gtk+ r22155 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22155 - in trunk: . gtk
- Date: Wed, 21 Jan 2009 03:16:28 +0000 (UTC)
Author: federico
Date: Wed Jan 21 03:16:28 2009
New Revision: 22155
URL: http://svn.gnome.org/viewvc/gtk+?rev=22155&view=rev
Log:
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>
Modified:
trunk/ChangeLog
trunk/gtk/gtkfilechooserentry.c
Modified: trunk/gtk/gtkfilechooserentry.c
==============================================================================
--- trunk/gtk/gtkfilechooserentry.c (original)
+++ trunk/gtk/gtkfilechooserentry.c Wed Jan 21 03:16:28 2009
@@ -145,8 +145,8 @@
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);
@@ -245,11 +245,24 @@
}
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 @@
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 @@
/* 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 @@
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 @@
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 @@
/* 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]