Lots and lots of changes to bring ProjectUnity up to date, including a new
[wvapps.git] / unity / gconf / wvgtktest.cc
blob5bc4a7a446d67f4e121b5012329c4a6fabe63b23
1 /* Be clean and pure (yeah, right!) */
2 #define GTK_DISABLE_DEPRECATED
3 #define G_DISABLE_DEPRECATED
5 #include "wvglibstreamclone.h"
6 #include "wvtcp.h"
7 #include "wvistreamlist.h"
8 #include <gconf/gconf-client.h>
11 static void gconf_notify(GConfClient *client,
12 guint cnxn_id,
13 GConfEntry *entry,
14 gpointer user_data)
16 if (gconf_entry_get_value(entry) == NULL)
17 fprintf(stderr, "value is NULL\n");
18 else if (gconf_entry_get_value(entry)->type == GCONF_VALUE_STRING)
20 fprintf(stderr, "value is a string.\n");
21 fprintf(stderr, " ... '%s'\n", gconf_value_get_string(
22 gconf_entry_get_value(entry)));
24 else
25 fprintf(stderr, "value is something else!\n");
29 int main(int argc, char **argv)
31 guint notify_id;
33 WvIStreamList *list = new WvIStreamList;
34 WvTCPConn tcp("127.0.0.1", 4111);
35 list->append(&tcp, false);
36 list->append(wvcon, false);
37 tcp.autoforward(*wvcon);
38 wvcon->autoforward(tcp);
40 WvGlibStreamClone glibstream(NULL, list); // glibstream now owns list
42 g_type_init();
43 GConfClient *client = gconf_client_get_default();
45 gconf_client_add_dir(client, "/test",
46 GCONF_CLIENT_PRELOAD_NONE, NULL);
48 fprintf(stderr, "initial a: '%s'\n",
49 gconf_client_get_string(client, "/test/a", NULL));
51 notify_id = gconf_client_notify_add(client, "/test/a", gconf_notify,
52 0, NULL, NULL);
53 notify_id = gconf_client_notify_add(client, "/test/b", gconf_notify,
54 0, NULL, NULL);
56 GMainLoop *loop = g_main_loop_new(NULL, 0);
57 g_main_loop_run(loop);
59 g_object_unref(G_OBJECT(client));
60 return 0;