gtk+ r22181 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22181 - in trunk: . gtk
- Date: Fri, 23 Jan 2009 00:54:23 +0000 (UTC)
Author: federico
Date: Fri Jan 23 00:54:22 2009
New Revision: 22181
URL: http://svn.gnome.org/viewvc/gtk+?rev=22181&view=rev
Log:
Factor out function to discard the loading process and the current folder file
(discard_loading_and_current_folder_file): Factor out function to
cancel the cancellable and discard the current_folder_file,
i.e. to reset the invariant to the "nothing valid is loaded" case.
(gtk_file_chooser_entry_dispose): Use
discard_loading_and_current_folder_file().
(reload_current_folder): Likewise.
(refresh_current_folder_and_file_part): Likewise, and ensure that
the error cases result in the invariant being held.
Signed-off-by: Federico Mena Quintero <federico novell com>
Modified:
trunk/ChangeLog
trunk/gtk/gtkfilechooserentry.c
Modified: trunk/gtk/gtkfilechooserentry.c
==============================================================================
--- trunk/gtk/gtkfilechooserentry.c (original)
+++ trunk/gtk/gtkfilechooserentry.c Fri Jan 23 00:54:22 2009
@@ -269,12 +269,29 @@
}
static void
+discard_loading_and_current_folder_file (GtkFileChooserEntry *chooser_entry)
+{
+ if (chooser_entry->load_folder_cancellable)
+ {
+ g_cancellable_cancel (chooser_entry->load_folder_cancellable);
+ chooser_entry->load_folder_cancellable = NULL;
+ }
+
+ if (chooser_entry->current_folder_file)
+ {
+ g_object_unref (chooser_entry->current_folder_file);
+ chooser_entry->current_folder_file = NULL;
+ }
+}
+
+static void
gtk_file_chooser_entry_dispose (GObject *object)
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (object);
remove_completion_feedback (chooser_entry);
discard_current_folder (chooser_entry);
+ discard_loading_and_current_folder_file (chooser_entry);
if (chooser_entry->start_autocompletion_idle_id != 0)
{
@@ -288,12 +305,6 @@
chooser_entry->completion_store = NULL;
}
- if (chooser_entry->load_folder_cancellable)
- {
- g_cancellable_cancel (chooser_entry->load_folder_cancellable);
- chooser_entry->load_folder_cancellable = NULL;
- }
-
if (chooser_entry->file_system)
{
g_object_unref (chooser_entry->file_system);
@@ -1458,17 +1469,9 @@
{
reload = TRUE;
- /* We changed our current directory. We need to clear out the old
- * directory information.
- */
- if (chooser_entry->load_folder_cancellable)
- {
- g_cancellable_cancel (chooser_entry->load_folder_cancellable);
- chooser_entry->load_folder_cancellable = NULL;
- }
-
discard_current_folder (chooser_entry);
- g_object_unref (chooser_entry->current_folder_file);
+ discard_loading_and_current_folder_file (chooser_entry);
+
chooser_entry->current_folder_file = (folder_file) ? g_object_ref (folder_file) : NULL;
}
}
@@ -1562,8 +1565,16 @@
chooser_entry->file_part = file_part;
chooser_entry->file_part_pos = file_part_pos;
- /* FMQ: this needs to return an error if the folder is not local */
- reload_current_folder (chooser_entry, folder_file, file_part_pos == -1);
+ if (result == REFRESH_OK)
+ {
+ /* FMQ: this needs to return an error if the folder is not local */
+ reload_current_folder (chooser_entry, folder_file, file_part_pos == -1);
+ }
+ else
+ {
+ discard_current_folder (chooser_entry);
+ discard_loading_and_current_folder_file (chooser_entry);
+ }
if (folder_file)
g_object_unref (folder_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]