Merge lp:~ibelieve/scratch/add_save_as_button into lp:~elementary-apps/scratch/scratch

Proposed by Michael Spencer
Status: Merged
Approved by: Cody Garver
Approved revision: 1358
Merged at revision: 1357
Proposed branch: lp:~ibelieve/scratch/add_save_as_button
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 98 lines (+17/-3)
3 files modified
src/MainWindow.vala (+12/-2)
src/Widgets/ToolBar.vala (+3/-0)
src/scratch-ui.xml (+2/-1)
To merge this branch: bzr merge lp:~ibelieve/scratch/add_save_as_button
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+230364@code.launchpad.net

Commit message

Adds a "Save As" button to the toolbar

Description of the change

Adds a "Save As" button to the toolbar, so a file can be saved with a different file name.

To post a comment you must log in.
Revision history for this message
Michael Spencer (ibelieve) wrote :

I'm unable to trigger the keyboard shortcut "Ctrl+shift+s". I've looked through the code, and can't find code that sets up specific key bindings. Is this just a local bug on my system, or did I miss something?

Revision history for this message
Cody Garver (codygarver) wrote :

ctrl+shift+s IS working for me

Use a real ellipsis, copy and paste this one: …

I think the tooltip should be "Save this file with a different name" because the other tooltips are saying "this file"

review: Needs Fixing
1357. By Michael Spencer

Use a real ellipsis and change the tooltip for save/save as

Revision history for this message
Michael Spencer (ibelieve) wrote :

Ok, I've fixed the things you mentioned.

Revision history for this message
Michael Spencer (ibelieve) wrote :

Actually, I didn't fully fix the tooltip. I only changed "the current file" to "this file".

1358. By Michael Spencer

Change the tooltip for save as

Revision history for this message
Michael Spencer (ibelieve) wrote :

The tooltip now matches your suggestion.

Revision history for this message
Cody Garver (codygarver) wrote :

Very nice!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/MainWindow.vala'
2--- src/MainWindow.vala 2014-08-01 00:11:19 +0000
3+++ src/MainWindow.vala 2014-08-11 18:52:46 +0000
4@@ -188,6 +188,7 @@
5 }
6 // Set actions sensitive property
7 main_actions.get_action ("SaveFile").visible = (!settings.autosave || doc.file == null);
8+ main_actions.get_action ("SaveFileAs").visible = (doc.file != null);
9 doc.check_undoable_actions ();
10 });
11
12@@ -293,6 +294,7 @@
13 this.search_revealer.set_reveal_child (false);
14 // Toolbar Actions
15 main_actions.get_action ("SaveFile").sensitive = val;
16+ main_actions.get_action ("SaveFileAs").sensitive = val;
17 main_actions.get_action ("Undo").sensitive = val;
18 main_actions.get_action ("Redo").sensitive = val;
19 main_actions.get_action ("Revert").sensitive = val;
20@@ -519,6 +521,10 @@
21 this.get_current_document ().save ();
22 }
23
24+ void action_save_as () {
25+ this.get_current_document ().save_as ();
26+ }
27+
28 void action_undo () {
29 this.get_current_document ().undo ();
30 }
31@@ -702,8 +708,12 @@
32 action_open },
33 { "SaveFile", Gtk.Stock.SAVE,
34 /* label, accelerator */ N_("Save"), "<Control>s",
35- /* tooltip */ N_("Save the current file"),
36+ /* tooltip */ N_("Save this file"),
37 action_save },
38+ { "SaveFileAs", Gtk.Stock.SAVE_AS,
39+ /* label, accelerator */ N_("Save As…"), "<Control><shift>s",
40+ /* tooltip */ N_("Save this file with a different name"),
41+ action_save_as },
42 { "Templates", "text-x-generic-template",
43 /* label, accelerator */ N_("Templates"), null,
44 /* tooltip */ N_("Project templates"),
45@@ -739,4 +749,4 @@
46 action_fullscreen }
47 };
48 }
49-}
50+}
51\ No newline at end of file
52
53=== modified file 'src/Widgets/ToolBar.vala'
54--- src/Widgets/ToolBar.vala 2014-04-24 10:46:39 +0000
55+++ src/Widgets/ToolBar.vala 2014-08-11 18:52:46 +0000
56@@ -28,6 +28,7 @@
57 public ToolButton open_button;
58 public ToolButton templates_button;
59 public ToolButton save_button;
60+ public ToolButton save_as_button;
61 public ToolButton revert_button;
62 public ToolButton find_button;
63
64@@ -47,6 +48,7 @@
65 open_button = main_actions.get_action ("Open").create_tool_item() as Gtk.ToolButton;
66 templates_button = main_actions.get_action ("Templates").create_tool_item() as Gtk.ToolButton;
67 save_button = main_actions.get_action ("SaveFile").create_tool_item() as Gtk.ToolButton;
68+ save_as_button = main_actions.get_action ("SaveFileAs").create_tool_item() as Gtk.ToolButton;
69 revert_button = main_actions.get_action ("Revert").create_tool_item() as Gtk.ToolButton;
70 find_button = main_actions.get_action ("Fetch").create_tool_item() as Gtk.ToolButton;
71
72@@ -83,6 +85,7 @@
73 pack_start (open_button);
74 pack_start (templates_button);
75 pack_start (save_button);
76+ pack_start (save_as_button);
77 pack_start (new SeparatorToolItem ());
78 pack_start (revert_button);
79 pack_start (new SeparatorToolItem ());
80
81=== modified file 'src/scratch-ui.xml'
82--- src/scratch-ui.xml 2014-07-07 16:56:48 +0000
83+++ src/scratch-ui.xml 2014-08-11 18:52:46 +0000
84@@ -12,6 +12,7 @@
85 <menuitem name="Open" action="Open"/>
86 <menuitem name="Duplicate" action="Duplicate"/>
87 <menuitem name="SaveFile" action="SaveFile"/>
88+ <menuitem name="SaveFileAs" action="SaveFileAs"/>
89 <menuitem name="Undo" action="Undo"/>
90 <menuitem name="Redo" action="Redo"/>
91 <menuitem action="Templates" />
92@@ -27,4 +28,4 @@
93 <separator />
94 <menuitem action="Preferences" />
95 </popup>
96-</ui>
97+</ui>
98\ No newline at end of file

Subscribers

People subscribed via source and target branches