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: 149 lines (+30/-22)
3 files modified
plugins/browser-preview/browser-preview.vala (+5/-2)
plugins/outline/OutlinePlugin.vala (+17/-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
elementary Apps team Pending
Review via email: mp+244354@code.launchpad.net

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

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 :

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

1430. By artem-anufrij

Destroy Toggle Button on deactivating plugin

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

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 :
1431. By artem-anufrij

OUTLINE: moved plugin from the right side to the left side

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

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

1432. By artem-anufrij

fixed code style

1433. By artem-anufrij

fixed code style

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-12 20:21:24 +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-12 20:21:24 +0000
29@@ -35,6 +35,7 @@
30 public class OutlinePlugin : Peas.ExtensionBase, Peas.Activatable {
31 public Object object { owned get; construct; }
32
33+ //Gtk.ToggleToolButton? tool_button = null;
34 Scratch.Services.Interface scratch_interface;
35 SymbolOutline? current_view = null;
36 Gtk.EventBox? container = null;
37@@ -46,9 +47,11 @@
38
39 public void activate () {
40 scratch_interface = (Scratch.Services.Interface)object;
41- scratch_interface.hook_notebook_context.connect (on_hook_context);
42+
43 scratch_interface.hook_document.connect (on_hook_document);
44- scratch_interface.hook_split_view.connect (on_hook_split_view);
45+
46+ scratch_interface.hook_notebook_sidebar.connect (on_hook_sidebar);
47+
48 views = new Gee.LinkedList<SymbolOutline> ();
49 }
50
51@@ -59,18 +62,20 @@
52 public void update_state () {
53 }
54
55- void on_hook_context (Gtk.Notebook notebook) {
56+ void on_hook_sidebar (Gtk.Notebook notebook) {
57 if (container != null)
58 return;
59 if (this.notebook == null)
60 this.notebook = notebook;
61-
62+
63 container = new Gtk.EventBox ();
64 container.visible = false;
65+ if (this.notebook != null)
66+ notebook.append_page (container, new Gtk.Label (_("Symbols")));
67 }
68
69 void on_hook_document (Scratch.Services.Document doc) {
70- if (current_view != null && current_view.doc == doc)
71+ if (current_view != null && current_view.doc == doc)
72 return;
73
74 if (current_view != null)
75@@ -83,6 +88,7 @@
76 break;
77 }
78 }
79+
80 if (view == null && doc.file != null) {
81 if (doc.get_mime_type () == "text/x-vala") {
82 view = new ValaSymbolOutline (doc);
83@@ -108,28 +114,19 @@
84 remove_container ();
85 }
86 }
87-
88+
89 void add_container () {
90 if(notebook.page_num (container) == -1) {
91 notebook.append_page (container, new Gtk.Label (_("Symbols")));
92 container.show_all ();
93 }
94 }
95-
96+
97 void remove_container () {
98 if (notebook.page_num (container) != -1)
99 notebook.remove (container);
100 }
101-
102- void on_hook_split_view (Scratch.Widgets.SplitView view) {
103- view.welcome_shown.connect (() => {
104- remove_container ();
105- });
106- view.welcome_hidden.connect (() => {
107- add_container ();
108- });
109- }
110-
111+
112 void update_timeout () {
113 if (refresh_timeout != 0)
114 Source.remove (refresh_timeout);
115@@ -163,6 +160,6 @@
116 [ModuleInit]
117 public void peas_register_types (GLib.TypeModule module)
118 {
119- var objmodule = module as Peas.ObjectModule;
120- objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
121-}
122\ No newline at end of file
123+ var objmodule = module as Peas.ObjectModule;
124+ objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
125+}
126
127=== modified file 'plugins/terminal/terminal.vala'
128--- plugins/terminal/terminal.vala 2014-12-05 20:58:48 +0000
129+++ plugins/terminal/terminal.vala 2014-12-12 20:21:24 +0000
130@@ -61,12 +61,20 @@
131 plugins.hook_notebook_bottom.connect ((n) => {
132 if (bottombar == null) {
133 this.bottombar = n;
134+ this.bottombar.switch_page.connect ((page, page_num) => {
135+ if(tool_button.active != (grid == page) && bottombar.page_num(grid) > -1)
136+ tool_button.active = (grid == page);
137+ });
138 }
139 });
140
141 plugins.hook_notebook_context.connect ((n) => {
142 if (contextbar == null) {
143 this.contextbar = n;
144+ this.contextbar.switch_page.connect ((page, page_num) => {
145+ if(tool_button.active != (grid == page) && contextbar.page_num(grid) > -1)
146+ tool_button.active = (grid == page);
147+ });
148 }
149 });
150

Subscribers

People subscribed via source and target branches