[gtranslator/gtk4] Move searchbar to a GtkSearchBar widget



commit f5877b4e47a12efc32237cef7362a50ce41da946
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Mon Sep 5 18:25:10 2022 +0200

    Move searchbar to a GtkSearchBar widget

 src/gtr-search-bar-old.ui | 290 ----------------------------------------------
 src/gtr-search-bar.c      |  10 +-
 src/gtr-search-bar.ui     | 207 +++++++++++++++++----------------
 src/gtr-tab.c             |  38 +++---
 src/gtr-tab.ui            | 202 +++++++++++++++-----------------
 src/gtr-window.c          |  11 +-
 6 files changed, 227 insertions(+), 531 deletions(-)
---
diff --git a/src/gtr-search-bar.c b/src/gtr-search-bar.c
index 05727d99..29479bad 100644
--- a/src/gtr-search-bar.c
+++ b/src/gtr-search-bar.c
@@ -42,7 +42,8 @@ struct _GtrSearchBar
   GtkButton               *next_button;
   GtkEntry                *replace_entry;
   GtkEntry                *search_entry;
-  GtkGrid                 *search_options;
+  GtkRevealer             *search_options;
+  GtkRevealer             *replace_options;
   GtkLabel                *search_text_error;
 
   GtrWindow               *active_window;
@@ -346,9 +347,7 @@ gtr_search_bar_set_replace_mode (GtrSearchBar *self,
   if (replace_mode != self->replace_mode)
     {
       self->replace_mode = replace_mode;
-      gtk_widget_set_visible (GTK_WIDGET (self->replace_entry), replace_mode);
-      gtk_widget_set_visible (GTK_WIDGET (self->replace_button), replace_mode);
-      gtk_widget_set_visible (GTK_WIDGET (self->replace_all_button), replace_mode);
+      gtk_revealer_set_reveal_child (self->replace_options, replace_mode);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REPLACE_MODE]);
     }
 }
@@ -489,7 +488,7 @@ gtr_search_bar_set_show_options (GtrSearchBar *self,
   if (self->show_options != show_options)
     {
       self->show_options = show_options;
-      gtk_widget_set_visible (GTK_WIDGET (self->search_options), show_options);
+      gtk_revealer_set_reveal_child (self->search_options, show_options);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SHOW_OPTIONS]);
     }
 }
@@ -668,6 +667,7 @@ gtr_search_bar_class_init (GtrSearchBarClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GtrSearchBar, previous_button);
   gtk_widget_class_bind_template_child (widget_class, GtrSearchBar, next_button);
   gtk_widget_class_bind_template_child (widget_class, GtrSearchBar, search_options);
+  gtk_widget_class_bind_template_child (widget_class, GtrSearchBar, replace_options);
   gtk_widget_class_bind_template_child (widget_class, GtrSearchBar, search_text_error);
 
   gtk_widget_class_set_css_name (widget_class, "gtrsearchbar");
diff --git a/src/gtr-search-bar.ui b/src/gtr-search-bar.ui
index 094cd336..ffe6a4f4 100644
--- a/src/gtr-search-bar.ui
+++ b/src/gtr-search-bar.ui
@@ -8,10 +8,8 @@
     <child>
       <object class="GtkBox">
         <property name="orientation">vertical</property>
-        <property name="spacing">7</property>
         <child>
           <object class="GtkGrid">
-            <property name="row_spacing">8</property>
             <property name="column_spacing">8</property>
             <child>
               <object class="GtkEntry" id="search_entry">
@@ -25,37 +23,6 @@
                 </layout>
               </object>
             </child>
