~ubuntu-branches/ubuntu/wily/tomboy/wily-proposed

« back to all changes in this revision

Viewing changes to Tomboy/NoteWindow.cs

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2012-08-06 18:13:55 UTC
  • mfrom: (1.5.16) (4.3.20 experimental)
  • Revision ID: package-import@ubuntu.com-20120806181355-h2xqtsicgq8ih0my
Tags: 1.11.5-1ubuntu1
* Merge with Debian unstable, remaining changes
  + Use dh-translations
  + Ubuntu patches:
    - Add app indicator support
    - Use Ubuntu One as default sync server
    - Add initial note about Ubuntu One
    - Set save button sensitive when needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
806
806
                Gtk.Entry entry;
807
807
                Gtk.Button next_button;
808
808
                Gtk.Button prev_button;
 
809
                Gtk.Label labelCount = new Gtk.Label (); //Label of current find matches and current position in List of Matches
809
810
 
810
811
                List<Match> current_matches;
811
812
                string prev_search_text;
839
840
                        entry.Activated += OnFindEntryActivated;
840
841
                        entry.Show ();
841
842
                        PackStart (entry, true, true, 0);
 
843
                        
 
844
                        labelCount.Show ();
 
845
                        PackStart (labelCount, false,false, 0);
842
846
 
843
847
                        prev_button = new Gtk.Button (Catalog.GetString ("_Previous"));
844
848
                        prev_button.Image = new Gtk.Arrow (Gtk.ArrowType.Left, Gtk.ShadowType.None);
866
870
                        entry.KeyPressEvent += KeyPressed;
867
871
                        entry.KeyReleaseEvent += KeyReleased;
868
872
                }
869
 
 
 
873
                
 
874
                /// <summary>
 
875
                /// Updates the match count.
 
876
                /// </summary>
 
877
                /// <param name='location'>
 
878
                /// Current location in the List of Matched notes
 
879
                /// </param>
 
880
                protected void UpdateMatchCount (int location)
 
881
                {
 
882
                        if (current_matches == null || current_matches.Count == 0)
 
883
                                return;
 
884
                        // x of x - specifically Number of Matches and what location is the cursor in the list of matches
 
885
                        labelCount.Text = String.Format (Catalog.GetString("{0} of {1}"), (location + 1), current_matches.Count);
 
886
                }
 
887
                
 
888
                /// <summary>
 
889
                /// Clears the match count.
 
890
                /// </summary>
 
891
                protected void ClearMatchCount ()
 
892
                {
 
893
                        labelCount.Text = "";
 
894
                }
 
895
                
870
896
                protected override void OnShown ()
871
897
                {
872
898
                        entry.GrabFocus ();
911
937
                                Gtk.TextIter end = buffer.GetIterAtMark (match.EndMark);
912
938
 
913
939
                                if (end.Offset < cursor.Offset) {
 
940
                                        UpdateMatchCount (current_matches.IndexOf (match));
914
941
                                        JumpToMatch (match);
915
942
                                        return;
916
943
                                }
917
944
                        }
918
945
 
 
946
                        
 
947
                        UpdateMatchCount (current_matches.Count - 1);
919
948
                        // Wrap to first match
920
949
                        JumpToMatch (current_matches [current_matches.Count - 1] as Match);
921
950
                }
933
962
                                Gtk.TextIter start = buffer.GetIterAtMark (match.StartMark);
934
963
 
935
964
                                if (start.Offset >= cursor.Offset) {
 
965
                                        UpdateMatchCount (current_matches.IndexOf (match));
936
966
                                        JumpToMatch (match);
937
967
                                        return;
938
968
                                }
939
969
                        }
940
970
 
 
971
                        UpdateMatchCount(0);
941
972
                        // Else wrap to first match
942
973
                        JumpToMatch (current_matches [0] as Match);
943
974
                }
1031
1062
                        if (SearchText == null) {
1032
1063
                                next_button.Sensitive = false;
1033
1064
                                prev_button.Sensitive = false;
 
1065
                                ClearMatchCount ();
1034
1066
                        }
1035
1067
 
1036
1068
                        if (current_matches != null && current_matches.Count > 0) {
1039
1071
                        } else {
1040
1072
                                next_button.Sensitive = false;
1041
1073
                                prev_button.Sensitive = false;
 
1074
                                ClearMatchCount ();
1042
1075
                        }
1043
1076
                }
1044
1077