[Xfce4-commits] <thunar:master> Move away from using a hard-coded size for window icons (bug #8626).

Jannis Pohlmann noreply at xfce.org
Sun Apr 15 23:48:02 CEST 2012


Updating branch refs/heads/master
         to 16ab778bb7fd307f7ac35715a33283494373bce6 (commit)
       from 096f3b6eb37205b6cabb0da4ecc8886b24a67a28 (commit)

commit 16ab778bb7fd307f7ac35715a33283494373bce6
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Apr 15 22:42:21 2012 +0100

    Move away from using a hard-coded size for window icons (bug #8626).
    
    The previous commit wasn't actually related to this bug. The problem
    here was that the xfwm4 tab window now allows themes to change the size
    of the displayed window icons but Thunar still hard-coded its own window
    icons to 48px.
    
    From this commit Thunar on uses thunar_file_get_icon_name(current_dir)
    to get an icon name for the current directory and and then calls
    gtk_window_set_icon_name() rather than asking ThunarIconFactory for a
    48px GdkPixbuf that cannot be scaled up nicely. This is ok because we
    only ever set icons for directories and for those ThunarIconFactory
    never returns anything but a GdkPixbuf based on an icon name anyway. It
    never returns a GdkPixbuf loaded from an absolute path or anything.

 NEWS                   |    3 ++-
 thunar/thunar-window.c |   19 ++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index 672ae4b..8702c5c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 1.3.x
 =====
-- Add a 64x64 and 128x128 icon for Thunar (bug #8626).
+- Add a 64x64 and 128x128 icon for Thunar.
+- Move away from the hard-coded size of window icons (bug #8626).
 
 1.3.2
 =====
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 8d930a9..7e19e57 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -2399,9 +2399,10 @@ static void
 thunar_window_current_directory_changed (ThunarFile   *current_directory,
                                          ThunarWindow *window)
 {
-  GtkAction *action;
-  GdkPixbuf *icon;
-  gchar     *title;
+  GtkIconTheme *icon_theme;
+  GtkAction    *action;
+  gchar        *icon_name;
+  gchar        *title;
 
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
   _thunar_return_if_fail (THUNAR_IS_FILE (current_directory));
@@ -2418,12 +2419,12 @@ thunar_window_current_directory_changed (ThunarFile   *current_directory,
   g_free (title);
 
   /* set window icon */
-  icon = thunar_icon_factory_load_file_icon (window->icon_factory, current_directory, THUNAR_FILE_ICON_STATE_DEFAULT, 48);
-  if (G_LIKELY (icon != NULL))
-    {
-      gtk_window_set_icon (GTK_WINDOW (window), icon);
-      g_object_unref (G_OBJECT (icon));
-    }
+  icon_theme = gtk_icon_theme_get_default ();
+  icon_name = thunar_file_get_icon_name (current_directory,
+                                         THUNAR_FILE_ICON_STATE_DEFAULT,
+                                         icon_theme);
+  gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
+  g_free (icon_name);
 }
 
 


More information about the Xfce4-commits mailing list