diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
| commit | d2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch) | |
| tree | e2703384779e83312c456399999997fcc289c5cf /src/selection-describer.cpp | |
| parent | Merge branch 'master' into powerpencil (diff) | |
| parent | change assignment to equality (diff) | |
| download | inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip | |
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/selection-describer.cpp')
| -rw-r--r-- | src/selection-describer.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 43fe1311d..5044864a4 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -15,6 +15,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include <set> #include <glibmm/i18n.h> #include "xml/quote.h" @@ -33,16 +34,15 @@ // Returns a list of terms for the items to be used in the statusbar char* collect_terms (const std::vector<SPItem*> &items) { - GSList *check = NULL; + std::set<Glib::ustring> check; std::stringstream ss; bool first = true; for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();++iter ) { SPItem *item = *iter; - if (item) { - const char *term = item->displayName(); - if (term != NULL && g_slist_find (check, term) == NULL) { - check = g_slist_prepend (check, (void *) term); + if (item && item->displayName()) { + Glib::ustring term(item->displayName()); + if (term != "" && (check.insert(term).second)) { ss << (first ? "" : ", ") << "<b>" << term << "</b>"; first = false; } @@ -54,14 +54,13 @@ char* collect_terms (const std::vector<SPItem*> &items) // Returns the number of terms in the list static int count_terms (const std::vector<SPItem*> &items) { - GSList *check = NULL; + std::set<Glib::ustring> check; int count=0; for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();++iter ) { SPItem *item = *iter; - if (item) { - const char *term = item->displayName(); - if (term != NULL && g_slist_find (check, term) == NULL) { - check = g_slist_prepend (check, (void *) term); + if (item && item->displayName()) { + Glib::ustring term(item->displayName()); + if (term != "" && (check.insert(term).second)) { count++; } } |
