[gnome-system-log] Use GdRevealer for sliding in the find bar



commit d3fde6a068fb7f9f65dcefc746154c5906f83e29
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sat Feb 9 18:47:28 2013 +0100

    Use GdRevealer for sliding in the find bar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693485

 configure.ac         |    1 +
 src/logview-window.c |   16 +++++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 47d86a6..33f8464 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,7 @@ PKG_CHECK_MODULES(LOGVIEW,
 
 LIBGD_INIT([
   main-toolbar
+  revealer
   static
 ])
 
diff --git a/src/logview-window.c b/src/logview-window.c
index 832cfe8..74c1f13 100644
--- a/src/logview-window.c
+++ b/src/logview-window.c
@@ -26,6 +26,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 #include <libgd/gd-main-toolbar.h>
+#include <libgd/gd-revealer.h>
 
 #include "logview-window.h"
 
@@ -41,6 +42,7 @@
 struct _LogviewWindowPrivate {
   PangoFontDescription *monospace_description;
 
+  GtkWidget *find_bar_revealer;
   GtkWidget *find_bar;
   GtkWidget *loglist;
   GtkWidget *sidebar;
@@ -174,7 +176,7 @@ logview_update_toolbar (LogviewWindow *logview,
     return;
   }
 
-  if (gtk_widget_get_visible (logview->priv->find_bar)) {
+  if (gd_revealer_get_reveal_child (GD_REVEALER (logview->priv->find_bar_revealer))) {
     text = g_strdup_printf (_("Search in \"%s\""),
                             logview_log_get_display_name (active));
     gd_main_toolbar_set_labels (GD_MAIN_TOOLBAR (logview->priv->toolbar),
@@ -1102,11 +1104,10 @@ action_search_change_state (GSimpleAction *action,
   gboolean open = g_variant_get_boolean (state);
   LogviewLog *active_log = logview_manager_get_active_log (logview_manager_get ());
 
+  gd_revealer_set_reveal_child (GD_REVEALER (logview->priv->find_bar_revealer),
+                                open);
   if (open) {
-    gtk_widget_show (logview->priv->find_bar);
     gtk_widget_grab_focus (logview->priv->find_bar);
-  } else {
-    gtk_widget_hide (logview->priv->find_bar);
   }
 
   logview_update_toolbar (logview, active_log, NULL);
@@ -1210,8 +1211,13 @@ logview_window_init (LogviewWindow *logview)
   priv->filters_placeholder = G_MENU_MODEL (gtk_builder_get_object (builder, "filters-placeholder"));
   g_object_unref (builder);
 
+  priv->find_bar_revealer = gd_revealer_new ();
+  gtk_widget_show (priv->find_bar_revealer);
+  gtk_box_pack_start (GTK_BOX (vbox), priv->find_bar_revealer, FALSE, FALSE, 0);
+
   priv->find_bar = logview_findbar_new ();
-  gtk_box_pack_start (GTK_BOX (vbox), priv->find_bar, FALSE, FALSE, 0);
+  gtk_widget_show (priv->find_bar);
+  gtk_container_add (GTK_CONTAINER (priv->find_bar_revealer), priv->find_bar);
 
   g_signal_connect (priv->find_bar, "previous",
                     G_CALLBACK (findbar_previous_cb), logview);


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