Chris Coulson has proposed merging lp:~chrisccoulson/indicator-appmenu/lp703769 into lp:indicator-appmenu.
Requested reviews: Ted Gould (ted) For more details, see: https://code.launchpad.net/~chrisccoulson/indicator-appmenu/lp703769/+merge/46495 Fixes bug 703769 -- https://code.launchpad.net/~chrisccoulson/indicator-appmenu/lp703769/+merge/46495 Your team ayatana-commits is subscribed to branch lp:indicator-appmenu.
=== modified file 'src/window-menus.c' --- src/window-menus.c 2011-01-14 04:39:00 +0000 +++ src/window-menus.c 2011-01-17 16:11:16 +0000 @@ -26,6 +26,7 @@ #include <libdbusmenu-gtk/menu.h> #include <glib.h> #include <gio/gio.h> +#include <libbamf/bamf-matcher.h> #include "window-menus.h" #include "indicator-appmenu-marshal.h" @@ -46,6 +47,8 @@ gchar * retry_name; GVariant * retry_data; guint retry_timestamp; + BamfApplication *app; + gulong window_removed_id; }; typedef struct _WMEntry WMEntry; @@ -78,7 +81,7 @@ static void window_menus_init (WindowMenus *self); static void window_menus_dispose (GObject *object); static void window_menus_finalize (GObject *object); -static void name_owner_changed (GObject * gobject, GParamSpec * pspec, gpointer user_data); +static void window_removed (GObject * gobject, BamfView * view, gpointer user_data); static void root_changed (DbusmenuClient * client, DbusmenuMenuitem * new_root, gpointer user_data); static void menu_entry_added (DbusmenuMenuitem * root, DbusmenuMenuitem * newentry, guint position, gpointer user_data); static void menu_entry_removed (DbusmenuMenuitem * root, DbusmenuMenuitem * oldentry, gpointer user_data); @@ -164,6 +167,12 @@ WindowMenusPrivate * priv = WINDOW_MENUS_GET_PRIVATE(object); + if (priv->app != NULL) { + g_signal_handler_disconnect(priv->app, priv->window_removed_id); + g_object_unref(G_OBJECT(priv->app)); + priv->app = NULL; + } + if (priv->root != NULL) { g_object_unref(G_OBJECT(priv->root)); priv->root = NULL; @@ -399,6 +408,10 @@ root_changed(DBUSMENU_CLIENT(priv->client), root, newmenu); } + priv->app = bamf_matcher_get_application_for_xid(bamf_matcher_get_default(), windowid); + g_object_ref(priv->app); + priv->window_removed_id = g_signal_connect(G_OBJECT(priv->app), "window-removed", G_CALLBACK(window_removed), newmenu); + return newmenu; } @@ -430,31 +443,25 @@ sure that it's ours. */ priv->props = proxy; - g_signal_connect(proxy, "notify::g-name-owner", G_CALLBACK(name_owner_changed), self); - return; } -/* Gets called when the proxy changes owners, which is usually when it - drops off of the bus. */ static void -name_owner_changed (GObject * gobject, GParamSpec * pspec, gpointer user_data) +window_removed (GObject * gobject, BamfView * view, gpointer user_data) { WindowMenus * wm = WINDOW_MENUS(user_data); WindowMenusPrivate * priv = WINDOW_MENUS_GET_PRIVATE(wm); - GDBusProxy * proxy = G_DBUS_PROXY(gobject); - gchar * owner = g_dbus_proxy_get_name_owner(proxy); - if (owner != NULL) { - /* OK, carry on */ - g_free (owner); + if (!BAMF_IS_WINDOW(view)) { return; } - /* We should die now */ - g_debug("Properties destroyed for window: %d", priv->windowid); - g_object_unref(G_OBJECT(wm)); - return; + BamfWindow * window = BAMF_WINDOW(view); + + if (bamf_window_get_xid(window) == priv->windowid) { + g_debug("Window removed for window: %d", priv->windowid); + g_object_unref(G_OBJECT(wm)); + } } /* Get the location of this entry */
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-commits Post to : ayatana-commits@lists.launchpad.net Unsubscribe : https://launchpad.net/~ayatana-commits More help : https://help.launchpad.net/ListHelp