[libgd/wip/ernestask/gtk4: 4/8] Drop state arguments from GtkStyleContext getters



commit d8c3467bc8c73c2f49df0ac392a0a7930eba2676
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sun Mar 4 15:36:49 2018 +0200

    Drop state arguments from GtkStyleContext getters

 libgd/gd-icon-utils.c         |    2 +-
 libgd/gd-main-icon-view.c     |    9 ++-------
 libgd/gd-notification.c       |    6 ++----
 libgd/gd-tagged-entry.c       |   28 +++++++---------------------
 libgd/gd-two-lines-renderer.c |    7 ++++---
 5 files changed, 16 insertions(+), 36 deletions(-)
---
diff --git a/libgd/gd-icon-utils.c b/libgd/gd-icon-utils.c
index 6c9dd40..4c7b5ec 100644
--- a/libgd/gd-icon-utils.c
+++ b/libgd/gd-icon-utils.c
@@ -141,7 +141,7 @@ gd_create_surface_with_counter (GtkWidget *widget, cairo_surface_t *base, gint n
   pango_layout_set_font_description (layout, desc);
   pango_font_description_free (desc);
 
-  gtk_style_context_get_color (context, 0, &color);
+  gtk_style_context_get_color (context, &color);
   gdk_cairo_set_source_rgba (emblem_cr, &color);
 
   /* update these values */
diff --git a/libgd/gd-main-icon-view.c b/libgd/gd-main-icon-view.c
index 1f048dc..7602edc 100644
--- a/libgd/gd-main-icon-view.c
+++ b/libgd/gd-main-icon-view.c
@@ -284,7 +284,6 @@ gd_main_icon_view_draw (GtkWidget *widget,
 
       if (lines->len > 0)
        {
-         GtkStateFlags state;
          cairo_path_t *path;
          GtkBorder border;
          GdkRGBA border_color;
@@ -306,12 +305,8 @@ gd_main_icon_view_draw (GtkWidget *widget,
          cairo_append_path (cr, path);
          cairo_path_destroy (path);
 
-         state = gtk_widget_get_state_flags (widget);
-         gtk_style_context_get_border_color (context,
-                                             state,
-                                             &border_color);
-         gtk_style_context_get_border (context, state,
-                                       &border);
+         gtk_style_context_get_border_color (context, &border_color);
+         gtk_style_context_get_border (context, &border);
 
          cairo_set_line_width (cr, border.left);
          gdk_cairo_set_source_rgba (cr, &border_color);
diff --git a/libgd/gd-notification.c b/libgd/gd-notification.c
index 8153436..e7d058b 100644
--- a/libgd/gd-notification.c
+++ b/libgd/gd-notification.c
@@ -545,15 +545,13 @@ get_padding_and_border (GdNotification *notification,
                         GtkBorder *border)
 {
   GtkStyleContext *context;
-  GtkStateFlags state;
   GtkBorder tmp;
 
   context = gtk_widget_get_style_context (GTK_WIDGET (notification));
-  state = gtk_widget_get_state_flags (GTK_WIDGET (notification));
 
-  gtk_style_context_get_padding (context, state, border);
+  gtk_style_context_get_padding (context, border);
 
-  gtk_style_context_get_border (context, state, &tmp);
+  gtk_style_context_get_border (context, &tmp);
   border->top += tmp.top;
   border->right += tmp.right;
   border->bottom += tmp.bottom;
diff --git a/libgd/gd-tagged-entry.c b/libgd/gd-tagged-entry.c
index 380962c..de145c7 100644
--- a/libgd/gd-tagged-entry.c
+++ b/libgd/gd-tagged-entry.c
@@ -95,9 +95,7 @@ gd_tagged_entry_tag_get_margin (GdTaggedEntryTag *tag,
 
   context = gd_tagged_entry_tag_get_context (tag, entry);
   gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
-  gtk_style_context_get_margin (context,
-                                gtk_style_context_get_state (context),
-                                margin);
+  gtk_style_context_get_margin (context, margin);
   gtk_style_context_restore (context);
 }
 
@@ -274,15 +272,9 @@ gd_tagged_entry_tag_get_width (GdTaggedEntryTag *tag,
   state = gd_tagged_entry_tag_get_state (tag, entry);
 
   gtk_style_context_set_state (context, state);
-  gtk_style_context_get_padding (context,
-                                 gtk_style_context_get_state (context),
-                                 &button_padding);
-  gtk_style_context_get_border (context,
-                                gtk_style_context_get_state (context),
-                                &button_border);
-  gtk_style_context_get_margin (context,
-                                gtk_style_context_get_state (context),
-                                &button_margin);
+  gtk_style_context_get_padding (context, &button_padding);
+  gtk_style_context_get_border (context, &button_border);
+  gtk_style_context_get_margin (context, &button_margin);
 
   gd_tagged_entry_tag_ensure_close_surface (tag, context);
 
@@ -341,9 +333,7 @@ gd_tagged_entry_tag_get_relative_allocations (GdTaggedEntryTag *tag,
   state = gd_tagged_entry_tag_get_state (tag, entry);
   gtk_style_context_save (context);
   gtk_style_context_set_state (context, state);
-  gtk_style_context_get_margin (context,
-                                gtk_style_context_get_state (context),
-                                &padding);
+  gtk_style_context_get_margin (context, &padding);
   gtk_style_context_restore (context);
 
   width -= padding.left + padding.right;
@@ -360,12 +350,8 @@ gd_tagged_entry_tag_get_relative_allocations (GdTaggedEntryTag *tag,
 
   gtk_style_context_save (context);
   gtk_style_context_set_state (context, state);
-  gtk_style_context_get_padding (context,
-                                 gtk_style_context_get_state (context),
-                                 &padding);
-  gtk_style_context_get_border (context,
-                                gtk_style_context_get_state (context),
-                                &border);
+  gtk_style_context_get_padding (context, &padding);
+  gtk_style_context_get_border (context, &border);
   gtk_style_context_restore (context);
 
   gd_tagged_entry_tag_ensure_layout (tag, entry);
diff --git a/libgd/gd-two-lines-renderer.c b/libgd/gd-two-lines-renderer.c
index a2c3fdc..88a6bc6 100644
--- a/libgd/gd-two-lines-renderer.c
+++ b/libgd/gd-two-lines-renderer.c
@@ -92,7 +92,7 @@ apply_subtitle_style_to_layout (GtkStyleContext *context,
 
   gtk_style_context_save (context);
   gtk_style_context_set_state (context, flags);
-  gtk_style_context_get (context, gtk_style_context_get_state (context),
+  gtk_style_context_get (context,
                          "font", &desc,
                          NULL);
   gtk_style_context_restore (context);
@@ -375,8 +375,9 @@ gd_two_lines_renderer_get_preferred_width (GtkCellRenderer *cell,
   context = gtk_widget_get_pango_context (widget);
   gtk_style_context_save (style_context);
   gtk_style_context_set_state (style_context, 0);
-  gtk_style_context_get (style_context, gtk_style_context_get_state (style_context),
-                         "font", &font_desc, NULL);
+  gtk_style_context_get (style_context,
+                         "font", &font_desc,
+                         NULL);
   gtk_style_context_restore (style_context);
   metrics = pango_context_get_metrics (context, font_desc,
                                        pango_context_get_language (context));


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