aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-03 17:58:57 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-03 18:28:29 +0800
commit8859363aee3d81abd6fb84f8d54f78e782d90425 (patch)
tree95cd9f3291fffdc18790dfb196c157c426370281 /libempathy-gtk
parentf7b205167a4b7e11f1eed687852cb253b1ce1a23 (diff)
downloadgsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar.gz
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar.bz2
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar.lz
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar.xz
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.tar.zst
gsoc2013-empathy-8859363aee3d81abd6fb84f8d54f78e782d90425.zip
individual-view: detach the individual menu once it has been displayed
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-view.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index d5ed8b63a..597b4c4f6 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -889,6 +889,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
individual_view_popup_menu_idle_cb (gpointer user_data)
{
@@ -906,6 +917,15 @@ individual_view_popup_menu_idle_cb (gpointer user_data)
gtk_widget_show (menu);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, data->button,
data->time);
+
+ /* 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);