diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-08-16 10:15:26 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-08-17 10:23:44 +0000 |
| commit | 470c5ce22538e5e67d636b15fb236043862a398d (patch) | |
| tree | 6bbca19408aabdbb8499de75185139594d3e66fb /src | |
| parent | Fixes for symbols dialog (diff) | |
| download | inkscape-470c5ce22538e5e67d636b15fb236043862a398d.tar.gz inkscape-470c5ce22538e5e67d636b15fb236043862a398d.zip | |
Fix for bug https://gitlab.com/inkscape/inbox/issues/764 and some UI improvements
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 93 |
1 files changed, 48 insertions, 45 deletions
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 7eccc675d..de5184058 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -176,7 +176,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : // Giving the iconview a small minimum size will help users understand // What the dialog does. icon_view->set_size_request( 100, 250 ); - + std::vector< Gtk::TargetEntry > targets; targets.emplace_back( "application/x-inkscape-paste"); @@ -432,14 +432,12 @@ void SymbolsDialog::rebuild() { SPDocument* symbol_document = selectedSymbols(); icons_found = false; //We are not in search all docs - if (search->get_text() != _("Searching...") && - search->get_text() != _("Loading all symbols...")) - { - Glib::ustring current = Glib::Markup::escape_text(symbol_set->get_active_text()); - if (current == ALLDOCS && search->get_text() != "") { - searchsymbols(); - return; - } + if (search->get_text() != _("Searching...") && search->get_text() != _("Loading all symbols...")) { + Glib::ustring current = Glib::Markup::escape_text(symbol_set->get_active_text()); + if (current == ALLDOCS && search->get_text() != "") { + searchsymbols(); + return; + } } if (symbol_document) { addSymbolsInDoc(symbol_document); @@ -459,34 +457,43 @@ void SymbolsDialog::showOverlay() { overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring(_("First search can be slow.")) + Glib::ustring("</span>")); } else if (!icons_found && !search_str.empty()) { - overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring(_("Try a different search term.")) + Glib::ustring("</span>")); + overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + + Glib::ustring("</span>")); + overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + + Glib::ustring(_("Try a different search term.")) + Glib::ustring("</span>")); } else { overlay_icon->show(); overlay_title->set_markup(Glib::ustring("<spansize=\"large\">") + Glib::ustring(_("Search in all symbol sets...")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + - Glib::ustring("</span>")); + overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring("</span>")); } } else if (!number_symbols && (current != CURRENTDOC || !search_str.empty())) { - overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring(_("Try a different search term,\nor switch to a different symbol set.")) + Glib::ustring("</span>")); + overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + + Glib::ustring("</span>")); + overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + + Glib::ustring(_("Try a different search term,\nor switch to a different symbol set.")) + + Glib::ustring("</span>")); } else if (!number_symbols && current == CURRENTDOC) { - overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No symbols found")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring(_("No symbols in current document.\nChoose a different symbol set\nor add a new symbol.")) + Glib::ustring("</span>")); + overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No symbols found")) + + Glib::ustring("</span>")); + overlay_desc->set_markup( + Glib::ustring("<span size=\"small\">") + + Glib::ustring(_("No symbols in current document.\nChoose a different symbol set\nor add a new symbol.")) + + Glib::ustring("</span>")); } else if (!icons_found && !search_str.empty()) { - overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + Glib::ustring(_("Try a different search term,\nor switch to a different symbol set.")) + Glib::ustring("</span>")); + overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("No results found")) + + Glib::ustring("</span>")); + overlay_desc->set_markup(Glib::ustring("<span size=\"small\">") + + Glib::ustring(_("Try a different search term,\nor switch to a different symbol set.")) + + Glib::ustring("</span>")); } gint width = scroller->get_allocated_width(); gint height = scroller->get_allocated_height(); - if (previous_height != height || - previous_width != width) - { - previous_height = height; - previous_width = width; - overlay_opacity->set_size_request(width, height); - overlay_opacity->set(getOverlay(width, height)); + if (previous_height != height || previous_width != width) { + previous_height = height; + previous_width = width; + overlay_opacity->set_size_request(width, height); + overlay_opacity->set(getOverlay(width, height)); } overlay_opacity->hide(); overlay_icon->show(); @@ -1029,29 +1036,25 @@ void SymbolsDialog::beforeSearch(GdkEventKey* evt) if (evt->keyval != GDK_KEY_Return) { return; } - overlay_title->set_markup(Glib::ustring("<span size=\"large\">") + Glib::ustring(_("Searching...")) + Glib::ustring("</span>")); - overlay_desc->set_markup(Glib::ustring("")); searchsymbols(); } -void SymbolsDialog::searchsymbols() +void SymbolsDialog::searchsymbols() { - - - progress_bar->set_fraction(0.0); - enableWidgets(false); - SPDocument* symbol_document = selectedSymbols(); - if (symbol_document) { - //We are not in search all docs - search->set_text(_("Searching...")); - store->clear(); - icons_found = false; - addSymbolsInDoc(symbol_document); - } else { - idleconn.disconnect(); - idleconn = Glib::signal_idle().connect( sigc::mem_fun(*this, &SymbolsDialog::callbackAllSymbols)); - search->set_text(_("Loading all symbols...")); - } + progress_bar->set_fraction(0.0); + enableWidgets(false); + SPDocument *symbol_document = selectedSymbols(); + if (symbol_document) { + // We are not in search all docs + search->set_text(_("Searching...")); + store->clear(); + icons_found = false; + addSymbolsInDoc(symbol_document); + } else { + idleconn.disconnect(); + idleconn = Glib::signal_idle().connect(sigc::mem_fun(*this, &SymbolsDialog::callbackAllSymbols)); + search->set_text(_("Loading all symbols...")); + } } void SymbolsDialog::unsensitive(GdkEventKey* evt) |
