aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-05 18:36:42 -0400
committerTed Gould <ted@canonical.com>2009-10-05 18:36:42 -0400
commit3a5abcd25eee470e2c6b1fb8a29a6fff510f231e (patch)
tree8e8d629c1b2863e08a7398d6f03089574a8eabc6 /tools
parente3136699a6d00c24715326e2c9016f8b04425860 (diff)
downloadlibdbusmenu-3a5abcd25eee470e2c6b1fb8a29a6fff510f231e.tar.gz
libdbusmenu-3a5abcd25eee470e2c6b1fb8a29a6fff510f231e.tar.bz2
libdbusmenu-3a5abcd25eee470e2c6b1fb8a29a6fff510f231e.zip
Watching for the root changing and then using that to start profiling the dbusmenu
Diffstat (limited to 'tools')
-rw-r--r--tools/dbusmenu-dumper.c32
1 files changed, 24 insertions, 8 deletions
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 <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem.h>
+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;
}