[nautilus/wip/antoniof/gtk4-preparation-miscellaneous: 3/6] general: Stop using the state argument of GtkStyleContext getters




commit d9ef795392dc1c701121df6c851a0ce7b12f57fb
Author: António Fernandes <antoniof gnome org>
Date:   Sun Feb 14 14:40:45 2021 +0000

    general: Stop using the state argument of GtkStyleContext getters
    
    As per https://developer.gnome.org/gtk4/unstable/gtk-migrating-3-to-4.html#id-1.7.4.3.12

 src/nautilus-container-max-width.c   | 4 ++--
 src/nautilus-floating-bar.c          | 2 +-
 src/nautilus-selection-canvas-item.c | 4 ++--
 src/nautilus-toolbar.c               | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-container-max-width.c b/src/nautilus-container-max-width.c
index ef6fb8792..589068c81 100644
--- a/src/nautilus-container-max-width.c
+++ b/src/nautilus-container-max-width.c
@@ -141,7 +141,7 @@ get_preferred_width (GtkWidget *widget,
 
     style_context = gtk_widget_get_style_context (widget);
     gtk_style_context_get_padding (style_context,
-                                   gtk_widget_get_state_flags (widget),
+                                   gtk_style_context_get_state (style_context),
                                    &padding);
     *minimum_size += padding.left + padding.right;
     *natural_size += padding.left + padding.right;
@@ -169,7 +169,7 @@ get_preferred_height (GtkWidget *widget,
 
     style_context = gtk_widget_get_style_context (widget);
     gtk_style_context_get_padding (style_context,
-                                   gtk_widget_get_state_flags (widget),
+                                   gtk_style_context_get_state (style_context),
                                    &padding);
     *minimum_size += padding.top + padding.bottom;
     *natural_size += padding.top + padding.bottom;
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index fdb76fb95..1cac4dc43 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -304,7 +304,7 @@ get_padding_and_border (GtkWidget *widget,
     GtkBorder tmp;
 
     context = gtk_widget_get_style_context (widget);
-    state = gtk_widget_get_state_flags (widget);
+    state = gtk_style_context_get_state (context);
 
     gtk_style_context_get_padding (context, state, border);
     gtk_style_context_get_border (context, state, &tmp);
diff --git a/src/nautilus-selection-canvas-item.c b/src/nautilus-selection-canvas-item.c
index b54cb68ed..571a4dc7a 100644
--- a/src/nautilus-selection-canvas-item.c
+++ b/src/nautilus-selection-canvas-item.c
@@ -347,7 +347,7 @@ nautilus_selection_canvas_item_update (EelCanvasItem *item,
 
     gtk_style_context_save (context);
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
-    gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
+    gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
     gtk_style_context_restore (context);
 
     cx1 -= border.left;
@@ -400,7 +400,7 @@ nautilus_selection_canvas_item_bounds (EelCanvasItem *item,
 
     gtk_style_context_save (context);
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
-    gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
+    gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
     gtk_style_context_restore (context);
 
     *x1 = self->priv->x1 - (border.left / item->canvas->pixels_per_unit) / 2.0;
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index dc5574a07..b52920853 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -687,7 +687,7 @@ on_operations_icon_draw (GtkWidget       *widget,
     GtkStyleContext *style_context;
 
     style_context = gtk_widget_get_style_context (widget);
-    gtk_style_context_get_color (style_context, gtk_widget_get_state_flags (widget), &foreground);
+    gtk_style_context_get_color (style_context, gtk_style_context_get_state (style_context), &foreground);
     background = foreground;
     background.alpha *= 0.3;
 


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