X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fwidgets%2Ffont-selector.cpp;h=6144840736a5451cf106823610fb20f67abe47a3;hb=36bc7dd88d084a2beb99e61b046e7fffde6e21c5;hp=ec619c50c202bf1d6f367d028de83ed1f13e5aca;hpb=cd4b3d6b35dc66928db5fd4880f9441d0e70bff9;p=inkscape.git diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index ec619c50c..614484073 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -307,7 +307,16 @@ static void sp_font_selector_style_select_row (GtkTreeSelection *selection, static void sp_font_selector_size_changed (GtkComboBox *cbox, SPFontSelector *fsel) { +#if GTK_CHECK_VERSION(2,6,0) char *sstr = gtk_combo_box_get_active_text (GTK_COMBO_BOX (fsel->size)); +#else // GTK_CHECK_VERSION(2,6,0) + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (fsel->size)); + GtkTreeIter iter; + char *sstr = NULL; + + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (fsel->size), &iter) && model) + gtk_tree_model_get (model, &iter, 0, &sstr, -1); +#endif // GTK_CHECK_VERSION(2,6,0) gfloat old_size = fsel->fontsize; fsel->fontsize = MAX(atof(sstr), 0.1); if ( fabs(fsel->fontsize-old_size) > 0.001) @@ -383,13 +392,18 @@ GtkWidget *sp_font_selector_new() void sp_font_selector_set_font (SPFontSelector *fsel, font_instance *font, double size) { - if (font && (fsel->font != font || size != fsel->fontsize)) { gchar family[256]; font->Family (family, 256); + + Gtk::TreePath path; - Gtk::TreePath path = Inkscape::FontLister::get_instance()->get_row_for_font (family); + try { + path = Inkscape::FontLister::get_instance()->get_row_for_font (family); + } catch (...) { + return; + } fsel->block_emit = TRUE; gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->family_treeview)), path.gobj());