summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSorokin Alexei <[email protected]>2016-02-20 18:39:53 +0300
committerWolfgang Ulbrich <[email protected]>2016-02-21 11:51:49 +0100
commitbd3d7bc04d864d37e054b9e51fb48cbabb7e18f7 (patch)
tree50c9115518956d54e451e0a57c1f997fc61862cb
parentc29a88ff648af2e07a7cd657c027f1e5bf665ed6 (diff)
downloadmate-panel-bd3d7bc04d864d37e054b9e51fb48cbabb7e18f7.tar.bz2
mate-panel-bd3d7bc04d864d37e054b9e51fb48cbabb7e18f7.tar.xz
add gschema key for setting menu icon sizes
-rw-r--r--data/org.mate.panel.menubar.gschema.xml.in20
-rw-r--r--mate-panel/panel-stock-icons.c35
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 @@
<schemalist gettext-domain="@[email protected]">
+
+ <enum id="org.mate.panel.menubar.icon-size">
+ <value nick="default" value="-1"/>
+ <value nick="16px" value="16"/>
+ <value nick="22px" value="22"/>
+ <value nick="24px" value="24"/>
+ <value nick="32px" value="32"/>
+ <value nick="48px" value="48"/>
+ </enum>
+
<schema id="org.mate.panel.menubar" path="/org/mate/panel/menubar/">
<key name="show-applications" type="b">
<default>true</default>
@@ -25,5 +35,15 @@
<summary>Icon to show in menu bar</summary>
<description>Set the theme icon name to use in menu bar.</description>
</key>
+ <key name="icon-size" enum="org.mate.panel.menubar.icon-size">
+ <default>'default'</default>
+ <summary>Menu bar icon size</summary>
+ <description>Set the size of an icon used in menu bar. The panel must be restarted for this to take effect.</description>
+ </key>
+ <key name="item-icon-size" enum="org.mate.panel.menubar.icon-size">
+ <default>'default'</default>
+ <summary>Menu items icon size</summary>
+ <description>Set the size of icons used in the menu. The panel must be restarted for this to take effect.</description>
+ </key>
</schema>
</schemalist>
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 <gtk/gtk.h>
#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);
}