-            <child>
-              <object class="GtkLabel" id="search_text_error">
-                <property name="visible">0</property>
-                <property name="xalign">0.0</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-                <attributes>
-                  <attribute name="scale" value="0.8333"></attribute>
-                </attributes>
-                <layout>
-                  <property name="column">0</property>
-                  <property name="column-span">3</property>
-                  <property name="row">1</property>
-                </layout>
-              </object>
-            </child>
-            <child>
-              <object class="GtkEntry" id="replace_entry">
-                <property name="visible">0</property>
-                <property name="width-chars">20</property>
-                <property name="max-width-chars">30</property>
-                <property name="primary_icon_name">edit-find-replace-symbolic</property>
-                <property name="primary_icon_activatable">0</property>
-                <property name="primary_icon_sensitive">0</property>
-                <layout>
-                  <property name="column">0</property>
-                  <property name="row">2</property>
-                </layout>
-              </object>
-            </child>
             <child>
               <object class="GtkBox">
                 <property name="homogeneous">1</property>
@@ -80,28 +47,6 @@
                 </layout>
               </object>
             </child>
-            <child>
-              <object class="GtkButton" id="replace_button">
-                <property name="label" translatable="1">Replace</property>
-                <property name="visible">0</property>
-                <layout>
-                  <property name="column">1</property>
-                  <property name="row">2</property>
-                </layout>
-              </object>
-            </child>
-            <child>
-              <object class="GtkButton" id="replace_all_button">
-                <property name="label" translatable="1">Replace All</property>
-                <property name="visible">0</property>
-                <!--TODO: <property name="action-name">editor-search.replace-all</property> -->
-                <property name="action_name">editor-search.replace-all</property>
-                <layout>
-                  <property name="column">2</property>
-                  <property name="row">2</property>
-                </layout>
-              </object>
-            </child>
             <child>
               <object class="GtkBox">
                 <property name="homogeneous">1</property>
@@ -131,61 +76,119 @@
           </object>
         </child>
         <child>
-          <object class="GtkGrid" id="search_options">
-            <property name="visible">0</property>
-            <property name="column_spacing">8</property>
-            <child>
-              <object class="GtkCheckButton" id="case_sensitive">
-                <property name="label" translatable="1">Case sensitive</property>
-                <property name="action-name">search-settings.case-sensitive</property>
-                <layout>
-                  <property name="column">0</property>
-                  <property name="row">0</property>
-                </layout>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="whole_word">
-                <property name="label" translatable="1">Match whole word only</property>
-                <property name="action-name">search-settings.at-word-boundaries</property>
-                <layout>
-                  <property name="column">1</property>
-                  <property name="row">0</property>
-                </layout>
-              </object>
-            </child>
+          <object class="GtkRevealer" id="replace_options">
             <child>
-              <object class="GtkCheckButton" id="wrap_around_button">
-                <property name="label" translatable="1">Wrap Around</property>
-                <property name="action-name">search-settings.wrap-around</property>
-                <layout>
-                  <property name="column">2</property>
-                  <property name="row">0</property>
-                </layout>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="original_text_checkbutton">
-                <property name="label" translatable="1">Original text</property>
-                <property name="action-name">search-settings.at-original-text</property>
-                <layout>
-                  <property name="column">0</property>
-                  <property name="row">1</property>
-                </layout>
+              <object class="GtkGrid">
+                <property name="column_spacing">8</property>
+                <child>
+                  <object class="GtkEntry" id="replace_entry">
+                    <property name="width-chars">20</property>
+                    <property name="max-width-chars">30</property>
+                    <property name="primary_icon_name">edit-find-replace-symbolic</property>
+                    <property name="primary_icon_activatable">0</property>
+                    <property name="primary_icon_sensitive">0</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="replace_button">
+                    <property name="label" translatable="1">Replace</property>
+                    <layout>
+                      <property name="column">1</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton" id="replace_all_button">
+                    <property name="label" translatable="1">Replace All</property>
+                    <!--TODO: <property name="action-name">editor-search.replace-all</property> -->
+                    <property name="action_name">editor-search.replace-all</property>
+                    <layout>
+                      <property name="column">2</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkRevealer" id="search_options">
             <child>
