[gnome-builder] sysprof: set current directory to project workdir



commit d3afae8cdb8c16a59a2d0411419e7baf2f3323dd
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 27 19:30:20 2016 -0700

    sysprof: set current directory to project workdir
    
    When using a file dialog to open an existing profile, default
    to the working directory of the project.

 plugins/sysprof/gbp-sysprof-workbench-addin.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/sysprof/gbp-sysprof-workbench-addin.c b/plugins/sysprof/gbp-sysprof-workbench-addin.c
index b3a2f2d..4fd0dab 100644
--- a/plugins/sysprof/gbp-sysprof-workbench-addin.c
+++ b/plugins/sysprof/gbp-sysprof-workbench-addin.c
@@ -240,6 +240,9 @@ open_profile_action (GSimpleAction *action,
   GbpSysprofWorkbenchAddin *self = user_data;
   GtkFileChooserNative *native;
   GtkFileFilter *filter;
+  IdeContext *context;
+  IdeVcs *vcs;
+  GFile *workdir;
   gint ret;
 
   g_assert (GBP_IS_SYSPROF_WORKBENCH_ADDIN (self));
@@ -248,11 +251,16 @@ open_profile_action (GSimpleAction *action,
 
   ide_workbench_set_visible_perspective (self->workbench, IDE_PERSPECTIVE (self->perspective));
 
+  context = ide_workbench_get_context (self->workbench);
+  vcs = ide_context_get_vcs (context);
+  workdir = ide_vcs_get_working_directory (vcs);
+
   native = gtk_file_chooser_native_new (_("Open Profile"),
                                         GTK_WINDOW (self->workbench),
                                         GTK_FILE_CHOOSER_ACTION_OPEN,
                                         _("Open"),
                                         _("Cancel"));
+  gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (native), workdir, NULL);
 
   /* Add our filter for sysprof capture files.  */
   filter = gtk_file_filter_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]