[gnome-panel] don't use deprecated gtk_icon_size_register
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] don't use deprecated gtk_icon_size_register
- Date: Mon, 27 Oct 2014 16:19:36 +0000 (UTC)
commit 59951a69813159566644ef68b12e0a51ed01363a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Jul 12 20:34:37 2014 +0300
don't use deprecated gtk_icon_size_register
Also 'gtk-icon-sizes' in themes are deprecated and ignored. That
means that panel-menu and panel-menu-bar always is registered with
default sizes - 24x24px and 16x16px. We can safely replace these by
built-in stock icon sizes.
This commit also restores limited option to change icon size. You
can change icon size to one of built-in sizes - 16px, 24px, 32px
and 48px.
data/org.gnome.gnome-panel.gschema.xml.in.in | 15 +++++++++++++++
gnome-panel/main.c | 1 -
gnome-panel/panel-menu-bar-object.c | 11 ++++++-----
gnome-panel/panel-stock-icons.c | 14 ++++++--------
gnome-panel/panel-stock-icons.h | 1 -
5 files changed, 27 insertions(+), 15 deletions(-)
---
diff --git a/data/org.gnome.gnome-panel.gschema.xml.in.in b/data/org.gnome.gnome-panel.gschema.xml.in.in
index ab8682b..812dd56 100644
--- a/data/org.gnome.gnome-panel.gschema.xml.in.in
+++ b/data/org.gnome.gnome-panel.gschema.xml.in.in
@@ -7,6 +7,13 @@
<child name="run-dialog" schema="org.gnome.gnome-panel.run-dialog"/>
</schema>
+ <enum id='org.gnome.gnome-panel.icon-size'>
+ <value nick='16px' value='1'/>
+ <value nick='24px' value='3'/>
+ <value nick='32px' value='5'/>
+ <value nick='48px' value='6'/>
+ </enum>
+
<schema id="org.gnome.gnome-panel.general" path="/org/gnome/gnome-panel/general/">
<key name="enable-tooltips" type="b">
<default>true</default>
@@ -18,6 +25,14 @@
<_summary>Confirm panel removal</_summary>
<_description>If true, a dialog is shown asking for confirmation if the user wants to remove a
panel.</_description>
</key>
+ <key name="panel-menu" enum="org.gnome.gnome-panel.icon-size">
+ <default>'24px'</default>
+ <_summary>Icon size in the menus</_summary>
+ </key>
+ <key name="panel-menu-bar" enum="org.gnome.gnome-panel.icon-size">
+ <default>'16px'</default>
+ <_summary>Icon size for only Applications item in the Menu Bar applet</_summary>
+ </key>
</schema>
<schema id="org.gnome.gnome-panel.layout" path="/org/gnome/gnome-panel/layout/">
diff --git a/gnome-panel/main.c b/gnome-panel/main.c
index 74b4e8d..776f280 100644
--- a/gnome-panel/main.c
+++ b/gnome-panel/main.c
@@ -95,7 +95,6 @@ main (int argc, char **argv)
panel_action_protocol_init ();
panel_multiscreen_init ();
- panel_init_stock_icons_and_items ();
if (!panel_layout_load ()) {
panel_cleanup_do ();
diff --git a/gnome-panel/panel-menu-bar-object.c b/gnome-panel/panel-menu-bar-object.c
index 9e5f903..848e57c 100644
--- a/gnome-panel/panel-menu-bar-object.c
+++ b/gnome-panel/panel-menu-bar-object.c
@@ -57,6 +57,12 @@ static GtkIconSize panel_menu_bar_object_icon_size = 0;
GtkIconSize
panel_menu_bar_object_icon_get_size (void)
{
+ if (panel_menu_bar_object_icon_size == 0) {
+ GSettings *settings = g_settings_new ("org.gnome.gnome-panel.general");
+ panel_menu_bar_object_icon_size = (GtkIconSize) g_settings_get_enum (settings,
"panel-menu-bar");
+ g_object_unref (settings);
+ }
+
return panel_menu_bar_object_icon_size;
}
@@ -188,11 +194,6 @@ 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-stock-icons.c b/gnome-panel/panel-stock-icons.c
index d93b8b7..cbc46b9 100644
--- a/gnome-panel/panel-stock-icons.c
+++ b/gnome-panel/panel-stock-icons.c
@@ -34,13 +34,11 @@ static GtkIconSize panel_menu_icon_size = 0;
GtkIconSize
panel_menu_icon_get_size (void)
{
- return panel_menu_icon_size;
-}
+ if (panel_menu_icon_size == 0) {
+ GSettings *settings = g_settings_new ("org.gnome.gnome-panel.general");
+ panel_menu_icon_size = (GtkIconSize) g_settings_get_enum (settings, "panel-menu");
+ g_object_unref (settings);
+ }
-void
-panel_init_stock_icons_and_items (void)
-{
- panel_menu_icon_size = gtk_icon_size_register ("panel-menu",
- PANEL_DEFAULT_MENU_ICON_SIZE,
- PANEL_DEFAULT_MENU_ICON_SIZE);
+ return panel_menu_icon_size;
}
diff --git a/gnome-panel/panel-stock-icons.h b/gnome-panel/panel-stock-icons.h
index a1a0040..5bf1825 100644
--- a/gnome-panel/panel-stock-icons.h
+++ b/gnome-panel/panel-stock-icons.h
@@ -31,7 +31,6 @@ G_BEGIN_DECLS
/* themeable size - "panel-menu" -- This is used for the icons in the menus */
#define PANEL_DEFAULT_MENU_ICON_SIZE 24
-void panel_init_stock_icons_and_items (void);
GtkIconSize panel_menu_icon_get_size (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]