aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/menu.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-01 20:44:05 -0500
committerTed Gould <ted@canonical.com>2009-10-01 20:44:05 -0500
commit5040095814d0bf27a6aa2e8b3f3f9a5c1c02f38a (patch)
tree0504f38092763763c826f9bf5fa8036d3a9b7c67 /libdbusmenu-gtk/menu.c
parent5234d6f550335d177038062a9b0c361fa3043a0c (diff)
downloadlibdbusmenu-5040095814d0bf27a6aa2e8b3f3f9a5c1c02f38a.tar.gz
libdbusmenu-5040095814d0bf27a6aa2e8b3f3f9a5c1c02f38a.tar.bz2
libdbusmenu-5040095814d0bf27a6aa2e8b3f3f9a5c1c02f38a.zip
Reporting on the request pos vs. the actual.
Diffstat (limited to 'libdbusmenu-gtk/menu.c')
-rw-r--r--libdbusmenu-gtk/menu.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c
index 8f97294..2dd7a6e 100644
--- a/libdbusmenu-gtk/menu.c
+++ b/libdbusmenu-gtk/menu.c
@@ -185,6 +185,28 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec)
/* Internal Functions */
+#ifdef MASSIVEDEBUGGING
+typedef struct {
+ GtkMenuItem * mi;
+ gint finalpos;
+ gboolean found;
+} menu_pos_t;
+
+static void
+find_pos (GtkWidget * widget, gpointer data)
+{
+ menu_pos_t * menu_pos = (menu_pos_t *)data;
+ if (menu_pos->found) return;
+ if ((gpointer)(menu_pos->mi) == (gpointer)widget) {
+ menu_pos->found = TRUE;
+ } else {
+ menu_pos->finalpos++;
+ }
+ return;
+}
+#endif
+
+
/* Called when a new child of the root item is
added. Sets up a signal for when it's actually
realized. */
@@ -199,8 +221,16 @@ root_child_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint posit
GtkMenuItem * mi = dbusmenu_gtkclient_menuitem_get(priv->client, child);
if (mi != NULL) {
GtkWidget * item = GTK_WIDGET(mi);
- gtk_menu_append(GTK_MENU(menu), item);
- gtk_menu_reorder_child(GTK_MENU(menu), item, dbusmenu_menuitem_get_position(root, child));
+ gtk_menu_insert(GTK_MENU(menu), item, position);
+ #ifdef MASSIVEDEBUGGING
+ menu_pos_t menu_pos;
+ menu_pos.mi = mi;
+ menu_pos.finalpos = 0;
+ menu_pos.found = FALSE;
+
+ gtk_container_foreach(GTK_CONTAINER(menu), find_pos, &menu_pos);
+ g_debug("Menu position requested was %d but got %d", position, menu_pos.finalpos);
+ #endif
}
return;
}