[gnome-panel] panel-menu-bar: force icon size
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel-menu-bar: force icon size
- Date: Sat, 21 Mar 2015 13:09:33 +0000 (UTC)
commit eefb31f140056bda95a63d67c39696b3159aa29a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Mar 20 00:02:33 2015 +0200
panel-menu-bar: force icon size
gnome-panel/panel-menu-bar-object.c | 16 ++++++++++++++++
gnome-panel/panel-menu-bar-object.h | 1 +
gnome-panel/panel-menu-bar.c | 8 ++++++--
gnome-panel/panel-menu-items.c | 11 +++++++++--
4 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel-menu-bar-object.c b/gnome-panel/panel-menu-bar-object.c
index 4e2998a..600ccf9 100644
--- a/gnome-panel/panel-menu-bar-object.c
+++ b/gnome-panel/panel-menu-bar-object.c
@@ -66,6 +66,22 @@ panel_menu_bar_object_icon_get_size (void)
return panel_menu_bar_object_icon_size;
}
+int
+panel_menu_bar_object_icon_get_pixel_size (GtkIconSize size)
+{
+ switch (size)
+ {
+ case GTK_ICON_SIZE_DIALOG:
+ return 48;
+ case GTK_ICON_SIZE_DND:
+ return 32;
+ case GTK_ICON_SIZE_LARGE_TOOLBAR:
+ return 24;
+ default:
+ return 16;
+ }
+}
+
static void
panel_menu_bar_object_init (PanelMenuBarObject *menubar)
{
diff --git a/gnome-panel/panel-menu-bar-object.h b/gnome-panel/panel-menu-bar-object.h
index 9421ea5..ac53632 100644
--- a/gnome-panel/panel-menu-bar-object.h
+++ b/gnome-panel/panel-menu-bar-object.h
@@ -60,6 +60,7 @@ void panel_menu_bar_object_set_orientation (PanelMenuBarObject *
PanelOrientation panel_menu_bar_object_get_orientation (PanelMenuBarObject *menubar);
GtkIconSize panel_menu_bar_object_icon_get_size (void);
+int panel_menu_bar_object_icon_get_pixel_size (GtkIconSize size);
G_END_DECLS
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index 3082ea6..d420969 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -111,6 +111,7 @@ static void
panel_menu_bar_init (PanelMenuBar *menubar)
{
gchar *applications_menu;
+ GtkIconSize icon_size;
menubar->priv = PANEL_MENU_BAR_GET_PRIVATE (menubar);
@@ -123,8 +124,11 @@ panel_menu_bar_init (PanelMenuBar *menubar)
menubar->priv->applications_item = panel_image_menu_item_new2 ();
gtk_menu_item_set_label (GTK_MENU_ITEM (menubar->priv->applications_item),
_("Applications"));
- menubar->priv->image = gtk_image_new_from_icon_name (PANEL_ICON_MAIN_MENU,
- panel_menu_bar_object_icon_get_size ());
+
+ icon_size = panel_menu_bar_object_icon_get_size ();
+ menubar->priv->image = gtk_image_new_from_icon_name (PANEL_ICON_MAIN_MENU, icon_size);
+ gtk_image_set_pixel_size (GTK_IMAGE (menubar->priv->image),
+ panel_menu_bar_object_icon_get_pixel_size (icon_size));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar->priv->applications_item),
menubar->priv->applications_menu);
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 1421c29..6a2b66e 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -1611,9 +1611,14 @@ panel_place_menu_item_new (gboolean use_image,
if (in_menubar) {
gtk_menu_item_set_label (GTK_MENU_ITEM (menuitem), name);
if (use_image) {
+ GtkIconSize icon_size;
GtkWidget *image;
- image = gtk_image_new_from_icon_name (icon_name,
- panel_menu_bar_object_icon_get_size ());
+
+ icon_size = panel_menu_bar_object_icon_get_size ();
+ image = gtk_image_new_from_icon_name (icon_name, icon_size);
+
+ gtk_image_set_pixel_size (GTK_IMAGE (image),
+ panel_menu_bar_object_icon_get_pixel_size (icon_size));
panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menuitem), image);
}
} else {
@@ -1718,6 +1723,8 @@ panel_desktop_menu_item_new (gboolean use_image,
GtkWidget *image;
image = gtk_image_new_from_icon_name (icon_name,
menuitem->priv->icon_size);
+ gtk_image_set_pixel_size (GTK_IMAGE (image),
+ panel_menu_bar_object_icon_get_pixel_size
(menuitem->priv->icon_size));
panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menuitem), image);
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]