summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-05-23 13:22:56 +0200
committerraveit65 <[email protected]>2022-07-21 17:34:12 +0200
commitdd46d0d5f34187f1893cea668dce25f91f388179 (patch)
tree04726fb19a80c1f91d7fc1920052d613349f7ff4
parentda69719f5ce6375c4762ac3d338b3d3a94562019 (diff)
downloadcaja-dd46d0d5f34187f1893cea668dce25f91f388179.tar.bz2
caja-dd46d0d5f34187f1893cea668dce25f91f388179.tar.xz
caja-window-slot: fix window icon replacement/alternation
-rw-r--r--src/caja-window-slot.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c
index 34d8af12..86431203 100644
--- a/src/caja-window-slot.c
+++ b/src/caja-window-slot.c
@@ -384,34 +384,40 @@ caja_window_slot_update_icon (CajaWindowSlot *slot)
icon_name = NULL;
if (info)
{
+ GtkWindow *gtk_window = GTK_WINDOW (window);
+
icon_name = caja_icon_info_get_used_name (info);
if (icon_name != NULL)
{
+ /* frees the icon if it was previously set by using a pixbuf */
+ if (gtk_window_get_icon (gtk_window))
+ gtk_window_set_icon_list (gtk_window, NULL);
+
/* Gtk+ doesn't short circuit this (yet), so avoid lots of work
* if we're setting to the same icon. This happens a lot e.g. when
* the trash directory changes due to the file count changing.
*/
- if (g_strcmp0 (icon_name, gtk_window_get_icon_name (GTK_WINDOW (window))) != 0)
+ const gchar *current_icon_name;
+
+ current_icon_name = gtk_window_get_icon_name (gtk_window);
+ if ((current_icon_name == NULL) || (strcmp (icon_name, current_icon_name) != 0))
{
- if (g_strcmp0 (icon_name, "text-x-generic") == 0)
- gtk_window_set_icon_name (GTK_WINDOW (window), "folder-saved-search");
+ if (strcmp (icon_name, "text-x-generic") == 0)
+ gtk_window_set_icon_name (gtk_window, "folder-saved-search");
else
- gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
+ gtk_window_set_icon_name (gtk_window, icon_name);
}
}
else
{
- GdkPixbuf *pixbuf;
-
- pixbuf = caja_icon_info_get_pixbuf_nodefault (info);
+ GdkPixbuf *pixbuf = caja_icon_info_get_pixbuf_nodefault (info);
if (pixbuf)
{
- gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+ gtk_window_set_icon (gtk_window, pixbuf);
g_object_unref (pixbuf);
}
}
-
g_object_unref (info);
}
}