-              <object class="GtkCheckButton" id="translated_text_checkbutton">
-                <property name="label" translatable="1">Translated text</property>
-                <property name="action-name">search-settings.at-translated-text</property>
-                <layout>
-                  <property name="column">1</property>
-                  <property name="row">1</property>
-                </layout>
+              <object class="GtkGrid">
+                <property name="column_spacing">8</property>
+                <child>
+                  <object class="GtkCheckButton" id="case_sensitive">
+                    <property name="label" translatable="1">Case sensitive</property>
+                    <property name="action-name">search-settings.case-sensitive</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="whole_word">
+                    <property name="label" translatable="1">Match whole word only</property>
+                    <property name="action-name">search-settings.at-word-boundaries</property>
+                    <layout>
+                      <property name="column">1</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="wrap_around_button">
+                    <property name="label" translatable="1">Wrap Around</property>
+                    <property name="action-name">search-settings.wrap-around</property>
+                    <layout>
+                      <property name="column">2</property>
+                      <property name="row">0</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="original_text_checkbutton">
+                    <property name="label" translatable="1">Original text</property>
+                    <property name="action-name">search-settings.at-original-text</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">1</property>
+                    </layout>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="translated_text_checkbutton">
+                    <property name="label" translatable="1">Translated text</property>
+                    <property name="action-name">search-settings.at-translated-text</property>
+                    <layout>
+                      <property name="column">1</property>
+                      <property name="row">1</property>
+                    </layout>
+                  </object>
+                </child>
               </object>
             </child>
           </object>
         </child>
+        <child>
+          <object class="GtkLabel" id="search_text_error">
+            <property name="visible">false</property>
+            <property name="xalign">0.0</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+            <attributes>
+              <attribute name="scale" value="0.8333"></attribute>
+            </attributes>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 56f150fc..b16e0c89 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -122,10 +122,8 @@ typedef struct
   guint dispose_has_run : 1;
 
   /*Search Bar*/
-  GtkOverlay     *overlay;
-  GtkRevealer    *search_revealer;
-  GtrSearchBar   *search_bar;
-  GtkSearchEntry *search;
+  GtkSearchBar   *search_bar;
+  GtrSearchBar   *gtr_search_bar;
 
   /* notebook code */
   GtkWidget *titlebar;
@@ -176,10 +174,7 @@ gtr_page_stop_search (GtrTab *tab,
   GtrTabPrivate *priv;
 
   priv = gtr_tab_get_instance_private (tab);
-  g_assert (GTR_IS_TAB (tab));
-  g_assert (GTR_IS_SEARCH_BAR (priv->search_bar));
-
-  gtk_revealer_set_reveal_child (priv->search_revealer, FALSE);
+  gtk_search_bar_set_search_mode (priv->search_bar, FALSE);
 
 }
 
@@ -192,7 +187,7 @@ gtr_tab_focus_search_bar (GtrTab *tab)
   g_assert (GTR_IS_TAB (tab));
   priv = gtr_tab_get_instance_private (tab);
 
-  entry = (GtkEntry *) gtr_search_bar_get_search (priv->search_bar);
+  entry = (GtkEntry *) gtr_search_bar_get_search (priv->gtr_search_bar);
 
   gtk_entry_grab_focus_without_selecting (entry);
 }
@@ -202,10 +197,8 @@ gtr_tab_show_hide_search_bar (GtrTab *tab, gboolean show)
 {
   GtrTabPrivate *priv;
 
-  g_assert (GTR_IS_TAB (tab));
   priv = gtr_tab_get_instance_private (tab);
-
-  gtk_revealer_set_reveal_child (priv->search_revealer, show);
+  gtk_search_bar_set_search_mode (priv->search_bar, show);
 }
 
 void
