Merge lp:~unity-team/unity/unity.fix-636602 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 498
Proposed branch: lp:~unity-team/unity/unity.fix-636602
Merge into: lp:unity
Diff against target: 195 lines (+97/-13)
4 files modified
unity-private/Makefile.am (+1/-0)
unity-private/panel/panel-divider.vala (+81/-0)
unity-private/panel/panel-home-button.vala (+10/-13)
unity-private/panel/panel-view.vala (+5/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-636602
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+35293@code.launchpad.net

Description of the change

A new class called Unity.Panel.Divider has been added to fix LP: #636602. This adds a special Ctk.Image actor between the home-button and menubar/window-buttons to hold the dividing groove artwork. The padding is intentionally part of the artwork-image, because clutk/clutter would otherwise stretch the divider-groove itself to the full width (groove + right padding).

This branch needs the artwork introduced with lp:~unity-team/unity-asset-pool/unity-asset-pool.fix-636602

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

approved, works well. works a little weird in the popup version, but thats not a problem

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'unity-private/Makefile.am'
--- unity-private/Makefile.am 2010-08-26 17:04:48 +0000
+++ unity-private/Makefile.am 2010-09-13 15:48:49 +0000
@@ -76,6 +76,7 @@
7676
77panel_sources = \77panel_sources = \
78 panel/panel-background.vala \78 panel/panel-background.vala \
79 panel/panel-divider.vala \
79 panel/panel-home-button.vala \80 panel/panel-home-button.vala \
80 panel/panel-indicator-background.vala \81 panel/panel-indicator-background.vala \
81 panel/panel-indicator-bar.vala \82 panel/panel-indicator-bar.vala \
8283
=== added file 'unity-private/panel/panel-divider.vala'
--- unity-private/panel/panel-divider.vala 1970-01-01 00:00:00 +0000
+++ unity-private/panel/panel-divider.vala 2010-09-13 15:48:49 +0000
@@ -0,0 +1,81 @@
1/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
2/*
3 * Copyright (C) 2010 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by Mirco Müller <mirco.mueller@canonical.com>
18 *
19 */
20
21namespace Unity.Panel
22{
23 public class Divider : Ctk.Image
24 {
25 public Shell shell { get; construct; }
26 private Clutter.Texture bg;
27
28 public Divider (Shell shell)
29 {
30 Object (reactive:true, shell:shell);
31
32 shell.mode_changed.connect (on_mode_changed);
33
34 Unity.Testing.ObjectRegistry.get_default ().register ("PanelDivider",
35 this);
36 }
37
38 construct
39 {
40 try
41 {
42 bg = new Clutter.Texture.from_file (
43 "/usr/share/unity/themes/divider.png");
44 }
45 catch (Error e)
46 {
47 warning ("Could not load bg-texture for divider: %s", e.message);
48 }
49
50 set_background (bg);
51 }
52
53 /* the current divider-artwork is two pixels wide */
54 private override void get_preferred_width (float for_height,
55 out float min_width,
56 out float nat_width)
57 {
58 // the width of six pixels is made up of two pixels for the divider itself
59 // and four pixels for the padding; the padding needs to be in the image
60 // of the artwork, because otherwise clutk/clutter would stretch the two
61 // pixel divider across the whole width
62 min_width = 6.0f;
63 nat_width = 6.0f;
64 }
65
66 private void on_mode_changed (ShellMode mode)
67 {
68 if (mode == ShellMode.MINIMIZED)
69 {
70 set_background (bg);
71 }
72 else
73 {
74 set_background (null);
75 }
76
77 do_queue_redraw ();
78 }
79
80 }
81}
082
=== modified file 'unity-private/panel/panel-home-button.vala'
--- unity-private/panel/panel-home-button.vala 2010-09-09 07:08:56 +0000
+++ unity-private/panel/panel-home-button.vala 2010-09-13 15:48:49 +0000
@@ -28,7 +28,6 @@
28 private Clutter.Texture bfb_bg_normal;28 private Clutter.Texture bfb_bg_normal;
29 private Clutter.Texture bfb_bg_prelight;29 private Clutter.Texture bfb_bg_prelight;
30 private Clutter.Texture bfb_bg_active;30 private Clutter.Texture bfb_bg_active;
31 private bool search_shown;
3231
33 public HomeButton (Shell shell)32 public HomeButton (Shell shell)
34 {33 {
@@ -52,7 +51,7 @@
5251
53 notify["state"].connect (on_state_changed);52 notify["state"].connect (on_state_changed);
5453
55 width += 3.0f;54 //width += 3.0f;
5655
57 glow = new Ctk.EffectGlow ();56 glow = new Ctk.EffectGlow ();
58 glow.set_color ({ 255, 255, 255, 255 });57 glow.set_color ({ 255, 255, 255, 255 });
@@ -98,8 +97,6 @@
98 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bfb_bg_normal);97 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bfb_bg_normal);
99 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bfb_bg_prelight);98 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bfb_bg_prelight);
100 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bfb_bg_active);99 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bfb_bg_active);
101
102 search_shown = false;
103 }100 }
104101
105 private override void allocate (Clutter.ActorBox box,102 private override void allocate (Clutter.ActorBox box,
@@ -111,9 +108,10 @@
111 float pheight;108 float pheight;
112 Ctk.Padding pad = { 0 };109 Ctk.Padding pad = { 0 };
113 110
114 // 2.0f are added so the home-button groove aligns with the111 // 1.0f are subtracted so the groove dividing home-button and
115 // right edge of the launcher, this fixes LP: #630031112 // the rest of the panel aligns with the right edge of the
116 lwidth = 2.0f + (float) shell.get_launcher_width_foobar ();113 // launcher, this fixes LP: #630031
114 lwidth = (float) shell.get_launcher_width_foobar () - 1.0f;
117 pheight = (float) shell.get_panel_height_foobar ();115 pheight = (float) shell.get_panel_height_foobar ();
118 theme_image.get_preferred_size (out cwidth, out cheight,116 theme_image.get_preferred_size (out cwidth, out cheight,
119 out cwidth, out cheight);117 out cwidth, out cheight);
@@ -180,10 +178,11 @@
180 out float min_width,178 out float min_width,
181 out float nat_width)179 out float nat_width)
182 {180 {
183 // 2.0f are added so the home-button groove aligns with the181 // 1.0f are subtracted so the groove dividing home-button and
184 // right edge of the launcher, this fixes LP: #630031182 // the rest of the panel aligns with the right edge of the
185 min_width = 2.0f + shell.get_launcher_width_foobar ();183 // launcher, this fixes LP: #630031
186 nat_width = 2.0f + shell.get_launcher_width_foobar ();184 min_width = shell.get_launcher_width_foobar () - 1.0f;
185 nat_width = shell.get_launcher_width_foobar () - 1.0f;
187 }186 }
188187
189 private void on_mode_changed (ShellMode mode)188 private void on_mode_changed (ShellMode mode)
@@ -193,14 +192,12 @@
193 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bfb_bg_normal);192 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bfb_bg_normal);
194 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bfb_bg_prelight);193 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bfb_bg_prelight);
195 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bfb_bg_active);194 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bfb_bg_active);
196 search_shown = false;
197 }195 }
198 else196 else
199 {197 {
200 set_background_for_state (Ctk.ActorState.STATE_NORMAL, null);198 set_background_for_state (Ctk.ActorState.STATE_NORMAL, null);
201 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, null);199 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, null);
202 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, null);200 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, null);
203 search_shown = true;
204 }201 }
205202
206 do_queue_redraw ();203 do_queue_redraw ();
207204
=== modified file 'unity-private/panel/panel-view.vala'
--- unity-private/panel/panel-view.vala 2010-08-02 09:16:36 +0000
+++ unity-private/panel/panel-view.vala 2010-09-13 15:48:49 +0000
@@ -33,6 +33,7 @@
33 Ctk.HBox hbox;33 Ctk.HBox hbox;
34 Background bground;34 Background bground;
35 HomeButton home_button;35 HomeButton home_button;
36 Divider divider;
36 WindowButtons window_buttons;37 WindowButtons window_buttons;
37 MenuBar menu_bar;38 MenuBar menu_bar;
38 SystemTray system_tray;39 SystemTray system_tray;
@@ -68,6 +69,10 @@
68 hbox.pack (home_button, false, true);69 hbox.pack (home_button, false, true);
69 home_button.show ();70 home_button.show ();
7071
72 divider = new Divider (shell);
73 hbox.pack (divider, false, false);
74 divider.show ();
75
71 window_buttons = new WindowButtons ();76 window_buttons = new WindowButtons ();
72 hbox.pack (window_buttons, false, true);77 hbox.pack (window_buttons, false, true);
73 window_buttons.show ();78 window_buttons.show ();