[gtk+/gtk-2-24] Signalify (already existing) GtkMenuShell.insert()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Signalify (already existing) GtkMenuShell.insert()
- Date: Mon, 28 Jan 2013 23:22:47 +0000 (UTC)
commit 5ada51d3c7d3b476d954c4fdddb4895c3de00220
Author: William Hua <william attente ca>
Date: Mon Jan 28 17:21:31 2013 -0500
Signalify (already existing) GtkMenuShell.insert()
gtk_menu_shell_insert() is a virtual function that was being directly
invoked from the class vtable.
Turn it into a proper signal and emit it in the usual way.
See https://bugzilla.gnome.org/show_bug.cgi?id=656565.
This is a backport of Ryan Lortie's commit
05aeaeef9ea41282a8859cbff2116d3fba5d31ea from the GTK+ 3 branch.
gtk/gtkmenushell.c | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index c3e107f..a7ad7b5 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -59,6 +59,7 @@ enum {
CANCEL,
CYCLE_FOCUS,
MOVE_SELECTED,
+ INSERT,
LAST_SIGNAL
};
@@ -326,6 +327,30 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
G_TYPE_BOOLEAN, 1,
G_TYPE_INT);
+ /**
+ * GtkMenuShell::insert:
+ * @menu_shell: the object on which the signal is emitted
+ * @child: the #GtkMenuItem that is being inserted
+ * @position: the position at which the insert occurs
+ *
+ * The ::insert signal is emitted when a new #GtkMenuItem is added to
+ * a #GtkMenuShell. A separate signal is used instead of
+ * GtkContainer::add because of the need for an additional position
+ * parameter.
+ *
+ * The inverse of this signal is the GtkContainer::remove signal.
+ *
+ * Since: 2.24.15
+ **/
+ menu_shell_signals[INSERT] =
+ g_signal_new (I_("insert"),
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkMenuShellClass, insert),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT_INT,
+ G_TYPE_NONE, 2, GTK_TYPE_WIDGET, G_TYPE_INT);
+
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set,
GDK_Escape, 0,
@@ -482,15 +507,10 @@ gtk_menu_shell_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position)
{
- GtkMenuShellClass *class;
-
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
g_return_if_fail (GTK_IS_MENU_ITEM (child));
- class = GTK_MENU_SHELL_GET_CLASS (menu_shell);
-
- if (class->insert)
- class->insert (menu_shell, child, position);
+ g_signal_emit (menu_shell, menu_shell_signals[INSERT], 0, child, position);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]