From bd3d7bc04d864d37e054b9e51fb48cbabb7e18f7 Mon Sep 17 00:00:00 2001 From: Sorokin Alexei Date: Sat, 20 Feb 2016 18:39:53 +0300 Subject: add gschema key for setting menu icon sizes --- data/org.mate.panel.menubar.gschema.xml.in | 20 +++++++++++++++++ mate-panel/panel-stock-icons.c | 35 ++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/data/org.mate.panel.menubar.gschema.xml.in b/data/org.mate.panel.menubar.gschema.xml.in index 0c707412..71cd4e97 100644 --- a/data/org.mate.panel.menubar.gschema.xml.in +++ b/data/org.mate.panel.menubar.gschema.xml.in @@ -1,4 +1,14 @@ + + + + + + + + + + true @@ -25,5 +35,15 @@ Icon to show in menu bar Set the theme icon name to use in menu bar. + + 'default' + Menu bar icon size + Set the size of an icon used in menu bar. The panel must be restarted for this to take effect. + + + 'default' + Menu items icon size + Set the size of icons used in the menu. The panel must be restarted for this to take effect. + diff --git a/mate-panel/panel-stock-icons.c b/mate-panel/panel-stock-icons.c index 26639784..514e5818 100644 --- a/mate-panel/panel-stock-icons.c +++ b/mate-panel/panel-stock-icons.c @@ -30,6 +30,7 @@ #include #include "panel-icon-names.h" +#include "panel-schemas.h" static GtkIconSize panel_menu_icon_size = 0; static GtkIconSize panel_menu_bar_icon_size = 0; @@ -128,14 +129,33 @@ void panel_init_stock_icons_and_items (void) { GtkIconFactory *factory; + GSettings *settings; + gint icon_size; + + settings = g_settings_new (PANEL_MENU_BAR_SCHEMA); + + icon_size = g_settings_get_enum (settings, "item-icon-size"); + if (icon_size <= 0) { + panel_menu_icon_size = gtk_icon_size_register ("panel-menu", + PANEL_DEFAULT_MENU_ICON_SIZE, + PANEL_DEFAULT_MENU_ICON_SIZE); + } else { + /* underscores to prevent themes from altering these settings */ + panel_menu_icon_size = gtk_icon_size_register ("__panel-menu", + icon_size, + icon_size); + } - panel_menu_icon_size = gtk_icon_size_register ("panel-menu", - PANEL_DEFAULT_MENU_ICON_SIZE, - PANEL_DEFAULT_MENU_ICON_SIZE); - - panel_menu_bar_icon_size = gtk_icon_size_register ("panel-foobar", - PANEL_DEFAULT_MENU_BAR_ICON_SIZE, - PANEL_DEFAULT_MENU_BAR_ICON_SIZE); + icon_size = g_settings_get_enum (settings, "icon-size"); + if (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); + } else { + panel_menu_bar_icon_size = gtk_icon_size_register ("__panel-foobar", + icon_size, + icon_size); + } panel_add_to_icon_size = gtk_icon_size_register ("panel-add-to", PANEL_ADD_TO_DEFAULT_ICON_SIZE, @@ -148,4 +168,5 @@ panel_init_stock_icons_and_items (void) panel_init_stock_items (factory); g_object_unref (factory); + g_object_unref (settings); } -- cgit v1.2.1