diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c index b6af8be1d0..2939880427 100644 --- a/gtk/gtkfontchooser.c +++ b/gtk/gtkfontchooser.c @@ -731,10 +731,11 @@ cmp_families (const void *a, const void *b) static void populate_list (GtkTreeView* treeview, GtkListStore* model) { - GtkStyleContext *style_context; - GdkRGBA g_color; - PangoColor p_color; - gchar *color_string; + GtkStyleContext *style_context; + GdkRGBA g_color; + PangoColor p_color; + gchar *color_string; + PangoFontDescription *default_font; GtkTreeIter match_row; GtkTreePath *path; @@ -756,7 +757,7 @@ populate_list (GtkTreeView* treeview, GtkListStore* model) /* Get row header font color */ style_context = gtk_widget_get_style_context (GTK_WIDGET (treeview)); gtk_style_context_get_color (style_context, - GTK_STATE_FLAG_NORMAL |GTK_STATE_FLAG_INSENSITIVE, + GTK_STATE_FLAG_NORMAL | GTK_STATE_FLAG_INSENSITIVE, &g_color); p_color.red = (guint16)((gdouble)G_MAXUINT16 * g_color.red); @@ -764,6 +765,9 @@ populate_list (GtkTreeView* treeview, GtkListStore* model) p_color.blue = (guint16)((gdouble)G_MAXUINT16 * g_color.blue); color_string = pango_color_to_string (&p_color); + /* Get theme font */ + default_font = gtk_style_context_get_font (style_context, GTK_STATE_NORMAL); + /* Iterate over families and faces */ for (i=0; ipriv; + gint n_families, i; + PangoFontFamily **families; + GtkFontSelectionPrivate *priv = fontsel->priv; + GtkTreePath *path; pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)), &families, @@ -995,7 +1000,23 @@ populate_font_model (GtkFontSelection *fontsel) 0, families[i], 1, pango_font_family_get_name (families[i]), -1); + if (priv->family && + !strcmp (pango_font_family_get_name (families[i]), + pango_font_family_get_name (priv->family))) + { + path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->_face_model), + &iter); + if (path) + { + gtk_tree_view_set_cursor (gtk_bin_get_child (GTK_BIN (priv->font_list)), + path, + NULL, + FALSE); + gtk_tree_path_free (path); + } + } } + g_free (families); }