diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-11-30 04:25:34 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-11-30 04:25:34 +0000 |
commit | d29ec308bd6dbfa07f81d7d02450a6c61812a330 (patch) | |
tree | 48b7cfe75e4a2f36c0cb008161fdcd59c812b7ac /gtk/gtktoggleaction.c | |
parent | 924765a2fe8015290a4bd26ad93d5ad33091fd24 (diff) | |
download | gtk+-d29ec308bd6dbfa07f81d7d02450a6c61812a330.tar.gz |
Add an active property. (#322673, Jorn Baayen)
2005-11-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktoggleaction.c (gtk_toggle_action_class_init): Add
an active property. (#322673, Jorn Baayen)
Diffstat (limited to 'gtk/gtktoggleaction.c')
-rw-r--r-- | gtk/gtktoggleaction.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gtk/gtktoggleaction.c b/gtk/gtktoggleaction.c index 332b1cbd40..8d032c5469 100644 --- a/gtk/gtktoggleaction.c +++ b/gtk/gtktoggleaction.c @@ -47,7 +47,8 @@ enum enum { PROP_0, - PROP_DRAW_AS_RADIO + PROP_DRAW_AS_RADIO, + PROP_ACTIVE }; static void gtk_toggle_action_init (GtkToggleAction *action); @@ -133,6 +134,21 @@ gtk_toggle_action_class_init (GtkToggleActionClass *klass) FALSE, GTK_PARAM_READWRITE)); + /** + * GtkToggleAction:active: + * + * If the toggle action should be active in or not. + * + * Since: 2.10 + */ + g_object_class_install_property (gobject_class, + PROP_ACTIVE, + g_param_spec_boolean ("active", + P_("Active"), + P_("If the toggle action should be active in or not"), + FALSE, + GTK_PARAM_READWRITE)); + action_signals[TOGGLED] = g_signal_new (I_("toggled"), G_OBJECT_CLASS_TYPE (klass), @@ -199,6 +215,9 @@ get_property (GObject *object, case PROP_DRAW_AS_RADIO: g_value_set_boolean (value, gtk_toggle_action_get_draw_as_radio (action)); break; + case PROP_ACTIVE: + g_value_set_boolean (value, gtk_toggle_action_get_active (action)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -218,6 +237,9 @@ set_property (GObject *object, case PROP_DRAW_AS_RADIO: gtk_toggle_action_set_draw_as_radio (action, g_value_get_boolean (value)); break; + case PROP_ACTIVE: + gtk_toggle_action_set_active (action, g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -235,6 +257,8 @@ gtk_toggle_action_activate (GtkAction *action) toggle_action->private_data->active = !toggle_action->private_data->active; + g_object_notify (action, "active"); + gtk_toggle_action_toggled (toggle_action); } |