Merge lp:~niclasl/granite/tab-icon-visibility into lp:~elementary-pantheon/granite/granite

Proposed by Niclas Lockner
Status: Merged
Approved by: David Gomes
Approved revision: 760
Merged at revision: 760
Proposed branch: lp:~niclasl/granite/tab-icon-visibility
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 66 lines (+17/-11)
1 file modified
lib/Widgets/DynamicNotebook.vala (+17/-11)
To merge this branch: bzr merge lp:~niclasl/granite/tab-icon-visibility
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+227981@code.launchpad.net

Commit message

Implements show_icon property in tab objects which allows for correct icon visibility state after changing the 'working' property of a given tab.

Description of the change

When a tab's working property is set to false, and when a pinned non-working tab is unpinned, the tab's icon visibility is set to true even though the DynamicNotebook object's show_icons property is false. This branch fixes these bugs.

To post a comment you must log in.
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

This very well may break process completion notifications in pantheon-terminal - they use tab icons in a slightly wonky way that worked up until now, but may break after this change. In that case Terminal should be fixed.

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

I didn't see any regressions when I tested pantheon-terminal with this branch installed

760. By Niclas Lockner

Code-style

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 'lib/Widgets/DynamicNotebook.vala'
2--- lib/Widgets/DynamicNotebook.vala 2014-04-05 09:09:57 +0000
3+++ lib/Widgets/DynamicNotebook.vala 2014-07-31 12:42:38 +0000
4@@ -122,6 +122,16 @@
5 }
6 }
7
8+ bool _show_icon;
9+ internal bool show_icon {
10+ get { return _show_icon; }
11+
12+ set {
13+ _icon.visible = value && !working;
14+ _show_icon = value;
15+ }
16+ }
17+
18 internal Gtk.Image _icon;
19 public GLib.Icon? icon {
20 owned get { return _icon.gicon; }
21@@ -132,7 +142,11 @@
22 bool __working;
23 public bool working {
24 get { return __working; }
25- set { __working = _working.visible = value; _icon.visible = !value; }
26+
27+ set {
28+ __working = _working.visible = value;
29+ _icon.visible = show_icon && !value;
30+ }
31 }
32
33 public Pango.EllipsizeMode ellipsize_mode {
34@@ -532,7 +546,7 @@
35 get { return _show_icons; }
36 set {
37 if (_show_icons != value) {
38- tabs.foreach ((t) => t._icon.visible = (value && !t.working));
39+ tabs.foreach ((t) => t.show_icon = value);
40 }
41 _show_icons = value;
42 }
43@@ -1056,14 +1070,6 @@
44 return;
45 }
46
47- var pin_state = !tab.pinned;
48- if (pin_state) {
49- tab._icon.visible = !tab.working;
50- tab.closable = tabs_closable;
51- } else {
52- tab._icon.visible = show_icons && !tab.working;
53- }
54-
55 recalc_order ();
56 recalc_size ();
57 }
58@@ -1133,7 +1139,7 @@
59 this.notebook.set_tab_reorderable (tab.page_container, this.allow_drag);
60 this.notebook.set_tab_detachable (tab.page_container, this.allow_new_window);
61
62- tab._icon.visible = show_icons && !tab.working;
63+ tab.show_icon = show_icons;
64 tab.duplicate_m.visible = allow_duplication;
65 tab.new_window_m.visible = allow_new_window;
66 tab.pin_m.visible = allow_pinning;

Subscribers

People subscribed via source and target branches