P_("Action Name"),
P_("The name used to invoke the action"),
NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
P_("Parameter Type"),
P_("The type of GVariant passed to activate()"),
G_TYPE_VARIANT_TYPE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
P_("Enabled"),
P_("If the action can be activated"),
TRUE,
- G_PARAM_CONSTRUCT |
- G_PARAM_READWRITE |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
}
static void
-g_simple_action_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GSimpleAction *simple = G_SIMPLE_ACTION (object);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_assert (simple->name == NULL);
- simple->name = g_value_dup_string (value);
- break;
-
- case PROP_PARAMETER_TYPE:
- g_assert (simple->parameter_type == NULL);
- simple->parameter_type = g_value_dup_boxed (value);
- break;
-
- case PROP_ENABLED:
- g_simple_action_set_enabled (simple, g_value_get_boolean (value));
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
g_simple_action_get_property (GObject *object,
guint prop_id,
GValue *value,
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->get_property = g_simple_action_get_property;
- object_class->set_property = g_simple_action_set_property;
object_class->finalize = g_simple_action_finalize;
/**
P_("Action Name"),
P_("The name used to invoke the action"),
NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
P_("Parameter Type"),
P_("The type of GVariant passed to activate()"),
G_TYPE_VARIANT_TYPE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
P_("Enabled"),
P_("If the action can be activated"),
TRUE,
- G_PARAM_CONSTRUCT |
- G_PARAM_READWRITE |
+ G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
g_simple_action_new (const gchar *name,
const GVariantType *parameter_type)
{
- return g_object_new (G_TYPE_SIMPLE_ACTION,
- "name", name,
- "parameter-type", parameter_type,
- NULL);
+ GSimpleAction *simple;
+
+ simple = g_object_new (G_TYPE_SIMPLE_ACTION, NULL);
+ simple->name = g_strdup (name);
+
+ if (parameter_type)
+ simple->parameter_type = g_variant_type_copy (parameter_type);
+
+ simple->enabled = TRUE;
+
+ return simple;
}
/**
{
GSimpleAction *simple;
- simple = g_object_new (G_TYPE_SIMPLE_ACTION,
- "name", name,
- "parameter-type", parameter_type,
- NULL);
+ simple = g_object_new (G_TYPE_SIMPLE_ACTION, NULL);
+ simple->name = g_strdup (name);
+
+ if (parameter_type)
+ simple->parameter_type = g_variant_type_copy (parameter_type);
+
+ simple->state = g_variant_ref_sink (state);
- if (state)
- simple->state = g_variant_ref_sink (state);
+ simple->enabled = TRUE;
return simple;
}