Merge lp:~tintou/scratch/filemanager into lp:~elementary-apps/scratch/scratch

Proposed by Corentin Noël
Status: Rejected
Rejected by: Zisu Andrei
Proposed branch: lp:~tintou/scratch/filemanager
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 1566 lines (+330/-994)
19 files modified
plugins/CMakeLists.txt (+0/-1)
plugins/filemanager/CMakeLists.txt (+2/-0)
plugins/filemanager/File.vala (+3/-3)
plugins/filemanager/FileItem.vala (+52/-0)
plugins/filemanager/FileManagerPlugin.vala (+68/-46)
plugins/filemanager/FileView.vala (+39/-210)
plugins/filemanager/FolderItem.vala (+154/-0)
plugins/filemanager/Settings.vala (+1/-1)
plugins/folder-manager/CMakeLists.txt (+0/-29)
plugins/folder-manager/File.vala (+0/-207)
plugins/folder-manager/FileView.vala (+0/-312)
plugins/folder-manager/FolderManagerPlugin.vala (+0/-122)
plugins/folder-manager/Settings.vala (+0/-36)
plugins/folder-manager/folder-manager.plugin (+0/-10)
plugins/outline/OutlinePlugin.vala (+4/-1)
plugins/source-tree/SourceTreePlugin.vala (+3/-1)
schemas/CMakeLists.txt (+0/-1)
schemas/org.pantheon.scratch.plugins.file-manager.gschema.xml (+4/-4)
schemas/org.pantheon.scratch.plugins.folder-manager.gschema.xml (+0/-10)
To merge this branch: bzr merge lp:~tintou/scratch/filemanager
Reviewer Review Type Date Requested Status
Danielle Foré ux Needs Fixing
Zisu Andrei (community) Needs Fixing
Review via email: mp+304845@code.launchpad.net
To post a comment you must log in.
lp:~tintou/scratch/filemanager updated
1748. By Corentin Noël

Fix CMake warnings in the plugins

Revision history for this message
Zisu Andrei (matzipan) wrote :

This branch works as advertised, but, as discussed, we need to change the root item into a folder item too so you can use the context menu to add files to it, instead of using the plus sign at the bottom.

Also maybe after creating a new file, the sidebar entry needs to be opened in rename mode so that the user can type in the desired name.

review: Needs Fixing
Revision history for this message
Corentin Noël (tintou) wrote :

Aaand it's ready for a new review.

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

Hm, unsure what the intended behavior is here. After installing this branch, the File Manager plugin appears to be completely empty and do nothing. I don't notice any changes to the Folder Manager plugin.

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

This is definitely needs fixing on UX:

* It seems like you can only add one folder at a time. I really think the button to add a folder in the headerbar needs to come back. It's simple and obvious.

* Having this welcome screen in the sidebar is really bad. Especially if you don't have a file open you can have two welcome screens side-by-side. This is a pretty big annoyance from the previous behavior where it was possible to not have any folders open. This new behavior requires turning the plugin on and off. It's really annoying.

review: Needs Fixing (ux)
lp:~tintou/scratch/filemanager updated
1749. By Corentin Noël

Unified the file manager and folder manager.

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

This is way better than it was before.

One thing I still don't like is the open folder button disappearing from the headerbar. I don't like the actions moving around like this. It means that once I perform the action I now have to go hunt to figure out how to perform that action again. The UI is not predictable.

Revision history for this message
Zisu Andrei (matzipan) wrote :

Rejected because I branched and wrapped up the changes here: https://code.launchpad.net/~matzipan/scratch/filemanager/+merge/311301

Unmerged revisions

1749. By Corentin Noël

