[gtk+/icon-shadow: 9/11] entry: use gtk_icon_info_load_symbolic_for_context()



commit 9015c668384b1c748c518152bf324870db36440d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue May 24 21:30:48 2011 -0400

    entry: use gtk_icon_info_load_symbolic_for_context()
    
    It's wrong not to recolor the image, the theme should be able to decide
    that, as it already is done in GtkImage and GtkCellRendererPixbuf
    
    This will also allow to render the image in the entry with a separate
    style class.

 gtk/gtkentry.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 90c13a6..04396b0 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -231,6 +231,8 @@ struct _EntryIconInfo
   gchar        *icon_name;
   GIcon        *gicon;
 
+  gboolean      symbolic;
+
   GtkTargetList *target_list;
   GdkDragAction actions;
 };
@@ -3397,7 +3399,7 @@ draw_icon (GtkWidget            *widget,
                    x, y,
                    width, height,
                    surface,
-                   FALSE);
+                   icon_info->symbolic);
 
   gtk_style_context_restore (context);
 
@@ -6776,10 +6778,17 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
                                              GTK_ICON_SIZE_MENU,
                                              &width, &height);
 
-          icon_info->pixbuf = gtk_icon_theme_load_icon (icon_theme,
-                                                        icon_info->icon_name,
-                                                        MIN (width, height),
-                                                        0, NULL);
+          info = gtk_icon_theme_lookup_icon (icon_theme,
+                                             icon_info->icon_name,
+                                             MIN (width, height), 
+                                             0);
+          if (info)
+            {
+              icon_info->pixbuf =
+                gtk_icon_info_load_symbolic_for_context (info, context,
+                                                         &icon_info->symbolic, NULL);
+              gtk_icon_info_free (info);
+            }
 
           if (icon_info->pixbuf == NULL)
             icon_info->pixbuf = create_normal_pixbuf (context,
@@ -6805,7 +6814,9 @@ gtk_entry_ensure_pixbuf (GtkEntry             *entry,
                                                  GTK_ICON_LOOKUP_USE_BUILTIN);
           if (info)
             {
-              icon_info->pixbuf = gtk_icon_info_load_icon (info, NULL);
+              icon_info->pixbuf =
+                gtk_icon_info_load_symbolic_for_context (info, context,
+                                                         &icon_info->symbolic, NULL);
               gtk_icon_info_free (info);
             }
 



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