forked from AuroraMiddleware/gtk
Factor out code to discard the current_folder
Patch by Carlos Garnacho <carlos@imendio.com>: * gtk/gtkfilechooserentry.c (discard_current_folder): New function, factored out for when we need to get rid of the current_folder. (gtk_file_chooser_entry_dispose): Use discard_current_folder(). (finished_loading_cb): Fix prototype. (load_directory_get_folder_callback): Discard the completion store, as well as clearing the completion feedback, if we find an error while loading the folder. Also, use discard_current_folder(). (reload_current_folder): Use discard_current_folder(). Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=22155
This commit is contained in:
parent
9f62525f2b
commit
92ec0276fc
13
ChangeLog
13
ChangeLog
@ -8,6 +8,19 @@
|
||||
(has_uri_scheme): New function, stolen from the old
|
||||
gtkfilesystemgnomevfs.c.
|
||||
|
||||
Patch by Carlos Garnacho <carlos@imendio.com>:
|
||||
|
||||
* gtk/gtkfilechooserentry.c (discard_current_folder): New
|
||||
function, factored out for when we need to get rid of the
|
||||
current_folder.
|
||||
(gtk_file_chooser_entry_dispose): Use discard_current_folder().
|
||||
(finished_loading_cb): Fix prototype.
|
||||
(load_directory_get_folder_callback): Discard the completion
|
||||
store, as well as clearing the completion feedback, if we find an
|
||||
error while loading the folder. Also, use
|
||||
discard_current_folder().
|
||||
(reload_current_folder): Use discard_current_folder().
|
||||
|
||||
2009-01-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
|
@ -145,8 +145,8 @@ typedef enum {
|
||||
|
||||
static void refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry,
|
||||
RefreshMode refresh_mode);
|
||||
static void finished_loading_cb (GFile *file,
|
||||
gpointer data);
|
||||
static void finished_loading_cb (GtkFolder *folder,
|
||||
gpointer data);
|
||||
static void autocomplete (GtkFileChooserEntry *chooser_entry);
|
||||
static void install_start_autocompletion_idle (GtkFileChooserEntry *chooser_entry);
|
||||
static void remove_completion_feedback (GtkFileChooserEntry *chooser_entry);
|
||||
@ -244,12 +244,25 @@ gtk_file_chooser_entry_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (_gtk_file_chooser_entry_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
discard_current_folder (GtkFileChooserEntry *chooser_entry)
|
||||
{
|
||||
if (chooser_entry->current_folder)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (chooser_entry->current_folder,
|
||||
G_CALLBACK (finished_loading_cb), chooser_entry);
|
||||
g_object_unref (chooser_entry->current_folder);
|
||||
chooser_entry->current_folder = 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);
|
||||
|
||||
if (chooser_entry->start_autocompletion_idle_id != 0)
|
||||
{
|
||||
@ -269,14 +282,6 @@ gtk_file_chooser_entry_dispose (GObject *object)
|
||||
chooser_entry->load_folder_cancellable = NULL;
|
||||
}
|
||||
|
||||
if (chooser_entry->current_folder)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (chooser_entry->current_folder,
|
||||
G_CALLBACK (finished_loading_cb), chooser_entry);
|
||||
g_object_unref (chooser_entry->current_folder);
|
||||
chooser_entry->current_folder = NULL;
|
||||
}
|
||||
|
||||
if (chooser_entry->file_system)
|
||||
{
|
||||
g_object_unref (chooser_entry->file_system);
|
||||
@ -1292,8 +1297,8 @@ finish_folder_load (GtkFileChooserEntry *chooser_entry)
|
||||
|
||||
/* Callback when the current folder finishes loading */
|
||||
static void
|
||||
finished_loading_cb (GFile *file,
|
||||
gpointer data)
|
||||
finished_loading_cb (GtkFolder *folder,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (data);
|
||||
|
||||
@ -1321,6 +1326,7 @@ load_directory_get_folder_callback (GCancellable *cancellable,
|
||||
|
||||
old_load_complete_action = chooser_entry->load_complete_action;
|
||||
|
||||
discard_completion_store (chooser_entry);
|
||||
clear_completions (chooser_entry);
|
||||
|
||||
if (old_load_complete_action == LOAD_COMPLETE_EXPLICIT_COMPLETION)
|
||||
@ -1331,11 +1337,7 @@ load_directory_get_folder_callback (GCancellable *cancellable,
|
||||
pop_up_completion_feedback (chooser_entry, error->message);
|
||||
}
|
||||
|
||||
if (chooser_entry->current_folder)
|
||||
{
|
||||
g_object_unref (chooser_entry->current_folder);
|
||||
chooser_entry->current_folder = NULL;
|
||||
}
|
||||
discard_current_folder (chooser_entry);
|
||||
}
|
||||
|
||||
if (cancelled || error)
|
||||
@ -1392,18 +1394,13 @@ reload_current_folder (GtkFileChooserEntry *chooser_entry,
|
||||
/* We changed our current directory. We need to clear out the old
|
||||
* directory information.
|
||||
*/
|
||||
if (chooser_entry->current_folder)
|
||||
{
|
||||
if (chooser_entry->load_folder_cancellable)
|
||||
{
|
||||
g_cancellable_cancel (chooser_entry->load_folder_cancellable);
|
||||
chooser_entry->load_folder_cancellable = NULL;
|
||||
}
|
||||
|
||||
g_object_unref (chooser_entry->current_folder);
|
||||
chooser_entry->current_folder = NULL;
|
||||
}
|
||||
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);
|
||||
chooser_entry->current_folder_file = g_object_ref (folder_file);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user