Unified the file manager and folder manager.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/CMakeLists.txt'
2--- plugins/CMakeLists.txt 2016-09-03 10:30:53 +0000
3+++ plugins/CMakeLists.txt 2016-09-03 22:26:31 +0000
4@@ -8,7 +8,6 @@
5 add_subdirectory (contractor)
6 add_subdirectory (pastebin)
7 add_subdirectory (filemanager)
8-add_subdirectory (folder-manager)
9 add_subdirectory (terminal)
10 add_subdirectory (browser-preview)
11 add_subdirectory (strip-trailing-save)
12
13=== modified file 'plugins/filemanager/CMakeLists.txt'
14--- plugins/filemanager/CMakeLists.txt 2016-09-03 10:30:53 +0000
15+++ plugins/filemanager/CMakeLists.txt 2016-09-03 22:26:31 +0000
16@@ -8,6 +8,8 @@
17 File.vala
18 Settings.vala
19 FileView.vala
20+ FileItem.vala
21+ FolderItem.vala
22 PACKAGES
23 gtk+-3.0
24 gee-0.8
25
26=== modified file 'plugins/filemanager/File.vala'
27--- plugins/filemanager/File.vala 2013-07-16 15:56:38 +0000
28+++ plugins/filemanager/File.vala 2016-09-03 22:26:31 +0000
29@@ -23,7 +23,7 @@
30 /**
31 * Class for easily dealing with files.
32 */
33- internal class File : GLib.Object {
34+ public class File : GLib.Object {
35
36 public GLib.File file;
37 private GLib.FileInfo info;
38@@ -179,13 +179,13 @@
39 }
40 }
41
42- /*public void trash () {
43+ public void trash () {
44 try {
45 file.trash ();
46 } catch (GLib.Error error) {
47 warning (error.message);
48 }
49- }*/
50+ }
51
52 public void reset_cache () {
53 _name = null;
54
55=== added file 'plugins/filemanager/FileItem.vala'
56--- plugins/filemanager/FileItem.vala 1970-01-01 00:00:00 +0000
57+++ plugins/filemanager/FileItem.vala 2016-09-03 22:26:31 +0000
58@@ -0,0 +1,52 @@
59+// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
60+/*-
61+ * Copyright (c) 2016 elementary LLC. (https://elementary.io)
62+ *
63+ * This program is free software: you can redistribute it and/or modify
64+ * it under the terms of the GNU General Public License as published by
65+ * the Free Software Foundation, either version 3 of the License, or
66+ * (at your option) any later version.
67+ *
68+ * This program is distributed in the hope that it will be useful,
69+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
70+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71+ * GNU General Public License for more details.
72+ *
73+ * You should have received a copy of the GNU General Public License
74+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
75+ *
76+ * Authored by: Corentin Noël <corentin@elementary.io>
77+ */
78+
79+public class Scratch.Plugins.FileManager.FileItem : Item {
80+ public FileItem (Scratch.Plugins.FileManager.File file, Scratch.Plugins.FileManager.FileView view) requires (file.is_valid_textfile) {
81+ Object (file: file, view: view);
82+
83+ this.selectable = true;
84+ this.editable = true;
85+ this.name = file.name;
86+ this.icon = file.icon;
87+ }
88+
89+ public override Gtk.Menu? get_context_menu () {
90+ var menu = new Gtk.Menu ();
91+ var open_item = new Gtk.MenuItem.with_label (_("Rename"));
92+ open_item.activate.connect (() => view.start_editing_item (this));
93+ menu.append (open_item);
94+ var delete_item = new Gtk.MenuItem.with_label (_("Move to Trash"));
95+ delete_item.activate.connect (() => do_remove ());
96+ menu.append (delete_item);
97+ menu.show_all ();
98+ return menu;
99+ }
100+
101+ public void rename (string new_name) {
102+ string new_uri = file.file.get_parent ().get_uri () + "/" + new_name;
103+ debug (new_uri);
104+ file.rename (new_name);
105+ }
106+
107+ private void do_remove () {
108+ file.trash ();
109+ }
110+}
111
112=== modified file 'plugins/filemanager/FileManagerPlugin.vala'
113--- plugins/filemanager/FileManagerPlugin.vala 2016-09-03 11:50:58 +0000
114+++ plugins/filemanager/FileManagerPlugin.vala 2016-09-03 22:26:31 +0000
115@@ -24,9 +24,9 @@
116 namespace Scratch.Plugins {
117 public class FileManagerPlugin : Peas.ExtensionBase, Peas.Activatable {
118 public Scratch.Services.Interface plugins;
119-
120- Gtk.Box box;
121+ Gtk.Button button;
122 FileManager.FileView view;
123+ Gtk.Grid main_grid;
124
125 public Object object { owned get; construct; }
126
127@@ -37,11 +37,19 @@
128 public void activate () {
129 plugins = (Scratch.Services.Interface) object;
130 plugins.hook_notebook_sidebar.connect (on_hook_sidebar);
131+ plugins.hook_toolbar.connect (on_hook_toolbar);
132 }
133
134 public void deactivate () {
135- if (box != null)
136- box.destroy();
137+ if (main_grid != null) {
138+ main_grid.destroy();
139+ main_grid = null;
140+ }
141+
142+ if (button != null) {
143+ button.destroy();
144+ button = null;
145+ }
146 }
147
148 public void update_state () {
149@@ -49,59 +57,73 @@
150 }
151
152 void on_hook_sidebar (Gtk.Notebook notebook) {
153- if (view != null)
154+ if (main_grid != null)
155 return;
156
157- box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
158-
159 // File View
160 view = new FileManager.FileView ();
161-
162- view.select.connect ((a) => {
163- var file = GLib.File.new_for_path (a);
164- plugins.open_file (file);
165+ view.select.connect ((file) => plugins.open_file (file));
166+ view.welcome_visible.connect ((visible) => {
167+ if (visible) {
168+ button.no_show_all = false;
169+ button.show_all ();
170+ main_grid.parent.remove (main_grid);
171+ } else if (main_grid.parent == null) {
172+ button.no_show_all = true;
173+ button.hide ();
174+ main_grid.show_all ();
175+ var icon = new Gtk.Image.from_icon_name ("folder-symbolic", Gtk.IconSize.MENU);
176+ icon.tooltip_text = _("File Manager");
177+ notebook.append_page (main_grid, icon);
178+ }
179 });
180
181- // Toolbar
182 var toolbar = new Gtk.Toolbar ();
183 toolbar.set_icon_size (Gtk.IconSize.SMALL_TOOLBAR);
184- toolbar.get_style_context ().add_class ("inline-toolbar");
185-
186- var parent = new Gtk.ToolButton (null, null);
187- parent.tooltip_text = _("Go to parent");
188- parent.icon_name = "go-up-symbolic";
189- parent.clicked.connect (() => {
190- view.open_parent ();
191- parent.sensitive = !(view.folder.file.file.get_path () == "/");
192- });
193-
194- var spacer = new Gtk.ToolItem ();
195- spacer.set_expand (true);
196+ toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_INLINE_TOOLBAR);
197
198 var add = new Gtk.ToolButton (null, null);
199- add.tooltip_text = _("Add file");
200+ add.tooltip_text = _("Add a folder");
201 add.icon_name = "list-add-symbolic";
202- add.clicked.connect (() => {
203- view.add_file ();
204- });
205-
206- var remove = new Gtk.ToolButton (null, null);
207- remove.tooltip_text = _("Remove file");
208- remove.icon_name = "edit-delete-symbolic";
209- remove.clicked.connect (() => {
210- view.remove_file ();
211- });
212-
213- toolbar.insert (parent, -1);
214- toolbar.insert (spacer, -1);
215- toolbar.insert (add, -1);
216- toolbar.insert (remove, -1);
217-
218- box.pack_start (view, true, true, 0);
219- box.pack_start (toolbar, false, false, 0);
220- box.show_all ();
221-
222- notebook.append_page (box, new Gtk.Label (_("File Manager")));
223+ add.clicked.connect (() => open_dialog ());
224+
225+ toolbar.add (add);
226+
227+ main_grid = new Gtk.Grid ();
228+ main_grid.orientation = Gtk.Orientation.VERTICAL;
229+ main_grid.add (view);
230+ main_grid.add (toolbar);
231+
232+ view.restore_settings ();
233+ }
234+
235+ void on_hook_toolbar (Gtk.HeaderBar toolbar) {
236+ if (button != null)
237+ return;
238+
239+ button = new Gtk.Button.from_icon_name ("folder-saved-search", Gtk.IconSize.LARGE_TOOLBAR);
240+ button.tooltip_text = _("Open a folder");
241+ button.clicked.connect (() => open_dialog ());
242+ button.show_all ();
243+ toolbar.pack_start (button);
244+ }
245+
246+ private void open_dialog () {
247+ Gtk.Window window = plugins.manager.window;
248+ Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
249+ "Select a folder.", window, Gtk.FileChooserAction.SELECT_FOLDER,
250+ _("_Cancel"), Gtk.ResponseType.CANCEL,
251+ _("_Open"), Gtk.ResponseType.ACCEPT);
252+ chooser.select_multiple = true;
253+
254+ if (chooser.run () == Gtk.ResponseType.ACCEPT) {
255+ chooser.get_files ().foreach ((file) => {
256+ var folder = new Scratch.Plugins.FileManager.File (file.get_path ());
257+ view.open_folder (folder);
258+ });
259+ }
260+
261+ chooser.close ();
262 }
263 }
264 }
265
266=== modified file 'plugins/filemanager/FileView.vala'
267--- plugins/filemanager/FileView.vala 2016-09-03 11:50:58 +0000
268+++ plugins/filemanager/FileView.vala 2016-09-03 22:26:31 +0000
269@@ -24,30 +24,30 @@
270 /**
271 * SourceList that displays folders and their contents.
272 */
273- internal class FileView : Granite.Widgets.SourceList {
274- public FolderItem? folder = null;
275- public signal void select (string file);
276+ public class FileView : Granite.Widgets.SourceList {
277+ public signal void select (GLib.File file);
278+ public signal void welcome_visible (bool visible);
279 public FileView () {
280- this.width_request = 180;
281+ width_request = 180;
282
283- this.item_selected.connect ((item) => {
284- select ((item as FileItem).path);
285+ item_selected.connect ((item) => {
286+ if (item is FileItem) {
287+ select ((item as FileItem).file.file);
288+ }
289 });
290
291- this.root.child_removed.connect (() => {
292+ root.child_removed.connect (() => {
293 this.selected = null;
294+ if (root.n_children == 0) {
295+ welcome_visible (true);
296+ }
297+
298+ write_settings ();
299 });
300
301 settings = new Settings ();
302- restore_settings ();
303 }
304
305- public void open_parent () {
306- GLib.File parent = this.folder.file.file.get_parent ();
307- this.root.remove (this.folder);
308- open_folder (new File (parent.get_path ()));
309- }
310-
311 public void open_folder (File folder, bool expand = true) {
312 if (is_open (folder)) {
313 warning ("Folder '%s' is already open.", folder.path);
314@@ -57,49 +57,25 @@
315 return;
316 }
317
318- // Clean the SourceList before start adding something
319- if (this.folder != null) {
320- this.root.remove (this.folder);
321- }
322-
323- this.folder = new FolderItem (folder, this);
324- this.root.add (this.folder);
325-
326- this.folder.expanded = expand;
327+ var folder_item = new FolderItem (folder, this);
328+ root.add (folder_item);
329+ welcome_visible (false);
330+
331+ folder_item.expanded = expand;
332 write_settings ();
333 }
334-
335- public void add_file () {
336- string path = folder.file.file.get_path () + _("/New File");
337- var file = GLib.File.new_for_path (path);
338- int n = 1;
339- while (file.query_exists ()) {
340- file = GLib.File.new_for_path (path + n.to_string ());
341- n++;
342- }
343-
344- try {
345- file.create (FileCreateFlags.NONE);
346- } catch (Error e) {
347- warning (e.message);
348- }
349-
350- var item = new FileItem (new File (file.get_path ()));
351- this.folder.add (item);
352- }
353-
354- public void remove_file () {
355- if (this.selected is FileItem) {
356- var file = GLib.File.new_for_path (((FileItem)selected).file.file.get_path ());
357- try {
358- file.delete ();
359- this.root.remove (selected);
360- } catch (Error e) {
361- warning (e.message);
362- }
363- }
364-
365- this.selected = null;
366+
367+ public void restore_settings () {
368+ foreach (var folder_path in settings.opened_folders) {
369+ if (folder_path == null) {
370+ continue;
371+ }
372+
373+ var folder = new File (folder_path);
374+ if (folder.is_valid_directory) {
375+ open_folder (folder);
376+ }
377+ }
378 }
379
380 private bool is_open (File folder) {
381@@ -113,24 +89,23 @@
382 }
383
384 private void write_settings () {
385- settings.opened_folder = this.folder.file.file.get_path ();
386- }
387-
388- private void restore_settings () {
389- var folder = new File (settings.opened_folder);
390- if (settings.opened_folder == "" || settings.opened_folder == null || !folder.is_valid_directory) {
391- settings.opened_folder = GLib.Environment.get_home_dir ();
392+ string[] paths = {};
393+ foreach (var child in this.root.children) {
394+ if (child is FolderItem) {
395+ paths += ((FolderItem) child).path;
396+ }
397 }
398
399- open_folder (new File (settings.opened_folder));
400+ settings.opened_folders = paths;
401 }
402 }
403
404 /**
405 * Common abstract class for normal and expandable items.
406 */
407- internal class Item : Granite.Widgets.SourceList.ExpandableItem, Granite.Widgets.SourceListSortable {
408+ public class Item : Granite.Widgets.SourceList.ExpandableItem, Granite.Widgets.SourceListSortable {
409 public File file { get; construct; }
410+ public Scratch.Plugins.FileManager.FileView view { get; construct; }
411 public string path { get { return file.path; } }
412
413 public int compare (Granite.Widgets.SourceList.Item a, Granite.Widgets.SourceList.Item b) {
414@@ -148,150 +123,4 @@
415 }
416 }
417
418- /**
419- * Normal item in the source list, represents a textfile.
420- * TODO Remove, Rename
421- */
422- internal class FileItem : Item {
423- //Gtk.Menu menu;
424- //Gtk.MenuItem item_trash;
425- public FileItem (File file) requires (file.is_valid_textfile) {
426- Object (file: file);
427-
428- this.selectable = true;
429- this.editable = true;
430- this.name = file.name;
431- this.icon = file.icon;
432- }
433-
434- public void rename (string new_name) {
435- string new_uri = file.file.get_parent ().get_uri () + "/" + new_name;
436- debug (new_uri);
437- file.rename (new_name);
438- }
439-
440- /*public override Gtk.Menu? get_context_menu () {
441- menu = new Gtk.Menu ();
442- item_trash = new Gtk.MenuItem.with_label (_("Move to Trash"));
443- menu.append (item_trash);
444- item_trash.activate.connect (() => { file.trash (); });
445- menu.show_all ();
446- return menu;
447- }*/
448- }
449-
450- /**
451- * Expandable item in the source list, represents a folder.
452- * Monitored for changes inside the directory.
453- * TODO remove, rename, create new file
454- */
455- internal class FolderItem : Item {
456- public signal void folder_open (GLib.File folder);
457- public FileView view { get; construct; }
458-
459- private GLib.FileMonitor monitor;
460- private bool children_loaded = false;
461-
462- //Gtk.Menu menu;
463- //Gtk.MenuItem item_trash;
464- //Gtk.MenuItem item_create;
465-
466- public FolderItem (File file, FileView view) requires (file.is_valid_directory) {
467- Object (file: file, view: view);
468-
469- this.editable = false;
470- this.selectable = false;
471- this.name = file.name;
472- this.icon = file.icon;
473-
474- this.add (new Granite.Widgets.SourceList.Item ("")); // dummy
475- this.toggled.connect (() => {
476- if (this.expanded && this.n_children <= 1) {
477- this.clear ();
478- this.add_children ();
479- children_loaded = true;
480- }
481- });
482-
483- try {
484- monitor = file.file.monitor_directory (GLib.FileMonitorFlags.NONE);
485- monitor.changed.connect ((s,d,e) => { on_changed (s,d,e); });
486- } catch (GLib.Error e) {
487- warning (e.message);
488- }
489- }
490-
491- public override Gtk.Menu? get_context_menu () {
492- if (this == this.view.root.children.to_array ()[0]) {
493- return null;
494- }
495-
496- var menu = new Gtk.Menu ();
497- var item = new Gtk.MenuItem.with_label (_("Open"));
498- item.activate.connect (() => { this.folder_open (this.file.file); });
499- menu.append (item);
500- menu.show_all ();
501- return menu;
502- }
503-
504- internal void add_children () {
505- foreach (var child in file.children) {
506- if (child.is_valid_directory) {
507- var item = new FolderItem (child, view);
508- item.folder_open.connect (() => {
509- this.view.open_folder (child);
510- });
511-
512- add (item);
513- } else if (child.is_valid_textfile) {
514- var item = new FileItem (child);
515- add (item);
516- item.edited.connect (item.rename);
517- }
518- }
519- }
520-
521- private void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
522- if (!children_loaded) {
523- this.file.reset_cache ();
524- return;
525- }
526-
527- switch (event) {
528- case GLib.FileMonitorEvent.DELETED:
529- var children_tmp = new Gee.ArrayList<Granite.Widgets.SourceList.Item> ();
530- children_tmp.add_all (children);
531- foreach (var item in children_tmp) {
532- if ((item as Item).path == source.get_path ()) {
533- remove (item);
534- }
535- }
536-
537- break;
538- case GLib.FileMonitorEvent.CREATED:
539- if (source.query_exists () == false) {
540- return;
541- }
542-
543- var file = new File (source.get_path ());
544- var exists = false;
545- foreach (var item in children) {
546- if ((item as Item).path == file.path) {
547- exists = true;
548- }
549- }
550-
551- if (!exists) {
552- if (file.is_valid_textfile) {
553- this.add (new FileItem (file));
554- } else if (file.is_valid_directory) {
555- this.add (new FolderItem (file, view));
556- }
557- }
558-
559- break;
560- }
561- }
562- }
563-
564 }
565
566=== added file 'plugins/filemanager/FolderItem.vala'
567--- plugins/filemanager/FolderItem.vala 1970-01-01 00:00:00 +0000
568+++ plugins/filemanager/FolderItem.vala 2016-09-03 22:26:31 +0000
569@@ -0,0 +1,154 @@
570+// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
571+/*-
572+ * Copyright (c) 2016 elementary LLC. (https://elementary.io)
573+ *
574+ * This program is free software: you can redistribute it and/or modify
575+ * it under the terms of the GNU General Public License as published by
576+ * the Free Software Foundation, either version 3 of the License, or
577+ * (at your option) any later version.
578+ *
579+ * This program is distributed in the hope that it will be useful,
580+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
581+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
582+ * GNU General Public License for more details.
583+ *
584+ * You should have received a copy of the GNU General Public License
585+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
586+ *
587+ * Authored by: Corentin Noël <corentin@elementary.io>
588+ */
589+
590+public class Scratch.Plugins.FileManager.FolderItem : Item {
591+ public signal void folder_open (GLib.File folder);
592+
593+ private GLib.FileMonitor monitor;
594+ private bool children_loaded = false;
595+
596+ public FolderItem (Scratch.Plugins.FileManager.File file, Scratch.Plugins.FileManager.FileView view) requires (file.is_valid_directory) {
597+ Object (file: file, view: view);
598+
599+ this.editable = false;
600+ this.selectable = false;
601+ this.name = file.name;
602+ this.icon = file.icon;
603+
604+ this.add (new Granite.Widgets.SourceList.Item ("")); // dummy
605+ this.toggled.connect (() => {
606+ if (this.expanded && this.n_children <= 1) {
607+ this.clear ();
608+ this.add_children ();
609+ children_loaded = true;
610+ }
611+ });
612+
613+ try {
614+ monitor = file.file.monitor_directory (GLib.FileMonitorFlags.NONE);
615+ monitor.changed.connect ((s,d,e) => { on_changed (s,d,e); });
616+ } catch (GLib.Error e) {
617+ warning (e.message);
618+ }
619+ }
620+
621+ public override Gtk.Menu? get_context_menu () {
622+ var menu = new Gtk.Menu ();
623+ if (this.parent == this.view.root) {
624+ var item = new Gtk.MenuItem.with_label (_("Close Folder"));
625+ item.activate.connect (() => {
626+ monitor.cancel ();
627+ parent.remove (this);
628+ });
629+ menu.append (item);
630+ } else {
631+ var item = new Gtk.MenuItem.with_label (_("Open"));
632+ item.activate.connect (() => folder_open (this.file.file));
633+ menu.append (item);
634+ }
635+
636+ var new_file_item = new Gtk.MenuItem.with_label (_("Add file"));
637+ new_file_item.activate.connect (() => add_file ());
638+ menu.append (new_file_item);
639+ menu.show_all ();
640+ return menu;
641+ }
642+
643+ internal void add_children () {
644+ foreach (var child in file.children) {
645+ if (child.is_valid_directory) {
646+ var item = new FolderItem (child, view);
647+ item.folder_open.connect (() => {
648+ this.view.open_folder (child);
649+ });
650+
651+ add (item);
652+ } else if (child.is_valid_textfile) {
653+ var item = new FileItem (child, view);
654+ add (item);
655+ item.edited.connect (item.rename);
656+ }
657+ }
658+ }
659+
660+ private void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
661+ if (!children_loaded) {
662+ this.file.reset_cache ();
663+ return;
664+ }
665+
666+ switch (event) {
667+ case GLib.FileMonitorEvent.DELETED:
668+ var children_tmp = new Gee.ArrayList<Granite.Widgets.SourceList.Item> ();
669+ children_tmp.add_all (children);
670+ foreach (var item in children_tmp) {
671+ if ((item as Item).path == source.get_path ()) {
672+ remove (item);
673+ }
674+ }
675+
676+ break;
677+ case GLib.FileMonitorEvent.CREATED:
678+ if (source.query_exists () == false) {
679+ return;
680+ }
681+
682+ var file = new File (source.get_path ());
683+ var exists = false;
684+ foreach (var item in children) {
685+ if ((item as Item).path == file.path) {
686+ exists = true;
687+ }
688+ }
689+
690+ if (!exists) {
691+ if (file.is_valid_textfile) {
692+ this.add (new FileItem (file, view));
693+ } else if (file.is_valid_directory) {
694+ this.add (new FolderItem (file, view));
695+ }
696+ }
697+
698+ break;
699+ }
700+ }
701+
702+ private void add_file () {
703+ var child = file.file.get_child (_("New File"));
704+
705+ int n = 1;
706+ while (child.query_exists ()) {
707+ child = file.file.get_child (_("New File (%d)").printf (n));
708+ n++;
709+ }
710+
711+ try {
712+ child.create (FileCreateFlags.NONE);
713+ } catch (Error e) {
714+ warning (e.message);
715+ }
716+
717+ if (children_loaded) {
718+ var item = new FileItem (new File (child.get_path ()), view);
719+ this.add (item);
720+ view.start_editing_item (item);
721+ }
722+ }
723+}
724
725=== modified file 'plugins/filemanager/Settings.vala'
726--- plugins/filemanager/Settings.vala 2013-07-16 15:56:38 +0000
727+++ plugins/filemanager/Settings.vala 2016-09-03 22:26:31 +0000
728@@ -27,7 +27,7 @@
729
730 private const string SCHEMA = "org.pantheon.scratch.plugins.file-manager";
731
732- public string opened_folder { get; set; }
733+ public string[] opened_folders { get; set; }
734
735 public Settings () {
736 base (SCHEMA);
737
738=== removed directory 'plugins/folder-manager'
739=== removed file 'plugins/folder-manager/CMakeLists.txt'
740--- plugins/folder-manager/CMakeLists.txt 2016-09-03 10:30:53 +0000
741+++ plugins/folder-manager/CMakeLists.txt 1970-01-01 00:00:00 +0000
742@@ -1,29 +0,0 @@
743-add_definitions(${NORMAL_CFLAGS})
744-link_directories(${NORMAL_LINK_DIRS})
745-
746-set (PLUGIN_NAME "folder-manager")
747-
748-vala_precompile(VALA_C ${PLUGIN_NAME}
749- FolderManagerPlugin.vala
750- File.vala
751- Settings.vala
752- FileView.vala
753-PACKAGES
754- gtk+-3.0
755- gee-0.8
756- granite
757- scratchcore
758- libpeas-1.0
759- gtksourceview-3.0
760- ${ZEITGEIST_DEPS}
761-OPTIONS
762- ${DEFAULT_PLUGIN_OPTIONS}
763-)
764-
765-add_library(${PLUGIN_NAME} MODULE ${VALA_C})
766-add_dependencies(${PLUGIN_NAME} ${LIBNAME})
767-
768-install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGINDIR}/${PLUGIN_NAME})
769-install(FILES ${PLUGIN_NAME}.plugin DESTINATION ${PLUGINDIR}/${PLUGIN_NAME})
770-
771-message("-- Folder Manager plugin will be compiled")
772
773=== removed file 'plugins/folder-manager/File.vala'
774--- plugins/folder-manager/File.vala 2013-06-02 13:07:08 +0000
775+++ plugins/folder-manager/File.vala 1970-01-01 00:00:00 +0000
776@@ -1,207 +0,0 @@
777-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
778-/***
779- BEGIN LICENSE
780-
781- Copyright (C) 2013 Julien Spautz <spautz.julien@gmail.com>
782- This program is free software: you can redistribute it and/or modify it
783- under the terms of the GNU Lesser General Public License version 3, as published
784- by the Free Software Foundation.
785-
786- This program is distributed in the hope that it will be useful, but
787- WITHOUT ANY WARRANTY; without even the implied warranties of
788- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
789- PURPOSE. See the GNU General Public License for more details.
790-
791- You should have received a copy of the GNU General Public License along
792- with this program. If not, see <http://www.gnu.org/licenses/>
793-
794- END LICENSE
795-***/
796-
797-namespace Scratch.Plugins.FolderManager {
798-
799- /**
800- * Class for easily dealing with files.
801- */
802- internal class File : GLib.Object {
803-
804- public GLib.File file;
805- private GLib.FileInfo info;
806-
807- private enum Type {
808- VALID_FILE,
809- VALID_FOLDER,
810- UNKNOWN,
811- INVALID
812- }
813-
814- public File (string path) {
815- file = GLib.File.new_for_path (path);
816-
817- info = new FileInfo ();
818- try {
819- info = file.query_info (
820- GLib.FileAttribute.STANDARD_CONTENT_TYPE + "," +
821- GLib.FileAttribute.STANDARD_IS_BACKUP + "," +
822- GLib.FileAttribute.STANDARD_IS_HIDDEN + "," +
823- GLib.FileAttribute.STANDARD_DISPLAY_NAME + "," +
824- GLib.FileAttribute.STANDARD_TYPE,
825- FileQueryInfoFlags.NONE);
826- } catch (GLib.Error error) {
827- info = null;
828- warning (error.message);
829- }
830- }
831-
832- // returns the path the file
833- string _path = null;
834- public string path {
835- get { return _path != null ? _path : _path = file.get_path (); }
836- }
837-
838- // returns the basename of the file
839- string _name = null;
840- public string name {
841- get { return _name != null ? _name : _name = info.get_display_name (); }
842- }
843-
844- // returns the icon of the file's content type
845- GLib.Icon _icon = null;
846- public GLib.Icon icon {
847- get {
848- if (_icon != null)
849- return _icon;
850- //var content_type = info.get_attribute_string (FileAttribute.STANDARD_FAST_CONTENT_TYPE);
851- var content_type = info.get_content_type ();
852- return _icon = GLib.ContentType.get_icon (content_type);
853- }
854- }
855-
856- // checks if file exists
857- public bool exists {
858- get { return file.query_exists (); }
859- }
860-
861- Type _type = Type.UNKNOWN;
862- // checks if we're dealing with a non-hidden, non-backup directory
863- public bool is_valid_directory {
864- get {
865- if (_type == Type.VALID_FILE)
866- return false;
867- if (_type == Type.VALID_FOLDER)
868- return true;
869- if (_type == Type.INVALID)
870- return false;
871-
872- if (info.get_file_type () != FileType.DIRECTORY ||
873- info.get_is_hidden () || info.get_is_backup ()) {
874- return false;
875- }
876-
877- bool has_valid_children = false;
878-
879- foreach (var child in children) {
880- if (child.is_valid_textfile) {
881- _type = Type.VALID_FOLDER;
882- return has_valid_children = true;
883- }
884- }
885-
886- foreach (var child in children) {
887- if (child.is_valid_directory) {
888- has_valid_children = true;
889- _type = Type.VALID_FOLDER;
890- return has_valid_children = true;
891- }
892- }
893-
894- return false;
895- }
896- }
897-
898- // checks if we're dealing with a textfile
899- public bool is_valid_textfile {
900- get {
901- if (_type == Type.VALID_FILE)
902- return true;
903- if (_type == Type.VALID_FOLDER)
904- return false;
905- if (_type == Type.INVALID)
906- return false;
907-
908- if (info.get_file_type () == FileType.REGULAR) {
909- //var content_type = info.get_attribute_string (FileAttribute.STANDARD_FAST_CONTENT_TYPE);
910- var content_type = info.get_content_type ();
911- if (ContentType.is_a (content_type, "text/*") &&
912- !info.get_is_backup () &&
913- !info.get_is_hidden ()) {
914- _type = Type.VALID_FILE;
915- return true;
916- }
917- }
918-
919- return false;
920- }
921- }
922-
923- // returns a list of all children of a directory
924- GLib.List <File> _children = null;
925- public GLib.List <File> children {
926- get {
927- if (_children != null)
928- return _children;
929-
930- var parent = GLib.File.new_for_path (file.get_path ());
931- try {
932- var enumerator = parent.enumerate_children (
933- GLib.FileAttribute.STANDARD_NAME,
934- FileQueryInfoFlags.NONE
935- );
936-
937- var file_info = new FileInfo ();
938- while ((file_info = enumerator.next_file ()) != null) {
939- var child = parent.get_child (file_info.get_name ());
940- _children.append (new File (child.get_path ()));
941- }
942- } catch (GLib.Error error) {
943- warning (error.message);
944- }
945-
946- return _children;
947- }
948- }
949-
950- /*public void rename (string name) {
951- try {
952- file.set_display_name (name);
953- } catch (GLib.Error error) {
954- warning (error.message);
955- }
956- }
957-
958- public void trash () {
959- try {
960- file.trash ();
961- } catch (GLib.Error error) {
962- warning (error.message);
963- }
964- }*/
965-
966- public void reset_cache () {
967- _name = null;
968- _path = null;
969- _icon = null;
970- _children = null;
971- _type = Type.UNKNOWN;
972- }
973-
974- public static int compare (File a, File b) {
975- if (a.is_valid_directory && b.is_valid_textfile)
976- return -1;
977- if (a.is_valid_textfile && b.is_valid_directory)
978- return 1;
979- return strcmp (a.path.collate_key_for_filename (),
980- b.path.collate_key_for_filename ());
981- }
982- }
983-}
984
985=== removed file 'plugins/folder-manager/FileView.vala'
986--- plugins/folder-manager/FileView.vala 2015-09-16 01:11:55 +0000
987+++ plugins/folder-manager/FileView.vala 1970-01-01 00:00:00 +0000
988@@ -1,312 +0,0 @@
989-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
990-/***
991- BEGIN LICENSE
992-
993- Copyright (C) 2013 Julien Spautz <spautz.julien@gmail.com>
994- This program is free software: you can redistribute it and/or modify it
995- under the terms of the GNU Lesser General Public License version 3, as published
996- by the Free Software Foundation.
997-
998- This program is distributed in the hope that it will be useful, but
999- WITHOUT ANY WARRANTY; without even the implied warranties of
1000- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1001- PURPOSE. See the GNU General Public License for more details.
1002-
1003- You should have received a copy of the GNU General Public License along
1004- with this program. If not, see <http://www.gnu.org/licenses/>
1005-
1006- END LICENSE
1007-***/
1008-
1009-namespace Scratch.Plugins.FolderManager {
1010- Settings settings;
1011-
1012- /**
1013- * SourceList that displays folders and their contents.
1014- */
1015- internal class FileView : Granite.Widgets.SourceList {
1016-
1017- public signal void select (string file);
1018-
1019- public FileView () {
1020- this.width_request = 180;
1021- this.item_selected.connect ((item) => {
1022- select ((item as FileItem).path);
1023- });
1024-
1025- settings = new Settings ();
1026- }
1027-
1028- public void restore_saved_state () {
1029- foreach (var path in settings.opened_folders)
1030- add_folder (new File (path), false);
1031- }
1032-
1033- public void open_folder (File folder) {
1034- if (is_open (folder)) {
1035- warning ("Folder '%s' is already open.", folder.path);
1036- return;
1037- } else if (!folder.is_valid_directory) {
1038- warning ("Cannot open invalid directory.");
1039- return;
1040- }
1041-
1042- add_folder (folder, true);
1043- write_settings ();
1044- }
1045-
1046- private void add_folder (File folder, bool expand) {
1047- if (is_open (folder)) {
1048- warning ("Folder '%s' is already open.", folder.path);
1049- return;
1050- } else if (!folder.is_valid_directory) {
1051- warning ("Cannot open invalid directory.");
1052- return;
1053- }
1054-
1055- var folder_root = new MainFolderItem (folder);
1056- this.root.add (folder_root);
1057-
1058- folder_root.expanded = expand;
1059- folder_root.closed.connect (() => {
1060- root.remove (folder_root);
1061- write_settings ();
1062- });
1063- }
1064-
1065- private bool is_open (File folder) {
1066- foreach (var child in root.children)
1067- if (folder.path == (child as Item).path)
1068- return true;
1069- return false;
1070- }
1071-
1072- private void write_settings () {
1073- string[] to_save = {};
1074-
1075- foreach (var main_folder in root.children) {
1076- var saved = false;
1077-
1078- foreach (var saved_folder in to_save) {
1079- if ((main_folder as Item).path == saved_folder) {
1080- saved = true;
1081- break;
1082- }
1083- }
1084-
1085- if (!saved) {
1086- to_save += (main_folder as Item).path;
1087- }
1088- }
1089-
1090- settings.opened_folders = to_save;
1091- }
1092- }
1093-
1094- /**
1095- * Common abstract class for file and filder items.
1096- */
1097- internal class Item: Granite.Widgets.SourceList.ExpandableItem, Granite.Widgets.SourceListSortable {
1098- public File file { get; construct; }
1099- public string path { get { return file.path; } }
1100-
1101- public int compare (Granite.Widgets.SourceList.Item a, Granite.Widgets.SourceList.Item b) {
1102- if (a is FolderItem && b is FileItem) {
1103- return -1;
1104- } else if (a is FileItem && b is FolderItem) {
1105- return 1;
1106- }
1107-
1108- return File.compare ((a as Item).file, (b as Item).file);
1109- }
1110-
1111- public bool allow_dnd_sorting () {
1112- return false;
1113- }
1114- }
1115-
1116- /**
1117- * Normal item in the source list, represents a textfile.
1118- * TODO Remove, Rename
1119- */
1120- internal class FileItem : Item {
1121-
1122- //Gtk.Menu menu;
1123- //Gtk.MenuItem item_trash;
1124-
1125- public FileItem (File file) requires (file.is_valid_textfile) {
1126- Object (file: file);
1127-
1128- this.selectable = true;
1129- //this.editable = true;
1130- this.name = file.name;
1131- this.icon = file.icon;
1132- }
1133-
1134- /*public void rename (string new_name) {
1135- file.rename (new_name);
1136- }*/
1137-
1138- /*public override Gtk.Menu? get_context_menu () {
1139- menu = new Gtk.Menu ();
1140- item_trash = new Gtk.MenuItem.with_label (_("Move to Trash"));
1141- menu.append (item_trash);
1142- item_trash.activate.connect (() => { file.trash (); });
1143- menu.show_all ();
1144- return menu;
1145- }*/
1146- }
1147-
1148- /**
1149- * Expandable item in the source list, represents a folder.
1150- * Monitored for changes inside the directory.
1151- * TODO remove, rename, create new file
1152- */
1153- internal class FolderItem : Item {
1154-
1155- //Gtk.Menu menu;
1156- //Gtk.MenuItem item_trash;
1157- //Gtk.MenuItem item_create;
1158-
1159- private GLib.FileMonitor monitor;
1160- private bool children_loaded = false;
1161-
1162- public FolderItem (File file) requires (file.is_valid_directory) {
1163- Object (file: file);
1164-
1165- this.editable = false;
1166- this.selectable = false;
1167- this.name = file.name;
1168- this.icon = file.icon;
1169-
1170- this.add (new Granite.Widgets.SourceList.Item ("")); // dummy
1171- this.toggled.connect (() => {
1172- if (this.expanded && this.n_children <= 1) {
1173- this.clear ();
1174- this.add_children ();
1175- children_loaded = true;
1176- }
1177- });
1178-
1179- try {
1180- monitor = file.file.monitor_directory (GLib.FileMonitorFlags.NONE);
1181- monitor.changed.connect ((s,d,e) => { on_changed (s,d,e); });
1182- } catch (GLib.Error e) {
1183- warning (e.message);
1184- }
1185- }
1186-
1187- /*public override Gtk.Menu? get_context_menu () {
1188- menu = new Gtk.Menu ();
1189- item_trash = new Gtk.MenuItem.with_label (_("Move to Trash"));
1190- item_create = new Gtk.MenuItem.with_label (_("Create new File"));
1191- menu.append (item_trash);
1192- menu.append (item_create);
1193- item_trash.activate.connect (() => { file.trash (); });
1194- item_create.activate.connect (() => {
1195- var new_file = GLib.File.new_for_path (file.path + "/new File");
1196-
1197- try {
1198- FileOutputStream os = new_file.create (FileCreateFlags.NONE);
1199- } catch (Error e) {
1200- warning ("Error: %s\n", e.message);
1201- }
1202- });
1203- menu.show_all ();
1204- return menu;
1205- }*/
1206-
1207- internal void add_children () {
1208- foreach (var child in file.children) {
1209- if (child.is_valid_directory) {
1210- var item = new FolderItem (child);
1211- add (item);
1212- } else if (child.is_valid_textfile) {
1213- var item = new FileItem (child);
1214- add (item);
1215- //item.edited.connect (item.rename);
1216- }
1217- }
1218- }
1219-
1220- private void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
1221-
1222- if (!children_loaded) {
1223- this.file.reset_cache ();
1224- return;
1225- }
1226-
1227- switch (event) {
1228- case GLib.FileMonitorEvent.DELETED:
1229- var children_tmp = new Gee.ArrayList<Granite.Widgets.SourceList.Item> ();
1230- children_tmp.add_all (children);
1231- foreach (var item in children_tmp) {
1232- if ((item as Item).path == source.get_path ()) {
1233- remove (item);
1234- }
1235- }
1236-
1237- break;
1238- case GLib.FileMonitorEvent.CREATED:
1239- if (source.query_exists () == false) {
1240- return;
1241- }
1242-
1243- var file = new File (source.get_path ());
1244- var exists = false;
1245- foreach (var item in children) {
1246- if ((item as Item).path == file.path) {
1247- exists = true;
1248- break;
1249- }
1250- }
1251-
1252- if (!exists) {
1253- if (file.is_valid_textfile) {
1254- this.add (new FileItem (file));
1255- } else if (file.is_valid_directory) {
1256- this.add (new FolderItem (file));
1257- }
1258- }
1259-
1260- break;
1261- }
1262- }
1263- }
1264-
1265- /**
1266- * Special root folder.
1267- * TODO rename, create new file
1268- */
1269- internal class MainFolderItem : FolderItem {
1270- public signal void closed ();
1271-
1272- Gtk.Menu menu;
1273- Gtk.MenuItem item_close;
1274- //Gtk.MenuItem item_create;
1275-
1276- public MainFolderItem (File file) requires (file.is_valid_directory) {
1277- base (file);
1278- }
1279-
1280- public override Gtk.Menu? get_context_menu () {
1281- menu = new Gtk.Menu ();
1282- item_close = new Gtk.MenuItem.with_label (_("Close Folder"));
1283- //item_create = new Gtk.MenuItem.with_label (_("Create new File"));
1284- menu.append (item_close);
1285- //menu.append (item_create);
1286- item_close.activate.connect (() => { closed (); });
1287- /*item_create.activate.connect (() => {
1288- var new_file = GLib.File.new_for_path (file.path + "/new File");
1289-
1290- try {
1291- FileOutputStream os = new_file.create (FileCreateFlags.NONE);
1292- } catch (Error e) {
1293- warning ("Error: %s\n", e.message);
1294- }
1295- });*/
1296- menu.show_all ();
1297- return menu;
1298- }
1299- }
1300-}
1301
1302=== removed file 'plugins/folder-manager/FolderManagerPlugin.vala'
1303--- plugins/folder-manager/FolderManagerPlugin.vala 2015-12-01 11:37:53 +0000
1304+++ plugins/folder-manager/FolderManagerPlugin.vala 1970-01-01 00:00:00 +0000
1305@@ -1,122 +0,0 @@
1306-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
1307-/***
1308- BEGIN LICENSE
1309-
1310- Copyright (C) 2013 Julien Spautz <spautz.julien@gmail.com>
1311- This program is free software: you can redistribute it and/or modify it
1312- under the terms of the GNU Lesser General Public License version 3, as published
1313- by the Free Software Foundation.
1314-
1315- This program is distributed in the hope that it will be useful, but
1316- WITHOUT ANY WARRANTY; without even the implied warranties of
1317- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1318- PURPOSE. See the GNU General Public License for more details.
1319-
1320- You should have received a copy of the GNU General Public License along
1321- with this program. If not, see <http://www.gnu.org/licenses/>
1322-
1323- END LICENSE
1324-***/
1325-
1326-public const string NAME = _("Folder Manager");
1327-public const string DESCRIPTION = _("Basic folder manager with file browsing");
1328-
1329-namespace Scratch.Plugins {
1330- public class FolderManagerPlugin : Peas.ExtensionBase, Peas.Activatable {
1331-
1332- FolderManager.FileView view;
1333- Gtk.ToolButton tool_button;
1334-
1335- int index = 0;
1336-
1337- Scratch.Services.Interface plugins;
1338- public Object object { owned get; construct; }
1339-
1340- public FolderManagerPlugin () {
1341- message ("Starting Folder Manager Plugin");
1342- }
1343-
1344- public void activate () {
1345- plugins = (Scratch.Services.Interface) object;
1346- plugins.hook_notebook_sidebar.connect (on_hook_sidebar);
1347- plugins.hook_toolbar.connect (on_hook_toolbar);
1348- }
1349-
1350- public void deactivate () {
1351- if (view != null)
1352- view.destroy();
1353- if (tool_button != null) {
1354- //(tool_button.parent as Scratch.Widgets.Toolbar).open_button.visible = true;
1355- tool_button.destroy ();
1356- }
1357- }
1358-
1359- public void update_state () {
1360- }
1361-
1362- void on_hook_sidebar (Gtk.Notebook notebook) {
1363- if (view != null)
1364- return;
1365-
1366- view = new FolderManager.FileView ();
1367-
1368- view.select.connect ((a) => {
1369- var file = GLib.File.new_for_path (a);
1370- plugins.open_file (file);
1371- });
1372-
1373- view.root.child_added.connect (() => {
1374- if (view.get_n_visible_children (view.root) == 0) {
1375- index = notebook.append_page (view, new Gtk.Label (_("Folders")));
1376- }
1377- });
1378-
1379- view.root.child_removed.connect (() => {
1380- if (view.get_n_visible_children (view.root) == 1)
1381- notebook.remove_page (index);
1382- });
1383-
1384- view.restore_saved_state ();
1385- }
1386-
1387- void on_hook_toolbar (Gtk.HeaderBar toolbar) {
1388- if (tool_button != null)
1389- return;
1390-
1391- //(toolbar as Scratch.Widgets.Toolbar).open_button.visible = false;
1392- var icon = new Gtk.Image.from_icon_name ("folder-saved-search", Gtk.IconSize.LARGE_TOOLBAR);
1393- tool_button = new Gtk.ToolButton (icon, _("Open a folder"));
1394- tool_button.tooltip_text = _("Open a folder");
1395- tool_button.clicked.connect (() => {
1396- Gtk.Window window = plugins.manager.window;
1397- Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
1398- "Select a folder.", window, Gtk.FileChooserAction.SELECT_FOLDER,
1399- _("_Cancel"), Gtk.ResponseType.CANCEL,
1400- _("_Open"), Gtk.ResponseType.ACCEPT);
1401- chooser.select_multiple = true;
1402-
1403- if (chooser.run () == Gtk.ResponseType.ACCEPT) {
1404- SList<string> uris = chooser.get_uris ();
1405- foreach (unowned string uri in uris) {
1406- var folder = new FolderManager.File (uri.replace ("file:///", "/"));
1407- view.open_folder (folder); // emit signal
1408- }
1409- }
1410-
1411- chooser.close ();
1412- });
1413-
1414- icon.show ();
1415- tool_button.show ();
1416-
1417- toolbar.pack_start (tool_button);
1418- //toolbar.insert (tool_button, 1);
1419- }
1420- }
1421-}
1422-
1423-[ModuleInit]
1424-public void peas_register_types (GLib.TypeModule module) {
1425- var objmodule = module as Peas.ObjectModule;
1426- objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.FolderManagerPlugin));
1427-}
1428
1429=== removed file 'plugins/folder-manager/Settings.vala'
1430--- plugins/folder-manager/Settings.vala 2013-05-31 10:38:24 +0000
1431+++ plugins/folder-manager/Settings.vala 1970-01-01 00:00:00 +0000
1432@@ -1,36 +0,0 @@
1433-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
1434-/***
1435- BEGIN LICENSE
1436-
1437- Copyright (C) 2013 Julien Spautz <spautz.julien@gmail.com>
1438- This program is free software: you can redistribute it and/or modify it
1439- under the terms of the GNU Lesser General Public License version 3, as published
1440- by the Free Software Foundation.
1441-
1442- This program is distributed in the hope that it will be useful, but
1443- WITHOUT ANY WARRANTY; without even the implied warranties of
1444- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1445- PURPOSE. See the GNU General Public License for more details.
1446-
1447- You should have received a copy of the GNU General Public License along
1448- with this program. If not, see <http://www.gnu.org/licenses/>
1449-
1450- END LICENSE
1451-***/
1452-
1453-namespace Scratch.Plugins.FolderManager {
1454-
1455- /**
1456- * Class for interacting with gsettings.
1457- */
1458- internal class Settings : Granite.Services.Settings {
1459-
1460- private const string SCHEMA = "org.pantheon.scratch.plugins.folder-manager";
1461-
1462- public string[] opened_folders { get; set; }
1463-
1464- public Settings () {
1465- base (SCHEMA);
1466- }
1467- }
1468-}
1469
1470=== removed file 'plugins/folder-manager/folder-manager.plugin'
1471--- plugins/folder-manager/folder-manager.plugin 2013-06-08 15:17:42 +0000
1472+++ plugins/folder-manager/folder-manager.plugin 1970-01-01 00:00:00 +0000
1473@@ -1,10 +0,0 @@
1474-[Plugin]
1475-Module=folder-manager
1476-Loader=C
1477-IAge=2
1478-Name=Folder Manager
1479-Description=Basic folder manager with file browsing
1480-Icon=folder-saved-search
1481-Authors=Julien Spautz <spautz.julien@gmail.com>
1482-Copyright=Copyright © 2013 Scratch Developers
1483-Website=http://launchpad.net/scratch
1484
1485=== modified file 'plugins/outline/OutlinePlugin.vala'
1486--- plugins/outline/OutlinePlugin.vala 2016-01-14 19:33:06 +0000
1487+++ plugins/outline/OutlinePlugin.vala 2016-09-03 22:26:31 +0000
1488@@ -21,6 +21,7 @@
1489 public const string NAME = _("Outline");
1490 public const string DESCRIPTION = _("Outline symbols in your current file in vala");
1491
1492+
1493 namespace Scratch.Plugins {
1494 public class OutlinePlugin : Peas.ExtensionBase, Peas.Activatable {
1495 public Object object { owned get; construct; }
1496@@ -113,7 +114,9 @@
1497
1498 void add_container () {
1499 if (notebook.page_num (container) == -1) {
1500- notebook.append_page (container, new Gtk.Label (_("Symbols")));
1501+ var icon = new Gtk.Image.from_icon_name ("view-sort-ascending-symbolic", Gtk.IconSize.MENU);
1502+ icon.tooltip_text = _("Outline");
1503+ notebook.append_page (container, icon);
1504 container.show_all ();
1505 }
1506 }
1507
1508=== modified file 'plugins/source-tree/SourceTreePlugin.vala'
1509--- plugins/source-tree/SourceTreePlugin.vala 2015-12-01 11:41:37 +0000
1510+++ plugins/source-tree/SourceTreePlugin.vala 2016-09-03 22:26:31 +0000
1511@@ -194,7 +194,9 @@
1512 view.welcome_hidden.connect (() => {
1513 this.bookmark_tool_button.visible = true;
1514 this.bookmark_tool_button.no_show_all = false;
1515- this.side_notebook.append_page (this.view, new Gtk.Label (_("Source Tree")));
1516+ var icon = new Gtk.Image.from_icon_name ("view-list-symbolic", Gtk.IconSize.MENU);
1517+ icon.tooltip_text = _("Source Tree");
1518+ this.side_notebook.append_page (this.view, icon);
1519 });
1520 });
1521
1522
1523=== modified file 'schemas/CMakeLists.txt'
1524--- schemas/CMakeLists.txt 2015-09-10 00:54:45 +0000
1525+++ schemas/CMakeLists.txt 2016-09-03 22:26:31 +0000
1526@@ -1,6 +1,5 @@
1527 include(GSettings)
1528 add_schema("org.pantheon.scratch.gschema.xml")
1529-add_schema("org.pantheon.scratch.plugins.folder-manager.gschema.xml")
1530 add_schema("org.pantheon.scratch.plugins.file-manager.gschema.xml")
1531 add_schema("org.pantheon.scratch.plugins.terminal.gschema.xml")
1532 add_schema("org.pantheon.scratch.plugins.spell.gschema.xml")
1533
1534=== modified file 'schemas/org.pantheon.scratch.plugins.file-manager.gschema.xml'
1535--- schemas/org.pantheon.scratch.plugins.file-manager.gschema.xml 2013-07-16 15:56:38 +0000
1536+++ schemas/org.pantheon.scratch.plugins.file-manager.gschema.xml 2016-09-03 22:26:31 +0000
1537@@ -1,10 +1,10 @@
1538 <?xml version="1.0" encoding="UTF-8"?>
1539 <schemalist>
1540 <schema path="/org/pantheon/scratch/plugins/file-manager/" id="org.pantheon.scratch.plugins.file-manager" gettext-domain="scratch">
1541- <key name="opened-folder" type="s">
1542- <default>''</default>
1543- <summary>Opened folder.</summary>
1544- <description>Opened folder that should be restored in startup.</description>
1545+ <key name="opened-folders" type="as">
1546+ <default>[]</default>
1547+ <summary>Opened folders.</summary>
1548+ <description>Opened folders that should be restored in startup.</description>
1549 </key>
1550 </schema>
1551 </schemalist>
1552
1553=== removed file 'schemas/org.pantheon.scratch.plugins.folder-manager.gschema.xml'
1554--- schemas/org.pantheon.scratch.plugins.folder-manager.gschema.xml 2013-05-31 10:38:24 +0000
1555+++ schemas/org.pantheon.scratch.plugins.folder-manager.gschema.xml 1970-01-01 00:00:00 +0000
1556@@ -1,10 +0,0 @@
1557-<?xml version="1.0" encoding="UTF-8"?>
1558-<schemalist>
1559- <schema path="/org/pantheon/scratch/plugins/folder-manager/" id="org.pantheon.scratch.plugins.folder-manager" gettext-domain="scratch">
1560- <key name="opened-folders" type="as">
1561- <default>[]</default>
1562- <summary>Opened folders.</summary>
1563- <description>Opened folders that should be restored in startup.</description>
1564- </key>
1565- </schema>
1566-</schemalist>

Subscribers

People subscribed via source and target branches