ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #01922
[Merge] lp:~bratsche/appmenu-gtk/show-local into lp:appmenu-gtk
Cody Russell has proposed merging lp:~bratsche/appmenu-gtk/show-local into lp:appmenu-gtk.
Requested reviews:
Canonical Desktop Experience Team (canonical-dx-team)
Related bugs:
#607285 Fall back to stock menu if the applet isn't in the panel
https://bugs.launchpad.net/bugs/607285
There is still an issue where the application may draw the menu before it receives a response from dbus, and will then hide it if the dbus response was successful.
For now I'm not sure the best way to fix that, so I'm deferring that to another branch for now. This branch solves enough problems that I think we should get it into this release despite that flaw.
--
https://code.launchpad.net/~bratsche/appmenu-gtk/show-local/+merge/30640
Your team ayatana-commits is subscribed to branch lp:appmenu-gtk.
=== modified file 'src/bridge.c'
--- src/bridge.c 2010-07-21 13:42:27 +0000
+++ src/bridge.c 2010-07-22 12:08:47 +0000
@@ -83,6 +83,7 @@
DBusGProxy *dbusproxy;
DBusGProxy *appmenuproxy;
gboolean online;
+ gboolean failed;
};
typedef struct _RecurseContext
@@ -238,10 +239,43 @@
}
static void
+app_menu_bridge_set_show_local (AppMenuBridge *bridge,
+ gboolean local)
+{
+ const gchar *env = g_getenv ("APPMENU_DISPLAY_BOTH");
+
+ if (g_strcmp0 (env, "1") == 0)
+ local = TRUE;
+
+ g_object_set (bridge,
+ "show-local", local,
+ NULL);
+}
+
+static void
register_application_window_cb (DBusGProxy *proxy,
GError *error,
void *user_data)
{
+ AppWindowContext *context = (AppWindowContext *)user_data;
+
+ if (error != NULL)
+ {
+ if (context->bridge != NULL)
+ {
+ context->bridge->priv->failed = TRUE;
+ context->registered = FALSE;
+
+ app_menu_bridge_set_show_local (context->bridge, TRUE);
+
+ return;
+ }
+ }
+
+ context->bridge->priv->failed = FALSE;
+ context->registered = TRUE;
+
+ app_menu_bridge_set_show_local (context->bridge, FALSE);
}
static void
@@ -260,7 +294,7 @@
GDK_WINDOW_XID (gtk_widget_get_window (widget)),
context->path,
register_application_window_cb,
- NULL);
+ context);
}
}
}
@@ -276,6 +310,8 @@
context->registered = FALSE;
}
+
+ app_menu_bridge_set_show_local (bridge, TRUE);
}
static void
@@ -422,8 +458,8 @@
dbusmenu_menuitem_property_remove (menuitem,
DBUSMENU_MENUITEM_PROP_ICON_NAME);
- const gchar * label = dbusmenu_menuitem_property_get (menuitem,
- DBUSMENU_MENUITEM_PROP_LABEL);
+ const gchar *label = dbusmenu_menuitem_property_get (menuitem,
+ DBUSMENU_MENUITEM_PROP_LABEL);
if (stock.label != NULL && label != NULL)
{
@@ -1058,9 +1094,7 @@
static gboolean
app_menu_bridge_show_local (UbuntuMenuProxy *proxy)
{
- const gchar *env = g_getenv ("APPMENU_DISPLAY_BOTH");
-
- return (g_strcmp0 (env, "1") == 0);
+ return TRUE;
}
/* crude blacklist to avoid patching innoncent apps */
Follow ups