diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-06-19 00:29:52 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-06-19 00:29:52 +0000 |
| commit | fd8dc80e78f402e37d9c4ef29094e69d90653ea6 (patch) | |
| tree | a858ce047096b8ddb581d76805760e773a251a5f /src/selection-describer.cpp | |
| parent | Removed original path helper paths pointed by LiamW (diff) | |
| parent | add win64 files to distribution (Makefile.am) (diff) | |
| download | inkscape-fd8dc80e78f402e37d9c4ef29094e69d90653ea6.tar.gz inkscape-fd8dc80e78f402e37d9c4ef29094e69d90653ea6.zip | |
Update to latest tip (trunk r13432)
(bzr r13341.1.62)
Diffstat (limited to 'src/selection-describer.cpp')
| -rw-r--r-- | src/selection-describer.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 88450dfdf..1cb96fed0 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -56,6 +56,21 @@ char* collect_terms (GSList *items) return g_strdup(ss.str().c_str()); } +// Returns the number of terms in the list +static int count_terms (GSList *items) +{ + GSList *check = NULL; + int count=0; + for (GSList *i = (GSList *)items; i != NULL; i = i->next) { + const char *term = SP_ITEM(i->data)->displayName(); + if (term != NULL && g_slist_find (check, term) == NULL) { + check = g_slist_prepend (check, (void *) term); + count++; + } + } + return count; +} + // Returns the number of filtered items in the list static int count_filtered (GSList *items) { @@ -194,9 +209,12 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select } else { // multiple items int objcount = g_slist_length((GSList *)items); char *terms = collect_terms ((GSList *)items); - - gchar *objects_str = g_strdup_printf( - "<b>%i</b> objects selected of types %s", objcount, terms); + int n_terms = count_terms((GSList *)items); + + gchar *objects_str = g_strdup_printf(ngettext( + "<b>%i</b> objects selected of type %s", + "<b>%i</b> objects selected of types %s", n_terms), + objcount, terms); g_free(terms); |
