gtk+ r22182 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22182 - in trunk: . gtk
- Date: Fri, 23 Jan 2009 00:54:37 +0000 (UTC)
Author: federico
Date: Fri Jan 23 00:54:37 2009
New Revision: 22182
URL: http://svn.gnome.org/viewvc/gtk+?rev=22182&view=rev
Log:
Pass refresh errors from the very bottom of the loading sequence up to the top
(start_loading_current_folder): Check if the folder to be loaded
is non-native for the local_only=TRUE case; if so, return an error
as we are configured to load only local folders.
(reload_current_folder): Pass on errors from
start_loading_current_folder(). Tighten the preconditions, as we
are sure that we can only receive non-NULL folder-files to load.
(refresh_current_folder_and_file_part): Pass on errors from
reload_current_folder(). At the very end, assert the invariant
described above.
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:37 2009
@@ -1432,19 +1432,24 @@
g_object_unref (cancellable);
}
-static void
+static RefreshStatus
start_loading_current_folder (GtkFileChooserEntry *chooser_entry)
{
- if (chooser_entry->current_folder_file == NULL ||
- chooser_entry->file_system == NULL)
- return;
+ if (chooser_entry->file_system == NULL)
+ return REFRESH_OK;
+
+ g_assert (chooser_entry->current_folder_file != NULL);
+ g_assert (chooser_entry->current_folder == NULL);
+ g_assert (chooser_entry->load_folder_cancellable == NULL);
if (chooser_entry->local_only
&& !g_file_is_native (chooser_entry->current_folder_file))
- return;
+ {
+ g_object_unref (chooser_entry->current_folder_file);
+ chooser_entry->current_folder_file = NULL;
- g_assert (chooser_entry->current_folder == NULL);
- g_assert (chooser_entry->load_folder_cancellable == NULL);
+ return REFRESH_NOT_LOCAL;
+ }
chooser_entry->load_folder_cancellable =
_gtk_file_system_get_folder (chooser_entry->file_system,
@@ -1452,19 +1457,23 @@
"standard::name,standard::display-name,standard::type",
load_directory_get_folder_callback,
g_object_ref (chooser_entry));
+
+ return REFRESH_OK;
}
-static void
+static RefreshStatus
reload_current_folder (GtkFileChooserEntry *chooser_entry,
GFile *folder_file,
gboolean force_reload)
{
gboolean reload = FALSE;
+ g_assert (folder_file != NULL);
+
if (chooser_entry->current_folder_file)
{
- if ((folder_file && !(g_file_equal (folder_file, chooser_entry->current_folder_file)
- && chooser_entry->load_folder_cancellable))
+ if ((!(g_file_equal (folder_file, chooser_entry->current_folder_file)
+ && chooser_entry->load_folder_cancellable))
|| force_reload)
{
reload = TRUE;
@@ -1472,17 +1481,19 @@
discard_current_folder (chooser_entry);
discard_loading_and_current_folder_file (chooser_entry);
- chooser_entry->current_folder_file = (folder_file) ? g_object_ref (folder_file) : NULL;
+ chooser_entry->current_folder_file = g_object_ref (folder_file);
}
}
else
{
- chooser_entry->current_folder_file = (folder_file) ? g_object_ref (folder_file) : NULL;
+ chooser_entry->current_folder_file = g_object_ref (folder_file);
reload = TRUE;
}
if (reload)
- start_loading_current_folder (chooser_entry);
+ return start_loading_current_folder (chooser_entry);
+ else
+ return REFRESH_OK;
}
static RefreshStatus
@@ -1548,6 +1559,8 @@
}
else
{
+ g_assert (folder_file != NULL);
+
file_part_len = strlen (file_part);
total_len = strlen (text);
if (total_len > file_part_len)
@@ -1567,8 +1580,7 @@
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);
+ result = reload_current_folder (chooser_entry, folder_file, file_part_pos == -1);
}
else
{
@@ -1579,6 +1591,17 @@
if (folder_file)
g_object_unref (folder_file);
+ g_assert (/* we are OK and we have a current folder file and (loading process or folder handle)... */
+ ((result == REFRESH_OK)
+ && (chooser_entry->current_folder_file != NULL)
+ && (((chooser_entry->load_folder_cancellable != NULL) && (chooser_entry->current_folder == NULL))
+ || ((chooser_entry->load_folder_cancellable == NULL) && (chooser_entry->current_folder != NULL))))
+ /* ... OR we have an error, and we don't have a current folder file nor a loading process nor a folder handle */
+ || ((result != REFRESH_OK)
+ && (chooser_entry->current_folder_file == NULL)
+ && (chooser_entry->load_folder_cancellable == NULL)
+ && (chooser_entry->current_folder == NULL)));
+
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]