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
=== modified file 'org.pantheon.terminal.gschema.xml'
--- org.pantheon.terminal.gschema.xml 2013-08-26 17:04:59 +0000
+++ org.pantheon.terminal.gschema.xml 2014-01-21 18:12:53 +0000
@@ -6,14 +6,14 @@
6 <value nick="Fullscreen" value="2" />6 <value nick="Fullscreen" value="2" />
7 </enum>7 </enum>
88
9 <enum id="pantheon-terminal-tab-bar-behavior">9 <enum id="dynamic-notebook-tab-bar-behavior">
10 <value value="0" nick="Always Show Tabs"/>10 <value value="0" nick="Always Show Tabs"/>
11 <value value="1" nick="Hide When Single Tab"/>11 <value value="1" nick="Hide When Single Tab"/>
12 <value value="2" nick="Never Show Tabs"/>12 <value value="2" nick="Never Show Tabs"/>
13 </enum>13 </enum>
1414
15 <schema path="/org/pantheon/terminal/saved-state/" 15 <schema path="/org/pantheon/terminal/saved-state/"
16 id="org.pantheon.terminal.saved-state" 16 id="org.pantheon.terminal.saved-state"
17 gettext-domain="pantheon-terminal">17 gettext-domain="pantheon-terminal">
18 <key name="window-width" type="i">18 <key name="window-width" type="i">
19 <default>640</default>19 <default>640</default>
@@ -47,7 +47,7 @@
47 </key>47 </key>
48 </schema>48 </schema>
4949
50 <schema path="/org/pantheon/terminal/settings/" id="org.pantheon.terminal.settings" 50 <schema path="/org/pantheon/terminal/settings/" id="org.pantheon.terminal.settings"
51 gettext-domain="pantheon-terminal">51 gettext-domain="pantheon-terminal">
52 <key name="window-width" type="i">52 <key name="window-width" type="i">
53 <default>640</default>53 <default>640</default>
@@ -133,7 +133,7 @@
133 <summary>Whether to allow bold fonts.</summary>133 <summary>Whether to allow bold fonts.</summary>
134 <description>Defines whether fonts can be bold or not.</description>134 <description>Defines whether fonts can be bold or not.</description>
135 </key>135 </key>
136 <key name="tab-bar-behavior" enum="pantheon-terminal-tab-bar-behavior">136 <key name="tab-bar-behavior" enum="dynamic-notebook-tab-bar-behavior">
137 <default>'Always Show Tabs'</default>137 <default>'Always Show Tabs'</default>
138 <summary>Tab Behavior</summary>138 <summary>Tab Behavior</summary>
139 <description>Whether to always show tabs, hide tabs when there is only one tab and never show tabs.</description>139 <description>Whether to always show tabs, hide tabs when there is only one tab and never show tabs.</description>
140140
=== modified file 'src/PantheonTerminalWindow.vala'
--- src/PantheonTerminalWindow.vala 2013-12-26 21:48:07 +0000
+++ src/PantheonTerminalWindow.vala 2014-01-21 18:12:53 +0000
@@ -146,14 +146,6 @@
146 notebook = new Granite.Widgets.DynamicNotebook ();146 notebook = new Granite.Widgets.DynamicNotebook ();
147 notebook.show_icons = false;147 notebook.show_icons = false;
148148
149 if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.ALWAYS) {
150 notebook.show_tabs = true;
151 } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
152 notebook.show_tabs = false;
153 } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.NEVER) {
154 notebook.show_tabs = false;
155 }
156
157 main_actions.get_action ("Copy").set_sensitive (false);149 main_actions.get_action ("Copy").set_sensitive (false);
158150
159 notebook.tab_added.connect (on_tab_added);151 notebook.tab_added.connect (on_tab_added);
@@ -168,6 +160,7 @@
168 notebook.allow_duplication = true;160 notebook.allow_duplication = true;
169 notebook.group_name = "pantheon-terminal";161 notebook.group_name = "pantheon-terminal";
170 notebook.can_focus = false;162 notebook.can_focus = false;
163 notebook.tab_bar_behavior = settings.tab_bar_behavior;
171 add (notebook);164 add (notebook);
172165
173 this.key_press_event.connect ((e) => {166 this.key_press_event.connect ((e) => {
@@ -263,7 +256,6 @@
263 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;256 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;
264 terminals.append (t);257 terminals.append (t);
265 t.window = this;258 t.window = this;
266 update_tabs_visibility ();
267 }259 }
268260
269 private void on_tab_removed (Granite.Widgets.Tab tab) {261 private void on_tab_removed (Granite.Widgets.Tab tab) {
@@ -272,8 +264,6 @@
272264
273 if (notebook.n_tabs == 0)265 if (notebook.n_tabs == 0)
274 destroy ();266 destroy ();
275 else
276 update_tabs_visibility ();
277 }267 }
278268
279 private bool on_close_tab_requested (Granite.Widgets.Tab tab) {269 private bool on_close_tab_requested (Granite.Widgets.Tab tab) {
@@ -313,7 +303,7 @@
313 new_notebook.insert_tab (tab, -1);303 new_notebook.insert_tab (tab, -1);
314 new_window.current_terminal = terminal;304 new_window.current_terminal = terminal;
315 }305 }
316 306
317 private void on_tab_duplicated (Granite.Widgets.Tab tab) {307 private void on_tab_duplicated (Granite.Widgets.Tab tab) {
318 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;308 var t = (tab.page as Gtk.Grid).get_child_at (0, 0) as TerminalWidget;
319 new_tab (t.get_shell_location ());309 new_tab (t.get_shell_location ());
@@ -373,11 +363,6 @@
373 new_tab.page.grab_focus ();363 new_tab.page.grab_focus ();
374 }364 }
375365
376 private void update_tabs_visibility () {
377 if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE)
378 notebook.show_tabs = notebook.n_tabs > 1;
379 }
380
381 private void open_tabs () {366 private void open_tabs () {
382 string tabs = saved_tabs;367 string tabs = saved_tabs;
383 if (tabs == "" || !settings.remember_tabs ||368 if (tabs == "" || !settings.remember_tabs ||
@@ -392,9 +377,9 @@
392 }377 }
393378
394 private void new_tab (string directory="", string? program=null) {379 private void new_tab (string directory="", string? program=null) {
395 /* 380 /*
396 * If the user choose to use a specific working directory.381 * If the user choose to use a specific working directory.
397 * Reassigning the directory variable a new value 382 * Reassigning the directory variable a new value
398 * leads to free'd memory being read.383 * leads to free'd memory being read.
399 */384 */
400 string location;385 string location;
401386
=== modified file 'src/Settings.vala'
--- src/Settings.vala 2013-08-26 17:04:59 +0000
+++ src/Settings.vala 2014-01-21 18:12:53 +0000
@@ -29,12 +29,6 @@
29 FULLSCREEN = 229 FULLSCREEN = 2
30 }30 }
3131
32 public enum PantheonTerminalTabBarBehavior {
33 ALWAYS = 0,
34 SINGLE = 1,
35 NEVER = 2
36 }
37
38 public class SavedState : Granite.Services.Settings {32 public class SavedState : Granite.Services.Settings {
3933
40 public int window_width { get; set; }34 public int window_width { get; set; }
@@ -69,7 +63,7 @@
69 public string encoding { get; set; }63 public string encoding { get; set; }
70 public string font { get; set; }64 public string font { get; set; }
71 public bool allow_bold { get; set; }65 public bool allow_bold { get; set; }
72 public PantheonTerminalTabBarBehavior tab_bar_behavior { get; set; }66 public Granite.Widgets.DynamicNotebook.TabBarBehavior tab_bar_behavior { get; set; }
7367
74 public Settings () {68 public Settings () {
75 base ("org.pantheon.terminal.settings");69 base ("org.pantheon.terminal.settings");

Subscribers

People subscribed via source and target branches