Merge lp:~artem-anufrij/scratch/Bugfix-1399456 into lp:~elementary-apps/scratch/scratch

Proposed by Artem Anufrij
Status: Merged
Approved by: Robert Roth
Approved revision: 1428
Merged at revision: 1427
Proposed branch: lp:~artem-anufrij/scratch/Bugfix-1399456
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 92 lines (+26/-14)
1 file modified
plugins/terminal/terminal.vala (+26/-14)
To merge this branch: bzr merge lp:~artem-anufrij/scratch/Bugfix-1399456
Reviewer Review Type Date Requested Status
Robert Roth (community) Approve
Review via email: mp+243863@code.launchpad.net

Commit message

Hide terminal toggle button on welcome screen (lp:1399456)

Description of the change

hide terminal toggle button on welcome screen.

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

I have renamed "toolbutton" to "tool_button" like "webbrowser" plugin. This is the reason for "92 lines (+26/-14) 1 file modified". :)

Bugfix code is just only in the lines:

Line 17
and
Line 44 - 53.

1428. By artem-anufrij

hide toggle button on welcome screen.

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

Next time you could do the bugfix in a separate commit, and the renaming in another one, and so you will not have to explain what's the bugfix and what's other stuff :) Good job, approving. As danrabbit reported the bug, I guess we don't need a UX review, so I'm approving the merge proposal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/terminal/terminal.vala'
--- plugins/terminal/terminal.vala 2014-12-03 22:04:20 +0000
+++ plugins/terminal/terminal.vala 2014-12-05 20:59:04 +0000
@@ -30,7 +30,7 @@
30 Gtk.Notebook? bottombar = null;30 Gtk.Notebook? bottombar = null;
31 Gtk.Notebook? contextbar = null;31 Gtk.Notebook? contextbar = null;
32 Scratch.Widgets.Toolbar? toolbar = null;32 Scratch.Widgets.Toolbar? toolbar = null;
33 Gtk.ToggleToolButton? toolbutton = null;33 Gtk.ToggleToolButton? tool_button = null;
3434
35 bool on_bottom = true;35 bool on_bottom = true;
3636
@@ -77,21 +77,23 @@
77 }77 }
78 });78 });
7979
80 plugins.hook_split_view.connect (on_hook_split_view);
81
80 on_hook_notebook ();82 on_hook_notebook ();
81 }83 }
8284
83 public void deactivate () {85 public void deactivate () {
84 if (terminal != null)86 if (terminal != null)
85 grid.destroy ();87 grid.destroy ();
86 if (toolbutton != null)88 if (tool_button != null)
87 toolbutton.destroy ();89 tool_button.destroy ();
8890
89 window.key_press_event.disconnect (switch_focus);91 window.key_press_event.disconnect (switch_focus);
90 }92 }
9193
92 void switch_terminal_location () {94 void switch_terminal_location () {
9395
94 if (bottombar.page_num (grid) == -1 && this.location_bottom.active) {96 if (bottombar.page_num (grid) == -1 && this.location_bottom.active) {
9597
96 contextbar.remove_page (contextbar.page_num (grid));98 contextbar.remove_page (contextbar.page_num (grid));
97 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));99 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));
@@ -130,22 +132,32 @@
130 return false;132 return false;
131 }133 }
132134
135 void on_hook_split_view (Scratch.Widgets.SplitView view) {
136 this.tool_button.visible = ! view.is_empty ();
137 view.welcome_shown.connect (() => {
138 this.tool_button.visible = false;
139 });
140 view.welcome_hidden.connect (() => {
141 this.tool_button.visible = true;
142 });
143 }
144
133 void on_hook_toolbar (Scratch.Widgets.Toolbar toolbar) {145 void on_hook_toolbar (Scratch.Widgets.Toolbar toolbar) {
134 var icon = new Gtk.Image.from_icon_name ("utilities-terminal", Gtk.IconSize.LARGE_TOOLBAR);146 var icon = new Gtk.Image.from_icon_name ("utilities-terminal", Gtk.IconSize.LARGE_TOOLBAR);
135 toolbutton = new Gtk.ToggleToolButton ();147 tool_button = new Gtk.ToggleToolButton ();
136 toolbutton.set_icon_widget (icon);148 tool_button.set_icon_widget (icon);
137 toolbutton.set_active (false);149 tool_button.set_active (false);
138 toolbutton.tooltip_text = _("Show Terminal");150 tool_button.tooltip_text = _("Show Terminal");
139 toolbutton.toggled.connect (() => {151 tool_button.toggled.connect (() => {
140 if (this.toolbutton.active) {152 if (this.tool_button.active) {
141 toolbutton.tooltip_text = _("Hide Terminal");153 tool_button.tooltip_text = _("Hide Terminal");
142 if (on_bottom) {154 if (on_bottom) {
143 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));155 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));
144 } else {156 } else {
145 contextbar.set_current_page (contextbar.append_page (grid, new Gtk.Label (_("Terminal"))));157 contextbar.set_current_page (contextbar.append_page (grid, new Gtk.Label (_("Terminal"))));
146 }158 }
147 } else {159 } else {
148 toolbutton.tooltip_text = _("Show Terminal");160 tool_button.tooltip_text = _("Show Terminal");
149 if (on_bottom) {161 if (on_bottom) {
150 bottombar.remove_page (bottombar.page_num (grid));162 bottombar.remove_page (bottombar.page_num (grid));
151 } else {163 } else {
@@ -154,9 +166,9 @@
154 }166 }
155 });167 });
156168
157 toolbutton.show_all ();169 tool_button.show_all ();
158170
159 toolbar.pack_end (toolbutton);171 toolbar.pack_end (tool_button);
160 }172 }
161173
162 void on_hook_notebook () {174 void on_hook_notebook () {

Subscribers

People subscribed via source and target branches