From 3a5abcd25eee470e2c6b1fb8a29a6fff510f231e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 5 Oct 2009 18:36:42 -0400 Subject: Watching for the root changing and then using that to start profiling the dbusmenu --- tools/dbusmenu-dumper.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index a4075f1..b0790c3 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -25,6 +25,27 @@ with this program. If not, see . #include #include +static GMainLoop * mainloop = NULL; + +static void +new_root_cb (DbusmenuClient * client, DbusmenuMenuitem * newroot) +{ + if (newroot == NULL) { + g_printerr("ERROR: Unable to create Dbusmenu Root\n"); + g_main_loop_quit(mainloop); + return; + } + + g_print("{\n"); + + g_print("}\n"); + + + + return; +} + + static gchar * dbusname = NULL; static gchar * dbusobject = NULL; @@ -98,15 +119,10 @@ main (int argc, char ** argv) return 1; } - DbusmenuMenuitem * root = dbusmenu_client_get_root(client); - if (root == NULL) { - g_printerr("ERROR: Unable to create Dbusmenu Root\n"); - return 1; - } - - g_print("{\n"); + g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(new_root_cb), NULL); - g_print("}\n"); + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); return 0; } -- cgit v1.2.3