[Pkg-telepathy-commits] [empathy] 30/39: use (room-name, account-path) as primary key when removing GMenuItem

Simon McVittie smcv at debian.org
Wed Jan 29 12:53:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository empathy.

commit b21d3e5a166d698874295b9bb5b4e81b20c8f1d3
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Wed Sep 11 16:41:24 2013 +0200

    use (room-name, account-path) as primary key when removing GMenuItem
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707885
---
 src/empathy-roster-window.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index cd1aabb..5008fb6 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -1321,6 +1321,7 @@ roster_window_favorite_chatroom_menu_add (EmpathyRosterWindow *self,
   g_menu_item_set_action_and_target (item, "win.join", "(ss)",
       name, account_path);
   g_menu_item_set_attribute (item, "room-name", "s", name);
+  g_menu_item_set_attribute (item, "account-path", "s", account_path);
   g_menu_append_item (self->priv->rooms_section, item);
 
   g_free (label);
@@ -1342,26 +1343,44 @@ roster_window_favorite_chatroom_menu_removed_cb (
 {
   GList *chatrooms;
   guint i, n;
+  TpAccount *account;
+  const gchar *account_path;
+
+  account = empathy_chatroom_get_account (chatroom);
+  account_path = tp_proxy_get_object_path (account);
 
   n = g_menu_model_get_n_items (G_MENU_MODEL (self->priv->rooms_section));
 
   for (i = 0; i < n; i++)
     {
-      gchar *name;
+      gchar *tmp;
+
+      if (!g_menu_model_get_item_attribute (
+            G_MENU_MODEL (self->priv->rooms_section), i,
+            "room-name", "s", &tmp))
+        continue;
+
+      if (tp_strdiff (tmp, empathy_chatroom_get_name (chatroom)))
+        {
+          g_free (tmp);
+          continue;
+        }
+
+      g_free (tmp);
 
       if (!g_menu_model_get_item_attribute (
             G_MENU_MODEL (self->priv->rooms_section), i,
-            "room-name", "s", &name))
+            "account-path", "s", &tmp))
         continue;
 
-      if (tp_strdiff (name, empathy_chatroom_get_name (chatroom)))
+      if (tp_strdiff (tmp, account_path))
         {
-          g_free (name);
+          g_free (tmp);
           continue;
         }
 
       g_menu_remove (self->priv->rooms_section, i);
-      g_free (name);
+      g_free (tmp);
       break;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/empathy.git



More information about the Pkg-telepathy-commits mailing list