summaryrefslogtreecommitdiff
path: root/gtk/gtkradioaction.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-01-07 21:54:33 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-01-07 21:54:33 +0000
commita11e45a1ebc9574ea3a60f6bc031affecd088208 (patch)
tree943f86d4e5a2fe931d447710bfb59593eabffc6d /gtk/gtkradioaction.c
parent8f5b438e6b3eb37af60b368b9bda366fc23f2d42 (diff)
downloadgtk+-a11e45a1ebc9574ea3a60f6bc031affecd088208.tar.gz
Add creation functions for actions.
Wed Jan 7 22:20:20 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkaction.h: * gtk/gtkaction.c (gtk_action_new): * gtk/gtktoggleaction.h: * gtk/gtktoggleaction.c (gtk_toggle_action_new): * gtk/gtkradioaction.h: * gtk/gtkradioaction.c (gtk_radio_action_new): Add creation functions for actions. * gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): (gtk_action_group_add_toggle_actions_full): (gtk_action_group_add_radio_actions_full): and use the new functions here. (#125322, Patch by Jeff Frank)
Diffstat (limited to 'gtk/gtkradioaction.c')
-rw-r--r--gtk/gtkradioaction.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gtk/gtkradioaction.c b/gtk/gtkradioaction.c
index e6ae027425..35460a33b8 100644
--- a/gtk/gtkradioaction.c
+++ b/gtk/gtkradioaction.c
@@ -171,6 +171,43 @@ gtk_radio_action_init (GtkRadioAction *action)
action->private_data->value = 0;
}
+/**
+ * gtk_radio_action_new:
+ * @name: A unique name for the action
+ * @label: The label displayed in menu items and on buttons
+ * @tooltip: A tooltip for this action
+ * @stock_id: The stock icon to display in widgets representing this action
+ * @value: The value which gtk_radio_action_get_current_value() should return
+ * if this action is selected.
+ *
+ * Creates a new #GtkRadioAction object. To add the action to
+ * a #GtkActionGroup and set the accelerator for the action,
+ * call gtk_action_group_add_action_with_accel().
+ *
+ * Return value: a new #GtkRadioAction
+ *
+ * Since: 2.4
+ */
+GtkRadioAction *
+gtk_radio_action_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *stock_id,
+ gint value)
+{
+ GtkRadioAction *action;
+
+ action = g_object_new (GTK_TYPE_RADIO_ACTION,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "stock_id", stock_id,
+ "value", value,
+ NULL);
+
+ return action;
+}
+
static void
gtk_radio_action_finalize (GObject *object)
{