[gnome-builder] workbench: implemnt save-all action



commit 0cfb57b440925af989b787e8a6dfbe98ba64b836
Author: Christian Hergert <chergert redhat com>
Date:   Fri Dec 4 01:54:43 2015 -0800

    workbench: implemnt save-all action

 data/gtk/menus.ui              |    2 +-
 libide/ide-workbench-actions.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index c7b4537..a5924f6 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -79,7 +79,7 @@
     <section>
       <item>
         <attribute name="label" translatable="yes">Save _All</attribute>
-        <attribute name="action">workbench.save-all</attribute>
+        <attribute name="action">win.save-all</attribute>
       </item>
     </section>
     <section>
diff --git a/libide/ide-workbench-actions.c b/libide/ide-workbench-actions.c
index 2ecb82b..ba6cbd1 100644
--- a/libide/ide-workbench-actions.c
+++ b/libide/ide-workbench-actions.c
@@ -20,6 +20,7 @@
 
 #include <glib/gi18n.h>
 
+#include "ide-buffer-manager.h"
 #include "ide-debug.h"
 #include "ide-workbench.h"
 #include "ide-workbench-private.h"
@@ -95,12 +96,32 @@ ide_workbench_actions_open_with_dialog (GSimpleAction *action,
   IDE_EXIT;
 }
 
+static void
+ide_workbench_actions_save_all (GSimpleAction *action,
+                                GVariant      *variant,
+                                gpointer       user_data)
+{
+  IdeWorkbench *workbench = user_data;
+  IdeContext *context;
+  IdeBufferManager *bufmgr;
+
+  g_assert (IDE_IS_WORKBENCH (workbench));
+
+  context = ide_workbench_get_context (workbench);
+  if (context == NULL)
+    return;
+
+  bufmgr = ide_context_get_buffer_manager (context);
+  ide_buffer_manager_save_all_async (bufmgr, NULL, NULL, NULL);
+}
+
 void
 ide_workbench_actions_init (IdeWorkbench *self)
 {
   GPropertyAction *action;
   const GActionEntry actions[] = {
     { "open-with-dialog", ide_workbench_actions_open_with_dialog },
+    { "save-all", ide_workbench_actions_save_all },
   };
 
   g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), self);


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