On Sun, 2002-11-03 at 20:45, Dave Camp wrote: Hi, updated patch and a nautilus-desktop.png icon (the gnome-show-desktop icon) is attached. > On Sat, 2002-11-02 at 16:57, Jan Arne Petersen wrote: > > > -static void > > -update_title (NautilusWindow *window) > > +void > > +nautilus_window_update_title_and_icon (NautilusWindow *window) > > It doesn't seem like there's any reason to tie together the title and > icon setting into one function. You could probably get away with just > adding a nautilus_window_update_icon function and leaving the title > handling alone (maybe putting the special case in compute_title()) done. > > { > > 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); > > You probably shouldn't use the "accept" modifier here. "accept" doesn't > necessarily mean "open", there's at least one theme that just changes > the color of the icon. done. > > + /* 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); > > Your callback should match the signature of the function that's going to > be called by the signal handler. It's probably best to not use SWAPPED > and just add a helper function. done. Jan Arne Petersen
Index: src/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 --- src/nautilus-window-manage-views.c 2 Oct 2002 05:36:52 -0000 1.311 +++ src/nautilus-window-manage-views.c 4 Nov 2002 20:52:22 -0000 @@ -185,7 +185,11 @@ char *title; title = NULL; - if (window->new_content_view != NULL) { + + if (NAUTILUS_IS_DESKTOP_WINDOW (window)) { + /* Special Desktop window title (displayed in the Ctrl-Alt-Tab window) */ + title = g_strdup(_("Desktop")); + } else if (window->new_content_view != NULL) { title = nautilus_view_frame_get_title (window->new_content_view); } else if (window->content_view != NULL) { title = nautilus_view_frame_get_title (window->content_view); @@ -258,6 +262,42 @@ g_free (title); } +/* nautilus_window_update_icon: + * + * Update the non-NautilusViewFrame objects that use the location's user-displayable + * icon in some way. Called when the location or icon-theme has changed. + * @window: The NautilusWindow in question. + * + */ +void +nautilus_window_update_icon (NautilusWindow *window) +{ + char *path; + GdkPixbuf *pixbuf; + + pixbuf = NULL; + + /* Desktop window special 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); + + g_free (path); + } + } else { + pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file, + "open", + NAUTILUS_ICON_SIZE_STANDARD); + } + + if (pixbuf != NULL) { + gtk_window_set_icon (GTK_WINDOW (window), pixbuf); + g_object_unref (pixbuf); + } +} + /* set_displayed_location: * * Update the non-NautilusViewFrame objects that use the location's user-displayable @@ -290,6 +330,7 @@ } update_title (window); + nautilus_window_update_icon (window); } static void @@ -501,6 +542,7 @@ } update_title (window); + nautilus_window_update_icon (window); } } @@ -652,6 +694,7 @@ free_location_change (window); update_title (window); + nautilus_window_update_icon (window); /* The whole window has been finished. Now show it, unless * we're still waiting for the saved positions from the @@ -1964,6 +2007,7 @@ g_assert (NAUTILUS_IS_WINDOW (window)); update_title (window); + nautilus_window_update_icon (window); } static void Index: src/nautilus-window.c =================================================================== RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v retrieving revision 1.398 diff -u -r1.398 nautilus-window.c --- src/nautilus-window.c 31 Oct 2002 19:24:32 -0000 1.398 +++ src/nautilus-window.c 4 Nov 2002 20:52:26 -0000 @@ -173,6 +173,14 @@ } static void +icons_changed_callback (GObject *factory, NautilusWindow *window) +{ + g_return_if_fail (NAUTILUS_IS_WINDOW (window)); + + nautilus_window_update_icon (window); +} + +static void nautilus_window_instance_init (NautilusWindow *window) { window->details = g_new0 (NautilusWindowDetails, 1); @@ -197,6 +205,12 @@ 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 (nautilus_icon_factory_get (), "icons_changed", + G_CALLBACK (icons_changed_callback), window); + /* Create a separate component so when we remove the status * we don't loose the status bar */ Index: src/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 --- src/nautilus-window-private.h 22 Sep 2002 17:18:44 -0000 1.92 +++ src/nautilus-window-private.h 4 Nov 2002 20:52:26 -0000 @@ -173,5 +173,6 @@ 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_icon (NautilusWindow *window); #endif /* NAUTILUS_WINDOW_PRIVATE_H */ Index: src/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 --- src/file-manager/fm-properties-window.c 25 Oct 2002 17:38:35 -0000 1.160 +++ src/file-manager/fm-properties-window.c 4 Nov 2002 20:52:30 -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, + "open", + 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 +icons_changed_callback (GObject *factory, FMPropertiesWindow *window) +{ + g_return_if_fail (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 (nautilus_icon_factory_get (), "icons_changed", + G_CALLBACK (icons_changed_callback), + window); /* Start monitoring the file attributes we display. Note that some * of the attributes are for the original file, and some for the Index: icons/Makefile.am =================================================================== RCS file: /cvs/gnome/nautilus/icons/Makefile.am,v retrieving revision 1.114 diff -u -r1.114 Makefile.am --- icons/Makefile.am 31 Oct 2002 19:02:37 -0000 1.114 +++ icons/Makefile.am 4 Nov 2002 20:52:30 -0000 @@ -22,6 +22,7 @@ emblems.png \ increment.png \ knob.png \ + nautilus-desktop.png \ nautilus-launch-icon.png \ nautilus-mini-logo.png \ nautilus-server-connect.png \
Attachment:
nautilus-desktop.png
Description: PNG image