gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG(fontsel), gtk_entry_get_text(GTK_ENTRY(uc->entry)));
if (!gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG(fontsel), fontname)) {  GdkFont *font = gdk_font_load(fontname); if (font) { XFontStruct *xfs = GDK_FONT_XFONT(font); Display *disp = GDK_FONT_XDISPLAY(font); Atom fontprop = XInternAtom(disp, "FONT", False); unsigned long ret; if (XGetFontProperty(xfs, fontprop, &ret)) { char *name = XGetAtomName(disp, (Atom)ret); if (name) gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG(fontsel), name); } gdk_font_unref(font); } }
static void filefont_clicked(GtkButton *button, gpointer data){    struct dlgparam *dp = (struct dlgparam *)data;    struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));    if (uc->ctrl->generic.type == CTRL_FILESELECT) {	GtkWidget *filesel =	    gtk_file_selection_new(uc->ctrl->fileselect.title);	gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);	gtk_object_set_data	    (GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",	     (gpointer)filesel);	gtk_object_set_data(GTK_OBJECT(filesel), "user-data", (gpointer)uc);	gtk_signal_connect	    (GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",	     GTK_SIGNAL_FUNC(filesel_ok), (gpointer)dp);	gtk_signal_connect_object	    (GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",	     GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)filesel);	gtk_signal_connect_object	    (GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked",	     GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)filesel);	gtk_widget_show(filesel);    }    if (uc->ctrl->generic.type == CTRL_FONTSELECT) {	gchar *spacings[] = { "c", "m", NULL };	GtkWidget *fontsel =	    gtk_font_selection_dialog_new("Select a font");	gtk_window_set_modal(GTK_WINDOW(fontsel), TRUE);	gtk_font_selection_dialog_set_filter	    (GTK_FONT_SELECTION_DIALOG(fontsel),	     GTK_FONT_FILTER_BASE, GTK_FONT_ALL,	     NULL, NULL, NULL, NULL, spacings, NULL);	gtk_font_selection_dialog_set_font_name	    (GTK_FONT_SELECTION_DIALOG(fontsel),	     gtk_entry_get_text(GTK_ENTRY(uc->entry)));	gtk_object_set_data	    (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),	     "user-data", (gpointer)fontsel);	gtk_object_set_data(GTK_OBJECT(fontsel), "user-data", (gpointer)uc);	gtk_signal_connect	    (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),	     "clicked", GTK_SIGNAL_FUNC(fontsel_ok), (gpointer)dp);	gtk_signal_connect_object	    (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),	     "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),	     (gpointer)fontsel);	gtk_signal_connect_object	    (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->cancel_button),	     "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),	     (gpointer)fontsel);	gtk_widget_show(fontsel);    }}