[evince] ev-toolbar: Remove the margin of the buttons and center them vertically
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] ev-toolbar: Remove the margin of the buttons and center them vertically
- Date: Sun, 10 Nov 2013 11:33:45 +0000 (UTC)
commit b289180e98b6a7f89a2bd80c5f1be71719e917d4
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Nov 10 12:30:55 2013 +0100
ev-toolbar: Remove the margin of the buttons and center them vertically
This makes the buttons small again after whatever changed in
gnome-themes-standard. Based on patch by Yosef Or Boczko.
https://bugzilla.gnome.org/show_bug.cgi?id=709005
shell/ev-history-action-widget.c | 14 +-------------
shell/ev-toolbar.c | 35 ++++++-----------------------------
2 files changed, 7 insertions(+), 42 deletions(-)
---
diff --git a/shell/ev-history-action-widget.c b/shell/ev-history-action-widget.c
index 8d825b3..634af41 100644
--- a/shell/ev-history-action-widget.c
+++ b/shell/ev-history-action-widget.c
@@ -189,18 +189,6 @@ button_pressed (GtkWidget *button,
return GDK_EVENT_PROPAGATE;
}
-static gint
-get_icon_margin (EvHistoryActionWidget *history_widget)
-{
- gint toolbar_size_px, menu_size_px;
- GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (history_widget));
-
- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &menu_size_px, NULL);
- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_LARGE_TOOLBAR, &toolbar_size_px, NULL);
-
- return (gint)floor ((toolbar_size_px - menu_size_px) / 2.0);
-}
-
static GtkWidget *
ev_history_action_widget_create_button (EvHistoryActionWidget *history_widget,
EvHistoryActionButton action_button)
@@ -214,6 +202,7 @@ ev_history_action_widget_create_button (EvHistoryActionWidget *history_widget,
rtl = (gtk_widget_get_direction (GTK_WIDGET (history_widget)) == GTK_TEXT_DIR_RTL);
button = gtk_button_new ();
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
g_signal_connect (button, "clicked",
G_CALLBACK (button_clicked),
history_widget);
@@ -233,7 +222,6 @@ ev_history_action_widget_create_button (EvHistoryActionWidget *history_widget,
}
image = gtk_image_new ();
- g_object_set (image, "margin", get_icon_margin (history_widget), NULL);
gtk_button_set_image (GTK_BUTTON (button), image);
gtk_image_set_from_icon_name (GTK_IMAGE (image), icon_name, GTK_ICON_SIZE_MENU);
gtk_widget_set_tooltip_text (button, tooltip_text);
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 661e4b3..b470078 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -61,32 +61,6 @@ ev_toolbar_set_property (GObject *object,
}
}
-static gint
-get_icon_margin (EvToolbar *ev_toolbar)
-{
- GtkIconSize toolbar_size;
- gint toolbar_size_px, menu_size_px;
- GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (ev_toolbar));
-
- toolbar_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (ev_toolbar));
-
- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &menu_size_px, NULL);
- gtk_icon_size_lookup_for_settings (settings, toolbar_size, &toolbar_size_px, NULL);
-
- return (gint)floor ((toolbar_size_px - menu_size_px) / 2.0);
-}
-
-static void
-ev_toolbar_set_button_image (EvToolbar *ev_toolbar,
- GtkButton *button)
-{
- GtkWidget *image;
-
- image = gtk_image_new ();
- g_object_set (image, "margin", get_icon_margin (ev_toolbar), NULL);
- gtk_button_set_image (button, image);
-}
-
static void
ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
GtkButton *button,
@@ -104,7 +78,8 @@ ev_toolbar_create_button (EvToolbar *ev_toolbar,
{
GtkWidget *button = gtk_button_new ();
- ev_toolbar_set_button_image (ev_toolbar, GTK_BUTTON (button));
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action);
return button;
@@ -116,7 +91,8 @@ ev_toolbar_create_toggle_button (EvToolbar *ev_toolbar,
{
GtkWidget *button = gtk_toggle_button_new ();
- ev_toolbar_set_button_image (ev_toolbar, GTK_BUTTON (button));
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action);
return button;
@@ -130,7 +106,8 @@ ev_toolbar_create_menu_button (EvToolbar *ev_toolbar,
{
GtkWidget *button = gtk_menu_button_new ();
- ev_toolbar_set_button_image (ev_toolbar, GTK_BUTTON (button));
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON (button))),
icon_name, GTK_ICON_SIZE_MENU);
gtk_widget_set_halign (menu, menu_align);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]