Merge lp:~macslow/unity/unity.fix-748101 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1774
Proposed branch: lp:~macslow/unity/unity.fix-748101
Merge into: lp:unity
Diff against target: 111 lines (+19/-15)
2 files modified
plugins/unityshell/src/PlacesGroup.cpp (+17/-15)
plugins/unityshell/src/PlacesGroup.h (+2/-0)
To merge this branch: bzr merge lp:~macslow/unity/unity.fix-748101
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) style Approve
Review via email: mp+84975@code.launchpad.net

Description of the change

This fixes the alignment of the baseline of both text-labels (both on the same baseline now), uses updated/correct artwork-assets for the expander-arrows and corrects the spacing between icon, name, expander-label and expander-arrows.

There is no test other than the before/after screenshots I provide here...

http://people.canonical.com/~mmueller/748101-before.png
http://people.canonical.com/~mmueller/748101-after.png

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

It looks like the glow on the expander arrow is gone, is that on purpose?

Revision history for this message
Adolfo Jayme Barrientos (fitojb) wrote :

> It looks like the glow on the expander arrow is gone, is that on purpose?

Yes, see bug 748101 starting at comment 20

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Thanks for the pointer Fitoschido

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

92 + //const gchar* temp = " %s ";
93 + //gchar* tmp = NULL;
94 gchar* final = NULL;
95 if (_cached_name != NULL)
96 {
97 @@ -161,13 +170,14 @@
98
99 _cached_name = g_strdup(name);
100
101 - tmp = g_markup_escape_text(name, -1);
102 + //tmp = g_markup_escape_text(name, -1);
103 + final = g_markup_escape_text(name, -1);
104
105 - final = g_strdup_printf(temp, tmp);
106 + //final = g_strdup_printf(temp, tmp);
107
108 _name->SetText(final);
109
110 - g_free(tmp);
111 + //g_free(tmp);
112 g_free(final);

I think this commented out code can be removed?

143 + /*nux::Color red(1.0, 0.0, 0.0, 1.0);
144 + nux::Color green(0.0, 1.0, 0.0, 1.0);
145 + nux::Color blue(0.0, 0.0, 1.0, 1.0);
146 +
147 + nux::Geometry geo;
148 + geo = _header_layout->GetGeometry();
149 + print_geo ("_header_layout", geo);
150 + geo = _text_layout->GetGeometry();
151 + print_geo ("_text_layout", geo);
152 + geo = _expand_layout->GetGeometry();
153 + print_geo ("_expand_layout", geo);
154 +
155 + nux::GetPainter().Paint2DQuadColor(GfxContext, _header_layout->GetGeometry(), red);
156 + nux::GetPainter().Paint2DQuadColor(GfxContext, _text_layout->GetGeometry(), green);
157 + nux::GetPainter().Paint2DQuadColor(GfxContext, _expand_layout->GetGeometry(), blue);*/

As can that (almost missed it)

128 +void print_geo (std::string text, nux::Geometry geo)
129 +{
130 + std::cout << text.c_str() << ": "
131 + << geo.GetWidth() << "/"
132 + << geo.GetHeight()
133 + << std::endl;
134 +}

Is this a debugging function? I'm not really against having them in the code, as long as they are done in a consistent way - I was discussing this with thumper the other day, we should look into having a header file with overloads for std::ostream & operator<< for types that need printing out a lot, maybe stuff we can just #ifdef out on non-debug builds

review: Needs Fixing (style)
Revision history for this message
Mirco Müller (macslow) wrote :

Fixed the raised issues.

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve (style)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/resources/dash_group_expand.png'
2Binary files plugins/unityshell/resources/dash_group_expand.png 2011-02-28 12:58:19 +0000 and plugins/unityshell/resources/dash_group_expand.png 2011-12-12 12:37:25 +0000 differ
3=== modified file 'plugins/unityshell/resources/dash_group_unexpand.png'
4Binary files plugins/unityshell/resources/dash_group_unexpand.png 2011-02-28 12:58:19 +0000 and plugins/unityshell/resources/dash_group_unexpand.png 2011-12-12 12:37:25 +0000 differ
5=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
6--- plugins/unityshell/src/PlacesGroup.cpp 2011-11-07 19:05:57 +0000
7+++ plugins/unityshell/src/PlacesGroup.cpp 2011-12-12 12:37:25 +0000
8@@ -44,9 +44,9 @@
9
10 #include "DashStyle.h"
11
12-static const nux::Color kExpandDefaultTextColor(1.0f, 1.0f, 1.0f, 0.6f);
13+static const nux::Color kExpandDefaultTextColor(1.0f, 1.0f, 1.0f, 0.5f);
14 static const nux::Color kExpandHoverTextColor(1.0f, 1.0f, 1.0f, 1.0f);
15-static const float kExpandDefaultIconOpacity = 0.6f;
16+static const float kExpandDefaultIconOpacity = 0.5f;
17 static const float kExpandHoverIconOpacity = 1.0f;
18
19 namespace unity
20@@ -72,16 +72,25 @@
21 _group_layout->AddLayout(new nux::SpaceLayout(15,15,15,15), 0);
22
23 _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
24- _group_layout->AddLayout(_header_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
25+ _header_layout->SetHorizontalInternalMargin(10);
26+ _group_layout->AddLayout(_header_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FIX);
27
28 _icon = new IconTexture("", 24);
29 _icon->SetMinMaxSize(24, 24);
30 _header_layout->AddView(_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
31
32+ _text_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
33+ _text_layout->SetHorizontalInternalMargin(15);
34+ _header_layout->AddLayout(_text_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
35+
36 _name = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
37 _name->SetTextEllipsize(nux::StaticCairoText::NUX_ELLIPSIZE_END);
38 _name->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
39- _header_layout->AddView(_name, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
40+ _text_layout->AddView(_name, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
41+
42+ _expand_layout = new nux::HLayout(NUX_TRACKER_LOCATION);
43+ _expand_layout->SetHorizontalInternalMargin(8);
44+ _text_layout->AddLayout(_expand_layout, 0, nux::MINOR_POSITION_END, nux::MINOR_SIZE_MATCHCONTENT);
45
46 _expand_label = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
47 _expand_label->SetTextEllipsize(nux::StaticCairoText::NUX_ELLIPSIZE_END);
48@@ -91,13 +100,13 @@
49 _expand_label->OnKeyNavFocusActivate.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelActivated));
50 _expand_label->OnKeyNavFocusChange.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged));
51
52- _header_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
53+ _expand_layout->AddView(_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
54
55 _expand_icon = new IconTexture(arrow, arrow->GetWidth(), arrow->GetHeight());
56 _expand_icon->SetOpacity(kExpandDefaultIconOpacity);
57 _expand_icon->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
58 _expand_icon->SetVisible(false);
59- _header_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
60+ _expand_layout->AddView(_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
61
62 SetLayout(_group_layout);
63
64@@ -148,10 +157,6 @@
65 void
66 PlacesGroup::SetName(const char* name)
67 {
68- // Spaces are on purpose, want padding to be proportional to the size of the text
69- // Bear with me, I'm trying something different :)
70- const gchar* temp = " %s ";
71- gchar* tmp = NULL;
72 gchar* final = NULL;
73 if (_cached_name != NULL)
74 {
75@@ -161,13 +166,10 @@
76
77 _cached_name = g_strdup(name);
78
79- tmp = g_markup_escape_text(name, -1);
80-
81- final = g_strdup_printf(temp, tmp);
82+ final = g_markup_escape_text(name, -1);
83
84 _name->SetText(final);
85
86- g_free(tmp);
87 g_free(final);
88 }
89
90@@ -212,7 +214,7 @@
91 void
92 PlacesGroup::RefreshLabel()
93 {
94- const char* temp = "<small>%s</small>";
95+ const char* temp = "<span size='small'>%s</span>";
96 char* result_string;
97 char* final;
98
99
100=== modified file 'plugins/unityshell/src/PlacesGroup.h'
101--- plugins/unityshell/src/PlacesGroup.h 2011-11-28 21:27:17 +0000
102+++ plugins/unityshell/src/PlacesGroup.h 2011-12-12 12:37:25 +0000
103@@ -88,6 +88,8 @@
104 private:
105 nux::VLayout* _group_layout;
106 nux::HLayout* _header_layout;
107+ nux::HLayout* _text_layout;
108+ nux::HLayout* _expand_layout;
109 nux::View* _child_view;
110
111 IconTexture* _icon;