summaryrefslogtreecommitdiff
path: root/src/msd-osd-window.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-05-31 18:37:01 +0200
committerraveit65 <[email protected]>2016-05-31 18:37:01 +0200
commit29170154ed4186adec4a6e0ccc5053bd537c01ff (patch)
tree7c32fa67ab2439c37413bc7517453e88fe4167ba /src/msd-osd-window.c
parenta8ad7d9e2ae5299dc75aba1fb022883aa8396340 (diff)
downloadmate-power-manager-29170154ed4186adec4a6e0ccc5053bd537c01ff.tar.bz2
mate-power-manager-29170154ed4186adec4a6e0ccc5053bd537c01ff.tar.xz
GTK+-3 msd-osd-window: port everything to GtkStyleContext
fixes #188
Diffstat (limited to 'src/msd-osd-window.c')
-rw-r--r--src/msd-osd-window.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/msd-osd-window.c b/src/msd-osd-window.c
index c3c2bee..5b7224a 100644
--- a/src/msd-osd-window.c
+++ b/src/msd-osd-window.c
@@ -500,6 +500,22 @@ msd_osd_window_real_realize (GtkWidget *widget)
}
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+msd_osd_window_style_updated (GtkWidget *widget)
+{
+ GtkStyleContext *style;
+
+ GTK_WIDGET_CLASS (msd_osd_window_parent_class)->style_updated (widget);
+
+ /* We set our border width to 12 (per the MATE standard), plus the
+ * thickness of the frame that we draw in our expose handler. This will
+ * make our child be 12 pixels away from the frame.
+ */
+
+ style = gtk_widget_get_style_context (widget);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
+}
+#else
msd_osd_window_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
@@ -515,6 +531,7 @@ msd_osd_window_style_set (GtkWidget *widget,
style = gtk_widget_get_style (widget);
gtk_container_set_border_width (GTK_CONTAINER (widget), 12 + MAX (style->xthickness, style->ythickness));
}
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
static void
@@ -522,16 +539,16 @@ msd_osd_window_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
gint *natural_width)
{
- GtkStyle *style;
+ GtkStyleContext *style;
GTK_WIDGET_CLASS (msd_osd_window_parent_class)->get_preferred_width (widget, minimum_width, natural_width);
- /* See the comment in msd_osd_window_style_set() for why we add the thickness here */
+ /* See the comment in msd_osd_window_style_updated() for why we add the thickness here */
- style = gtk_widget_get_style (widget);
+ style = gtk_widget_get_style_context (widget);
- *minimum_width += style->xthickness;
- *natural_width += style->xthickness;
+ *minimum_width += 12;
+ *natural_width += 12;
}
static void
@@ -539,16 +556,16 @@ msd_osd_window_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height)
{
- GtkStyle *style;
+ GtkStyleContext *style;
GTK_WIDGET_CLASS (msd_osd_window_parent_class)->get_preferred_height (widget, minimum_height, natural_height);
- /* See the comment in msd_osd_window_style_set() for why we add the thickness here */
+ /* See the comment in msd_osd_window_style_updated() for why we add the thickness here */
- style = gtk_widget_get_style (widget);
+ style = gtk_widget_get_style_context (widget);
- *minimum_height += style->ythickness;
- *natural_height += style->ythickness;
+ *minimum_height += 12;
+ *natural_height += 12;
}
#else
static void
@@ -605,12 +622,13 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass)
widget_class->show = msd_osd_window_real_show;
widget_class->hide = msd_osd_window_real_hide;
widget_class->realize = msd_osd_window_real_realize;
- widget_class->style_set = msd_osd_window_style_set;
#if GTK_CHECK_VERSION (3, 0, 0)
+ widget_class->style_updated = msd_osd_window_style_updated;
widget_class->get_preferred_width = msd_osd_window_get_preferred_width;
widget_class->get_preferred_height = msd_osd_window_get_preferred_height;
widget_class->draw = msd_osd_window_draw;
#else
+ widget_class->style_set = msd_osd_window_style_set;
widget_class->size_request = msd_osd_window_size_request;
widget_class->expose_event = msd_osd_window_expose_event;
#endif