[libgda/gtk3] GdauiBasicForm: added "populate-popup" signal



commit be091e4bcccd917847bdd13799d7766dfccbddb2
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Feb 14 18:04:40 2011 +0100

    GdauiBasicForm: added "populate-popup" signal

 libgda-ui/gdaui-basic-form.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 2499166..cbaf5e5 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -124,6 +124,7 @@ enum {
 	HOLDER_CHANGED,
 	ACTIVATED,
 	LAYOUT_CHANGED,
+	POPULATE_POPUP,
 	LAST_SIGNAL
 };
 
@@ -251,6 +252,23 @@ gdaui_basic_form_class_init (GdauiBasicFormClass * class)
 			      NULL, NULL,
 			      _gdaui_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
+	/**
+	 * GdauiBasicForm::populate-popup:
+	 * @form: GdauiBasicForm
+	 *
+	 * Connect this signal and modify the popup menu.
+	 *
+	 * Since: 4.2.4
+	 */
+	gdaui_basic_form_signals[POPULATE_POPUP] =
+		g_signal_new ("populate-popup",
+                              G_TYPE_FROM_CLASS (object_class),
+                              G_SIGNAL_RUN_FIRST,
+                              0,
+                              NULL, NULL,
+                              _gdaui_marshal_VOID__OBJECT, G_TYPE_NONE,
+			      1, GTK_TYPE_MENU);
+
 	class->holder_changed = NULL;
 	class->activated = NULL;
 	class->layout_changed = NULL;
@@ -338,6 +356,9 @@ do_popup_menu (GdauiBasicForm *form, GdkEventButton *event)
 		event_time = gtk_get_current_event_time ();
 	}
 
+	/* allow listeners to add their custom menu items */
+	g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals [POPULATE_POPUP], 0, GTK_MENU (menu));
+
 	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
 			button, event_time);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]