Revert the patch to #137520, as 2.4.1 is for conservative bug fixes only.

2004-03-19  Federico Mena Quintero  <federico@ximian.com>

	* Revert the patch to #137520, as 2.4.1 is for conservative bug
	fixes only.  The patch is attached to the bug report, for
	reference.

2004-03-19  Morten Welinder  <terra@gnome.org>

	* gtk/gtkfilechooserdefault.c
This commit is contained in:
Federico Mena Quintero 2004-03-19 21:16:24 +00:00 committed by Federico Mena Quintero
parent f1c18d57d6
commit da83c1cbf3
10 changed files with 66 additions and 173 deletions

View File

@ -1,3 +1,9 @@
2004-03-19 Federico Mena Quintero <federico@ximian.com>
* Revert the patch to #137520, as 2.4.1 is for conservative bug
fixes only. The patch is attached to the bug report, for
reference.
2004-03-19 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,9 @@
2004-03-19 Federico Mena Quintero <federico@ximian.com>
* Revert the patch to #137520, as 2.4.1 is for conservative bug
fixes only. The patch is attached to the bug report, for
reference.
2004-03-19 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,9 @@
2004-03-19 Federico Mena Quintero <federico@ximian.com>
* Revert the patch to #137520, as 2.4.1 is for conservative bug
fixes only. The patch is attached to the bug report, for
reference.
2004-03-19 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,9 @@
2004-03-19 Federico Mena Quintero <federico@ximian.com>
* Revert the patch to #137520, as 2.4.1 is for conservative bug
fixes only. The patch is attached to the bug report, for
reference.
2004-03-19 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,9 @@
2004-03-19 Federico Mena Quintero <federico@ximian.com>
* Revert the patch to #137520, as 2.4.1 is for conservative bug
fixes only. The patch is attached to the bug report, for
reference.
2004-03-19 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c

View File

