Merge lp:~unity-team/unity/dash-fixes-2011-02-24 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Didier Roche
Approved revision: 890
Merged at revision: 882
Proposed branch: lp:~unity-team/unity/dash-fixes-2011-02-24
Merge into: lp:unity
Diff against target: 2020 lines (+784/-345)
35 files modified
CMakeLists.txt (+1/-1)
com.canonical.Unity.gschema.xml (+14/-1)
src/IconTexture.cpp (+62/-34)
src/IconTexture.h (+6/-1)
src/LauncherIcon.cpp (+1/-0)
src/PanelIndicatorObjectView.cpp (+4/-4)
src/PanelMenuView.cpp (+15/-13)
src/PanelTray.cpp (+4/-5)
src/PlaceFactoryFile.cpp (+8/-7)
src/PlacesController.cpp (+38/-4)
src/PlacesController.h (+2/-0)
src/PlacesGroup.cpp (+18/-15)
src/PlacesGroup.h (+5/-5)
src/PlacesHomeView.cpp (+244/-97)
src/PlacesHomeView.h (+14/-5)
src/PlacesResultsController.cpp (+16/-16)
src/PlacesResultsView.cpp (+0/-18)
src/PlacesResultsView.h (+0/-3)
src/PlacesSearchBar.cpp (+14/-9)
src/PlacesSearchBar.h (+1/-1)
src/PlacesSettings.cpp (+93/-0)
src/PlacesSettings.h (+58/-0)
src/PlacesSimpleTile.cpp (+12/-6)
src/PlacesTile.cpp (+9/-8)
src/PlacesView.cpp (+27/-25)
src/QuicklistMenuItemCheckmark.cpp (+4/-0)
src/QuicklistMenuItemLabel.cpp (+2/-0)
src/QuicklistMenuItemRadio.cpp (+4/-0)
src/QuicklistMenuItemSeparator.cpp (+1/-0)
src/StaticCairoText.cpp (+10/-7)
src/TimeMe.cpp (+22/-0)
src/TimeMe.h (+43/-0)
src/Tooltip.cpp (+1/-1)
src/unitya11y.cpp (+3/-0)
tests/CMakeLists.txt (+28/-59)
To merge this branch: bzr merge lp:~unity-team/unity/dash-fixes-2011-02-24
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+50896@code.launchpad.net

Description of the change

All the attached bugs plus various clean ups of the code.

You'll need latest Nux trunk and export UNITY_A11Y_DISABLE=1 otherwise unity won't run because of missing schemas. Oh, speaking of schemas, I install some more options so make sure your installing the gsettings stuff in the right place, ping me if you get stuck!

To post a comment you must log in.
891. By Neil J. Patel on 2011-02-23

remove comments

Didier Roche (didrocks) wrote :

CreateShortcutFromExec (markup, _("Browse the Web"), "firefox");
and such…
-> as far as I understand, "firefox", "evolution", "banshee" are just the icon named that we ship to show it. As the branch make some detection of the prefer tool, we can maybe ship as well "generic icons" for those cases (and rename firefox in browser-icon, evolution in mail-icon, banshee in mediaplayer-icon and such)?
I know there is the issue to detect which Exec corresponds to which desktop file, that can wait :)

Currently building and testing

892. By Neil J. Patel on 2011-02-23

fix up the fallback apps

893. By Neil J. Patel on 2011-02-23

reset the dash

894. By Neil J. Patel on 2011-02-23

reset the dash

Didier Roche (didrocks) wrote :

