Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
braikar authored and lukefromdc committed Oct 20, 2018
1 parent c7d431d commit 10b9c30
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
10 changes: 9 additions & 1 deletion applets/notification_area/Makefile.am
Expand Up @@ -93,6 +93,9 @@ org.mate.panel.applet.NotificationAreaAppletFactory.service: $(service_in_files)
$< > $@
endif

notification_area_gschemas_in = org.mate.panel.applet.notification-area.gschema.xml.in
gsettings_SCHEMAS = $(notification_area_gschemas_in:.xml.in=.xml)

ui_FILES = \
notification-area-menu.xml

Expand All @@ -106,15 +109,20 @@ BUILT_SOURCES = \
na-resources.c \
na-resources.h

@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@

EXTRA_DIST = \
org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in \
$(notification_area_gschemas_in) \
$(ui_FILES) \
na.gresource.xml \
$(service_in_files)

CLEANFILES = \
$(applet_DATA) \
$(applet_DATA).in \
$(service_DATA)
$(service_DATA) \
$(gsettings_SCHEMAS)

-include $(top_srcdir)/git.mk
29 changes: 28 additions & 1 deletion applets/notification_area/main.c
Expand Up @@ -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"
Expand All @@ -40,7 +42,10 @@

struct _NaTrayAppletPrivate
{
GtkWidget *grid;
GtkWidget *grid;

GSettings *settings;
gint min_icon_size;

#ifdef PROVIDE_WATCHER_SERVICE
GfStatusNotifierWatcher *sn_watcher;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions applets/notification_area/main.h
Expand Up @@ -26,6 +26,9 @@

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

#define NA_TRAY_SCHEMA "org.mate.panel.applet.notification-area"
#define KEY_MIN_ICON_SIZE "min-icon-size"

G_BEGIN_DECLS

#define NA_TYPE_TRAY_APPLET (na_tray_applet_get_type ())
Expand Down
@@ -0,0 +1,9 @@
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
<schema id="org.mate.panel.applet.notification-area">
<key name="min-icon-size" type="i">
<default>24</default>
<summary>Minimum icon size</summary>
<description>The minimum size an icon can have.</description>
</key>
</schema>
</schemalist>
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -282,6 +282,7 @@ applets/clock/pixmaps/Makefile
applets/fish/Makefile
applets/fish/org.mate.panel.applet.fish.gschema.xml
applets/notification_area/Makefile
applets/notification_area/org.mate.panel.applet.notification-area.gschema.xml
applets/notification_area/libstatus-notifier-watcher/Makefile
applets/notification_area/status-notifier/Makefile
applets/notification_area/system-tray/Makefile
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Expand Up @@ -14,6 +14,7 @@ applets/fish/fish.c
[type: gettext/gsettings]applets/fish/org.mate.panel.applet.fish.gschema.xml.in
[type: gettext/ini]applets/fish/org.mate.panel.FishApplet.mate-panel-applet.in.in
applets/notification_area/main.c
[type: gettext/gsettings]applets/notification_area/org.mate.panel.applet.notification-area.gschema.xml.in
[type: gettext/ini]applets/notification_area/org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in
[type: gettext/gsettings]applets/wncklet/org.mate.panel.applet.window-list.gschema.xml.in
[type: gettext/gsettings]applets/wncklet/org.mate.panel.applet.workspace-switcher.gschema.xml.in
Expand Down

0 comments on commit 10b9c30

Please sign in to comment.