summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-05-15 14:04:29 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-05-15 14:46:13 +0100
commit20c2703a77173cb749a3824b87c0252f7ef56364 (patch)
treecebd92f441492c0b3ee902890827f83b8cfc9840
parentceb38d1c205057e3129529163063338a960abe7c (diff)
Adapt to avoid use of deprecated GTK3 style & size APIs
The GtkStyle API has been deprecated in favour of GtkStyleContext. Update ovBox.c to use the latter if building with GtK3. Also replace use of the gtk_widget_size_request API with gtk_widget_get_preferred_size. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--src/view/ovBox.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 10cf142..a3b1130 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -337,14 +337,23 @@ ViewOvBoxGetOverGeometry(ViewOvBox *that, // IN
static void
ViewOvBoxSetBackground(ViewOvBox *that) // IN
{
- GtkWidget *widget;
+ GtkWidget *widget = GTK_WIDGET(that);
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GtkStyleContext *stylecontext;
+
+ stylecontext = gtk_widget_get_style_context(widget);
+ gtk_style_context_set_background(stylecontext, gtk_widget_get_window(widget));
+ gtk_style_context_set_background(stylecontext, that->priv->underWin);
+ gtk_style_context_set_background(stylecontext, that->priv->overWin);
+#else
GtkStyle *style;
- widget = GTK_WIDGET(that);
style = gtk_widget_get_style (widget);
gtk_style_set_background(style, gtk_widget_get_window(widget), GTK_STATE_NORMAL);
gtk_style_set_background(style, that->priv->underWin, GTK_STATE_NORMAL);
gtk_style_set_background(style, that->priv->overWin, GTK_STATE_NORMAL);
+#endif
}
@@ -394,7 +403,9 @@ ViewOvBoxRealize(GtkWidget *widget) // IN
&attributes, mask);
gtk_widget_set_window(widget, window);
gdk_window_set_user_data(window, that);
+#if !GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), window));
+#endif
/*
* The order in which we create the children X window matters: the child
@@ -497,8 +508,13 @@ ViewOvBoxSizeRequest(GtkWidget *widget, // IN
that = VIEW_OV_BOX(widget);
priv = that->priv;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_widget_get_preferred_size(priv->under, NULL, &underR);
+ gtk_widget_get_preferred_size(priv->over, NULL, &priv->overR);
+#else
gtk_widget_size_request(priv->under, &underR);
gtk_widget_size_request(priv->over, &priv->overR);
+#endif
gtk_container_child_get(GTK_CONTAINER(that), priv->over,
"expand", &expand,