summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--ChangeLog.pre-2-030
-rw-r--r--ChangeLog.pre-2-1030
-rw-r--r--ChangeLog.pre-2-230
-rw-r--r--ChangeLog.pre-2-430
-rw-r--r--ChangeLog.pre-2-630
-rw-r--r--ChangeLog.pre-2-830
-rw-r--r--gtk/gtkcheckbutton.c8
-rw-r--r--gtk/gtkcheckmenuitem.c29
-rw-r--r--gtk/gtkcheckmenuitem.h21
-rw-r--r--gtk/gtkcolorsel.c5
-rw-r--r--gtk/gtkimagemenuitem.c32
-rw-r--r--gtk/gtkimagemenuitem.h18
-rw-r--r--gtk/gtklabel.c16
-rw-r--r--gtk/gtkmenuitem.c29
-rw-r--r--gtk/gtkmenuitem.h1
-rw-r--r--gtk/gtkradiobutton.c50
-rw-r--r--gtk/gtkradiobutton.h22
-rw-r--r--gtk/gtkradiomenuitem.c31
-rw-r--r--gtk/gtkradiomenuitem.h17
-rw-r--r--gtk/gtktogglebutton.c26
-rw-r--r--gtk/gtktogglebutton.h28
22 files changed, 483 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 9c6b5c9dce..e343295994 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,33 @@
+2001-06-05 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcolorsel.c: Use new mnemonic convenience functions
+
+ Applying patch from Jeff Franks, with function docs added.
+
+ * gtk/gtkcheckbutton.c (gtk_check_button_new_with_mnemonic):
+ remove call to set_mnemonic_widget, change docs a bit.
+
+ * gtk/gtkimagemenuitem.c (gtk_image_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtkmenuitem.c (gtk_menu_item_new_with_mnemonic): new function
+
+ * gtk/gtkradiobutton.c (gtk_radio_button_new_with_mnemonic): new
+ function
+ (gtk_radio_button_new_with_mnemonic_from_widget): new function
+
+ * gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_with_mnemonic):
+ new function
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_new_with_mnemonic): new
+ function
+
+ * gtk/gtklabel.c (gtk_label_new_with_mnemonic): Improve docs on
+ auto-selection of mnemonic widget.
+
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index f888e65113..9c535d9576 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -145,10 +145,9 @@ gtk_check_button_new_with_label (const gchar *label)
* mnemonic character
* @returns: a new #GtkCheckButton
*
- * Creates a new #GtkCheckButton containing a label.
- * If characters in @label are preceded by an underscore, they are underlined
- * indicating that they represent a keyboard accelerator called a mnemonic.
- * Pressing Alt and that key activates the checkbutton.
+ * Creates a new #GtkCheckButton containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the check button.
**/
GtkWidget*
gtk_check_button_new_with_mnemonic (const gchar *label)
@@ -159,7 +158,6 @@ gtk_check_button_new_with_mnemonic (const gchar *label)
check_button = gtk_check_button_new ();
label_widget = gtk_label_new_with_mnemonic (label);
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label_widget), check_button);
gtk_container_add (GTK_CONTAINER (check_button), label_widget);
gtk_widget_show (label_widget);
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index efeb6fcf07..914888fd7a 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -165,6 +165,35 @@ gtk_check_menu_item_new_with_label (const gchar *label)
return check_menu_item;
}
+
+/**
+ * gtk_check_menu_item_new_with_mnemonic:
+ * @label: The text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkCheckMenuItem
+ *
+ * Creates a new #GtkCheckMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ **/
+GtkWidget*
+gtk_check_menu_item_new_with_mnemonic (const gchar *label)
+{
+ GtkWidget *check_menu_item;
+ GtkWidget *accel_label;
+
+ check_menu_item = gtk_check_menu_item_new ();
+ accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
+ gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (check_menu_item), accel_label);
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), check_menu_item);
+ gtk_widget_show (accel_label);
+
+ return check_menu_item;
+}
+
void
gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
gboolean is_active)
diff --git a/gtk/gtkcheckmenuitem.h b/gtk/gtkcheckmenuitem.h
index 87317741f7..15d9707afb 100644
--- a/gtk/gtkcheckmenuitem.h
+++ b/gtk/gtkcheckmenuitem.h
@@ -67,16 +67,17 @@ struct _GtkCheckMenuItemClass
};
-GtkType gtk_check_menu_item_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_check_menu_item_new (void);
-GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
-void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
- gboolean is_active);
-void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
-
-void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
- gboolean setting);
-gboolean gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item);
+GtkType gtk_check_menu_item_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_check_menu_item_new (void);
+GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
+GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label);
+void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
+ gboolean is_active);
+void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
+void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
+ gboolean setting);
+gboolean gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item);
+
#ifndef GTK_DISABLE_DEPRECATED
void gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item,
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 02f847d7c3..a1cc67fe24 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -854,7 +854,6 @@ do_popup (GtkColorSelection *colorsel,
{
GtkWidget *menu;
GtkWidget *mi;
- GtkWidget *label;
g_object_set_data (G_OBJECT (drawing_area),
"gtk-color-sel",
@@ -862,9 +861,7 @@ do_popup (GtkColorSelection *colorsel,
menu = gtk_menu_new ();
- label = gtk_label_new_with_mnemonic (_("_Save color here"));
- mi = gtk_menu_item_new ();
- gtk_container_add (GTK_CONTAINER (mi), label);
+ mi = gtk_menu_item_new_with_mnemonic (_("_Save color here"));
gtk_signal_connect (GTK_OBJECT (mi), "activate",
GTK_SIGNAL_FUNC (save_color_selected),
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c
index e56f26b05f..68c020407f 100644
--- a/gtk/gtkimagemenuitem.c
+++ b/gtk/gtkimagemenuitem.c
@@ -353,6 +353,38 @@ gtk_image_menu_item_new_with_label (const gchar *label)
return GTK_WIDGET(image_menu_item);
}
+
+/**
+ * gtk_image_menu_item_new_with_mnemonic:
+ * @label: The text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkImageMenuItem
+ *
+ * Creates a new #GtkImageMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ **/
+GtkWidget*
+gtk_image_menu_item_new_with_mnemonic (const gchar *label)
+{
+ GtkImageMenuItem *image_menu_item;
+ GtkWidget *accel_label;
+
+ image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM,
+ NULL));
+
+ accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
+ gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (image_menu_item), accel_label);
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label),
+ GTK_WIDGET (image_menu_item));
+ gtk_widget_show (accel_label);
+
+ return GTK_WIDGET(image_menu_item);
+}
+
GtkWidget*
gtk_image_menu_item_new_from_stock (const gchar *stock_id,
GtkAccelGroup *accel_group)
diff --git a/gtk/gtkimagemenuitem.h b/gtk/gtkimagemenuitem.h
index e3381de09e..d3fbc32e7d 100644
--- a/gtk/gtkimagemenuitem.h
+++ b/gtk/gtkimagemenuitem.h
@@ -62,14 +62,16 @@ struct _GtkImageMenuItemClass
};
-GtkType gtk_image_menu_item_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_image_menu_item_new (void);
-GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
-GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,
- GtkAccelGroup *accel_group);
-void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
- GtkWidget *image);
-GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item);
+GtkType gtk_image_menu_item_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_image_menu_item_new (void);
+GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
+GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label);
+GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,
+ GtkAccelGroup *accel_group);
+void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
+ GtkWidget *image);
+GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item);
+
#ifdef __cplusplus
}
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index aa90199320..ac9e465df0 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -423,10 +423,18 @@ gtk_label_new (const gchar *str)
*
* Creates a new #GtkLabel, containing the text in @str.
*
- * If characters in @str are preceded by an underscore, they are underlined
- * indicating that they represent a keyboard accelerator called a mnemonic.
- * The mnemonic key can be used to activate another widget, chosen automatically,
- * or explicitly using gtk_label_set_mnemonic_widget().
+ * If characters in @str are preceded by an underscore, they are
+ * underlined indicating that they represent a keyboard accelerator
+ * called a mnemonic. The mnemonic key can be used to activate
+ * another widget, chosen automatically, or explicitly using
+ * gtk_label_set_mnemonic_widget().
+ *
+ * If gtk_label_set_mnemonic_widget()
+ * is not called, then the first activatable ancestor of the #GtkLabel
+ * will be chosen as the mnemonic widget. For instance, if the
+ * label is inside a button or menu item, the button or menu item will
+ * automatically become the mnemonic widget and be activated by
+ * the mnemonic.
**/
GtkWidget*
gtk_label_new_with_mnemonic (const gchar *str)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 4c68939ecf..0501a8bd64 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -229,6 +229,35 @@ gtk_menu_item_new_with_label (const gchar *label)
return menu_item;
}
+
+/**
+ * gtk_menu_item_new_with_mnemonic:
+ * @label: The text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkMenuItem
+ *
+ * Creates a new #GtkMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ **/
+GtkWidget*
+gtk_menu_item_new_with_mnemonic (const gchar *label)
+{
+ GtkWidget *menu_item;
+ GtkWidget *accel_label;
+
+ menu_item = gtk_menu_item_new ();
+ accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
+ gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (menu_item), accel_label);
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), menu_item);
+ gtk_widget_show (accel_label);
+
+ return menu_item;
+}
+
static void
gtk_menu_item_destroy (GtkObject *object)
{
diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h
index a879bce741..77f6b435ce 100644
--- a/gtk/gtkmenuitem.h
+++ b/gtk/gtkmenuitem.h
@@ -90,6 +90,7 @@ struct _GtkMenuItemClass
GtkType gtk_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_menu_item_new (void);
GtkWidget* gtk_menu_item_new_with_label (const gchar *label);
+GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);
void gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
GtkWidget *submenu);
void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item);
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index b3294bf7aa..373623e155 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -229,6 +229,35 @@ gtk_radio_button_new_with_label (GSList *group,
return radio_button;
}
+
+/**
+ * gtk_radio_button_new_with_mnemonic:
+ * @group: the radio button group
+ * @label: the text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkRadioButton
+ *
+ * Creates a new #GtkRadioButton containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the button.
+ **/
+GtkWidget*
+gtk_radio_button_new_with_mnemonic (GSList *group,
+ const gchar *label)
+{
+ GtkWidget *radio_button;
+ GtkWidget *label_widget;
+
+ radio_button = gtk_radio_button_new (group);
+ label_widget = gtk_label_new_with_mnemonic (label);
+ gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (radio_button), label_widget);
+ gtk_widget_show (label_widget);
+
+ return radio_button;
+}
+
GtkWidget*
gtk_radio_button_new_from_widget (GtkRadioButton *group)
{
@@ -249,6 +278,27 @@ gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
return gtk_radio_button_new_with_label (l, label);
}
+/**
+ * gtk_radio_button_new_with_mnemonic_from_widget:
+ * @group: widget to get radio group from
+ * @label: the text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkRadioButton
+ *
+ * Creates a new #GtkRadioButton containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the button.
+ **/
+GtkWidget*
+gtk_radio_button_new_with_mnemonic_from_widget (GtkRadioButton *group,
+ const gchar *label)
+{
+ GSList *l = NULL;
+ if (group)
+ l = gtk_radio_button_group (group);
+ return gtk_radio_button_new_with_mnemonic (l, label);
+}
+
GSList*
gtk_radio_button_group (GtkRadioButton *radio_button)
{
diff --git a/gtk/gtkradiobutton.h b/gtk/gtkradiobutton.h
index df91ddfe83..62b66f7440 100644
--- a/gtk/gtkradiobutton.h
+++ b/gtk/gtkradiobutton.h
@@ -62,16 +62,20 @@ struct _GtkRadioButtonClass
GtkType gtk_radio_button_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_radio_button_new (GSList *group);
-GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group);
-GtkWidget* gtk_radio_button_new_with_label (GSList *group,
- const gchar *label);
-GtkWidget* gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
- const gchar *label);
-GSList* gtk_radio_button_group (GtkRadioButton *radio_button);
-void gtk_radio_button_set_group (GtkRadioButton *radio_button,
- GSList *group);
+GtkWidget* gtk_radio_button_new (GSList *group);
+GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group);
+GtkWidget* gtk_radio_button_new_with_label (GSList *group,
+ const gchar *label);
+GtkWidget* gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
+ const gchar *label);
+GtkWidget* gtk_radio_button_new_with_mnemonic (GSList *group,
+ const gchar *label);
+GtkWidget* gtk_radio_button_new_with_mnemonic_from_widget (GtkRadioButton *group,
+ const gchar *label);
+GSList* gtk_radio_button_group (GtkRadioButton *radio_button);
+void gtk_radio_button_set_group (GtkRadioButton *radio_button,
+ GSList *group);
#ifdef __cplusplus
}
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index 27db681dcb..a392057d4e 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -138,6 +138,37 @@ gtk_radio_menu_item_new_with_label (GSList *group,
return radio_menu_item;
}
+
+/**
+ * gtk_radio_menu_item_new_with_mnemonic:
+ * @group: group the radio menu item is inside
+ * @label: the text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkRadioMenuItem
+ *
+ * Creates a new #GtkRadioMenuItem containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the menu item.
+ **/
+GtkWidget*
+gtk_radio_menu_item_new_with_mnemonic (GSList *group,
+ const gchar *label)
+{
+ GtkWidget *radio_menu_item;
+ GtkWidget *accel_label;
+
+ radio_menu_item = gtk_radio_menu_item_new (group);
+ accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
+ gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (radio_menu_item), accel_label);
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), radio_menu_item);
+ gtk_widget_show (accel_label);
+
+ return radio_menu_item;
+}
+
GSList*
gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item)
{
diff --git a/gtk/gtkradiomenuitem.h b/gtk/gtkradiomenuitem.h
index b81376cf12..9c0f362f15 100644
--- a/gtk/gtkradiomenuitem.h
+++ b/gtk/gtkradiomenuitem.h
@@ -61,13 +61,16 @@ struct _GtkRadioMenuItemClass
};
-GtkType gtk_radio_menu_item_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_radio_menu_item_new (GSList *group);
-GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
- const gchar *label);
-GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
-void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
- GSList *group);
+GtkType gtk_radio_menu_item_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_radio_menu_item_new (GSList *group);
+GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
+ const gchar *label);
+GtkWidget* gtk_radio_menu_item_new_with_mnemonic (GSList *group,
+ const gchar *label);
+GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
+void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
+ GSList *group);
+
#ifdef __cplusplus
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 434100df0a..cd61047fae 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -202,6 +202,32 @@ gtk_toggle_button_new_with_label (const gchar *label)
return toggle_button;
}
+/**
+ * gtk_toggle_button_new_with_mnemonic:
+ * @label: the text of the button, with an underscore in front of the
+ * mnemonic character
+ * @returns: a new #GtkToggleButton
+ *
+ * Creates a new #GtkToggleButton containing a label. The label
+ * will be created using gtk_label_new_with_mnemonic(), so underscores
+ * in @label indicate the mnemonic for the button.
+ **/
+GtkWidget*
+gtk_toggle_button_new_with_mnemonic (const gchar *label)
+{
+ GtkWidget *toggle_button;
+ GtkWidget *label_widget;
+
+ toggle_button = gtk_toggle_button_new ();
+ label_widget = gtk_label_new_with_mnemonic (label);
+ gtk_misc_set_alignment (GTK_MISC (label_widget), 0.5, 0.5);
+
+ gtk_container_add (GTK_CONTAINER (toggle_button), label_widget);
+ gtk_widget_show (label_widget);
+
+ return toggle_button;
+}
+
static void
gtk_toggle_button_set_property (GObject *object,
guint prop_id,
diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h
index c00b98bad5..40c8cd7b4b 100644
--- a/gtk/gtktogglebutton.h
+++ b/gtk/gtktogglebutton.h
@@ -67,19 +67,21 @@ struct _GtkToggleButtonClass
};
-GtkType gtk_toggle_button_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_toggle_button_new (void);
-GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);
-void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
- gboolean draw_indicator);
-void gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
- gboolean is_active);
-gboolean gtk_toggle_button_get_active (GtkToggleButton *toggle_button);
-void gtk_toggle_button_toggled (GtkToggleButton *toggle_button);
-
-void gtk_toggle_button_set_inconsistent (GtkToggleButton *toggle_button,
- gboolean setting);
-gboolean gtk_toggle_button_get_inconsistent (GtkToggleButton *toggle_button);
+GtkType gtk_toggle_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget* gtk_toggle_button_new (void);
+GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);
+GtkWidget* gtk_toggle_button_new_with_mnemonic (const gchar *label);
+void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
+ gboolean draw_indicator);
+void gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
+ gboolean is_active);
+gboolean gtk_toggle_button_get_active (GtkToggleButton *toggle_button);
+void gtk_toggle_button_toggled (GtkToggleButton *toggle_button);
+void gtk_toggle_button_set_inconsistent (GtkToggleButton *toggle_button,
+ gboolean setting);
+gboolean gtk_toggle_button_get_inconsistent (GtkToggleButton *toggle_button);
+
#ifdef __cplusplus
}