[gthumb] fixed the header bar buttons style



commit 84e2e3aee5795886534a25a93ef59e1a1f41a116
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Oct 17 11:13:55 2013 +0200

    fixed the header bar buttons style

 extensions/search/callbacks.c |    2 +-
 gthumb/gth-browser.c          |   13 +++++++------
 gthumb/gtk-utils.c            |   35 +++++++++++++++++++++++++++++++++++
 gthumb/gtk-utils.h            |    2 ++
 4 files changed, 45 insertions(+), 7 deletions(-)
---
diff --git a/extensions/search/callbacks.c b/extensions/search/callbacks.c
index dedbb26..d93dd2b 100644
--- a/extensions/search/callbacks.c
+++ b/extensions/search/callbacks.c
@@ -103,7 +103,7 @@ search__gth_browser_construct_cb (GthBrowser *browser)
        {
                GtkWidget *button;
 
-               button = gtk_button_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("edit-find-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(data->find_action, "Edit_Find"));
                gtk_widget_show (button);
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 90536e5..3aa16d3 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4608,6 +4608,7 @@ gth_browser_init (GthBrowser *browser)
 
                for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
                        browser->priv->header_sections[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+                       gtk_widget_set_valign (browser->priv->header_sections[i], GTK_ALIGN_CENTER);
                        gtk_style_context_add_class (gtk_widget_get_style_context 
(browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
                }
 
@@ -4633,7 +4634,7 @@ gth_browser_init (GthBrowser *browser)
 
                        builder = _gtk_builder_new_from_resource ("gears-menu.ui");
                        menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
-                       gears_menu_button = gtk_menu_button_new ();
+                       gears_menu_button = _gtk_menu_button_new_for_header_bar ();
                        gtk_container_add (GTK_CONTAINER (gears_menu_button), gtk_image_new_from_icon_name 
("emblem-system-symbolic", GTK_ICON_SIZE_MENU));
                        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (gears_menu_button), menu);
                        gtk_widget_show_all (gears_menu_button);
@@ -4645,13 +4646,13 @@ gth_browser_init (GthBrowser *browser)
 
                /* browser navigation */
 
-               button = gtk_button_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("go-previous-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(browser->priv->actions, "Go_Back"));
                gtk_widget_show (button);
                gtk_box_pack_start (GTK_BOX 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION]), button, FALSE, FALSE, 0);
 
-               button = gtk_button_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("go-next-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(browser->priv->actions, "Go_Forward"));
                gtk_widget_show (button);
@@ -4659,7 +4660,7 @@ gth_browser_init (GthBrowser *browser)
 
                /* browser commands */
 
-               button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("view-fullscreen-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(browser->priv->actions, "View_Fullscreen"));
                gtk_widget_show (button);
@@ -4667,7 +4668,7 @@ gth_browser_init (GthBrowser *browser)
 
                /* viewer navigation */
 
-               button = gtk_button_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("go-previous-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(browser->priv->actions, "View_BrowserMode"));
                gtk_widget_show (button);
@@ -4675,7 +4676,7 @@ gth_browser_init (GthBrowser *browser)
 
                /* viewer view */
 
-               button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic", GTK_ICON_SIZE_MENU);
+               button = _gtk_image_button_new_for_header_bar ("view-fullscreen-symbolic");
                gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (button), FALSE);
                gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), gtk_action_group_get_action 
(browser->priv->actions, "View_Fullscreen"));
                gtk_widget_show (button);
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 50502cd..420eb34 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -1075,3 +1075,38 @@ _gtk_file_chooser_set_file_parent (GtkFileChooser   *chooser,
        return result;
 }
 
+
+static void
+_gtk_menu_button_set_style_for_header_bar (GtkWidget *button)
+{
+       GtkStyleContext *context;
+
+       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+       context = gtk_widget_get_style_context (button);
+       gtk_style_context_add_class (context, "image-button");
+       gtk_style_context_remove_class (context, "text-button");
+}
+
+
+GtkWidget *
+_gtk_menu_button_new_for_header_bar (void)
+{
+       GtkWidget *button;
+
+       button = gtk_menu_button_new ();
+       _gtk_menu_button_set_style_for_header_bar (button);
+
+       return button;
+}
+
+
+GtkWidget *
+_gtk_image_button_new_for_header_bar (const char *icon_name)
+{
+       GtkWidget *button;
+
+       button = gtk_button_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+       _gtk_menu_button_set_style_for_header_bar (button);
+
+       return button;
+}
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index 4130ab3..84db4d0 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -136,6 +136,8 @@ void            _gtk_combo_box_add_image_sizes             (GtkComboBox      *co
 gboolean        _gtk_file_chooser_set_file_parent          (GtkFileChooser   *chooser,
                                                            GFile            *file,
                                                            GError          **error);
+GtkWidget *     _gtk_menu_button_new_for_header_bar        (void);
+GtkWidget *     _gtk_image_button_new_for_header_bar       (const char       *icon_name);
 
 G_END_DECLS
 


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