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
1=== modified file 'plugins/terminal/terminal.vala'
2--- plugins/terminal/terminal.vala 2014-12-03 22:04:20 +0000
3+++ plugins/terminal/terminal.vala 2014-12-05 20:59:04 +0000
4@@ -30,7 +30,7 @@
5 Gtk.Notebook? bottombar = null;
6 Gtk.Notebook? contextbar = null;
7 Scratch.Widgets.Toolbar? toolbar = null;
8- Gtk.ToggleToolButton? toolbutton = null;
9+ Gtk.ToggleToolButton? tool_button = null;
10
11 bool on_bottom = true;
12
13@@ -77,21 +77,23 @@
14 }
15 });
16
17+ plugins.hook_split_view.connect (on_hook_split_view);
18+
19 on_hook_notebook ();
20 }
21
22 public void deactivate () {
23 if (terminal != null)
24 grid.destroy ();
25- if (toolbutton != null)
26- toolbutton.destroy ();
27+ if (tool_button != null)
28+ tool_button.destroy ();
29
30 window.key_press_event.disconnect (switch_focus);
31 }
32
33 void switch_terminal_location () {
34
35- if (bottombar.page_num (grid) == -1 && this.location_bottom.active) {
36+ if (bottombar.page_num (grid) == -1 && this.location_bottom.active) {
37
38 contextbar.remove_page (contextbar.page_num (grid));
39 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));
40@@ -130,22 +132,32 @@
41 return false;
42 }
43
44+ void on_hook_split_view (Scratch.Widgets.SplitView view) {
45+ this.tool_button.visible = ! view.is_empty ();
46+ view.welcome_shown.connect (() => {
47+ this.tool_button.visible = false;
48+ });
49+ view.welcome_hidden.connect (() => {
50+ this.tool_button.visible = true;
51+ });
52+ }
53+
54 void on_hook_toolbar (Scratch.Widgets.Toolbar toolbar) {
55 var icon = new Gtk.Image.from_icon_name ("utilities-terminal", Gtk.IconSize.LARGE_TOOLBAR);
56- toolbutton = new Gtk.ToggleToolButton ();
57- toolbutton.set_icon_widget (icon);
58- toolbutton.set_active (false);
59- toolbutton.tooltip_text = _("Show Terminal");
60- toolbutton.toggled.connect (() => {
61- if (this.toolbutton.active) {
62- toolbutton.tooltip_text = _("Hide Terminal");
63+ tool_button = new Gtk.ToggleToolButton ();
64+ tool_button.set_icon_widget (icon);
65+ tool_button.set_active (false);
66+ tool_button.tooltip_text = _("Show Terminal");
67+ tool_button.toggled.connect (() => {
68+ if (this.tool_button.active) {
69+ tool_button.tooltip_text = _("Hide Terminal");
70 if (on_bottom) {
71 bottombar.set_current_page (bottombar.append_page (grid, new Gtk.Label (_("Terminal"))));
72 } else {
73 contextbar.set_current_page (contextbar.append_page (grid, new Gtk.Label (_("Terminal"))));
74 }
75 } else {
76- toolbutton.tooltip_text = _("Show Terminal");
77+ tool_button.tooltip_text = _("Show Terminal");
78 if (on_bottom) {
79 bottombar.remove_page (bottombar.page_num (grid));
80 } else {
81@@ -154,9 +166,9 @@
82 }
83 });
84
85- toolbutton.show_all ();
86+ tool_button.show_all ();
87
88- toolbar.pack_end (toolbutton);
89+ toolbar.pack_end (tool_button);
90 }
91
92 void on_hook_notebook () {

Subscribers

People subscribed via source and target branches