ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02449
[Merge] lp:~bratsche/appmenu-gtk/after-startup-additions into lp:appmenu-gtk
Cody Russell has proposed merging lp:~bratsche/appmenu-gtk/after-startup-additions into lp:appmenu-gtk.
Requested reviews:
Canonical Desktop Experience Team (canonical-dx-team)
Related bugs:
#646794 menu items added by gedit plugins not shown
https://bugs.launchpad.net/bugs/646794
--
https://code.launchpad.net/~bratsche/appmenu-gtk/after-startup-additions/+merge/36817
Your team ayatana-commits is subscribed to branch lp:appmenu-gtk.
=== modified file 'src/bridge.c'
--- src/bridge.c 2010-09-23 18:49:58 +0000
+++ src/bridge.c 2010-09-28 03:11:00 +0000
@@ -109,6 +109,9 @@
static GHashTable *rebuild_ids = NULL;
+
+static gboolean after_startup = FALSE;
+
static void
app_menu_bridge_setup_proxy (AppMenuBridge *bridge)
{
@@ -1230,6 +1233,14 @@
}
}
+gboolean
+startup_timeout (gpointer data)
+{
+ after_startup = TRUE;
+
+ return FALSE;
+}
+
static void
app_menu_bridge_insert (UbuntuMenuProxy *proxy,
GtkWidget *parent,
@@ -1241,6 +1252,8 @@
GtkWidget *toplevel = NULL;
gboolean append = FALSE;
+ g_timeout_add (500, (GSourceFunc)startup_timeout, NULL);
+
if (GTK_IS_TEAROFF_MENU_ITEM (child))
return;
@@ -1260,10 +1273,30 @@
}
else if (GTK_IS_MENU (parent))
{
- GtkWidget *attach;
+ GtkWidget *attach = NULL;
+ GList *tmp = NULL;
+ AppWindowContext *context = NULL;
g_object_get (parent, "attach-widget", &attach, NULL);
+ /* First attempt to setup the menuitem immediately if possible. */
+ for (tmp = bridge->priv->windows; tmp != NULL; tmp = tmp->next)
+ {
+ context = (AppWindowContext *)tmp->data;
+
+ DbusmenuMenuitem *mi = (DbusmenuMenuitem *)g_hash_table_lookup (context->lookup, attach);
+
+ if (mi != NULL)
+ {
+ DbusmenuMenuitem *child_dmi = construct_dbusmenu_for_widget (child, FALSE);
+
+ dbusmenu_menuitem_child_add_position (mi,
+ child_dmi,
+ position);
+ return;
+ }
+ }
+
if (attach == NULL)
{
g_signal_connect (G_OBJECT (parent),
@@ -1274,8 +1307,6 @@
}
else
{
- toplevel = gtk_widget_get_toplevel (attach);
-
rebuild (bridge, toplevel);
}
}
Follow ups