[gnome-system-log] findbar: use a more modern style



commit 25b40984136daa932e7bcd4d721f1af7da1c7e79
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 25 16:18:10 2013 -0400

    findbar: use a more modern style
    
    Use the same pattern Epiphany/Documents have for the findbar.

 src/logview-findbar.c |   58 ++++++++++++++++++++++--------------------------
 1 files changed, 27 insertions(+), 31 deletions(-)
---
diff --git a/src/logview-findbar.c b/src/logview-findbar.c
index 73cf81a..0d6feac 100644
--- a/src/logview-findbar.c
+++ b/src/logview-findbar.c
@@ -27,6 +27,7 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <math.h>
+#include <libgd/gd.h>
 
 #include "logview-findbar.h"
 
@@ -126,7 +127,7 @@ get_icon_margin (void)
 static void 
 logview_findbar_init (LogviewFindbar *findbar)
 {
-  GtkWidget *w, *box;
+  GtkWidget *w, *box, *buttons;
   GtkToolbar *gtoolbar;
   GtkToolItem *item;
   LogviewFindbarPrivate *priv;
@@ -135,44 +136,39 @@ logview_findbar_init (LogviewFindbar *findbar)
 
   gtoolbar = GTK_TOOLBAR (findbar);
 
+  gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (findbar)),
+                               GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
   gtk_toolbar_set_style (gtoolbar, GTK_TOOLBAR_BOTH_HORIZ);
 
-  priv->entry = gtk_search_entry_new ();
+  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+  gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
 
-  item = gtk_tool_item_new ();
-  gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
-  gtk_container_add (GTK_CONTAINER (item), priv->entry);
-  gtk_toolbar_insert (gtoolbar, item, -1);
-  gtk_widget_show_all (GTK_WIDGET (item));
-
-  item = gtk_separator_tool_item_new ();
-  gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
-  gtk_toolbar_insert (gtoolbar, item, -1);
-  gtk_widget_show (GTK_WIDGET (item));
+  priv->entry = gtk_search_entry_new ();
+       gtk_widget_set_size_request (priv->entry, 500, -1);
+  gtk_container_add (GTK_CONTAINER (box), priv->entry);
 
-  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
+  buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_style_context_add_class (gtk_widget_get_style_context (buttons), "linked");
+  gtk_style_context_add_class (gtk_widget_get_style_context (buttons), "raised");
+  gtk_container_add (GTK_CONTAINER (box), buttons);
 
   /* "Previous" and "Next" buttons */
-  priv->back_button = gtk_button_new ();
-  w = gtk_image_new_from_icon_name ("go-up-symbolic", GTK_ICON_SIZE_MENU);
-  g_object_set (w, "margin", get_icon_margin (), NULL);
-  gtk_container_add (GTK_CONTAINER (priv->back_button), w);
-  gtk_container_add (GTK_CONTAINER (box), priv->back_button);
-  gtk_widget_set_tooltip_text (priv->back_button,
-                               _("Find previous occurrence of the search string"));
-  gtk_widget_show_all (GTK_WIDGET (priv->back_button));
-
-  priv->forward_button = gtk_button_new ();
-  w = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
-  g_object_set (w, "margin", get_icon_margin (), NULL);
-  gtk_container_add (GTK_CONTAINER (priv->forward_button), w);
-  gtk_container_add (GTK_CONTAINER (box), priv->forward_button);
-  gtk_widget_set_tooltip_text (priv->forward_button,
-                               _("Find next occurrence of the search string"));
-  gtk_widget_show_all (GTK_WIDGET (priv->forward_button));
+  priv->back_button = gd_header_simple_button_new ();
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->back_button),
+                                           "go-up-symbolic");
+  gd_header_button_set_label (GD_HEADER_BUTTON (priv->back_button),
+                              _("Find previous occurrence of the search string"));
+  gtk_container_add (GTK_CONTAINER (buttons), priv->back_button);
+
+  priv->forward_button = gd_header_simple_button_new ();
+  gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->forward_button),
+                                           "go-down-symbolic");
+  gd_header_button_set_label (GD_HEADER_BUTTON (priv->forward_button),
+                              _("Find next occurrence of the search string"));
+  gtk_container_add (GTK_CONTAINER (buttons), priv->forward_button);
 
   item = gtk_tool_item_new ();
+  gtk_tool_item_set_expand (item, TRUE);
   gtk_container_add (GTK_CONTAINER (item), box);
   gtk_toolbar_insert (gtoolbar, item, -1);
   gtk_widget_show_all (GTK_WIDGET (item));


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