[meld] Add indicator to show wrapped search in Findbar (closes bgo#647687)



commit a6f91cfab442f6bd261c160bceb7601b43b626a2
Author: Philipp MÃller <descpl yahoo de>
Date:   Tue Oct 30 11:37:47 2012 +0100

    Add indicator to show wrapped search in Findbar (closes bgo#647687)
    
    Added an image and a label that pop up if a search hits the
    bottom of the file and continues at the beginning. This implements
    a very basic notificaion that is somewhat similar to those known
    from Firefox or similar programs.

 data/ui/findbar.ui |   43 ++++++++++++++++++++++++++++++++++++++++++-
 meld/ui/findbar.py |    6 ++++++
 2 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/findbar.ui b/data/ui/findbar.ui
index 88a4dc8..d800ccb 100644
--- a/data/ui/findbar.ui
+++ b/data/ui/findbar.ui
@@ -17,7 +17,7 @@
       <object class="GtkTable" id="findbar">
         <property name="can_focus">False</property>
         <property name="n_rows">2</property>
-        <property name="n_columns">5</property>
+        <property name="n_columns">6</property>
         <property name="column_spacing">6</property>
         <child>
           <object class="GtkHButtonBox" id="hbuttonbox2">
@@ -241,6 +241,47 @@
           </packing>
         </child>
         <child>
+          <object class="GtkHBox" id="wrap_box">
+            <property name="can_focus">False</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkImage" id="wrap_image">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="stock">gtk-info</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="wrap_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Wrapped</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">5</property>
+            <property name="right_attach">6</property>
+            <property name="x_options"/>
+            <property name="x_padding">6</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
           <placeholder/>
         </child>
       </object>
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index 63d105d..ae0d5dc 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -41,6 +41,7 @@ class FindBar(gnomeglade.Component):
 
     def hide(self):
         self.textview = None
+        self.wrap_box.set_visible(False)
         self.widget.hide()
 
     def start_find(self, textview, text=None):
@@ -75,6 +76,7 @@ class FindBar(gnomeglade.Component):
         self.widget.set_row_spacings(6)
         self.widget.show_all()
         self.find_entry.grab_focus()
+        self.wrap_box.set_visible(False)
 
     def on_find_entry__activate(self, entry):
         self.find_next_button.activate()
@@ -139,15 +141,18 @@ class FindBar(gnomeglade.Component):
         except re.error as e:
             misc.run_dialog( _("Regular expression error\n'%s'") % e, self, messagetype=gtk.MESSAGE_ERROR)
         else:
+            self.wrap_box.set_visible(False)
             if backwards == False:
                 match = pattern.search(text, insert.get_offset() + start_offset)
                 if match is None and wrap:
+                    self.wrap_box.set_visible(True)
                     match = pattern.search(text, 0)
             else:
                 match = None
                 for m in pattern.finditer(text, 0, insert.get_offset()):
                     match = m
                 if match is None and wrap:
+                    self.wrap_box.set_visible(True)
                     for m in pattern.finditer(text, insert.get_offset()):
                         match = m
             if match:
@@ -160,3 +165,4 @@ class FindBar(gnomeglade.Component):
             else:
                 buf.place_cursor( buf.get_iter_at_mark(buf.get_insert()) )
                 self.find_entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#ffdddd"))
+                self.wrap_box.set_visible(False)



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