[gnome-builder] gui: add "workbench.reload-files" action



commit 484c1d6b2b18b91ebc39cfd5cc1a66e6085d42b3
Author: Christian Hergert <chergert redhat com>
Date:   Mon Feb 3 09:58:30 2020 -0800

    gui: add "workbench.reload-files" action
    
    This new GAction will request files to be reloaded by the buffer manager.
    There currently is no UI element to map to this, but it can easily be activated
    using the command bar (Control+Enter) and activating the "reload-files" action.
    
    Fixes #1136

 src/libide/gui/ide-workbench.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 430c301d4..3002274c4 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -124,11 +124,14 @@ static void ide_workbench_action_object_tree (IdeWorkbench *self,
                                               GVariant     *param);
 static void ide_workbench_action_inspector   (IdeWorkbench *self,
                                               GVariant     *param);
+static void ide_workbench_action_reload_all  (IdeWorkbench *self,
+                                              GVariant     *param);
 
 
 DZL_DEFINE_ACTION_GROUP (IdeWorkbench, ide_workbench, {
   { "close", ide_workbench_action_close },
   { "open", ide_workbench_action_open },
+  { "reload-files", ide_workbench_action_reload_all },
   { "-inspector", ide_workbench_action_inspector },
   { "-object-tree", ide_workbench_action_object_tree },
   { "-dump-tasks", ide_workbench_action_dump_tasks },
@@ -1404,6 +1407,21 @@ ide_workbench_action_close (IdeWorkbench *self,
                                 NULL);
 }
 
+static void
+ide_workbench_action_reload_all (IdeWorkbench *self,
+                                 GVariant     *param)
+{
+  IdeBufferManager *bufmgr;
+  IdeContext *context;
+
+  g_assert (IDE_IS_WORKBENCH (self));
+  g_assert (param == NULL);
+
+  context = ide_workbench_get_context (self);
+  bufmgr = ide_buffer_manager_from_context (context);
+  ide_buffer_manager_reload_all_async (bufmgr, NULL, NULL, NULL);
+}
+
 static void
 ide_workbench_action_open (IdeWorkbench *self,
                            GVariant     *param)


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