Merge lp:~gangsterveggies/pantheon-terminal/fix-bug-1166013 into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by Pedro Paredes
Status: Merged
Approved by: David Gomes
Approved revision: 512
Merged at revision: 510
Proposed branch: lp:~gangsterveggies/pantheon-terminal/fix-bug-1166013
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 143 lines (+61/-1)
3 files modified
org.pantheon.terminal.gschema.xml (+11/-0)
src/PantheonTerminalWindow.vala (+43/-1)
src/Settings.vala (+7/-0)
To merge this branch: bzr merge lp:~gangsterveggies/pantheon-terminal/fix-bug-1166013
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Danielle Foré Needs Fixing
Review via email: mp+180970@code.launchpad.net

Commit message

Fixed bug #1166013, to allow tabs to be hidden. Added a dconf-editor setting "tab-behavior" to set tab bar behavior.

Description of the change

Fixed bug #1166013, to allow tabs to be hidden. Added a dconf-editor setting to hide-tabs by default and added a right-click menu button to toggle tabs visibility.

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

Good fix, good code, but the right-click I'm pretty sure is a no-no. I'm adding the ~elementary-design team, but we want to keep the terminal simple and we don't want people accidentally hitting the switch and going crazy. We'll keep it dconf-editor only.

review: Needs Fixing
Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> Good fix, good code, but the right-click I'm pretty sure is a no-no. I'm
> adding the ~elementary-design team, but we want to keep the terminal simple
> and we don't want people accidentally hitting the switch and going crazy.
> We'll keep it dconf-editor only.

Mmmm, you are probably right. I think another option it should have would be to hide tabs if there is only one tab. For example, I use terminator and by default I don't have tabs showing. If I add a tab the header shows up and it works fine. But that only works if we have a add tab button on the actual terminal and not the header. What do you think about this?

Revision history for this message
David Gomes (davidgomes) wrote :

>Mmmm, you are probably right. I think another option it should have would be to hide tabs if there is only one tab.

Has been discussed and it's not going to happen. We want the tabs always visible, we don't like bouncing interfaces. Plus, the Add button has to be visible at all times and we're not going to put an Add button on the terminal widget.

We'll just keep hide-tabs as a dconf-only variable as so many others.

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> >Mmmm, you are probably right. I think another option it should have would be
> to hide tabs if there is only one tab.
>
> Has been discussed and it's not going to happen. We want the tabs always
> visible, we don't like bouncing interfaces. Plus, the Add button has to be
> visible at all times and we're not going to put an Add button on the terminal
> widget.
>
> We'll just keep hide-tabs as a dconf-only variable as so many others.

Ok, I guess in that case the "Toggle Tabs" button should come out then. I just feel like the menu is a bit empty, if you check menus from other terminals they have a lot of options and obviously I'm not saying we should make an impossibly long menu, but I feel like more options could help. It's just an opinion, but I get what you say.

Revision history for this message
Danielle Foré (danrabbit) wrote :

"Toggle Tabs" is not really an appropriate string in my opinion. "Show Tab Bar" and "Hide Tab Bar" would be much better.

Hiding the tabbar should probably not be possible when you have more than 1 tab open. (insensitive menu entry)
If you open a new tab (via shortcut for example), we should probably show the tabbar.

Basically if tabs > 1, always show the tabbar. Even if we'd previously chosen to hide it.

review: Needs Fixing
Revision history for this message
Julián Unrrein (junrrein) wrote :

What about the string being "Always Show Tab Bar"?

In this way, the UI can keep Daniel's proposed behavior, and the menu entry doesn't need to ever be insensitive, because the setting makes sense regardless of the number of open tabs.

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> What about the string being "Always Show Tab Bar"?
>
> In this way, the UI can keep Daniel's proposed behavior, and the menu entry
> doesn't need to ever be insensitive, because the setting makes sense
> regardless of the number of open tabs.

I like your idea. I think it's the one that solves the problem the most elegantly. But what is the "final call" then? What should I implement?

Revision history for this message
Akshay Shekher (voldyman) wrote :

