[maemo-developers] [Hildon-Extras] Proposing two new helper functions (logical font desc + color)
From: Thomas Perl th.perl at gmail.comDate: Tue Mar 23 12:38:53 EET 2010
- Previous message: Ask for removal of some packages from Extras Fremantle repository
- Next message: [Hildon-Extras] Proposing two new helper functions (logical font desc + color)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello!
I've ported my "logical font style retrieval" code from gPodder to C
for use in MæPad, as I have not found similar functionality in the
Hildon libraries:
+gchar *
+he_get_logical_font_desc(const gchar *name)
+{
+ GtkSettings *settings = gtk_settings_get_default();
+ GtkStyle *style = gtk_rc_get_style_by_paths(settings,
+ name, NULL, G_TYPE_NONE);
+
+ return pango_font_description_to_string(style->font_desc);
+}
+
+gchar *
+he_get_logical_font_color(const gchar *name)
+{
+ GdkColor color;
+ GtkSettings *settings = gtk_settings_get_default();
+ GtkStyle *style = gtk_rc_get_style_by_paths(settings,
+ "GtkButton", "osso-logical-colors", GTK_TYPE_BUTTON);
+
+ if (gtk_style_lookup_color(style, name, &color)) {
+ return gdk_color_to_string(&color);
+ } else {
+ return NULL;
+ }
+}
These functions are best used in combination with Pango Markup to
style text (e.g. in treeview models).
Is this something that we want to have in Hildon-Extras? If so, I'm
going to prepare a patch. The best place for this code is in
he-helper.{c,h}, right? The logical color and font names can be found
in the "Fremantle Master Layout Guide" (page 9 for fonts, page 17 for
colors), but of course I'd be including #defines for these names in
the HE implementation.
Thomas
- Previous message: Ask for removal of some packages from Extras Fremantle repository
- Next message: [Hildon-Extras] Proposing two new helper functions (logical font desc + color)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
