summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <christian@hergert.me>2015-09-24 03:43:28 -0700
committerChristian Hergert <christian@hergert.me>2015-09-24 03:43:28 -0700
commit165e696041eb829a895cb20fc7843273bb1c0c01 (patch)
tree390bbfbf64975f1e459576766e36fd0a44c70249
parentcb8e131b984de23aa124cc81c422498a6eb7abde (diff)
downloadgtksourceview-165e696041eb829a895cb20fc7843273bb1c0c01.tar.gz
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.
-rw-r--r--gtksourceview/gtksourcecompletion.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 76c7b502..ae082b66 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);
}
}