[gnome-panel] panel: Change default size of icon in menu bar & user menu applets to 16



commit 12b371c4211ec5d17cf799cb3ee628ffd577cbf6
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Oct 17 13:41:50 2011 +0200

    panel: Change default size of icon in menu bar & user menu applets to 16
    
    This makes it possible to make the panel smaller than it used to be (the
    size of the icon was the blocker) and it also makes the icon consistent
    with the notification area icons.
    
    Note that this size doesn't apply to the user menu when it appears in
    the main menu (as opposed to the user menu applet).
    
    This can be changed in settings.ini (see GtkSettings doc) with:
     gtk-icon-sizes = panel-menu-bar=16,16
    
    This used to be called panel-foobar, but that name was horrible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660846
    https://bugzilla.gnome.org/show_bug.cgi?id=661790

 gnome-panel/panel-menu-bar-object.c |   18 ++++++++++++++++++
 gnome-panel/panel-menu-bar-object.h |    2 ++
 gnome-panel/panel-menu-bar.c        |   19 +------------------
 gnome-panel/panel-menu-items.c      |   14 ++++++++++----
 4 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/gnome-panel/panel-menu-bar-object.c b/gnome-panel/panel-menu-bar-object.c
index fe0fd64..9752f2a 100644
--- a/gnome-panel/panel-menu-bar-object.c
+++ b/gnome-panel/panel-menu-bar-object.c
@@ -49,6 +49,19 @@ enum {
 static void panel_menu_bar_object_update_text_gravity (PanelMenuBarObject *menubar);
 static void panel_menu_bar_object_update_orientation (PanelMenuBarObject *menubar);
 
+/* themeable size - "panel-menu-bar" -- This is only used for the icon of the
+ * Applications item in the menu bar. To set it, use this in gtk+'s
+ * settings.ini: "gtk-icon-sizes = panel-menu-bar=16,16" */
+#define PANEL_DEFAULT_MENU_BAR_OBJECT_ICON_SIZE       16
+
+static GtkIconSize panel_menu_bar_object_icon_size = 0;
+
+GtkIconSize
+panel_menu_bar_object_icon_get_size (void)
+{
+	return panel_menu_bar_object_icon_size;
+}
+
 static void
 panel_menu_bar_object_init (PanelMenuBarObject *menubar)
 {
@@ -172,6 +185,11 @@ panel_menu_bar_object_class_init (PanelMenuBarObjectClass *klass)
 				   PANEL_TYPE_ORIENTATION,
 				   PANEL_ORIENTATION_TOP,
 				   G_PARAM_READWRITE));
+
+	if (panel_menu_bar_object_icon_size == 0)
+		panel_menu_bar_object_icon_size = gtk_icon_size_register ("panel-menu-bar",
+								   PANEL_DEFAULT_MENU_BAR_OBJECT_ICON_SIZE,
+								   PANEL_DEFAULT_MENU_BAR_OBJECT_ICON_SIZE);
 }
 
 static gboolean
diff --git a/gnome-panel/panel-menu-bar-object.h b/gnome-panel/panel-menu-bar-object.h
index 9091164..351321e 100644
--- a/gnome-panel/panel-menu-bar-object.h
+++ b/gnome-panel/panel-menu-bar-object.h
@@ -63,6 +63,8 @@ void             panel_menu_bar_object_set_orientation (PanelMenuBarObject     *
 							PanelOrientation        orientation);
 PanelOrientation panel_menu_bar_object_get_orientation (PanelMenuBarObject     *menubar);
 
+GtkIconSize      panel_menu_bar_object_icon_get_size (void);
+
 G_END_DECLS
 
 #endif /* __PANEL_MENU_BAR_OBJECT_H__ */
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index be037da..0988144 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -58,18 +58,6 @@ struct _PanelMenuBarPrivate {
 	GtkWidget   *places_item;
 };
 
-/* themeable size - "panel-foobar" -- This is only used for the icon of the
- * Applications item in the menu bar */
-#define PANEL_DEFAULT_MENU_BAR_ICON_SIZE       24
-
-static GtkIconSize panel_menu_bar_icon_size = 0;
-
-static GtkIconSize
-panel_menu_bar_icon_get_size (void)
-{
-	return panel_menu_bar_icon_size;
-}
-
 static gboolean
 panel_menu_bar_reinit_tooltip (GtkWidget    *widget,
 			       PanelMenuBar *menubar)
@@ -135,7 +123,7 @@ panel_menu_bar_init (PanelMenuBar *menubar)
 	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_icon_get_size ());
+							     panel_menu_bar_object_icon_get_size ());
 
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar->priv->applications_item),
 				   menubar->priv->applications_menu);
@@ -207,11 +195,6 @@ panel_menu_bar_class_init (PanelMenuBarClass *klass)
 				      "Whether the menubar icon is visible",
 				      FALSE,
 				      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-	if (panel_menu_bar_icon_size == 0)
-		panel_menu_bar_icon_size = gtk_icon_size_register ("panel-foobar",
-								   PANEL_DEFAULT_MENU_BAR_ICON_SIZE,
-								   PANEL_DEFAULT_MENU_BAR_ICON_SIZE);
 }
 
 void
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 821e638..9b84e18 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -58,6 +58,7 @@
 #include "panel-globals.h"
 #include "panel-icon-names.h"
 #include "panel-lockdown.h"
+#include "panel-menu-bar-object.h"
 #include "panel-recent.h"
 #include "panel-stock-icons.h"
 #include "panel-util.h"
@@ -100,6 +101,7 @@ struct _PanelPlaceMenuItemPrivate {
 struct _PanelDesktopMenuItemPrivate {
 	GtkWidget   *menu;
 	PanelWidget *panel;
+	GtkIconSize  icon_size;
 
 #ifdef HAVE_TELEPATHY_GLIB
 	GList            *presence_items;
@@ -1632,7 +1634,7 @@ panel_place_menu_item_new (gboolean use_image,
 		if (use_image) {
 			GtkWidget *image;
 			image = gtk_image_new_from_icon_name (icon_name,
-							      panel_menu_icon_get_size ());
+							      panel_menu_bar_object_icon_get_size ());
 			gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
 						       image);
 		}
@@ -1686,7 +1688,7 @@ panel_desktop_menu_item_on_presence_changed (PanelSessionManager             *ma
 	 * menu */
 	if (image) {
 		gtk_image_set_from_icon_name (GTK_IMAGE (image),
-					      icon, panel_menu_icon_get_size ());
+					      icon, desktop_item->priv->icon_size);
 	}
 
 	for (l = desktop_item->priv->presence_items; l != NULL; l = l->next) {
@@ -1732,17 +1734,21 @@ panel_desktop_menu_item_new (gboolean use_image,
 	 * the size requests and can make the panels bigger than we'd like */
 	if (in_menubar) {
 		gtk_menu_item_set_label (GTK_MENU_ITEM (menuitem), name);
+		menuitem->priv->icon_size = panel_menu_bar_object_icon_get_size ();
+
 		if (use_image) {
 			GtkWidget *image;
 			image = gtk_image_new_from_icon_name (icon_name,
-							      panel_menu_icon_get_size ());
+							      menuitem->priv->icon_size);
 			gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
 						       image);
 		}
 	} else {
+		menuitem->priv->icon_size = panel_menu_icon_get_size ();
+
 		if (use_image)
 			setup_menu_item_with_icon (GTK_WIDGET (menuitem),
-						   panel_menu_icon_get_size (),
+						   menuitem->priv->icon_size,
 						   icon_name, NULL, NULL,
 						   name);
 		else



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