[gtkhtml] Bug 593572 - Lack of feedback when there are no search hits



commit 85947cfc2fb2417cb42585262452dd22df10895f
Author: Dan Vrátil <dvratil redhat com>
Date:   Thu Apr 7 18:07:14 2011 -0400

    Bug 593572 - Lack of feedback when there are no search hits
    
    Displays "No match found" in the search dialog when no further search
    hits are found.  It's a bit overzealous about showing the message right
    now but that's a different bug.

 components/editor/gtkhtml-editor-actions.c  |    5 ++
 components/editor/gtkhtml-editor-builder.ui |   62 +++++++++++++++++----------
 components/editor/gtkhtml-editor-signals.c  |    1 +
 components/editor/gtkhtml-editor-widgets.h  |    2 +
 4 files changed, 47 insertions(+), 23 deletions(-)
---
diff --git a/components/editor/gtkhtml-editor-actions.c b/components/editor/gtkhtml-editor-actions.c
index 05bfc6e..2bf01f2 100644
--- a/components/editor/gtkhtml-editor-actions.c
+++ b/components/editor/gtkhtml-editor-actions.c
@@ -505,6 +505,11 @@ action_find_cb (GtkAction *action,
 			GTK_TOGGLE_BUTTON (WIDGET (FIND_REGULAR_EXPRESSION))));
 
 	gtk_action_set_sensitive (ACTION (FIND), found);
+
+	if (!found)
+		gtk_label_set_label (
+			GTK_LABEL (WIDGET (FIND_RESULT_LABEL)),
+			N_("No match found"));
 }
 
 static void
diff --git a/components/editor/gtkhtml-editor-builder.ui b/components/editor/gtkhtml-editor-builder.ui
index 28ef86b..6dfe984 100644
--- a/components/editor/gtkhtml-editor-builder.ui
+++ b/components/editor/gtkhtml-editor-builder.ui
@@ -852,44 +852,60 @@
           </packing>
         </child>
         <child>
-          <object class="GtkHButtonBox" id="find-button-box">
+          <object class="GtkHBox" id="find-inner-hbox">
             <property name="visible">True</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <property name="spacing">12</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
-              <object class="GtkButton" id="find-close-button">
+              <object class="GtkLabel" id="find-result-label">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label">gtk-close</property>
-                <property name="use_stock">True</property>
-                <signal handler="gtk_widget_hide" name="clicked" object="find-window"/>
+                <property name="label"></property>     
+                <property name="xalign">0</property>
               </object>
             </child>
             <child>
-              <object class="GtkButton" id="find-button">
+              <object class="GtkHButtonBox" id="find-button-box">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label">gtk-find</property>
-                <property name="use_stock">True</property>
+                <property name="spacing">12</property>
+                <property name="layout_style">GTK_BUTTONBOX_END</property>
+                <child>
+                  <object class="GtkButton" id="find-close-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label">gtk-close</property>
+                    <property name="use_stock">True</property>
+                    <signal handler="gtk_widget_hide" name="clicked" object="find-window"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="find-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="has_default">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label">gtk-find</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </object>
               <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">GTK_PACK_END</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="pack_type">GTK_PACK_END</property>
-            <property name="position">1</property>
-          </packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>     
         </child>
       </object>
     </child>
diff --git a/components/editor/gtkhtml-editor-signals.c b/components/editor/gtkhtml-editor-signals.c
index df0f8d6..e07974a 100644
--- a/components/editor/gtkhtml-editor-signals.c
+++ b/components/editor/gtkhtml-editor-signals.c
@@ -625,6 +625,7 @@ sensitize_find_action (GtkWidget *window)
 
 	editor = extract_gtkhtml_editor (window);
 	gtk_action_set_sensitive (ACTION (FIND), TRUE);
+	gtk_label_set_label (GTK_LABEL (WIDGET (FIND_RESULT_LABEL)), "");
 	g_object_unref (editor);
 }
 
diff --git a/components/editor/gtkhtml-editor-widgets.h b/components/editor/gtkhtml-editor-widgets.h
index cf3aa8a..68f1b27 100644
--- a/components/editor/gtkhtml-editor-widgets.h
+++ b/components/editor/gtkhtml-editor-widgets.h
@@ -71,6 +71,8 @@
 	GTKHTML_EDITOR_WIDGET ((editor), "find-entry")
 #define GTKHTML_EDITOR_WIDGET_FIND_REGULAR_EXPRESSION(editor) \
 	GTKHTML_EDITOR_WIDGET ((editor), "find-regular-expression")
+#define GTKHTML_EDITOR_WIDGET_FIND_RESULT_LABEL(editor) \
+	GTKHTML_EDITOR_WIDGET ((editor), "find-result-label")
 
 /* Image Properties Window */
 #define GTKHTML_EDITOR_WIDGET_IMAGE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \



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