From a11e45a1ebc9574ea3a60f6bc031affecd088208 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jan 2004 21:54:33 +0000 Subject: Add creation functions for actions. Wed Jan 7 22:20:20 2004 Matthias Clasen * 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) --- gtk/gtktoggleaction.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'gtk/gtktoggleaction.c') diff --git a/gtk/gtktoggleaction.c b/gtk/gtktoggleaction.c index c3ac2d71f6..1f4a8d7a03 100644 --- a/gtk/gtktoggleaction.c +++ b/gtk/gtktoggleaction.c @@ -151,6 +151,39 @@ gtk_toggle_action_init (GtkToggleAction *action) action->private_data->draw_as_radio = FALSE; } +/** + * gtk_toggle_action_new: + * @name: A unique name for the action + * @label: The label displayed in menu items and on buttons + * @tooltip: A tooltip for the action + * @stock_id: The stock icon to display in widgets representing the action + * + * Creates a new #GtkToggleAction 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 #GtkToggleAction + * + * Since: 2.4 + */ +GtkToggleAction * +gtk_toggle_action_new (const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *stock_id) +{ + GtkToggleAction *action; + + action = g_object_new (GTK_TYPE_TOGGLE_ACTION, + "name", name, + "label", label, + "tooltip", tooltip, + "stock_id", stock_id, + NULL); + + return action; +} + static void get_property (GObject *object, guint prop_id, @@ -170,7 +203,6 @@ get_property (GObject *object, } } - static void set_property (GObject *object, guint prop_id, -- cgit v1.2.1