Merge lp:~victored/wingpanel/lp-1051655 into lp:~elementary-pantheon/wingpanel/trunk-0.3.x

Proposed by Victor Martinez
Status: Merged
Approved by: Danielle Foré
Approved revision: 209
Merged at revision: 212
Proposed branch: lp:~victored/wingpanel/lp-1051655
Merge into: lp:~elementary-pantheon/wingpanel/trunk-0.3.x
Diff against target: 112 lines (+21/-47)
2 files modified
src/Widgets/MenuBar.vala (+4/-0)
src/Widgets/Panel.vala (+17/-47)
To merge this branch: bzr merge lp:~victored/wingpanel/lp-1051655
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+252061@code.launchpad.net

Commit message

Prevent overflowing when other indicators reach the date-time area. Push date-time indicator to the left instead. This code takes advantage of Gtk.Box's ability to center a widget. Fixes lp:1051655.

Description of the change

Prevent overflowing when other indicators reach the date-time area. Push date-time indicator to the left instead. This code takes advantage of Gtk.Box's ability to center a widget. Fixes lp:1051655.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/MenuBar.vala'
2--- src/Widgets/MenuBar.vala 2013-04-14 07:54:25 +0000
3+++ src/Widgets/MenuBar.vala 2015-03-06 05:49:05 +0000
4@@ -20,5 +20,9 @@
5 can_focus = true;
6 border_width = 0;
7 get_style_context ().add_class (StyleClass.COMPOSITED_INDICATOR);
8+
9+ // make sure menubars are fully transparent when we later adjust the transparency
10+ // in the panel's draw callback
11+ override_background_color (Gtk.StateFlags.NORMAL, {0, 0, 0, 0});
12 }
13 }
14
15=== modified file 'src/Widgets/Panel.vala'
16--- src/Widgets/Panel.vala 2015-01-22 06:06:22 +0000
17+++ src/Widgets/Panel.vala 2015-03-06 05:49:05 +0000
18@@ -21,15 +21,11 @@
19 namespace Wingpanel.Widgets {
20
21 public class Panel : BasePanel {
22+ private IndicatorLoader indicator_loader;
23+ private IndicatorMenubar right_menubar;
24+ private MenuBar left_menubar;
25+ private MenuBar center_menubar;
26 private Gtk.Box container;
27- private Gtk.Box left_wrapper;
28- private Gtk.Box right_wrapper;
29-
30- private IndicatorMenubar menubar;
31- private MenuBar clock;
32- private MenuBar apps_menubar;
33-
34- private IndicatorLoader indicator_loader;
35
36 public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) {
37 base (settings);
38@@ -38,11 +34,7 @@
39 set_application (app);
40
41 container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
42- left_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
43- right_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
44 container.set_homogeneous (false);
45- left_wrapper.set_homogeneous (false);
46- right_wrapper.set_homogeneous (false);
47
48 add (container);
49
50@@ -81,9 +73,9 @@
51 string entry_name = entry.get_indicator ().get_name ();
52
53 if (entry_name == "libdatetime.so" || entry_name == "com.canonical.indicator.datetime")
54- clock.prepend (entry);
55+ center_menubar.prepend (entry);
56 else
57- menubar.insert_sorted (entry);
58+ right_menubar.insert_sorted (entry);
59 }
60
61 private void delete_entry (IndicatorWidget entry) {
62@@ -96,39 +88,17 @@
63 }
64
65 private void add_defaults (Services.Settings settings) {
66- // Add Apps button
67- apps_menubar = new MenuBar ();
68- var apps_button = new Widgets.AppsButton (settings);
69- apps_menubar.append (apps_button);
70-
71- left_wrapper.pack_start (apps_menubar, false, true, 0);
72-
73- container.pack_start (left_wrapper);
74-
75- clock = new MenuBar ();
76- container.pack_start (clock, false, false, 0);
77-
78- // Menubar for storing indicators
79- menubar = new IndicatorMenubar ();
80-
81- right_wrapper.pack_end (menubar, false, false, 0);
82- container.pack_end (right_wrapper);
83-
84- var gpr = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
85- gpr.add_widget (left_wrapper);
86- gpr.add_widget (right_wrapper);
87-
88- // make sure those are all transparent when we later adjust the transparency
89- // in the panel's draw callback
90- clock.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
91- red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
92- });
93- menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
94- red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
95- });
96- apps_menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
97- red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
98- });
99+ left_menubar = new MenuBar ();
100+ center_menubar = new MenuBar ();
101+ right_menubar = new IndicatorMenubar ();
102+
103+ right_menubar.halign = Gtk.Align.END;
104+
105+ left_menubar.append (new Widgets.AppsButton (settings));
106+
107+ container.pack_start (left_menubar);
108+ container.pack_end (right_menubar);
109+ container.set_center_widget (center_menubar);
110 }
111 }
112 }

Subscribers

People subscribed via source and target branches