From 62b0fccd725b4e3c7b01e39258fd64dfa1d6064d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 10:54:48 -0500 Subject: Changing from using a transform to getting the contents --- tools/dbusmenu-dumper.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 55d631e..68a21d9 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -36,11 +36,10 @@ print_menuitem (DbusmenuMenuitem * item, int depth) GList * properties = dbusmenu_menuitem_properties_list(item); GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { - GValue value = {0}; - g_value_init(&value, G_TYPE_STRING); - g_value_transform(dbusmenu_menuitem_property_get_value(item, (gchar *)property->data), &value); - g_print(",\n%s\"%s\": \"%s\"", space, (gchar *)property->data, g_value_get_string(&value)); - g_value_unset(&value); + const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); + gchar * str = g_strdup_value_contents(value); + g_print(",\n%s\"%s\": %s", space, (gchar *)property->data, str); + g_free(str); } g_list_free(properties); -- cgit v1.2.3 From e7ef77f7498d95f1f752aaca73f2dfdd935a0f44 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:07:31 -0500 Subject: Splitting out the collection printing. --- tools/dbusmenu-dumper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 68a21d9..38284b1 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -25,8 +25,16 @@ with this program. If not, see . #include #include +#include + static GMainLoop * mainloop = NULL; +static gchar * +collection_dumper (const GValue * value) +{ + return g_strdup(""); +} + static void print_menuitem (DbusmenuMenuitem * item, int depth) { @@ -37,7 +45,12 @@ print_menuitem (DbusmenuMenuitem * item, int depth) GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); - gchar * str = g_strdup_value_contents(value); + gchar * str = NULL; + if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { + str = collection_dumper(value); + } else { + str = g_strdup_value_contents(value); + } g_print(",\n%s\"%s\": %s", space, (gchar *)property->data, str); g_free(str); } -- cgit v1.2.3 From b13fe82d9d489e0c77cd4e8a9e09fce934d40865 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:14:28 -0500 Subject: Giving the depth as well so this can look nice. --- tools/dbusmenu-dumper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 38284b1..5790828 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -30,7 +30,7 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; static gchar * -collection_dumper (const GValue * value) +collection_dumper (const GValue * value, int depth) { return g_strdup(""); } @@ -47,7 +47,7 @@ print_menuitem (DbusmenuMenuitem * item, int depth) const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); gchar * str = NULL; if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { - str = collection_dumper(value); + str = collection_dumper(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2); } else { str = g_strdup_value_contents(value); } -- cgit v1.2.3 From 84e7a884a2f3c6bd480060235478beb50a38841e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:22:07 -0500 Subject: Printing more like we'd want a collection to print. --- tools/dbusmenu-dumper.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 5790828..1bf6e43 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -32,7 +32,19 @@ static GMainLoop * mainloop = NULL; static gchar * collection_dumper (const GValue * value, int depth) { - return g_strdup(""); + gchar * space = g_strnfill(depth, ' '); + GPtrArray * array = g_ptr_array_new_with_free_func(g_free); + + g_ptr_array_add(array, g_strdup("[\n")); + g_ptr_array_add(array, g_strdup_printf("%s\n", space)); + g_ptr_array_add(array, g_strdup_printf("%s]", space)); + + g_free(space); + + gchar * retstr = g_strjoinv(NULL, (gchar **)array->pdata); + g_ptr_array_free(array, TRUE); + + return retstr; } static void @@ -47,7 +59,7 @@ print_menuitem (DbusmenuMenuitem * item, int depth) const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); gchar * str = NULL; if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { - str = collection_dumper(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2); + str = collection_dumper(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2 /*quotes*/ + 2 /*: */); } else { str = g_strdup_value_contents(value); } -- cgit v1.2.3 From a359a31ffc36630c385ac9ebdf06b6f20e8401f6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:36:35 -0500 Subject: Now iterating through the collection and printing those entries out. --- tools/dbusmenu-dumper.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 1bf6e43..724ee25 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -29,15 +29,50 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; +typedef struct _collection_iterator_t collection_iterator_t; +struct _collection_iterator_t { + gchar * space; + GPtrArray * array; + gboolean first; +}; + +static void +collection_iterate (const GValue * value, gpointer user_data) +{ + collection_iterator_t * iter = (collection_iterator_t *)user_data; + + gchar * str = g_strdup_value_contents(value); + gchar * retval = NULL; + + if (iter->first) { + iter->first = FALSE; + retval = g_strdup_printf("\n%s%s", iter->space, str); + } else { + retval = g_strdup_printf(",\n%s%s", iter->space, str); + } + + g_ptr_array_add(iter->array, retval); + g_free(str); + + return; +} + static gchar * collection_dumper (const GValue * value, int depth) { gchar * space = g_strnfill(depth, ' '); GPtrArray * array = g_ptr_array_new_with_free_func(g_free); - g_ptr_array_add(array, g_strdup("[\n")); - g_ptr_array_add(array, g_strdup_printf("%s\n", space)); - g_ptr_array_add(array, g_strdup_printf("%s]", space)); + g_ptr_array_add(array, g_strdup("[")); + + collection_iterator_t iter; + iter.space = space; + iter.array = array; + iter.first = TRUE; + + dbus_g_type_collection_value_iterate(value, collection_iterate, &iter); + + g_ptr_array_add(array, g_strdup_printf("\n%s]", space)); g_free(space); -- cgit v1.2.3 From 84437fefcfda6157063210bbd9677298d62899b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:45:56 -0500 Subject: Handling the printing of strv's as well. --- tools/dbusmenu-dumper.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 724ee25..4ce1374 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -29,6 +29,17 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; +static gchar * +strv_dumper(const GValue * value) +{ + gchar ** strv = (gchar **)g_value_get_boxed(value); + + gchar * joined = g_strjoinv("\", \"", strv); + gchar * retval = g_strdup_printf("[\"%s\"]", joined); + g_free(joined); + return retval; +} + typedef struct _collection_iterator_t collection_iterator_t; struct _collection_iterator_t { gchar * space; @@ -41,7 +52,13 @@ collection_iterate (const GValue * value, gpointer user_data) { collection_iterator_t * iter = (collection_iterator_t *)user_data; - gchar * str = g_strdup_value_contents(value); + gchar * str; + if (G_VALUE_TYPE(value) == G_TYPE_STRV) { + str = strv_dumper(value); + } else { + str = g_strdup_value_contents(value); + } + gchar * retval = NULL; if (iter->first) { -- cgit v1.2.3 From 057503a47f2dff7ea4863ffc1df939556cc1753f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:51:19 -0500 Subject: Abstracting out the choosing of how to dump the value. --- tools/dbusmenu-dumper.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 4ce1374..6af344d 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -29,6 +29,8 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; +static gchar * value2string (const GValue * value, int depth); + static gchar * strv_dumper(const GValue * value) { @@ -45,6 +47,7 @@ struct _collection_iterator_t { gchar * space; GPtrArray * array; gboolean first; + int depth; }; static void @@ -52,13 +55,7 @@ collection_iterate (const GValue * value, gpointer user_data) { collection_iterator_t * iter = (collection_iterator_t *)user_data; - gchar * str; - if (G_VALUE_TYPE(value) == G_TYPE_STRV) { - str = strv_dumper(value); - } else { - str = g_strdup_value_contents(value); - } - + gchar * str = value2string(value, iter->depth); gchar * retval = NULL; if (iter->first) { @@ -86,6 +83,7 @@ collection_dumper (const GValue * value, int depth) iter.space = space; iter.array = array; iter.first = TRUE; + iter.depth = depth + 2; dbus_g_type_collection_value_iterate(value, collection_iterate, &iter); @@ -99,6 +97,22 @@ collection_dumper (const GValue * value, int depth) return retstr; } +static gchar * +value2string (const GValue * value, int depth) +{ + gchar * str = NULL; + + if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { + str = collection_dumper(value, depth); + } else if (G_VALUE_TYPE(value) == G_TYPE_STRV) { + str = strv_dumper(value); + } else { + str = g_strdup_value_contents(value); + } + + return str; +} + static void print_menuitem (DbusmenuMenuitem * item, int depth) { @@ -109,12 +123,7 @@ print_menuitem (DbusmenuMenuitem * item, int depth) GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); - gchar * str = NULL; - if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { - str = collection_dumper(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2 /*quotes*/ + 2 /*: */); - } else { - str = g_strdup_value_contents(value); - } + gchar * str = value2string(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2 /*quotes*/ + 2 /*: */); g_print(",\n%s\"%s\": %s", space, (gchar *)property->data, str); g_free(str); } -- cgit v1.2.3 From aea8d2664195b8d5b6b77817a70c5955f9f32a8c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:55:22 -0500 Subject: Optimizing the one item in the collection case (common for shortcuts) --- tools/dbusmenu-dumper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 6af344d..f0f4ba0 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -90,8 +90,14 @@ collection_dumper (const GValue * value, int depth) g_ptr_array_add(array, g_strdup_printf("\n%s]", space)); g_free(space); - - gchar * retstr = g_strjoinv(NULL, (gchar **)array->pdata); + + gchar * retstr = NULL; + if (array->len == 3) { + retstr = g_strdup_printf("[%s]", ((gchar *)array->pdata[1]) + depth + 1/*for newline*/); + } else { + retstr = g_strjoinv(NULL, (gchar **)array->pdata); + } + g_ptr_array_free(array, TRUE); return retstr; -- cgit v1.2.3 From a2d820e83b57e71a0b1305b52b1aff8162d6930d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 12:55:51 -0500 Subject: Adding an explicit null check. --- tools/dbusmenu-dumper.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index f0f4ba0..f2e2bec 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -108,6 +108,10 @@ value2string (const GValue * value, int depth) { gchar * str = NULL; + if (value == NULL) { + return g_strdup("(null)"); + } + if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { str = collection_dumper(value, depth); } else if (G_VALUE_TYPE(value) == G_TYPE_STRV) { -- cgit v1.2.3 From 3d291c9bd937b20511efbebb938b3a6b059e8b14 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 18:04:06 -0500 Subject: Have the proper case for booleans --- tools/dbusmenu-dumper.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index f2e2bec..6ce9655 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -116,6 +116,12 @@ value2string (const GValue * value, int depth) str = collection_dumper(value, depth); } else if (G_VALUE_TYPE(value) == G_TYPE_STRV) { str = strv_dumper(value); + } else if (G_VALUE_TYPE(value) == G_TYPE_BOOLEAN) { + if (g_value_get_boolean(value)) { + str = g_strdup("true"); + } else { + str = g_strdup("false"); + } } else { str = g_strdup_value_contents(value); } -- cgit v1.2.3 From 9f4213d9d59c84c9c4811a69ee50d4baaab6dc58 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Mon, 19 Jul 2010 12:53:38 +0200 Subject: Started to implement click-to-dump --- tools/Makefile.am | 4 +- tools/dbusmenu-dumper.c | 129 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 122 insertions(+), 11 deletions(-) (limited to 'tools') diff --git a/tools/Makefile.am b/tools/Makefile.am index 77d6eef..a36d224 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -10,11 +10,11 @@ dbusmenu_dumper_SOURCES = \ dbusmenu_dumper_CFLAGS = \ -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -Wall -Werror + $(DBUSMENUGLIB_CFLAGS) -I/usr/include/dbus-1.0 -Wall -Werror dbusmenu_dumper_LDADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) + $(DBUSMENUGLIB_LIBS) -lX11 -ldbus-glib-1 doc_DATA = README.dbusmenu-bench diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 55d631e..4a0dd03 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -21,10 +21,13 @@ with this program. If not, see . */ #include +#include #include #include +#include + static GMainLoop * mainloop = NULL; static void @@ -90,10 +93,104 @@ new_root_cb (DbusmenuClient * client, DbusmenuMenuitem * newroot) return; } +static Window +find_real_window(Display * display, Window w, int depth) +{ + if (depth > 5) { + return None; + } + /*static*/ Atom wm_state = XInternAtom(display, "WM_STATE", False); + Atom type; + int format; + unsigned long nitems, after; + unsigned char* prop; + if (XGetWindowProperty(display, w, wm_state, 0, 0, False, AnyPropertyType, + &type, &format, &nitems, &after, &prop) == Success) { + if (prop != NULL) { + XFree(prop); + } + if (type != None) { + return w; + } + } + Window root, parent; + Window* children; + unsigned int nchildren; + Window ret = None; + if (XQueryTree(display, w, &root, &parent, &children, &nchildren) != 0) { + unsigned int i; + for(i = 0; i < nchildren && ret == None; ++i) { + ret = find_real_window(display, children[ i ], depth + 1); + } + if (children != NULL) { + XFree(children); + } + } + return ret; +} + +static Window +get_window_under_cursor() +{ + Display * display = XOpenDisplay(NULL); + g_return_val_if_fail(display != NULL, None); + + Window root; + Window child; + uint mask; + int rootX, rootY, winX, winY; + XGrabServer(display); + Window root_window = DefaultRootWindow(display); + XQueryPointer(display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &mask); + if (child == None) { + return None; + } + return find_real_window(display, child, 0); +} static gchar * dbusname = NULL; static gchar * dbusobject = NULL; +static gboolean +init_dbus_vars_from_window(Window window) +{ + DBusGConnection *connection; + GError *error; + DBusGProxy *proxy; + + error = NULL; + connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (connection == NULL) { + g_printerr("Failed to open connection to bus: %s\n", error->message); + g_error_free(error); + return FALSE; + } + + proxy = dbus_g_proxy_new_for_name (connection, + "org.ayatana.AppMenu.Registrar", + "/org/ayatana/AppMenu/Registrar", + "org.ayatana.AppMenu.Registrar"); + + error = NULL; + if (!dbus_g_proxy_call (proxy, "GetMenuForWindow", &error, + G_TYPE_UINT, window, G_TYPE_INVALID, + G_TYPE_STRING, &dbusname, DBUS_TYPE_G_OBJECT_PATH, &dbusobject, G_TYPE_INVALID)) + { + g_printerr("ERROR: %s\n", error->message); + g_error_free(error); + g_object_unref(proxy); + return FALSE; + } + + if (!g_strcmp0(dbusobject, "/")) { + return FALSE; + } + + g_object_unref (proxy); + + return TRUE; +} + static gboolean option_dbusname (const gchar * arg, const gchar * value, gpointer data, GError ** error) { @@ -147,16 +244,30 @@ main (int argc, char ** argv) return 1; } - if (dbusname == NULL) { - g_printerr("ERROR: dbus-name not specified\n"); - usage(); - return 1; - } + if (dbusname == NULL && dbusobject == NULL) { + Window window = get_window_under_cursor(); + if (window == None) { + g_printerr("ERROR: could not get the id for the pointed window\n"); + return 1; + } + g_debug("window: %u", (unsigned int)window); + if (!init_dbus_vars_from_window(window)) { + g_printerr("ERROR: could not find a menu for the pointed window\n"); + return 1; + } + g_debug("dbusname: %s, dbusobject: %s", dbusname, dbusobject); + } else { + if (dbusname == NULL) { + g_printerr("ERROR: dbus-name not specified\n"); + usage(); + return 1; + } - if (dbusobject == NULL) { - g_printerr("ERROR: dbus-object not specified\n"); - usage(); - return 1; + if (dbusobject == NULL) { + g_printerr("ERROR: dbus-object not specified\n"); + usage(); + return 1; + } } DbusmenuClient * client = dbusmenu_client_new (dbusname, dbusobject); -- cgit v1.2.3 From 6da7a3341f028d913fd3ad01d47a59f436b5e780 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Mon, 19 Jul 2010 17:21:38 +0200 Subject: Use pkgconfig to find libx11 --- configure.ac | 9 +++++++++ tools/Makefile.am | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/configure.ac b/configure.ac index b88d96d..99911fa 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,15 @@ PKG_CHECK_MODULES(DBUSMENUGTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION AC_SUBST(DBUSMENUGTK_CFLAGS) AC_SUBST(DBUSMENUGTK_LIBS) +########################### +# Dependencies - tools +########################### + +PKG_CHECK_MODULES(DBUSMENUTOOLS, x11) + +AC_SUBST(DBUSMENUTOOLS_CFLAGS) +AC_SUBST(DBUSMENUTOOLS_LIBS) + ########################### # Dependencies - Testing ########################### diff --git a/tools/Makefile.am b/tools/Makefile.am index a36d224..3cd5538 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -10,11 +10,11 @@ dbusmenu_dumper_SOURCES = \ dbusmenu_dumper_CFLAGS = \ -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) -I/usr/include/dbus-1.0 -Wall -Werror + $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUTOOLS_CFLAGS) -Wall -Werror dbusmenu_dumper_LDADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) -lX11 -ldbus-glib-1 + $(DBUSMENUGLIB_LIBS) $(DBUSMENUTOOLS_LIBS) doc_DATA = README.dbusmenu-bench -- cgit v1.2.3 From 646c74694e86d6e5d479028a7dbd8cf9a1aca37a Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Tue, 20 Jul 2010 14:51:23 +0200 Subject: Ripped some code from wnckprop to do proper click-to-dump --- configure.ac | 11 ++++-- tools/Makefile.am | 4 +- tools/dbusmenu-dumper.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/configure.ac b/configure.ac index 99911fa..2e95d55 100644 --- a/configure.ac +++ b/configure.ac @@ -51,13 +51,16 @@ AC_SUBST(DBUSMENUGTK_CFLAGS) AC_SUBST(DBUSMENUGTK_LIBS) ########################### -# Dependencies - tools +# Dependencies - dumper ########################### -PKG_CHECK_MODULES(DBUSMENUTOOLS, x11) +X11_REQUIRED_VERSION=1.3 -AC_SUBST(DBUSMENUTOOLS_CFLAGS) -AC_SUBST(DBUSMENUTOOLS_LIBS) +PKG_CHECK_MODULES(DBUSMENUDUMPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION + x11 >= $X11_REQUIRED_VERSION) + +AC_SUBST(DBUSMENUDUMPER_CFLAGS) +AC_SUBST(DBUSMENUDUMPER_LIBS) ########################### # Dependencies - Testing diff --git a/tools/Makefile.am b/tools/Makefile.am index 3cd5538..ab7a598 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -10,11 +10,11 @@ dbusmenu_dumper_SOURCES = \ dbusmenu_dumper_CFLAGS = \ -I $(srcdir)/.. \ - $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUTOOLS_CFLAGS) -Wall -Werror + $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUDUMPER_CFLAGS) -Wall -Werror dbusmenu_dumper_LDADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGLIB_LIBS) $(DBUSMENUTOOLS_LIBS) + $(DBUSMENUGLIB_LIBS) $(DBUSMENUDUMPER_LIBS) doc_DATA = README.dbusmenu-bench diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 4a0dd03..3a47f21 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -23,6 +23,10 @@ with this program. If not, see . #include #include +#include +#include +#include + #include #include @@ -93,6 +97,12 @@ new_root_cb (DbusmenuClient * client, DbusmenuMenuitem * newroot) return; } +/* Window clicking ***************************************************/ +static GdkFilterReturn +click_filter (GdkXEvent *gdk_xevent, + GdkEvent *event, + gpointer data); + static Window find_real_window(Display * display, Window w, int depth) { @@ -148,6 +158,91 @@ get_window_under_cursor() return find_real_window(display, child, 0); } +static void +uninstall_click_filter (void) +{ + GdkWindow *root; + + root = gdk_get_default_root_window (); + gdk_window_remove_filter (root, (GdkFilterFunc) click_filter, NULL); + + gdk_pointer_ungrab (GDK_CURRENT_TIME); + gdk_keyboard_ungrab (GDK_CURRENT_TIME); + + gtk_main_quit (); +} + +static GdkFilterReturn +click_filter (GdkXEvent *gdk_xevent, + GdkEvent *event, + gpointer data) + +{ + XEvent *xevent = (XEvent *) gdk_xevent; + gboolean *success = (gboolean *)data; + + switch (xevent->type) { + case ButtonPress: + uninstall_click_filter(); + *success = TRUE; + return GDK_FILTER_REMOVE; + case KeyPress: + if (xevent->xkey.keycode == XKeysymToKeycode(gdk_display, XK_Escape)) { + uninstall_click_filter(); + *success = FALSE; + return GDK_FILTER_REMOVE; + } + break; + default: + break; + } + + return GDK_FILTER_CONTINUE; +} + +static gboolean +install_click_filter (gpointer data) +{ + GdkGrabStatus status; + GdkCursor *cross; + GdkWindow *root; + + root = gdk_get_default_root_window(); + + gdk_window_add_filter(root, (GdkFilterFunc) click_filter, data); + + cross = gdk_cursor_new(GDK_CROSS); + status = gdk_pointer_grab(root, FALSE, GDK_BUTTON_PRESS_MASK, + NULL, cross, GDK_CURRENT_TIME); + gdk_cursor_unref(cross); + + if (status != GDK_GRAB_SUCCESS) { + g_warning("Pointer grab failed.\n"); + uninstall_click_filter(); + return FALSE; + } + + status = gdk_keyboard_grab(root, FALSE, GDK_CURRENT_TIME); + if (status != GDK_GRAB_SUCCESS) { + g_warning("Keyboard grab failed.\n"); + uninstall_click_filter(); + return FALSE; + } + + gdk_flush(); + return FALSE; +} + +static gboolean +wait_for_click (int argc, char **argv) +{ + gtk_init(&argc, &argv); + gboolean success; + g_idle_add (install_click_filter, (gpointer)(&success)); + gtk_main (); + return success; +} + static gchar * dbusname = NULL; static gchar * dbusobject = NULL; @@ -191,6 +286,7 @@ init_dbus_vars_from_window(Window window) return TRUE; } +/* Option parser *****************************************************/ static gboolean option_dbusname (const gchar * arg, const gchar * value, gpointer data, GError ** error) { @@ -245,6 +341,9 @@ main (int argc, char ** argv) } if (dbusname == NULL && dbusobject == NULL) { + if (!wait_for_click(argc, argv)) { + return 1; + } Window window = get_window_under_cursor(); if (window == None) { g_printerr("ERROR: could not get the id for the pointed window\n"); @@ -256,6 +355,7 @@ main (int argc, char ** argv) return 1; } g_debug("dbusname: %s, dbusobject: %s", dbusname, dbusobject); + return 1; } else { if (dbusname == NULL) { g_printerr("ERROR: dbus-name not specified\n"); -- cgit v1.2.3 From 463b05a77a8e21e60ffe197f58461b0fb02ed930 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Tue, 20 Jul 2010 14:58:16 +0200 Subject: Clean up --- tools/dbusmenu-dumper.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 3a47f21..4ddb057 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -104,17 +104,17 @@ click_filter (GdkXEvent *gdk_xevent, gpointer data); static Window -find_real_window(Display * display, Window w, int depth) +find_real_window (Window w, int depth) { if (depth > 5) { return None; } - /*static*/ Atom wm_state = XInternAtom(display, "WM_STATE", False); + /*static*/ Atom wm_state = XInternAtom(gdk_display, "WM_STATE", False); Atom type; int format; unsigned long nitems, after; unsigned char* prop; - if (XGetWindowProperty(display, w, wm_state, 0, 0, False, AnyPropertyType, + if (XGetWindowProperty(gdk_display, w, wm_state, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &prop) == Success) { if (prop != NULL) { XFree(prop); @@ -127,10 +127,10 @@ find_real_window(Display * display, Window w, int depth) Window* children; unsigned int nchildren; Window ret = None; - if (XQueryTree(display, w, &root, &parent, &children, &nchildren) != 0) { + if (XQueryTree(gdk_display, w, &root, &parent, &children, &nchildren) != 0) { unsigned int i; for(i = 0; i < nchildren && ret == None; ++i) { - ret = find_real_window(display, children[ i ], depth + 1); + ret = find_real_window(children[ i ], depth + 1); } if (children != NULL) { XFree(children); @@ -140,22 +140,17 @@ find_real_window(Display * display, Window w, int depth) } static Window -get_window_under_cursor() +get_window_under_cursor (void) { - Display * display = XOpenDisplay(NULL); - g_return_val_if_fail(display != NULL, None); - Window root; Window child; uint mask; int rootX, rootY, winX, winY; - XGrabServer(display); - Window root_window = DefaultRootWindow(display); - XQueryPointer(display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &mask); + XQueryPointer(gdk_display, gdk_x11_get_default_root_xwindow(), &root, &child, &rootX, &rootY, &winX, &winY, &mask); if (child == None) { return None; } - return find_real_window(display, child, 0); + return find_real_window(child, 0); } static void @@ -234,9 +229,8 @@ install_click_filter (gpointer data) } static gboolean -wait_for_click (int argc, char **argv) +wait_for_click (void) { - gtk_init(&argc, &argv); gboolean success; g_idle_add (install_click_filter, (gpointer)(&success)); gtk_main (); @@ -341,7 +335,8 @@ main (int argc, char ** argv) } if (dbusname == NULL && dbusobject == NULL) { - if (!wait_for_click(argc, argv)) { + gtk_init(&argc, &argv); + if (!wait_for_click()) { return 1; } Window window = get_window_under_cursor(); -- cgit v1.2.3 From 70961ba202ced579d434e19f185f442684814722 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Tue, 20 Jul 2010 15:03:39 +0200 Subject: Unbreak command line parser --- tools/dbusmenu-dumper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 4ddb057..82ca5c1 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -314,7 +314,8 @@ usage (void) static GOptionEntry general_options[] = { {"dbus-name", 'd', 0, G_OPTION_ARG_CALLBACK, option_dbusname, "The name of the program to connect to (i.e. org.test.bob", "dbusname"}, - {"dbus-object", 'o', 0, G_OPTION_ARG_CALLBACK, option_dbusobject, "The path to the Dbus object (i.e /org/test/bob/alvin)", "dbusobject"} + {"dbus-object", 'o', 0, G_OPTION_ARG_CALLBACK, option_dbusobject, "The path to the Dbus object (i.e /org/test/bob/alvin)", "dbusobject"}, + {NULL} }; int @@ -350,7 +351,6 @@ main (int argc, char ** argv) return 1; } g_debug("dbusname: %s, dbusobject: %s", dbusname, dbusobject); - return 1; } else { if (dbusname == NULL) { g_printerr("ERROR: dbus-name not specified\n"); -- cgit v1.2.3 From a68fa500006320df74beb336c5daf2f2f0950560 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Thu, 5 Aug 2010 19:05:51 +0200 Subject: debug-- --- tools/dbusmenu-dumper.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 40ab1e1..9e66236 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -445,12 +445,10 @@ main (int argc, char ** argv) g_printerr("ERROR: could not get the id for the pointed window\n"); return 1; } - g_debug("window: %u", (unsigned int)window); if (!init_dbus_vars_from_window(window)) { g_printerr("ERROR: could not find a menu for the pointed window\n"); return 1; } - g_debug("dbusname: %s, dbusobject: %s", dbusname, dbusobject); } else { if (dbusname == NULL) { g_printerr("ERROR: dbus-name not specified\n"); -- cgit v1.2.3 From e22b44483407aac56d6b50705bed890038e469a2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Aug 2010 11:11:13 -0500 Subject: Making the dumper sort the properties to make it more predictable. --- tests/test-json-01.json | 386 ++++++++++++++++++++++++------------------------ tools/dbusmenu-dumper.c | 9 +- 2 files changed, 201 insertions(+), 194 deletions(-) (limited to 'tools') diff --git a/tests/test-json-01.json b/tests/test-json-01.json index 88e1cbf..08e9112 100644 --- a/tests/test-json-01.json +++ b/tests/test-json-01.json @@ -4,30 +4,30 @@ "submenu": [ { "id": 5, + "children-display": "submenu", "enabled": true, "label": "File", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 6, - "shortcut": [["Control", "q"]], "enabled": true, "label": "Quit", + "shortcut": [["Control", "q"]], "visible": true }, { "id": 7, - "shortcut": [["Control", "Shift", "w"]], "enabled": true, "label": "Close all", + "shortcut": [["Control", "Shift", "w"]], "visible": true }, { "id": 8, - "shortcut": [["Control", "w"]], "enabled": true, "label": "Close", + "shortcut": [["Control", "w"]], "visible": true }, { @@ -42,9 +42,9 @@ }, { "id": 11, - "shortcut": [["Control", "p"]], "enabled": true, "label": "Print...", + "shortcut": [["Control", "p"]], "visible": true }, { @@ -77,16 +77,16 @@ }, { "id": 17, - "shortcut": [["Control", "Shift", "s"]], "enabled": true, "label": "Save As...", + "shortcut": [["Control", "Shift", "s"]], "visible": true }, { "id": 18, - "shortcut": [["Control", "s"]], "enabled": true, "label": "Save", + "shortcut": [["Control", "s"]], "visible": true }, { @@ -95,9 +95,9 @@ }, { "id": 20, + "children-display": "submenu", "enabled": true, "label": "Open Recent", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -112,16 +112,16 @@ }, { "id": 23, - "shortcut": [["Control", "2"]], "enabled": true, "label": "giggity.jpg", + "shortcut": [["Control", "2"]], "visible": true }, { "id": 24, - "shortcut": [["Control", "1"]], "enabled": true, "label": "Icon Height.svg", + "shortcut": [["Control", "1"]], "visible": true } ] @@ -134,37 +134,37 @@ }, { "id": 26, - "shortcut": [["Control", "Alt", "o"]], "enabled": true, "label": "Open as Layers...", + "shortcut": [["Control", "Alt", "o"]], "visible": true }, { "id": 27, - "shortcut": [["Control", "o"]], "enabled": true, "label": "Open...", + "shortcut": [["Control", "o"]], "visible": true }, { "id": 28, + "children-display": "submenu", "enabled": true, "label": "Create", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 29, + "children-display": "submenu", "enabled": true, "label": "Web Page Themes", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 30, + "children-display": "submenu", "enabled": true, "label": "Classic.Gimp.Org", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -207,9 +207,9 @@ }, { "id": 37, + "children-display": "submenu", "enabled": true, "label": "Beveled Pattern", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -246,9 +246,9 @@ }, { "id": 43, + "children-display": "submenu", "enabled": true, "label": "Alien Glow", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -281,9 +281,9 @@ }, { "id": 48, + "children-display": "submenu", "enabled": true, "label": "Patterns", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -338,9 +338,9 @@ }, { "id": 57, + "children-display": "submenu", "enabled": true, "label": "Logos", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -515,9 +515,9 @@ }, { "id": 86, + "children-display": "submenu", "enabled": true, "label": "Buttons", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -540,9 +540,9 @@ }, { "id": 90, + "children-display": "submenu", "enabled": true, "label": "xscanimage", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -561,27 +561,27 @@ }, { "id": 93, - "shortcut": [["Control", "Shift", "v"]], "enabled": true, "label": "From Clipboard", + "shortcut": [["Control", "Shift", "v"]], "visible": true } ] }, { "id": 94, - "shortcut": [["Control", "n"]], "enabled": true, "label": "New...", + "shortcut": [["Control", "n"]], "visible": true } ] }, { "id": 95, + "children-display": "submenu", "enabled": true, "label": "Edit", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -626,30 +626,30 @@ }, { "id": 103, - "shortcut": [["Control", "semicolon"]], "enabled": true, "label": "Fill with Pattern", + "shortcut": [["Control", "semicolon"]], "visible": true }, { "id": 104, - "shortcut": [["Control", "period"]], "enabled": true, "label": "Fill with BG Color", + "shortcut": [["Control", "period"]], "visible": true }, { "id": 105, - "shortcut": [["Control", "comma"]], "enabled": true, "label": "Fill with FG Color", + "shortcut": [["Control", "comma"]], "visible": true }, { "id": 106, - "shortcut": [["Delete"]], "enabled": true, "label": "Clear", + "shortcut": [["Delete"]], "visible": true }, { @@ -658,9 +658,9 @@ }, { "id": 108, + "children-display": "submenu", "enabled": true, "label": "Buffer", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -691,9 +691,9 @@ }, { "id": 113, + "children-display": "submenu", "enabled": true, "label": "Paste as", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -716,9 +716,9 @@ }, { "id": 117, - "shortcut": [["Control", "Shift", "v"]], "enabled": true, "label": "New Image", + "shortcut": [["Control", "Shift", "v"]], "visible": true } ] @@ -731,30 +731,30 @@ }, { "id": 119, - "shortcut": [["Control", "v"]], "enabled": true, "label": "Paste", + "shortcut": [["Control", "v"]], "visible": true }, { "id": 120, - "shortcut": [["Control", "Shift", "c"]], "enabled": true, "label": "Copy Visible", + "shortcut": [["Control", "Shift", "c"]], "visible": true }, { "id": 121, - "shortcut": [["Control", "c"]], "enabled": true, "label": "Copy", + "shortcut": [["Control", "c"]], "visible": true }, { "id": 122, - "shortcut": [["Control", "x"]], "enabled": true, "label": "Cut", + "shortcut": [["Control", "x"]], "visible": true }, { @@ -775,25 +775,25 @@ }, { "id": 2, - "shortcut": [["Control", "y"]], "enabled": false, "label": "_Redo", + "shortcut": [["Control", "y"]], "visible": true }, { "id": 1, - "shortcut": [["Control", "z"]], "enabled": false, "label": "_Undo", + "shortcut": [["Control", "z"]], "visible": true } ] }, { "id": 125, + "children-display": "submenu", "enabled": true, "label": "Select", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -810,10 +810,10 @@ }, { "id": 128, - "shortcut": [["Shift", "q"]], "enabled": true, - "toggle-state": 0, "label": "Toggle Quick Mask", + "shortcut": [["Shift", "q"]], + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -869,93 +869,93 @@ }, { "id": 138, - "shortcut": [["Shift", "v"]], "enabled": false, "label": "From Path", + "shortcut": [["Shift", "v"]], "visible": true }, { "id": 139, - "shortcut": [["Shift", "o"]], "enabled": true, "label": "By Color", + "shortcut": [["Shift", "o"]], "visible": true }, { "id": 140, - "shortcut": [["Control", "Shift", "l"]], "enabled": false, "label": "Float", + "shortcut": [["Control", "Shift", "l"]], "visible": true }, { "id": 141, - "shortcut": [["Control", "i"]], "enabled": true, "label": "Invert", + "shortcut": [["Control", "i"]], "visible": true }, { "id": 142, - "shortcut": [["Control", "Shift", "a"]], "enabled": false, "label": "None", + "shortcut": [["Control", "Shift", "a"]], "visible": true }, { "id": 143, - "shortcut": [["Control", "a"]], "enabled": true, "label": "All", + "shortcut": [["Control", "a"]], "visible": true } ] }, { "id": 144, + "children-display": "submenu", "enabled": true, "label": "View", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 145, "enabled": true, - "toggle-state": 1, "label": "Show Statusbar", + "toggle-state": 1, "toggle-type": "checkmark", "visible": true }, { "id": 146, "enabled": true, - "toggle-state": 0, "label": "Show Scrollbars", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 147, - "shortcut": [["Control", "Shift", "r"]], "enabled": true, - "toggle-state": 0, "label": "Show Rulers", + "shortcut": [["Control", "Shift", "r"]], + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 148, "enabled": true, - "toggle-state": 1, "label": "Show Menubar", + "toggle-state": 1, "toggle-type": "checkmark", "visible": true }, { "id": 149, + "children-display": "submenu", "enabled": true, "label": "Padding Color", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1001,32 +1001,32 @@ { "id": 157, "enabled": true, - "toggle-state": 0, "label": "Snap to Active Path", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 158, "enabled": true, - "toggle-state": 0, "label": "Snap to Canvas Edges", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 159, "enabled": true, - "toggle-state": 0, "label": "Snap to Grid", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 160, "enabled": true, - "toggle-state": 1, "label": "Snap to Guides", + "toggle-state": 1, "toggle-type": "checkmark", "visible": true }, @@ -1037,42 +1037,42 @@ { "id": 162, "enabled": true, - "toggle-state": 0, "label": "Show Sample Points", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 163, "enabled": true, - "toggle-state": 0, "label": "Show Grid", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 164, - "shortcut": [["Control", "Shift", "t"]], "enabled": true, - "toggle-state": 0, "label": "Show Guides", + "shortcut": [["Control", "Shift", "t"]], + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 165, "enabled": true, - "toggle-state": 0, "label": "Show Layer Boundary", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 166, - "shortcut": [["Control", "t"]], "enabled": true, - "toggle-state": 0, "label": "Show Selection", + "shortcut": [["Control", "t"]], + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -1098,12 +1098,12 @@ }, { "id": 171, + "children-display": "submenu", "enabled": true, + "label": "Fullscreen", "shortcut": [["F11"]], "toggle-state": 0, - "label": "Fullscreen", "toggle-type": "checkmark", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1116,9 +1116,9 @@ }, { "id": 173, - "shortcut": [["Control", "e"]], "enabled": true, "label": "Shrink Wrap", + "shortcut": [["Control", "e"]], "visible": true }, { @@ -1127,16 +1127,16 @@ }, { "id": 175, + "children-display": "submenu", "enabled": true, "label": "_Zoom (67%)", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 176, "enabled": true, - "toggle-state": 0, "label": "Othe_r (67%)...", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -1147,73 +1147,73 @@ { "id": 178, "enabled": true, - "toggle-state": 0, "label": "1:16 (6.25%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 179, "enabled": true, - "toggle-state": 0, "label": "1:8 (12.5%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 180, "enabled": true, - "toggle-state": 0, "label": "1:4 (25%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 181, "enabled": true, - "toggle-state": 0, "label": "1:2 (50%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 182, - "shortcut": [["1"]], "enabled": true, - "toggle-state": 1, "label": "1:1 (100%)", + "shortcut": [["1"]], + "toggle-state": 1, "toggle-type": "checkmark", "visible": true }, { "id": 183, "enabled": true, - "toggle-state": 0, "label": "2:1 (200%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 184, "enabled": true, - "toggle-state": 0, "label": "4:1 (400%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 185, "enabled": true, - "toggle-state": 0, "label": "8:1 (800%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 186, "enabled": true, - "toggle-state": 0, "label": "16:1 (1600%)", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -1229,30 +1229,30 @@ }, { "id": 189, - "shortcut": [["Control", "Shift", "e"]], "enabled": true, "label": "Fit Image in Window", + "shortcut": [["Control", "Shift", "e"]], "visible": true }, { "id": 190, - "shortcut": [["plus"]], "enabled": true, "label": "Zoom In", + "shortcut": [["plus"]], "visible": true }, { "id": 191, - "shortcut": [["minus"]], "enabled": true, "label": "Zoom Out", + "shortcut": [["minus"]], "visible": true }, { "id": 4, - "shortcut": [["grave"]], "enabled": true, "label": "Re_vert Zoom (67%)", + "shortcut": [["grave"]], "visible": true } ] @@ -1260,8 +1260,8 @@ { "id": 192, "enabled": true, - "toggle-state": 1, "label": "Dot for Dot", + "toggle-state": 1, "toggle-type": "checkmark", "visible": true }, @@ -1275,16 +1275,16 @@ }, { "id": 194, + "children-display": "submenu", "enabled": true, "label": "Image", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 195, - "shortcut": [["Alt", "Return"]], "enabled": true, "label": "Image Properties", + "shortcut": [["Alt", "Return"]], "visible": true }, { @@ -1295,9 +1295,9 @@ }, { "id": 197, + "children-display": "submenu", "enabled": true, "label": "Guides", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1344,9 +1344,9 @@ }, { "id": 205, - "shortcut": [["Control", "m"]], "enabled": true, "label": "Merge Visible Layers...", + "shortcut": [["Control", "m"]], "visible": true }, { @@ -1411,9 +1411,9 @@ }, { "id": 217, + "children-display": "submenu", "enabled": true, "label": "Transform", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1464,9 +1464,9 @@ }, { "id": 226, + "children-display": "submenu", "enabled": true, "label": "Mode", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1488,24 +1488,24 @@ { "id": 230, "enabled": true, - "toggle-state": 0, "label": "Indexed...", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 231, "enabled": true, - "toggle-state": 0, "label": "Grayscale", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 232, "enabled": true, - "toggle-state": 1, "label": "RGB", + "toggle-state": 1, "toggle-type": "checkmark", "visible": true } @@ -1513,18 +1513,18 @@ }, { "id": 233, - "shortcut": [["Control", "d"]], "enabled": true, "label": "Duplicate", + "shortcut": [["Control", "d"]], "visible": true } ] }, { "id": 234, + "children-display": "submenu", "enabled": true, "label": "Layer", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1563,16 +1563,16 @@ }, { "id": 241, + "children-display": "submenu", "enabled": true, "label": "Transform", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 242, - "shortcut": [["Control", "Shift", "o"]], "enabled": true, "label": "Offset...", + "shortcut": [["Control", "Shift", "o"]], "visible": true }, { @@ -1623,9 +1623,9 @@ }, { "id": 251, + "children-display": "submenu", "enabled": true, "label": "Transparency", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1690,9 +1690,9 @@ }, { "id": 262, + "children-display": "submenu", "enabled": true, "label": "Mask", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1726,24 +1726,24 @@ { "id": 268, "enabled": false, - "toggle-state": 0, "label": "Disable Layer Mask", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 269, "enabled": false, - "toggle-state": 0, "label": "Edit Layer Mask", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, { "id": 270, "enabled": false, - "toggle-state": 0, "label": "Show Layer Mask", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -1773,9 +1773,9 @@ }, { "id": 275, + "children-display": "submenu", "enabled": true, "label": "Stack", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1818,38 +1818,38 @@ }, { "id": 283, - "shortcut": [["End"]], "enabled": false, "label": "Select Bottom Layer", + "shortcut": [["End"]], "visible": true }, { "id": 284, - "shortcut": [["Home"]], "enabled": false, "label": "Select Top Layer", + "shortcut": [["Home"]], "visible": true }, { "id": 285, - "shortcut": [["Page_Down"]], "enabled": false, "label": "Select Next Layer", + "shortcut": [["Page_Down"]], "visible": true }, { "id": 286, - "shortcut": [["Page_Up"]], "enabled": false, "label": "Select Previous Layer", + "shortcut": [["Page_Up"]], "visible": true } ] }, { "id": 287, - "type": "separator", "children-display": "submenu", + "type": "separator", "submenu": [ { "id": 288, @@ -1873,16 +1873,16 @@ }, { "id": 291, - "shortcut": [["Control", "h"]], "enabled": false, "label": "Anchor Layer", + "shortcut": [["Control", "h"]], "visible": true }, { "id": 292, - "shortcut": [["Control", "Shift", "d"]], "enabled": true, "label": "Duplicate Layer", + "shortcut": [["Control", "Shift", "d"]], "visible": true }, { @@ -1893,18 +1893,18 @@ }, { "id": 294, - "shortcut": [["Control", "Shift", "n"]], "enabled": true, "label": "New Layer...", + "shortcut": [["Control", "Shift", "n"]], "visible": true } ] }, { "id": 295, + "children-display": "submenu", "enabled": true, "label": "Colors", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1949,9 +1949,9 @@ }, { "id": 303, + "children-display": "submenu", "enabled": true, "label": "Info", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -1982,9 +1982,9 @@ }, { "id": 308, + "children-display": "submenu", "enabled": true, "label": "Map", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2043,9 +2043,9 @@ }, { "id": 318, + "children-display": "submenu", "enabled": true, "label": "Components", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2076,9 +2076,9 @@ }, { "id": 323, + "children-display": "submenu", "enabled": true, "label": "Auto", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2126,8 +2126,8 @@ { "id": 331, "enabled": true, - "toggle-state": 0, "label": "Use GEGL", + "toggle-state": 0, "toggle-type": "checkmark", "visible": true }, @@ -2209,30 +2209,30 @@ }, { "id": 345, + "children-display": "submenu", "enabled": true, "label": "Tools", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 346, - "shortcut": [["x"]], "enabled": true, "label": "Swap Colors", + "shortcut": [["x"]], "visible": true }, { "id": 347, - "shortcut": [["d"]], "enabled": true, "label": "Default Colors", + "shortcut": [["d"]], "visible": true }, { "id": 348, - "shortcut": [["Control", "b"]], "enabled": true, "label": "Toolbox", + "shortcut": [["Control", "b"]], "visible": true }, { @@ -2247,44 +2247,44 @@ }, { "id": 351, - "shortcut": [["t"]], "enabled": true, "label": "Text", + "shortcut": [["t"]], "visible": true }, { "id": 352, - "shortcut": [["Shift", "m"]], "enabled": true, "label": "Measure", + "shortcut": [["Shift", "m"]], "visible": true }, { "id": 353, - "shortcut": [["z"]], "enabled": true, "label": "Zoom", + "shortcut": [["z"]], "visible": true }, { "id": 354, - "shortcut": [["o"]], "enabled": true, "label": "Color Picker", + "shortcut": [["o"]], "visible": true }, { "id": 355, - "shortcut": [["b"]], "enabled": true, "label": "Paths", + "shortcut": [["b"]], "visible": true }, { "id": 356, + "children-display": "submenu", "enabled": true, "label": "Color Tools", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2345,95 +2345,95 @@ }, { "id": 366, + "children-display": "submenu", "enabled": true, "label": "Transform Tools", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 367, - "shortcut": [["Shift", "f"]], "enabled": true, "label": "Flip", + "shortcut": [["Shift", "f"]], "visible": true }, { "id": 368, - "shortcut": [["Shift", "p"]], "enabled": true, "label": "Perspective", + "shortcut": [["Shift", "p"]], "visible": true }, { "id": 369, - "shortcut": [["Shift", "s"]], "enabled": true, "label": "Shear", + "shortcut": [["Shift", "s"]], "visible": true }, { "id": 370, - "shortcut": [["Shift", "t"]], "enabled": true, "label": "Scale", + "shortcut": [["Shift", "t"]], "visible": true }, { "id": 371, - "shortcut": [["Shift", "r"]], "enabled": true, "label": "Rotate", + "shortcut": [["Shift", "r"]], "visible": true }, { "id": 372, - "shortcut": [["Shift", "c"]], "enabled": true, "label": "Crop", + "shortcut": [["Shift", "c"]], "visible": true }, { "id": 373, - "shortcut": [["m"]], "enabled": true, "label": "Move", + "shortcut": [["m"]], "visible": true }, { "id": 374, - "shortcut": [["q"]], "enabled": true, "label": "Align", + "shortcut": [["q"]], "visible": true } ] }, { "id": 375, + "children-display": "submenu", "enabled": true, "label": "Paint Tools", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 376, - "shortcut": [["Shift", "d"]], "enabled": true, "label": "Dodge / Burn", + "shortcut": [["Shift", "d"]], "visible": true }, { "id": 377, - "shortcut": [["s"]], "enabled": true, "label": "Smudge", + "shortcut": [["s"]], "visible": true }, { "id": 378, - "shortcut": [["Shift", "u"]], "enabled": true, "label": "Blur / Sharpen", + "shortcut": [["Shift", "u"]], "visible": true }, { @@ -2444,95 +2444,95 @@ }, { "id": 380, - "shortcut": [["h"]], "enabled": true, "label": "Heal", + "shortcut": [["h"]], "visible": true }, { "id": 381, - "shortcut": [["c"]], "enabled": true, "label": "Clone", + "shortcut": [["c"]], "visible": true }, { "id": 382, - "shortcut": [["k"]], "enabled": true, "label": "Ink", + "shortcut": [["k"]], "visible": true }, { "id": 383, - "shortcut": [["a"]], "enabled": true, "label": "Airbrush", + "shortcut": [["a"]], "visible": true }, { "id": 384, - "shortcut": [["Shift", "e"]], "enabled": true, "label": "Eraser", + "shortcut": [["Shift", "e"]], "visible": true }, { "id": 385, - "shortcut": [["p"]], "enabled": true, "label": "Paintbrush", + "shortcut": [["p"]], "visible": true }, { "id": 386, - "shortcut": [["n"]], "enabled": true, "label": "Pencil", + "shortcut": [["n"]], "visible": true }, { "id": 387, - "shortcut": [["l"]], "enabled": true, "label": "Blend", + "shortcut": [["l"]], "visible": true }, { "id": 388, - "shortcut": [["Shift", "b"]], "enabled": true, "label": "Bucket Fill", + "shortcut": [["Shift", "b"]], "visible": true } ] }, { "id": 389, + "children-display": "submenu", "enabled": true, "label": "Selection Tools", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 390, - "shortcut": [["i"]], "enabled": true, "label": "Intelligent Scissors", + "shortcut": [["i"]], "visible": true }, { "id": 391, - "shortcut": [["Shift", "o"]], "enabled": true, "label": "By Color Select", + "shortcut": [["Shift", "o"]], "visible": true }, { "id": 392, - "shortcut": [["u"]], "enabled": true, "label": "Fuzzy Select", + "shortcut": [["u"]], "visible": true }, { @@ -2543,23 +2543,23 @@ }, { "id": 394, - "shortcut": [["f"]], "enabled": true, "label": "Free Select", + "shortcut": [["f"]], "visible": true }, { "id": 395, - "shortcut": [["e"]], "enabled": true, "label": "Ellipse Select", + "shortcut": [["e"]], "visible": true }, { "id": 396, - "shortcut": [["r"]], "enabled": true, "label": "Rectangle Select", + "shortcut": [["r"]], "visible": true } ] @@ -2568,16 +2568,16 @@ }, { "id": 397, + "children-display": "submenu", "enabled": true, "label": "Filters", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 398, + "children-display": "submenu", "enabled": true, "label": "Script-Fu", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2602,9 +2602,9 @@ }, { "id": 402, + "children-display": "submenu", "enabled": true, "label": "Python-Fu", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2621,9 +2621,9 @@ }, { "id": 405, + "children-display": "submenu", "enabled": true, "label": "Alpha to Logo", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2748,9 +2748,9 @@ }, { "id": 426, + "children-display": "submenu", "enabled": true, "label": "Animation", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2815,9 +2815,9 @@ }, { "id": 437, + "children-display": "submenu", "enabled": true, "label": "Web", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2842,9 +2842,9 @@ }, { "id": 441, + "children-display": "submenu", "enabled": true, "label": "Render", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2895,9 +2895,9 @@ }, { "id": 450, + "children-display": "submenu", "enabled": true, "label": "Pattern", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2952,9 +2952,9 @@ }, { "id": 459, + "children-display": "submenu", "enabled": true, "label": "Nature", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -2973,9 +2973,9 @@ }, { "id": 462, + "children-display": "submenu", "enabled": true, "label": "Clouds", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3008,9 +3008,9 @@ }, { "id": 467, + "children-display": "submenu", "enabled": true, "label": "Map", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3077,9 +3077,9 @@ }, { "id": 478, + "children-display": "submenu", "enabled": true, "label": "Decor", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3140,9 +3140,9 @@ }, { "id": 488, + "children-display": "submenu", "enabled": true, "label": "Artistic", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3215,9 +3215,9 @@ }, { "id": 500, + "children-display": "submenu", "enabled": true, "label": "Combine", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3236,9 +3236,9 @@ }, { "id": 503, + "children-display": "submenu", "enabled": true, "label": "Generic", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3263,9 +3263,9 @@ }, { "id": 507, + "children-display": "submenu", "enabled": true, "label": "Edge-Detect", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3302,9 +3302,9 @@ }, { "id": 513, + "children-display": "submenu", "enabled": true, "label": "Noise", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3347,9 +3347,9 @@ }, { "id": 520, + "children-display": "submenu", "enabled": true, "label": "Light and Shadow", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3424,9 +3424,9 @@ }, { "id": 533, + "children-display": "submenu", "enabled": true, "label": "Distorts", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3541,9 +3541,9 @@ }, { "id": 552, + "children-display": "submenu", "enabled": true, "label": "Enhance", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3598,9 +3598,9 @@ }, { "id": 561, + "children-display": "submenu", "enabled": true, "label": "Blur", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3653,10 +3653,10 @@ }, { "id": 570, - "shortcut": [["Control", "Shift", "f"]], + "children-display": "submenu", "enabled": false, "label": "Re-Show Last", - "children-display": "submenu", + "shortcut": [["Control", "Shift", "f"]], "visible": true, "submenu": [ { @@ -3669,25 +3669,25 @@ }, { "id": 572, - "shortcut": [["Control", "f"]], "enabled": false, "label": "Repeat Last", + "shortcut": [["Control", "f"]], "visible": true } ] }, { "id": 573, + "children-display": "submenu", "enabled": true, "label": "Windows", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 574, - "shortcut": [["Control", "b"]], "enabled": true, "label": "Toolbox", + "shortcut": [["Control", "b"]], "visible": true }, { @@ -3696,9 +3696,9 @@ }, { "id": 576, + "children-display": "submenu", "enabled": true, "label": "Dockable Dialogs", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3755,23 +3755,23 @@ }, { "id": 586, - "shortcut": [["Control", "g"]], "enabled": true, "label": "Gradients", + "shortcut": [["Control", "g"]], "visible": true }, { "id": 587, - "shortcut": [["Control", "Shift", "p"]], "enabled": true, "label": "Patterns", + "shortcut": [["Control", "Shift", "p"]], "visible": true }, { "id": 588, - "shortcut": [["Control", "Shift", "b"]], "enabled": true, "label": "Brushes", + "shortcut": [["Control", "Shift", "b"]], "visible": true }, { @@ -3840,9 +3840,9 @@ }, { "id": 600, - "shortcut": [["Control", "l"]], "enabled": true, "label": "Layers", + "shortcut": [["Control", "l"]], "visible": true }, { @@ -3865,9 +3865,9 @@ }, { "id": 604, + "children-display": "submenu", "enabled": true, "label": "Recently Closed Docks", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3882,16 +3882,16 @@ }, { "id": 606, + "children-display": "submenu", "enabled": true, "label": "Help", - "children-display": "submenu", "visible": true, "submenu": [ { "id": 607, + "children-display": "submenu", "enabled": true, "label": "User Manual", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -3940,9 +3940,9 @@ }, { "id": 615, + "children-display": "submenu", "enabled": true, "label": "GIMP Online", - "children-display": "submenu", "visible": true, "submenu": [ { @@ -4005,16 +4005,16 @@ }, { "id": 626, - "shortcut": [["Shift", "F1"]], "enabled": true, "label": "Context Help", + "shortcut": [["Shift", "F1"]], "visible": true }, { "id": 627, - "shortcut": [["F1"]], "enabled": true, "label": "Help", + "shortcut": [["F1"]], "visible": true } ] diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 9e66236..3256f7e 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -135,13 +135,20 @@ value2string (const GValue * value, int depth) return str; } +static gint +list_str_cmp (gconstpointer a, gconstpointer b) +{ + return g_strcmp0((gchar *)a, (gchar *)b); +} + static void print_menuitem (DbusmenuMenuitem * item, int depth) { gchar * space = g_strnfill(depth, ' '); g_print("%s\"id\": %d", space, dbusmenu_menuitem_get_id(item)); - GList * properties = dbusmenu_menuitem_properties_list(item); + GList * properties_raw = dbusmenu_menuitem_properties_list(item); + GList * properties = g_list_sort(properties_raw, list_str_cmp); GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); -- cgit v1.2.3 From 682fd63278c0306437d43c827d7873403d3575af Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 6 Oct 2010 10:13:09 -0400 Subject: instead of always building gtk2 and gtk3, add a --with-gtk= flag to configure to specify which to build with --- configure.ac | 45 +++++++++++------- libdbusmenu-gtk/Makefile.am | 91 +++++++++++++++++-------------------- libdbusmenu-gtk/dbusmenu-gtk3.pc.in | 2 +- libdbusmenu-gtk/genericmenuitem.c | 40 +++++++++++----- tools/testapp/Makefile.am | 8 +++- 5 files changed, 105 insertions(+), 81 deletions(-) (limited to 'tools') diff --git a/configure.ac b/configure.ac index ff8dc78..a525612 100644 --- a/configure.ac +++ b/configure.ac @@ -48,23 +48,33 @@ AC_SUBST(DBUSMENUGLIB_LIBS) ########################### GTK_REQUIRED_VERSION=2.16 -GTK3_REQUIRED_VERSION=2.90 - -PKG_CHECK_MODULES(DBUSMENUGTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - dbus-glib-1 >= $DBUS_REQUIRED_VERSION - libxml-2.0 >= $XML_REQUIRED_VERSION) - -AC_SUBST(DBUSMENUGTK_CFLAGS) -AC_SUBST(DBUSMENUGTK_LIBS) - -PKG_CHECK_MODULES(DBUSMENUGTK3, gtk+-3.0 >= $GTK3_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - dbus-glib-1 >= $DBUS_REQUIRED_VERSION - libxml-2.0 >= $XML_REQUIRED_VERSION) - -AC_SUBST(DBUSMENUGTK3_CFLAGS) -AC_SUBST(DBUSMENUGTK3_LIBS) +GTK3_REQUIRED_VERSION=2.91 + +AC_ARG_WITH([gtk], + [AS_HELP_STRING([--with-gtk], + [Which version of gtk to use @<:@default=2@:>@])], + [], + [with_gtk=2]) +AS_IF([test "x$with_gtk" = x3], + [PKG_CHECK_MODULES(DBUSMENUGTK, gtk+-3.0 >= $GTK3_REQUIRED_VERSION + glib-2.0 >= $GLIB_REQUIRED_VERSION + dbus-glib-1 >= $DBUS_REQUIRED_VERSION + libxml-2.0 >= $XML_REQUIRED_VERSION) + AC_SUBST(DBUSMENUGTK_CFLAGS) + AC_SUBST(DBUSMENUGTK_LIBS) + AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available]) + ], + [test "x$with_gtk" = x2], + [PKG_CHECK_MODULES(DBUSMENUGTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION + glib-2.0 >= $GLIB_REQUIRED_VERSION + dbus-glib-1 >= $DBUS_REQUIRED_VERSION + libxml-2.0 >= $XML_REQUIRED_VERSION) + AC_SUBST(DBUSMENUGTK_CFLAGS) + AC_SUBST(DBUSMENUGTK_LIBS) + ], + [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])] +) +AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) ########################### # Dependencies - Testing @@ -155,5 +165,6 @@ libdbusmenu Configuration: Prefix: $prefix Massive Debugging: $with_massivedebugging + GTK+ Version: $with_gtk ]) diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index 4f38b63..cfa4230 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -1,22 +1,27 @@ CLEANFILES = -EXTRA_DIST = \ - dbusmenu-gtk.pc.in \ - dbusmenu-gtk3.pc.in +if USE_GTK3 +VER=3 +GTKGIR=Gtk-3.0 +GTKVALA=gtk+-3.0 +lib_LTLIBRARIES = libdbusmenu-gtk3.la +else +VER= +GTKGIR=Gtk-2.0 +GTKVALA=gtk+-2.0 +lib_LTLIBRARIES = libdbusmenu-gtk.la +endif -lib_LTLIBRARIES = \ - libdbusmenu-gtk.la \ - libdbusmenu-gtk3.la +EXTRA_DIST = \ + dbusmenu-gtk$(VER).pc.in -libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.1/libdbusmenu-gtk/ -libdbusmenu_gtk3includedir=$(includedir)/libdbusmenu3-0.1/libdbusmenu-gtk/ +libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.1/libdbusmenu-gtk$(VER)/ libdbusmenu_gtkinclude_HEADERS = \ client.h \ menu.h \ menuitem.h -libdbusmenu_gtk3include_HEADERS = $(libdbusmenu_gtkinclude_HEADERS) libdbusmenu_gtk_la_SOURCES = \ client.h \ @@ -27,27 +32,31 @@ libdbusmenu_gtk_la_SOURCES = \ menu.c \ menuitem.h \ menuitem.c -libdbusmenu_gtk3_la_SOURCES = $(libdbusmenu_gtk_la_SOURCES) libdbusmenu_gtk_la_LDFLAGS = \ -version-info $(LIBDBUSMENU_CURRENT):$(LIBDBUSMENU_REVISION):$(LIBDBUSMENU_AGE) \ -no-undefined \ -export-symbols-regex "^[^_].*" -libdbusmenu_gtk3_la_LDFLAGS = $(libdbusmenu_gtk_la_LDFLAGS) libdbusmenu_gtk_la_CFLAGS = \ $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) -Wall -Werror -DG_DISABLE_DEPRECATED -DG_LOG_DOMAIN="\"LIBDBUSMENU-GTK\"" -libdbusmenu_gtk3_la_CFLAGS = \ - $(DBUSMENUGTK3_CFLAGS) -I$(top_srcdir) -Wall -Werror -DG_DISABLE_DEPRECATED -DG_LOG_DOMAIN="\"LIBDBUSMENU-GTK\"" libdbusmenu_gtk_la_LIBADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ $(DBUSMENUGTK_LIBS) -libdbusmenu_gtk3_la_LIBADD = \ - ../libdbusmenu-glib/libdbusmenu-glib.la \ - $(DBUSMENUGTK3_LIBS) -pkgconfig_DATA = dbusmenu-gtk.pc dbusmenu-gtk3.pc +# We duplicate these here because Automake won't let us use $(VER) on the left hand side. +# Since we carefully use $(VER) in the right hand side above, we can assign the same values. +# Only one version of the library is every compiled at the same time, so it is safe to reuse +# the right hand sides like this. +libdbusmenu_gtk3includedir = $(libdbusmenu_gtkincludedir) +libdbusmenu_gtk3include_HEADERS = $(libdbusmenu_gtkinclude_HEADERS) +libdbusmenu_gtk3_la_SOURCES = $(libdbusmenu_gtk_la_SOURCES) +libdbusmenu_gtk3_la_LDFLAGS = $(libdbusmenu_gtk_la_LDFLAGS) +libdbusmenu_gtk3_la_CFLAGS = $(libdbusmenu_gtk_la_CFLAGS) +libdbusmenu_gtk3_la_LIBADD = $(libdbusmenu_gtk_la_LIBADD) + +pkgconfig_DATA = dbusmenu-gtk$(VER).pc pkgconfigdir = $(libdir)/pkgconfig ######################### @@ -66,25 +75,22 @@ if HAVE_INTROSPECTION introspection_sources = $(libdbusmenu_gtkinclude_HEADERS) -DbusmenuGtk-0.2.gir: libdbusmenu-gtk.la +DbusmenuGtk$(VER)-0.2.gir: libdbusmenu-gtk$(VER).la DbusmenuGtk_0_2_gir_INCLUDES = \ GObject-2.0 \ - Gtk-2.0 \ + $(GTKGIR) \ Dbusmenu-Glib-0.2 DbusmenuGtk_0_2_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) -DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk.la +DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk$(VER).la DbusmenuGtk_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) -DbusmenuGtk3-0.2.gir: libdbusmenu-gtk3.la -DbusmenuGtk3_0_2_gir_INCLUDES = \ - GObject-2.0 \ - Gtk-3.0 \ - Dbusmenu-Glib-0.2 -DbusmenuGtk3_0_2_gir_CFLAGS = $(DBUSMENUGTK3_CFLAGS) -I$(top_srcdir) -DbusmenuGtk3_0_2_gir_LIBS = libdbusmenu-gtk3.la -DbusmenuGtk3_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) +# We duplicate these for the same reason as libdbusmenu_gtk3includedir above +DbusmenuGtk3_0_2_gir_INCLUDES = $(DbusmenuGtk_0_2_gir_INCLUDES) +DbusmenuGtk3_0_2_gir_CFLAGS = $(DbusmenuGtk_0_2_gir_CFLAGS) +DbusmenuGtk3_0_2_gir_LIBS = $(DbusmenuGtk_0_2_gir_LIBS) +DbusmenuGtk3_0_2_gir_FILES = $(DbusmenuGtk_0_2_gir_FILES) -INTROSPECTION_GIRS += DbusmenuGtk-0.2.gir DbusmenuGtk3-0.2.gir +INTROSPECTION_GIRS += DbusmenuGtk$(VER)-0.2.gir girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) @@ -103,39 +109,24 @@ endif if HAVE_INTROSPECTION vapidir = $(datadir)/vala/vapi -vapi_DATA = DbusmenuGtk-0.2.vapi DbusmenuGtk3-0.2.vapi +vapi_DATA = DbusmenuGtk$(VER)-0.2.vapi -DbusmenuGtk-0.2.vapi: DbusmenuGtk-0.2.tmp.gir Makefile.am - $(VALA_API_GEN) --library=DbusmenuGtk-0.2 \ +DbusmenuGtk$(VER)-0.2.vapi: DbusmenuGtk$(VER)-0.2.tmp.gir Makefile.am + $(VALA_API_GEN) --library=DbusmenuGtk$(VER)-0.2 \ --pkg gdk-pixbuf-2.0 \ - --pkg gtk+-2.0 \ - --pkg atk \ - --pkg Dbusmenu-Glib-0.2 \ - --vapidir=$(top_builddir)/libdbusmenu-glib \ - $< - -DbusmenuGtk3-0.2.vapi: DbusmenuGtk3-0.2.tmp.gir Makefile.am - $(VALA_API_GEN) --library=DbusmenuGtk3-0.2 \ - --pkg gdk-pixbuf-3.0 \ - --pkg gtk+-3.0 \ + --pkg $(GTKVALA) \ --pkg atk \ --pkg Dbusmenu-Glib-0.2 \ --vapidir=$(top_builddir)/libdbusmenu-glib \ $< -DbusmenuGtk-0.2.tmp.gir: DbusmenuGtk-0.2.gir - $(SED) \ - -e "s|GdkPixbuf.Pixbuf|Gdk.Pixbuf|g" \ - -e "s|Atk.ImplementorIface|Atk.Implementor|g" \ - $< > $@ - -DbusmenuGtk3-0.2.tmp.gir: DbusmenuGtk3-0.2.gir +DbusmenuGtk$(VER)-0.2.tmp.gir: DbusmenuGtk$(VER)-0.2.gir $(SED) \ -e "s|GdkPixbuf.Pixbuf|Gdk.Pixbuf|g" \ -e "s|Atk.ImplementorIface|Atk.Implementor|g" \ $< > $@ -CLEANFILES += $(vapi_DATA) DbusmenuGtk-0.2.tmp.gir DbusmenuGtk3-0.2.tmp.gir +CLEANFILES += $(vapi_DATA) DbusmenuGtk$(VER)-0.2.tmp.gir endif diff --git a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3.pc.in index e2c4cc3..1a3410e 100644 --- a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in +++ b/libdbusmenu-gtk/dbusmenu-gtk3.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ bindir=@bindir@ includedir=@includedir@ -Cflags: -I${includedir}/libdbusmenu-3.1 +Cflags: -I${includedir}/libdbusmenu-0.1 Requires: dbus-glib-1 dbusmenu-glib Libs: -L${libdir} -ldbusmenu-gtk3 diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 8f40d93..b357d82 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -51,7 +51,6 @@ static void genericmenuitem_class_init (GenericmenuitemClass *klass); static void genericmenuitem_init (Genericmenuitem *self); static void genericmenuitem_dispose (GObject *object); static void genericmenuitem_finalize (GObject *object); -static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area); static void set_label (GtkMenuItem * menu_item, const gchar * label); static const gchar * get_label (GtkMenuItem * menu_item); static void activate (GtkMenuItem * menu_item); @@ -59,8 +58,13 @@ static void activate (GtkMenuItem * menu_item); /* GObject stuff */ G_DEFINE_TYPE (Genericmenuitem, genericmenuitem, GTK_TYPE_CHECK_MENU_ITEM); -/* Globals */ +#if HAVE_GTK3 +static void draw_indicator (GtkCheckMenuItem *check_menu_item, cairo_t *cr); +static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, cairo_t *cr) = NULL; +#else +static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area); static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) = NULL; +#endif /* Initializing all of the classes. Most notably we're disabling the drawing of the check early. */ @@ -121,6 +125,17 @@ genericmenuitem_finalize (GObject *object) /* Checks to see if we should be drawing a little box at all. If we should be, let's do that, otherwise we're going suppress the box drawing. */ +#if HAVE_GTK3 +static void +draw_indicator (GtkCheckMenuItem *check_menu_item, cairo_t *cr) +{ + Genericmenuitem * self = GENERICMENUITEM(check_menu_item); + if (self->priv->check_type != GENERICMENUITEM_CHECK_TYPE_NONE) { + parent_draw_indicator(check_menu_item, cr); + } + return; +} +#else static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) { @@ -130,6 +145,7 @@ draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) } return; } +#endif /* A small helper to look through the widgets in the box and find the one that is the label. */ @@ -320,32 +336,32 @@ genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state) GtkCheckMenuItem * check = GTK_CHECK_MENU_ITEM(item); - gboolean old_active = check->active; - gboolean old_inconsist = check->inconsistent; + gboolean old_active = gtk_check_menu_item_get_active (check); + gboolean old_inconsist = gtk_check_menu_item_get_inconsistent (check); switch (item->priv->state) { case GENERICMENUITEM_STATE_UNCHECKED: - check->active = FALSE; - check->inconsistent = FALSE; + gtk_check_menu_item_set_active (check, FALSE); + gtk_check_menu_item_set_inconsistent (check, FALSE); break; case GENERICMENUITEM_STATE_CHECKED: - check->active = TRUE; - check->inconsistent = FALSE; + gtk_check_menu_item_set_active (check, TRUE); + gtk_check_menu_item_set_inconsistent (check, FALSE); break; case GENERICMENUITEM_STATE_INDETERMINATE: - check->active = TRUE; - check->inconsistent = TRUE; + gtk_check_menu_item_set_active (check, TRUE); + gtk_check_menu_item_set_inconsistent (check, TRUE); break; default: g_warning("Generic Menuitem invalid check state: %d", state); return; } - if (old_active != check->active) { + if (old_active != gtk_check_menu_item_get_active (check)) { g_object_notify(G_OBJECT(item), "active"); } - if (old_inconsist != check->inconsistent) { + if (old_inconsist != gtk_check_menu_item_get_inconsistent (check)) { g_object_notify(G_OBJECT(item), "inconsistent"); } diff --git a/tools/testapp/Makefile.am b/tools/testapp/Makefile.am index a8b42dd..39de532 100644 --- a/tools/testapp/Makefile.am +++ b/tools/testapp/Makefile.am @@ -1,4 +1,10 @@ +if USE_GTK3 +VER=3 +else +VER= +endif + libexec_PROGRAMS = dbusmenu-testapp dbusmenu_testapp_SOURCES = \ @@ -12,6 +18,6 @@ dbusmenu_testapp_CFLAGS = \ dbusmenu_testapp_LDADD = \ $(builddir)/../../libdbusmenu-glib/libdbusmenu-glib.la \ - $(builddir)/../../libdbusmenu-gtk/libdbusmenu-gtk.la \ + $(builddir)/../../libdbusmenu-gtk/libdbusmenu-gtk$(VER).la \ $(DBUSMENUGTK_LIBS) \ $(DBUSMENUTESTS_LIBS) -- cgit v1.2.3 From b856f7cd47db470f4369aa28ad87dc1925bf68a5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 16:31:51 -0600 Subject: Switching to getting the name with GDBus --- tools/testapp/main.c | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'tools') diff --git a/tools/testapp/main.c b/tools/testapp/main.c index f489407..67e962d 100644 --- a/tools/testapp/main.c +++ b/tools/testapp/main.c @@ -26,9 +26,7 @@ License version 3 and version 2.1 along with this program. If not, see */ #include - -#include -#include +#include #include @@ -117,6 +115,24 @@ void init_menu(DbusmenuMenuitem *root, const char *filename) } } +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + DbusmenuServer *server = dbusmenu_server_new("/MenuBar"); + DbusmenuMenuitem *root = dbusmenu_menuitem_new_with_id(0); + init_menu(root, (gchar *)user_data); + dbusmenu_server_set_root(server, root); + + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + return; +} + int main (int argc, char ** argv) { g_type_init(); @@ -127,25 +143,14 @@ int main (int argc, char ** argv) } const char *filename = argv[1]; - GError * error = NULL; - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - DbusmenuServer *server = dbusmenu_server_new("/MenuBar"); - DbusmenuMenuitem *root = dbusmenu_menuitem_new_with_id(0); - init_menu(root, filename); - dbusmenu_server_set_root(server, root); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + (gpointer)filename, + NULL); g_main_loop_run(g_main_loop_new(NULL, FALSE)); -- cgit v1.2.3 From e9e8e1c31e0a32e23e2526622d2435f60c24a084 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 11:12:28 -0600 Subject: Porting the dumper to GDBus --- tools/dbusmenu-dumper.c | 154 ++++++++++-------------------------------------- 1 file changed, 30 insertions(+), 124 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 3256f7e..4580e4c 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -21,7 +21,6 @@ with this program. If not, see . */ #include -#include #include #include @@ -30,111 +29,10 @@ with this program. If not, see . #include #include -#include #include static GMainLoop * mainloop = NULL; -static gchar * value2string (const GValue * value, int depth); - -static gchar * -strv_dumper(const GValue * value) -{ - gchar ** strv = (gchar **)g_value_get_boxed(value); - - gchar * joined = g_strjoinv("\", \"", strv); - gchar * retval = g_strdup_printf("[\"%s\"]", joined); - g_free(joined); - return retval; -} - -typedef struct _collection_iterator_t collection_iterator_t; -struct _collection_iterator_t { - gchar * space; - GPtrArray * array; - gboolean first; - int depth; -}; - -static void -collection_iterate (const GValue * value, gpointer user_data) -{ - collection_iterator_t * iter = (collection_iterator_t *)user_data; - - gchar * str = value2string(value, iter->depth); - gchar * retval = NULL; - - if (iter->first) { - iter->first = FALSE; - retval = g_strdup_printf("\n%s%s", iter->space, str); - } else { - retval = g_strdup_printf(",\n%s%s", iter->space, str); - } - - g_ptr_array_add(iter->array, retval); - g_free(str); - - return; -} - -static gchar * -collection_dumper (const GValue * value, int depth) -{ - gchar * space = g_strnfill(depth, ' '); - GPtrArray * array = g_ptr_array_new_with_free_func(g_free); - - g_ptr_array_add(array, g_strdup("[")); - - collection_iterator_t iter; - iter.space = space; - iter.array = array; - iter.first = TRUE; - iter.depth = depth + 2; - - dbus_g_type_collection_value_iterate(value, collection_iterate, &iter); - - g_ptr_array_add(array, g_strdup_printf("\n%s]", space)); - - g_free(space); - - gchar * retstr = NULL; - if (array->len == 3) { - retstr = g_strdup_printf("[%s]", ((gchar *)array->pdata[1]) + depth + 1/*for newline*/); - } else { - retstr = g_strjoinv(NULL, (gchar **)array->pdata); - } - - g_ptr_array_free(array, TRUE); - - return retstr; -} - -static gchar * -value2string (const GValue * value, int depth) -{ - gchar * str = NULL; - - if (value == NULL) { - return g_strdup("(null)"); - } - - if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { - str = collection_dumper(value, depth); - } else if (G_VALUE_TYPE(value) == G_TYPE_STRV) { - str = strv_dumper(value); - } else if (G_VALUE_TYPE(value) == G_TYPE_BOOLEAN) { - if (g_value_get_boolean(value)) { - str = g_strdup("true"); - } else { - str = g_strdup("false"); - } - } else { - str = g_strdup_value_contents(value); - } - - return str; -} - static gint list_str_cmp (gconstpointer a, gconstpointer b) { @@ -151,10 +49,11 @@ print_menuitem (DbusmenuMenuitem * item, int depth) GList * properties = g_list_sort(properties_raw, list_str_cmp); GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { - const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); - gchar * str = value2string(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2 /*quotes*/ + 2 /*: */); + GVariant * variant = dbusmenu_menuitem_property_get_variant(item, (gchar *)property->data); + gchar * str = g_variant_print(variant, FALSE); g_print(",\n%s\"%s\": %s", space, (gchar *)property->data, str); g_free(str); + g_variant_unref(variant); } g_list_free(properties); @@ -350,39 +249,46 @@ static gchar * dbusobject = NULL; static gboolean init_dbus_vars_from_window(Window window) { - DBusGConnection *connection; GError *error; - DBusGProxy *proxy; + GDBusProxy *proxy; error = NULL; - connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (connection == NULL) { - g_printerr("Failed to open connection to bus: %s\n", error->message); + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.ayatana.AppMenu.Registrar", + "/org/ayatana/AppMenu/Registrar", + "org.ayatana.AppMenu.Registrar", + NULL, + &error); + if (error != NULL) { + g_warning("Unable to get registrar proxy: %s", error->message); g_error_free(error); return FALSE; } - proxy = dbus_g_proxy_new_for_name (connection, - "org.ayatana.AppMenu.Registrar", - "/org/ayatana/AppMenu/Registrar", - "org.ayatana.AppMenu.Registrar"); - error = NULL; - if (!dbus_g_proxy_call (proxy, "GetMenuForWindow", &error, - G_TYPE_UINT, window, G_TYPE_INVALID, - G_TYPE_STRING, &dbusname, DBUS_TYPE_G_OBJECT_PATH, &dbusobject, G_TYPE_INVALID)) - { - g_printerr("ERROR: %s\n", error->message); + GVariant * retval; + + retval = g_dbus_proxy_call_sync(proxy, + "GetMenuForWindow", + g_variant_new("u", window), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (error != NULL) { + g_warning("Unable to call 'GetMenuForWindow' on registrar: %s", error->message); g_error_free(error); - g_object_unref(proxy); return FALSE; } - if (!g_strcmp0(dbusobject, "/")) { - return FALSE; - } + g_variant_get(retval, "so", &dbusname, &dbusobject); - g_object_unref (proxy); + g_variant_unref(retval); + g_object_unref(proxy); return TRUE; } -- cgit v1.2.3 From a8b425c5868c73739f60997ebc2013df3b3d6d4b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 13 Jan 2011 09:53:15 -0600 Subject: Ayatana purge --- libdbusmenu-glib/clean-namespaces.xslt | 2 +- libdbusmenu-glib/client.c | 2 +- libdbusmenu-glib/dbus-menu.xml | 6 +++--- libdbusmenu-glib/server.c | 8 ++++---- tools/dbusmenu-bench | 2 +- tools/dbusmenu-dumper.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/libdbusmenu-glib/clean-namespaces.xslt b/libdbusmenu-glib/clean-namespaces.xslt index 8344a71..8c0c521 100644 --- a/libdbusmenu-glib/clean-namespaces.xslt +++ b/libdbusmenu-glib/clean-namespaces.xslt @@ -1,4 +1,4 @@ - + diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a15469b..58d6360 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -122,7 +122,7 @@ struct _event_data_t { #define DBUSMENU_CLIENT_GET_PRIVATE(o) (DBUSMENU_CLIENT(o)->priv) -#define DBUSMENU_INTERFACE "org.ayatana.dbusmenu" +#define DBUSMENU_INTERFACE "com.canonical.dbusmenu" /* GObject Stuff */ static void dbusmenu_client_class_init (DbusmenuClientClass *klass); diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 9e8013c..042a24c 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -28,15 +28,15 @@ You should have received a copy of both the GNU Lesser General Public License version 3 and version 2.1 along with this program. If not, see --> - + - + Date: Wed, 16 Feb 2011 16:59:17 +0100 Subject: tools/dbusmenu-dumper: Proper GVariant handling of gdbus call to make this actually work --- tools/dbusmenu-dumper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index bd986e8..2db437d 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -270,10 +270,12 @@ init_dbus_vars_from_window(Window window) error = NULL; GVariant * retval; + GVariant * args[1]; + args[0] = g_variant_new("u", window); retval = g_dbus_proxy_call_sync(proxy, "GetMenuForWindow", - g_variant_new("u", window), + g_variant_new_tuple(args, 1), G_DBUS_CALL_FLAGS_NONE, -1, NULL, @@ -285,7 +287,7 @@ init_dbus_vars_from_window(Window window) return FALSE; } - g_variant_get(retval, "so", &dbusname, &dbusobject); + g_variant_get(retval, "(so)", &dbusname, &dbusobject); g_variant_unref(retval); g_object_unref(proxy); -- cgit v1.2.3