gboolean generic_dialog_get_alternative_button_order(GtkWidget *widget) { GtkSettings *settings; GObjectClass *klass; gboolean alternative_order = FALSE; settings = gtk_settings_get_for_screen(gtk_widget_get_screen(widget)); klass = G_OBJECT_CLASS(GTK_SETTINGS_GET_CLASS(settings)); if (g_object_class_find_property(klass, "gtk-alternative-button-order")) { g_object_get(settings, "gtk-alternative-button-order", &alternative_order, NULL); } return alternative_order; }
/** * gtk_psfont_get_font_description: * @font: a #GtkPSFont * @height: font height * * Get a #PangoDescriptionFont from PS Font. * * Returns: a #PangoFontDescription pointer. */ PangoFontDescription * gtk_psfont_get_font_description(GtkPSFont *font, gint height) { PangoFontDescription *font_desc; gchar *font_string; GtkSettings *settings = gtk_settings_get_for_screen(gdk_screen_get_default()); GObjectClass *klass; gdouble dpi; g_return_val_if_fail (font != NULL, NULL); if (height <= 0) height = 1; /* Dirty hack to get the correct font size for this device http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html */ klass = G_OBJECT_CLASS(GTK_SETTINGS_GET_CLASS(settings)); /* Check that the properties we're looking at are defined. */ if (!g_object_class_find_property(klass, "gtk-xft-dpi")) { dpi = 96.; } else { /* Read the settings. */ gint int_dpi; g_object_get(G_OBJECT(settings), "gtk-xft-dpi", &int_dpi, NULL); if(int_dpi <= 0) dpi = 96; else dpi = int_dpi / PANGO_SCALE; } /* { GdkScreen *screen = gdk_screen_get_default (); FcPattern *pattern; pattern = FcPatternCreate(); if (pattern) { XftDefaultSubstitute (GDK_SCREEN_XDISPLAY (screen), GDK_SCREEN_XNUMBER (screen), pattern); FcPatternGetDouble (pattern, FC_DPI, 0, &dpi); FcPatternDestroy (pattern); } } */ height *= 75./dpi; font_string = g_strdup_printf("%s %i", font->pango_description, height); font_desc = pango_font_description_from_string(font_string); g_free(font_string); if (!font_desc) { font_string = g_strdup_printf("%s %i", default_font, height); font_desc = pango_font_description_from_string(font_string); g_free(font_string); if (font_desc) g_message ("Font %s not describable, using %s instead.", font->fontname, default_font); else g_warning ("Error, couldn't describe default font. Shouldn't happen."); } /* Loading via the pango fontset facility means that pango.aliases is used */ /* This is not working */ /* It is screwing up the whole thing */ /* if (font_desc) { PangoContext *context = gdk_pango_context_get(); PangoFontset *pffontset; PangoFont *pffont; pffontset = pango_context_load_fontset(context, font_desc, pango_context_get_language(context)); if (pffontset) { pffont = pango_fontset_get_font(pffontset, g_utf8_get_char(" ")); if (pffont) { PangoFontDescription *font_desc; desc = pango_font_describe(pffont); g_object_unref(G_OBJECT(pffont)); if (desc) { pango_font_description_free(font_desc); font_desc = desc; } } g_object_unref(G_OBJECT(pffontset)); } } */ return font_desc; }