forked from AuroraMiddleware/gtk
filechooserwidget: Create recent manager when setting operation mode
Creating a recent manager can be fairly expensive and we won't use it if the widget is not visible or the recent mode has not been entered. Code other places can already handle a NULL recent manager, so just create it when entering the recent mode. And shove 25ms of startup time off the widget-factory this way.
This commit is contained in:
parent
f4c4fe860b
commit
4c28ee80a6
@ -3150,6 +3150,9 @@ operation_mode_set_recent (GtkFileChooserWidget *impl)
|
||||
GFile *file;
|
||||
GtkRevealerTransitionType old_revealer_transition_type;
|
||||
|
||||
if (!priv->recent_manager)
|
||||
priv->recent_manager = gtk_recent_manager_get_default ();
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "pathbar");
|
||||
|
||||
@ -6812,6 +6815,10 @@ add_selection_to_recent_list (GtkFileChooserWidget *impl)
|
||||
|
||||
files = gtk_file_chooser_widget_get_files (GTK_FILE_CHOOSER (impl));
|
||||
|
||||
|
||||
if (!priv->recent_manager)
|
||||
priv->recent_manager = gtk_recent_manager_get_default ();
|
||||
|
||||
for (l = files; l; l = l->next)
|
||||
{
|
||||
GFile *file = l->data;
|
||||
@ -8640,7 +8647,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
priv->operation_mode = OPERATION_MODE_BROWSE;
|
||||
priv->sort_column = MODEL_COL_NAME;
|
||||
priv->sort_order = GTK_SORT_ASCENDING;
|
||||
priv->recent_manager = gtk_recent_manager_get_default ();
|
||||
priv->create_folders = TRUE;
|
||||
priv->auto_selecting_first_row = FALSE;
|
||||
priv->renamed_file = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user