@ -664,25 +664,19 @@ error_message_with_parent (GtkWindow *parent,
gtk_widget_destroy (dialog);
}
/* Returns a toplevel GtkWindow, or NULL if none */
static GtkWindow *
get_toplevel (GtkWidget *widget)
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
if (!GTK_WIDGET_TOPLEVEL (toplevel))
return NULL;
else
return GTK_WINDOW (toplevel);
}
/* Shows an error dialog for the file chooser */
static void
error_message (GtkFileChooserDefault *impl,
const char *msg)
{
error_message_with_parent (get_toplevel (GTK_WIDGET (impl)), msg);
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl));
if (!GTK_WIDGET_TOPLEVEL (toplevel))
toplevel = NULL;
error_message_with_parent (toplevel ? GTK_WINDOW (toplevel) : NULL,
msg);
}
/* Shows a simple error dialog relative to a path. Frees the GError as well. */
@ -2562,15 +2556,21 @@ trap_activate_cb (GtkWidget *widget,
|| event->keyval == GDK_KP_Enter
|| event->keyval == GDK_space)
{
GtkWindow *window;
GtkWidget *toplevel;
window = get_toplevel (widget);
if (window
&& widget != window->default_widget
&& !(widget == window->focus_widget &&
(!window->default_widget || !GTK_WIDGET_SENSITIVE (window->default_widget))))
gtk_window_activate_default (window);
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (toplevel))
{
GtkWindow *window;
window = GTK_WINDOW (toplevel);
if (window &&
widget != window->default_widget &&
!(widget == window->focus_widget &&
(!window->default_widget || !GTK_WIDGET_SENSITIVE (window->default_widget))))
gtk_window_activate_default (window);
}
return TRUE;
}
return FALSE;
@ -3602,40 +3602,6 @@ list_sort_column_changed_cb (GtkTreeSortable *sortable,
impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
}
static void
set_busy_cursor (GtkFileChooserDefault *impl,
gboolean busy)
{
GtkWindow *toplevel;
GdkDisplay *display;
GdkCursor *cursor;
toplevel = get_toplevel (GTK_WIDGET (impl));
if (!toplevel || !GTK_WIDGET_REALIZED (toplevel))
return;
display = gtk_widget_get_display (GTK_WIDGET (toplevel));
if (busy)
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
else
cursor = NULL;
gdk_window_set_cursor (GTK_WIDGET (toplevel)->window, cursor);
gdk_display_flush (display);
if (cursor)
gdk_cursor_unref (cursor);
}
/* Callback used when the file system model finishes loading */
static void
browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
GtkFileChooserDefault *impl)
{
set_busy_cursor (impl, FALSE);
}
/* Gets rid of the old list model and creates a new one for the current folder */
static void
set_list_model (GtkFileChooserDefault *impl)
@ -3646,14 +3612,9 @@ set_list_model (GtkFileChooserDefault *impl)
g_object_unref (impl->sort_model);
}
set_busy_cursor (impl, TRUE);
impl->browse_files_model = _gtk_file_system_model_new (impl->file_system,
impl->current_folder, 0,
GTK_FILE_INFO_ALL);
g_signal_connect (impl->browse_files_model, "finished-loading",
G_CALLBACK (browse_files_model_finished_loading_cb), impl);
_gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
switch (impl->action)
{
@ -5036,7 +4997,7 @@ static void
location_popup_handler (GtkFileChooserDefault *impl)
{
GtkWidget *dialog;
GtkWindow *toplevel;
GtkWidget *toplevel;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *entry;
@ -5045,7 +5006,9 @@ location_popup_handler (GtkFileChooserDefault *impl)
/* Create dialog */
toplevel = get_toplevel (GTK_WIDGET (impl));
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl));
if (!GTK_WIDGET_TOPLEVEL (toplevel))
toplevel = NULL;
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
|| impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
@ -5060,7 +5023,7 @@ location_popup_handler (GtkFileChooserDefault *impl)
}
dialog = gtk_dialog_new_with_buttons (title,
toplevel,
GTK_WINDOW (toplevel),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@ -5108,11 +5071,11 @@ location_popup_handler (GtkFileChooserDefault *impl)
if (refocus)
{
GtkWindow *toplevel;
GtkWidget *toplevel;
toplevel = get_toplevel (GTK_WIDGET (impl));
if (toplevel && toplevel->focus_widget)
gtk_widget_grab_focus (toplevel->focus_widget);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl));
if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_WINDOW (toplevel)->focus_widget)
gtk_widget_grab_focus (GTK_WINDOW (toplevel)->focus_widget);
}
gtk_widget_destroy (dialog);

View File

@ -838,13 +838,6 @@ 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;
}
@ -883,17 +876,6 @@ 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 *

View File

@ -307,10 +307,6 @@ struct _GtkFileFolderIface
GSList *paths);
void (*files_removed) (GtkFileFolder *monitor,
GSList *paths);
/* Method / signal */
gboolean (*is_finished_loading) (GtkFileFolder *folder);
void (*finished_loading) (GtkFileFolder *folder);
};
GType gtk_file_folder_get_type (void);
@ -321,8 +317,6 @@ GtkFileInfo *gtk_file_folder_get_info (GtkFileFolder *folder,
const GtkFilePath *path,
GError **error);
gboolean gtk_file_folder_is_finished_loading (GtkFileFolder *folder);
/* GtkFilePath */
#define GTK_TYPE_FILE_PATH (gtk_file_path_get_type ())

View File

