Merge lp:~artem-anufrij/scratch/Bugfix-1399017-PlugIn-Switcher into lp:~elementary-apps/scratch/scratch

Proposed by Artem Anufrij
Status: Superseded
Proposed branch: lp:~artem-anufrij/scratch/Bugfix-1399017-PlugIn-Switcher
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 141 lines (+29/-22)
3 files modified
plugins/browser-preview/browser-preview.vala (+5/-2)
plugins/outline/OutlinePlugin.vala (+16/-20)
plugins/terminal/terminal.vala (+8/-0)
To merge this branch: bzr merge lp:~artem-anufrij/scratch/Bugfix-1399017-PlugIn-Switcher
Reviewer Review Type Date Requested Status
Robert Roth (community) code Approve
Review via email: mp+244711@code.launchpad.net

This proposal supersedes a proposal from 2014-12-10.

This proposal has been superseded by a proposal from 2014-12-16.

Description of the change

#1 Added a toggle button for the "Outline" plugin.

2# Plugin toggle buttons toggle tabs visibility in the "context" - notebook.
- Browser Preview
- Terminal (if it's on the right side)
- Outline

To post a comment you must log in.
Revision history for this message
Artem Anufrij (artem-anufrij) wrote : Posted in a previous version of this proposal

which icon can I use for the "ouline" plugin?

Revision history for this message
Danielle Foré (danrabbit) wrote : Posted in a previous version of this proposal

Hm it seems to me that the Outline plugin is a navigation feature and not a result/utility. I think it doesn't belong in this stack but on the left side in a stack with the folder/file browser.

See this mockup: https://launchpadlibrarian.net/156102789/scratch.png

Otherwise, hiding/showing and switching panes work as expected.

Revision history for this message
Artem Anufrij (artem-anufrij) wrote : Posted in a previous version of this proposal
Revision history for this message
Robert Roth (evfool) wrote : Posted in a previous version of this proposal

Code style looks mostly ok, see a few comments inline, as usual, some nitpicking whitespace comments.

1432. By artem-anufrij

fixed code style

Revision history for this message
Robert Roth (evfool) wrote :

Found another one, the last one.

1433. By artem-anufrij

fixed code style

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

@Robert: done!

Revision history for this message
Robert Roth (evfool) :
review: Approve (code)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/browser-preview/browser-preview.vala'
2--- plugins/browser-preview/browser-preview.vala 2014-12-03 22:04:20 +0000
3+++ plugins/browser-preview/browser-preview.vala 2014-12-16 18:14:37 +0000
4@@ -82,7 +82,7 @@
5 var icon = new Gtk.Image.from_icon_name ("emblem-web", Gtk.IconSize.LARGE_TOOLBAR);
6 tool_button = new Gtk.ToggleToolButton ();
7 tool_button.set_icon_widget (icon);
8- tool_button.tooltip_text = _("Hide Preview");
9+ tool_button.tooltip_text = _("Show Preview");
10 tool_button.toggled.connect (toggle_plugin_visibility);
11
12 tool_button.show_all ();
13@@ -95,7 +95,10 @@
14 return;
15
16 this.notebook = notebook;
17-
18+ this.notebook.switch_page.connect ((page, page_num) => {
19+ if (tool_button.active != (view.paned == page))
20+ tool_button.active = (view.paned == page);
21+ });
22 set_current_document (this.doc);
23 }
24
25
26=== modified file 'plugins/outline/OutlinePlugin.vala'
27--- plugins/outline/OutlinePlugin.vala 2014-04-23 22:33:04 +0000
28+++ plugins/outline/OutlinePlugin.vala 2014-12-16 18:14:37 +0000
29@@ -46,9 +46,11 @@
30
31 public void activate () {
32 scratch_interface = (Scratch.Services.Interface)object;
33- scratch_interface.hook_notebook_context.connect (on_hook_context);
34+
35 scratch_interface.hook_document.connect (on_hook_document);
36- scratch_interface.hook_split_view.connect (on_hook_split_view);
37+
38+ scratch_interface.hook_notebook_sidebar.connect (on_hook_sidebar);
39+
40 views = new Gee.LinkedList<SymbolOutline> ();
41 }
42
43@@ -59,18 +61,20 @@
44 public void update_state () {
45 }
46
47- void on_hook_context (Gtk.Notebook notebook) {
48+ void on_hook_sidebar (Gtk.Notebook notebook) {
49 if (container != null)
50 return;
51 if (this.notebook == null)
52 this.notebook = notebook;
53-
54+
55 container = new Gtk.EventBox ();
56 container.visible = false;
57+ if (this.notebook != null)
58+ notebook.append_page (container, new Gtk.Label (_("Symbols")));
59 }
60
61 void on_hook_document (Scratch.Services.Document doc) {
62- if (current_view != null && current_view.doc == doc)
63+ if (current_view != null && current_view.doc == doc)
64 return;
65
66 if (current_view != null)
67@@ -83,6 +87,7 @@
68 break;
69 }
70 }
71+
72 if (view == null && doc.file != null) {
73 if (doc.get_mime_type () == "text/x-vala") {
74 view = new ValaSymbolOutline (doc);
75@@ -108,28 +113,19 @@
76 remove_container ();
77 }
78 }
79-
80+
81 void add_container () {
82 if(notebook.page_num (container) == -1) {
83 notebook.append_page (container, new Gtk.Label (_("Symbols")));
84 container.show_all ();
85 }
86 }
87-
88+
89 void remove_container () {
90 if (notebook.page_num (container) != -1)
91 notebook.remove (container);
92 }
93-
94- void on_hook_split_view (Scratch.Widgets.SplitView view) {
95- view.welcome_shown.connect (() => {
96- remove_container ();
97- });
98- view.welcome_hidden.connect (() => {
99- add_container ();
100- });
101- }
102-
103+
104 void update_timeout () {
105 if (refresh_timeout != 0)
106 Source.remove (refresh_timeout);
107@@ -163,6 +159,6 @@
108 [ModuleInit]
109 public void peas_register_types (GLib.TypeModule module)
110 {
111- var objmodule = module as Peas.ObjectModule;
112- objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
113-}
114\ No newline at end of file
115+ var objmodule = module as Peas.ObjectModule;
116+ objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
117+}
118
119=== modified file 'plugins/terminal/terminal.vala'
120--- plugins/terminal/terminal.vala 2014-12-05 20:58:48 +0000
121+++ plugins/terminal/terminal.vala 2014-12-16 18:14:37 +0000
122@@ -61,12 +61,20 @@
123 plugins.hook_notebook_bottom.connect ((n) => {
124 if (bottombar == null) {
125 this.bottombar = n;
126+ this.bottombar.switch_page.connect ((page, page_num) => {
127+ if (tool_button.active != (grid == page) && bottombar.page_num (grid) > -1)
128+ tool_button.active = (grid == page);
129+ });
130 }
131 });
132
133 plugins.hook_notebook_context.connect ((n) => {
134 if (contextbar == null) {
135 this.contextbar = n;
136+ this.contextbar.switch_page.connect ((page, page_num) => {
137+ if (tool_button.active != (grid == page) && contextbar.page_num (grid) > -1)
138+ tool_button.active = (grid == page);
139+ });
140 }
141 });
142

Subscribers

People subscribed via source and target branches