Add clutter-text properties to StEntry and StLabel
Add clutter-text properties to allow getting access to the underlying ClutterText actor. This corresponds to the get_clutter_text() methods. The PROP_LABEL and PROP_ENTRY enum values are renamed to PROP_TEXT to match the names of the properties that they correspond to, and the properties of StEntry are reordered into alphabetical order. Based on a patch from Colin Walters https://bugzilla.gnome.org/show_bug.cgi?id=591245 http://bugzilla.moblin.org/show_bug.cgi?id=6313
This commit is contained in:
parent
4057cfaa17
commit
a37c86636b
src/st
@ -70,8 +70,9 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_ENTRY,
|
PROP_CLUTTER_TEXT,
|
||||||
PROP_HINT
|
PROP_HINT_TEXT,
|
||||||
|
PROP_TEXT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
@ -112,12 +113,12 @@ st_entry_set_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_ENTRY:
|
case PROP_HINT_TEXT:
|
||||||
st_entry_set_text (entry, g_value_get_string (value));
|
st_entry_set_hint_text (entry, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HINT:
|
case PROP_TEXT:
|
||||||
st_entry_set_hint_text (entry, g_value_get_string (value));
|
st_entry_set_text (entry, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -136,12 +137,17 @@ st_entry_get_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_ENTRY:
|
case PROP_CLUTTER_TEXT:
|
||||||
g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->entry)));
|
g_value_set_object (value, priv->entry);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HINT:
|
case PROP_HINT_TEXT:
|
||||||
g_value_set_string (value, priv->hint);
|
g_value_set_string (value, priv->hint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TEXT:
|
||||||
|
g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->entry)));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
@ -583,18 +589,25 @@ st_entry_class_init (StEntryClass *klass)
|
|||||||
|
|
||||||
widget_class->style_changed = st_entry_style_changed;
|
widget_class->style_changed = st_entry_style_changed;
|
||||||
|
|
||||||
pspec = g_param_spec_string ("text",
|
pspec = g_param_spec_object ("clutter-text",
|
||||||
"Text",
|
"Clutter Text",
|
||||||
"Text of the entry",
|
"Internal ClutterText actor",
|
||||||
NULL, G_PARAM_READWRITE);
|
CLUTTER_TYPE_TEXT,
|
||||||
g_object_class_install_property (gobject_class, PROP_ENTRY, pspec);
|
G_PARAM_READABLE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_CLUTTER_TEXT, pspec);
|
||||||
|
|
||||||
pspec = g_param_spec_string ("hint-text",
|
pspec = g_param_spec_string ("hint-text",
|
||||||
"Hint Text",
|
"Hint Text",
|
||||||
"Text to display when the entry is not focused "
|
"Text to display when the entry is not focused "
|
||||||
"and the text property is empty",
|
"and the text property is empty",
|
||||||
NULL, G_PARAM_READWRITE);
|
NULL, G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (gobject_class, PROP_ENTRY, pspec);
|
g_object_class_install_property (gobject_class, PROP_HINT_TEXT, pspec);
|
||||||
|
|
||||||
|
pspec = g_param_spec_string ("text",
|
||||||
|
"Text",
|
||||||
|
"Text of the entry",
|
||||||
|
NULL, G_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_TEXT, pspec);
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
/**
|
/**
|
||||||
@ -735,7 +748,7 @@ st_entry_set_text (StEntry *entry,
|
|||||||
*
|
*
|
||||||
* Retrieve the internal #ClutterText so that extra parameters can be set
|
* Retrieve the internal #ClutterText so that extra parameters can be set
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): ethe #ClutterText used by #StEntry. The entry is
|
* Returns: (transfer none): the #ClutterText used by #StEntry. The entry is
|
||||||
* owned by the #StEntry and should not be unref'ed by the application.
|
* owned by the #StEntry and should not be unref'ed by the application.
|
||||||
*/
|
*/
|
||||||
ClutterActor*
|
ClutterActor*
|
||||||
|
@ -50,7 +50,8 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_LABEL
|
PROP_CLUTTER_TEXT,
|
||||||
|
PROP_TEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ST_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_LABEL, StLabelPrivate))
|
#define ST_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_LABEL, StLabelPrivate))
|
||||||
@ -72,7 +73,7 @@ st_label_set_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_LABEL:
|
case PROP_TEXT:
|
||||||
st_label_set_text (label, g_value_get_string (value));
|
st_label_set_text (label, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -92,7 +93,11 @@ st_label_get_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_LABEL:
|
case PROP_CLUTTER_TEXT:
|
||||||
|
g_value_set_object (value, priv->label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TEXT:
|
||||||
g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->label)));
|
g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->label)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -232,11 +237,18 @@ st_label_class_init (StLabelClass *klass)
|
|||||||
|
|
||||||
widget_class->style_changed = st_label_style_changed;
|
widget_class->style_changed = st_label_style_changed;
|
||||||
|
|
||||||
|
pspec = g_param_spec_object ("clutter-text",
|
||||||
|
"Clutter Text",
|
||||||
|
"Internal ClutterText actor",
|
||||||
|
CLUTTER_TYPE_TEXT,
|
||||||
|
G_PARAM_READABLE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_CLUTTER_TEXT, pspec);
|
||||||
|
|
||||||
pspec = g_param_spec_string ("text",
|
pspec = g_param_spec_string ("text",
|
||||||
"Text",
|
"Text",
|
||||||
"Text of the label",
|
"Text of the label",
|
||||||
NULL, G_PARAM_READWRITE);
|
NULL, G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (gobject_class, PROP_LABEL, pspec);
|
g_object_class_install_property (gobject_class, PROP_TEXT, pspec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user