[PATCH virt-viewer] Remove use of deprecated GTK style & size APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The GtkStyle API has been deprecated in favour of GtkStyleContext.
Update ovBox.c to use the latter. Also replace use of the
gtk_widget_size_request API with gtk_widget_get_preferred_size.
---
 src/view/ovBox.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/view/ovBox.c b/src/view/ovBox.c
index 10cf142..aae35dd 100644
--- a/src/view/ovBox.c
+++ b/src/view/ovBox.c
@@ -338,13 +338,13 @@ static void
 ViewOvBoxSetBackground(ViewOvBox *that) // IN
 {
    GtkWidget *widget;
-   GtkStyle *style;
+   GtkStyleContext *stylecontext;
 
    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);
+   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);
 }
 
 
@@ -394,7 +394,6 @@ ViewOvBoxRealize(GtkWidget *widget) // IN
                            &attributes, mask);
    gtk_widget_set_window(widget, window);
    gdk_window_set_user_data(window, that);
-   gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), window));
 
    /*
     * The order in which we create the children X window matters: the child
@@ -497,8 +496,8 @@ ViewOvBoxSizeRequest(GtkWidget *widget,           // IN
    that = VIEW_OV_BOX(widget);
    priv = that->priv;
 
-   gtk_widget_size_request(priv->under, &underR);
-   gtk_widget_size_request(priv->over, &priv->overR);
+   gtk_widget_get_preferred_size(priv->under, NULL, &underR);
+   gtk_widget_get_preferred_size(priv->over, NULL, &priv->overR);
 
    gtk_container_child_get(GTK_CONTAINER(that), priv->over,
                            "expand", &expand,
-- 
1.7.10.1


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux