Merge lp:~unity-team/unity/fixes-2011-04-04 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1084
Proposed branch: lp:~unity-team/unity/fixes-2011-04-04
Merge into: lp:unity
Diff against target: 614 lines (+118/-69)
23 files modified
src/IndicatorObjectFactoryRemote.cpp (+2/-2)
src/LauncherIcon.cpp (+5/-0)
src/LauncherIcon.h (+1/-1)
src/PanelController.cpp (+7/-0)
src/PanelHomeButton.cpp (+3/-1)
src/PanelHomeButton.h (+1/-0)
src/PanelMenuView.cpp (+1/-1)
src/PlaceFactoryFile.cpp (+34/-1)
src/PlaceFactoryFile.h (+4/-2)
src/PlaceLauncherSection.cpp (+4/-2)
src/PlaceLauncherSection.h (+2/-0)
src/PlaceRemote.cpp (+6/-0)
src/PlaceRemote.h (+1/-1)
src/PlacesController.cpp (+1/-1)
src/PlacesHorizontalTile.cpp (+13/-11)
src/PlacesSettings.cpp (+2/-2)
src/PlacesSimpleTile.cpp (+8/-7)
src/PlacesTile.cpp (+7/-32)
src/QuicklistMenuItemCheckmark.cpp (+1/-1)
src/QuicklistMenuItemLabel.cpp (+1/-1)
src/QuicklistMenuItemRadio.cpp (+1/-1)
src/StaticCairoText.cpp (+9/-1)
src/StaticCairoText.h (+4/-1)
To merge this branch: bzr merge lp:~unity-team/unity/fixes-2011-04-04
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+56769@code.launchpad.net

Description of the change

Bugs attached plus some misc fixes.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

