[gtk+/icon-shadow: 9/9] entry: use GTK_STYLE_CLASS_IMAGE when rendering the entry icon



commit 6f88c278830fd1a2407083c8a56ad6b7b47bf6a1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue May 24 21:33:14 2011 -0400

    entry: use GTK_STYLE_CLASS_IMAGE when rendering the entry icon

 gtk/gtkentry.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 039dcc9..13eb422 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3351,6 +3351,8 @@ draw_icon (GtkWidget            *widget,
   width = gdk_window_get_width (icon_info->window);
   height = gdk_window_get_height (icon_info->window);
 
+  context = gtk_widget_get_style_context (widget);
+
   /* size_allocate hasn't been called yet. These are the default values.
    */
   if (width == 1 || height == 1)
@@ -3388,7 +3390,6 @@ draw_icon (GtkWidget            *widget,
       else if (icon_info->prelight)
         state |= GTK_STATE_FLAG_PRELIGHT;
 
-      context = gtk_widget_get_style_context (widget);
       gtk_style_context_save (context);
       gtk_style_context_set_state (context, state);
       temp_pixbuf = gtk_render_icon_pixbuf (context, icon_source, (GtkIconSize)-1);
@@ -6722,7 +6723,7 @@ create_normal_pixbuf (GtkStyleContext *context,
   gtk_style_context_save (context);
 
   /* Unset any state */
-  gtk_style_context_set_state (context, 0);
+  gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
 
   icon_set = gtk_style_context_lookup_icon_set (context, stock_id);
   pixbuf = gtk_icon_set_render_icon_pixbuf (icon_set, context, icon_size);
@@ -6752,6 +6753,9 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
   widget = GTK_WIDGET (entry);
   context = gtk_widget_get_style_context (widget);
 
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
+
   switch (icon_info->storage_type)
     {
     case GTK_IMAGE_EMPTY:
@@ -6835,7 +6839,9 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
       g_assert_not_reached ();
       break;
     }
-    
+
+  gtk_style_context_restore (context);
+
   if (icon_info->pixbuf != NULL && icon_info->window != NULL)
     gdk_window_show_unraised (icon_info->window);
 }



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