You should remove the menu item and leave it in the dconf. Tabs should be shown by default.

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> You should remove the menu item and leave it in the dconf. Tabs should be
> shown by default.

Ok, I just did it.

Revision history for this message
David Gomes (davidgomes) wrote :

Have you considered that some people might want it to Never Show Tabs even when there is more than one tab open? That is why I recommend an enum with 3 modes:

Always Show Tabs - Default.
Show Tabs When More Than One Open
Never Show Tabs

Pedro told me on IRC he found this confusing, but it's not, it's just 3 modes and it's the only way to satisfy all users. Besides, only experienced (so called power users) people will mess with this setting on dconf so we know it won't confuse any simple user.

Revision history for this message
David Gomes (davidgomes) wrote :

If I put "hide-tabs" as true, when I load up the terminal won't be 80*24. It'll be slightly more than 80 per 24.

review: Needs Fixing
Revision history for this message
Alex Lourie (alourie) wrote :

Suggesting text change in schema:

<summary>Hide Tabs</summary>
<description>Hides terminal tabs if set to True</description>

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> Have you considered that some people might want it to Never Show Tabs even
> when there is more than one tab open? That is why I recommend an enum with 3
> modes:
>
> Always Show Tabs - Default.
> Show Tabs When More Than One Open
> Never Show Tabs
>
> Pedro told me on IRC he found this confusing, but it's not, it's just 3 modes
> and it's the only way to satisfy all users. Besides, only experienced (so
> called power users) people will mess with this setting on dconf so we know it
> won't confuse any simple user.

I just pushed a revision with that behavior. Test it and tell me if it works. And check the texts on dconf because you might not like what I wrote.

> If I put "hide-tabs" as true, when I load up the terminal won't be 80*24. It'll be slightly more than 80 per 24.

I can't test it, can you send me a screen? (or two, one for each setting).

Revision history for this message
David Gomes (davidgomes) wrote :

