[Xfce4-commits] [apps/ristretto] 01/01: Prepare for gtk3 migration: Use gtk_widget_get/set_style

noreply at xfce.org noreply at xfce.org
Mon Sep 12 12:54:42 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/ristretto.

commit 076542eadb5d00bd9ac25dea9ba1242419cd4dbb
Author: Igor <f2404 at yandex.ru>
Date:   Mon Sep 12 13:54:36 2016 +0300

    Prepare for gtk3 migration: Use gtk_widget_get/set_style
---
 src/icon_bar.c        | 18 ++++++++++--------
 src/image_viewer.c    | 10 ++++++----
 src/monitor_chooser.c | 20 +++++++++++---------
 3 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/src/icon_bar.c b/src/icon_bar.c
index 1fa1e7a..968236a 100644
--- a/src/icon_bar.c
+++ b/src/icon_bar.c
@@ -645,7 +645,7 @@ rstto_icon_bar_style_set (
     if (GTK_WIDGET_REALIZED (widget))
     {
         gdk_window_set_background (icon_bar->priv->bin_window,
-                &widget->style->base[widget->state]);
+                &(gtk_widget_get_style (widget)->base[widget->state]));
     }
 }
 
@@ -659,6 +659,7 @@ rstto_icon_bar_realize (GtkWidget *widget)
     gint          attributes_mask;
     GtkAllocation allocation;
     GdkWindow    *window;
+    GtkStyle     *style;
 
     GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
@@ -698,9 +699,10 @@ rstto_icon_bar_realize (GtkWidget *widget)
     icon_bar->priv->bin_window = gdk_window_new (window, &attributes, attributes_mask);
     gdk_window_set_user_data (icon_bar->priv->bin_window, widget);
 
-    widget->style = gtk_style_attach (widget->style, window);
-    gdk_window_set_background (window, &widget->style->base[widget->state]);
-    gdk_window_set_background (icon_bar->priv->bin_window, &widget->style->base[widget->state]);
+    style = gtk_style_attach (gtk_widget_get_style (widget), window);
+    gtk_widget_set_style (widget, style);
+    gdk_window_set_background (window, &(gtk_widget_get_style (widget)->base[widget->state]));
+    gdk_window_set_background (icon_bar->priv->bin_window, &(gtk_widget_get_style (widget)->base[widget->state]));
     gdk_window_show (icon_bar->priv->bin_window);
 }
 
@@ -1295,13 +1297,13 @@ rstto_icon_bar_paint_item (
 
         if (fill_color == NULL)
         {
-            fill_color = gdk_color_copy (&GTK_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+            fill_color = gdk_color_copy (&(gtk_widget_get_style (GTK_WIDGET (icon_bar))->base[GTK_STATE_SELECTED]));
             gdk_color_parse ("#c1d2ee", fill_color);
         }
 
         if (border_color == NULL)
         {
-            border_color = gdk_color_copy (&GTK_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+            border_color = gdk_color_copy (&(gtk_widget_get_style (GTK_WIDGET (icon_bar))->base[GTK_STATE_SELECTED]));
             gdk_color_parse ("#316ac5", border_color);
         }
 
@@ -1333,13 +1335,13 @@ rstto_icon_bar_paint_item (
 
         if (fill_color == NULL)
         {
-            fill_color = gdk_color_copy (&GTK_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+            fill_color = gdk_color_copy (&(gtk_widget_get_style (GTK_WIDGET (icon_bar))->base[GTK_STATE_SELECTED]));
             gdk_color_parse ("#e0e8f6", fill_color);
         }
 
         if (border_color == NULL)
         {
-            border_color = gdk_color_copy (&GTK_WIDGET (icon_bar)->style->base[GTK_STATE_SELECTED]);
+            border_color = gdk_color_copy (&(gtk_widget_get_style (GTK_WIDGET (icon_bar))->base[GTK_STATE_SELECTED]));
             gdk_color_parse ("#98b4e2", border_color);
         }
 
diff --git a/src/image_viewer.c b/src/image_viewer.c
index e116b10..82f8ead 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -493,6 +493,7 @@ rstto_image_viewer_realize(GtkWidget *widget)
     GtkAllocation allocation;
     GdkWindowAttr attributes;
     GdkWindow *window;
+    GtkStyle *style;
     gint attributes_mask;
 
     g_return_if_fail (widget != NULL);
@@ -521,10 +522,11 @@ rstto_image_viewer_realize(GtkWidget *widget)
     window = gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
     gtk_widget_set_window (widget, window);
 
-    widget->style = gtk_style_attach (widget->style, window);
+    style = gtk_style_attach (gtk_widget_get_style (widget), window);
+    gtk_widget_set_style (widget, style);
     gdk_window_set_user_data (window, widget);
 
-    gtk_style_set_background (widget->style, window, GTK_STATE_ACTIVE);
+    gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_ACTIVE);
 
     g_object_get_property (
             G_OBJECT(viewer->priv->settings),
@@ -556,7 +558,7 @@ rstto_image_viewer_realize(GtkWidget *widget)
     }
     else
     {
-        viewer->priv->bg_color = &(widget->style->bg[GTK_STATE_NORMAL]);
+        viewer->priv->bg_color = &(gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL]);
     }
 
     viewer->priv->bg_color_fs = g_value_get_boxed (&val_bg_color_fs);
@@ -2779,7 +2781,7 @@ cb_rstto_bgcolor_changed (GObject *settings, GParamSpec *pspec, gpointer user_da
     }
     else
     {
-        viewer->priv->bg_color = &(widget->style->bg[GTK_STATE_NORMAL]);
+        viewer->priv->bg_color = &(gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL]);
     }
     viewer->priv->bg_color_fs = g_value_get_boxed (&val_bg_color_fs);
 
diff --git a/src/monitor_chooser.c b/src/monitor_chooser.c
index 1b68680..43754cd 100644
--- a/src/monitor_chooser.c
+++ b/src/monitor_chooser.c
@@ -183,6 +183,7 @@ rstto_monitor_chooser_realize(GtkWidget *widget)
     gint attributes_mask;
     GtkAllocation allocation;
     GdkWindow *window;
+    GtkStyle *style;
 
     g_return_if_fail (widget != NULL);
     g_return_if_fail (RSTTO_IS_MONITOR_CHOOSER (widget));
@@ -202,13 +203,14 @@ rstto_monitor_chooser_realize(GtkWidget *widget)
     attributes.colormap = gtk_widget_get_colormap (widget);
 
     attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-    window = gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
+    window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
     gtk_widget_set_window (widget, window);
 
-    widget->style = gtk_style_attach (widget->style, window);
+    style = gtk_style_attach (gtk_widget_get_style (widget), window);
+    gtk_widget_set_style (widget, style);
     gdk_window_set_user_data (window, widget);
 
-    gtk_style_set_background (widget->style, window, GTK_STATE_ACTIVE);
+    gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_ACTIVE);
 }
 
 
@@ -257,7 +259,7 @@ rstto_monitor_chooser_paint(GtkWidget *widget)
 
     gdk_cairo_set_source_color (
             ctx,
-            &(widget->style->bg[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->bg[GTK_STATE_NORMAL]));
     cairo_rectangle (
             ctx,
             0.0,
@@ -478,13 +480,13 @@ paint_monitor ( GtkWidget *widget,
     /* Fill the background-color */
     gdk_cairo_set_source_color (
             cr,
-            &(widget->style->base[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->base[GTK_STATE_NORMAL]));
     cairo_fill_preserve (cr);
 
     /* Paint the outside border */
     gdk_cairo_set_source_color (
             cr,
-            &(widget->style->fg[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->fg[GTK_STATE_NORMAL]));
     cairo_set_line_width (cr, line_width);
     cairo_stroke (cr);
 
@@ -525,11 +527,11 @@ paint_monitor ( GtkWidget *widget,
     cairo_close_path (cr);
     gdk_cairo_set_source_color (
             cr,
-            &(widget->style->base[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->base[GTK_STATE_NORMAL]));
     cairo_fill_preserve (cr);
     gdk_cairo_set_source_color (
             cr,
-            &(widget->style->fg[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->fg[GTK_STATE_NORMAL]));
     cairo_set_line_width (cr, line_width);
     cairo_stroke (cr);
 
@@ -542,7 +544,7 @@ paint_monitor ( GtkWidget *widget,
     cairo_close_path (cr);
     gdk_cairo_set_source_color (
             cr,
-            &(widget->style->fg[GTK_STATE_NORMAL]));
+            &(gtk_widget_get_style (widget)->fg[GTK_STATE_NORMAL]));
     cairo_set_line_width (cr, line_width);
     cairo_stroke (cr);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list