summaryrefslogtreecommitdiff
path: root/applets/notification_area/main.c
diff options
context:
space:
mode:
authorFabien Broquard <[email protected]>2018-10-02 20:29:38 +0200
committerlukefromdc <[email protected]>2018-10-20 13:35:24 -0400
commit10b9c30fc79de5f8d9516ba153df233c4968da65 (patch)
treeb88e4afea6a47a1f98e89c72e5928cee5ecffcf1 /applets/notification_area/main.c
parentc7d431d36f8bf6e9b94bab37c19dd51041e117c9 (diff)
downloadmate-panel-10b9c30fc79de5f8d9516ba153df233c4968da65.tar.bz2
mate-panel-10b9c30fc79de5f8d9516ba153df233c4968da65.tar.xz
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.
Diffstat (limited to 'applets/notification_area/main.c')
-rw-r--r--applets/notification_area/main.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index df07a3e2..9fc63e04 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -25,9 +25,11 @@
#include <string.h>
#include <mate-panel-applet.h>
+#include <mate-panel-applet-gsettings.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include "main.h"
#include "na-grid.h"
@@ -40,7 +42,10 @@
struct _NaTrayAppletPrivate
{
- GtkWidget *grid;
+ GtkWidget *grid;
+
+ GSettings *settings;
+ gint min_icon_size;
#ifdef PROVIDE_WATCHER_SERVICE
GfStatusNotifierWatcher *sn_watcher;
@@ -104,6 +109,23 @@ get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient)
return GTK_ORIENTATION_HORIZONTAL;
}
+static void
+gsettings_changed_min_icon_size (GSettings *settings,
+ gchar *key,
+ NaTrayApplet *applet)
+{
+ applet->priv->min_icon_size = g_settings_get_int (settings, key);
+
+ na_grid_set_min_icon_size (NA_GRID (applet->priv->grid), applet->priv->min_icon_size);
+}
+
+static void
+setup_gsettings (NaTrayApplet *applet)
+{
+ applet->priv->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (applet), NA_TRAY_SCHEMA);
+ g_signal_connect (applet->priv->settings, "changed::" KEY_MIN_ICON_SIZE, G_CALLBACK (gsettings_changed_min_icon_size), applet);
+}
+
static void help_cb(GtkAction* action, NaTrayApplet* applet)
{
GError* error = NULL;
@@ -203,6 +225,11 @@ na_tray_applet_realize (GtkWidget *widget)
NA_RESOURCE_PATH "notification-area-menu.xml",
action_group);
g_object_unref(action_group);
+
+ setup_gsettings (applet);
+
+ // load min icon size
+ gsettings_changed_min_icon_size (applet->priv->settings, KEY_MIN_ICON_SIZE, applet);
}
static void