approved! nice enhancements :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-02-17 17:19:57 +0000
3+++ CMakeLists.txt 2011-02-23 12:01:18 +0000
4@@ -94,7 +94,7 @@
5 #
6 # src (Compiz Plugin)
7 #
8-set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk;unity-misc")
9+set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator;atk;unity-misc;gconf-2.0")
10
11 find_package (Compiz REQUIRED)
12 include (CompizPlugin)
13
14=== modified file 'com.canonical.Unity.gschema.xml'
15--- com.canonical.Unity.gschema.xml 2011-02-14 20:37:44 +0000
16+++ com.canonical.Unity.gschema.xml 2011-02-23 12:01:18 +0000
17@@ -1,4 +1,17 @@
18 <schemalist>
19+ <enum id="form-factor-enum">
20+ <value nick="Automatic" value="0" />
21+ <value nick="Desktop" value="1" />
22+ <value nick="Netbook" value="2" />
23+ </enum>
24+
25+ <schema path="/desktop/unity/" id="com.canonical.Unity" gettext-domain="unity">
26+ <key enum="form-factor-enum" name="form-factor">
27+ <default>"Automatic"</default>
28+ <summary>The form factor Unity should target.</summary>
29+ <description>The form factor chosen will affect the size and appearance of the Dash, Launcher and also the Window Management behaviour.</description>
30+ </key>
31+ </schema>
32 <schema path="/desktop/unity/launcher/" id="com.canonical.Unity.Launcher" gettext-domain="unity">
33 <key type="as" name="favorites">
34 <default>[ 'ubiquity-gtkui.desktop', 'nautilus.desktop', 'firefox.desktop', 'ubuntuone-control-panel-gtk.desktop', 'tomboy.desktop' ]</default>
35@@ -10,7 +23,7 @@
36 <summary>Version of last migration done</summary>
37 <description>This is a detection key for the favorite migration script to know whether the needed migration is done or not.</description>
38 </key>
39- </schema>
40+ </schema>
41 <schema path="/desktop/unity/panel/" id="com.canonical.Unity.Panel" gettext-domain="unity">
42 <key type="as" name="systray-whitelist">
43 <default>[ 'JavaEmbeddedFrame', 'Wine', 'Skype' ]</default>
44
45=== modified file 'src/IconTexture.cpp'
46--- src/IconTexture.cpp 2011-02-15 14:05:14 +0000
47+++ src/IconTexture.cpp 2011-02-23 12:01:18 +0000
48@@ -34,7 +34,10 @@
49 IconTexture::IconTexture (const char *icon_name, unsigned int size)
50 : TextureArea (NUX_TRACKER_LOCATION),
51 _icon_name (NULL),
52- _size (size)
53+ _size (size),
54+ _texture_cached (NULL),
55+ _texture_width (0),
56+ _texture_height (0)
57 {
58 _icon_name = g_strdup (icon_name ? icon_name : DEFAULT_ICON);
59
60@@ -44,7 +47,9 @@
61 IconTexture::~IconTexture ()
62 {
63 g_free (_icon_name);
64- _texture_cached->UnReference ();
65+
66+ if (_texture_cached)
67+ _texture_cached->UnReference ();
68 }
69
70 void
71@@ -53,7 +58,6 @@
72 g_free (_icon_name);
73 _icon_name = g_strdup (icon_name);
74 _size = size;
75-
76 LoadIcon ();
77 }
78
79@@ -87,8 +91,6 @@
80 _size,
81 sigc::mem_fun (this, &IconTexture::IconLoaded));
82 }
83-
84- SetMinMaxSize (_size, _size);
85 }
86
87 void
88@@ -101,37 +103,29 @@
89 void
90 IconTexture::Refresh (GdkPixbuf *pixbuf)
91 {
92- // try and get a texture from the texture cache
93- char *id = g_strdup_printf ("IconTexture.%s", _icon_name);
94+ TextureCache *cache = TextureCache::GetDefault ();
95+ char *id = NULL;
96+
97 _pixbuf_cached = pixbuf;
98- TextureCache *cache = TextureCache::GetDefault ();
99- nux::BaseTexture * texture2D = cache->FindTexture (id, _size, _size,
100- sigc::mem_fun (this, &IconTexture::CreateTextureCallback));
101-
102- nux::TexCoordXForm texxform;
103- texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_SCALE_COORD);
104- texxform.SetWrap (nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
105-
106- nux::IntrusiveSP<nux::IOpenGLBaseTexture> dev = texture2D->GetDeviceTexture();
107- dev->SetFiltering (GL_LINEAR, GL_LINEAR);
108-
109- nux::ROPConfig rop;
110- rop.Blend = true;
111- rop.SrcBlend = GL_ONE;
112- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
113- nux::TextureLayer* texture_layer = new nux::TextureLayer (dev,
114- texxform,
115- nux::Color::White,
116- true,
117- rop);
118- SetPaintLayer(texture_layer);
119-
120- texture2D->Reference ();
121- _texture_cached = texture2D;
122-
123- SetMinMaxSize (gdk_pixbuf_get_width (pixbuf) * (_size/(float)gdk_pixbuf_get_height (pixbuf)),
124- _size);
125+
126+ // Cache the pixbuf dimensions so we scale correctly
127+ _texture_width = gdk_pixbuf_get_width (pixbuf);
128+ _texture_height = gdk_pixbuf_get_height (pixbuf);
129+
130+ // Try and get a texture from the texture cache
131+ id = g_strdup_printf ("IconTexture.%s", _icon_name);
132+ if (_texture_cached)
133+ _texture_cached->UnReference ();
134+
135+ _texture_cached = cache->FindTexture (id,
136+ _texture_width,
137+ _texture_height,
138+ sigc::mem_fun (this, &IconTexture::CreateTextureCallback));
139+ _texture_cached->Reference ();
140+
141 QueueDraw ();
142+
143+ g_free (id);
144 }
145
146 void
147@@ -147,6 +141,40 @@
148 }
149 }
150
151+void
152+IconTexture::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
153+{
154+ nux::Geometry geo = GetGeometry ();
155+
156+ GfxContext.PushClippingRectangle (geo);
157+
158+ if (_texture_cached)
159+ {
160+ nux::TexCoordXForm texxform;
161+ texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_SCALE_COORD);
162+ texxform.SetWrap (nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
163+
164+ GfxContext.QRP_1Tex (geo.x + ((geo.width - _texture_width)/2),
165+ geo.y + ((geo.height - _texture_height)/2),
166+ _texture_width,
167+ _texture_height,
168+ _texture_cached->GetDeviceTexture (),
169+ texxform,
170+ nux::Color::White);
171+ }
172+
173+ GfxContext.PopClippingRectangle ();
174+}
175+
176+void
177+IconTexture::GetTextureSize (int *width, int *height)
178+{
179+ if (width)
180+ *width = _texture_width;
181+ if (height)
182+ *height = _texture_height;
183+}
184+
185 const gchar*
186 IconTexture::GetName ()
187 {
188
189=== modified file 'src/IconTexture.h'
190--- src/IconTexture.h 2011-02-15 14:05:14 +0000
191+++ src/IconTexture.h 2011-02-23 12:01:18 +0000
192@@ -35,12 +35,15 @@
193
194 void SetByIconName (const char *icon_name, unsigned int size);
195 void SetByFilePath (const char *file_path, unsigned int size);
196+ void GetTextureSize (int *width, int *height);
197
198 protected:
199 const gchar* GetName ();
200 void AddProperties (GVariantBuilder *builder);
201
202 private:
203+ void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);
204+
205 void CreateTextureCallback (const char *texid, int width, int height, nux::BaseTexture **texture);
206 void LoadIcon ();
207 void Refresh (GdkPixbuf *pixbuf);
208@@ -49,8 +52,10 @@
209 char *_icon_name;
210 unsigned int _size;
211
212- GdkPixbuf *_pixbuf_cached; // not guarunteed outside of a IconLoader callback
213+ GdkPixbuf *_pixbuf_cached;
214 nux::BaseTexture *_texture_cached;
215+ int _texture_width;
216+ int _texture_height;
217 };
218
219 #endif // ICON_TEXTURE_H
220
221=== modified file 'src/LauncherIcon.cpp'
222--- src/LauncherIcon.cpp 2011-02-22 17:05:31 +0000
223+++ src/LauncherIcon.cpp 2011-02-23 12:01:18 +0000
224@@ -778,6 +778,7 @@
225
226 emblem = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
227 emblem->Update (bitmap);
228+ delete bitmap;
229
230 SetEmblem (emblem);
231
232
233=== modified file 'src/PanelIndicatorObjectView.cpp'
234--- src/PanelIndicatorObjectView.cpp 2011-02-15 11:55:14 +0000
235+++ src/PanelIndicatorObjectView.cpp 2011-02-23 12:01:18 +0000
236@@ -98,8 +98,8 @@
237
238 AddChild (view);
239
240- this->ComputeChildLayout ();
241- NeedRedraw ();
242+ QueueRelayout();
243+ QueueDraw ();
244 }
245
246 void
247@@ -126,8 +126,8 @@
248 }
249 }
250
251- this->ComputeChildLayout ();
252- NeedRedraw ();
253+ QueueRelayout ();
254+ QueueDraw ();
255 }
256
257 const gchar *
258
259=== modified file 'src/PanelMenuView.cpp'
260--- src/PanelMenuView.cpp 2011-02-17 11:04:21 +0000
261+++ src/PanelMenuView.cpp 2011-02-23 12:01:18 +0000
262@@ -25,6 +25,7 @@
263 #include <Nux/TextureArea.h>
264
265 #include "NuxGraphics/GLThread.h"
266+#include "NuxGraphics/XInputWindow.h"
267 #include "Nux/BaseWindow.h"
268 #include "Nux/WindowCompositor.h"
269
270@@ -347,17 +348,18 @@
271 gchar *label = NULL;
272 BamfWindow *window;
273
274- // There's probably a better way to do this, but we really only want to ignore our own windows
275- // as there could be cases where windows like ours have menus and we don't want them to fall
276- // into this statement. Still, will investigate better ways to do this.
277+ _is_own_window = false;
278+
279 window = bamf_matcher_get_active_window (_matcher);
280- if (BAMF_IS_WINDOW (window)
281- && g_str_has_prefix (bamf_view_get_name (BAMF_VIEW (window)), "nux input"))
282+ if (BAMF_IS_WINDOW (window))
283 {
284- _is_own_window = true;
285+ std::list<Window> our_xids = nux::XInputWindow::NativeHandleList ();
286+ std::list<Window>::iterator it;
287+
288+ it = std::find (our_xids.begin (), our_xids.end (), bamf_window_get_xid (BAMF_WINDOW (window)));
289+ if (it != our_xids.end ())
290+ _is_own_window = true;
291 }
292- else
293- _is_own_window = false;
294
295 if (_is_maximized)
296 {
297@@ -553,7 +555,7 @@
298 void
299 PanelMenuView::OnEntryRefreshed (PanelIndicatorObjectEntryView *view)
300 {
301- ComputeChildLayout ();
302+ QueueRelayout ();
303 }
304
305 void
306@@ -587,8 +589,8 @@
307
308 AddChild (view);
309
310- this->ComputeChildLayout ();
311- NeedRedraw ();
312+ QueueRelayout ();
313+ QueueDraw ();
314 }
315
316 void
317@@ -615,8 +617,8 @@
318 }
319 }
320
321- this->ComputeChildLayout ();
322- NeedRedraw ();
323+ QueueRelayout ();
324+ QueueDraw ();
325 }
326
327 void
328
329=== modified file 'src/PanelTray.cpp'
330--- src/PanelTray.cpp 2011-02-15 16:45:30 +0000
331+++ src/PanelTray.cpp 2011-02-23 12:01:18 +0000
332@@ -89,8 +89,7 @@
333 PanelTray::Sync ()
334 {
335 SetMinMaxSize ((_n_children * 24) + (PADDING * 2), 24);
336- ComputeChildLayout ();
337-
338+ QueueRelayout ();
339 QueueDraw ();
340 }
341
342@@ -119,9 +118,9 @@
343 accept = false;
344 break;
345 }
346- else if (g_str_has_prefix (title, name)
347- || g_str_has_prefix (res_name, name)
348- || g_str_has_prefix (res_class, name))
349+ else if ((title && g_str_has_prefix (title, name))
350+ || (res_name && g_str_has_prefix (res_name, name))
351+ || ( res_class && g_str_has_prefix (res_class, name)))
352 {
353 accept = true;
354 break;
355
356=== modified file 'src/PlaceFactoryFile.cpp'
357--- src/PlaceFactoryFile.cpp 2011-02-17 16:01:55 +0000
358+++ src/PlaceFactoryFile.cpp 2011-02-23 12:01:18 +0000
359@@ -45,13 +45,14 @@
360 return;
361 }
362
363- g_file_enumerate_children_async (_dir,
364- G_FILE_ATTRIBUTE_STANDARD_NAME,
365- G_FILE_QUERY_INFO_NONE,
366- 0,
367- NULL,
368- on_directory_enumeration_ready,
369- this);
370+ if (!g_getenv ("UNITY_PLACES_DISABLE"))
371+ g_file_enumerate_children_async (_dir,
372+ G_FILE_ATTRIBUTE_STANDARD_NAME,
373+ G_FILE_QUERY_INFO_NONE,
374+ 0,
375+ NULL,
376+ on_directory_enumeration_ready,
377+ this);
378 }
379
380 PlaceFactoryFile::~PlaceFactoryFile ()
381
382=== modified file 'src/PlacesController.cpp'
383--- src/PlacesController.cpp 2011-02-21 13:21:49 +0000
384+++ src/PlacesController.cpp 2011-02-23 12:01:18 +0000
385@@ -65,6 +65,8 @@
386 _window->SetLayout (_window_layout);
387
388 _view->entry_changed.connect (sigc::mem_fun (this, &PlacesController::OnActivePlaceEntryChanged));
389+
390+ PlacesSettings::GetDefault ()->changed.connect (sigc::mem_fun (this, &PlacesController::OnSettingsChanged));
391 }
392
393 PlacesController::~PlacesController ()
394@@ -100,10 +102,10 @@
395 _window->UnGrabKeyboard ();
396 _window->EnableInputWindow (false);
397 _window->ShowWindow (false, false);
398-
399+
400 _visible = false;
401
402- _view->SetActiveEntry (NULL, 0, "", false);
403+ _view->SetActiveEntry (NULL, 0, "");
404
405 ubus_server_send_message (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN, NULL);
406 }
407@@ -117,8 +119,35 @@
408 void
409 PlacesController::WindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data)
410 {
411- // FIXME: This will be a ratio
412- geo = nux::Geometry (66, 24, 938, 500);
413+ PlacesSettings *settings = PlacesSettings::GetDefault ();
414+ GdkScreen *screen;
415+ gint primary_monitor, width=0, height=0;
416+ GdkRectangle rect;
417+ gint tile_width;
418+
419+ screen = gdk_screen_get_default ();
420+ primary_monitor = gdk_screen_get_primary_monitor (screen);
421+ gdk_screen_get_monitor_geometry (screen, primary_monitor, &rect);
422+
423+ tile_width = settings->GetDefaultTileWidth ();
424+
425+ if (settings->GetFormFactor () == PlacesSettings::DESKTOP)
426+ {
427+ gint half = rect.width / 2;
428+
429+ while ((width + tile_width) <= half)
430+ width += tile_width;
431+
432+ width = MAX (width, tile_width * 7);
433+ height = ((width/tile_width) - 3) * tile_width;
434+ }
435+ else
436+ {
437+ width = rect.width - 66;
438+ height = rect.height - 24;
439+ }
440+
441+ geo = nux::Geometry (66, 24, width, height);
442 }
443
444 void
445@@ -161,3 +190,8 @@
446 {
447 }
448
449+void
450+PlacesController::OnSettingsChanged (PlacesSettings *settings)
451+{
452+ // We don't need to do anything just yet over here, it's a placeholder for when we do
453+}
454
455=== modified file 'src/PlacesController.h'
456--- src/PlacesController.h 2011-01-31 15:32:39 +0000
457+++ src/PlacesController.h 2011-02-23 12:01:18 +0000
458@@ -26,6 +26,7 @@
459 #include <NuxGraphics/GraphicsEngine.h>
460
461 #include "PlaceFactoryFile.h"
462+#include "PlacesSettings.h"
463 #include "PlacesView.h"
464 #include "Introspectable.h"
465
466@@ -52,6 +53,7 @@
467
468 void RecvMouseDownOutsideOfView (int x, int y, unsigned long button_flags, unsigned long key_flags);
469 void OnActivePlaceEntryChanged (PlaceEntry *entry);
470+ void OnSettingsChanged (PlacesSettings *settings);
471
472 private:
473 nux::BaseWindow *_window;
474
475=== modified file 'src/PlacesGroup.cpp'
476--- src/PlacesGroup.cpp 2011-02-11 21:31:44 +0000
477+++ src/PlacesGroup.cpp 2011-02-23 12:01:18 +0000
478@@ -41,7 +41,8 @@
479 #include <glib/gi18n-lib.h>
480
481 PlacesGroup::PlacesGroup (NUX_FILE_LINE_DECL) :
482-View (NUX_FILE_LINE_PARAM)
483+View (NUX_FILE_LINE_PARAM),
484+_idle_id (0)
485 {
486 //~ OnMouseDown.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseDown));
487 //~ OnMouseUp.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseUp));
488@@ -176,20 +177,22 @@
489 NeedRedraw ();
490 }
491
492-void
493-PlacesGroup::SetVisible (bool visible)
494-{
495- _is_visible = visible;
496- ComputeChildLayout ();
497- NeedRedraw ();
498-}
499-
500-bool
501-PlacesGroup::IsVisible ()
502-{
503- return _is_visible;
504-}
505-
506+void PlacesGroup::Relayout ()
507+{
508+ if (_idle_id == 0)
509+ _idle_id = g_idle_add ((GSourceFunc)OnIdleRelayout, this);
510+}
511+
512+gboolean PlacesGroup::OnIdleRelayout (PlacesGroup *self)
513+{
514+ self->QueueDraw ();
515+ self->_group_layout->QueueDraw ();
516+ self->GetLayout ()->QueueDraw ();
517+ self->ComputeChildLayout ();
518+ self->_idle_id = 0;
519+
520+ return FALSE;
521+}
522
523 long PlacesGroup::ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
524 {
525
526=== modified file 'src/PlacesGroup.h'
527--- src/PlacesGroup.h 2011-02-02 23:21:05 +0000
528+++ src/PlacesGroup.h 2011-02-23 12:01:18 +0000
529@@ -51,9 +51,7 @@
530 void SetRowHeight (unsigned int row_height);
531 void SetItemDetail (unsigned int total_items, unsigned int visible_items);
532 void SetExpanded (bool expanded);
533-
534- void SetVisible (bool visible);
535- bool IsVisible ();
536+ void Relayout ();
537
538 protected:
539 nux::StaticCairoText *_label;
540@@ -64,13 +62,15 @@
541 unsigned int _total_items;
542 unsigned int _visible_items;
543
544- bool _is_visible;
545-
546 nux::Layout *_content;
547 nux::VLayout *_group_layout;
548 nux::HLayout *_header_layout;
549
550 bool _expanded;
551+
552+ guint32 _idle_id;
553+
554+ static gboolean OnIdleRelayout (PlacesGroup *self);
555 void UpdateTitle ();
556 void UpdateLabel ();
557
558
559=== modified file 'src/PlacesHomeView.cpp'
560--- src/PlacesHomeView.cpp 2011-01-25 00:11:13 +0000
561+++ src/PlacesHomeView.cpp 2011-02-23 12:01:18 +0000
562@@ -31,7 +31,7 @@
563
564 #include <glib.h>
565 #include <glib/gi18n-lib.h>
566-
567+#include <gio/gdesktopappinfo.h>
568 #include "ubus-server.h"
569 #include "UBusMessages.h"
570
571@@ -39,55 +39,39 @@
572
573 #include "PlacesSimpleTile.h"
574
575-typedef struct
576-{
577- gchar *name;
578- gchar *icon;
579- gchar *exec;
580-
581-} TileInfo;
582-
583-static TileInfo tile_infos[] = {
584- {
585- (gchar*)_("Find Media Apps"),
586- (gchar*)"applications-multimedia",
587- (gchar*)"xdg-open /usr/share/applications"
588- },
589- {
590- (gchar*)_("Find Internet Apps"),
591- (gchar*)"applications-internet",
592- (gchar*)"xdg-open /usr/share/applications"
593- },
594- {
595- (gchar*)_("Find More Apps"),
596- (gchar*)"find",
597- (gchar*)"xdg-open /usr/share/applications"
598- },
599- {
600- (gchar*)_("Find Files"),
601- (gchar*)"folder-saved-search",
602- (gchar*)"xdg-open ~"
603- },
604- {
605- (gchar*)_("Browse the Web"),
606- (gchar*)"firefox",
607- (gchar*)"firefox"
608- },
609- {
610- (gchar*)_("View Photos"),
611- (gchar*)"shotwell",
612- (gchar*)"shotwell"
613- },
614- {
615- (gchar*)_("Check Email"),
616- (gchar*)"evolution",
617- (gchar*)"evolution"
618- },
619- {
620- (gchar*)_("Listen to Music"),
621- (gchar*)"media-player-banshee",
622- (gchar*)"banshee"
623- }
624+#define DESKTOP_DIR "/desktop/gnome/applications"
625+#define BROWSER_DIR DESKTOP_DIR"/browser"
626+#define CALENDAR_DIR DESKTOP_DIR"/calendar"
627+#define MEDIA_DIR DESKTOP_DIR"/media"
628+
629+enum
630+{
631+ TYPE_PLACE=0,
632+ TYPE_EXEC
633+};
634+
635+class Shortcut : public PlacesSimpleTile
636+{
637+public:
638+ Shortcut (const char *icon, const char *name, int size)
639+ : PlacesSimpleTile (icon, name, size),
640+ _id (0),
641+ _place_id (NULL),
642+ _place_section (0),
643+ _exec (NULL)
644+ {
645+ }
646+
647+ ~Shortcut ()
648+ {
649+ g_free (_place_id);
650+ g_free (_exec);
651+ }
652+
653+ int _id;
654+ gchar *_place_id;
655+ guint32 _place_section;
656+ char *_exec;
657 };
658
659 PlacesHomeView::PlacesHomeView (NUX_FILE_LINE_DECL)
660@@ -98,20 +82,6 @@
661 _layout = new nux::GridHLayout (NUX_TRACKER_LOCATION);
662 SetCompositionLayout (_layout);
663
664- for (guint i = 0; i < G_N_ELEMENTS (tile_infos); i++)
665- {
666- gchar *markup = g_strdup_printf ("<big><b>%s</b></big>", tile_infos[i].name);
667-
668- PlacesSimpleTile *tile = new PlacesSimpleTile (tile_infos[i].icon,
669- markup,
670- 96);
671- _layout->AddView (tile, 1, nux::eLeft, nux::eFull);
672-
673- tile->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnTileClicked));
674-
675- g_free (markup);
676- }
677-
678 _layout->ForceChildrenSize (true);
679 _layout->SetChildrenSize (186, 186);
680 _layout->EnablePartialVisibility (false);
681@@ -120,36 +90,227 @@
682 _layout->SetHorizontalExternalMargin (48);
683 _layout->SetVerticalInternalMargin (32);
684 _layout->SetHorizontalInternalMargin (32);
685+
686+ _client = gconf_client_get_default ();
687+ gconf_client_add_dir (_client,
688+ BROWSER_DIR,
689+ GCONF_CLIENT_PRELOAD_NONE,
690+ NULL);
691+ gconf_client_add_dir (_client,
692+ CALENDAR_DIR,
693+ GCONF_CLIENT_PRELOAD_NONE,
694+ NULL);
695+ gconf_client_add_dir (_client,
696+ MEDIA_DIR,
697+ GCONF_CLIENT_PRELOAD_NONE,
698+ NULL);
699+ gconf_client_notify_add(_client,
700+ BROWSER_DIR"/exec",
701+ (GConfClientNotifyFunc)OnKeyChanged,
702+ this,
703+ NULL, NULL);
704+ gconf_client_notify_add(_client,
705+ CALENDAR_DIR"/exec",
706+ (GConfClientNotifyFunc)OnKeyChanged,
707+ this,
708+ NULL, NULL);
709+ gconf_client_notify_add(_client,
710+ MEDIA_DIR"/exec",
711+ (GConfClientNotifyFunc)OnKeyChanged,
712+ this,
713+ NULL, NULL);
714+
715+ Refresh ();
716 }
717
718 PlacesHomeView::~PlacesHomeView ()
719 {
720+ g_object_unref (_client);
721 delete _bg_layer;
722 }
723
724 void
725-PlacesHomeView::OnTileClicked (PlacesTile *_tile)
726-{
727- PlacesSimpleTile *tile = static_cast<PlacesSimpleTile *> (_tile);
728-
729- for (guint i = 0; i < G_N_ELEMENTS (tile_infos); i++)
730- {
731- if (g_strcmp0 (tile->GetIcon (), tile_infos[i].icon) == 0)
732+PlacesHomeView::OnKeyChanged (GConfClient *client,
733+ guint cnxn_id,
734+ GConfEntry *entry,
735+ PlacesHomeView *self)
736+{
737+ self->Refresh ();
738+}
739+
740+void
741+PlacesHomeView::Refresh ()
742+{
743+ Shortcut *shortcut = NULL;
744+ gchar *markup = NULL;
745+ const char *temp = "<big><b>%s</b></big>";
746+
747+ _layout->Clear ();
748+
749+ // Find Media Apps
750+ markup = g_strdup_printf (temp, _("Find Media Apps"));
751+ shortcut = new Shortcut ("applications-multimedia",
752+ markup,
753+ 96);
754+ shortcut->_id = TYPE_PLACE;
755+ shortcut->_place_id = g_strdup ("/com/canonical/unity/applicationsplace/applications");
756+ shortcut->_place_section = 4;
757+ _layout->AddView (shortcut, 1, nux::eLeft, nux::eFull);
758+ shortcut->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnShortcutClicked));
759+ g_free (markup);
760+
761+ // Find Internet Apps
762+ markup = g_strdup_printf (temp, _("Find Internet Apps"));
763+ shortcut = new Shortcut ("applications-internet",
764+ markup,
765+ 96);
766+ shortcut->_id = TYPE_PLACE;
767+ shortcut->_place_id = g_strdup ("/com/canonical/unity/applicationsplace/applications");
768+ shortcut->_place_section = 3;
769+ _layout->AddView (shortcut, 1, nux::eLeft, nux::eFull);
770+ shortcut->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnShortcutClicked));
771+ g_free (markup);
772+
773+ // Find More Apps
774+ markup = g_strdup_printf (temp, _("Find More Apps"));
775+ shortcut = new Shortcut ("find",
776+ markup,
777+ 96);
778+ shortcut->_id = TYPE_PLACE;
779+ shortcut->_place_id = g_strdup ("/com/canonical/unity/applicationsplace/applications");
780+ shortcut->_place_section = 0;
781+ _layout->AddView (shortcut, 1, nux::eLeft, nux::eFull);
782+ shortcut->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnShortcutClicked));
783+ g_free (markup);
784+
785+ // Find Files
786+ markup = g_strdup_printf (temp, _("Find Files"));
787+ shortcut = new Shortcut ("folder-saved-search",
788+ markup,
789+ 96);
790+ shortcut->_id = TYPE_PLACE;
791+ shortcut->_place_id = g_strdup ("/com/canonical/unity/filesplace/files");
792+ shortcut->_place_section = 0;
793+ _layout->AddView (shortcut, 1, nux::eLeft, nux::eFull);
794+ shortcut->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnShortcutClicked));
795+ g_free (markup);
796+
797+ // Browser
798+ markup = gconf_client_get_string (_client, BROWSER_DIR"/exec", NULL);
799+ CreateShortcutFromExec (markup, _("Browse the Web"), "firefox");
800+ g_free (markup);
801+
802+ // Photos
803+ // FIXME: Need to figure out the default
804+ CreateShortcutFromExec ("shotwell", _("View Photos"), "shotwell");
805+
806+ // Email
807+ markup = gconf_client_get_string (_client, CALENDAR_DIR"/exec", NULL);
808+ CreateShortcutFromExec (markup, _("Check Email"), "evolution");
809+ g_free (markup);
810+
811+ // Music
812+ markup = gconf_client_get_string (_client, MEDIA_DIR"/exec", NULL);
813+ CreateShortcutFromExec (markup, _("Listen to Music"), "banshee-1");
814+ g_free (markup);
815+
816+ QueueDraw ();
817+ _layout->QueueDraw ();
818+ QueueRelayout ();
819+}
820+
821+void
822+PlacesHomeView::CreateShortcutFromExec (const char *exec,
823+ const char *name,
824+ const char *icon_hint)
825+{
826+ Shortcut *shortcut = NULL;
827+ gchar *id;
828+ gchar *markup;
829+ gchar *icon;
830+ gchar *real_exec;
831+ GDesktopAppInfo *info;
832+
833+ markup = g_strdup_printf ("<big><b>%s</b></big>", name);
834+
835+ // We're going to try and create a desktop id from a exec string. Now, this is hairy at the
836+ // best of times but the following is the closest best-guess without having to do D-Bus
837+ // roundtrips to BAMF.
838+ if (exec)
839+ {
840+ char *basename;
841+
842+ if (exec[0] == '/')
843+ basename = g_path_get_basename (exec);
844+ else
845+ basename = g_strdup (exec);
846+
847+ id = g_strdup_printf ("%s.desktop", basename);
848+
849+ g_free (basename);
850+ }
851+ else
852+ {
853+ id = g_strdup_printf ("%s.desktop", icon_hint);
854+ }
855+
856+ info = g_desktop_app_info_new (id);
857+ if (G_IS_DESKTOP_APP_INFO (info))
858+ {
859+ icon = g_icon_to_string (g_app_info_get_icon (G_APP_INFO (info)));
860+ real_exec = g_strdup (g_app_info_get_executable (G_APP_INFO (info)));
861+
862+ g_object_unref (info);
863+ }
864+ else
865+ {
866+ icon = g_strdup (icon_hint);
867+ real_exec = g_strdup ("firefox");
868+ }
869+
870+ shortcut = new Shortcut (icon, markup, 96);
871+ shortcut->_id = TYPE_EXEC;
872+ shortcut->_exec = real_exec; //shorcut will free
873+ _layout->AddView (shortcut, 1, nux::eLeft, nux::eFull);
874+ shortcut->sigClick.connect (sigc::mem_fun (this, &PlacesHomeView::OnShortcutClicked));
875+
876+ g_free (id);
877+ g_free (markup);
878+ g_free (icon);
879+}
880+
881+void
882+PlacesHomeView::OnShortcutClicked (PlacesTile *tile)
883+{
884+ Shortcut *shortcut = static_cast<Shortcut *> (tile);
885+ int id = shortcut->_id;
886+
887+ if (id == TYPE_PLACE)
888+ {
889+ ubus_server_send_message (ubus_server_get_default (),
890+ UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
891+ g_variant_new ("(sus)",
892+ shortcut->_place_id,
893+ shortcut->_place_section,
894+ ""));
895+ }
896+ else if (id == TYPE_EXEC)
897+ {
898+ GError *error = NULL;
899+
900+ if (!g_spawn_command_line_async (shortcut->_exec, &error))
901 {
902- GError *error = NULL;
903-
904- g_spawn_command_line_async (tile_infos[i].exec, &error);
905- if (error)
906- {
907- g_warning ("Unable to launch tile: %s", error->message);
908- g_error_free (error);
909- }
910+ g_warning ("%s: Unable to launch %s: %s",
911+ G_STRFUNC,
912+ shortcut->_exec,
913+ error->message);
914+ g_error_free (error);
915 }
916+
917+ ubus_server_send_message (ubus_server_get_default (),
918+ UBUS_PLACE_VIEW_CLOSE_REQUEST,
919+ NULL);
920 }
921-
922- ubus_server_send_message (ubus_server_get_default (),
923- UBUS_PLACE_VIEW_CLOSE_REQUEST,
924- NULL);
925 }
926
927 const gchar* PlacesHomeView::GetName ()
928@@ -203,20 +364,6 @@
929 }
930
931 void
932-PlacesHomeView::PreLayoutManagement ()
933-{
934- nux::View::PreLayoutManagement ();
935-}
936-
937-long
938-PlacesHomeView::PostLayoutManagement (long LayoutResult)
939-{
940- // I'm imagining this is a good as time as any to update the background
941-
942- return nux::View::PostLayoutManagement (LayoutResult);
943-}
944-
945-void
946 PlacesHomeView::DrawRoundedRectangle (cairo_t* cr,
947 double aspect,
948 double x,
949
950=== modified file 'src/PlacesHomeView.h'
951--- src/PlacesHomeView.h 2011-02-06 13:57:19 +0000
952+++ src/PlacesHomeView.h 2011-02-23 12:01:18 +0000
953@@ -31,6 +31,8 @@
954
955 #include "PlacesTile.h"
956
957+#include <gconf/gconf-client.h>
958+
959 class PlacesHomeView : public Introspectable, public nux::View
960 {
961 public:
962@@ -41,9 +43,7 @@
963 void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);
964 void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
965
966- void PreLayoutManagement ();
967- long PostLayoutManagement (long LayoutResult);
968- void OnTileClicked (PlacesTile *tile);
969+ void Refresh ();
970
971 protected:
972 // Introspectable methods
973@@ -60,12 +60,21 @@
974 double cornerRadius,
975 double width,
976 double height);
977+ void OnShortcutClicked (PlacesTile *_tile);
978+ static void OnKeyChanged (GConfClient *client,
979+ guint cnxn_id,
980+ GConfEntry *entry,
981+ PlacesHomeView *self);
982+ void CreateShortcutFromExec (const char *exec,
983+ const char *name,
984+ const char *icon_hint);
985
986 private:
987 nux::AbstractPaintLayer *_bg_layer;
988 nux::GridHLayout *_layout;
989- int _last_width;
990- int _last_height;
991+ int _last_width;
992+ int _last_height;
993+ GConfClient *_client;
994 };
995
996
997
998=== modified file 'src/PlacesResultsController.cpp'
999--- src/PlacesResultsController.cpp 2011-02-17 16:48:20 +0000
1000+++ src/PlacesResultsController.cpp 2011-02-23 12:01:18 +0000
1001@@ -31,6 +31,7 @@
1002 #include "PlacesGroup.h"
1003 #include "PlacesSimpleTile.h"
1004
1005+#include "PlacesSettings.h"
1006
1007 PlacesResultsController::PlacesResultsController ()
1008 {
1009@@ -64,7 +65,7 @@
1010 void *_id)
1011 {
1012 PlacesGroup *group = _groups[groupname];
1013-
1014+
1015 if (!group)
1016 {
1017 group = CreateGroup (groupname);
1018@@ -80,12 +81,10 @@
1019 if (group->IsVisible () == false)
1020 {
1021 group->SetVisible (true);
1022- _results_view->ReJiggyGroups ();
1023-
1024- group->QueueDraw ();
1025- group->ComputeChildLayout ();
1026- group->GetLayout ()->QueueDraw ();
1027+ group->Relayout ();
1028 }
1029+
1030+ tile->QueueDraw ();
1031 }
1032
1033 void
1034@@ -104,13 +103,10 @@
1035 if (group->GetLayout ()->GetChildren ().empty ())
1036 {
1037 group->SetVisible (false);
1038- _results_view->ReJiggyGroups ();
1039 }
1040 else
1041 {
1042- group->QueueDraw ();
1043- group->GetLayout ()->QueueDraw ();
1044- group->ComputeChildLayout ();
1045+ group->Relayout ();
1046 }
1047 }
1048 else
1049@@ -142,10 +138,13 @@
1050
1051 for (it = _groups.begin (); it != _groups.end (); ++it)
1052 {
1053- PlacesGroup *group = static_cast <PlacesGroup *> (it->second);
1054-
1055- _results_view->RemoveGroup (group);
1056- group->UnReference ();
1057+ PlacesGroup *group = dynamic_cast <PlacesGroup *> (it->second);
1058+
1059+ if (group)
1060+ {
1061+ _results_view->RemoveGroup (group);
1062+ group->UnReference ();
1063+ }
1064 }
1065
1066 _groups.erase (_groups.begin (), _groups.end ());
1067@@ -156,6 +155,8 @@
1068 PlacesGroup *
1069 PlacesResultsController::CreateGroup (const char *groupname)
1070 {
1071+ PlacesSettings *settings = PlacesSettings::GetDefault ();
1072+
1073 PlacesGroup *newgroup = new PlacesGroup (NUX_TRACKER_LOCATION);
1074 newgroup->SinkReference ();
1075 newgroup->SetTitle (groupname);
1076@@ -165,7 +166,7 @@
1077
1078 nux::GridHLayout *layout = new nux::GridHLayout (NUX_TRACKER_LOCATION);
1079 layout->ForceChildrenSize (true);
1080- layout->SetChildrenSize (140, 100);
1081+ layout->SetChildrenSize (settings->GetDefaultTileWidth (), 100);
1082 layout->EnablePartialVisibility (false);
1083
1084 layout->SetVerticalExternalMargin (4);
1085@@ -179,7 +180,6 @@
1086
1087 _groups[groupname] = newgroup;
1088 _results_view->AddGroup (newgroup);
1089- _results_view->ReJiggyGroups ();
1090
1091 return newgroup;
1092 }
1093
1094=== modified file 'src/PlacesResultsView.cpp'
1095--- src/PlacesResultsView.cpp 2011-02-17 16:01:55 +0000
1096+++ src/PlacesResultsView.cpp 2011-02-23 12:01:18 +0000
1097@@ -47,24 +47,6 @@
1098 }
1099
1100 void
1101-PlacesResultsView::ReJiggyGroups ()
1102-{
1103- _layout->Clear ();
1104- std::list<PlacesGroup *>::iterator it;
1105-
1106- for (it = _groups.begin(); it != _groups.end(); it++)
1107- {
1108- if ((*it)->IsVisible ())
1109- {
1110- _layout->AddView ((*it), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1111- _layout->QueueDraw ();
1112- (*it)->QueueDraw ();
1113- QueueDraw ();
1114- }
1115- }
1116-}
1117-
1118-void
1119 PlacesResultsView::Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
1120 {
1121 }
1122
1123=== modified file 'src/PlacesResultsView.h'
1124--- src/PlacesResultsView.h 2011-01-31 12:48:36 +0000
1125+++ src/PlacesResultsView.h 2011-02-23 12:01:18 +0000
1126@@ -49,9 +49,6 @@
1127 void AddGroup (PlacesGroup *group);
1128 void RemoveGroup (PlacesGroup *group);
1129
1130- /* I am going to remove this API, its just temporary till nux is fixed */
1131- void ReJiggyGroups ();
1132-
1133 protected:
1134 virtual void ScrollLeft (float stepx, int mousedx);
1135 virtual void ScrollRight (float stepx, int mousedx);
1136
1137=== modified file 'src/PlacesSearchBar.cpp'
1138--- src/PlacesSearchBar.cpp 2011-02-10 14:34:30 +0000
1139+++ src/PlacesSearchBar.cpp 2011-02-23 12:01:18 +0000
1140@@ -51,10 +51,9 @@
1141
1142 _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION);
1143 _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));
1144-
1145-
1146 _layout->AddView (_pango_entry, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
1147- _layout->SetVerticalExternalMargin (14);
1148+
1149+ _layout->SetVerticalExternalMargin (18);
1150 _layout->SetHorizontalExternalMargin (18);
1151
1152 SetCompositionLayout (_layout);
1153@@ -136,7 +135,7 @@
1154 }
1155
1156 void
1157-PlacesSearchBar::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string)
1158+PlacesSearchBar::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore)
1159 {
1160 std::map<gchar *, gchar *> hints;
1161
1162@@ -150,8 +149,11 @@
1163
1164 res = g_strdup_printf (search_template, _entry->GetName ());
1165
1166- _entry->SetActiveSection (section_id);
1167- _entry->SetSearch (search_string ? search_string : "", hints);
1168+ if (!ignore)
1169+ {
1170+ _entry->SetActiveSection (section_id);
1171+ _entry->SetSearch (search_string ? search_string : "", hints);
1172+ }
1173 _pango_entry->SetText (search_string ? search_string : "");
1174 g_free (res);
1175 }
1176@@ -172,6 +174,9 @@
1177 this);
1178
1179 search_changed.emit (_pango_entry->GetText ().c_str ());
1180+
1181+ _pango_entry->QueueDraw ();
1182+ QueueDraw ();
1183 }
1184
1185 bool
1186@@ -253,7 +258,7 @@
1187 void
1188 PlacesSearchBar::UpdateBackground ()
1189 {
1190-#define PADDING 8
1191+#define PADDING 14
1192 #define RADIUS 6
1193 int x, y, width, height;
1194 nux::Geometry geo = GetGeometry ();
1195@@ -299,14 +304,14 @@
1196 delete _bg_layer;
1197
1198 nux::ROPConfig rop;
1199- rop.Blend = false; // Disable the blending. By default rop.Blend is false.
1200+ rop.Blend = true; // Disable the blending. By default rop.Blend is false.
1201 rop.SrcBlend = GL_ONE; // Set the source blend factor.
1202 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; // Set the destination blend factor.
1203
1204 _bg_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
1205 texxform, // The Oject that defines the texture wraping and coordinate transformation.
1206 nux::Color::White, // The color used to modulate the texture.
1207- false, // Write the alpha value of the texture to the destination buffer.
1208+ true, // Write the alpha value of the texture to the destination buffer.
1209 rop // Use the given raster operation to set the blending when the layer is being rendered.
1210 );
1211
1212
1213=== modified file 'src/PlacesSearchBar.h'
1214--- src/PlacesSearchBar.h 2011-02-10 14:34:30 +0000
1215+++ src/PlacesSearchBar.h 2011-02-23 12:01:18 +0000
1216@@ -45,7 +45,7 @@
1217 virtual void PreLayoutManagement ();
1218 virtual long PostLayoutManagement (long LayoutResult);
1219
1220- void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string);
1221+ void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore=false);
1222
1223 sigc::signal<void, const char *> search_changed;
1224
1225
1226=== added file 'src/PlacesSettings.cpp'
1227--- src/PlacesSettings.cpp 1970-01-01 00:00:00 +0000
1228+++ src/PlacesSettings.cpp 2011-02-23 12:01:18 +0000
1229@@ -0,0 +1,93 @@
1230+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
1231+/*
1232+* Copyright (C) 2010 Canonical Ltd
1233+*
1234+* This program is free software: you can redistribute it and/or modify
1235+* it under the terms of the GNU General Public License version 3 as
1236+* published by the Free Software Foundation.
1237+*
1238+* This program is distributed in the hope that it will be useful,
1239+* but WITHOUT ANY WARRANTY; without even the implied warranty of
1240+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1241+* GNU General Public License for more details.
1242+*
1243+* You should have received a copy of the GNU General Public License
1244+* along with this program. If not, see <http://www.gnu.org/licenses/>.
1245+*
1246+* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1247+*/
1248+
1249+#include "gdk/gdk.h"
1250+
1251+#include "PlacesSettings.h"
1252+
1253+static PlacesSettings *_places_settings = NULL;
1254+
1255+PlacesSettings::PlacesSettings ()
1256+: _settings (NULL),
1257+ _raw_from_factor (0),
1258+ _form_factor (DESKTOP)
1259+{
1260+ _settings = g_settings_new ("com.canonical.Unity");
1261+ g_signal_connect (_settings, "changed",
1262+ (GCallback)(PlacesSettings::Changed), this);
1263+ Refresh ();
1264+}
1265+
1266+PlacesSettings::~PlacesSettings ()
1267+{
1268+ g_object_unref (_settings);
1269+}
1270+
1271+void
1272+PlacesSettings::Refresh ()
1273+{
1274+ _raw_from_factor = g_settings_get_enum (_settings, "form-factor");
1275+
1276+ if (_raw_from_factor == 0) //Automatic
1277+ {
1278+ GdkScreen *screen;
1279+ gint primary_monitor;
1280+ GdkRectangle geo;
1281+
1282+ screen = gdk_screen_get_default ();
1283+ primary_monitor = gdk_screen_get_primary_monitor (screen);
1284+ gdk_screen_get_monitor_geometry (screen, primary_monitor, &geo);
1285+
1286+ _form_factor = geo.height > 800 ? DESKTOP : NETBOOK;
1287+ }
1288+ else
1289+ {
1290+ _form_factor = (FormFactor)_raw_from_factor;
1291+ }
1292+
1293+ changed.emit (this);
1294+}
1295+
1296+void
1297+PlacesSettings::Changed (GSettings *settings, char *key, PlacesSettings *self)
1298+{
1299+ self->Refresh ();
1300+}
1301+
1302+PlacesSettings *
1303+PlacesSettings::GetDefault ()
1304+{
1305+ if (G_UNLIKELY (!_places_settings))
1306+ _places_settings = new PlacesSettings ();
1307+
1308+ return _places_settings;
1309+}
1310+
1311+PlacesSettings::FormFactor
1312+PlacesSettings::GetFormFactor ()
1313+{
1314+ return _form_factor;
1315+}
1316+
1317+int
1318+PlacesSettings::GetDefaultTileWidth ()
1319+{
1320+ //FIXME: We want to calculate this from DPI
1321+ return 140;
1322+}
1323
1324=== added file 'src/PlacesSettings.h'
1325--- src/PlacesSettings.h 1970-01-01 00:00:00 +0000
1326+++ src/PlacesSettings.h 2011-02-23 12:01:18 +0000
1327@@ -0,0 +1,58 @@
1328+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
1329+/*
1330+* Copyright (C) 2010 Canonical Ltd
1331+*
1332+* This program is free software: you can redistribute it and/or modify
1333+* it under the terms of the GNU General Public License version 3 as
1334+* published by the Free Software Foundation.
1335+*
1336+* This program is distributed in the hope that it will be useful,
1337+* but WITHOUT ANY WARRANTY; without even the implied warranty of
1338+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1339+* GNU General Public License for more details.
1340+*
1341+* You should have received a copy of the GNU General Public License
1342+* along with this program. If not, see <http://www.gnu.org/licenses/>.
1343+*
1344+* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1345+*/
1346+
1347+#ifndef PLACES_SETTINGS_H
1348+#define PLACES_SETTINGS_H
1349+
1350+#include <gio/gio.h>
1351+#include <Nux/Nux.h>
1352+
1353+#include "PlacesSettings.h"
1354+
1355+class PlacesSettings : public nux::Object
1356+{
1357+public:
1358+ typedef enum
1359+ {
1360+ DESKTOP=1,
1361+ NETBOOK
1362+
1363+ } FormFactor;
1364+
1365+ PlacesSettings ();
1366+ ~PlacesSettings ();
1367+
1368+ static PlacesSettings * GetDefault ();
1369+
1370+ FormFactor GetFormFactor ();
1371+ int GetDefaultTileWidth ();
1372+
1373+ sigc::signal<void, PlacesSettings *> changed;
1374+
1375+private:
1376+ void Refresh ();
1377+ static void Changed (GSettings *settings, gchar *key, PlacesSettings *self);
1378+
1379+private:
1380+ GSettings *_settings;
1381+ int _raw_from_factor;
1382+ FormFactor _form_factor;
1383+};
1384+
1385+#endif // PLACES_SETTINGS_H
1386
1387=== modified file 'src/PlacesSimpleTile.cpp'
1388--- src/PlacesSimpleTile.cpp 2011-02-14 18:07:04 +0000
1389+++ src/PlacesSimpleTile.cpp 2011-02-23 12:01:18 +0000
1390@@ -24,6 +24,10 @@
1391
1392 #include "IconTexture.h"
1393
1394+#include "PlacesSettings.h"
1395+
1396+#define ICON_HEIGHT 48
1397+
1398 PlacesSimpleTile::PlacesSimpleTile (const char *icon_name, const char *label, int icon_size)
1399 : PlacesTile (NUX_TRACKER_LOCATION),
1400 _label (NULL),
1401@@ -36,6 +40,7 @@
1402 _icon = g_strdup (icon_name);
1403
1404 _icontex = new IconTexture (_icon, icon_size);
1405+ _icontex->SetMinMaxSize (PlacesSettings::GetDefault ()->GetDefaultTileWidth (), icon_size);
1406 _icontex->SinkReference ();
1407
1408 _cairotext = new nux::StaticCairoText (_label);
1409@@ -50,8 +55,7 @@
1410 _layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
1411 _layout->AddView (_cairotext, 0, nux::eCenter, nux::eFull);
1412
1413- SetMinimumSize (160, 128);
1414- SetMaximumSize (160, 128);
1415+ SetMinMaxSize (160, 128);
1416
1417 AddChild (_icontex);
1418
1419@@ -73,12 +77,14 @@
1420 PlacesSimpleTile::GetHighlightGeometry ()
1421 {
1422 nux::Geometry base = GetGeometry ();
1423- nux::Geometry icontex_base = _icontex->GetGeometry ();
1424+ int width = 0, height = 0;
1425+
1426+ _icontex->GetTextureSize (&width, &height);
1427
1428- _highlight_geometry.x = (base.width - icontex_base.width) / 2;
1429+ _highlight_geometry.x = (base.width - width) / 2;
1430 _highlight_geometry.y = 12;
1431- _highlight_geometry.width = icontex_base.width;
1432- _highlight_geometry.height = icontex_base.height;
1433+ _highlight_geometry.width = width;
1434+ _highlight_geometry.height = height;
1435
1436 return _highlight_geometry;
1437 }
1438
1439=== modified file 'src/PlacesTile.cpp'
1440--- src/PlacesTile.cpp 2011-02-17 15:34:34 +0000
1441+++ src/PlacesTile.cpp 2011-02-23 12:01:18 +0000
1442@@ -59,7 +59,6 @@
1443 nux::Geometry
1444 PlacesTile::GetHighlightGeometry ()
1445 {
1446-
1447 return GetGeometry ();
1448 }
1449
1450@@ -258,19 +257,19 @@
1451 void PlacesTile::Draw (nux::GraphicsEngine& gfxContext,
1452 bool forceDraw)
1453 {
1454- UpdateBackground ();
1455- nux::Geometry hl_geo = GetHighlightGeometry ();
1456 nux::Geometry base = GetGeometry ();
1457-
1458- nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - 3, base.y + hl_geo.y - 3,
1459- hl_geo.width + 7, hl_geo.height + 7);
1460-
1461 gfxContext.PushClippingRectangle (base);
1462
1463 nux::GetPainter ().PaintBackground (gfxContext, GetGeometry ());
1464
1465 if (_state == STATE_HOVER)
1466 {
1467+ UpdateBackground ();
1468+ nux::Geometry hl_geo = GetHighlightGeometry ();
1469+
1470+ nux::Geometry total_highlight_geo = nux::Geometry (base.x + hl_geo.x - 3, base.y + hl_geo.y - 3,
1471+ hl_geo.width + 7, hl_geo.height + 7);
1472+
1473 gPainter.PushDrawLayer (gfxContext, total_highlight_geo, _hilight_layer);
1474 gPainter.PopBackground ();
1475 }
1476@@ -280,11 +279,13 @@
1477
1478 void PlacesTile::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
1479 {
1480- UpdateBackground ();
1481 GfxContext.PushClippingRectangle (GetGeometry() );
1482
1483 if (_state == STATE_HOVER)
1484+ {
1485+ UpdateBackground ();
1486 nux::GetPainter ().PushLayer (GfxContext, GetGeometry (), _hilight_layer);
1487+ }
1488
1489 _layout->ProcessDraw (GfxContext, force_draw);
1490
1491
1492=== modified file 'src/PlacesView.cpp'
1493--- src/PlacesView.cpp 2011-02-17 16:31:42 +0000
1494+++ src/PlacesView.cpp 2011-02-23 12:01:18 +0000
1495@@ -105,7 +105,7 @@
1496 SetActiveEntry (NULL, 0, "");
1497 return TraverseInfo;
1498 }
1499-
1500+
1501 ret = _layout->ProcessEvent (ievent, ret, ProcessEventInfo);
1502 return ret;
1503 }
1504@@ -125,9 +125,13 @@
1505 PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
1506 {
1507 GfxContext.PushClippingRectangle (GetGeometry() );
1508-
1509+ GfxContext.GetRenderStates ().SetBlend (true);
1510+ GfxContext.GetRenderStates ().SetPremultipliedBlend (nux::SRC_OVER);
1511+
1512 if (_layout)
1513 _layout->ProcessDraw (GfxContext, force_draw);
1514+
1515+ GfxContext.GetRenderStates ().SetBlend (false);
1516
1517 GfxContext.PopClippingRectangle ();
1518 }
1519@@ -138,6 +142,9 @@
1520 void
1521 PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
1522 {
1523+ if ((!entry && _entry == _home_entry) && g_strcmp0 (search_string, "") == 0)
1524+ return;
1525+
1526 if (signal)
1527 entry_changed.emit (entry);
1528
1529@@ -154,16 +161,18 @@
1530 g_signal_handler_disconnect (_entry->GetResultsModel (), _result_removed_id);
1531
1532 _group_added_id = _group_removed_id = _result_added_id = _result_removed_id = 0;
1533+
1534 _results_controller->Clear ();
1535 }
1536
1537 _entry = entry;
1538-
1539+
1540 std::map <gchar*, gchar*> hints;
1541 DeeModel *groups, *results;
1542 DeeModelIter *iter, *last;
1543
1544 _entry->SetActive (true);
1545+ _search_bar->SetActiveEntry (_entry, section_id, search_string, (_entry == _home_entry));
1546
1547 groups = _entry->GetGroupsModel ();
1548 iter = dee_model_get_first_iter (groups);
1549@@ -176,13 +185,16 @@
1550 iter = dee_model_next (groups, iter);
1551 }
1552
1553- results = _entry->GetResultsModel ();
1554- iter = dee_model_get_first_iter (results);
1555- last = dee_model_get_last_iter (results);
1556- while (iter != last)
1557+ if (_entry != _home_entry)
1558 {
1559- OnResultAdded (results, iter, this);
1560- iter = dee_model_next (results, iter);
1561+ results = _entry->GetResultsModel ();
1562+ iter = dee_model_get_first_iter (results);
1563+ last = dee_model_get_last_iter (results);
1564+ while (iter != last)
1565+ {
1566+ OnResultAdded (results, iter, this);
1567+ iter = dee_model_next (results, iter);
1568+ }
1569 }
1570
1571 _group_added_id = g_signal_connect (_entry->GetGroupsModel (), "row-added",
1572@@ -198,8 +210,6 @@
1573 _layered_layout->SetActiveLayer (_home_view);
1574 else
1575 _layered_layout->SetActiveLayer (_results_view);
1576-
1577- _search_bar->SetActiveEntry (_entry, section_id, search_string);
1578 }
1579
1580 PlaceEntry *
1581@@ -243,7 +253,8 @@
1582 PlacesSimpleTile *tile;
1583
1584 //FIXME: We can't do anything with these do just ignore
1585- if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI), "unity-install"))
1586+ if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI),
1587+ "unity-install"))
1588 return;
1589
1590 active = self->GetActiveEntry ();
1591@@ -267,21 +278,12 @@
1592 void
1593 PlacesView::OnResultRemoved (DeeModel *model, DeeModelIter *iter, PlacesView *self)
1594 {
1595- PlaceEntry *active;
1596- DeeModel *groups;
1597- DeeModelIter *git;
1598- const gchar *group_id;
1599-
1600 //FIXME: We can't do anything with these do just ignore
1601- if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI), "unity-install"))
1602+ if (g_str_has_prefix (dee_model_get_string (model, iter, PlaceEntry::RESULT_URI),
1603+ "unity-install"))
1604 return;
1605- active = self->GetActiveEntry ();
1606- groups = active->GetGroupsModel ();
1607- git = dee_model_get_iter_at_row (groups, dee_model_get_uint32 (model,
1608- iter,
1609- PlaceEntry::RESULT_GROUP_ID));
1610- group_id = dee_model_get_string (groups, git, PlaceEntry::GROUP_NAME);
1611- self->GetResultsController ()->RemoveResultFromGroup (group_id, iter);
1612+
1613+ self->GetResultsController ()->RemoveResult (iter);
1614 }
1615
1616 void
1617
1618=== modified file 'src/QuicklistMenuItemCheckmark.cpp'
1619--- src/QuicklistMenuItemCheckmark.cpp 2011-02-01 17:33:26 +0000
1620+++ src/QuicklistMenuItemCheckmark.cpp 2011-02-23 12:01:18 +0000
1621@@ -245,6 +245,7 @@
1622
1623 _normalTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1624 _normalTexture[0]->Update (bitmap);
1625+ delete bitmap;
1626
1627 // draw normal, checked version
1628 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1629@@ -286,6 +287,7 @@
1630
1631 _normalTexture[1] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1632 _normalTexture[1]->Update (bitmap);
1633+ delete bitmap;
1634
1635 // draw active/prelight, unchecked version
1636 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1637@@ -316,6 +318,7 @@
1638
1639 _prelightTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1640 _prelightTexture[0]->Update (bitmap);
1641+ delete bitmap;
1642
1643 // draw active/prelight, checked version
1644 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1645@@ -366,6 +369,7 @@
1646
1647 _prelightTexture[1] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1648 _prelightTexture[1]->Update (bitmap);
1649+ delete bitmap;
1650
1651 // finally clean up
1652 delete _cairoGraphics;
1653
1654=== modified file 'src/QuicklistMenuItemLabel.cpp'
1655--- src/QuicklistMenuItemLabel.cpp 2011-02-01 17:33:26 +0000
1656+++ src/QuicklistMenuItemLabel.cpp 2011-02-23 12:01:18 +0000
1657@@ -218,6 +218,7 @@
1658
1659 _normalTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1660 _normalTexture[0]->Update (bitmap);
1661+ delete bitmap;
1662
1663 // draw active/prelight, unchecked version
1664 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1665@@ -248,6 +249,7 @@
1666
1667 _prelightTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1668 _prelightTexture[0]->Update (bitmap);
1669+ delete bitmap;
1670
1671 // finally clean up
1672 delete _cairoGraphics;
1673
1674=== modified file 'src/QuicklistMenuItemRadio.cpp'
1675--- src/QuicklistMenuItemRadio.cpp 2011-02-01 17:33:26 +0000
1676+++ src/QuicklistMenuItemRadio.cpp 2011-02-23 12:01:18 +0000
1677@@ -247,6 +247,7 @@
1678
1679 _normalTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1680 _normalTexture[0]->Update (bitmap);
1681+ delete bitmap;
1682
1683 // draw normal, enabled version
1684 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1685@@ -275,6 +276,7 @@
1686
1687 _normalTexture[1] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1688 _normalTexture[1]->Update (bitmap);
1689+ delete bitmap;
1690
1691 // draw active/prelight, unchecked version
1692 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1693@@ -305,6 +307,7 @@
1694
1695 _prelightTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1696 _prelightTexture[0]->Update (bitmap);
1697+ delete bitmap;
1698
1699 // draw active/prelight, unchecked version
1700 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1701@@ -338,6 +341,7 @@
1702
1703 _prelightTexture[1] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1704 _prelightTexture[1]->Update (bitmap);
1705+ delete bitmap;
1706
1707 // finally clean up
1708 delete _cairoGraphics;
1709
1710=== modified file 'src/QuicklistMenuItemSeparator.cpp'
1711--- src/QuicklistMenuItemSeparator.cpp 2011-02-01 17:33:26 +0000
1712+++ src/QuicklistMenuItemSeparator.cpp 2011-02-23 12:01:18 +0000
1713@@ -175,6 +175,7 @@
1714
1715 _normalTexture[0] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture ();
1716 _normalTexture[0]->Update (bitmap);
1717+ delete bitmap;
1718
1719 delete _cairoGraphics;
1720 }
1721
1722=== modified file 'src/StaticCairoText.cpp'
1723--- src/StaticCairoText.cpp 2011-02-17 15:34:34 +0000
1724+++ src/StaticCairoText.cpp 2011-02-23 12:01:18 +0000
1725@@ -42,6 +42,8 @@
1726 _text = TEXT (text);
1727 _texture2D = 0;
1728 _need_new_extent_cache = true;
1729+ _pre_layout_width = 0;
1730+ _pre_layout_height = 0;
1731
1732 SetMinimumSize (1, 1);
1733 _ellipsize = NUX_ELLIPSIZE_END;
1734@@ -54,8 +56,7 @@
1735 GtkSettings* settings = gtk_settings_get_default (); // not ref'ed
1736 g_signal_handlers_disconnect_by_func (settings,
1737 (void *) &StaticCairoText::OnFontChanged,
1738- this);
1739-
1740+ this);
1741 if (_texture2D)
1742 _texture2D->UnReference ();
1743
1744@@ -155,9 +156,11 @@
1745 TexCoordXForm texxform;
1746 texxform.SetWrap (TEXWRAP_REPEAT, TEXWRAP_REPEAT);
1747 texxform.SetTexCoordType (TexCoordXForm::OFFSET_COORD);
1748+
1749+ t_u32 alpha = 0, src = 0, dest = 0;
1750
1751- gfxContext.GetRenderStates ().SetBlend (true);
1752- gfxContext.GetRenderStates ().SetPremultipliedBlend (nux::SRC_OVER);
1753+ gfxContext.GetRenderStates ().GetBlend (alpha, src, dest);
1754+ gfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1755
1756 gfxContext.QRP_1Tex (base.x,
1757 base.y,
1758@@ -166,9 +169,9 @@
1759 _texture2D->GetDeviceTexture(),
1760 texxform,
1761 _textColor);
1762-
1763- gfxContext.GetRenderStates().SetBlend (false);
1764-
1765+
1766+ gfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
1767+
1768 gfxContext.PopClippingRectangle ();
1769 }
1770
1771
1772=== added file 'src/TimeMe.cpp'
1773--- src/TimeMe.cpp 1970-01-01 00:00:00 +0000
1774+++ src/TimeMe.cpp 2011-02-23 12:01:18 +0000
1775@@ -0,0 +1,22 @@
1776+/*
1777+ * Copyright (C) 2010 Canonical Ltd
1778+ *
1779+ * This program is free software: you can redistribute it and/or modify
1780+ * it under the terms of the GNU General Public License version 3 as
1781+ * published by the Free Software Foundation.
1782+ *
1783+ * This program is distributed in the hope that it will be useful,
1784+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1785+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1786+ * GNU General Public License for more details.
1787+ *
1788+ * You should have received a copy of the GNU General Public License
1789+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1790+ *
1791+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1792+ */
1793+
1794+#include "TimeMe.h"
1795+
1796+gint64 _____last_time_____ = 0;
1797+gint64 _____start_time_____ = 0;
1798
1799=== added file 'src/TimeMe.h'
1800--- src/TimeMe.h 1970-01-01 00:00:00 +0000
1801+++ src/TimeMe.h 2011-02-23 12:01:18 +0000
1802@@ -0,0 +1,43 @@
1803+/*
1804+ * Copyright (C) 2010 Canonical Ltd
1805+ *
1806+ * This program is free software: you can redistribute it and/or modify
1807+ * it under the terms of the GNU General Public License version 3 as
1808+ * published by the Free Software Foundation.
1809+ *
1810+ * This program is distributed in the hope that it will be useful,
1811+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1812+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1813+ * GNU General Public License for more details.
1814+ *
1815+ * You should have received a copy of the GNU General Public License
1816+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1817+ *
1818+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1819+ */
1820+
1821+#ifndef _TIME_ME_H_
1822+#define _TIME_ME_H_
1823+
1824+#include <glib.h>
1825+
1826+extern gint64 _____last_time_____;
1827+extern gint64 _____start_time_____;
1828+
1829+#define TIME_ME_START(foo) { _____last_time_____ = g_get_monotonic_time (); _____start_time_____ = _____last_time_____; g_print ("\nSTARTED (%s)\n", foo);}
1830+
1831+#define TIME_ME_LOG(foo) { \
1832+ gint64 ____now_time___ = g_get_monotonic_time (); \
1833+ g_print ("%f: %s\n", (____now_time___ - _____last_time_____)/1000.0f, foo); \
1834+ _____last_time_____ = ____now_time___; \
1835+}
1836+
1837+#define TIME_ME_FINSH(foo) { \
1838+ gint64 ____now_time___ = g_get_monotonic_time (); \
1839+ g_print ("\n%f: FINISHED (%s)\n", (____now_time___ - _____start_time_____)/1000.0f, foo); \
1840+}
1841+
1842+#define TIME_ME_FUNC() {_____last_time_____ = g_get_monotonic_time (); _____start_time_____ = _____last_time_____;}
1843+#define TIME_ME_ENDFUNC() TIME_ME_FINSH(G_STRFUNC)
1844+
1845+#endif //_TIME_ME_H_
1846
1847=== modified file 'src/Tooltip.cpp'
1848--- src/Tooltip.cpp 2011-02-01 17:33:26 +0000
1849+++ src/Tooltip.cpp 2011-02-23 12:01:18 +0000
1850@@ -853,7 +853,7 @@
1851
1852 _labelText = text;
1853 _tooltip_text->SetText (_labelText);
1854- this->ComputeChildLayout ();
1855+ QueueRelayout ();
1856 }
1857
1858 // Introspection
1859
1860=== modified file 'src/unitya11y.cpp'
1861--- src/unitya11y.cpp 2011-02-23 11:47:45 +0000
1862+++ src/unitya11y.cpp 2011-02-23 12:01:18 +0000
1863@@ -90,6 +90,9 @@
1864 GSettings *desktop_settings = NULL;
1865 gboolean value = FALSE;
1866
1867+ if (g_getenv ("UNITY_A11Y_DISABLE"))
1868+ return FALSE;
1869+
1870 if (!has_gsettings_schema (DESKTOP_SCHEMA))
1871 return FALSE;
1872
1873
1874=== modified file 'tests/CMakeLists.txt'
1875--- tests/CMakeLists.txt 2011-02-21 13:21:49 +0000
1876+++ tests/CMakeLists.txt 2011-02-23 12:01:18 +0000
1877@@ -103,6 +103,8 @@
1878 ../src/PanelHomeButton.h
1879 ../src/PanelMenuView.cpp
1880 ../src/PanelMenuView.h
1881+ ../src/TimeMe.cpp
1882+ ../src/TimeMe.h
1883 ../src/StaticCairoText.cpp
1884 ../src/StaticCairoText.h
1885 ../src/WindowButtons.cpp
1886@@ -113,22 +115,37 @@
1887 ../src/ubus-server.h
1888 )
1889
1890+set (PLACES_COMMON_SOURCE ../src/ubus-server.cpp
1891+ ../src/ubus-server.h
1892+ ../src/IconLoader.cpp
1893+ ../src/IconLoader.h
1894+ ../src/IconTexture.cpp
1895+ ../src/IconTexture.h
1896+ ../src/Introspectable.cpp
1897+ ../src/Introspectable.h
1898+ ../src/PlacesSettings.cpp
1899+ ../src/PlacesSettings.h
1900+ ../src/PlacesTile.cpp
1901+ ../src/PlacesTile.h
1902+ ../src/PlacesSimpleTile.cpp
1903+ ../src/PlacesSimpleTile.h
1904+ ../src/TextureCache.h
1905+ ../src/TextureCache.cpp
1906+ ../src/TimeMe.cpp
1907+ ../src/TimeMe.h
1908+ ../src/StaticCairoText.cpp
1909+ ../src/StaticCairoText.h
1910+ ../src/UBusMessages.h
1911+ )
1912 add_executable (test-places
1913 TestPlaces.cpp
1914- ../src/IconLoader.cpp
1915- ../src/IconLoader.h
1916- ../src/IconTexture.cpp
1917- ../src/IconTexture.h
1918+ ${PLACES_COMMON_SOURCE}
1919 ../src/PlacesController.cpp
1920 ../src/PlacesController.h
1921 ../src/PlacesHomeView.cpp
1922 ../src/PlacesHomeView.h
1923 ../src/PlacesSearchBar.cpp
1924 ../src/PlacesSearchBar.h
1925- ../src/PlacesSimpleTile.cpp
1926- ../src/PlacesSimpleTile.h
1927- ../src/PlacesTile.cpp
1928- ../src/PlacesTile.h
1929 ../src/PlacesResultsController.cpp
1930 ../src/PlacesResultsController.h
1931 ../src/PlacesResultsView.h
1932@@ -137,11 +154,6 @@
1933 ../src/PlacesGroup.h
1934 ../src/PlacesView.cpp
1935 ../src/PlacesView.h
1936- ../src/TextureCache.h
1937- ../src/TextureCache.cpp
1938- ../src/UBusMessages.h
1939- ../src/Introspectable.cpp
1940- ../src/Introspectable.h
1941 ../src/PlaceEntryHome.cpp
1942 ../src/PlaceEntryRemote.h
1943 ../src/PlaceEntryRemote.cpp
1944@@ -154,73 +166,30 @@
1945 ../src/PlaceRemote.cpp
1946 ../src/PlaceRemote.h
1947 ../src/Place.h
1948- ../src/StaticCairoText.cpp
1949- ../src/StaticCairoText.h
1950- ../src/ubus-server.cpp
1951- ../src/ubus-server.h
1952 )
1953
1954 add_executable (test-places-tiles
1955 TestPlacesTiles.cpp
1956- ../src/IconLoader.cpp
1957- ../src/IconLoader.h
1958- ../src/PlacesTile.cpp
1959- ../src/PlacesTile.h
1960- ../src/PlacesSimpleTile.cpp
1961- ../src/PlacesSimpleTile.h
1962- ../src/StaticCairoText.cpp
1963- ../src/StaticCairoText.h
1964- ../src/IconTexture.cpp
1965- ../src/IconTexture.h
1966- ../src/Introspectable.cpp
1967- ../src/Introspectable.h
1968- ../src/TextureCache.h
1969- ../src/TextureCache.cpp
1970+ ${PLACES_COMMON_SOURCE}
1971 )
1972
1973
1974 add_executable (test-places-group
1975 TestPlacesGroup.cpp
1976- ../src/IconLoader.cpp
1977- ../src/IconLoader.h
1978+ ${PLACES_COMMON_SOURCE}
1979 ../src/PlacesGroup.cpp
1980 ../src/PlacesGroup.h
1981- ../src/IconTexture.cpp
1982- ../src/IconTexture.h
1983- ../src/Introspectable.cpp
1984- ../src/Introspectable.h
1985- ../src/StaticCairoText.cpp
1986- ../src/StaticCairoText.h
1987- ../src/PlacesTile.cpp
1988- ../src/PlacesTile.h
1989- ../src/PlacesSimpleTile.cpp
1990- ../src/PlacesSimpleTile.h
1991- ../src/TextureCache.h
1992- ../src/TextureCache.cpp
1993 )
1994
1995 add_executable (test-places-results
1996 TestPlacesResults.cpp
1997- ../src/IconLoader.cpp
1998- ../src/IconLoader.h
1999+ ${PLACES_COMMON_SOURCE}
2000 ../src/PlacesResultsController.cpp
2001 ../src/PlacesResultsController.h
2002 ../src/PlacesResultsView.h
2003 ../src/PlacesResultsView.cpp
2004 ../src/PlacesGroup.cpp
2005 ../src/PlacesGroup.h
2006- ../src/PlacesTile.cpp
2007- ../src/PlacesTile.h
2008- ../src/PlacesSimpleTile.cpp
2009- ../src/PlacesSimpleTile.h
2010- ../src/IconTexture.cpp
2011- ../src/IconTexture.h
2012- ../src/Introspectable.cpp
2013- ../src/Introspectable.h
2014- ../src/StaticCairoText.cpp
2015- ../src/StaticCairoText.h
2016- ../src/TextureCache.h
2017- ../src/TextureCache.cpp
2018 )
2019
2020 add_executable (test-quicklist