[gedit/wip/use-tagged-entry] ViewFrame: show total number of occurrences alone



commit 82d5c24c2d8b4da800d65f872f3cb0a3dd0e2e3b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jul 13 21:18:57 2013 +0200

    ViewFrame: show total number of occurrences alone
    
    If the text selected is not on a match.

 gedit/gedit-view-frame.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index f57eff2..26b230c 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -563,20 +563,28 @@ update_entry_tag (GeditViewFrame *frame)
 
        if (count == -1 || pos == -1)
        {
+               /* Wait that the buffer is fully scanned. */
                return;
        }
 
-       if (count == 0 || pos == 0)
+       if (count == 0)
        {
                gd_tagged_entry_remove_tag (frame->priv->search_entry, "search-occurrences");
                return;
        }
 
-       /* Translators: the first %d is the position of the current search
-        * occurrence, and the second %d is the total number of search
-        * occurrences.
-        */
-       label = g_strdup_printf (_("%d of %d"), pos, count);
+       if (pos == 0)
+       {
+               label = g_strdup_printf ("%d", count);
+       }
+       else
+       {
+               /* Translators: the first %d is the position of the current search
+                * occurrence, and the second %d is the total number of search
+                * occurrences.
+                */
+               label = g_strdup_printf (_("%d of %d"), pos, count);
+       }
 
        ok = gd_tagged_entry_set_tag_label (frame->priv->search_entry,
                                            "search-occurrences",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]