diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-03 18:07:06 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-03 18:28:30 +0800 |
commit | 7cbe28b6cfc22744a0a6079213b9614d87bf22ad (patch) | |
tree | 8fc8f95a1954025ac6f85bee246019c584a45367 /libempathy-gtk | |
parent | 8978c0d955186405e291a7ff2ac71a063cdb9e68 (diff) | |
download | gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar.gz gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar.bz2 gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar.lz gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar.xz gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.tar.zst gsoc2013-empathy-7cbe28b6cfc22744a0a6079213b9614d87bf22ad.zip |
contact-list-view: backport fixes from individual_view_popup_menu_idle_cb
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index cccfebb51..4ab3607ec 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -804,6 +804,17 @@ typedef struct { guint32 time; } MenuPopupData; +static void +menu_deactivate_cb (GtkMenuShell *menushell, + gpointer user_data) +{ + gtk_menu_detach (GTK_MENU (menushell)); + + /* FIXME: we shouldn't have to disconnec the signal (bgo #641327) */ + g_signal_handlers_disconnect_by_func (menushell, + menu_deactivate_cb, user_data); +} + static gboolean contact_list_view_popup_menu_idle_cb (gpointer user_data) { @@ -822,8 +833,15 @@ contact_list_view_popup_menu_idle_cb (gpointer user_data) gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, data->button, data->time); - g_object_ref_sink (menu); - g_object_unref (menu); + + /* menu is initially unowned but gtk_menu_attach_to_widget() taked its + * floating ref. We can either wait that the treeview releases its ref + * when it will be destroyed (when leaving Empathy) or explicitely + * detach the menu when it's not displayed any more. + * We go for the latter as we don't want to keep useless menus in memory + * during the whole lifetime of Empathy. */ + g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivate_cb), + NULL); } g_slice_free (MenuPopupData, data); |