|
25 | 25 | #include <string.h> |
26 | 26 |
|
27 | 27 | #include <mate-panel-applet.h> |
| 28 | +#include <mate-panel-applet-gsettings.h> |
28 | 29 |
|
29 | 30 | #include <glib/gi18n.h> |
30 | 31 | #include <gtk/gtk.h> |
| 32 | +#include <gio/gio.h> |
31 | 33 |
|
32 | 34 | #include "main.h" |
33 | 35 | #include "na-grid.h" |
|
40 | 42 |
|
41 | 43 | struct _NaTrayAppletPrivate |
42 | 44 | { |
43 | | - GtkWidget *grid; |
| 45 | + GtkWidget *grid; |
| 46 | + |
| 47 | + GSettings *settings; |
| 48 | + gint min_icon_size; |
44 | 49 |
|
45 | 50 | #ifdef PROVIDE_WATCHER_SERVICE |
46 | 51 | GfStatusNotifierWatcher *sn_watcher; |
@@ -104,6 +109,23 @@ get_gtk_orientation_from_applet_orient (MatePanelAppletOrient orient) |
104 | 109 | return GTK_ORIENTATION_HORIZONTAL; |
105 | 110 | } |
106 | 111 |
|
| 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 | + |
107 | 129 | static void help_cb(GtkAction* action, NaTrayApplet* applet) |
108 | 130 | { |
109 | 131 | GError* error = NULL; |
@@ -203,6 +225,11 @@ na_tray_applet_realize (GtkWidget *widget) |
203 | 225 | NA_RESOURCE_PATH "notification-area-menu.xml", |
204 | 226 | action_group); |
205 | 227 | 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); |
206 | 233 | } |
207 | 234 |
|
208 | 235 | static void |
|
0 commit comments