[epiphany] Be more careful with gtk_style_context_get_*



commit c6844fe27a771deb4f5deeec97f5bc588c4123f8
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Dec 19 16:31:31 2015 -0600

    Be more careful with gtk_style_context_get_*

 lib/widgets/ephy-location-entry.c |    8 ++++++--
 src/ephy-completion-model.c       |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index afb61cb..bf52697 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -690,8 +690,6 @@ favicon_create_drag_surface (EphyLocationEntry *entry,
        GdkRGBA color;
        GdkPixbuf *favicon;
 
-       state = gtk_widget_get_state_flags (widget);
-
        g_signal_emit (entry, signals[GET_LOCATION], 0, &address);
        sanitize_location (&address);
        g_signal_emit (entry, signals[GET_TITLE], 0, &title);
@@ -729,8 +727,14 @@ favicon_create_drag_surface (EphyLocationEntry *entry,
        layout = pango_layout_new (context);
 
        style = gtk_widget_get_style_context (GTK_WIDGET (entry));
+       state = gtk_style_context_get_state (style);
+
+       gtk_style_context_save (style);
+       gtk_style_context_set_state (style, GTK_STATE_FLAG_NORMAL);
        gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
                               "font", &font_desc, NULL);
+       gtk_style_context_restore (style);
+
        metrics = pango_context_get_metrics (context,
                                             font_desc,
                                             pango_context_get_language (context));
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 4ea53da..1deeaba 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -326,6 +326,7 @@ get_text_column_subtitle_color (void)
   gtk_widget_path_free (path);
 
   gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_ENTRY);
+  gtk_style_context_set_state (style_context, GTK_STATE_FLAG_INSENSITIVE);
   gtk_style_context_get_color (style_context, GTK_STATE_FLAG_INSENSITIVE, &rgba);
   g_object_unref (style_context);
 


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