[gnome-builder/wip/libide-merge] implement save-all
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide-merge] implement save-all
- Date: Sun, 22 Mar 2015 09:25:49 +0000 (UTC)
commit 15c8bb62df406b08243b68d0afd6e0f1a3c287fa
Author: Christian Hergert <christian hergert me>
Date: Sun Mar 22 02:24:53 2015 -0700
implement save-all
data/gtk/menus.ui | 4 ++--
src/workbench/gb-workbench-actions.c | 25 ++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 43ca26f..538efde 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -55,7 +55,7 @@
<section>
<item>
<attribute name="label" translatable="yes">_New Document</attribute>
- <attribute name="action">workspace.new-document</attribute>
+ <attribute name="action">workbench.new-document</attribute>
</item>
</section>
<section>
@@ -67,7 +67,7 @@
<section>
<item>
<attribute name="label" translatable="yes">Save _All</attribute>
- <attribute name="action">win.save-all</attribute>
+ <attribute name="action">workbench.save-all</attribute>
</item>
</section>
<section>
diff --git a/src/workbench/gb-workbench-actions.c b/src/workbench/gb-workbench-actions.c
index e2f42e9..56812a5 100644
--- a/src/workbench/gb-workbench-actions.c
+++ b/src/workbench/gb-workbench-actions.c
@@ -237,6 +237,29 @@ gb_workbench_actions_save_all (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
+ GbWorkbench *self = user_data;
+ IdeBufferManager *buffer_manager;
+ g_autoptr(GPtrArray) ar = NULL;
+ gsize i;
+
+ g_assert (GB_IS_WORKBENCH (self));
+
+ buffer_manager = ide_context_get_buffer_manager (self->context);
+ ar = ide_buffer_manager_get_buffers (buffer_manager);
+
+ for (i = 0; i < ar->len; i++)
+ {
+ IdeBuffer *buffer;
+ IdeFile *file;
+
+ buffer = g_ptr_array_index (ar, i);
+ file = ide_buffer_get_file (buffer);
+
+ if (file == NULL)
+ continue;
+
+ ide_buffer_manager_save_file_async (buffer_manager, buffer, file, NULL, NULL, NULL, NULL);
+ }
}
static void
@@ -303,7 +326,7 @@ static const GActionEntry GbWorkbenchActions[] = {
{ "open", gb_workbench_actions_open },
{ "open-uri-list", gb_workbench_actions_open_uri_list, "as" },
{ "save-all", gb_workbench_actions_save_all },
- { "search-docs", gb_workbench_actions_search_docs, "s" },
+ { "search-docs", gb_workbench_actions_search_docs, "s" },
{ "show-command-bar", gb_workbench_actions_show_command_bar },
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]