Merged from HEAD:
2005-10-03 Federico Mena Quintero <federico@ximian.com> Merged from HEAD: Don't reload the current folder unnecessarily on ::map(). * gtk/gtkfilechooserprivate.h (ReloadState): New enum to represent the reloading state. (struct _GtkFileChooserDefault): Added a "reload_state" field. * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): Initialize impl->reload_state. (gtk_file_chooser_default_map): Check the impl->reload_state; load a default folder if no folder has been set, or reload the current one only if we had been unmapped first. (gtk_file_chooser_default_update_current_folder): Set the reload_state to RELOAD_HAS_FOLDER. (gtk_file_chooser_default_unmap): Implement, and set the reload_state to RELOAD_WAS_UNMAPPED. (shortcuts_model_create): Don't call shortcuts_add_bookmarks() here; they'll get (re)loaded on ::map() anyway. * gtk/gtkfilechooserwidget.c (gtk_file_chooser_widget_constructor): Don't set a default folder here. * tests/autotestfilechooser.c (test_action_widgets): Don't take in a dialog; build it ourselves. (test_reload): New test to ensure that we don't load the default folder more than once, and that we reload it when unmapping/remapping. (get_impl_from_dialog): New utility function. (test_widgets_for_current_action): Use get_impl_from_dialog().
This commit is contained in:
committed by
Federico Mena Quintero
parent
8d0574f9cf
commit
55a7c31665
33
ChangeLog
33
ChangeLog
@@ -1,3 +1,36 @@
|
||||
2005-10-03 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
Don't reload the current folder unnecessarily on ::map().
|
||||
|
||||
* gtk/gtkfilechooserprivate.h (ReloadState): New enum to represent
|
||||
the reloading state.
|
||||
(struct _GtkFileChooserDefault): Added a "reload_state" field.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
|
||||
Initialize impl->reload_state.
|
||||
(gtk_file_chooser_default_map): Check the impl->reload_state; load
|
||||
a default folder if no folder has been set, or reload the current
|
||||
one only if we had been unmapped first.
|
||||
(gtk_file_chooser_default_update_current_folder): Set the
|
||||
reload_state to RELOAD_HAS_FOLDER.
|
||||
(gtk_file_chooser_default_unmap): Implement, and set the
|
||||
reload_state to RELOAD_WAS_UNMAPPED.
|
||||
(shortcuts_model_create): Don't call shortcuts_add_bookmarks()
|
||||
here; they'll get (re)loaded on ::map() anyway.
|
||||
|
||||
* gtk/gtkfilechooserwidget.c
|
||||
(gtk_file_chooser_widget_constructor): Don't set a default folder here.
|
||||
|
||||
* tests/autotestfilechooser.c (test_action_widgets): Don't take in
|
||||
a dialog; build it ourselves.
|
||||
(test_reload): New test to ensure that we don't load the default
|
||||
folder more than once, and that we reload it when
|
||||
unmapping/remapping.
|
||||
(get_impl_from_dialog): New utility function.
|
||||
(test_widgets_for_current_action): Use get_impl_from_dialog().
|
||||
|
||||
2005-10-03 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
2005-10-03 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
Merged from HEAD:
|
||||
|
||||
Don't reload the current folder unnecessarily on ::map().
|
||||
|
||||
* gtk/gtkfilechooserprivate.h (ReloadState): New enum to represent
|
||||
the reloading state.
|
||||
(struct _GtkFileChooserDefault): Added a "reload_state" field.
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
|
||||
Initialize impl->reload_state.
|
||||
(gtk_file_chooser_default_map): Check the impl->reload_state; load
|
||||
a default folder if no folder has been set, or reload the current
|
||||
one only if we had been unmapped first.
|
||||
(gtk_file_chooser_default_update_current_folder): Set the
|
||||
reload_state to RELOAD_HAS_FOLDER.
|
||||
(gtk_file_chooser_default_unmap): Implement, and set the
|
||||
reload_state to RELOAD_WAS_UNMAPPED.
|
||||
(shortcuts_model_create): Don't call shortcuts_add_bookmarks()
|
||||
here; they'll get (re)loaded on ::map() anyway.
|
||||
|
||||
* gtk/gtkfilechooserwidget.c
|
||||
(gtk_file_chooser_widget_constructor): Don't set a default folder here.
|
||||
|
||||
* tests/autotestfilechooser.c (test_action_widgets): Don't take in
|
||||
a dialog; build it ourselves.
|
||||
(test_reload): New test to ensure that we don't load the default
|
||||
folder more than once, and that we reload it when
|
||||
unmapping/remapping.
|
||||
(get_impl_from_dialog): New utility function.
|
||||
(test_widgets_for_current_action): Use get_impl_from_dialog().
|
||||
|
||||
2005-10-03 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
||||
@@ -152,6 +152,12 @@ typedef enum {
|
||||
LOAD_FINISHED /* Model is fully loaded and inserted into the tree */
|
||||
} LoadState;
|
||||
|
||||
typedef enum {
|
||||
RELOAD_EMPTY, /* No folder has been set */
|
||||
RELOAD_HAS_FOLDER, /* We have a folder, although it may not be completely loaded yet; no need to reload */
|
||||
RELOAD_WAS_UNMAPPED /* We had a folder but got unmapped; reload is needed */
|
||||
} ReloadState;
|
||||
|
||||
#define MAX_LOADING_TIME 500
|
||||
|
||||
struct _GtkFileChooserDefaultClass
|
||||
@@ -206,6 +212,7 @@ struct _GtkFileChooserDefault
|
||||
GtkTreeModelSort *sort_model;
|
||||
|
||||
LoadState load_state;
|
||||
ReloadState reload_state;
|
||||
guint load_timeout_id;
|
||||
|
||||
GSList *pending_select_paths;
|
||||
@@ -373,6 +380,7 @@ static void gtk_file_chooser_default_get_property (GObject *ob
|
||||
static void gtk_file_chooser_default_dispose (GObject *object);
|
||||
static void gtk_file_chooser_default_show_all (GtkWidget *widget);
|
||||
static void gtk_file_chooser_default_map (GtkWidget *widget);
|
||||
static void gtk_file_chooser_default_unmap (GtkWidget *widget);
|
||||
static void gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel);
|
||||
static void gtk_file_chooser_default_style_set (GtkWidget *widget,
|
||||
@@ -615,6 +623,7 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
|
||||
|
||||
widget_class->show_all = gtk_file_chooser_default_show_all;
|
||||
widget_class->map = gtk_file_chooser_default_map;
|
||||
widget_class->unmap = gtk_file_chooser_default_unmap;
|
||||
widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
|
||||
widget_class->style_set = gtk_file_chooser_default_style_set;
|
||||
widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
|
||||
@@ -745,6 +754,7 @@ gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
|
||||
impl->show_hidden = FALSE;
|
||||
impl->icon_size = FALLBACK_ICON_SIZE;
|
||||
impl->load_state = LOAD_EMPTY;
|
||||
impl->reload_state = RELOAD_EMPTY;
|
||||
impl->pending_select_paths = NULL;
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (impl), 12);
|
||||
@@ -1862,7 +1872,6 @@ shortcuts_model_create (GtkFileChooserDefault *impl)
|
||||
shortcuts_append_home (impl);
|
||||
shortcuts_append_desktop (impl);
|
||||
shortcuts_add_volumes (impl);
|
||||
shortcuts_add_bookmarks (impl);
|
||||
}
|
||||
|
||||
impl->shortcuts_filter_model = shortcuts_model_filter_new (impl,
|
||||
@@ -4746,6 +4755,7 @@ static void
|
||||
gtk_file_chooser_default_map (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserDefault *impl;
|
||||
char *current_working_dir;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
@@ -4753,10 +4763,29 @@ gtk_file_chooser_default_map (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->map (widget);
|
||||
|
||||
if (impl->current_folder)
|
||||
switch (impl->reload_state)
|
||||
{
|
||||
case RELOAD_EMPTY:
|
||||
/* The user didn't explicitly give us a folder to display, so we'll use the cwd */
|
||||
current_working_dir = g_get_current_dir ();
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (impl), current_working_dir);
|
||||
g_free (current_working_dir);
|
||||
break;
|
||||
|
||||
case RELOAD_HAS_FOLDER:
|
||||
/* Nothing; we are already loading or loaded, so we don't need to reload */
|
||||
break;
|
||||
|
||||
case RELOAD_WAS_UNMAPPED:
|
||||
/* Just reload the current folder */
|
||||
g_assert (impl->current_folder != NULL);
|
||||
|
||||
pending_select_paths_store_selection (impl);
|
||||
change_folder_and_display_error (impl, impl->current_folder);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
bookmarks_changed_cb (impl->file_system, impl);
|
||||
@@ -4764,6 +4793,19 @@ gtk_file_chooser_default_map (GtkWidget *widget)
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* GtkWidget::unmap method */
|
||||
static void
|
||||
gtk_file_chooser_default_unmap (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserDefault *impl;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
||||
|
||||
impl->reload_state = RELOAD_WAS_UNMAPPED;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
list_model_filter_func (GtkFileSystemModel *model,
|
||||
GtkFilePath *path,
|
||||
@@ -5369,6 +5411,8 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
|
||||
gtk_file_path_free (impl->current_folder);
|
||||
|
||||
impl->current_folder = gtk_file_path_copy (path);
|
||||
|
||||
impl->reload_state = RELOAD_HAS_FOLDER;
|
||||
}
|
||||
|
||||
/* Update the widgets that may trigger a folder change themselves. */
|
||||
|
||||
@@ -144,7 +144,6 @@ gtk_file_chooser_widget_constructor (GType type,
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv;
|
||||
GObject *object;
|
||||
gchar *current_folder;
|
||||
|
||||
object = parent_class->constructor (type,
|
||||
n_construct_properties,
|
||||
@@ -158,10 +157,6 @@ gtk_file_chooser_widget_constructor (GType type,
|
||||
gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->impl);
|
||||
|
||||
current_folder = g_get_current_dir ();
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->impl), current_folder);
|
||||
g_free (current_folder);
|
||||
|
||||
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
|
||||
GTK_FILE_CHOOSER (priv->impl));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user