[nautilus] pathbar: clear buttons directly when file is gone
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] pathbar: clear buttons directly when file is gone
- Date: Sat, 1 Sep 2012 03:04:24 +0000 (UTC)
commit 7643a28eb104bf66c511633bd1662d546f8d7bf7
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Aug 31 20:53:06 2012 -0400
pathbar: clear buttons directly when file is gone
Instead of having the code in nautilus-window-manage-views clear the
pathbar, since it receives the same signal, handle it internally. This
should make code more robust.
src/nautilus-pathbar.c | 11 +++++++----
src/nautilus-pathbar.h | 1 -
src/nautilus-window-manage-views.c | 13 -------------
3 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 29eaf2d..6b5fbf5 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1223,7 +1223,7 @@ nautilus_path_bar_check_icon_theme (NautilusPathBar *path_bar)
}
/* Public functions and their helpers */
-void
+static void
nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar)
{
while (path_bar->priv->button_list != NULL) {
@@ -1558,12 +1558,15 @@ button_data_file_changed (NautilusFile *file,
} else if (nautilus_file_is_gone (file)) {
gint idx, position;
- /* if the current or a parent location are gone, don't do anything, as the view
- * will get the event too and call us back.
+ /* if the current or a parent location are gone, clear all the buttons,
+ * the view will set the new path.
*/
current_location = nautilus_file_get_location (current_button_data->file);
- if (g_file_has_prefix (location, current_location)) {
+ if (g_file_has_prefix (current_location, location) ||
+ g_file_equal (current_location, location)) {
+ nautilus_path_bar_clear_buttons (path_bar);
+ } else if (g_file_has_prefix (location, current_location)) {
/* remove this and the following buttons */
position = g_list_position (path_bar->priv->button_list,
g_list_find (path_bar->priv->button_list, button_data));
diff --git a/src/nautilus-pathbar.h b/src/nautilus-pathbar.h
index 2a5d6b5..7dbc20f 100644
--- a/src/nautilus-pathbar.h
+++ b/src/nautilus-pathbar.h
@@ -56,6 +56,5 @@ struct _NautilusPathBarClass
GType nautilus_path_bar_get_type (void) G_GNUC_CONST;
void nautilus_path_bar_set_path (NautilusPathBar *path_bar, GFile *file);
-void nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar);
#endif /* NAUTILUS_PATHBAR_H */
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 3f8b2f0..9ac7641 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -333,19 +333,6 @@ viewed_file_changed_callback (NautilusFile *file,
}
if (go_to_file != NULL) {
- /* the path bar URI will be set to go_to_uri immediately
- * in begin_location_change, but we don't want the
- * inexistant children to show up anymore */
- if (slot == slot->window->details->active_slot) {
- GtkWidget *path_bar;
-
- /* multiview-TODO also update NautilusWindowSlot
- * [which as of writing doesn't save/store any path bar state]
- */
- path_bar = nautilus_toolbar_get_path_bar (NAUTILUS_TOOLBAR (slot->window->details->toolbar));
- nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (path_bar));
- }
-
nautilus_window_slot_open_location (slot, go_to_file, 0);
g_object_unref (go_to_file);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]