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
=== modified file 'src/Widgets/MenuBar.vala'
--- src/Widgets/MenuBar.vala 2013-04-14 07:54:25 +0000
+++ src/Widgets/MenuBar.vala 2015-03-06 05:49:05 +0000
@@ -20,5 +20,9 @@
20 can_focus = true;20 can_focus = true;
21 border_width = 0;21 border_width = 0;
22 get_style_context ().add_class (StyleClass.COMPOSITED_INDICATOR);22 get_style_context ().add_class (StyleClass.COMPOSITED_INDICATOR);
23
24 // make sure menubars are fully transparent when we later adjust the transparency
25 // in the panel's draw callback
26 override_background_color (Gtk.StateFlags.NORMAL, {0, 0, 0, 0});
23 }27 }
24}28}
2529
=== modified file 'src/Widgets/Panel.vala'
--- src/Widgets/Panel.vala 2015-01-22 06:06:22 +0000
+++ src/Widgets/Panel.vala 2015-03-06 05:49:05 +0000
@@ -21,15 +21,11 @@
21namespace Wingpanel.Widgets {21namespace Wingpanel.Widgets {
2222
23 public class Panel : BasePanel {23 public class Panel : BasePanel {
24 private IndicatorLoader indicator_loader;
25 private IndicatorMenubar right_menubar;
26 private MenuBar left_menubar;
27 private MenuBar center_menubar;
24 private Gtk.Box container;28 private Gtk.Box container;
25 private Gtk.Box left_wrapper;
26 private Gtk.Box right_wrapper;
27
28 private IndicatorMenubar menubar;
29 private MenuBar clock;
30 private MenuBar apps_menubar;
31
32 private IndicatorLoader indicator_loader;
3329
34 public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) {30 public Panel (Gtk.Application app, Services.Settings settings, IndicatorLoader indicator_loader) {
35 base (settings);31 base (settings);
@@ -38,11 +34,7 @@
38 set_application (app);34 set_application (app);
3935
40 container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);36 container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
41 left_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
42 right_wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
43 container.set_homogeneous (false);37 container.set_homogeneous (false);
44 left_wrapper.set_homogeneous (false);
45 right_wrapper.set_homogeneous (false);
4638
47 add (container);39 add (container);
4840
@@ -81,9 +73,9 @@
81 string entry_name = entry.get_indicator ().get_name ();73 string entry_name = entry.get_indicator ().get_name ();
8274
83 if (entry_name == "libdatetime.so" || entry_name == "com.canonical.indicator.datetime")75 if (entry_name == "libdatetime.so" || entry_name == "com.canonical.indicator.datetime")
84 clock.prepend (entry);76 center_menubar.prepend (entry);
85 else77 else
86 menubar.insert_sorted (entry);78 right_menubar.insert_sorted (entry);
87 }79 }
8880
89 private void delete_entry (IndicatorWidget entry) {81 private void delete_entry (IndicatorWidget entry) {
@@ -96,39 +88,17 @@
96 }88 }
9789
98 private void add_defaults (Services.Settings settings) {90 private void add_defaults (Services.Settings settings) {
99 // Add Apps button91 left_menubar = new MenuBar ();
100 apps_menubar = new MenuBar ();92 center_menubar = new MenuBar ();
101 var apps_button = new Widgets.AppsButton (settings);93 right_menubar = new IndicatorMenubar ();
102 apps_menubar.append (apps_button);94
10395 right_menubar.halign = Gtk.Align.END;
104 left_wrapper.pack_start (apps_menubar, false, true, 0);96
10597 left_menubar.append (new Widgets.AppsButton (settings));
106 container.pack_start (left_wrapper);98
10799 container.pack_start (left_menubar);
108 clock = new MenuBar ();100 container.pack_end (right_menubar);
109 container.pack_start (clock, false, false, 0);101 container.set_center_widget (center_menubar);
110
111 // Menubar for storing indicators
112 menubar = new IndicatorMenubar ();
113
114 right_wrapper.pack_end (menubar, false, false, 0);
115 container.pack_end (right_wrapper);
116
117 var gpr = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
118 gpr.add_widget (left_wrapper);
119 gpr.add_widget (right_wrapper);
120
121 // make sure those are all transparent when we later adjust the transparency
122 // in the panel's draw callback
123 clock.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
124 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
125 });
126 menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
127 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
128 });
129 apps_menubar.override_background_color (Gtk.StateFlags.NORMAL, Gdk.RGBA () {
130 red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0
131 });
132 }102 }
133 }103 }
134}104}

Subscribers

People subscribed via source and target branches