← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~bratsche/indicator-me/fix-restarting-service into lp:indicator-me

 

Cody Russell has proposed merging lp:~bratsche/indicator-me/fix-restarting-service into lp:indicator-me.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  #551063 Invalid reference to a dbusmenu item crashes the me menu
  https://bugs.launchpad.net/bugs/551063

-- 
https://code.launchpad.net/~bratsche/indicator-me/fix-restarting-service/+merge/22573
Your team ayatana-commits is subscribed to branch lp:indicator-me.
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c	2010-03-24 09:38:22 +0000
+++ src/indicator-me.c	2010-03-31 21:32:24 +0000
@@ -74,6 +74,9 @@
 static GtkLabel *label = NULL;
 static DBusGProxy * status_proxy = NULL;
 
+static DbusmenuGtkMenu *dmenu = NULL;
+static IdoEntryMenuItem *ido_entry = NULL;
+
 /* Prototypes */
 static GtkLabel * get_label (IndicatorObject * io);
 static GtkImage * get_icon (IndicatorObject * io);
@@ -85,6 +88,9 @@
 static void indicator_me_finalize   (GObject *object);
 static void connection_changed      (IndicatorServiceManager * sm, gboolean connected, gpointer userdata);
 static void status_icon_cb (DBusGProxy * proxy, char * icons, GError *error, gpointer userdata);
+static gboolean new_entry_item (DbusmenuMenuitem * newitem,
+                                DbusmenuMenuitem * parent,
+                                DbusmenuClient   * client);
 
 G_DEFINE_TYPE (IndicatorMe, indicator_me, INDICATOR_OBJECT_TYPE);
 
@@ -232,10 +238,23 @@
 
     /* query the service for the username to display */
 		org_ayatana_indicator_me_service_pretty_user_name_async(status_proxy, username_cb, NULL);
-
 	} else {
 		/* If we're disconnecting, go back to offline */
 		status_icon_cb(NULL, DEFAULT_ICON, NULL, NULL);
+
+    g_object_unref (status_proxy);
+    status_proxy = NULL;
+
+    if (ido_entry != NULL) {
+      g_object_unref (ido_entry);
+      ido_entry = NULL;
+    }
+
+    if (dmenu != NULL) {
+      DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client (dmenu);
+
+      dbusmenu_client_add_type_handler (DBUSMENU_CLIENT (client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item);
+    }
 	}
 
 	return;
@@ -305,6 +324,8 @@
 	gtk_entry_set_width_chars (entry, 23); /* set some nice aspect ratio for the menu */
   gtk_entry_set_max_length (entry, 140); /* enforce current gwibber limit */
 
+  ido_entry = ido;
+
   g_signal_connect (ido,
                     "notify::parent", G_CALLBACK (entry_parent_changed),
                     NULL);
@@ -369,6 +390,8 @@
 	DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_ME_DBUS_NAME, INDICATOR_ME_DBUS_OBJECT);
 	DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu);
 
+  dmenu = menu;
+
 	dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item);
 	dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ABOUT_ME_MENUITEM_TYPE, new_about_me_item);
 


Follow ups