Commit 623f9546 authored by Sébastien Wilmet's avatar Sébastien Wilmet

Connect to ::selection-done to destroy the GeditNotebookPopupMenu's

It's better than calling g_object_unref() directly after
gtk_menu_popup(), ::selection-done has more guarantees to work.
parent 9e10935d
......@@ -1536,7 +1536,10 @@ row_on_button_pressed (GtkWidget *row_event_box,
GeditTab *tab = GEDIT_TAB (document_row->ref);
GtkWidget *menu = gedit_notebook_popup_menu_new (window, tab);
g_object_ref_sink (menu);
g_signal_connect (menu,
"selection-done",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_menu_popup_for_device (GTK_MENU (menu),
gdk_event_get_device ((GdkEvent *)event),
......@@ -1545,8 +1548,6 @@ row_on_button_pressed (GtkWidget *row_event_box,
event->button,
event->time);
g_object_unref (menu);
return TRUE;
}
}
......
......@@ -2219,14 +2219,15 @@ on_show_popup_menu (GeditMultiNotebook *multi,
menu = gedit_notebook_popup_menu_new (window, tab);
g_object_ref_sink (menu);
g_signal_connect (menu,
"selection-done",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (menu);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
NULL, NULL,
event->button, event->time);
g_object_unref (menu);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment