[gedit] Allow passing a NULL emblem to set_emblem in the file browser
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Allow passing a NULL emblem to set_emblem in the file browser
- Date: Mon, 1 Jul 2013 15:40:33 +0000 (UTC)
commit a1c7addc098fa8539f1178405a4d7b13d9d9cce3
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Jul 1 06:05:07 2013 -0700
Allow passing a NULL emblem to set_emblem in the file browser
Otherwise an emblem cannot be unset, also force the emblem's
size to prevent it from being cut off.
plugins/filebrowser/gedit-file-browser-messages.c | 50 ++++++++++-----------
1 files changed, 24 insertions(+), 26 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-messages.c
b/plugins/filebrowser/gedit-file-browser-messages.c
index 4e3b5b0..36b78fd 100644
--- a/plugins/filebrowser/gedit-file-browser-messages.c
+++ b/plugins/filebrowser/gedit-file-browser-messages.c
@@ -228,7 +228,7 @@ message_set_emblem_cb (GeditMessageBus *bus,
g_object_get (message, "id", &id, "emblem", &emblem, NULL);
- if (!id || !emblem)
+ if (!id)
{
g_free (id);
g_free (emblem);
@@ -240,40 +240,38 @@ message_set_emblem_cb (GeditMessageBus *bus,
if (path != NULL)
{
- GError *error = NULL;
- GdkPixbuf *pixbuf;
-
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- emblem,
- 10,
- 0,
- &error);
+ GtkTreeIter iter;
+ GValue value = G_VALUE_INIT;
+ GdkPixbuf *pixbuf = NULL;
- if (pixbuf)
+ if (emblem != NULL)
{
- GValue value = { 0, };
- GtkTreeIter iter;
+ pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ emblem,
+ 10,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
+ }
- store = gedit_file_browser_widget_get_browser_store (data->widget);
+ store = gedit_file_browser_widget_get_browser_store (data->widget);
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
- {
- g_value_init (&value, GDK_TYPE_PIXBUF);
- g_value_set_object (&value, pixbuf);
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
+ {
+ g_value_init (&value, GDK_TYPE_PIXBUF);
+ g_value_set_object (&value, pixbuf);
- gedit_file_browser_store_set_value (store,
- &iter,
- GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM,
- &value);
+ gedit_file_browser_store_set_value (store,
+ &iter,
+ GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM,
+ &value);
- g_value_unset (&value);
- }
+ g_value_unset (&value);
+ }
+ if (pixbuf)
+ {
g_object_unref (pixbuf);
}
-
- if (error)
- g_error_free (error);
}
g_free (id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]