summaryrefslogtreecommitdiff
path: root/gtk/gtkmenubar.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-03-03 22:15:39 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-03-03 22:15:39 +0000
commit8627dbda08ea95403356442fbb75ac21a7223dc0 (patch)
tree06da440da2bc8d92cfbee6dd5a614ceb95de5f29 /gtk/gtkmenubar.c
parentd9f8121359da5fa8d495aa187e23714b6ebe8b10 (diff)
downloadgtk+-8627dbda08ea95403356442fbb75ac21a7223dc0.tar.gz
Back out changes to propagate keys to parent menu shells, since that broke
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out changes to propagate keys to parent menu shells, since that broke stuff; rather implement ::cycle-focus as a key binding on GtkMenuShell rather than on GtkMenuBar. * gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add add bindings for ::cycle-focus. (In gtkmenubar.c, were mistakently bound to ::move-focus.)
Diffstat (limited to 'gtk/gtkmenubar.c')
-rw-r--r--gtk/gtkmenubar.c77
1 files changed, 10 insertions, 67 deletions
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index e814bc5efe..fa351abd58 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -53,17 +53,8 @@ static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
-static void gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
- GtkDirectionType dir);
static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
-enum {
- CYCLE_FOCUS,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
static GtkMenuShellClass *parent_class = NULL;
GtkType
@@ -91,35 +82,6 @@ gtk_menu_bar_get_type (void)
return menu_bar_type;
}
-static guint
-binding_signal_new (const gchar *signal_name,
- GType itype,
- GSignalFlags signal_flags,
- GCallback handler,
- GSignalAccumulator accumulator,
- gpointer accu_data,
- GSignalCMarshaller c_marshaller,
- GType return_type,
- guint n_params,
- ...)
-{
- va_list args;
- guint signal_id;
-
- g_return_val_if_fail (signal_name != NULL, 0);
-
- va_start (args, n_params);
-
- signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
- g_cclosure_new (handler, NULL, NULL),
- accumulator, accu_data, c_marshaller,
- return_type, n_params, args);
-
- va_end (args);
-
- return signal_id;
-}
-
static void
gtk_menu_bar_class_init (GtkMenuBarClass *class)
{
@@ -142,16 +104,6 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
- signals[CYCLE_FOCUS] =
- binding_signal_new ("cycle_focus",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | GTK_RUN_ACTION,
- G_CALLBACK (gtk_menu_bar_cycle_focus),
- NULL, NULL,
- _gtk_marshal_VOID__ENUM,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_DIRECTION_TYPE);
-
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set,
GDK_Left, 0,
@@ -193,22 +145,6 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD);
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab, GDK_CONTROL_MASK,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab, GDK_CONTROL_MASK,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("shadow_type",
@@ -555,9 +491,16 @@ gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
add_to_window (GTK_WINDOW (toplevel), menubar);
}
-static void
-gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
- GtkDirectionType dir)
+/**
+ * _gtk_menu_bar_cycle_focus:
+ * @menubar: a #GtkMenuBar
+ * @dir: direction in which to cycle the focus
+ *
+ * Move the focus between menubars in the toplevel.
+ **/
+void
+_gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
+ GtkDirectionType dir)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));