summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-09-14 18:15:24 +0000
committerDarin Adler <darin@src.gnome.org>2000-09-14 18:15:24 +0000
commit146c7178ee17764cd882d18e25a0e6ae7c344b52 (patch)
treea5e5166d591b32eb4499de80ebd75b8ba494a58c
parent0b257a4ef60b2545c4c4042541ac952d8c6e326d (diff)
downloadnautilus-146c7178ee17764cd882d18e25a0e6ae7c344b52.tar.gz
To get started on a bug, I dismantled part of the state machine,
which we can replace with something much simpler. Just doing this change seems to have fixed the bug I was going to tackle. Fixes bug 2170 (hitting the "up" button a lot of times in a row causes crash). * libnautilus-extensions/nautilus-file-utilities.c: (nautilus_self_check_file_utilities): Quick tweak to these tests. We need more thorough tests of nautilus_make_uri_from_input. * libnautilus-extensions/nautilus-search-bar-criterion-private.h: Removed this long-obsolete file. There's another copy in the src directory that's the "real" one. * src/file-manager/fm-directory-view.c: (fm_directory_view_destroy): Fixed a problem I was seeing switching out of the list view by emptying the "pending" lists so doing the stop as part of destroy will not add items to the view before destroying it. * src/nautilus-window-manage-views.c: (nautilus_window_free_load_info): Got rid of "action_tag", "made_changes", and "state". (nautilus_window_update_state): Turned "made_changes" into a local variable. Got rid of code setting "state" since nothing looked at it. Got rid of code that sets up an idle. (nautilus_window_set_state_info): Eliminated "do_sync" and made the function always keep running update_state until it's done instead of using an idle. (nautilus_window_end_location_change_callback): Got rid of FIXME since I now understand why gtk_object_destroy is OK for windows. * src/nautilus-window.h: Eliminated "action_tag", "made_changes", and "state". * src/nautilus-window.c: (nautilus_window_destroy): No need to deal with "action_tag" any more. (window_update_sidebar_panels_from_preferences): Remove excess unref that's not needed now that we have more careful handling of sidebar references.
-rw-r--r--ChangeLog44
-rw-r--r--libnautilus-extensions/nautilus-file-utilities.c21
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion-private.h57
-rw-r--r--libnautilus-private/nautilus-file-utilities.c21
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion-private.h57
-rw-r--r--src/file-manager/fm-directory-view.c39
-rw-r--r--src/nautilus-navigation-window.c5
-rw-r--r--src/nautilus-navigation-window.h5
-rw-r--r--src/nautilus-object-window.c5
-rw-r--r--src/nautilus-object-window.h5
-rw-r--r--src/nautilus-spatial-window.c5
-rw-r--r--src/nautilus-spatial-window.h5
-rw-r--r--src/nautilus-window-manage-views.c107
-rw-r--r--src/nautilus-window.c5
-rw-r--r--src/nautilus-window.h5
15 files changed, 103 insertions, 283 deletions
diff --git a/ChangeLog b/ChangeLog
index 9dd4fd4a1..9ca070c9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2000-09-14 Darin Adler <darin@eazel.com>
+
+ To get started on a bug, I dismantled part of the state machine,
+ which we can replace with something much simpler. Just doing this
+ change seems to have fixed the bug I was going to tackle.
+
+ Fixes bug 2170 (hitting the "up" button a lot of times in a row
+ causes crash).
+
+ * libnautilus-extensions/nautilus-file-utilities.c:
+ (nautilus_self_check_file_utilities): Quick tweak to these tests.
+ We need more thorough tests of nautilus_make_uri_from_input.
+
+ * libnautilus-extensions/nautilus-search-bar-criterion-private.h:
+ Removed this long-obsolete file. There's another copy in the src
+ directory that's the "real" one.
+
+ * src/file-manager/fm-directory-view.c:
+ (fm_directory_view_destroy): Fixed a problem I was seeing
+ switching out of the list view by emptying the "pending" lists so
+ doing the stop as part of destroy will not add items to the view
+ before destroying it.
+
+ * src/nautilus-window-manage-views.c:
+ (nautilus_window_free_load_info): Got rid of "action_tag",
+ "made_changes", and "state".
+ (nautilus_window_update_state): Turned "made_changes" into a local
+ variable. Got rid of code setting "state" since nothing looked at
+ it. Got rid of code that sets up an idle.
+ (nautilus_window_set_state_info): Eliminated "do_sync" and made
+ the function always keep running update_state until it's done
+ instead of using an idle.
+ (nautilus_window_end_location_change_callback): Got rid of FIXME
+ since I now understand why gtk_object_destroy is OK for windows.
+
+ * src/nautilus-window.h: Eliminated "action_tag", "made_changes",
+ and "state".
+
+ * src/nautilus-window.c: (nautilus_window_destroy): No need to
+ deal with "action_tag" any more.
+ (window_update_sidebar_panels_from_preferences): Remove excess
+ unref that's not needed now that we have more careful handling of
+ sidebar references.
+
2000-09-14 John Sullivan <sullivan@eazel.com>
Fixed bug 3072 (crash right-clicking in icon view background)
diff --git a/libnautilus-extensions/nautilus-file-utilities.c b/libnautilus-extensions/nautilus-file-utilities.c
index 9354de3d0..d65fec204 100644
--- a/libnautilus-extensions/nautilus-file-utilities.c
+++ b/libnautilus-extensions/nautilus-file-utilities.c
@@ -717,28 +717,19 @@ nautilus_read_file_cancel (NautilusReadFileHandle *handle)
void
nautilus_self_check_file_utilities (void)
{
- char *tmp;
-
- /* check to make sure the current implementation doesn't cause problems */
+ /* nautilus_make_uri_from_input */
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input (""), "");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu"), "http://null.stanford.edu");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu:80"), "http://null.stanford.edu:80");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://seth@null.stanford.edu:80"), "http://seth@null.stanford.edu:80");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu/some file"), "http://null.stanford.edu/some%20file");
-
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file:///home/joe/some file"), "file:///home/joe/some%20file");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file://home/joe/some file"), "file://home/joe/some%20file");
-
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("foo://foobar.txt"), "foo://foobar.txt");
-
- /* now we test input we just want to make sure doesn't crash the function */
- tmp = nautilus_make_uri_from_input (":://:://:::::::::::::::::");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("file:::::////");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("http:::::::::");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("::");
- g_free (tmp);
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("::"), "::");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input (":://:://:::::::::::::::::"), ":://%3A%3A//%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file:::::////"), "file:::::////");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http:::::::::"), "http:::::::::");
/* nautilus_make_uri_canonical */
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_canonical (""), "file:");
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion-private.h b/libnautilus-extensions/nautilus-search-bar-criterion-private.h
deleted file mode 100644
index 9f23a8641..000000000
--- a/libnautilus-extensions/nautilus-search-bar-criterion-private.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion-private.h - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- Copyright (C) 2000 Eazel, Inc.
-
- 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-
-#include "nautilus-search-bar-criterion.h"
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkoptionmenu.h>
-#include <time.h>
-#include <libgnomeui/gnome-dateedit.h>
-
-struct NautilusSearchBarCriterionDetails {
- NautilusSearchBarCriterionType type;
-
- /* various widgets hold by the criterion */
- GtkOptionMenu *available_criteria;
- GtkOptionMenu *relation_menu;
- gboolean use_value_entry;
- GtkEntry *value_entry;
- gboolean use_value_menu;
- GtkOptionMenu *value_menu;
- gboolean use_value_suffix;
- GtkLabel *value_suffix;
- GnomeDateEdit *date;
-
- /* callback to be called when the criterion type changes */
- NautilusSearchBarCriterionCallback callback;
- gpointer callback_data;
-
-};
-
-#endif /* NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H */
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 9354de3d0..d65fec204 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -717,28 +717,19 @@ nautilus_read_file_cancel (NautilusReadFileHandle *handle)
void
nautilus_self_check_file_utilities (void)
{
- char *tmp;
-
- /* check to make sure the current implementation doesn't cause problems */
+ /* nautilus_make_uri_from_input */
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input (""), "");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu"), "http://null.stanford.edu");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu:80"), "http://null.stanford.edu:80");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://seth@null.stanford.edu:80"), "http://seth@null.stanford.edu:80");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http://null.stanford.edu/some file"), "http://null.stanford.edu/some%20file");
-
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file:///home/joe/some file"), "file:///home/joe/some%20file");
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file://home/joe/some file"), "file://home/joe/some%20file");
-
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("foo://foobar.txt"), "foo://foobar.txt");
-
- /* now we test input we just want to make sure doesn't crash the function */
- tmp = nautilus_make_uri_from_input (":://:://:::::::::::::::::");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("file:::::////");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("http:::::::::");
- g_free (tmp);
- tmp = nautilus_make_uri_from_input ("::");
- g_free (tmp);
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("::"), "::");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input (":://:://:::::::::::::::::"), ":://%3A%3A//%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("file:::::////"), "file:::::////");
+ NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_from_input ("http:::::::::"), "http:::::::::");
/* nautilus_make_uri_canonical */
NAUTILUS_CHECK_STRING_RESULT (nautilus_make_uri_canonical (""), "file:");
diff --git a/libnautilus-private/nautilus-search-bar-criterion-private.h b/libnautilus-private/nautilus-search-bar-criterion-private.h
deleted file mode 100644
index 9f23a8641..000000000
--- a/libnautilus-private/nautilus-search-bar-criterion-private.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion-private.h - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- Copyright (C) 2000 Eazel, Inc.
-
- 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-
-#include "nautilus-search-bar-criterion.h"
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkoptionmenu.h>
-#include <time.h>
-#include <libgnomeui/gnome-dateedit.h>
-
-struct NautilusSearchBarCriterionDetails {
- NautilusSearchBarCriterionType type;
-
- /* various widgets hold by the criterion */
- GtkOptionMenu *available_criteria;
- GtkOptionMenu *relation_menu;
- gboolean use_value_entry;
- GtkEntry *value_entry;
- gboolean use_value_menu;
- GtkOptionMenu *value_menu;
- gboolean use_value_suffix;
- GtkLabel *value_suffix;
- GnomeDateEdit *date;
-
- /* callback to be called when the criterion type changes */
- NautilusSearchBarCriterionCallback callback;
- gpointer callback_data;
-
-};
-
-#endif /* NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H */
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 62c38d662..5778b153c 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -991,52 +991,49 @@ fm_directory_view_destroy (GtkObject *object)
*/
view->details->nautilus_view = NULL;
+ nautilus_file_list_free (view->details->pending_files_added);
+ view->details->pending_files_added = NULL;
+ nautilus_file_list_free (view->details->pending_files_changed);
+ view->details->pending_files_changed = NULL;
+ nautilus_g_list_free_deep (view->details->pending_uris_selected);
+ view->details->pending_uris_selected = NULL;
+
fm_directory_view_stop (view);
fm_directory_view_clear (view);
+ disconnect_model_handlers (view);
+ nautilus_directory_unref (view->details->model);
+
+ if (view->details->display_selection_idle_id != 0) {
+ gtk_idle_remove (view->details->display_selection_idle_id);
+ }
+
+ if (view->details->update_menus_idle_id != 0) {
+ gtk_idle_remove (view->details->update_menus_idle_id);
+ }
+
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
show_hidden_files_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_CAPTIONS,
text_attribute_names_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
embedded_text_policy_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
image_display_policy_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY,
directory_view_font_family_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
click_policy_changed_callback,
view);
-
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
view);
- if (view->details->model != NULL) {
- disconnect_model_handlers (view);
- nautilus_directory_unref (view->details->model);
- }
-
- if (view->details->display_selection_idle_id != 0) {
- gtk_idle_remove (view->details->display_selection_idle_id);
- }
-
- if (view->details->update_menus_idle_id != 0) {
- gtk_idle_remove (view->details->update_menus_idle_id);
- }
-
- unschedule_display_of_pending_files (view);
-
g_free (view->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 94331393a..166e2c79d 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -506,9 +506,6 @@ nautilus_window_destroy (GtkObject *object)
if (window->status_bar_clear_id != 0) {
g_source_remove (window->status_bar_clear_id);
}
- if (window->action_tag != 0) {
- g_source_remove (window->action_tag);
- }
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
@@ -1574,8 +1571,6 @@ window_update_sidebar_panels_from_preferences (NautilusWindow *window)
if (sidebar_panel != NULL) {
nautilus_window_disconnect_view (window, sidebar_panel);
nautilus_window_remove_sidebar_panel (window, sidebar_panel);
-
- gtk_widget_unref (GTK_WIDGET (sidebar_panel));
}
}
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index fa7ba166b..b37941b9a 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -123,13 +123,10 @@ struct NautilusWindow {
GList *new_sidebar_panels;
GList *error_views;
- enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
-
NautilusNavigationInfo *cancel_tag;
gboolean location_change_end_reached;
- guint action_tag;
- guint16 made_changes, making_changes;
+ guint16 making_changes;
NautilusLocationChangeType location_change_type;
guint location_change_distance;
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index 94331393a..166e2c79d 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -506,9 +506,6 @@ nautilus_window_destroy (GtkObject *object)
if (window->status_bar_clear_id != 0) {
g_source_remove (window->status_bar_clear_id);
}
- if (window->action_tag != 0) {
- g_source_remove (window->action_tag);
- }
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
@@ -1574,8 +1571,6 @@ window_update_sidebar_panels_from_preferences (NautilusWindow *window)
if (sidebar_panel != NULL) {
nautilus_window_disconnect_view (window, sidebar_panel);
nautilus_window_remove_sidebar_panel (window, sidebar_panel);
-
- gtk_widget_unref (GTK_WIDGET (sidebar_panel));
}
}
diff --git a/src/nautilus-object-window.h b/src/nautilus-object-window.h
index fa7ba166b..b37941b9a 100644
--- a/src/nautilus-object-window.h
+++ b/src/nautilus-object-window.h
@@ -123,13 +123,10 @@ struct NautilusWindow {
GList *new_sidebar_panels;
GList *error_views;
- enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
-
NautilusNavigationInfo *cancel_tag;
gboolean location_change_end_reached;
- guint action_tag;
- guint16 made_changes, making_changes;
+ guint16 making_changes;
NautilusLocationChangeType location_change_type;
guint location_change_distance;
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 94331393a..166e2c79d 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -506,9 +506,6 @@ nautilus_window_destroy (GtkObject *object)
if (window->status_bar_clear_id != 0) {
g_source_remove (window->status_bar_clear_id);
}
- if (window->action_tag != 0) {
- g_source_remove (window->action_tag);
- }
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
@@ -1574,8 +1571,6 @@ window_update_sidebar_panels_from_preferences (NautilusWindow *window)
if (sidebar_panel != NULL) {
nautilus_window_disconnect_view (window, sidebar_panel);
nautilus_window_remove_sidebar_panel (window, sidebar_panel);
-
- gtk_widget_unref (GTK_WIDGET (sidebar_panel));
}
}
diff --git a/src/nautilus-spatial-window.h b/src/nautilus-spatial-window.h
index fa7ba166b..b37941b9a 100644
--- a/src/nautilus-spatial-window.h
+++ b/src/nautilus-spatial-window.h
@@ -123,13 +123,10 @@ struct NautilusWindow {
GList *new_sidebar_panels;
GList *error_views;
- enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
-
NautilusNavigationInfo *cancel_tag;
gboolean location_change_end_reached;
- guint action_tag;
- guint16 made_changes, making_changes;
+ guint16 making_changes;
NautilusLocationChangeType location_change_type;
guint location_change_distance;
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 317ab24bb..779cbf883 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -24,12 +24,6 @@
* John Sullivan <sullivan@eazel.com>
*/
-/* Main operations needed:
- * Initiate location change
- * Initiate content view change
- * Cancel action
- */
-
#include <config.h>
#include "nautilus-window-manage-views.h"
@@ -646,12 +640,6 @@ nautilus_window_free_load_info (NautilusWindow *window)
window->new_sidebar_panels = NULL;
window->new_content_view = NULL;
window->cancel_tag = NULL;
- if (window->action_tag != 0) {
- g_source_remove (window->action_tag);
- window->action_tag = 0;
- }
- window->made_changes = 0;
- window->state = NW_IDLE;
window->changes_pending = FALSE;
window->views_shown = FALSE;
window->view_bombed_out = FALSE;
@@ -953,29 +941,29 @@ nautilus_window_update_state (gpointer data)
{
NautilusWindow *window;
GList *p;
- gboolean result;
+ gboolean made_changes;
GList *sidebar_panel_identifiers;
window = data;
if (window->making_changes) {
- x_message (("In the middle of making changes %d (action_tag %d) - RETURNING",
- window->making_changes, window->action_tag));
+ x_message (("In the middle of making changes %d - RETURNING",
+ window->making_changes));
return FALSE;
}
- window->made_changes = 0;
+ made_changes = FALSE;
window->making_changes++;
#ifdef EXTREME_DEBUGGING
- g_message(">>> nautilus_window_update_state (action tag is %d):", window->action_tag);
- g_print("made_changes %d, making_changes %d\n", window->made_changes, window->making_changes);
- g_print("changes_pending %d, location_change_type %d, views_shown %d, view_bombed_out %d, view_activation_complete %d\n",
- window->changes_pending, window->location_change_type, window->views_shown,
- window->view_bombed_out, window->view_activation_complete);
- g_print("sent_update_view %d, cv_progress_initial %d, cv_progress_done %d, cv_progress_error %d, reset_to_idle %d\n",
- window->sent_update_view, window->cv_progress_initial, window->cv_progress_done, window->cv_progress_error,
- window->reset_to_idle);
+ g_message (">>> nautilus_window_update_state:");
+ g_print ("making_changes %d\n", window->making_changes);
+ g_print ("changes_pending %d, location_change_type %d, views_shown %d, view_bombed_out %d, view_activation_complete %d\n",
+ window->changes_pending, window->location_change_type, window->views_shown,
+ window->view_bombed_out, window->view_activation_complete);
+ g_print ("sent_update_view %d, cv_progress_initial %d, cv_progress_done %d, cv_progress_error %d, reset_to_idle %d\n",
+ window->sent_update_view, window->cv_progress_initial, window->cv_progress_done, window->cv_progress_error,
+ window->reset_to_idle);
#endif
/* Now make any needed state changes based on available information */
@@ -984,7 +972,7 @@ nautilus_window_update_state (gpointer data)
NautilusViewFrame *error_view = p->data;
if (error_view == window->new_content_view) {
- window->made_changes++;
+ made_changes = TRUE;
window->reset_to_idle = TRUE;
window->cv_progress_error = TRUE;
}
@@ -996,7 +984,7 @@ nautilus_window_update_state (gpointer data)
}
report_content_view_failure_to_user (window);
window->content_view = NULL;
- window->made_changes++;
+ made_changes = TRUE;
window->cv_progress_error = TRUE;
}
@@ -1021,7 +1009,7 @@ nautilus_window_update_state (gpointer data)
x_message (("Reset to idle!"));
window->changes_pending = FALSE;
- window->made_changes++;
+ made_changes = TRUE;
window->reset_to_idle = FALSE;
if (window->cancel_tag != NULL) {
@@ -1061,8 +1049,6 @@ nautilus_window_update_state (gpointer data)
}
if (window->changes_pending) {
- window->state = NW_LOADING_VIEWS;
-
x_message (("Changes pending"));
if (window->pending_ni
@@ -1094,7 +1080,7 @@ nautilus_window_update_state (gpointer data)
nautilus_view_identifier_list_free (sidebar_panel_identifiers);
window->view_activation_complete = TRUE;
- window->made_changes++;
+ made_changes = TRUE;
}
if (window->view_activation_complete
@@ -1135,7 +1121,7 @@ nautilus_window_update_state (gpointer data)
window->pending_selection = NULL;
window->sent_update_view = TRUE;
- window->made_changes++;
+ made_changes = TRUE;
}
if (!window->cv_progress_error
@@ -1145,7 +1131,7 @@ nautilus_window_update_state (gpointer data)
nautilus_window_has_really_changed (window);
window->views_shown = TRUE;
- window->made_changes++;
+ made_changes = TRUE;
}
if (window->cv_progress_error
@@ -1153,31 +1139,17 @@ nautilus_window_update_state (gpointer data)
x_message (("cv_progress_(error|done) kicking in"));
- window->made_changes++;
+ made_changes = TRUE;
window->reset_to_idle = TRUE;
}
}
- if (window->made_changes) {
- if (!window->action_tag) {
- window->action_tag = g_idle_add_full (G_PRIORITY_LOW,
- nautilus_window_update_state,
- window, NULL);
- }
-
- result = TRUE;
- window->made_changes = 0;
- } else {
- result = FALSE;
- window->action_tag = 0;
- }
-
window->making_changes--;
- x_message(("update_state done (new action tag is %d, making_changes is %d) <<<",
- window->action_tag, window->making_changes));
+ x_message(("update_state done (making_changes is %d) <<<",
+ window->making_changes));
- return result;
+ return made_changes;
}
void
@@ -1186,19 +1158,11 @@ nautilus_window_set_state_info (NautilusWindow *window, ...)
va_list args;
NautilusWindowStateItem item_type;
NautilusViewFrame *new_view;
- gboolean do_sync;
/* Ensure that changes happen in-order */
- if (window->made_changes != 0) {
- if (window->action_tag != 0) {
- g_source_remove(window->action_tag);
- window->action_tag = 0;
- }
- nautilus_window_update_state(window);
+ while (nautilus_window_update_state (window)) {
}
- do_sync = FALSE;
-
va_start (args, window);
while ((item_type = va_arg (args, NautilusWindowStateItem)) != 0) {
@@ -1260,7 +1224,6 @@ nautilus_window_set_state_info (NautilusWindow *window, ...)
case RESET_TO_IDLE: /* Someone pressed the stop button or something */
x_message (("RESET_TO_IDLE"));
window->reset_to_idle = TRUE;
- do_sync = TRUE;
break;
default:
@@ -1270,27 +1233,7 @@ nautilus_window_set_state_info (NautilusWindow *window, ...)
va_end (args);
- window->made_changes++;
- if (!window->making_changes) {
- if (do_sync) {
- if (window->action_tag != 0) {
- x_message (("Doing sync - action_tag was %d",
- window->action_tag));
- g_source_remove (window->action_tag);
- window->action_tag = 0;
- }
- if (nautilus_window_update_state (window)) {
- do_sync = FALSE;
- }
- }
-
- if (window->action_tag == 0 && !do_sync) {
- window->action_tag = g_idle_add_full (G_PRIORITY_LOW,
- nautilus_window_update_state,
- window, NULL);
- x_message (("Added callback to update_state - tag is %d",
- window->action_tag));
- }
+ while (nautilus_window_update_state (window)) {
}
}
@@ -1435,7 +1378,7 @@ nautilus_window_end_location_change_callback (NautilusNavigationResult result_co
nautilus_main_event_loop_register (GTK_OBJECT (dialog));
}
- /* FIXME bugzilla.eazel.com 2459: Is a destroy really sufficient here? Who does the unref? */
+ /* Since this is a window, destroying it will also unref it. */
gtk_object_destroy (GTK_OBJECT (window));
} else {
/* Clean up state of already-showing window */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 94331393a..166e2c79d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -506,9 +506,6 @@ nautilus_window_destroy (GtkObject *object)
if (window->status_bar_clear_id != 0) {
g_source_remove (window->status_bar_clear_id);
}
- if (window->action_tag != 0) {
- g_source_remove (window->action_tag);
- }
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
@@ -1574,8 +1571,6 @@ window_update_sidebar_panels_from_preferences (NautilusWindow *window)
if (sidebar_panel != NULL) {
nautilus_window_disconnect_view (window, sidebar_panel);
nautilus_window_remove_sidebar_panel (window, sidebar_panel);
-
- gtk_widget_unref (GTK_WIDGET (sidebar_panel));
}
}
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index fa7ba166b..b37941b9a 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -123,13 +123,10 @@ struct NautilusWindow {
GList *new_sidebar_panels;
GList *error_views;
- enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
-
NautilusNavigationInfo *cancel_tag;
gboolean location_change_end_reached;
- guint action_tag;
- guint16 made_changes, making_changes;
+ guint16 making_changes;
NautilusLocationChangeType location_change_type;
guint location_change_distance;