[patch] nautilus window border icon



Hi,

This patch displays the real file icons instead of the "shell" icon.

Jan Arne Petersen
Index: nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.311
diff -u -r1.311 nautilus-window-manage-views.c
--- nautilus-window-manage-views.c	2 Oct 2002 05:36:52 -0000	1.311
+++ nautilus-window-manage-views.c	2 Nov 2002 15:39:11 -0000
@@ -196,7 +196,7 @@
         return title;
 }
 
-/* update_title:
+/* nautilus_window_update_title_and_icon:
  * 
  * Update the non-NautilusViewFrame objects that use the location's user-displayable
  * title in some way. Called when the location or title has changed.
@@ -204,16 +204,24 @@
  * @title: The new user-displayable title.
  * 
  */
-static void
-update_title (NautilusWindow *window)
+void
+nautilus_window_update_title_and_icon (NautilusWindow *window)
 {
         char *title;
         char *window_title;
         GList *sidebar_panels;
         GList *node;
+	GdkPixbuf *pixbuf;
 
-        title = compute_title (window);
+        /* Update window border icon */
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
+							    "accept",
+							    NAUTILUS_ICON_SIZE_STANDARD);
+	gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+	g_object_unref (pixbuf);
 
+	title = compute_title (window);
+	
         /* Remember the title and check if it's the same as last time. */
         if (window->details->title != NULL
             && strcmp (title, window->details->title) == 0) {
@@ -289,7 +297,7 @@
                         : nautilus_bookmark_new (location, location);
         }
 
-        update_title (window);
+        nautilus_window_update_title_and_icon (window);
 }
 
 static void
@@ -500,7 +508,7 @@
                         g_free (new_location);
                 }
 
-                update_title (window);
+		nautilus_window_update_title_and_icon (window);
         }
 }
 
@@ -651,7 +659,7 @@
 
         free_location_change (window);
 
-        update_title (window);
+        nautilus_window_update_title_and_icon (window);
 
         /* The whole window has been finished. Now show it, unless
          * we're still waiting for the saved positions from the
@@ -1963,7 +1971,7 @@
 {
         g_assert (NAUTILUS_IS_WINDOW (window));
 
-        update_title (window);
+        nautilus_window_update_title_and_icon (window);
 }
 
 static void
Index: nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.398
diff -u -r1.398 nautilus-window.c
--- nautilus-window.c	31 Oct 2002 19:24:32 -0000	1.398
+++ nautilus-window.c	2 Nov 2002 15:39:14 -0000
@@ -197,6 +204,13 @@
 		 nautilus_window_get_ui_container (window),
 		 NULL);
 
+	/* Register IconFactory callback to update the window border icon
+	 * when the icon-theme is changed.
+	 */
+	g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed",
+				 G_CALLBACK (nautilus_window_update_title_and_icon),
+				 window, G_CONNECT_SWAPPED);
+
 	/* Create a separate component so when we remove the status
 	 * we don't loose the status bar
 	 */
Index: nautilus-window-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-private.h,v
retrieving revision 1.92
diff -u -r1.92 nautilus-window-private.h
--- nautilus-window-private.h	22 Sep 2002 17:18:44 -0000	1.92
+++ nautilus-window-private.h	2 Nov 2002 15:39:15 -0000
@@ -173,5 +172,5 @@
 void               nautilus_remove_from_history_list_no_notify           (const char        *location);
 GList *            nautilus_get_history_list                             (void);
 void               nautilus_window_bookmarks_preference_changed_callback (gpointer           user_data);
-
+void               nautilus_window_update_title_and_icon                 (NautilusWindow    *window);
 #endif /* NAUTILUS_WINDOW_PRIVATE_H */
Index: file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.160
diff -u -r1.160 fm-properties-window.c
--- file-manager/fm-properties-window.c	25 Oct 2002 17:38:35 -0000	1.160
+++ file-manager/fm-properties-window.c	2 Nov 2002 15:39:20 -0000
@@ -614,6 +614,7 @@
 update_properties_window_title (GtkWindow *window, NautilusFile *file)
 {
 	char *name, *title;
+	GdkPixbuf *pixbuf;
 
 	g_assert (NAUTILUS_IS_FILE (file));
 	g_assert (GTK_IS_WINDOW (window));
@@ -622,6 +623,13 @@
 	title = g_strdup_printf (_("%s Properties"), name);
   	gtk_window_set_title (window, title);
 
+        /* Update window border icon */
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_file (file,
+							    "accept",
+							    NAUTILUS_ICON_SIZE_STANDARD);
+	gtk_window_set_icon (window, pixbuf);
+	g_object_unref (pixbuf);
+
 	g_free (name);	
 	g_free (title);
 }
@@ -2353,6 +2361,14 @@
 	}
 }
 
+static void
+properties_window_icon_theme_changed (FMPropertiesWindow *window)
+{
+	/* g_assert (FM_IS_PROPERTIES_WINDOW (window)); */
+
+	update_properties_window_title (GTK_WINDOW (window), window->details->target_file);
+}
+
 static FMPropertiesWindow *
 create_properties_window (StartupData *startup_data)
 {
@@ -2373,6 +2389,13 @@
 
 	/* Set initial window title */
 	update_properties_window_title (GTK_WINDOW (window), window->details->target_file);
+
+	/* Register IconFactory callback to update the window border icon
+	 * when the icon-theme is changed.
+	 */
+	g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed",
+				 G_CALLBACK (properties_window_icon_theme_changed),
+				 window, G_CONNECT_SWAPPED);
 
 	/* Start monitoring the file attributes we display. Note that some
 	 * of the attributes are for the original file, and some for the


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