diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-16 10:44:52 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-16 10:44:52 +0000 |
| commit | e068794cdcfb86203db5ab72f6f1d632b5d900d9 (patch) | |
| tree | e675f4f455f495af2684bd884521b097d44258c3 /src/ui | |
| parent | Working on fix (diff) | |
| download | inkscape-e068794cdcfb86203db5ab72f6f1d632b5d900d9.tar.gz inkscape-e068794cdcfb86203db5ab72f6f1d632b5d900d9.zip | |
Fix title problems
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 4d2315def..3a15813c1 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -886,12 +886,17 @@ void SymbolsDialog::symbolsInDocRecursive (SPObject *r, std::map<Glib::ustring, return; } - if ( dynamic_cast<SPSymbol *>(r) && r->title()) { - Glib::ustring current = symbol_set->get_active_text(); - if (current == ALLDOCS) { - l[doc_title + r->title()] = std::make_pair(doc_title,dynamic_cast<SPSymbol *>(r)); + if ( dynamic_cast<SPSymbol *>(r)) { + if(r->title()) { + Glib::ustring current = symbol_set->get_active_text(); + if (current == ALLDOCS) { + l[doc_title + r->title()] = std::make_pair(doc_title,dynamic_cast<SPSymbol *>(r)); + } else { + l[r->title()] = std::make_pair(doc_title,dynamic_cast<SPSymbol *>(r)); + } } else { - l[r->title()] = std::make_pair(doc_title,dynamic_cast<SPSymbol *>(r)); + Glib::ustring id = r->getAttribute("id"); + l[Glib::ustring(_("Symbol without title ")) + id] = std::make_pair(doc_title,dynamic_cast<SPSymbol *>(r)); } } for (auto& child: r->children) { @@ -1028,7 +1033,7 @@ bool SymbolsDialog::callbackSymbols(){ } } } - if (symbol && (search_str.empty() || found || (search_str.empty() && !symbol_title_char))) { + if (symbol && (search_str.empty() || found)) { addSymbol( symbol, doc_title); icons_found = true; } @@ -1152,16 +1157,17 @@ void SymbolsDialog::addSymbol( SPObject* symbol, Glib::ustring doc_title) { SymbolColumns* columns = getColumns(); gchar const *id = symbol->getRepr()->attribute("id"); - gchar const *title = symbol->title(); // From title element - if( !title ) { - title = id; - } + gchar * title = symbol->title(); // From title element if (doc_title.empty()) { doc_title = CURRENTDOC; } - Glib::ustring symbol_title = Glib::ustring(title) + Glib::ustring(" (") + doc_title + Glib::ustring(")"); + Glib::ustring symbol_title = ""; + if(title) { + symbol_title = Glib::ustring(title) + Glib::ustring(" (") + doc_title + Glib::ustring(")"); + } else { + symbol_title = Glib::ustring(_("Symbol without title ")) + Glib::ustring(id) + Glib::ustring(" (") + doc_title + Glib::ustring(")"); + } Glib::RefPtr<Gdk::Pixbuf> pixbuf = drawSymbol( symbol ); - if( pixbuf ) { Gtk::ListStore::iterator row = store->append(); (*row)[columns->symbol_id] = Glib::ustring( id ); @@ -1169,7 +1175,7 @@ void SymbolsDialog::addSymbol( SPObject* symbol, Glib::ustring doc_title) { (*row)[columns->symbol_doc_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "SymbolDoc", doc_title.c_str()) )); (*row)[columns->symbol_image] = pixbuf; } - + g_free(title); delete columns; } |