@@ -216,7 +209,7 @@ gtr_tab_find_set_replace (GtrTab   *tab,
 
   g_assert (GTR_IS_TAB (tab));
   priv = gtr_tab_get_instance_private (tab);
-  gtr_search_bar_set_replace_mode (priv->search_bar, replace);
+  gtr_search_bar_set_replace_mode (priv->gtr_search_bar, replace);
 }
 
 void
@@ -225,7 +218,7 @@ gtr_tab_find_next (GtrTab * tab)
   GtrTabPrivate *priv;
 
   priv = gtr_tab_get_instance_private (tab);
-  gtr_search_bar_find_next (priv->search_bar);
+  gtr_search_bar_find_next (priv->gtr_search_bar);
 }
 
 void
@@ -234,7 +227,7 @@ gtr_tab_find_prev (GtrTab * tab)
   GtrTabPrivate *priv;
 
   priv = gtr_tab_get_instance_private (tab);
-  gtr_search_bar_find_prev (priv->search_bar);
+  gtr_search_bar_find_prev (priv->gtr_search_bar);
 }
 
 void
@@ -257,7 +250,7 @@ gtr_page_notify_child_revealed (GtrTab *tab,
        * as it can reselect the search text.
        */
       if (focus == NULL || !gtk_widget_is_ancestor (focus, GTK_WIDGET (revealer)))
-        gtk_widget_grab_focus (GTK_WIDGET (priv->search_bar));
+        gtk_widget_grab_focus (GTK_WIDGET (priv->gtr_search_bar));
     }
 }
 
@@ -690,11 +683,11 @@ emit_selection_changed (GtkTextBuffer * buf, GParamSpec * spec, GtrTab * tab)
 }
 
 static void
-emit_searchbar_toggled (GtkRevealer *revealer,
-                        GParamSpec  *pspec,
-                        GtrTab      *tab)
+emit_searchbar_toggled (GtkSearchBar *search_bar,
+                        GParamSpec   *pspec,
+                        GtrTab       *tab)
 {
-  gboolean revealed = gtk_revealer_get_child_revealed (revealer);
+  gboolean revealed = gtk_search_bar_get_search_mode (search_bar);
   g_signal_emit (G_OBJECT (tab), signals[SEARCHBAR_TOGGLED], 0, revealed);
 }
 
@@ -897,7 +890,7 @@ gtr_tab_init (GtrTab * tab)
   g_signal_connect (priv->progress_gesture_click, "pressed",
                     G_CALLBACK (show_hide_revealer), tab);
 
-  g_signal_connect (priv->search_revealer, "notify::child-revealed",
+  g_signal_connect (priv->search_bar, "notify::search-mode-enabled",
                     G_CALLBACK (emit_searchbar_toggled), tab);
 
   // TODO: related to header of gtr tab move to saperate header file
@@ -1121,9 +1114,8 @@ gtr_tab_class_init (GtrTabClass * klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_fuzzy);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_untrans);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, progress_percentage);
-  gtk_widget_class_bind_template_child_private (widget_class, GtrTab, overlay);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, search_bar);
-  gtk_widget_class_bind_template_child_private (widget_class, GtrTab, search_revealer);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrTab, gtr_search_bar);
 
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, titlebar);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, sort_id);
diff --git a/src/gtr-tab.ui b/src/gtr-tab.ui
index b7b523a4..fc406a21 100644
--- a/src/gtr-tab.ui
+++ b/src/gtr-tab.ui
@@ -7,144 +7,134 @@
   <template class="GtrTab" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
