[gtksourceview] completion: ensure pixbuf if no image was provided



commit 165e696041eb829a895cb20fc7843273bb1c0c01
Author: Christian Hergert <christian hergert me>
Date:   Thu Sep 24 03:43:28 2015 -0700

    completion: ensure pixbuf if no image was provided
    
    It is common to have a mixture of GtkSourceCompletionProposal where some
    have pixbuf/gicon/icon-name and some do not. This was causing the rows
    without provided icons to inherit that of the previously rendered row.
    
    This simply unsets the image if we did not find one to set.

 gtksourceview/gtksourcecompletion.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 76c7b50..ae082b6 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1959,6 +1959,7 @@ cell_icon_func (GtkTreeViewColumn *column,
        GdkPixbuf *pixbuf;
        gchar *icon_name;
        GIcon *gicon;
+       gboolean set = FALSE;
 
        gtk_tree_model_get (model, iter,
                            GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON, &pixbuf,
@@ -1970,18 +1971,26 @@ cell_icon_func (GtkTreeViewColumn *column,
        {
                g_object_set (cell, "pixbuf", pixbuf, NULL);
                g_object_unref (pixbuf);
+               set = TRUE;
        }
 
        if (icon_name != NULL)
        {
                g_object_set (cell, "icon-name", icon_name, NULL);
                g_free (icon_name);
+               set = TRUE;
        }
 
        if (gicon != NULL)
        {
                g_object_set (cell, "gicon", gicon, NULL);
                g_object_unref (gicon);
+               set = TRUE;
+       }
+
+       if (!set)
+       {
+               g_object_set (cell, "icon-name", NULL, NULL);
        }
 }
 


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