Merge lp:~artem-anufrij/scratch/Bugfix-1200522 into lp:~elementary-apps/scratch/scratch

Proposed by Artem Anufrij
Status: Superseded
Proposed branch: lp:~artem-anufrij/scratch/Bugfix-1200522
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 149 lines (+27/-17)
3 files modified
plugins/filemanager/FileManagerPlugin.vala (+13/-13)
plugins/filemanager/FileView.vala (+13/-3)
plugins/terminal/terminal.vala (+1/-1)
To merge this branch: bzr merge lp:~artem-anufrij/scratch/Bugfix-1200522
Reviewer Review Type Date Requested Status
Artem Anufrij (community) Approve
Danielle Foré Needs Fixing
Review via email: mp+240185@code.launchpad.net

Description of the change

'save as' opens automatically location highlighted in the File Browser plugin

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

This doesn't seem to work as expected. I'm still getting the folder Scratch was launched from in the Save dialog regardless of the expanded folders or selected file in the file manager plugin

review: Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

@Dan:
Have you tested it with file manager, or folder manager? File manager works fine....

Revision history for this message
Danielle Foré (danrabbit) wrote :

File manager. I tried running from the directory and installed.

1402. By artem-anufrij

commit

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Mysterious.

I pushed once again the code...

This is the workflow on my system:

https://launchpadlibrarian.net/188886936/Screencast%202014-11-01%2022%3A20%3A38.mp4

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Dan, could you try again?

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Please review

review: Needs Resubmitting
Revision history for this message
Artem Anufrij (artem-anufrij) :
review: Approve
Revision history for this message
Artem Anufrij (artem-anufrij) :
review: Approve

Unmerged revisions

1402. By artem-anufrij

commit

1401. By artem-anufrij

'save as' opens automatically location highlighted in the File Browser plugin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/filemanager/FileManagerPlugin.vala'
2--- plugins/filemanager/FileManagerPlugin.vala 2014-04-13 16:15:35 +0000
3+++ plugins/filemanager/FileManagerPlugin.vala 2014-11-01 21:23:31 +0000
4@@ -22,10 +22,10 @@
5 public const string DESCRIPTION = N_("Basic folder manager with file browsing");
6
7 namespace Scratch.Plugins {
8-
9+
10 public class FileManagerPlugin : Peas.ExtensionBase, Peas.Activatable {
11 public Scratch.Services.Interface plugins;
12-
13+
14 Gtk.Box box;
15 FileManager.FileView view;
16
17@@ -51,9 +51,9 @@
18 void on_hook_sidebar (Gtk.Notebook notebook) {
19 if (view != null)
20 return;
21-
22+
23 box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
24-
25+
26 // File View
27 view = new FileManager.FileView ();
28
29@@ -61,12 +61,12 @@
30 var file = GLib.File.new_for_path (a);
31 plugins.open_file (file);
32 });
33-
34+
35 // Toolbar
36 var toolbar = new Gtk.Toolbar ();
37 toolbar.set_icon_size (Gtk.IconSize.SMALL_TOOLBAR);
38 toolbar.get_style_context ().add_class ("inline-toolbar");
39-
40+
41 var parent = new Gtk.ToolButton (null, null);
42 parent.tooltip_text = _("Go to parent");
43 parent.icon_name = "go-up-symbolic";
44@@ -74,33 +74,33 @@
45 view.open_parent ();
46 parent.sensitive = !(view.folder.file.file.get_path () == "/");
47 });
48-
49+
50 var spacer = new Gtk.ToolItem ();
51 spacer.set_expand (true);
52-
53+
54 var add = new Gtk.ToolButton (null, null);
55 add.tooltip_text = _("Add file");
56 add.icon_name = "list-add-symbolic";
57 add.clicked.connect (() => {
58 view.add_file ();
59 });
60-
61+
62 var remove = new Gtk.ToolButton (null, null);
63 remove.tooltip_text = _("Remove file");
64 remove.icon_name = "edit-delete-symbolic";
65 remove.clicked.connect (() => {
66 view.remove_file ();
67 });
68-
69+
70 toolbar.insert (parent, -1);
71 toolbar.insert (spacer, -1);
72 toolbar.insert (add, -1);
73 toolbar.insert (remove, -1);
74-
75+
76 box.pack_start (view, true, true, 0);
77 box.pack_start (toolbar, false, false, 0);
78 box.show_all ();
79-
80+
81 notebook.append_page (box, new Gtk.Label (_("File Manager")));
82
83 }
84@@ -111,4 +111,4 @@
85 public void peas_register_types (GLib.TypeModule module) {
86 var objmodule = module as Peas.ObjectModule;
87 objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.FileManagerPlugin));
88-}
89+}
90\ No newline at end of file
91
92=== modified file 'plugins/filemanager/FileView.vala'
93--- plugins/filemanager/FileView.vala 2014-07-21 03:36:57 +0000
94+++ plugins/filemanager/FileView.vala 2014-11-01 21:23:31 +0000
95@@ -35,7 +35,13 @@
96 this.width_request = 180;
97
98 this.item_selected.connect ((item) => {
99- select ((item as FileItem).path);
100+ if (item is FileItem) {
101+ select ((item as FileItem).path);
102+ Utils.last_path = (item as FileItem).file.file.get_parent ().get_uri ();
103+ } else if (item is FolderItem) {
104+ Utils.last_path = (item as FolderItem).file.file.get_uri ();
105+ }
106+
107 });
108 this.root.child_removed.connect (() => {
109 this.selected = null;
110@@ -73,7 +79,7 @@
111 warning ("Cannot open invalid directory.");
112 return;
113 }
114-
115+
116 // Clean the SourceList before start adding something
117 if (this.folder != null)
118 this.root.remove (this.folder);
119@@ -251,7 +257,7 @@
120 view: view);
121
122 this.editable = false;
123- this.selectable = false;
124+ this.selectable = true;
125 this.name = file.name;
126 this.icon = IconLoader.get_default ().get_rendered_icon (file.icon);
127
128@@ -263,6 +269,10 @@
129 children_loaded = true;
130 }
131 });
132+
133+ this.activated.connect (() => {
134+ this.expanded = !this.expanded;
135+ });
136
137 try {
138 monitor = file.file.monitor_directory (GLib.FileMonitorFlags.NONE);
139
140=== modified file 'plugins/terminal/terminal.vala'
141--- plugins/terminal/terminal.vala 2014-08-07 00:33:31 +0000
142+++ plugins/terminal/terminal.vala 2014-11-01 21:23:31 +0000
143@@ -167,4 +167,4 @@
144 var objmodule = module as Peas.ObjectModule;
145 objmodule.register_extension_type (typeof (Peas.Activatable),
146 typeof (Scratch.Plugins.Terminal));
147-}
148+}
149\ No newline at end of file

Subscribers

People subscribed via source and target branches