-      <object class="GtkOverlay" id="overlay">
-        <property name="hexpand">1</property>
-        <property name="vexpand">1</property>
-        <child type="overlay">
-          <object class="GtkRevealer" id="search_revealer">
-            <property name="width-request">525</property>
-            <property name="halign">end</property>
-            <property name="valign">start</property>
-            <property name="margin-end">12</property>
-            <signal name="notify::child-revealed" handler="gtr_page_notify_child_revealed" swapped="true" 
object="GtrTab"/>
+      <object class="GtkSearchBar" id="search_bar">
+        <property name="show-close-button">true</property>
+        <child>
+          <object class="GtrSearchBar" id="gtr_search_bar">
+            <signal name="stop-search" handler="gtr_page_stop_search" swapped="true" object="GtrTab" />
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="AdwFlap" id="hbox">
+        <property name="flap_position">end</property>
+        <property name="fold_policy">ADW_FLAP_FOLD_POLICY_NEVER</property>
+        <property name="locked">1</property>
+        <property name="reveal_flap">1</property>
+        <property name="separator">sep</property>
+        <child>
+          <object class="GtkBox" id="vertical_box">
+            <property name="orientation">vertical</property>
             <child>
-              <object class="GtrSearchBar" id="search_bar">
-                <signal name="stop-search" handler="gtr_page_stop_search" swapped="true" object="GtrTab"/>
+              <object class="GtrMessageTable" id="message_table">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="tab">GtrTab</property>
+                <property name="height_request">350</property>
+                <property name="width_request">450</property>
               </object>
             </child>
-          </object>
-        </child>
-        <property name="child">
-          <object class="AdwFlap" id="hbox">
-            <property name="flap_position">end</property>
-            <property name="fold_policy">ADW_FLAP_FOLD_POLICY_NEVER</property>
-            <property name="locked">1</property>
-            <property name="reveal_flap">1</property>
-            <property name="separator">sep</property>
             <child>
-              <object class="GtkBox" id="vertical_box">
+              <object class="GtkBox" id="translation_box">
                 <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtrMessageTable" id="message_table">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="tab">GtrTab</property>
-                    <property name="height_request">350</property>
-                    <property name="width_request">450</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkBox" id="translation_box">
+                  <object class="GtkBox" id="text_vbox">
+                    <property name="vexpand">1</property>
                     <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkBox" id="text_vbox">
-                        <property name="vexpand">1</property>
-                        <property name="orientation">vertical</property>
+                      <object class="GtkBox" id="text_hbox">
+                        <property name="valign">center</property>
                         <child>
-                          <object class="GtkBox" id="text_hbox">
-                            <property name="valign">center</property>
-                            <child>
-                              <object class="GtkLabel" id="msgid_label">
-                                <property name="xalign">0</property>
-                                <!--<property name="ypad">5</property>-->
-                                <property name="label" translatable="1">_Original Message</property>
-                                <property name="use_underline">1</property>
-                                <attributes>
-                                  <attribute name="weight" value="bold"></attribute>
-                                </attributes>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="msgid_ctxt">
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="0"></property>
-                                <property name="use_underline">1</property>
-                                <property name="ellipsize">end</property>
-                                <style>
-                                  <class name="msgcontext"/>
-                                </style>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="msgid_tags">
-                                <property name="xalign">0</property>
-                                <attributes>
-                                  <attribute name="weight" value="bold"></attribute>
-                                </attributes>
-                                <style>
-                                  <class name="msgtags"/>
-                                </style>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="msgid_label">
+                            <property name="xalign">0</property>
+                            <!--<property name="ypad">5</property>-->
+                            <property name="label" translatable="1">_Original Message</property>
+                            <property name="use_underline">1</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"></attribute>
+                            </attributes>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkScrolledWindow" id="text_msgid_scroll">
-                            <property name="vexpand">1</property>
-                            <property name="focusable">1</property>
-                            <property name="has_frame">1</property>
-                            <child>
-                              <object class="GtrView" id="text_msgid">
-                                <property name="editable">False</property>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="msgid_ctxt">
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="0"></property>
+                            <property name="use_underline">1</property>
+                            <property name="ellipsize">end</property>
+                            <style>
+                              <class name="msgcontext"/>
+                            </style>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkScrolledWindow" id="text_plural_scroll">
-                            <property name="vexpand">1</property>
-                            <property name="focusable">1</property>
-                            <property name="has_frame">1</property>
-                            <child>
-                              <object class="GtrView" id="text_msgid_plural">
-                                <property name="editable">False</property>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="msgid_tags">
+                            <property name="xalign">0</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"></attribute>
+                            </attributes>
+                            <style>
+                              <class name="msgtags"/>
+                            </style>
                           </object>
                         </child>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="msgstr_label">
