[gnome-builder] workbench: implement save-all action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: implement save-all action
- Date: Sun, 14 Dec 2014 08:40:36 +0000 (UTC)
commit 154499ecd08a0abc0823f9deba51c762888223fe
Author: Christian Hergert <christian hergert me>
Date: Sun Dec 14 00:40:14 2014 -0800
workbench: implement save-all action
src/resources/gtk/menus.ui | 2 +-
src/resources/keybindings/default.ini | 1 +
src/workbench/gb-workbench.c | 25 +++++++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/resources/gtk/menus.ui b/src/resources/gtk/menus.ui
index 8912484..f4e06ea 100644
--- a/src/resources/gtk/menus.ui
+++ b/src/resources/gtk/menus.ui
@@ -59,7 +59,7 @@
<attribute name="id">file-section-2</attribute>
<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/src/resources/keybindings/default.ini b/src/resources/keybindings/default.ini
index 4e664a4..b472ec9 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -9,6 +9,7 @@ go-forward = <Control>I
go-backward = <Control>O
show-command-bar = <Control>space
global-search = <Control>period
+save-all = <Control><Alt>S
[editor]
# I'd like open to not have an accelerator by default eventually. We will move
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index 42ce92e..21a512f 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -418,6 +418,30 @@ on_open (GSimpleAction *action,
}
static void
+on_save_all (GSimpleAction *action,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ GbDocumentManager *manager;
+ GList *list;
+ GList *iter;
+
+ manager = gb_document_manager_get_default ();
+ list = gb_document_manager_get_documents (manager);
+
+ for (iter = list; iter; iter = iter->next)
+ {
+ GbDocument *document = GB_DOCUMENT (iter->data);
+
+ /* This will not save files which do not have location set */
+ if (gb_document_get_modified (document))
+ gb_document_save_async (document, NULL, NULL, NULL);
+ }
+
+ g_list_free (list);
+}
+
+static void
gb_workbench_constructed (GObject *object)
{
static const GActionEntry actions[] = {
@@ -430,6 +454,7 @@ gb_workbench_constructed (GObject *object)
{ "roll-credits", on_roll_credits },
{ "new-document", on_new_document },
{ "open", on_open },
+ { "save-all", on_save_all },
};
GbWorkbenchPrivate *priv;
GbWorkbench *workbench = (GbWorkbench *)object;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]