[gtk/wip/baedert/for-master] filechooserwidget: Create recent manager when setting operation mode
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master] filechooserwidget: Create recent manager when setting operation mode
- Date: Fri, 30 Aug 2019 05:49:59 +0000 (UTC)
commit 07b590349a50ebb9ace8bbc7732562ebc0e9c55b
Author: Timm Bäder <mail baedert org>
Date: Fri Aug 30 07:37:55 2019 +0200
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.
gtk/gtkfilechooserwidget.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index f2bc4b2b12..0e89b4cb53 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -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");
@@ -8640,7 +8643,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]