summaryrefslogtreecommitdiff
path: root/gtk/gtktogglebutton.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-07-25 16:12:46 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-07-25 16:12:46 +0000
commiteccc076085e32ad7eb1d9fe3e460764ec1aff279 (patch)
tree0d39e08589e041bfa8580f66780acb6c2d53f331 /gtk/gtktogglebutton.c
parent394ae506bab4781d0c1dab3408d358c6684d0e83 (diff)
downloadgtk+-eccc076085e32ad7eb1d9fe3e460764ec1aff279.tar.gz
[ Patch from Padraig O'Briain, #87904 ]
Thu Jul 25 11:57:57 2002 Owen Taylor <otaylor@redhat.com> [ Patch from Padraig O'Briain, #87904 ] * gtk/gtkwidget.c (gtk_widget_class_init): Cleanup - use G_SIGNAL_RUN_LAST not GTK_RUN_LAST when using g_signal new. * gtk/gtktogglebutton.c (gtk_toggle_button_mnemonic_activate): Always focus the widget, even when we are activating as well.
Diffstat (limited to 'gtk/gtktogglebutton.c')
-rw-r--r--gtk/gtktogglebutton.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 32409d5a8f..739fc5bc44 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -52,6 +52,8 @@ static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
static gint gtk_toggle_button_expose (GtkWidget *widget,
GdkEventExpose *event);
+static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
+ gboolean group_cycling);
static void gtk_toggle_button_pressed (GtkButton *button);
static void gtk_toggle_button_released (GtkButton *button);
static void gtk_toggle_button_clicked (GtkButton *button);
@@ -115,6 +117,7 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
gobject_class->get_property = gtk_toggle_button_get_property;
widget_class->expose_event = gtk_toggle_button_expose;
+ widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
button_class->pressed = gtk_toggle_button_pressed;
button_class->released = gtk_toggle_button_released;
@@ -401,6 +404,24 @@ gtk_toggle_button_expose (GtkWidget *widget,
return FALSE;
}
+static gboolean
+gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
+ gboolean group_cycling)
+{
+ /*
+ * We override the standard implementation in
+ * gtk_widget_real_mnemonic_activate() in order to focus the widget even
+ * if there is no mnemonic conflict.
+ */
+ if (GTK_WIDGET_CAN_FOCUS (widget))
+ gtk_widget_grab_focus (widget);
+
+ if (!group_cycling)
+ gtk_widget_activate (widget);
+
+ return TRUE;
+}
+
static void
gtk_toggle_button_pressed (GtkButton *button)
{