[bijiben] mainToolbar::searchButton - Set toggle when populating



commit 22a3ea886eb7d1a11783af63caa7e8aefdb9eb8e
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Thu May 2 22:38:16 2013 +0200

    mainToolbar::searchButton - Set toggle when populating
    
    Otherwise the state will be inconsistent. Fixes #699505

 src/bjb-main-toolbar.c   |    4 ++++
 src/bjb-search-toolbar.c |    6 ++++++
 src/bjb-search-toolbar.h |    2 ++
 src/bjb-window-base.c    |   11 +++++++++++
 src/bjb-window-base.h    |    2 ++
 5 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 3e22541..f91d8bd 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -213,12 +213,16 @@ static void
 add_search_button (BjbMainToolbar *self)
 {
   BjbMainToolbarPrivate *priv = self->priv;
+  gboolean active;
 
   priv->search = gd_main_toolbar_add_toggle (GD_MAIN_TOOLBAR (self),
                                              "edit-find-symbolic",
                                              NULL,
                                              FALSE);
 
+  active =  bjb_window_base_get_show_search_bar (BJB_WINDOW_BASE (self->priv->window));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search), active);
+
   g_signal_connect_swapped (priv->search, "clicked",
                             G_CALLBACK (on_search_button_clicked), priv);
 }
diff --git a/src/bjb-search-toolbar.c b/src/bjb-search-toolbar.c
index 9651f4a..6b7ccfc 100644
--- a/src/bjb-search-toolbar.c
+++ b/src/bjb-search-toolbar.c
@@ -411,3 +411,9 @@ bjb_search_toolbar_get_revealer (BjbSearchToolbar *self)
 {
   return self->priv->revealer;
 }
+
+gboolean
+bjb_search_toolbar_is_shown (BjbSearchToolbar *self)
+{
+  return gd_revealer_get_child_revealed (self->priv->revealer);
+}
diff --git a/src/bjb-search-toolbar.h b/src/bjb-search-toolbar.h
index 018f955..82f1153 100644
--- a/src/bjb-search-toolbar.h
+++ b/src/bjb-search-toolbar.h
@@ -63,6 +63,8 @@ void bjb_search_toolbar_disconnect (BjbSearchToolbar *self);
 
 void bjb_search_toolbar_connect (BjbSearchToolbar *self);
 
+gboolean bjb_search_toolbar_is_shown (BjbSearchToolbar *self);
+
 G_END_DECLS
 
 #endif /* BJB_SEARCH_TOOLBAR_H */
diff --git a/src/bjb-window-base.c b/src/bjb-window-base.c
index f9cc6b3..a98ec37 100644
--- a/src/bjb-window-base.c
+++ b/src/bjb-window-base.c
@@ -379,6 +379,17 @@ bjb_window_base_get_main_view (BjbWindowBase *self)
 }
 
 gboolean
+bjb_window_base_get_show_search_bar (BjbWindowBase *self)
+{
+  /* There is no search bar at startup,
+   * when main toolbar is first built... */
+  if (!self->priv->search_bar)
+    return FALSE;
+
+  return bjb_search_toolbar_is_shown (self->priv->search_bar);
+}
+
+gboolean
 bjb_window_base_set_show_search_bar (BjbWindowBase *self,
                                      gboolean show)
 {
diff --git a/src/bjb-window-base.h b/src/bjb-window-base.h
index c263ba6..0d9f57f 100644
--- a/src/bjb-window-base.h
+++ b/src/bjb-window-base.h
@@ -69,6 +69,8 @@ BijiNoteObj * bjb_window_base_get_note (BjbWindowBase *self);
 
 gboolean switch_window_fullscreen();
 
+gboolean bjb_window_base_get_show_search_bar (BjbWindowBase *self);
+
 gboolean bjb_window_base_set_show_search_bar (BjbWindowBase *self, gboolean show);
 
 gboolean bjb_window_base_toggle_search_button (BjbWindowBase *self,


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