void xfdashboard_text_box_set_text(XfdashboardTextBox *self, const gchar *inMarkupText) { XfdashboardTextBoxPrivate *priv; const gchar *text; g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self)); priv=self->priv; /* Set value if changed */ if(g_strcmp0(clutter_text_get_text(CLUTTER_TEXT(priv->actorTextBox)), inMarkupText)!=0) { clutter_text_set_markup(CLUTTER_TEXT(priv->actorTextBox), inMarkupText); text=clutter_text_get_text(CLUTTER_TEXT(priv->actorTextBox)); if((text==NULL || *text==0) && priv->isEditable) { clutter_actor_show(priv->actorHintLabel); } else { clutter_actor_hide(priv->actorHintLabel); } clutter_actor_queue_relayout(CLUTTER_ACTOR(self)); /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_TEXT]); } }
static void st_entry_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { StEntryPrivate *priv = ST_ENTRY_PRIV (gobject); switch (prop_id) { case PROP_CLUTTER_TEXT: g_value_set_object (value, priv->entry); break; case PROP_HINT_TEXT: 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: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
const gchar* mx_combo_box_get_active_text (MxComboBox *box) { g_return_val_if_fail (MX_IS_COMBO_BOX (box), NULL); return clutter_text_get_text ((ClutterText*) box->priv->label); }
static void mx_combo_box_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { MxComboBoxPrivate *priv = MX_COMBO_BOX (object)->priv; switch (property_id) { case PROP_ACTIVE_TEXT: g_value_set_string (value, clutter_text_get_text ((ClutterText*) priv->label)); break; case PROP_ACTIVE_ICON_NAME: g_value_set_string (value, mx_combo_box_get_active_icon_name ( MX_COMBO_BOX (object))); break; case PROP_INDEX: g_value_set_int (value, priv->index); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
/** * mx_label_get_text: * @label: a #MxLabel * * Get the text displayed on the label * * Returns: the text for the label. This must not be freed by the application */ const gchar * mx_label_get_text (MxLabel *label) { g_return_val_if_fail (MX_IS_LABEL (label), NULL); return clutter_text_get_text (CLUTTER_TEXT (label->priv->label)); }
/*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); } } } }
const gchar * mx_tooltip_get_text (MxTooltip *tooltip) { g_return_val_if_fail (MX_IS_TOOLTIP (tooltip), NULL); return clutter_text_get_text (CLUTTER_TEXT (tooltip->priv->label)); }
static void ensure_visible (ClutterText *text, MxGrid *grid) { GList *children; ClutterActor *child; const gchar *string = clutter_text_get_text (text); gint number = atoi (string) - 1; children = clutter_container_get_children (CLUTTER_CONTAINER (grid)); child = g_list_nth_data (children, number); if (child) { ClutterGeometry geom; MxScrollView *scroll = (MxScrollView *) clutter_actor_get_parent (CLUTTER_ACTOR (grid)); clutter_actor_get_allocation_geometry (child, &geom); mx_scroll_view_ensure_visible (scroll, &geom); printf ("Making child %d visible\n", number); } else printf ("Couldn't make child %d visible\n", number); g_list_free (children); }
static void set_max_stride (ClutterText *text, MxGrid *grid) { const gchar *string = clutter_text_get_text (text); mx_grid_set_max_stride (grid, atoi (string)); printf ("Max Stride: %d\n", atoi (string)); }
static void on_entry_activate (ClutterText *text, gpointer data) { g_print ("Text activated: %s (cursor: %d, selection at: %d)\n", clutter_text_get_text (text), clutter_text_get_cursor_position (text), clutter_text_get_selection_bound (text)); }
/** * st_entry_get_text: * @entry: a #StEntry * * Get the text displayed on the entry * * Returns: the text for the entry. This must not be freed by the application */ const gchar * st_entry_get_text (StEntry *entry) { g_return_val_if_fail (ST_IS_ENTRY (entry), NULL); if (entry->priv->hint_visible) return ""; else return clutter_text_get_text (CLUTTER_TEXT (entry->priv->entry)); }
/* Get/set text of editable text box */ gboolean xfdashboard_text_box_is_empty(XfdashboardTextBox *self) { const gchar *text; g_return_val_if_fail(XFDASHBOARD_IS_TEXT_BOX(self), TRUE); text=clutter_text_get_text(CLUTTER_TEXT(self->priv->actorTextBox)); return(text==NULL || *text==0); }
gint xfdashboard_text_box_get_length(XfdashboardTextBox *self) { const gchar *text; gint textLength=0; g_return_val_if_fail(XFDASHBOARD_IS_TEXT_BOX(self), 0); text=clutter_text_get_text(CLUTTER_TEXT(self->priv->actorTextBox)); if(text) textLength=strlen(text); return(textLength); }
static void text_changed_cb (ClutterText *actor, MplEntry *entry) { gchar const *text; text = clutter_text_get_text (actor); if (text && strlen (text) > 0) clutter_actor_show (entry->priv->clear_button); else clutter_actor_hide (entry->priv->clear_button); g_signal_emit (entry, _signals[TEXT_CHANGED], 0); }
const gchar * gmc_button_get_label (GmcButton *self) { GmcButtonPrivate *priv; priv = GMC_BUTTON_GET_PRIVATE (self); if (priv->label) { return clutter_text_get_text (CLUTTER_TEXT (priv->label)); } else { return NULL; } }
static void mx_label_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { MxLabel *self = MX_LABEL (gobject); MxLabelPrivate *priv = self->priv; switch (prop_id) { 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))); break; case PROP_USE_MARKUP: g_value_set_boolean (value, mx_label_get_use_markup (self)); break; case PROP_X_ALIGN: g_value_set_enum (value, priv->x_align); break; case PROP_Y_ALIGN: g_value_set_enum (value, priv->y_align); break; case PROP_LINE_WRAP: g_value_set_boolean (value, mx_label_get_line_wrap (self)); break; case PROP_FADE_OUT: g_value_set_boolean (value, priv->fade_out); break; case PROP_SHOW_TOOLTIP: g_value_set_boolean (value, priv->show_tooltip); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
static void mx_expander_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { MxExpanderPrivate *priv = MX_EXPANDER (object)->priv; switch (property_id) { case PROP_EXPANDED: g_value_set_boolean (value, priv->expanded); break; case PROP_LABEL: g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->label))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
void gmc_button_set_label (GmcButton *self, const gchar *label) { GmcButtonPrivate *priv; ClutterColor *color; priv = GMC_BUTTON_GET_PRIVATE (self); if (priv->label) { if (g_strcmp0 (label, clutter_text_get_text (CLUTTER_TEXT (priv->label))) == 0) return; clutter_text_set_text (CLUTTER_TEXT (priv->label), label); return; } color = clutter_color_new (0x80, 0x80, 0x80, 0xff); priv->label = clutter_text_new_full ("Comic Sans MS 12", label, color); clutter_actor_set_parent (priv->label, CLUTTER_ACTOR (self)); clutter_color_free (color); }
void xfdashboard_text_box_set_hint_text(XfdashboardTextBox *self, const gchar *inMarkupText) { XfdashboardTextBoxPrivate *priv; gboolean newHintTextSet; g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self)); priv=self->priv; newHintTextSet=FALSE; /* Freeze notification */ g_object_freeze_notify(G_OBJECT(self)); /* Set value if changed */ if(g_strcmp0(clutter_text_get_text(CLUTTER_TEXT(priv->actorHintLabel)), inMarkupText)!=0) { /* Set value */ clutter_text_set_markup(CLUTTER_TEXT(priv->actorHintLabel), inMarkupText); clutter_actor_queue_relayout(CLUTTER_ACTOR(self)); /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_HINT_TEXT]); } /* Check if a hint text was set and if read-only property changes. * Note: NULL string will unset "hint-text-set" property (set to FALSE) */ if(inMarkupText) newHintTextSet=TRUE; if(newHintTextSet!=priv->hintTextSet) { /* Set flag */ priv->hintTextSet=newHintTextSet; /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_HINT_TEXT_SET]); } /* Thaw notification */ g_object_thaw_notify(G_OBJECT(self)); }
/** * st_entry_set_hint_text: * @entry: a #StEntry * @text: (allow-none): text to set as the entry hint * * Sets the text to display when the entry is empty and unfocused. When the * entry is displaying the hint, it has a pseudo class of "indeterminate". * A value of NULL unsets the hint. */ void st_entry_set_hint_text (StEntry *entry, const gchar *text) { StEntryPrivate *priv; g_return_if_fail (ST_IS_ENTRY (entry)); priv = entry->priv; g_free (priv->hint); priv->hint = g_strdup (text); if (!strcmp (clutter_text_get_text (CLUTTER_TEXT (priv->entry)), "") && !HAS_FOCUS (priv->entry)) { priv->hint_visible = TRUE; clutter_text_set_text (CLUTTER_TEXT (priv->entry), priv->hint); st_widget_add_style_pseudo_class (ST_WIDGET (entry), "indeterminate"); } }
static void mx_tooltip_get_property (GObject *gobject, guint prop_id, GValue *value, GParamSpec *pspec) { MxTooltipPrivate *priv = MX_TOOLTIP (gobject)->priv; switch (prop_id) { case PROP_TEXT: g_value_set_string (value, clutter_text_get_text (CLUTTER_TEXT (priv->label))); break; case PROP_TIP_AREA: g_value_set_boxed (value, priv->tip_area); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
void gmc_button_set_icon (GmcButton *self, const gchar *filename) { GmcButtonPrivate *priv; ClutterActor *icon; GError *error = NULL; priv = GMC_BUTTON_GET_PRIVATE (self); icon = clutter_texture_new_from_file (filename, &error); if (!icon) { g_critical ("%s - %s [%s] %s", G_STRFUNC, error->message, filename, clutter_text_get_text (CLUTTER_TEXT (priv->label))); return; } if (priv->icon) { g_object_unref (priv->icon); } priv->icon = icon; clutter_actor_set_size (priv->icon, 24, 24); clutter_actor_set_parent (priv->icon, CLUTTER_ACTOR (self)); }
static void clutter_text_focus_out_cb (ClutterText *text, ClutterActor *actor) { StEntry *entry = ST_ENTRY (actor); StEntryPrivate *priv = entry->priv; GdkKeymap *keymap; st_widget_remove_style_pseudo_class (ST_WIDGET (actor), "focus"); /* add a hint if the entry is empty */ if (priv->hint && !strcmp (clutter_text_get_text (text), "")) { priv->hint_visible = TRUE; clutter_text_set_text (text, priv->hint); st_widget_add_style_pseudo_class (ST_WIDGET (actor), "indeterminate"); } clutter_text_set_cursor_visible (text, FALSE); remove_capslock_feedback (entry); keymap = gdk_keymap_get_for_display (gdk_display_get_default ()); g_signal_handlers_disconnect_by_func (keymap, keymap_state_changed, entry); }
/* 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)); }
void xfdashboard_text_box_set_editable(XfdashboardTextBox *self, gboolean isEditable) { XfdashboardTextBoxPrivate *priv; const gchar *text; g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self)); priv=self->priv; /* Set value if changed */ if(priv->isEditable!=isEditable) { priv->isEditable=isEditable; if(priv->isEditable) xfdashboard_stylable_add_pseudo_class(XFDASHBOARD_STYLABLE(self), "editable"); else xfdashboard_stylable_remove_pseudo_class(XFDASHBOARD_STYLABLE(self), "editable"); /* Set up actors */ clutter_text_set_selectable(CLUTTER_TEXT(priv->actorTextBox), priv->isEditable); clutter_text_set_editable(CLUTTER_TEXT(priv->actorTextBox), priv->isEditable); text=clutter_text_get_text(CLUTTER_TEXT(priv->actorTextBox)); if((text==NULL || *text==0) && priv->isEditable) { clutter_actor_show(priv->actorHintLabel); } else { clutter_actor_hide(priv->actorHintLabel); } clutter_actor_queue_relayout(CLUTTER_ACTOR(self)); /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_EDITABLE]); } }
static void mx_button_update_contents (MxButton *self) { MxButtonPrivate *priv = self->priv; ClutterActor *child; gboolean icon_visible, label_visible; const gchar *text; /* If the icon doesn't have a name set, treat it as * not-visible. */ if (priv->icon_visible && mx_icon_get_icon_name (MX_ICON (priv->icon))) icon_visible = TRUE; else icon_visible = FALSE; text = clutter_text_get_text (CLUTTER_TEXT (priv->label)); if (priv->label_visible && text && (strcmp (text, "") != 0)) label_visible = TRUE; else label_visible = FALSE; /* replace any custom content */ child = mx_bin_get_child (MX_BIN (self)); if (child != priv->hbox) mx_bin_set_child (MX_BIN (self), priv->hbox); /* Handle the simple cases first */ if (!icon_visible && !label_visible) { clutter_actor_hide (priv->hbox); return; } /* ensure the hbox is visible */ clutter_actor_show (priv->hbox); if (icon_visible && !label_visible) { clutter_actor_show (priv->icon); clutter_actor_hide (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); return; } if (!icon_visible && label_visible) { clutter_actor_hide (priv->icon); clutter_actor_show (priv->label); clutter_actor_set_child_below_sibling (priv->hbox, priv->label, NULL); return; } /* Both the icon and text are visible, handle this case */ clutter_actor_show (priv->icon); clutter_actor_show (priv->label); switch (priv->icon_position) { case MX_POSITION_TOP: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); break; case MX_POSITION_RIGHT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); break; case MX_POSITION_BOTTOM: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_VERTICAL); clutter_actor_set_child_above_sibling (priv->hbox, priv->icon, NULL); mx_box_layout_child_set_x_align (MX_BOX_LAYOUT (priv->hbox), priv->label, MX_ALIGN_MIDDLE); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_START, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); break; case MX_POSITION_LEFT: mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->hbox), MX_ORIENTATION_HORIZONTAL); clutter_actor_set_child_below_sibling (priv->hbox, priv->icon, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->label, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->hbox), priv->icon, "x-align", MX_ALIGN_START, "y-align", MX_ALIGN_MIDDLE, NULL); break; } }
static void _xfdashboard_text_box_get_property(GObject *inObject, guint inPropID, GValue *outValue, GParamSpec *inSpec) { XfdashboardTextBox *self=XFDASHBOARD_TEXT_BOX(inObject); XfdashboardTextBoxPrivate *priv=self->priv; switch(inPropID) { case PROP_PADDING: g_value_set_float(outValue, priv->padding); break; case PROP_SPACING: g_value_set_float(outValue, priv->spacing); break; case PROP_EDITABLE: g_value_set_boolean(outValue, priv->isEditable); break; case PROP_PRIMARY_ICON_NAME: g_value_set_string(outValue, priv->primaryIconName); break; case PROP_SECONDARY_ICON_NAME: g_value_set_string(outValue, priv->secondaryIconName); break; case PROP_TEXT: g_value_set_string(outValue, clutter_text_get_text(CLUTTER_TEXT(priv->actorTextBox))); break; case PROP_TEXT_FONT: g_value_set_string(outValue, priv->textFont); break; case PROP_TEXT_COLOR: clutter_value_set_color(outValue, priv->textColor); break; case PROP_SELECTION_TEXT_COLOR: clutter_value_set_color(outValue, priv->selectionTextColor); break; case PROP_SELECTION_BACKGROUND_COLOR: clutter_value_set_color(outValue, priv->selectionBackgroundColor); break; case PROP_HINT_TEXT: g_value_set_string(outValue, clutter_text_get_text(CLUTTER_TEXT(priv->actorHintLabel))); break; case PROP_HINT_TEXT_FONT: g_value_set_string(outValue, priv->hintTextFont); break; case PROP_HINT_TEXT_COLOR: clutter_value_set_color(outValue, priv->hintTextColor); break; case PROP_HINT_TEXT_SET: g_value_set_boolean(outValue, priv->hintTextSet); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(inObject, inPropID, inSpec); break; } }
/* Get/set text of hint label */ const gchar* xfdashboard_text_box_get_hint_text(XfdashboardTextBox *self) { g_return_val_if_fail(XFDASHBOARD_IS_TEXT_BOX(self), NULL); return(clutter_text_get_text(CLUTTER_TEXT(self->priv->actorHintLabel))); }
void on_uri_activate_cb(ClutterText *self, WebKitWebView *web_view) { const gchar *uri = clutter_text_get_text(self); webkit_web_view_load_uri(web_view, uri); }
const gchar * mex_tile_get_secondary_label (MexTile *tile) { g_return_val_if_fail (MEX_IS_TILE (tile), NULL); return clutter_text_get_text (CLUTTER_TEXT (tile->priv->secondary_label)); }