Add "name" as a construct-only property. (#125475, Murray Cumming)

Sat Oct 25 23:30:13 2003  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
	as a construct-only property.  (#125475, Murray Cumming)
This commit is contained in:
Matthias Clasen 2003-10-25 21:34:24 +00:00 committed by Matthias Clasen
parent c2612aa5c3
commit 03cd34e13c
6 changed files with 94 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Sat Oct 25 23:30:13 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
as a construct-only property. (#125475, Murray Cumming)
Thu Oct 23 21:55:10 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 116297 and 125472

View File

@ -1,3 +1,8 @@
Sat Oct 25 23:30:13 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
as a construct-only property. (#125475, Murray Cumming)
Thu Oct 23 21:55:10 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 116297 and 125472

View File

@ -1,3 +1,8 @@
Sat Oct 25 23:30:13 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
as a construct-only property. (#125475, Murray Cumming)
Thu Oct 23 21:55:10 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 116297 and 125472

View File

@ -1,3 +1,8 @@
Sat Oct 25 23:30:13 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
as a construct-only property. (#125475, Murray Cumming)
Thu Oct 23 21:55:10 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 116297 and 125472

View File

@ -1,3 +1,8 @@
Sat Oct 25 23:30:13 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkactiongroup.c (gtk_action_group_class_init): Add "name"
as a construct-only property. (#125475, Murray Cumming)
Thu Oct 23 21:55:10 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 116297 and 125472

View File

@ -48,9 +48,23 @@ struct _GtkActionGroupPrivate
GtkDestroyNotify translate_notify;
};
enum
{
PROP_0,
PROP_NAME
};
static void gtk_action_group_init (GtkActionGroup *self);
static void gtk_action_group_class_init (GtkActionGroupClass *class);
static void gtk_action_group_finalize (GObject *object);
static void gtk_action_group_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_action_group_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GtkAction *gtk_action_group_real_get_action (GtkActionGroup *self,
const gchar *name);
@ -93,8 +107,18 @@ gtk_action_group_class_init (GtkActionGroupClass *klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gtk_action_group_finalize;
gobject_class->set_property = gtk_action_group_set_property;
gobject_class->get_property = gtk_action_group_get_property;
klass->get_action = gtk_action_group_real_get_action;
g_object_class_install_property (gobject_class,
PROP_NAME,
g_param_spec_string ("name",
_("Name"),
_("A name for the action group."),
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (gobject_class, sizeof (GtkActionGroupPrivate));
}
@ -154,6 +178,51 @@ gtk_action_group_finalize (GObject *object)
(* parent_class->finalize) (object);
}
static void
gtk_action_group_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkActionGroup *self;
gchar *tmp;
self = GTK_ACTION_GROUP (object);
switch (prop_id)
{
case PROP_NAME:
tmp = self->private_data->name;
self->private_data->name = g_value_dup_string (value);
g_free (tmp);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_action_group_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkActionGroup *self;
self = GTK_ACTION_GROUP (object);
switch (prop_id)
{
case PROP_NAME:
g_value_set_string (value, self->private_data->name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GtkAction *
gtk_action_group_real_get_action (GtkActionGroup *self,
const gchar *action_name)