diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-06-05 16:28:15 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-06-05 16:28:15 +0000 |
| commit | 9b0db891ca0fc8ca0cfbfaa301c473f2ad3e6d68 (patch) | |
| tree | 9e79bdf85977d200ee099809103b3bba31c81ddb /src/ink-comboboxentry-action.cpp | |
| parent | Fix build failure with poppler 0.26 (Bug #1315142) (diff) | |
| download | inkscape-9b0db891ca0fc8ca0cfbfaa301c473f2ad3e6d68.tar.gz inkscape-9b0db891ca0fc8ca0cfbfaa301c473f2ad3e6d68.zip | |
Make family-name comparisons case insensitive.
Fix UI bug when SVG file does not have -inkscape-font-specification properties
(Style drop-down list not properly updated.)
(bzr r13341.1.47)
Diffstat (limited to 'src/ink-comboboxentry-action.cpp')
| -rw-r--r-- | src/ink-comboboxentry-action.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 06ccc3739..ebd238edc 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -38,7 +38,7 @@ static GtkWidget* create_tool_item( GtkAction* action ); static GtkWidget* create_menu_item( GtkAction* action ); // Internal -static gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text, gboolean exclude = false ); +static gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text, gboolean exclude = false, gboolean ignore_case = false ); static Glib::ustring check_comma_separated_text( Ink_ComboBoxEntry_Action* action ); // Callbacks @@ -732,7 +732,8 @@ void ink_comboboxentry_action_set_altx_name( Ink_ComboBoxEntry_Action* actio // use 3d colunm if available to exclude row from checking (useful to // skip rows added for font-families included in doc and not on // system) -gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text, gboolean exclude ) { +gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text, + gboolean exclude, gboolean ignore_case ) { // Check if text in list gint row = 0; @@ -752,10 +753,23 @@ gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* ta gchar* text = 0; gtk_tree_model_get( action->model, &iter, 0, &text, -1 ); // Column 0 - // Check for match - if( strcmp( target_text, text ) == 0 ){ - found = true; - break; + if( !ignore_case ) { + // Case sensitive compare + if( strcmp( target_text, text ) == 0 ){ + found = true; + break; + } + } else { + // Case insensitive compare + gchar* target_text_casefolded = g_utf8_casefold( target_text, -1 ); + gchar* text_casefolded = g_utf8_casefold( text, -1 ); + gboolean equal = (strcmp( target_text_casefolded, text_casefolded ) == 0 ); + g_free( text_casefolded ); + g_free( target_text_casefolded ); + if( equal ) { + found = true; + break; + } } } @@ -794,7 +808,7 @@ static Glib::ustring check_comma_separated_text( Ink_ComboBoxEntry_Action* actio // Remove any surrounding white space. g_strstrip( tokens[i] ); - if( get_active_row_from_text( action, tokens[i], true ) == -1 ) { + if( get_active_row_from_text( action, tokens[i], true, true ) == -1 ) { missing += tokens[i]; missing += ", "; } |
