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
(has_uri_scheme): New function, stolen from the old
gtkfilesystemgnomevfs.c.
(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:
2009-01-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
static void refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry,
RefreshMode refresh_mode);
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);
static void autocomplete (GtkFileChooserEntry *chooser_entry);
static void install_start_autocompletion_idle (GtkFileChooserEntry *chooser_entry);
static void remove_completion_feedback (GtkFileChooserEntry *chooser_entry);
G_OBJECT_CLASS (_gtk_file_chooser_entry_parent_class)->finalize (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);
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)
{
if (chooser_entry->start_autocompletion_idle_id != 0)
{
chooser_entry->load_folder_cancellable = NULL;
}
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);
if (chooser_entry->file_system)
{
g_object_unref (chooser_entry->file_system);
/* Callback when the current folder finishes loading */
static void
/* 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);
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (data);
old_load_complete_action = chooser_entry->load_complete_action;
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)
clear_completions (chooser_entry);
if (old_load_complete_action == LOAD_COMPLETE_EXPLICIT_COMPLETION)
pop_up_completion_feedback (chooser_entry, error->message);
}
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)
}
if (cancelled || error)
/* We changed our current directory. We need to clear out the old
* directory information.
*/
/* 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);
}
g_object_unref (chooser_entry->current_folder_file);
chooser_entry->current_folder_file = g_object_ref (folder_file);
}