Count font names added to the list, to fix font combo boxes

This commit is contained in:
Christian Dywan 2009-09-28 23:54:39 +02:00
parent 6d31faecf3
commit 7a5329a1e0

View file

@ -283,7 +283,7 @@ katze_property_proxy (gpointer object,
|| _hint == g_intern_string ("font-monospace"))) || _hint == g_intern_string ("font-monospace")))
{ {
GtkComboBox* combo; GtkComboBox* combo;
int n_families, i; gint n_families, i;
PangoContext* context; PangoContext* context;
PangoFontFamily** families; PangoFontFamily** families;
gboolean monospace = _hint == g_intern_string ("font-monospace"); gboolean monospace = _hint == g_intern_string ("font-monospace");
@ -296,6 +296,8 @@ katze_property_proxy (gpointer object,
if (!string) if (!string)
string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value); string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
if (string) if (string)
{
gint j = 0;
for (i = 0; i < n_families; i++) for (i = 0; i < n_families; i++)
{ {
const gchar* font = pango_font_family_get_name (families[i]); const gchar* font = pango_font_family_get_name (families[i]);
@ -303,7 +305,9 @@ katze_property_proxy (gpointer object,
continue; continue;
gtk_combo_box_append_text (combo, font); gtk_combo_box_append_text (combo, font);
if (!g_ascii_strcasecmp (font, string)) if (!g_ascii_strcasecmp (font, string))
gtk_combo_box_set_active (combo, i); gtk_combo_box_set_active (combo, j);
j++;
}
} }
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE ( gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (
gtk_combo_box_get_model (combo)), 0, GTK_SORT_ASCENDING); gtk_combo_box_get_model (combo)), 0, GTK_SORT_ASCENDING);