@ -24,7 +24,6 @@
#include "gtkfilesystemmodel.h"
#include "gtkfilesystem.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtktreednd.h"
#include "gtktreemodel.h"
@ -38,10 +37,6 @@ typedef struct _FileModelNode FileModelNode;
struct _GtkFileSystemModelClass
{
GObjectClass parent_class;
/* Signals */
void (*finished_loading) (GtkFileSystemModel *model);
};
struct _GtkFileSystemModel
@ -59,7 +54,6 @@ struct _GtkFileSystemModel
GSList *idle_clears;
GSource *idle_clear_source;
GSource *idle_finished_loading_source;
gushort max_depth;
@ -192,16 +186,6 @@ static void root_files_removed_callback (GtkFileFolder *folder,
static GObjectClass *parent_class = NULL;
/* Signal IDs */
enum {
FINISHED_LOADING,
LAST_SIGNAL
};
static guint file_system_model_signals[LAST_SIGNAL] = { 0 };
GType
_gtk_file_system_model_get_type (void)
{
@ -258,15 +242,6 @@ gtk_file_system_model_class_init (GtkFileSystemModelClass *class)
parent_class = g_type_class_peek_parent (class);
gobject_class->finalize = gtk_file_system_model_finalize;
file_system_model_signals[FINISHED_LOADING] =
g_signal_new ("finished-loading",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileSystemModelClass, finished_loading),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
@ -311,9 +286,6 @@ gtk_file_system_model_finalize (GObject *object)
if (model->file_system)
g_object_unref (model->file_system);
if (model->idle_finished_loading_source)
g_source_destroy (model->idle_finished_loading_source);
children = model->roots;
while (children)
{
@ -675,39 +647,6 @@ drag_source_drag_data_get (GtkTreeDragSource *drag_source,
return TRUE;
}
/* Callback used when the root folder finished loading */
static void
root_folder_finished_loading_cb (GtkFileFolder *folder,
GtkFileSystemModel *model)
{
g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0);
}
/* Emits the "finished-loading" signal as an idle handler; see the comment in
* _gtk_file_system_model_new()
*/
static gboolean
idle_finished_loading_cb (GtkFileSystemModel *model)
{
g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0);
g_source_destroy (model->idle_finished_loading_source);
model->idle_finished_loading_source = NULL;
return FALSE;
}
/* Queues an idle handler to emit the "finished-loading" signal */
static void
queue_finished_loading (GtkFileSystemModel *model)
{
model->idle_finished_loading_source = g_idle_source_new ();
g_source_set_closure (model->idle_finished_loading_source,
g_cclosure_new_object (G_CALLBACK (idle_finished_loading_cb),
G_OBJECT (model)));
g_source_attach (model->idle_finished_loading_source, NULL);
}
/**
* _gtk_file_system_model_new:
* @file_system: an object implementing #GtkFileSystem
@ -760,19 +699,13 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
model->types,
NULL); /* NULL-GError */
if (model->root_folder)
if (model->root_folder &&
gtk_file_folder_list_children (model->root_folder,
&child_paths,
NULL)) /* NULL-GError */
{
if (gtk_file_folder_list_children (model->root_folder,
&child_paths,
NULL)) /* NULL-GError */
roots = child_paths;
if (gtk_file_folder_is_finished_loading (model->root_folder))
queue_finished_loading (model); /* done in an idle because we are being created */
else
g_signal_connect (model->root_folder, "finished-loading",
G_CALLBACK (root_folder_finished_loading_cb), model);
roots = child_paths;
g_signal_connect_object (model->root_folder, "deleted",
G_CALLBACK (root_deleted_callback), model, 0);
g_signal_connect_object (model->root_folder, "files-added",

View File

@ -203,8 +203,6 @@ static gboolean gtk_file_folder_unix_list_children (GtkFileFolder *folder,
GSList **children,
GError **error);
static gboolean gtk_file_folder_unix_is_finished_loading (GtkFileFolder *folder);
static GtkFilePath *filename_to_path (const gchar *filename);
static gboolean filename_is_root (const char *filename);
@ -1466,7 +1464,6 @@ gtk_file_folder_unix_iface_init (GtkFileFolderIface *iface)
{
iface->get_info = gtk_file_folder_unix_get_info;
iface->list_children = gtk_file_folder_unix_list_children;
iface->is_finished_loading = gtk_file_folder_unix_is_finished_loading;
}
static void
@ -1626,12 +1623,6 @@ gtk_file_folder_unix_list_children (GtkFileFolder *folder,
return TRUE;
}
static gboolean
gtk_file_folder_unix_is_finished_loading (GtkFileFolder *folder)
{
/* Since we don't do asynchronous loads, we are always finished loading */
return TRUE;
}
static void
free_stat_info_entry (struct stat_info_entry *entry)