Ubuntu Pastebin

Paste from Marco Trevisan (3v1n0) at Wed, 18 Jan 2017 16:48:22 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <ccs.h>
#include <gio/gio.h>

#include <iostream>
#include <string>

extern const CCSInterfaceTable ccsDefaultInterfaceTable;

int main(int argc, char **argv)
{
  auto context = ccsContextNew (0, &ccsDefaultInterfaceTable);

  if (!context || argc < 2)
    return -1;

  g_print("Current profile is %s\n", ccsGetProfile(context));

  CCSStringList profiles = ccsGetExistingProfiles(context);
  g_print("We've %u profiles\n",ccsStringListLength(profiles));

  for (unsigned i = 0; i < ccsStringListLength(profiles); ++i)
    g_print(" - %s\n",ccsStringListGetItem(profiles, i)->data->value);

  ccsSetProfile(context, argv[1]);
  ccsReadSettings(context);
  ccsWriteSettings(context);
  g_settings_sync();

  auto plugins = ccsContextGetPlugins(context);
  for (auto *p = plugins; p; p = p->next)
  {
    auto plugin = p->data;
    g_print(" - Updating %s\n", ccsPluginGetName(plugin));
    ccsReadPluginSettings(plugin);
  }

  ccsFreeContext(context);

  return 0;
}
Download as text