[gtk+/places-sidebar] Use our own function to compute icon sizes
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] Use our own function to compute icon sizes
- Date: Tue, 4 Oct 2011 19:47:17 +0000 (UTC)
commit 9533b388aaf50f343c373bbe3d94acbdacd451a1
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 4 06:02:09 2011 -0500
Use our own function to compute icon sizes
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkplacessidebar.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 20b83e8..6912aa4 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -206,6 +206,20 @@ emit_initiated_unmount (GtkPlacesSidebar *sidebar, gboolean initiated_unmount)
initiated_unmount);
}
+static gint
+get_icon_size (GtkPlacesSidebar *sidebar)
+{
+ GtkSettings *settings;
+ gint width, height;
+
+ settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (sidebar)));
+
+ if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
+ return MAX (width, height);
+ else
+ return 16;
+}
+
static GdkPixbuf *
get_eject_icon (GtkPlacesSidebar *sidebar,
gboolean highlighted)
@@ -218,7 +232,7 @@ get_eject_icon (GtkPlacesSidebar *sidebar,
GtkStyleContext *style;
icon_theme = gtk_icon_theme_get_default ();
- icon_size = nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ icon_size = get_icon_size (sidebar);
icon = g_themed_icon_new_with_default_fallbacks ("media-eject-symbolic");
icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, icon_size, 0);
@@ -340,7 +354,7 @@ add_place (GtkPlacesSidebar *sidebar,
check_heading_for_section (sidebar, section_type);
- icon_size = nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ icon_size = get_icon_size (sidebar);
icon_info = nautilus_icon_info_lookup (icon, icon_size);
pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon_info, icon_size);
@@ -965,7 +979,7 @@ over_eject_button (GtkPlacesSidebar *sidebar,
sidebar->eject_icon_cell_renderer,
&x_offset, &width);
- eject_button_size = nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ eject_button_size = get_icon_size (sidebar);
/* This is kinda weird, but we have to do it to workaround gtk+ expanding
* the eject cell renderer (even thought we told it not to) and we then
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]