Skip to content

Commit 10b9c30

Browse files
braikarlukefromdc
authored andcommitted
na-tray: wide panels, add GSettings to the applet
The new GSettings allow to change and remember the minimum icon size for the grid. The default icon size is set at 24px.
1 parent c7d431d commit 10b9c30

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

applets/notification_area/Makefile.am

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ org.mate.panel.applet.NotificationAreaAppletFactory.service: $(service_in_files)
9393
$< > $@
9494
endif
9595

96+
notification_area_gschemas_in = org.mate.panel.applet.notification-area.gschema.xml.in
97+
gsettings_SCHEMAS = $(notification_area_gschemas_in:.xml.in=.xml)
98+
9699
ui_FILES = \
97100
notification-area-menu.xml
98101

@@ -106,15 +109,20 @@ BUILT_SOURCES = \
106109
na-resources.c \
107110
na-resources.h
108111

112+
@INTLTOOL_XML_NOMERGE_RULE@
113+
@GSETTINGS_RULES@
114+
109115
EXTRA_DIST = \
110116
org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in \
117+
$(notification_area_gschemas_in) \
111118
$(ui_FILES) \
112119
na.gresource.xml \
113120
$(service_in_files)
114121

115122
CLEANFILES = \
116123
$(applet_DATA) \
117124
$(applet_DATA).in \
118-
$(service_DATA)
125+
$(service_DATA) \
126+
$(gsettings_SCHEMAS)
119127

120128
-include $(top_srcdir)/git.mk

applets/notification_area/main.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
#include <string.h>
2626

2727
#include <mate-panel-applet.h>
28+
#include <mate-panel-applet-gsettings.h>
2829

2930
#include <glib/gi18n.h>
3031
#include <gtk/gtk.h>
32+
#include <gio/gio.h>
3133

3234
#include "main.h"
3335
#include "na-grid.h"
@@ -40,7 +42,10 @@
4042

4143
struct _NaTrayAppletPrivate
4244
{
43-
GtkWidget *grid;
45+
GtkWidget *grid;
46+
47+
GSettings *settings;
48+
gint min_icon_size;
4449

4550
#ifdef PROVIDE_WATCHER_SERVICE
4651
GfStatusNotifierWatcher *sn_watcher;
@@ -104,6 +109,23 @@ get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient)
104109
return GTK_ORIENTATION_HORIZONTAL;
105110
}
106111

112+
static void
113+
gsettings_changed_min_icon_size (GSettings *settings,
114+
gchar *key,
115+
NaTrayApplet *applet)
116+
{
117+
applet->priv->min_icon_size = g_settings_get_int (settings, key);
118+
119+
na_grid_set_min_icon_size (NA_GRID (applet->priv->grid), applet->priv->min_icon_size);
120+
}
121+
122+
static void
123+
setup_gsettings (NaTrayApplet *applet)
124+
{
125+
applet->priv->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (applet), NA_TRAY_SCHEMA);
126+
g_signal_connect (applet->priv->settings, "changed::" KEY_MIN_ICON_SIZE, G_CALLBACK (gsettings_changed_min_icon_size), applet);
127+
}
128+
107129
static void help_cb(GtkAction* action, NaTrayApplet* applet)
108130
{
109131
GError* error = NULL;
@@ -203,6 +225,11 @@ na_tray_applet_realize (GtkWidget *widget)
203225
NA_RESOURCE_PATH "notification-area-menu.xml",
204226
action_group);
205227
g_object_unref(action_group);
228+
229+
setup_gsettings (applet);
230+
231+
// load min icon size
232+
gsettings_changed_min_icon_size (applet->priv->settings, KEY_MIN_ICON_SIZE, applet);
206233
}
207234

208235
static void

applets/notification_area/main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#define NA_RESOURCE_PATH "/org/mate/panel/applet/na/"
2828

29+
#define NA_TRAY_SCHEMA "org.mate.panel.applet.notification-area"
30+
#define KEY_MIN_ICON_SIZE "min-icon-size"
31+
2932
G_BEGIN_DECLS
3033

3134
#define NA_TYPE_TRAY_APPLET (na_tray_applet_get_type ())
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
2+
<schema id="org.mate.panel.applet.notification-area">
3+
<key name="min-icon-size" type="i">
4+
<default>24</default>
5+
<summary>Minimum icon size</summary>
6+
<description>The minimum size an icon can have.</description>
7+
</key>
8+
</schema>
9+
</schemalist>

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ applets/clock/pixmaps/Makefile
282282
applets/fish/Makefile
283283
applets/fish/org.mate.panel.applet.fish.gschema.xml
284284
applets/notification_area/Makefile
285+
applets/notification_area/org.mate.panel.applet.notification-area.gschema.xml
285286
applets/notification_area/libstatus-notifier-watcher/Makefile
286287
applets/notification_area/status-notifier/Makefile
287288
applets/notification_area/system-tray/Makefile

po/POTFILES.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ applets/fish/fish.c
1414
[type: gettext/gsettings]applets/fish/org.mate.panel.applet.fish.gschema.xml.in
1515
[type: gettext/ini]applets/fish/org.mate.panel.FishApplet.mate-panel-applet.in.in
1616
applets/notification_area/main.c
17+
[type: gettext/gsettings]applets/notification_area/org.mate.panel.applet.notification-area.gschema.xml.in
1718
[type: gettext/ini]applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in
1819
[type: gettext/gsettings]applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in
1920
[type: gettext/gsettings]applets/wncklet/org.mate.panel.applet.workspace-switcher.gschema.xml.in

0 commit comments

Comments
 (0)