-                        <property name="valign">center</property>
-                        <property name="xalign">0</property>
-                        <!--<property name="ypad">5</property>-->
-                        <property name="label" translatable="1">Translate_d Text</property>
-                        <property name="use_underline">1</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"></attribute>
-                        </attributes>
+                      <object class="GtkScrolledWindow" id="text_msgid_scroll">
+                        <property name="vexpand">1</property>
+                        <property name="focusable">1</property>
+                        <property name="has_frame">1</property>
+                        <child>
+                          <object class="GtrView" id="text_msgid">
+                            <property name="editable">False</property>
+                          </object>
+                        </child>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkNotebook" id="trans_notebook">
+                      <object class="GtkScrolledWindow" id="text_plural_scroll">
                         <property name="vexpand">1</property>
                         <property name="focusable">1</property>
-                        <property name="show_border">0</property>
+                        <property name="has_frame">1</property>
+                        <child>
+                          <object class="GtrView" id="text_msgid_plural">
+                            <property name="editable">False</property>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="msgstr_label">
+                    <property name="valign">center</property>
+                    <property name="xalign">0</property>
+                    <!--<property name="ypad">5</property>-->
+                    <property name="label" translatable="1">Translate_d Text</property>
+                    <property name="use_underline">1</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"></attribute>
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkNotebook" id="trans_notebook">
+                    <property name="vexpand">1</property>
+                    <property name="focusable">1</property>
+                    <property name="show_border">0</property>
+                  </object>
+                </child>
               </object>
             </child>
-            <child type="flap">
-              <object class="GtrContextPanel" id="context">
-                <property name="tab">GtrTab</property>
-                <!--<property name="width_request">150</property>-->
-              </object>
-            </child>
           </object>
-        </property>
+        </child>
+        <child type="flap">
+          <object class="GtrContextPanel" id="context">
+            <property name="tab">GtrTab</property>
+            <!--<property name="width_request">150</property>-->
+          </object>
+        </child>
       </object>
     </child>
     <child>
diff --git a/src/gtr-window.c b/src/gtr-window.c
index ee8946fa..75dd39d8 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -489,6 +489,7 @@ searchbar_toggled (GtrTab * tab, gboolean revealed, GtrWindow *window)
 {
   GtrWindowPrivate *priv = gtr_window_get_instance_private (window);
   gtr_tab_enable_find_button (GTR_TAB (priv->active_tab), revealed);
+  priv->search_bar_shown = revealed;
 }
 
 /***************************** Public funcs ***********************************/
@@ -953,13 +954,13 @@ gtr_window_show_search_bar (GtrWindow *window,
                             gboolean show)
 {
   GtrWindowPrivate *priv = gtr_window_get_instance_private (window);
-  //GtrNotebook *notebook = GTR_NOTEBOOK (priv->notebook);
   GtrTab *tab = gtr_window_get_active_tab (window);
 
-  if (tab != NULL)
-    gtr_tab_show_hide_search_bar (tab, show);
+  if (!tab)
+    return;
 
-  gtr_tab_enable_find_button(tab, show);
+  gtr_tab_show_hide_search_bar (tab, show);
+  gtr_tab_enable_find_button (tab, show);
 
   priv->search_bar_shown = show;
 }
@@ -984,5 +985,5 @@ gtr_window_toggle_search_bar (GtrWindow *window)
 {
   GtrWindowPrivate *priv = gtr_window_get_instance_private (window);
 
-  gtr_window_show_search_bar(window, !priv->search_bar_shown);
+  gtr_window_show_search_bar (window, !priv->search_bar_shown);
 }


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