static gboolean font_fetch(void) { gchar *font_name; font_name = g_strdup(gtk_font_selection_get_font_name( GTK_FONT_SELECTION(font_browse_w))); if (font_name == NULL) { /* No font was selected; let the user know, but don't tear down the font selection dialog, so they can try again. */ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "You have not selected a font."); return FALSE; } if (!user_font_test(font_name)) { /* The font isn't usable; "user_font_test()" has already told the user why. Don't tear down the font selection dialog. */ g_free(font_name); return FALSE; } new_font_name = font_name; return TRUE; }
void update_font (GtkWidget * crap) { if (fntname) g_free (fntname); fntname = g_strdup (gtk_font_selection_get_font_name (GTK_FONT_SELECTION (blah))); return; }
/* Gets the currently-selected font name. */ int clip_GTK_FONTSELECTIONGETFONTNAME(ClipMachine * ClipMachineMemory) { C_widget *cfsel = _fetch_cw_arg(ClipMachineMemory); CHECKCWID(cfsel, GTK_IS_FONT_SELECTION); _clip_retc(ClipMachineMemory, gtk_font_selection_get_font_name(GTK_FONT_SELECTION(cfsel->widget))); return 0; err: return 1; }
static void custom_widget_apply(GtkPrintOperation *prt, GtkWidget *font_dialog, gpointer user_data) { gchar *font = NULL; #if GTK_CHECK_VERSION(2,20,0) if(gtk_widget_get_realized(font_dialog)) #else if(GTK_WIDGET_REALIZED(font_dialog)) #endif font = gtk_font_selection_get_font_name(GTK_FONT_SELECTION(font_dialog)); Trace("Selected font: \"%s\"",font); if(font) g_object_set_data_full(G_OBJECT(prt),"3270FontName",font,g_free); }
void font_print_result (void) { if (options.font_data.separate_output) { PangoFontFace *face; PangoFontFamily *family; gint size; face = gtk_font_selection_get_face (GTK_FONT_SELECTION (font)); family = gtk_font_selection_get_family (GTK_FONT_SELECTION (font)); size = gtk_font_selection_get_size (GTK_FONT_SELECTION (font)); if (options.common_data.quoted_output) { gchar *q1 = g_shell_quote (pango_font_family_get_name (family)); gchar *q2 = g_shell_quote (pango_font_face_get_face_name (face)); g_printf ("%s%s%s%s%d\n", q1, options.common_data.separator, q2, options.common_data.separator, size / 1000); g_free (q1); g_free (q2); } else { g_printf ("%s%s%s%s%d\n", pango_font_family_get_name (family), options.common_data.separator, pango_font_face_get_face_name (face), options.common_data.separator, size / 1000); } } else { gchar *fn = gtk_font_selection_get_font_name (GTK_FONT_SELECTION (font)); if (options.common_data.quoted_output) { gchar *buf = g_shell_quote (fn); g_printf ("%s\n", buf); g_free (buf); } else g_printf ("%s\n", fn); g_free (fn); } }
/* Does not work as expected yet. Need to know how to make it return XLFD. */ void gui_dialog_show_fontchooser(GtkWidget * txt_entry) { GtkWidget *font_selector = NULL; GGaduKeyValue *kv = (GGaduKeyValue *) g_object_get_data(G_OBJECT(txt_entry), "kv"); gchar *font_name = NULL; gint response; font_selector = gtk_font_selection_dialog_new(_("Select font")); response = gtk_dialog_run(GTK_DIALOG(font_selector)); if (response == GTK_RESPONSE_OK) { font_name = (gchar *) gtk_font_selection_get_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_selector)->fontsel)); gtk_entry_set_text(GTK_ENTRY(txt_entry), font_name); kv->value = (gpointer) font_name; } gtk_widget_destroy(font_selector); }
/** * Print the font currently selected by a font selection widget. * @param font_selection font selection widget to print information about */ void mk_print_GtkFontSelection_info(GtkFontSelection* font_selection) { const gchar* font_name = gtk_font_selection_get_font_name(font_selection); g_printf("\t%s", font_name); }
static void notify_font_name_cb (GObject *fontsel, GParamSpec *pspec, gpointer data) { g_debug ("Changed font name %s", gtk_font_selection_get_font_name (GTK_FONT_SELECTION (fontsel))); }