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
=== 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-12 20:21:24 +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-12 20:21:24 +0000
@@ -35,6 +35,7 @@
35 public class OutlinePlugin : Peas.ExtensionBase, Peas.Activatable {35 public class OutlinePlugin : Peas.ExtensionBase, Peas.Activatable {
36 public Object object { owned get; construct; }36 public Object object { owned get; construct; }
3737
38 //Gtk.ToggleToolButton? tool_button = null;
38 Scratch.Services.Interface scratch_interface;39 Scratch.Services.Interface scratch_interface;
39 SymbolOutline? current_view = null;40 SymbolOutline? current_view = null;
40 Gtk.EventBox? container = null;41 Gtk.EventBox? container = null;
@@ -46,9 +47,11 @@
4647
47 public void activate () {48 public void activate () {
48 scratch_interface = (Scratch.Services.Interface)object;49 scratch_interface = (Scratch.Services.Interface)object;
49 scratch_interface.hook_notebook_context.connect (on_hook_context);50
50 scratch_interface.hook_document.connect (on_hook_document);51 scratch_interface.hook_document.connect (on_hook_document);
51 scratch_interface.hook_split_view.connect (on_hook_split_view);52
53 scratch_interface.hook_notebook_sidebar.connect (on_hook_sidebar);
54
52 views = new Gee.LinkedList<SymbolOutline> ();55 views = new Gee.LinkedList<SymbolOutline> ();
53 }56 }
5457
@@ -59,18 +62,20 @@
59 public void update_state () {62 public void update_state () {
60 }63 }
6164
62 void on_hook_context (Gtk.Notebook notebook) {65 void on_hook_sidebar (Gtk.Notebook notebook) {
63 if (container != null)66 if (container != null)
64 return;67 return;
65 if (this.notebook == null)68 if (this.notebook == null)
66 this.notebook = notebook;69 this.notebook = notebook;
67 70
68 container = new Gtk.EventBox ();71 container = new Gtk.EventBox ();
69 container.visible = false;72 container.visible = false;
73 if (this.notebook != null)
74 notebook.append_page (container, new Gtk.Label (_("Symbols")));
70 }75 }
7176
72 void on_hook_document (Scratch.Services.Document doc) {77 void on_hook_document (Scratch.Services.Document doc) {
73 if (current_view != null && current_view.doc == doc) 78 if (current_view != null && current_view.doc == doc)
74 return;79 return;
7580
76 if (current_view != null)81 if (current_view != null)
@@ -83,6 +88,7 @@
83 break;88 break;
84 }89 }
85 }90 }
91
86 if (view == null && doc.file != null) {92 if (view == null && doc.file != null) {
87 if (doc.get_mime_type () == "text/x-vala") {93 if (doc.get_mime_type () == "text/x-vala") {
88 view = new ValaSymbolOutline (doc);94 view = new ValaSymbolOutline (doc);
@@ -108,28 +114,19 @@
108 remove_container ();114 remove_container ();
109 }115 }
110 }116 }
111 117
112 void add_container () {118 void add_container () {
113 if(notebook.page_num (container) == -1) {119 if(notebook.page_num (container) == -1) {
114 notebook.append_page (container, new Gtk.Label (_("Symbols")));120 notebook.append_page (container, new Gtk.Label (_("Symbols")));
115 container.show_all ();121 container.show_all ();
116 }122 }
117 }123 }
118 124
119 void remove_container () {125 void remove_container () {
120 if (notebook.page_num (container) != -1)126 if (notebook.page_num (container) != -1)
121 notebook.remove (container);127 notebook.remove (container);
122 }128 }
123 129
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 () {130 void update_timeout () {
134 if (refresh_timeout != 0)131 if (refresh_timeout != 0)
135 Source.remove (refresh_timeout);132 Source.remove (refresh_timeout);
@@ -163,6 +160,6 @@
163[ModuleInit]160[ModuleInit]
164public void peas_register_types (GLib.TypeModule module)161public void peas_register_types (GLib.TypeModule module)
165{162{
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 file163\ No newline at end of file
164 var objmodule = module as Peas.ObjectModule;
165 objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.OutlinePlugin));
166}
170167
=== modified file 'plugins/terminal/terminal.vala'
--- plugins/terminal/terminal.vala 2014-12-05 20:58:48 +0000
+++ plugins/terminal/terminal.vala 2014-12-12 20:21:24 +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