Merge lp:~gangsterveggies/granite/fix-bug-1205236 into lp:~elementary-pantheon/granite/granite

Proposed by Pedro Paredes on 2013-08-22
Status: Work in progress
Proposed branch: lp:~gangsterveggies/granite/fix-bug-1205236
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 124 lines (+68/-0)
1 file modified
lib/Widgets/DynamicNotebook.vala (+68/-0)
To merge this branch: bzr merge lp:~gangsterveggies/granite/fix-bug-1205236
Reviewer Review Type Date Requested Status
Cody Garver Needs Fixing on 2013-08-30
David Gomes 2013-08-22 Needs Fixing on 2013-08-23
Review via email: mp+181461@code.launchpad.net

Description of the change

Fixes bug #1205236 of only showing the 'x' close button when the tab is either active or hovered.

To post a comment you must log in.
Daniel Fore (danrabbit) wrote :

It seems with this branch that hovering the tab moves the label. Is there a way to remove this side effect?

Pedro Paredes (gangsterveggies) wrote :

> It seems with this branch that hovering the tab moves the label. Is there a
> way to remove this side effect?

It moves? When I test it it doesn't, it works fine... Can you send a video showing it? (or a screenshot)

David Gomes (davidgomes) wrote :

By the way, you fucked up some tabs in your code ;)

review: Needs Fixing
614. By Launchpad Translations on behalf of elementary-pantheon on 2013-08-23

Launchpad automatic translations update.

David Gomes (davidgomes) wrote :

vala-mode is a bitch isn't it.

review: Needs Fixing
615. By Julien Spautz on 2013-08-23

DynamicNotebook: Fixed bug #1205237, implemented trash's Clear All.

Pedro Paredes (gangsterveggies) wrote :

> vala-mode is a bitch isn't it.

Sorry, corrected.

616. By Launchpad Translations on behalf of elementary-pantheon on 2013-08-24

Launchpad automatic translations update.

617. By David Gomes on 2013-08-24

ModeButton: fixed bug #1187313.

618. By David Gomes on 2013-08-24

Fixed bug #1181781, pressing Escape now clears a SearchBar.

619. By Launchpad Translations on behalf of elementary-pantheon on 2013-08-25

Launchpad automatic translations update.

620. By Pedro Paredes on 2013-08-26

DynamicNotebook: implemented pinning and pinned tabs fixing bug #959553.

Additionally, deprecated "fixed" tabs, the old name for "pinned tabs" that didn't work very well. Implemented "allow_pinning" state variable that decides whether a certain DynamicNotebook, defaults to false.

621. By Launchpad Translations on behalf of elementary-pantheon on 2013-08-27

Launchpad automatic translations update.

622. By Launchpad Translations on behalf of elementary-pantheon on 2013-08-29

Launchpad automatic translations update.

Daniel Fore (danrabbit) wrote :

http://videobin.org/+6uf/8bw.html

This also happens in Adwaita, so I don't think it's a theme-specific problem

Cody Garver (codygarver) wrote :

Branch has text conflicts

review: Needs Fixing
623. By David Gomes on 2013-08-30

Increased source list's default width, a few code style and general code fixes and renamed the demo main file for consistency.

624. By Pedro Paredes on 2013-08-30

Fixed conflicts

David Gomes (davidgomes) wrote :

Unmerged revisions

624. By Pedro Paredes on 2013-08-30

Fixed conflicts

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 2013-08-26 17:10:58 +0000
3+++ lib/Widgets/DynamicNotebook.vala 2013-08-30 20:10:30 +0000
4@@ -130,6 +130,23 @@
5 }
6 }
7
8+ bool _active;
9+ public bool active {
10+ get { return _active; }
11+ set {
12+ _active = value;
13+
14+ if (_active) {
15+ close.image = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.MENU);
16+ } else {
17+ close.image = new Gtk.Image ();
18+ }
19+ }
20+ }
21+
22+ private int tab_height = 16;
23+ private int delay_time = 100;
24+
25 internal Gtk.Button close;
26 public Gtk.Menu menu { get; set; }
27
28@@ -145,6 +162,9 @@
29 internal signal void pin_switch ();
30
31 public Tab (string label="", GLib.Icon? icon=null, Gtk.Widget? page=null) {
32+ /* To prevent changing heights */
33+ this.height_request = tab_height;
34+
35 this._label = new Gtk.Label (label);
36 if (icon != null)
37 this._icon = new Gtk.Image.from_gicon (icon, Gtk.IconSize.MENU);
38@@ -167,6 +187,7 @@
39 _label.ellipsize = Pango.EllipsizeMode.END;
40 _icon.set_size_request (16, 16);
41 _working.set_size_request (16, 16);
42+ close.set_size_request (18, 18);
43 this.visible_window = false;
44
45 this.add (tab_box);
46@@ -246,10 +267,49 @@
47 return true;
48 });
49
50+ this.enter_notify_event.connect ((e) => {
51+ if (!this.active) {
52+ Timeout.add(delay_time, () => {
53+ close.image = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.MENU);
54+ return false;
55+ });
56+ }
57+ return false;
58+ });
59+
60+ this.leave_notify_event.connect ((e) => {
61+ if (!this.active) {
62+ Timeout.add(delay_time, () => {
63+ close.image = new Gtk.Image ();
64+ return false;
65+ });
66+ }
67+ return false;
68+ });
69+
70 /*this.button_press_event.connect ((e) => {
71 return (e.type == Gdk.EventType.2BUTTON_PRESS || e.button != 1);
72 });*/
73
74+ close.enter_notify_event.connect ((e) => {
75+ if (!this.active) {
76+ Timeout.add(delay_time, () => {
77+ close.image = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.MENU);
78+ return false;
79+ });
80+ }
81+ return false;
82+ });
83+
84+ close.leave_notify_event.connect ((e) => {
85+ if (!this.active) {
86+ Timeout.add(delay_time, () => {
87+ close.image = new Gtk.Image ();
88+ return false;
89+ });
90+ }
91+ return false;
92+ });
93 page_container.button_press_event.connect (() => { return true; }); //dont let clicks pass through
94 close.clicked.connect ( () => this.closed () );
95 working = false;
96@@ -749,6 +809,9 @@
97 void on_switch_page (Gtk.Widget page, uint pagenum) {
98 var new_tab = notebook.get_tab_label (page) as Tab;
99
100+ old_tab.active = false;
101+ new_tab.active = true;
102+
103 tab_switched (old_tab, new_tab);
104 old_tab = new_tab;
105 }
106@@ -877,6 +940,7 @@
107 }
108 }
109
110+
111 [Deprecated (since=0.2)]
112 public void remove_tab_force (Tab tab) {
113 var pos = get_tab_position (tab);
114@@ -958,6 +1022,10 @@
115 tab.width_request = tab_width;
116 tab.close.get_style_context ().add_provider (button_fix,
117 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
118+ tab.active = false;
119+ if (n_tabs == 1) {
120+ tab.active = true;
121+ }
122
123 tab.closed.connect ( () => {
124 remove_tab (tab);

Subscribers

People subscribed via source and target branches