コード例 #1
0
/*I have to do it, because implement po in script load need lots of time, for me. */
static void
gnome_app_script_preload (ClutterScript *script)
{
	GList *l;
	ClutterActor *actor;
	const gchar *raw;
	const gchar *real;

	for (l = clutter_script_list_objects (script); l; l = l->next) {
		actor = CLUTTER_ACTOR (l->data);
		if (CLUTTER_IS_TEXT (actor)) {
			raw = clutter_text_get_text (CLUTTER_TEXT (actor));
			/*
			 * Bad, all because of script did not recognize the po file.
			 * set_text will finalize the content of clutter_text first
			 * if we set_text by get_text,
			 * the pointer will be 'wide'...
			 * so does gtk_label_set_label.
			 *
			 * It is the bug of clutter and gtk, 
			 *  	altough it may not worth to fix it ..
			 */
			if (raw && raw [0]) {
				real = _(raw);
				if (raw != real)
					clutter_text_set_text (CLUTTER_TEXT (actor), real);
			}
		}
	}
}
コード例 #2
0
ファイル: st-button.c プロジェクト: branton/Cinnamon
static void
st_button_update_label_style (StButton *button)
{
  ClutterActor *label;

  label = st_bin_get_child (ST_BIN (button));

  /* check the child is really a label */
  if (!CLUTTER_IS_TEXT (label))
    return;

  _st_set_text_from_style (CLUTTER_TEXT (label), st_widget_get_theme_node (ST_WIDGET (button)));
}
コード例 #3
0
ファイル: st-button.c プロジェクト: branton/Cinnamon
/**
 * st_button_set_label:
 * @button: a #Stbutton
 * @text: text to set the label to
 *
 * Sets the text displayed on the button
 */
void
st_button_set_label (StButton    *button,
                     const gchar *text)
{
  StButtonPrivate *priv;
  ClutterActor *label;

  g_return_if_fail (ST_IS_BUTTON (button));

  priv = button->priv;

  g_free (priv->text);

  if (text)
    priv->text = g_strdup (text);
  else
    priv->text = g_strdup ("");

  label = st_bin_get_child (ST_BIN (button));

  if (label && CLUTTER_IS_TEXT (label))
    {
      clutter_text_set_text (CLUTTER_TEXT (label), priv->text);
    }
  else
    {
      label = g_object_new (CLUTTER_TYPE_TEXT,
                            "text", priv->text,
                            "line-alignment", PANGO_ALIGN_CENTER,
                            "ellipsize", PANGO_ELLIPSIZE_END,
                            "use-markup", TRUE,
                            NULL);
      st_bin_set_child (ST_BIN (button), label);
    }

  /* Fake a style change so that we reset the style properties on the label */
  st_widget_style_changed (ST_WIDGET (button));

  g_object_notify (G_OBJECT (button), "label");
}
コード例 #4
0
ファイル: text-box.c プロジェクト: tydaikho/xfdashboard
/* Text of editable text box has changed */
static void _xfdashboard_text_box_on_text_changed(XfdashboardTextBox *self, gpointer inUserData)
{
	XfdashboardTextBoxPrivate	*priv;
	ClutterText					*actorText;

	g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self));
	g_return_if_fail(CLUTTER_IS_TEXT(inUserData));

	priv=self->priv;
	actorText=CLUTTER_TEXT(inUserData);

	/* Show hint label depending if text box is empty or not */
	if(xfdashboard_text_box_is_empty(self) && priv->isEditable)
	{
		clutter_actor_show(priv->actorHintLabel);
	}
		else
		{
			clutter_actor_hide(priv->actorHintLabel);
		}

	/* Emit signal for text changed */
	g_signal_emit(self, XfdashboardTextBoxSignals[SIGNAL_TEXT_CHANGED], 0, clutter_text_get_text(actorText));
}