diff options
author | Paolo Borelli <pborelli@katamail.com> | 2006-12-18 09:57:23 +0000 |
---|---|---|
committer | Paolo Borelli <pborelli@src.gnome.org> | 2006-12-18 09:57:23 +0000 |
commit | 268d685efd17581fea56e72d5ecc2ba86a0dca61 (patch) | |
tree | 77122071ee6757e23444d89c1c4a8bda5093456e | |
parent | 2a5352a6c9250192a00488a87e9f527ec757d18b (diff) | |
download | nautilus-268d685efd17581fea56e72d5ecc2ba86a0dca61.tar.gz |
Add an extra widget to the trash folder with the "Empty Trash" button.
2006-12-18 Paolo Borelli <pborelli@katamail.com>
* src/nautilus-trash-bar.c:
* src/nautilus-trash-bar.c:
* src/nautilus-window-manage-views.c:
Add an extra widget to the trash folder with the "Empty Trash"
button. Kudos also to Lakin Wecker who came up with a similar
patch some months ago, though it never went in.
* src/nautilus-information-panel.c:
Remove the "Empty Trash" and "Burn" buttons from the side pane
since we now have extra location widgets.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/nautilus-information-panel.c | 130 | ||||
-rw-r--r-- | src/nautilus-spatial-window.c | 11 | ||||
-rw-r--r-- | src/nautilus-trash-bar.c | 188 | ||||
-rw-r--r-- | src/nautilus-trash-bar.h | 59 | ||||
-rw-r--r-- | src/nautilus-window-manage-views.c | 21 |
7 files changed, 286 insertions, 140 deletions
@@ -1,3 +1,18 @@ +2006-12-18 Paolo Borelli <pborelli@katamail.com> + + * src/nautilus-trash-bar.c: + * src/nautilus-trash-bar.c: + * src/nautilus-window-manage-views.c: + + Add an extra widget to the trash folder with the "Empty Trash" + button. Kudos also to Lakin Wecker who came up with a similar + patch some months ago, though it never went in. + + * src/nautilus-information-panel.c: + + Remove the "Empty Trash" and "Burn" buttons from the side pane + since we now have extra location widgets. + 2006-12-18 Luca Ferretti <elle.uca@libero.it> * src/file-manager/fm-directory-view.c: diff --git a/src/Makefile.am b/src/Makefile.am index a752b7a31..5c74fcca4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -117,6 +117,8 @@ nautilus_SOURCES = \ nautilus-spatial-window.h \ nautilus-throbber.c \ nautilus-throbber.h \ + nautilus-trash-bar.c \ + nautilus-trash-bar.h \ nautilus-window-bookmarks.c \ nautilus-window-bookmarks.h \ nautilus-window-manage-views.c \ diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index f91c0d8a2..be174f142 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -36,13 +36,8 @@ #include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <libxml/parser.h> -#include <gtk/gtkcheckmenuitem.h> #include <gtk/gtkdnd.h> #include <gtk/gtkhbox.h> -#include <gtk/gtkpaned.h> -#include <gtk/gtknotebook.h> -#include <gtk/gtksignal.h> #include <glib/gi18n.h> #include <libgnomeui/gnome-uidefs.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> @@ -52,17 +47,14 @@ #include <libnautilus-private/nautilus-dnd.h> #include <libnautilus-private/nautilus-directory.h> #include <libnautilus-private/nautilus-file-dnd.h> -#include <libnautilus-private/nautilus-file-operations.h> #include <libnautilus-private/nautilus-file.h> #include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-keep-last-vertical-box.h> #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-mime-actions.h> #include <libnautilus-private/nautilus-program-choosing.h> -#include <libnautilus-private/nautilus-trash-monitor.h> #include <libnautilus-private/nautilus-sidebar-provider.h> #include <libnautilus-private/nautilus-module.h> -#include <math.h> struct NautilusInformationPanelDetails { GtkVBox *container; @@ -87,7 +79,6 @@ struct NautilusInformationPanelDetails { static gboolean nautilus_information_panel_press_event (GtkWidget *widget, GdkEventButton *event); -static void nautilus_information_panel_destroy (GtkObject *object); static void nautilus_information_panel_finalize (GObject *object); static void nautilus_information_panel_drag_data_received (GtkWidget *widget, GdkDragContext *context, @@ -100,7 +91,6 @@ static void nautilus_information_panel_read_defaults (NautilusInform static void nautilus_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style); static void nautilus_information_panel_theme_changed (gpointer user_data); -static void nautilus_information_panel_confirm_trash_changed (gpointer user_data); static void nautilus_information_panel_update_appearance (NautilusInformationPanel *information_panel); static void nautilus_information_panel_update_buttons (NautilusInformationPanel *information_panel); static void add_command_buttons (NautilusInformationPanel *information_panel, @@ -111,8 +101,6 @@ static void nautilus_information_panel_iface_init (NautilusSideba static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface); static GType nautilus_information_panel_provider_get_type (void); -static gboolean confirm_trash_auto_value = TRUE; - enum { LOCATION_CHANGED, LAST_SIGNAL @@ -213,16 +201,12 @@ nautilus_information_panel_class_init (NautilusInformationPanelClass *klass) { GtkWidgetClass *widget_class; GObjectClass *gobject_class; - GtkObjectClass *object_class; gobject_class = G_OBJECT_CLASS (klass); - object_class = GTK_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); gobject_class->finalize = nautilus_information_panel_finalize; - object_class->destroy = nautilus_information_panel_destroy; - widget_class->drag_data_received = nautilus_information_panel_drag_data_received; widget_class->button_press_event = nautilus_information_panel_press_event; widget_class->style_set = nautilus_information_panel_style_set; @@ -262,18 +246,10 @@ static void nautilus_information_panel_init (NautilusInformationPanel *information_panel) { GtkWidget *widget; - static gboolean setup_autos = FALSE; widget = GTK_WIDGET (information_panel); information_panel->details = g_new0 (NautilusInformationPanelDetails, 1); - - if (!setup_autos) { - setup_autos = TRUE; - eel_preferences_add_auto_boolean ( - NAUTILUS_PREFERENCES_CONFIRM_TRASH, - &confirm_trash_auto_value); - } /* load the default background */ nautilus_information_panel_read_defaults (information_panel); @@ -303,9 +279,6 @@ nautilus_information_panel_init (NautilusInformationPanel *information_panel) eel_preferences_add_callback (NAUTILUS_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, nautilus_information_panel_theme_changed, information_panel); eel_preferences_add_callback (NAUTILUS_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME, nautilus_information_panel_theme_changed, information_panel); - /* add a callback for when the preference whether to confirm trashing/deleting file changes */ - eel_preferences_add_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH, nautilus_information_panel_confirm_trash_changed, information_panel); - /* prepare ourselves to receive dropped objects */ gtk_drag_dest_set (GTK_WIDGET (information_panel), GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, @@ -314,16 +287,6 @@ nautilus_information_panel_init (NautilusInformationPanel *information_panel) } static void -nautilus_information_panel_destroy (GtkObject *object) -{ - NautilusInformationPanel *information_panel; - - information_panel = NAUTILUS_INFORMATION_PANEL (object); - - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); -} - -static void nautilus_information_panel_finalize (GObject *object) { NautilusInformationPanel *information_panel; @@ -352,11 +315,6 @@ nautilus_information_panel_finalize (GObject *object) nautilus_information_panel_theme_changed, information_panel); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH, - nautilus_information_panel_confirm_trash_changed, - information_panel); - - EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); } @@ -459,17 +417,6 @@ nautilus_information_panel_theme_changed (gpointer user_data) gtk_widget_queue_draw (GTK_WIDGET (information_panel)) ; } -/* handler for handling confirming trash preferences changes */ - -static void -nautilus_information_panel_confirm_trash_changed (gpointer user_data) -{ - NautilusInformationPanel *information_panel; - - information_panel = NAUTILUS_INFORMATION_PANEL (user_data); - nautilus_information_panel_update_buttons (information_panel); -} - /* hit testing */ static InformationPanelPart @@ -518,8 +465,8 @@ receive_dropped_uri_list (NautilusInformationPanel *information_panel, char **uris; gboolean exactly_one; GtkWindow *window; - - uris = g_strsplit (selection_data->data, "\r\n", 0); + + uris = g_uri_list_extract_uris ((gchar *) selection_data->data); exactly_one = uris[0] != NULL && (uris[1] == NULL || uris[1][0] == '\0'); window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (information_panel))); @@ -974,43 +921,6 @@ add_buttons_from_metadata (NautilusInformationPanel *information_panel, const ch g_strfreev (terms); } -/* handle the hacked-in empty trash command */ -static void -empty_trash_callback (GtkWidget *button, gpointer data) -{ - GtkWidget *window; - - window = gtk_widget_get_toplevel (button); - nautilus_file_operations_empty_trash (window); -} - - -static void -burn_cd_callback (GtkWidget *button, gpointer data) -{ - GError *error; - char *argv[] = { "nautilus-cd-burner", NULL}; - - error = NULL; - if (!g_spawn_async (NULL, - argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, - NULL, - &error)) { - eel_show_error_dialog (_("Unable to launch the cd burner application."), error->message, - GTK_WINDOW (gtk_widget_get_toplevel (button))); - g_error_free (error); - } -} - -static void -nautilus_information_panel_trash_state_changed_callback (NautilusTrashMonitor *trash_monitor, - gboolean state, gpointer callback_data) -{ - gtk_widget_set_sensitive (GTK_WIDGET (callback_data), !nautilus_trash_monitor_is_empty ()); -} - /* * nautilus_information_panel_update_buttons: * @@ -1020,7 +930,6 @@ static void nautilus_information_panel_update_buttons (NautilusInformationPanel *information_panel) { char *button_data; - GtkWidget *temp_button; GList *short_application_list; /* dispose of any existing buttons */ @@ -1039,37 +948,6 @@ nautilus_information_panel_update_buttons (NautilusInformationPanel *information g_free(button_data); } - /* here is a hack to provide an "empty trash" button when displaying the trash. Eventually, we - * need a framework to allow protocols to add commands buttons */ - if (eel_istr_has_prefix (information_panel->details->uri, "trash:")) { - /* FIXME: We don't use spaces to pad labels! */ - temp_button = gtk_button_new_with_mnemonic (_("Empty _Trash")); - - gtk_box_pack_start (GTK_BOX (information_panel->details->button_box), - temp_button, FALSE, FALSE, 0); - gtk_widget_set_sensitive (temp_button, !nautilus_trash_monitor_is_empty ()); - gtk_widget_show (temp_button); - information_panel->details->has_buttons = TRUE; - - g_signal_connect (temp_button, "clicked", - G_CALLBACK (empty_trash_callback), NULL); - - g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed", - G_CALLBACK (nautilus_information_panel_trash_state_changed_callback), temp_button, 0); - } - if (eel_istr_has_prefix (information_panel->details->uri, "burn:")) { - /* FIXME: We don't use spaces to pad labels! */ - temp_button = gtk_button_new_with_mnemonic (_("_Write contents to CD")); - - gtk_box_pack_start (GTK_BOX (information_panel->details->button_box), - temp_button, FALSE, FALSE, 0); - gtk_widget_show (temp_button); - information_panel->details->has_buttons = TRUE; - - g_signal_connect (temp_button, "clicked", - G_CALLBACK (burn_cd_callback), NULL); - } - /* Make buttons for each application */ if (nautilus_mime_has_any_applications_for_file (information_panel->details->file)) { short_application_list = @@ -1142,7 +1020,6 @@ nautilus_information_panel_update_appearance (NautilusInformationPanel *informat information_panel); } - static void background_metadata_changed_callback (NautilusInformationPanel *information_panel) { @@ -1265,8 +1142,6 @@ nautilus_information_panel_set_parent_window (NautilusInformationPanel *panel, title); g_free (location); g_free (title); - - } static NautilusSidebar * @@ -1299,7 +1174,6 @@ nautilus_information_panel_provider_class_init (NautilusInformationPanelProvider { } - void nautilus_information_panel_register (void) { diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 7ab575277..fe763b00e 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -42,9 +42,6 @@ #include "nautilus-search-bar.h" #include "nautilus-window-manage-views.h" #include "nautilus-zoom-control.h" -#include <eel/eel-debug.h> -#include <eel/eel-gdk-extensions.h> -#include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-gtk-extensions.h> #include <eel/eel-gtk-macros.h> #include <eel/eel-string.h> @@ -54,16 +51,11 @@ #include <gtk/gtkmain.h> #include <gtk/gtkmenubar.h> #include <gtk/gtkmenuitem.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtktogglebutton.h> #include <gtk/gtkvbox.h> #include <gtk/gtkuimanager.h> #include <glib/gi18n.h> #include <libgnome/gnome-macros.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-messagebox.h> #include <libgnomeui/gnome-uidefs.h> -#include <libgnomeui/gnome-window-icon.h> #include <libgnomevfs/gnome-vfs-uri.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <libnautilus-private/nautilus-dnd.h> @@ -76,13 +68,10 @@ #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-mime-actions.h> #include <libnautilus-private/nautilus-program-choosing.h> -#include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-undo.h> #include <libnautilus-private/nautilus-search-directory.h> #include <libnautilus-private/nautilus-search-engine.h> #include <libnautilus-private/nautilus-signaller.h> -#include <math.h> -#include <sys/time.h> #define MAX_TITLE_LENGTH 180 #define MAX_SHORTNAME_PATH 16 diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c new file mode 100644 index 000000000..680e4c826 --- /dev/null +++ b/src/nautilus-trash-bar.c @@ -0,0 +1,188 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2006 Paolo Borelli <pborelli@katamail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: Paolo Borelli <pborelli@katamail.com> + * + */ + +#include "config.h" + +#include <glib/gi18n-lib.h> +#include <gtk/gtk.h> + +#include "nautilus-trash-bar.h" +#include <libnautilus-private/nautilus-file-operations.h> +#include <libnautilus-private/nautilus-trash-monitor.h> + +#define NAUTILUS_TRASH_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAUTILUS_TYPE_TRASH_BAR, NautilusTrashBarPrivate)) + +struct NautilusTrashBarPrivate +{ + GtkTooltips *tooltips; + GtkWidget *button; +}; + +G_DEFINE_TYPE (NautilusTrashBar, nautilus_trash_bar, GTK_TYPE_HBOX) + +GtkWidget * +nautilus_trash_bar_get_button (NautilusTrashBar *bar) +{ + GtkWidget *button; + + g_return_val_if_fail (bar != NULL, NULL); + + button = bar->priv->button; + + return button; +} + +static void +nautilus_trash_bar_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + NautilusTrashBar *bar; + + bar = NAUTILUS_TRASH_BAR (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nautilus_trash_bar_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + NautilusTrashBar *bar; + + bar = NAUTILUS_TRASH_BAR (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nautilus_trash_bar_finalize (GObject *object) +{ + NautilusTrashBar *bar; + + bar = NAUTILUS_TRASH_BAR (object); + + if (bar->priv->tooltips != NULL) { + g_object_unref (bar->priv->tooltips); + } + + G_OBJECT_CLASS (nautilus_trash_bar_parent_class)->finalize (object); +} + +static void +nautilus_trash_bar_trash_state_changed (NautilusTrashMonitor *trash_monitor, + gboolean state, + gpointer data) +{ + NautilusTrashBar *bar; + + bar = NAUTILUS_TRASH_BAR (data); + + gtk_widget_set_sensitive (bar->priv->button, + !nautilus_trash_monitor_is_empty ()); +} + +static void +nautilus_trash_bar_class_init (NautilusTrashBarClass *klass) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = nautilus_trash_bar_finalize; + object_class->get_property = nautilus_trash_bar_get_property; + object_class->set_property = nautilus_trash_bar_set_property; + + g_type_class_add_private (klass, sizeof (NautilusTrashBarPrivate)); +} + +static void +empty_trash_callback (GtkWidget *button, gpointer data) +{ + GtkWidget *window; + + window = gtk_widget_get_toplevel (button); + + nautilus_file_operations_empty_trash (window); +} + +static void +nautilus_trash_bar_init (NautilusTrashBar *bar) +{ + GtkWidget *label; + GtkWidget *hbox; + + bar->priv = NAUTILUS_TRASH_BAR_GET_PRIVATE (bar); + + hbox = GTK_WIDGET (bar); + + label = gtk_label_new (_("Trash")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (bar), label, FALSE, FALSE, 0); + + bar->priv->button = gtk_button_new_with_mnemonic (_("Empty _Trash")); + gtk_widget_show (bar->priv->button); + gtk_box_pack_end (GTK_BOX (hbox), bar->priv->button, FALSE, FALSE, 0); + + gtk_widget_set_sensitive (bar->priv->button, + !nautilus_trash_monitor_is_empty ()); + + bar->priv->tooltips = gtk_tooltips_new (); + g_object_ref_sink (bar->priv->tooltips); + + gtk_tooltips_set_tip (GTK_TOOLTIPS (bar->priv->tooltips), + bar->priv->button, + _("Delete all items in the Trash"), + NULL); + + g_signal_connect (bar->priv->button, + "clicked", + G_CALLBACK (empty_trash_callback), + bar); + + g_signal_connect_object (nautilus_trash_monitor_get (), + "trash_state_changed", + G_CALLBACK (nautilus_trash_bar_trash_state_changed), + bar, + 0); +} + +GtkWidget * +nautilus_trash_bar_new (void) +{ + GObject *bar; + + bar = g_object_new (NAUTILUS_TYPE_TRASH_BAR, NULL); + + return GTK_WIDGET (bar); +} diff --git a/src/nautilus-trash-bar.h b/src/nautilus-trash-bar.h new file mode 100644 index 000000000..5bcaed391 --- /dev/null +++ b/src/nautilus-trash-bar.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2006 Paolo Borelli <pborelli@katamail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: Paolo Borelli <pborelli@katamail.com> + * + */ + +#ifndef __NAUTILUS_TRASH_BAR_H +#define __NAUTILUS_TRASH_BAR_H + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define NAUTILUS_TYPE_TRASH_BAR (nautilus_trash_bar_get_type ()) +#define NAUTILUS_TRASH_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_TRASH_BAR, NautilusTrashBar)) +#define NAUTILUS_TRASH_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_TRASH_BAR, NautilusTrashBarClass)) +#define NAUTILUS_IS_TRASH_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_TYPE_TRASH_BAR)) +#define NAUTILUS_IS_TRASH_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_TRASH_BAR)) +#define NAUTILUS_TRASH_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_TRASH_BAR, NautilusTrashBarClass)) + +typedef struct NautilusTrashBarPrivate NautilusTrashBarPrivate; + +typedef struct +{ + GtkHBox box; + + NautilusTrashBarPrivate *priv; +} NautilusTrashBar; + +typedef struct +{ + GtkHBoxClass parent_class; +} NautilusTrashBarClass; + +GType nautilus_trash_bar_get_type (void) G_GNUC_CONST; + +GtkWidget *nautilus_trash_bar_new (void); + +GtkWidget *nautilus_trash_bar_get_button (NautilusTrashBar *bar); + +G_END_DECLS + +#endif /* __GS_TRASH_BAR_H */ diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index f1e51d20c..a1da3d8db 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -35,6 +35,7 @@ #include "nautilus-pathbar.h" #include "nautilus-main.h" #include "nautilus-window-private.h" +#include "nautilus-trash-bar.h" #include "nautilus-zoom-control.h" #include <eel/eel-accessibility.h> #include <eel/eel-debug.h> @@ -64,6 +65,7 @@ #include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-monitor.h> #include <libnautilus-private/nautilus-search-directory.h> +#include <libnautilus-private/nautilus-trash-directory.h> #include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-window-info.h> @@ -1173,7 +1175,19 @@ add_extension_extra_widgets (NautilusWindow *window, const char *uri) } nautilus_module_extension_list_free (providers); - +} + +static void +nautilus_window_show_trash_bar (NautilusWindow *window) +{ + GtkWidget *bar; + + g_assert (NAUTILUS_IS_WINDOW (window)); + + bar = nautilus_trash_bar_new (); + gtk_widget_show (bar); + + nautilus_window_add_extra_location_widget (window, bar); } /* Handle the changes for the NautilusWindow itself. */ @@ -1233,6 +1247,11 @@ update_for_new_location (NautilusWindow *window) } else { nautilus_window_set_search_mode (window, FALSE, NULL); } + + if (NAUTILUS_IS_TRASH_DIRECTORY (directory)) { + nautilus_window_show_trash_bar (window); + } + nautilus_directory_unref (directory); add_extension_extra_widgets (window, window->details->location); |