From 409de448cfb250865b4958d1dd2c6e409e990443 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 27 Apr 2010 20:24:44 +0200 Subject: inkscape-comboboxentry-action: Add option to add extra width to GtkComboBox. Add names to widgets so styles can be set with RC files. toolbox.cpp: Add extra width to font-family GtkComboBox. Change style of font-family drop-down from menu to list. (bzr r9384) --- src/widgets/toolbox.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 978f19c4c..2cd96491e 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6239,15 +6239,19 @@ static void cell_data_func(GtkCellLayout * /*cell_layout*/, Glib::ustring sample = prefs->getString("/tools/text/font_sample"); gchar *const sample_escaped = g_markup_escape_text(sample.data(), -1); - std::stringstream markup; - markup << family_escaped << " " << sample_escaped << ""; - g_object_set (G_OBJECT (cell), "markup", markup.str().c_str(), NULL); + std::stringstream markup; + markup << family_escaped << " " << sample_escaped << ""; + g_object_set (G_OBJECT (cell), "markup", markup.str().c_str(), NULL); g_free(sample_escaped); } else { g_object_set (G_OBJECT (cell), "markup", family_escaped, NULL); } + // This doesn't work for two reasons... it set both selected and not selected backgrounds + // to white.. which means that white foreground text is invisible. It also only effects + // the text region, leaving the padding untouched. + // g_object_set (G_OBJECT (cell), "cell-background", "white", "cell-background-set", true, NULL); g_free(family); g_free(family_escaped); @@ -7171,10 +7175,11 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontFamilyAction", _("Font Family"), - _("Select Font Family"), + _("Select Font Family (Alt-X to access)"), NULL, GTK_TREE_MODEL(model), - -1, // Set width + -1, // Entry width + 50, // Extra list width (gpointer)cell_data_func ); // Cell layout ink_comboboxentry_action_popup_enable( act ); // Enable entry completion gchar *const warning = _("Font not found on system"); @@ -7183,6 +7188,14 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions g_signal_connect( G_OBJECT(act), "changed", G_CALLBACK(sp_text_fontfamily_value_changed), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); g_object_set_data( holder, "TextFontFamilyAction", act ); + + // Change style of drop-down from menu to list + gtk_rc_parse_string ( + "style \"dropdown-as-list-style\"\n" + "{\n" + " GtkComboBox::appears-as-list = 1\n" + "}\n" + "widget \"*.TextFontFamilyAction_combobox\" style \"dropdown-as-list-style\""); } /* Font size */ -- cgit v1.2.3