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
=== modified file 'plugins/browser-preview/browser-preview.vala'
--- plugins/browser-preview/browser-preview.vala 2014-12-03 22:04:20 +0000
+++ plugins/browser-preview/browser-preview.vala 2014-12-16 18:14:37 +0000
@@ -82,7 +82,7 @@
82 var icon = new Gtk.Image.from_icon_name ("emblem-web", Gtk.IconSize.LARGE_TOOLBAR);82 var icon = new Gtk.Image.from_icon_name ("emblem-web", Gtk.IconSize.LARGE_TOOLBAR);
83 tool_button = new Gtk.ToggleToolButton ();83 tool_button = new Gtk.ToggleToolButton ();
84 tool_button.set_icon_widget (icon);84 tool_button.set_icon_widget (icon);
85 tool_button.tooltip_text = _("Hide Preview");85 tool_button.tooltip_text = _("Show Preview");
86 tool_button.toggled.connect (toggle_plugin_visibility);86 tool_button.toggled.connect (toggle_plugin_visibility);
8787
88 tool_button.show_all ();88 tool_button.show_all ();
@@ -95,7 +95,10 @@
95 return;95 return;
9696
97 this.notebook = notebook;97 this.notebook = notebook;
9898 this.notebook.switch_page.connect ((page, page_num) => {
99 if (tool_button.active != (view.paned == page))
100 tool_button.active = (view.paned == page);
101 });
99 set_current_document (this.doc);102 set_current_document (this.doc);
100 }103 }
101104
102105
=== modified file 'plugins/outline/OutlinePlugin.vala'
--- plugins/outline/OutlinePlugin.vala 2014-04-23 22:33:04 +0000
+++ plugins/outline/OutlinePlugin.vala 2014-12-16 18:14:37 +0000
@@ -46,9 +46,11 @@
4646
47 public void activate () {47 public void activate () {
48 scratch_interface = (Scratch.Services.Interface)object;48 scratch_interface = (Scratch.Services.Interface)object;
49 scratch_interface.hook_notebook_context.connect (on_hook_context);49
50 scratch_interface.hook_document.connect (on_hook_document);50 scratch_interface.hook_document.connect (on_hook_document);
51 scratch_interface.hook_split_view.connect (on_hook_split_view);51
52 scratch_interface.hook_notebook_sidebar.connect (on_hook_sidebar);
53
52 views = new Gee.LinkedList<SymbolOutline> ();54 views = new Gee.LinkedList<SymbolOutline> ();
53 }55 }
5456
@@ -59,18 +61,20 @@
59 public void update_state () {61 public void update_state () {
60 }62 }
6163
62 void on_hook_context (Gtk.Notebook notebook) {64 void on_hook_sidebar (Gtk.Notebook notebook) {
63 if (container != null)65 if (container != null)
64 return;66 return;
65 if (this.notebook == null)67 if (this.notebook == null)
66 this.notebook = notebook;68 this.notebook = notebook;
67 69
68 container = new Gtk.EventBox ();70 container = new Gtk.EventBox ();
69 container.visible = false;71 container.visible = false;
72 if (this.notebook != null)
73 notebook.append_page (container, new Gtk.Label (_("Symbols")));
70 }74 }
7175
72 void on_hook_document (Scratch.Services.Document doc) {76 void on_hook_document (Scratch.Services.Document doc) {
73 if (current_view != null && current_view.doc == doc) 77 if (current_view != null && current_view.doc == doc)
74 return;78 return;
7579
76 if (current_view != null)80 if (current_view != null)
@@ -83,6 +87,7 @@
83 break;87 break;
84 }88 }
85 }89 }
90
86 if (view == null && doc.file != null) {91 if (view == null && doc.file != null) {
87 if (doc.get_mime_type () == "text/x-vala") {92 if (doc.get_mime_type () == "text/x-vala") {
88 view = new ValaSymbolOutline (doc);93 view = new ValaSymbolOutline (doc);
@@ -108,28 +113,19 @@
108 remove_container ();113 remove_container ();
109 }114 }
110 }115 }
111 116
112 void add_container () {117 void add_container () {
113 if(notebook.page_num (container) == -1) {118 if(notebook.page_num (container) == -1) {
114 notebook.append_page (container, new Gtk.Label (_("Symbols")));119 notebook.append_page (container, new Gtk.Label (_("Symbols")));
115 container.show_all ();120 container.show_all ();
116 }121 }
117 }122 }
118 123
119 void remove_container () {124 void remove_container () {
120 if (notebook.page_num (container) != -1)125 if (notebook.page_num (container) != -1)
121 notebook.remove (container);126 notebook.remove (container);
122 }127 }
123 128
124 void on_hook_split_view (Scratch.Widgets.SplitView view) {
125 view.welcome_shown.connect (() => {
126 remove_container ();
127 });
128 view.welcome_hidden.connect (() => {
129 add_container ();
130 });
131 }
132
133 void update_timeout () {129 void update_timeout () {
134 if (refresh_timeout != 0)130 if (refresh_timeout != 0)
135 Source.remove (refresh_timeout);131 Source.remove (refresh_timeout);
@@ -163,6 +159,6 @@
163[ModuleInit]159[ModuleInit]
164public void peas_register_types (GLib.TypeModule module)160public void peas_register_types (GLib.TypeModule module)
165{161{
166 var objmodule = module as Peas.ObjectModule;
167 objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
168}
169\ No newline at end of file162\ No newline at end of file
163 var objmodule = module as Peas.ObjectModule;
164 objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
165}
170166
=== modified file 'plugins/terminal/terminal.vala'
--- plugins/terminal/terminal.vala 2014-12-05 20:58:48 +0000
+++ plugins/terminal/terminal.vala 2014-12-16 18:14:37 +0000
@@ -61,12 +61,20 @@
61 plugins.hook_notebook_bottom.connect ((n) => {61 plugins.hook_notebook_bottom.connect ((n) => {
62 if (bottombar == null) {62 if (bottombar == null) {
63 this.bottombar = n;63 this.bottombar = n;
64 this.bottombar.switch_page.connect ((page, page_num) => {
65 if (tool_button.active != (grid == page) && bottombar.page_num (grid) > -1)
66 tool_button.active = (grid == page);
67 });
64 }68 }
65 });69 });
6670
67 plugins.hook_notebook_context.connect ((n) => {71 plugins.hook_notebook_context.connect ((n) => {
68 if (contextbar == null) {72 if (contextbar == null) {
69 this.contextbar = n;73 this.contextbar = n;
74 this.contextbar.switch_page.connect ((page, page_num) => {
75 if (tool_button.active != (grid == page) && contextbar.page_num (grid) > -1)
76 tool_button.active = (grid == page);
77 });
70 }78 }
71 });79 });
7280

Subscribers

People subscribed via source and target branches