[tomboy] New reformatted patch for bgo #666194
- From: Jared L Jennings <jjennings src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tomboy] New reformatted patch for bgo #666194
- Date: Tue, 24 Jul 2012 17:11:26 +0000 (UTC)
commit 1a7d12646501030b9c7b96fa3524f8ac4fb5bcdd
Author: Jared Jennings <jjennings src gnome org>
Date: Tue Jul 24 13:11:46 2012 -0400
New reformatted patch for bgo #666194
Tomboy/NoteWindow.cs | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/Tomboy/NoteWindow.cs b/Tomboy/NoteWindow.cs
index cc8be4f..410e28e 100644
--- a/Tomboy/NoteWindow.cs
+++ b/Tomboy/NoteWindow.cs
@@ -806,6 +806,7 @@ namespace Tomboy
Gtk.Entry entry;
Gtk.Button next_button;
Gtk.Button prev_button;
+ Gtk.Label labelCount = new Gtk.Label (); //Label of current find matches and current position in List of Matches
List<Match> current_matches;
string prev_search_text;
@@ -839,6 +840,9 @@ namespace Tomboy
entry.Activated += OnFindEntryActivated;
entry.Show ();
PackStart (entry, true, true, 0);
+
+ labelCount.Show ();
+ PackStart (labelCount, false,false, 0);
prev_button = new Gtk.Button (Catalog.GetString ("_Previous"));
prev_button.Image = new Gtk.Arrow (Gtk.ArrowType.Left, Gtk.ShadowType.None);
@@ -866,7 +870,29 @@ namespace Tomboy
entry.KeyPressEvent += KeyPressed;
entry.KeyReleaseEvent += KeyReleased;
}
-
+
+ /// <summary>
+ /// Updates the match count.
+ /// </summary>
+ /// <param name='location'>
+ /// Current location in the List of Matched notes
+ /// </param>
+ protected void UpdateMatchCount (int location)
+ {
+ if (current_matches == null || current_matches.Count == 0)
+ return;
+ // x of x - specifically Number of Matches and what location is the cursor in the list of matches
+ labelCount.Text = String.Format (Catalog.GetString("{0} of {1}"), (location + 1), current_matches.Count);
+ }
+
+ /// <summary>
+ /// Clears the match count.
+ /// </summary>
+ protected void ClearMatchCount ()
+ {
+ labelCount.Text = "";
+ }
+
protected override void OnShown ()
{
entry.GrabFocus ();
@@ -911,11 +937,14 @@ namespace Tomboy
Gtk.TextIter end = buffer.GetIterAtMark (match.EndMark);
if (end.Offset < cursor.Offset) {
+ UpdateMatchCount (current_matches.IndexOf (match));
JumpToMatch (match);
return;
}
}
+
+ UpdateMatchCount (current_matches.Count - 1);
// Wrap to first match
JumpToMatch (current_matches [current_matches.Count - 1] as Match);
}
@@ -933,11 +962,13 @@ namespace Tomboy
Gtk.TextIter start = buffer.GetIterAtMark (match.StartMark);
if (start.Offset >= cursor.Offset) {
+ UpdateMatchCount (current_matches.IndexOf (match));
JumpToMatch (match);
return;
}
}
+ UpdateMatchCount(0);
// Else wrap to first match
JumpToMatch (current_matches [0] as Match);
}
@@ -1031,6 +1062,7 @@ namespace Tomboy
if (SearchText == null) {
next_button.Sensitive = false;
prev_button.Sensitive = false;
+ ClearMatchCount ();
}
if (current_matches != null && current_matches.Count > 0) {
@@ -1039,6 +1071,7 @@ namespace Tomboy
} else {
next_button.Sensitive = false;
prev_button.Sensitive = false;
+ ClearMatchCount ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]