On Fri, 08 Apr 2011 01:42:07 you wrote:
> +bool
> +PlaceFactoryFile::DoSortThemMister (Place *aa, Place *bb)
> +{
> +#define FIRST "/com/canonical/unity/applicationsplace"
> +#define SECOND "/com/canonical/unity/filesplace"
> +

For the love of clean code, what is wrong with:

  static const char* const apps_place =
"/com/canonical/unity/applicationsplace";
  static const char* const files_place = "/com/canonical/unity/filesplace";

#defines are brutal hammers that just aren't needed in places like this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/IndicatorObjectFactoryRemote.cpp'
--- src/IndicatorObjectFactoryRemote.cpp 2011-03-31 22:02:34 +0000
+++ src/IndicatorObjectFactoryRemote.cpp 2011-04-07 13:41:22 +0000
@@ -537,8 +537,8 @@
537 }537 }
538 else if (g_strcmp0 (signal_name, "EntryShowNowChanged") == 0)538 else if (g_strcmp0 (signal_name, "EntryShowNowChanged") == 0)
539 {539 {
540 gchar *id = NULL;540 gchar *id = NULL;
541 bool show_now_state;541 gboolean show_now_state;
542542
543 g_variant_get (parameters, "(sb)", &id, &show_now_state);543 g_variant_get (parameters, "(sb)", &id, &show_now_state);
544544
545545
=== modified file 'src/LauncherIcon.cpp'
--- src/LauncherIcon.cpp 2011-04-06 17:53:41 +0000
+++ src/LauncherIcon.cpp 2011-04-07 13:41:22 +0000
@@ -71,6 +71,7 @@
71 _mouse_inside = false;71 _mouse_inside = false;
72 _has_visible_window = false;72 _has_visible_window = false;
73 _tooltip = new nux::Tooltip ();73 _tooltip = new nux::Tooltip ();
74 _tooltip->SinkReference ();
74 _icon_type = TYPE_NONE;75 _icon_type = TYPE_NONE;
75 _sort_priority = 0;76 _sort_priority = 0;
76 _shortcut = 0;77 _shortcut = 0;
@@ -79,6 +80,7 @@
79 _superkey_label = 0;80 _superkey_label = 0;
8081
81 _quicklist = new QuicklistView ();82 _quicklist = new QuicklistView ();
83 _quicklist->SinkReference ();
82 _quicklist_is_initialized = false;84 _quicklist_is_initialized = false;
83 85
84 _present_time_handle = 0;86 _present_time_handle = 0;
@@ -133,6 +135,9 @@
133135
134 if (on_order_changed_connection.connected ())136 if (on_order_changed_connection.connected ())
135 on_order_changed_connection.disconnect ();137 on_order_changed_connection.disconnect ();
138
139 _quicklist->UnReference ();
140 _tooltip->UnReference ();
136}141}
137142
138bool143bool
139144
=== modified file 'src/LauncherIcon.h'
--- src/LauncherIcon.h 2011-03-31 20:33:43 +0000
+++ src/LauncherIcon.h 2011-04-07 13:41:22 +0000
@@ -88,6 +88,7 @@
88 88
89 void SetShortcut (guint64 shortcut);89 void SetShortcut (guint64 shortcut);
90 guint64 GetShortcut ();90 guint64 GetShortcut ();
91 void SetSortPriority (int priority);
91 92
92 void RecvMouseEnter ();93 void RecvMouseEnter ();
93 void RecvMouseLeave ();94 void RecvMouseLeave ();
@@ -182,7 +183,6 @@
182 void Unpresent ();183 void Unpresent ();
183 184
184 void SetIconType (IconType type);185 void SetIconType (IconType type);
185 void SetSortPriority (int priority);
186186
187 void SetEmblem (nux::BaseTexture *emblem);187 void SetEmblem (nux::BaseTexture *emblem);
188 void SetSuperkeyLabel (nux::BaseTexture* label);188 void SetSuperkeyLabel (nux::BaseTexture* label);
189189
=== modified file 'src/PanelController.cpp'
--- src/PanelController.cpp 2011-03-29 16:02:03 +0000
+++ src/PanelController.cpp 2011-04-07 13:41:22 +0000
@@ -134,8 +134,12 @@
134 (*it)->EnableInputWindow (true);134 (*it)->EnableInputWindow (true);
135 (*it)->InputWindowEnableStruts (true);135 (*it)->InputWindowEnableStruts (true);
136136
137 g_debug ("PanelController:: Updated Panel for Monitor %d", i);
138
137 i++;139 i++;
138 }140 }
141 else
142 break;
139 }143 }
140144
141 // Add new ones if needed145 // Add new ones if needed
@@ -181,6 +185,8 @@
181 unity_util_accessible_add_window (window);185 unity_util_accessible_add_window (window);
182186
183 _windows.push_back (window);187 _windows.push_back (window);
188
189 g_debug ("PanelController:: Added Panel for Monitor %d", i);
184 }190 }
185 }191 }
186192
@@ -190,6 +196,7 @@
190 for (sit = it; sit != eit; ++sit)196 for (sit = it; sit != eit; ++sit)
191 {197 {
192 (*sit)->UnReference ();198 (*sit)->UnReference ();
199 g_debug ("PanelController:: Removed extra Panel");
193 }200 }
194201
195 _windows.erase (it, _windows.end ());202 _windows.erase (it, _windows.end ());
196203
=== modified file 'src/PanelHomeButton.cpp'
--- src/PanelHomeButton.cpp 2011-04-06 17:53:41 +0000
+++ src/PanelHomeButton.cpp 2011-04-07 13:41:22 +0000
@@ -56,7 +56,7 @@
56 G_CALLBACK (PanelHomeButton::OnIconThemeChanged), this);56 G_CALLBACK (PanelHomeButton::OnIconThemeChanged), this);
5757
58 UBusServer *ubus = ubus_server_get_default ();58 UBusServer *ubus = ubus_server_get_default ();
59 ubus_server_register_interest (ubus, UBUS_LAUNCHER_ICON_URGENT_CHANGED,59 _urgent_interest = ubus_server_register_interest (ubus, UBUS_LAUNCHER_ICON_URGENT_CHANGED,
60 (UBusCallback)&PanelHomeButton::OnLauncherIconUrgentChanged,60 (UBusCallback)&PanelHomeButton::OnLauncherIconUrgentChanged,
61 this);61 this);
6262
@@ -67,6 +67,8 @@
67{67{
68 if (_theme_changed_id)68 if (_theme_changed_id)
69 g_signal_handler_disconnect (gtk_icon_theme_get_default (), _theme_changed_id);69 g_signal_handler_disconnect (gtk_icon_theme_get_default (), _theme_changed_id);
70
71 ubus_server_unregister_interest (ubus_server_get_default (), _urgent_interest);
70}72}
7173
72void 74void
7375
=== modified file 'src/PanelHomeButton.h'
--- src/PanelHomeButton.h 2011-03-29 12:23:52 +0000
+++ src/PanelHomeButton.h 2011-04-07 13:41:22 +0000
@@ -60,6 +60,7 @@
60 int _urgent_count;60 int _urgent_count;
61 61
62 gulong _theme_changed_id;62 gulong _theme_changed_id;
63 guint _urgent_interest;
63};64};
6465
65#endif // PANEL_HOME_BUTTON_H66#endif // PANEL_HOME_BUTTON_H
6667
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-04-07 08:48:01 +0000
+++ src/PanelMenuView.cpp 2011-04-07 13:41:22 +0000
@@ -100,7 +100,7 @@
100 _on_winbutton_redraw_signal_connection = _window_buttons->redraw_signal.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowButtonsRedraw));100 _on_winbutton_redraw_signal_connection = _window_buttons->redraw_signal.connect (sigc::mem_fun (this, &PanelMenuView::OnWindowButtonsRedraw));
101101
102 _panel_titlebar_grab_area = new PanelTitlebarGrabArea ();102 _panel_titlebar_grab_area = new PanelTitlebarGrabArea ();
103 _panel_titlebar_grab_area->Reference ();103 _panel_titlebar_grab_area->SinkReference ();
104 _on_titlebargrab_mouse_down_connnection = _panel_titlebar_grab_area->mouse_down.connect (sigc::mem_fun (this, &PanelMenuView::OnMaximizedGrab));104 _on_titlebargrab_mouse_down_connnection = _panel_titlebar_grab_area->mouse_down.connect (sigc::mem_fun (this, &PanelMenuView::OnMaximizedGrab));
105 _on_titlebargrab_mouse_doubleleftclick_connnection = _panel_titlebar_grab_area->mouse_doubleleftclick.connect (sigc::mem_fun (this, &PanelMenuView::OnMouseDoubleClicked));105 _on_titlebargrab_mouse_doubleleftclick_connnection = _panel_titlebar_grab_area->mouse_doubleleftclick.connect (sigc::mem_fun (this, &PanelMenuView::OnMouseDoubleClicked));
106 _on_titlebargrab_mouse_middleclick_connnection = _panel_titlebar_grab_area->mouse_middleclick.connect (sigc::mem_fun (this, &PanelMenuView::OnMouseMiddleClicked));106 _on_titlebargrab_mouse_middleclick_connnection = _panel_titlebar_grab_area->mouse_middleclick.connect (sigc::mem_fun (this, &PanelMenuView::OnMouseMiddleClicked));
107107
=== modified file 'src/PlaceFactoryFile.cpp'
--- src/PlaceFactoryFile.cpp 2011-03-09 12:40:14 +0000
+++ src/PlaceFactoryFile.cpp 2011-04-07 13:41:22 +0000
@@ -17,6 +17,8 @@
17 */17 */
18#include "config.h"18#include "config.h"
1919
20#include <algorithm>
21
20#include "PlaceFactoryFile.h"22#include "PlaceFactoryFile.h"
2123
22#include "PlaceRemote.h"24#include "PlaceRemote.h"
@@ -120,7 +122,6 @@
120 if (place->IsValid ())122 if (place->IsValid ())
121 {123 {
122 _places.push_back (place);124 _places.push_back (place);
123 place_added.emit (place);
124 }125 }
125 else126 else
126 delete place;127 delete place;
@@ -142,11 +143,43 @@
142 return;143 return;
143 }144 }
144145
146 // Sort them
147 std::sort (_places.begin (), _places.end (), DoSortThemMister);
148
149 // Signal their creation
150 std::vector<Place *>::iterator it, eit = _places.end ();
151 for (it = _places.begin (); it != eit; ++it)
152 {
153 place_added.emit (*it);
154 g_debug ("%s", static_cast<PlaceRemote *> (*it)->GetDBusPath ());
155 }
156
145 read_directory = true;157 read_directory = true;
146158
147 g_object_unref (enumerator);159 g_object_unref (enumerator);
148}160}
149161
162bool
163PlaceFactoryFile::DoSortThemMister (Place *aa, Place *bb)
164{
165#define FIRST "/com/canonical/unity/applicationsplace"
166#define SECOND "/com/canonical/unity/filesplace"
167
168 PlaceRemote *a = static_cast<PlaceRemote *> (aa);
169 PlaceRemote *b = static_cast<PlaceRemote *> (bb);
170
171 if (g_strcmp0 (a->GetDBusPath (), FIRST) == 0)
172 return true;
173 else if (g_strcmp0 (b->GetDBusPath (), FIRST) == 0)
174 return false;
175 else if (g_strcmp0 (a->GetDBusPath (), SECOND) == 0)
176 return true;
177 else if (g_strcmp0 (b->GetDBusPath (), SECOND) == 0)
178 return false;
179 else
180 return g_strcmp0 (a->GetDBusPath (), b->GetDBusPath ()) == 0;
181}
182
150/*183/*
151 * C to C++ glue184 * C to C++ glue
152 */185 */
153186
=== modified file 'src/PlaceFactoryFile.h'
--- src/PlaceFactoryFile.h 2010-12-10 18:40:26 +0000
+++ src/PlaceFactoryFile.h 2011-04-07 13:41:22 +0000
@@ -42,10 +42,12 @@
42 /* Callbacks, not interesting to others */42 /* Callbacks, not interesting to others */
43 void OnDirectoryEnumerationReady (GObject *source,43 void OnDirectoryEnumerationReady (GObject *source,
44 GAsyncResult *result);44 GAsyncResult *result);
4545private:
46 static bool DoSortThemMister (Place *a, Place *b);
47
46public:48public:
47 /* For Debugging */49 /* For Debugging */
48 bool read_directory; 50 bool read_directory;
4951
50private:52private:
51 char *_directory;53 char *_directory;
5254
=== modified file 'src/PlaceLauncherSection.cpp'
--- src/PlaceLauncherSection.cpp 2011-03-29 14:36:45 +0000
+++ src/PlaceLauncherSection.cpp 2011-04-07 13:41:22 +0000
@@ -21,7 +21,8 @@
21#include "PlaceLauncherSection.h"21#include "PlaceLauncherSection.h"
2222
23PlaceLauncherSection::PlaceLauncherSection (Launcher *launcher)23PlaceLauncherSection::PlaceLauncherSection (Launcher *launcher)
24: _launcher (launcher)24: _launcher (launcher),
25 _priority (10000)
25{26{
26 _factory = PlaceFactory::GetDefault ();27 _factory = PlaceFactory::GetDefault ();
27 _on_place_added_connection = (sigc::connection) _factory->place_added.connect (sigc::mem_fun (this, 28 _on_place_added_connection = (sigc::connection) _factory->place_added.connect (sigc::mem_fun (this,
@@ -49,6 +50,7 @@
49 if (entry->ShowInLauncher ())50 if (entry->ShowInLauncher ())
50 {51 {
51 PlaceLauncherIcon *icon = new PlaceLauncherIcon (_launcher, entry);52 PlaceLauncherIcon *icon = new PlaceLauncherIcon (_launcher, entry);
53 icon->SetSortPriority (_priority++);
52 IconAdded.emit (icon);54 IconAdded.emit (icon);
53 }55 }
54 }56 }
@@ -73,9 +75,9 @@
73 if (entry->ShowInLauncher ())75 if (entry->ShowInLauncher ())
74 {76 {
75 PlaceLauncherIcon *icon = new PlaceLauncherIcon (_launcher, entry);77 PlaceLauncherIcon *icon = new PlaceLauncherIcon (_launcher, entry);
78 icon->SetSortPriority (_priority++);
76 IconAdded.emit (icon);79 IconAdded.emit (icon);
77 }80 }
78 }81 }
79 }82 }
80}83}
81
8284
=== modified file 'src/PlaceLauncherSection.h'
--- src/PlaceLauncherSection.h 2011-03-29 14:36:45 +0000
+++ src/PlaceLauncherSection.h 2011-04-07 13:41:22 +0000
@@ -43,6 +43,8 @@
43 Launcher *_launcher;43 Launcher *_launcher;
44 PlaceFactory *_factory;44 PlaceFactory *_factory;
45 sigc::connection _on_place_added_connection;45 sigc::connection _on_place_added_connection;
46
47 guint32 _priority;
46};48};
4749
48#endif // _PLACE_LAUNCHER_SECTION_H_50#endif // _PLACE_LAUNCHER_SECTION_H_
4951
=== modified file 'src/PlaceRemote.cpp'
--- src/PlaceRemote.cpp 2011-03-09 19:57:01 +0000
+++ src/PlaceRemote.cpp 2011-04-07 13:41:22 +0000
@@ -204,6 +204,12 @@
204 g_object_unref (_activation_proxy);204 g_object_unref (_activation_proxy);
205}205}
206206
207const gchar *
208PlaceRemote::GetDBusPath ()
209{
210 return _dbus_path;
211}
212
207void213void
208PlaceRemote::Connect ()214PlaceRemote::Connect ()
209{215{
210216
=== modified file 'src/PlaceRemote.h'
--- src/PlaceRemote.h 2011-03-09 16:26:43 +0000
+++ src/PlaceRemote.h 2011-04-07 13:41:22 +0000
@@ -47,7 +47,7 @@
47 void OnEntryAdded (GVariant *args);47 void OnEntryAdded (GVariant *args);
48 void OnEntryRemoved (const gchar *dbus_path);48 void OnEntryRemoved (const gchar *dbus_path);
4949
50 const gchar * GetDBusName ();50 const gchar * GetDBusPath ();
5151
52 void ActivateResult (const char *uri, const char *mimetype);52 void ActivateResult (const char *uri, const char *mimetype);
5353
5454
=== modified file 'src/PlacesController.cpp'
--- src/PlacesController.cpp 2011-04-06 16:35:35 +0000
+++ src/PlacesController.cpp 2011-04-07 13:41:22 +0000
@@ -252,7 +252,7 @@
252 width += tile_width;252 width += tile_width;
253253
254 width = MAX (width, tile_width * 7);254 width = MAX (width, tile_width * 7);
255 height = ((width/tile_width) - 3) * tile_width;255 height = MIN (rect.height, (style->GetTileHeight () * 5.5) + 12);
256256
257 _view->SetSizeMode (PlacesView::SIZE_MODE_HOVER);257 _view->SetSizeMode (PlacesView::SIZE_MODE_HOVER);
258 style->SetDefaultNColumns (6);258 style->SetDefaultNColumns (6);
259259
=== modified file 'src/PlacesHorizontalTile.cpp'
--- src/PlacesHorizontalTile.cpp 2011-03-29 22:16:19 +0000
+++ src/PlacesHorizontalTile.cpp 2011-04-07 13:41:22 +0000
@@ -47,16 +47,17 @@
47 _comment = g_strdup_printf ("<small>%s</small>", comment);47 _comment = g_strdup_printf ("<small>%s</small>", comment);
4848
49 int w = (PlacesSettings::GetDefault ()->GetDefaultTileWidth () * 2) - icon_size - 24;//padding49 int w = (PlacesSettings::GetDefault ()->GetDefaultTileWidth () * 2) - icon_size - 24;//padding
50 int lines = 0;
5051
51 nux::HLayout *layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);52 nux::HLayout *layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
52 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));53 layout->AddLayout (new nux::SpaceLayout (6, 6, 0, 0));
5354
54 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);55 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);
55 _icontex->SetMinMaxSize (icon_size * 1.5, icon_size);56 _icontex->SetMinMaxSize (icon_size, icon_size);
56 AddChild (_icontex);57 AddChild (_icontex);
57 layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);58 layout->AddView (_icontex, 0, nux::eLeft, nux::eFix);
5859
59 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));60 layout->AddLayout (new nux::SpaceLayout (6, 6, 0, 0));
60 61
61 nux::VLayout *vlayout = new nux::VLayout ("", NUX_TRACKER_LOCATION);62 nux::VLayout *vlayout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
62 layout->AddView (vlayout, 1, nux::eLeft, nux::eFull);63 layout->AddView (vlayout, 1, nux::eLeft, nux::eFull);
@@ -66,12 +67,14 @@
66 _cairotext = new nux::StaticCairoText (_label);67 _cairotext = new nux::StaticCairoText (_label);
67 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);68 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
68 _cairotext->SetMaximumWidth (w);69 _cairotext->SetMaximumWidth (w);
70 _cairotext->SetLines (-2);
69 vlayout->AddView (_cairotext, 0, nux::eLeft, nux::eFull);71 vlayout->AddView (_cairotext, 0, nux::eLeft, nux::eFull);
72 lines = _cairotext->GetLineCount ();
7073
71 _cairotext = new nux::StaticCairoText (_comment);74 _cairotext = new nux::StaticCairoText (_comment);
72 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);75 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
73 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);76 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
74 _cairotext->SetLines (-3);77 _cairotext->SetLines (-1 * (4 - lines));
75 _cairotext->SetMaximumWidth (w);78 _cairotext->SetMaximumWidth (w);
76 _cairotext->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.8f));79 _cairotext->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.8f));
77 vlayout->AddView (_cairotext, 1, nux::eLeft, nux::eFull);80 vlayout->AddView (_cairotext, 1, nux::eLeft, nux::eFull);
@@ -197,13 +200,12 @@
197{200{
198 nux::Geometry base = GetGeometry ();201 nux::Geometry base = GetGeometry ();
199 int width = 0, height = 0;202 int width = 0, height = 0;
200
201 _icontex->GetTextureSize (&width, &height);203 _icontex->GetTextureSize (&width, &height);
202 204
203 _highlight_geometry.x = 12;205 _highlight_geometry.x = 6;
204 _highlight_geometry.y = 12;206 _highlight_geometry.y = 6;
205 _highlight_geometry.width = width;207 _highlight_geometry.width = _icontex->GetMaximumWidth ();
206 _highlight_geometry.height = height;208 _highlight_geometry.height = base.height - 12;
207209
208 return _highlight_geometry;210 return _highlight_geometry;
209}211}
210212
=== modified file 'src/PlacesSettings.cpp'
--- src/PlacesSettings.cpp 2011-03-13 19:23:11 +0000
+++ src/PlacesSettings.cpp 2011-04-07 13:41:22 +0000
@@ -20,6 +20,7 @@
20#include "gdk/gdk.h"20#include "gdk/gdk.h"
2121
22#include "PlacesSettings.h"22#include "PlacesSettings.h"
23#include "PlacesStyle.h"
2324
24#define HOME_EXPANDED "home-expanded"25#define HOME_EXPANDED "home-expanded"
2526
@@ -91,8 +92,7 @@
91int92int
92PlacesSettings::GetDefaultTileWidth ()93PlacesSettings::GetDefaultTileWidth ()
93{94{
94 //FIXME: We want to calculate this from DPI95 return PlacesStyle::GetDefault ()->GetTileWidth ();
95 return 140;
96}96}
9797
98PlacesSettings::DashBlurType98PlacesSettings::DashBlurType
9999
=== modified file 'src/PlacesSimpleTile.cpp'
--- src/PlacesSimpleTile.cpp 2011-03-29 15:57:38 +0000
+++ src/PlacesSimpleTile.cpp 2011-04-07 13:41:22 +0000
@@ -20,7 +20,7 @@
20 *20 *
21 */21 */
2222
23#include "PlacesSettings.h"23#include "PlacesStyle.h"
24#include "ubus-server.h"24#include "ubus-server.h"
25#include "UBusMessages.h"25#include "UBusMessages.h"
2626
@@ -40,29 +40,30 @@
40 _icon (NULL),40 _icon (NULL),
41 _uri (NULL)41 _uri (NULL)
42{42{
43 PlacesStyle *style = PlacesStyle::GetDefault ();
43 nux::VLayout *layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);44 nux::VLayout *layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
4445
45 _label = g_strdup (label);46 _label = g_strdup (label);
46 _icon = g_strdup (icon_name);47 _icon = g_strdup (icon_name);
4748
48 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);49 _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);
49 _icontex->SetMinMaxSize (PlacesSettings::GetDefault ()->GetDefaultTileWidth (), icon_size);50 _icontex->SetMinMaxSize (style->GetTileWidth (), icon_size);
50 _icontex->SinkReference ();51 _icontex->SinkReference ();
51 AddChild (_icontex);52 AddChild (_icontex);
5253
53 _cairotext = new nux::StaticCairoText (_label);54 _cairotext = new nux::StaticCairoText ("");
55 _cairotext->SetMaximumWidth (style->GetTileWidth ());
54 _cairotext->SinkReference ();56 _cairotext->SinkReference ();
55
56 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);57 _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_START);
57 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);58 _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_CENTRE);
58 _cairotext->SetMaximumWidth (140);59 _cairotext->SetText (_label);
5960
60 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));61 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
61 layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);62 layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);
62 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));63 layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
63 layout->AddView (_cairotext, 0, nux::eCenter, nux::eFull);64 layout->AddView (_cairotext, 0, nux::eCenter, nux::eFull);
6465
65 SetMinMaxSize (160, 128);66 SetMinMaxSize (style->GetTileWidth (), style->GetTileHeight ());
6667
67 SetLayout (layout);68 SetLayout (layout);
6869
6970
=== modified file 'src/PlacesTile.cpp'
--- src/PlacesTile.cpp 2011-04-06 17:53:41 +0000
+++ src/PlacesTile.cpp 2011-04-07 13:41:22 +0000
@@ -115,9 +115,7 @@
115 true);115 true);
116 cairo_fill (cr);116 cairo_fill (cr);
117 cairo_graphics->BlurSurface (BLUR_SIZE - 2);117 cairo_graphics->BlurSurface (BLUR_SIZE - 2);
118 118
119 // draw tiled background
120 // set up clip path
121 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);119 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
122 cairo_graphics->DrawRoundedRectangle (cr,120 cairo_graphics->DrawRoundedRectangle (cr,
123 1.0,121 1.0,
@@ -128,44 +126,21 @@
128 bg_height,126 bg_height,
129 true);127 true);
130 cairo_clip (cr);128 cairo_clip (cr);
131
132 int w, h;
133 cairo_surface_t *image;
134 cairo_pattern_t *pattern;
135
136 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
137 image = cairo_image_surface_create_from_png (PKGDATADIR"/places-tile-bg-tilable.png");
138 w = cairo_image_surface_get_width (image);
139 h = cairo_image_surface_get_height (image);
140
141
142 pattern = cairo_pattern_create_for_surface (image);
143 cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
144
145 cairo_set_source (cr, pattern);
146
147 cairo_rectangle (cr, 0, 0, base.width, base.height);
148 cairo_fill (cr);
149
150 cairo_pattern_destroy (pattern);
151 cairo_surface_destroy (image);
152
153 // draw the outline
154
155 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);129 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
156130
157 cairo_graphics->DrawRoundedRectangle (cr,131 cairo_graphics->DrawRoundedRectangle (cr,
158 1.0,132 1.0,
159 bg_x,133 bg_x,
160 bg_y,134 bg_y,
161 5.0,135 5.0,
162 bg_width,136 bg_width,
163 bg_height,137 bg_height,
164 true);138 true);
165 cairo_set_source_rgba (cr, 0.66, 0.66, 0.66, 1.0);139 cairo_set_source_rgba (cr, 240/255.0f, 240/255.0f, 240/255.0f, 1.0f);
166 cairo_set_line_width (cr, 1.0);140 cairo_fill_preserve (cr);
167 cairo_stroke (cr);141
168 142 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0);
143 cairo_stroke (cr);
169 144
170 cairo_destroy (cr);145 cairo_destroy (cr);
171146
172147
=== modified file 'src/QuicklistMenuItemCheckmark.cpp'
--- src/QuicklistMenuItemCheckmark.cpp 2011-04-06 17:53:41 +0000
+++ src/QuicklistMenuItemCheckmark.cpp 2011-04-07 13:41:22 +0000
@@ -191,7 +191,7 @@
191 texture = _normalTexture[0]->GetDeviceTexture ();191 texture = _normalTexture[0]->GetDeviceTexture ();
192 }192 }
193193
194 _color = nux::Colors::Gray;194 _color = nux::Color (0.8f, 0.8f, 0.8f, 1.0f);
195 }195 }
196 196
197 gfxContext.QRP_1Tex (base.x,197 gfxContext.QRP_1Tex (base.x,
198198
=== modified file 'src/QuicklistMenuItemLabel.cpp'
--- src/QuicklistMenuItemLabel.cpp 2011-04-06 17:53:41 +0000
+++ src/QuicklistMenuItemLabel.cpp 2011-04-07 13:41:22 +0000
@@ -162,7 +162,7 @@
162 else162 else
163 {163 {
164 texture = _normalTexture[0]->GetDeviceTexture ();164 texture = _normalTexture[0]->GetDeviceTexture ();
165 _color = nux::Colors::Gray;165 _color = nux::Color (0.8f, 0.8f, 0.8f, 1.0f);
166 }166 }
167167
168 gfxContext.QRP_1Tex (base.x,168 gfxContext.QRP_1Tex (base.x,
169169
=== modified file 'src/QuicklistMenuItemRadio.cpp'
--- src/QuicklistMenuItemRadio.cpp 2011-04-06 17:53:41 +0000
+++ src/QuicklistMenuItemRadio.cpp 2011-04-07 13:41:22 +0000
@@ -191,7 +191,7 @@
191 texture = _normalTexture[0]->GetDeviceTexture ();191 texture = _normalTexture[0]->GetDeviceTexture ();
192 }192 }
193193
194 _color = nux::Colors::Gray;194 _color = nux::Color (0.8f, 0.8f, 0.8f, 1.0f);
195 }195 }
196196
197 gfxContext.QRP_1Tex (base.x,197 gfxContext.QRP_1Tex (base.x,
198198
=== modified file 'src/StaticCairoText.cpp'
--- src/StaticCairoText.cpp 2011-03-29 22:16:19 +0000
+++ src/StaticCairoText.cpp 2011-04-07 13:41:22 +0000
@@ -36,7 +36,8 @@
36 _fontstring (NULL),36 _fontstring (NULL),
37 _cairoGraphics (NULL),37 _cairoGraphics (NULL),
38 _texture2D (NULL),38 _texture2D (NULL),
39 _lines (-2)39 _lines (-2),
40 _actual_lines (0)
4041
41{42{
42 _textColor = Color(1.0f, 1.0f, 1.0f, 1.0f);43 _textColor = Color(1.0f, 1.0f, 1.0f, 1.0f);
@@ -260,6 +261,11 @@
260 sigFontChanged.emit (this);261 sigFontChanged.emit (this);
261}262}
262263
264int
265StaticCairoText::GetLineCount ()
266{
267 return _actual_lines;
268}
263269
264void StaticCairoText::GetTextExtents (int &width, int &height)270void StaticCairoText::GetTextExtents (int &width, int &height)
265{271{
@@ -447,6 +453,8 @@
447 cairo_move_to (cr, 0.0f, 0.0f);453 cairo_move_to (cr, 0.0f, 0.0f);
448 pango_cairo_show_layout (cr, layout);454 pango_cairo_show_layout (cr, layout);
449455
456 _actual_lines = pango_layout_get_line_count (layout);
457
450 // clean up458 // clean up
451 pango_font_description_free (desc);459 pango_font_description_free (desc);
452 g_object_unref (layout);460 g_object_unref (layout);
453461
=== modified file 'src/StaticCairoText.h'
--- src/StaticCairoText.h 2011-03-29 22:16:19 +0000
+++ src/StaticCairoText.h 2011-04-07 13:41:22 +0000
@@ -86,7 +86,9 @@
86 void SetTextAlignment (AlignState state);86 void SetTextAlignment (AlignState state);
87 void SetTextVerticalAlignment (AlignState state);87 void SetTextVerticalAlignment (AlignState state);
88 void SetFont (const char *fontstring);88 void SetFont (const char *fontstring);
89 void SetLines (int lines);89 void SetLines (int maximum_lines);
90
91 int GetLineCount ();
9092
91 void GetTextExtents (int &width, int &height);93 void GetTextExtents (int &width, int &height);
9294
@@ -113,6 +115,7 @@
113 int _pre_layout_height;115 int _pre_layout_height;
114116
115 int _lines;117 int _lines;
118 int _actual_lines;
116119
117 void GetTextExtents (const TCHAR* font,120 void GetTextExtents (const TCHAR* font,
118 int& width,121 int& width,