/* * Writes the source code needed to create this widget. * You have to output everything necessary to create the widget here, though * there are some convenience functions to help. */ static void gb_font_selection_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) { const gchar *preview_text; if (data->create_widget) { source_add (data, " %s = gtk_font_selection_new ();\n", data->wname); } gb_widget_write_standard_source (widget, data); preview_text = gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (widget)); if (strcmp (preview_text, DEFAULT_PREVIEW_TEXT)) { gboolean translatable, context; gchar *comments; glade_util_get_translation_properties (widget, PreviewText, &translatable, &comments, &context); source_add_translator_comments (data, translatable, comments); source_add (data, " gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (%s), %s);\n", data->wname, source_make_string_full (preview_text, data->use_gettext && translatable, context)); } }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_font_selection_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { const gchar *preview_text; preview_text = gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (widget)); gb_widget_output_translatable_string (data, PreviewText, preview_text); }
/* Gets the text displayed in the preview area. */ int clip_GTK_FONTSELECTIONGETPREVIEWTEXT(ClipMachine * ClipMachineMemory) { C_widget *cfsel = _fetch_cw_arg(ClipMachineMemory); CHECKCWID(cfsel, GTK_IS_FONT_SELECTION); _clip_retc(ClipMachineMemory, gtk_font_selection_get_preview_text(GTK_FONT_SELECTION(cfsel->widget))); return 0; err: return 1; }
static void notify_preview_text_cb (GObject *fontsel, GParamSpec *pspec, gpointer data) { g_debug ("Changed preview text %s", gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (fontsel))); }