diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-11 22:41:24 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-25 21:21:50 +0800 |
commit | f4ebc8f15b96354f65023148465f8f88b55c1496 (patch) | |
tree | a6de45ff72080fade931a03998d7de0fd8b6b627 /src | |
parent | a0602d0d2e8824394ba738a8677909b5c4676d95 (diff) | |
download | gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar.gz gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar.bz2 gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar.lz gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar.xz gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.tar.zst gsoc2013-empathy-f4ebc8f15b96354f65023148465f8f88b55c1496.zip |
use (room-name, account-path) as primary key when removing GMenuItem
https://bugzilla.gnome.org/show_bug.cgi?id=707885
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-roster-window.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c index 667267f51..e06ea9333 100644 --- a/src/empathy-roster-window.c +++ b/src/empathy-roster-window.c @@ -1334,6 +1334,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); @@ -1355,26 +1356,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; } |