>if (notebook.n_tabs == 2) {
Shouldn't this be >1? I know we always have to go through 2 to get to 3, but it's better if you put it >1.

review: Needs Fixing
Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> >if (notebook.n_tabs == 2) {
> Shouldn't this be >1? I know we always have to go through 2 to get to 3, but
> it's better if you put it >1.

Nope, the idea is that when you get back to a single tab you want to hide tabs. The == 2 is because this is done pre-removing a tab, thus you have 2 tabs and you are removing one of them. If you put it >1 when you have say four tabs and remove one it'd hide tabs, not what we want.

Revision history for this message
David Gomes (davidgomes) wrote :

Play with tab dragging. For example, if I have 2 tabs and I drag 1 out on "Hide when single tab", I get 1 tab and I still see the tab bar.

review: Needs Fixing
Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> Play with tab dragging. For example, if I have 2 tabs and I drag 1 out on
> "Hide when single tab", I get 1 tab and I still see the tab bar.

Ups, I forgot about that, nicely spotted. On it.

Revision history for this message
David Gomes (davidgomes) :
review: Approve
Revision history for this message
David Gomes (davidgomes) wrote :

Rename tab-behavior to tab-bar-behavior and it's a merge.

review: Needs Fixing
512. By Pedro Paredes

Changed tab_behavior to tab_bar_behavior

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> Rename tab-behavior to tab-bar-behavior and it's a merge.

Done.

Revision history for this message
David Gomes (davidgomes) :
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-05-17 06:29:54 +0000
3+++ org.pantheon.terminal.gschema.xml 2013-08-26 17:07:35 +0000
4@@ -6,6 +6,12 @@
5 <value nick="Fullscreen" value="2" />
6 </enum>
7
8+ <enum id="pantheon-terminal-tab-bar-behavior">
9+ <value value="0" nick="Always Show Tabs"/>
10+ <value value="1" nick="Hide When Single Tab"/>
11+ <value value="2" nick="Never Show Tabs"/>
12+ </enum>
13+
14 <schema path="/org/pantheon/terminal/saved-state/"
15 id="org.pantheon.terminal.saved-state"
16 gettext-domain="pantheon-terminal">
17@@ -127,5 +133,10 @@
18 <summary>Whether to allow bold fonts.</summary>
19 <description>Defines whether fonts can be bold or not.</description>
20 </key>
21+ <key name="tab-bar-behavior" enum="pantheon-terminal-tab-bar-behavior">
22+ <default>'Always Show Tabs'</default>
23+ <summary>Tab Behavior</summary>
24+ <description>Whether to always show tabs, hide tabs when there is only one tab and never show tabs.</description>
25+ </key>
26 </schema>
27 </schemalist>
28
29=== modified file 'src/PantheonTerminalWindow.vala'
30--- src/PantheonTerminalWindow.vala 2013-08-18 21:03:49 +0000
31+++ src/PantheonTerminalWindow.vala 2013-08-26 17:07:35 +0000
32@@ -147,6 +147,15 @@
33 /* Set up the Notebook */
34 notebook = new Granite.Widgets.DynamicNotebook ();
35 notebook.show_icons = false;
36+
37+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.ALWAYS) {
38+ notebook.show_tabs = true;
39+ } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
40+ notebook.show_tabs = false;
41+ } else if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.NEVER) {
42+ notebook.show_tabs = false;
43+ }
44+
45 notebook.tab_switched.connect (on_switch_page);
46 notebook.tab_moved.connect (on_tab_moved);
47 notebook.allow_new_window = true;
48@@ -177,6 +186,12 @@
49
50 d.destroy ();
51
52+ if (notebook.n_tabs == 2) {
53+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
54+ notebook.show_tabs = false;
55+ }
56+ }
57+
58 return true;
59 }
60
61@@ -207,6 +222,12 @@
62 closed_by_exit = false;
63 t.kill_ps ();
64
65+ if (notebook.n_tabs == 2) {
66+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
67+ notebook.show_tabs = false;
68+ }
69+ }
70+
71 return true;
72 });
73
74@@ -325,8 +346,12 @@
75 } else {
76 current_terminal.grab_focus ();
77 }
78- if (notebook.n_tabs == 0)
79+
80+ if (notebook.n_tabs == 0) {
81 destroy ();
82+ } else if (notebook.n_tabs == 1 && settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
83+ notebook.show_tabs = false;
84+ }
85 }
86
87 private void update_context_menu () {
88@@ -379,6 +404,16 @@
89 current_terminal = ((Grid) new_tab.page).get_child_at (0, 0) as TerminalWidget;
90 title = current_terminal.window_title ?? "";
91 new_tab.page.grab_focus ();
92+
93+ if (notebook.n_tabs == 1) {
94+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
95+ notebook.show_tabs = false;
96+ }
97+ } else {
98+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
99+ notebook.show_tabs = true;
100+ }
101+ }
102 }
103
104 private void open_tabs () {
105@@ -412,6 +447,13 @@
106 t.vexpand = true;
107 t.hexpand = true;
108
109+ /* If tabs were hidden and this is not the first tab show tabs */
110+ if (notebook.n_tabs == 1) {
111+ if (settings.tab_bar_behavior == PantheonTerminalTabBarBehavior.SINGLE) {
112+ notebook.show_tabs = true;
113+ }
114+ }
115+
116 if (program == null) {
117 /* Set up the virtual terminal */
118 if (location == "")
119
120=== modified file 'src/Settings.vala'
121--- src/Settings.vala 2013-05-17 06:16:04 +0000
122+++ src/Settings.vala 2013-08-26 17:07:35 +0000
123@@ -29,6 +29,12 @@
124 FULLSCREEN = 2
125 }
126
127+ public enum PantheonTerminalTabBarBehavior {
128+ ALWAYS = 0,
129+ SINGLE = 1,
130+ NEVER = 2
131+ }
132+
133 public class SavedState : Granite.Services.Settings {
134
135 public int window_width { get; set; }
136@@ -63,6 +69,7 @@
137 public string encoding { get; set; }
138 public string font { get; set; }
139 public bool allow_bold { get; set; }
140+ public PantheonTerminalTabBarBehavior tab_bar_behavior { get; set; }
141
142 public Settings () {
143 base ("org.pantheon.terminal.settings");

Subscribers

People subscribed via source and target branches