Merge lp:~limeth/midori/midori-bug-768569 into lp:midori

Proposed by Limeth
Status: Needs review
Proposed branch: lp:~limeth/midori/midori-bug-768569
Merge into: lp:midori
Diff against target: 78 lines (+45/-5)
2 files modified
data/faq.html (+1/-1)
midori/midori-notebook.vala (+44/-4)
To merge this branch: bzr merge lp:~limeth/midori/midori-bug-768569
Reviewer Review Type Date Requested Status
Cris Dywan Needs Fixing
Review via email: mp+273314@code.launchpad.net

Description of the change

- Change "Show Tab Icon Only" to "Pin Tab" and "Show Tab Label" to "Unpin Tab";
- Move pinned tab after pinned tabs on the left, move unpinned tab out of pinned tabs to the right

Fixes: https://bugs.launchpad.net/midori/+bug/768569

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

The behavior is erratic, there's a 50/50 chance the tab size is reduced and it's at the left side. Also pinned tabs are never restored upon restart.

I think all updates should happen in tab_minimized because that also applies on restart, rather than in the UI-specific callback. But from a quick check that's not resolving the fundamental problem here.

review: Needs Fixing
Revision history for this message
Cris Dywan (kalikiana) wrote :

Incidentally I always imagined if we did this sort of thing it would be the most natural to put the pinned tabs in the left-side hbox, and not keep them as regular tabs. If you haven't considered that, it might make thinks easier.

Unmerged revisions

7044. By Limeth

Move pinned tab after pinned tabs on the left, move unpinned tab out of pinned tabs to the right

7043. By Limeth

Change "Show Tab Icon Only" to "Pin Tab" and "Show Tab Label" to "Unpin Tab"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/faq.html'
2--- data/faq.html 2015-08-30 10:19:52 +0000
3+++ data/faq.html 2015-10-03 09:17:15 +0000
4@@ -471,7 +471,7 @@
5 <div class="level4">
6
7 <p>
8-Right-click the tab label, and click &#039;Minimize&#039; or &#039;Show Tab Icon Only&#039; (Midori 0.3.5 or older).
9+Right-click the tab label, and click &#039;Minimize&#039; or &#039;Pin Tab&#039; (Midori 0.3.5 or older).
10 </p>
11
12 </div>
13
14=== modified file 'midori/midori-notebook.vala'
15--- midori/midori-notebook.vala 2014-03-30 14:00:38 +0000
16+++ midori/midori-notebook.vala 2015-10-03 09:17:15 +0000
17@@ -359,6 +359,48 @@
18 resize (size.width);
19 }
20
21+ /**
22+ * Returns the amount of pinned tabs on the left side of the notebook.
23+ * If break_at is specified, stops counting once it reaches break_at.
24+ */
25+ int get_number_of_pinned_tabs_on_the_left (Midori.Tab? break_at = null)
26+ {
27+ var minimized_tabs_on_the_left = 0;
28+
29+ foreach (var child in notebook.get_children ()) {
30+ if ((break_at != null && child == break_at) || !(child is Midori.Tab) || !((Midori.Tab) child).minimized)
31+ break;
32+
33+ minimized_tabs_on_the_left++;
34+ }
35+
36+ return minimized_tabs_on_the_left;
37+ }
38+
39+ /**
40+ * Pins/unpins selected tab
41+ */
42+ bool toggle_tab_minimized (Midori.Tab tab)
43+ {
44+ var tab_index = notebook.page_num (tab);
45+
46+ if (tab.minimized) {
47+ var minimized_tabs_on_the_left = get_number_of_pinned_tabs_on_the_left ();
48+
49+ if (tab_index < minimized_tabs_on_the_left) {
50+ notebook.reorder_child (tab, minimized_tabs_on_the_left - 1);
51+ }
52+ } else {
53+ var minimized_tabs_on_the_left = get_number_of_pinned_tabs_on_the_left (tab);
54+
55+ if (tab_index > minimized_tabs_on_the_left) {
56+ notebook.reorder_child (tab, minimized_tabs_on_the_left);
57+ }
58+ }
59+
60+ return tab.minimized = !tab.minimized;
61+ }
62+
63 /* Since: 0.5.8 */
64 public ContextAction get_tab_context_action (Midori.Tab tab) {
65 var menu = new Midori.ContextAction ("TabContextMenu", null, null, null);
66@@ -368,10 +410,8 @@
67 tab_detached (tab, 128, 128);
68 });
69 menu.add (action_window);
70- var action_minimize = new Midori.ContextAction ("TabMinimize", tab.minimized ? _("Show Tab _Label") : _("Show Tab _Icon Only"), null, null);
71- action_minimize.activate.connect (()=>{
72- tab.minimized = !tab.minimized;
73- });
74+ var action_minimize = new Midori.ContextAction ("TabMinimize", tab.minimized ? _("Un_pin Tab") : _("_Pin Tab"), null, null);
75+ action_minimize.activate.connect (() => toggle_tab_minimized (tab));
76 menu.add (action_minimize);
77 var action_right = new Midori.ContextAction ("TabCloseRight", ngettext ("Close Tab to the R_ight", "Close Tabs to the R_ight", count - 1), null, null);
78 action_right.sensitive = count > 1;

Subscribers

People subscribed via source and target branches

to all changes: