Re: [patch] nautilus window border icon
- From: Jan Arne Petersen <jpetersen gnome-de org>
- To: Havoc Pennington <hp redhat com>
- Cc: "nautilus-list [ML]" <nautilus-list gnome org>
- Subject: Re: [patch] nautilus window border icon
- Date: 02 Nov 2002 22:57:33 +0100
On Sat, 2002-11-02 at 18:37, Havoc Pennington wrote:
> Woo-hoo! Cool.
>
> When doing Ctrl+Alt+Tab, previously the desktop showed up as
> ".gnome-desktop" with the cheese puff icon - I think it should say
> "Desktop" and have a desktop icon (as in the "show desktop" applet).
> With your patch it probably still says .gnome-desktop and probably has
> a folder icon, right?
Yes.
> Do you think we could put in a special-case hack
> for the desktop window?
Yes. See http://www.uni-bonn.de/~jpeterse/nautilus-desktop-special.png
and the attached updated patch.
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 21:55:43 -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,41 @@
* @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;
+ char *path;
+ GdkPixbuf *pixbuf;
- title = compute_title (window);
+ /* Desktop window special title and icon */
+ if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
+ path = nautilus_pixmap_file ("nautilus-desktop.png");
+
+ if (path != NULL) {
+ pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+ gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+ g_free (path);
+ g_object_unref (pixbuf);
+ }
+
+ gtk_window_set_title (GTK_WINDOW (window), _("Desktop"));
+ return;
+ }
+
+ /* 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 +314,7 @@
: nautilus_bookmark_new (location, location);
}
- update_title (window);
+ nautilus_window_update_title_and_icon (window);
}
static void
@@ -500,7 +525,7 @@
g_free (new_location);
}
- update_title (window);
+ nautilus_window_update_title_and_icon (window);
}
}
@@ -651,7 +676,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 +1988,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 21:55:46 -0000
@@ -190,13 +190,20 @@
/* Set initial window title */
gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
-
+
window->details->shell_ui = bonobo_ui_component_new ("Nautilus Shell");
bonobo_ui_component_set_container
(window->details->shell_ui,
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 21:55:47 -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 21:55:51 -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]