summaryrefslogtreecommitdiffstats
path: root/src/selection-describer.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
commitd2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch)
treee2703384779e83312c456399999997fcc289c5cf /src/selection-describer.cpp
parentMerge branch 'master' into powerpencil (diff)
parentchange assignment to equality (diff)
downloadinkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz
inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/selection-describer.cpp')
-rw-r--r--src/selection-describer.cpp19
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++;
}
}