summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-02-11 07:47:44 +0100
committerWolfgang Ulbrich <[email protected]>2016-02-12 07:04:31 +0100
commit4932ed52b70b540bd58e6405550ea2e758c1d003 (patch)
treed309d49c5c4392aa54ec9e75c11183b12af20d45
parent7637a037898508dc5bec48b93b1d89edb6609588 (diff)
downloadmate-panel-4932ed52b70b540bd58e6405550ea2e758c1d003.tar.bz2
mate-panel-4932ed52b70b540bd58e6405550ea2e758c1d003.tar.xz
GTK+3 notification-area: set minimum size for icon
Fix for following warning from GtkStatusIcon: gtk_widget_size_allocate(): attempt to allocate widget with width -3 and height 26. https://bugzilla.gnome.org/show_bug.cgi?id=755129 taken from: https://git.gnome.org/browse/gnome-panel/commit/?id=e2bd90e
-rw-r--r--applets/notification_area/na-tray-child.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/applets/notification_area/na-tray-child.c b/applets/notification_area/na-tray-child.c
index 9ff5c739..76a360f5 100644
--- a/applets/notification_area/na-tray-child.c
+++ b/applets/notification_area/na-tray-child.c
@@ -113,6 +113,39 @@ na_tray_child_style_set (GtkWidget *widget,
*/
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+na_tray_child_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GTK_WIDGET_CLASS (na_tray_child_parent_class)->get_preferred_width (widget,
+ minimal_width,
+ natural_width);
+
+ if (*minimal_width < 16)
+ *minimal_width = 16;
+
+ if (*natural_width < 16)
+ *natural_width = 16;
+}
+
+static void
+na_tray_child_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GTK_WIDGET_CLASS (na_tray_child_parent_class)->get_preferred_height (widget,
+ minimal_height,
+ natural_height);
+
+ if (*minimal_height < 16)
+ *minimal_height = 16;
+
+ if (*natural_height < 16)
+ *natural_height = 16;
+}
+#else
#if 0
/* This is adapted from code that was commented out in na-tray-manager.c; the
* code in na-tray-manager.c wouldn't have worked reliably, this will. So maybe
@@ -141,6 +174,7 @@ na_tray_child_size_request (GtkWidget *widget,
}
}
#endif
+#endif
static void
na_tray_child_size_allocate (GtkWidget *widget,
@@ -272,6 +306,10 @@ na_tray_child_class_init (NaTrayChildClass *klass)
gobject_class->finalize = na_tray_child_finalize;
widget_class->style_set = na_tray_child_style_set;
widget_class->realize = na_tray_child_realize;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ widget_class->get_preferred_width = na_tray_child_get_preferred_width;
+ widget_class->get_preferred_height = na_tray_child_get_preferred_height;
+#endif
widget_class->size_allocate = na_tray_child_size_allocate;
#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = na_tray_child_draw;