Merge lp:~elementary-apps/pantheon-terminal/tab-bar-visibility-update into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by David Gomes
Status: Merged
Approved by: David Gomes
Approved revision: 545
Merged at revision: 547
Proposed branch: lp:~elementary-apps/pantheon-terminal/tab-bar-visibility-update
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 142 lines (+10/-31)
3 files modified
org.pantheon.terminal.gschema.xml (+5/-5)
src/PantheonTerminalWindow.vala (+4/-19)
src/Settings.vala (+1/-7)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-terminal/tab-bar-visibility-update
Reviewer Review Type Date Requested Status
Niclas Lockner (community) Approve
elementary Apps team Pending
Review via email: mp+202521@code.launchpad.net

Commit message

Fixes Pantheon Terminal for the latest version of Granite with DynamicNotebook.TabBarVisibility.

Description of the change

https://code.launchpad.net/~elementary-apps/granite/tab-bar-visibility/+merge/202517

Depends on that and uses that fix to refactor some of Pantheon Terminal's code.

To post a comment you must log in.
545. By David Gomes

Removed trailing white space.

Revision history for this message
Niclas Lockner (niclasl) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'org.pantheon.terminal.gschema.xml'
2--- org.pantheon.terminal.gschema.xml 2013-08-26 17:04:59 +0000
3+++ org.pantheon.terminal.gschema.xml 2014-01-21 18:12:53 +0000
4@@ -6,14 +6,14 @@
5 <value nick="Fullscreen" value="2" />
6 </enum>
7
8- <enum id="pantheon-terminal-tab-bar-behavior">
9+ <enum id="dynamic-notebook-tab-bar-behavior">
10 <value value="0" nick="Always Show Tabs"/>
11 <value value="1" nick="Hide When Single Tab"/>
12 <value value="2" nick="Never Show Tabs"/>
13 </enum>
14
15- <schema path="/org/pantheon/terminal/saved-state/"
16- id="org.pantheon.terminal.saved-state"
17+ <schema path="/org/pantheon/terminal/saved-state/"
18+ id="org.pantheon.terminal.saved-state"
19 gettext-domain="pantheon-terminal">
20 <key name="window-width" type="i">
21 <default>640</default>
22@@ -47,7 +47,7 @@
23 </key>
24 </schema>
25
26- <schema path="/org/pantheon/terminal/settings/" id="org.pantheon.terminal.settings"
27+ <schema path="/org/pantheon/terminal/settings/" id="org.pantheon.terminal.settings"
28 gettext-domain="pantheon-terminal">
29 <key name="window-width" type="i">
30 <default>640</default>
31@@ -133,7 +133,7 @@
32 <summary>Whether to allow bold fonts.</summary>
33 <description>Defines whether fonts can be bold or not.</description>
34 </key>
35- <key name="tab-bar-behavior" enum="pantheon-terminal-tab-bar-behavior">
36+ <key name="tab-bar-behavior" enum="dynamic-notebook-tab-bar-behavior">
37 <default>'Always Show Tabs'</default>
38 <summary>Tab Behavior</summary>
39 <description>Whether to always show tabs, hide tabs when there is only one tab and never show tabs.</description>
40
41=== modified file 'src/PantheonTerminalWindow.vala'
42--- src/PantheonTerminalWindow.vala 2013-12-26 21:48:07 +0000
43+++ src/PantheonTerminalWindow.vala 2014-01-21 18:12:53 +0000
44@@ -146,14 +146,6 @@
45 notebook = new Granite.Widgets.DynamicNotebook ();
46 notebook.show_icons = false;
47
48- if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.ALWAYS) {
49- notebook.show_tabs = true;
50- } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
51- notebook.show_tabs = false;
52- } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.NEVER) {
53- notebook.show_tabs = false;
54- }
55-
56 main_actions.get_action ("Copy").set_sensitive (false);
57
58 notebook.tab_added.connect (on_tab_added);
59@@ -168,6 +160,7 @@
60 notebook.allow_duplication = true;
61 notebook.group_name = "pantheon-terminal";
62 notebook.can_focus = false;
63+ notebook.tab_bar_behavior = settings.tab_bar_behavior;
64 add (notebook);
65
66 this.key_press_event.connect ((e) => {
67@@ -263,7 +256,6 @@
68 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;
69 terminals.append (t);
70 t.window = this;
71- update_tabs_visibility ();
72 }
73
74 private void on_tab_removed (Granite.Widgets.Tab tab) {
75@@ -272,8 +264,6 @@
76
77 if (notebook.n_tabs == 0)
78 destroy ();
79- else
80- update_tabs_visibility ();
81 }
82
83 private bool on_close_tab_requested (Granite.Widgets.Tab tab) {
84@@ -313,7 +303,7 @@
85 new_notebook.insert_tab (tab, -1);
86 new_window.current_terminal = terminal;
87 }
88-
89+
90 private void on_tab_duplicated (Granite.Widgets.Tab tab) {
91 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;
92 new_tab (t.get_shell_location ());
93@@ -373,11 +363,6 @@
94 new_tab.page.grab_focus ();
95 }
96
97- private void update_tabs_visibility () {
98- if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE)
99- notebook.show_tabs = notebook.n_tabs > 1;
100- }
101-
102 private void open_tabs () {
103 string tabs = saved_tabs;
104 if (tabs == "" || !settings.remember_tabs ||
105@@ -392,9 +377,9 @@
106 }
107
108 private void new_tab (string directory="", string? program=null) {
109- /*
110+ /*
111 * If the user choose to use a specific working directory.
112- * Reassigning the directory variable a new value
113+ * Reassigning the directory variable a new value
114 * leads to free'd memory being read.
115 */
116 string location;
117
118=== modified file 'src/Settings.vala'
119--- src/Settings.vala 2013-08-26 17:04:59 +0000
120+++ src/Settings.vala 2014-01-21 18:12:53 +0000
121@@ -29,12 +29,6 @@
122 FULLSCREEN = 2
123 }
124
125- public enum PantheonTerminalTabBarBehavior {
126- ALWAYS = 0,
127- SINGLE = 1,
128- NEVER = 2
129- }
130-
131 public class SavedState : Granite.Services.Settings {
132
133 public int window_width { get; set; }
134@@ -69,7 +63,7 @@
135 public string encoding { get; set; }
136 public string font { get; set; }
137 public bool allow_bold { get; set; }
138- public PantheonTerminalTabBarBehavior tab_bar_behavior { get; set; }
139+ public Granite.Widgets.DynamicNotebook.TabBarBehavior tab_bar_behavior { get; set; }
140
141 public Settings () {
142 base ("org.pantheon.terminal.settings");

Subscribers

People subscribed via source and target branches