From 68030a7ee783af6a1e4279b16ba581a4a55ca014 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 19 Mar 2004 19:41:06 +0000 Subject: Fix #137520. 2004-03-19 Federico Mena Quintero Fix #137520. * gtk/gtkfilesystem.h (struct _GtkFileFolderIface): Added slots for an ::is_finished_loading() method and a ::finished_loading() signal at the end of the struct. * gtk/gtkfilesystem.c (gtk_file_folder_base_init): Create the "finished-loading" signal. (gtk_file_folder_is_finished_loading): New function. * gtk/gtkfilesystemunix.c (gtk_file_folder_unix_is_finished_loading): Implement. * gtk/gtkfilesystemmodel.c (struct _GtkFileSystemModelClass): New slot for a "finished-loading" signal. (gtk_file_system_model_class_init): Create the "finished-loading" signal. (struct _GtkFileSystemModel): New field idle_finished_loading_source. We emit the "finished-loading" signal in an idle if the root folder was done loading right in _gtk_file_system_model_new(), so that the caller has a chance to connect to the signal. (_gtk_file_system_model_new): Connect to the normal signals of the folder even if the initial _list_children() fails. Also, see if the folder is finished loading; connect to the "finished-loading" signal otherwise. (gtk_file_system_model_finalize): Remove the idle handler. * gtk/gtkfilechooserdefault.c (set_list_model): Set a busy cursor and connect to the model's "finished-loading" signal. (get_toplevel): New helper function. (error_message): Use get_toplevel(). (trap_activate_cb): Likewise. (location_popup_handler): Likewise. (set_busy_cursor): New function. (browse_files_model_finished_loading_cb): New callback. --- gtk/gtkfilesystem.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gtk/gtkfilesystem.c') diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 4f176f6fe..af5f537e6 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -838,6 +838,13 @@ gtk_file_folder_base_init (gpointer g_class) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + g_signal_new ("finished-loading", + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkFileFolderIface, finished_loading), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); initialized = TRUE; } @@ -876,6 +883,17 @@ gtk_file_folder_get_info (GtkFileFolder *folder, return GTK_FILE_FOLDER_GET_IFACE (folder)->get_info (folder, path, error); } +gboolean +gtk_file_folder_is_finished_loading (GtkFileFolder *folder) +{ + g_return_val_if_fail (GTK_IS_FILE_FOLDER (folder), TRUE); + + if (!GTK_FILE_FOLDER_GET_IFACE (folder)->is_finished_loading) + return TRUE; + else + return GTK_FILE_FOLDER_GET_IFACE (folder)->is_finished_loading (folder); +} + /***************************************** * GtkFilePath modules * -- cgit v1.2.1