[gnome-panel] notification-area: use panel-icon-size property
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] notification-area: use panel-icon-size property
- Date: Mon, 26 Apr 2021 10:37:18 +0000 (UTC)
commit 9e2a5e7a3cd5115744ca133c5ee3366afde1d166
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Apr 26 10:17:18 2021 +0300
notification-area: use panel-icon-size property
data/theme/common.css | 1 -
modules/notification-area/na-applet.c | 42 +++++++++++++++++++++++++----------
2 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/data/theme/common.css b/data/theme/common.css
index 9434680db..9bd3599bb 100644
--- a/data/theme/common.css
+++ b/data/theme/common.css
@@ -59,7 +59,6 @@ panel-toplevel.vertical gp-menu-button .icon {
na-tray-applet {
-NaTrayApplet-icon-padding: 2;
- -NaTrayApplet-icon-size: 16;
}
gp-applet.separator > separator {
diff --git a/modules/notification-area/na-applet.c b/modules/notification-area/na-applet.c
index f866bbedd..3783f9895 100644
--- a/modules/notification-area/na-applet.c
+++ b/modules/notification-area/na-applet.c
@@ -35,6 +35,24 @@ struct _NaApplet
G_DEFINE_TYPE (NaApplet, na_applet, GP_TYPE_APPLET)
+static void
+update_icon_size (NaApplet *self)
+{
+ guint icon_size;
+
+ icon_size = gp_applet_get_panel_icon_size (GP_APPLET (self));
+
+ na_tray_set_icon_size (self->tray, icon_size);
+}
+
+static void
+panel_icon_size_cb (GpApplet *applet,
+ GParamSpec *pspec,
+ NaApplet *self)
+{
+ update_icon_size (self);
+}
+
static void
update_style (GtkWidget *widget)
{
@@ -45,7 +63,6 @@ update_style (GtkWidget *widget)
GdkRGBA warning;
GdkRGBA success;
gint padding;
- gint icon_size;
na = NA_APPLET (widget);
@@ -69,9 +86,6 @@ update_style (GtkWidget *widget)
gtk_widget_style_get (widget, "icon-padding", &padding, NULL);
na_tray_set_padding (na->tray, padding);
-
- gtk_widget_style_get (widget, "icon-size", &icon_size, NULL);
- na_tray_set_icon_size (na->tray, icon_size);
}
static void
@@ -84,8 +98,19 @@ na_applet_style_updated (GtkWidget *widget)
static void
na_applet_constructed (GObject *object)
{
+ NaApplet *self;
+
+ self = NA_APPLET (object);
+
G_OBJECT_CLASS (na_applet_parent_class)->constructed (object);
- gtk_widget_show (GTK_WIDGET (object));
+
+ g_signal_connect_object (self,
+ "notify::panel-icon-size",
+ G_CALLBACK (panel_icon_size_cb),
+ self,
+ 0);
+
+ update_icon_size (self);
}
static void
@@ -111,13 +136,6 @@ install_style_properties (GtkWidgetClass *widget_class)
0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
gtk_widget_class_install_style_property (widget_class, spec);
-
- spec = g_param_spec_int ("icon-size",
- "Icon size",
- "If non-zero, hardcodes the size of the icons in pixels",
- 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-
- gtk_widget_class_install_style_property (widget_class, spec);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]