Merge lp:~unity-team/unity/fixes-2011-03-28 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Merged at revision: 1058
Proposed branch: lp:~unity-team/unity/fixes-2011-03-28
Merge into: lp:unity
Diff against target: 852 lines (+442/-61)
19 files modified
src/IndicatorObjectFactoryRemote.cpp (+5/-0)
src/IndicatorObjectFactoryRemote.h (+2/-0)
src/PanelController.cpp (+8/-1)
src/PanelController.h (+2/-0)
src/PanelHomeButton.cpp (+7/-4)
src/PanelMenuView.cpp (+6/-0)
src/PanelMenuView.h (+2/-0)
src/PanelView.cpp (+9/-37)
src/PlacesGroupController.cpp (+42/-15)
src/PlacesGroupController.h (+7/-0)
src/PlacesHorizontalTile.cpp (+244/-0)
src/PlacesHorizontalTile.h (+68/-0)
src/PlacesSearchBar.cpp (+10/-0)
src/PlacesSearchBar.h (+1/-0)
src/PlacesView.cpp (+10/-0)
src/SimpleLauncherIcon.cpp (+2/-1)
src/StaticCairoText.cpp (+12/-3)
src/StaticCairoText.h (+3/-0)
tests/CMakeLists.txt (+2/-0)
To merge this branch: bzr merge lp:~unity-team/unity/fixes-2011-03-28
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+55814@code.launchpad.net

Description of the change

Bugs linked

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1, awesome work, fixes much many crashes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/IndicatorObjectFactoryRemote.cpp'
2--- src/IndicatorObjectFactoryRemote.cpp 2011-03-17 14:16:13 +0000
3+++ src/IndicatorObjectFactoryRemote.cpp 2011-03-31 19:28:30 +0000
4@@ -406,6 +406,11 @@
5 g_free (uname);
6 }
7
8+GDBusProxy *
9+IndicatorObjectFactoryRemote::GetRemoteProxy ()
10+{
11+ return _proxy;
12+}
13
14 //
15 // C callbacks, they just link to class methods and aren't interesting
16
17=== modified file 'src/IndicatorObjectFactoryRemote.h'
18--- src/IndicatorObjectFactoryRemote.h 2011-03-17 09:41:28 +0000
19+++ src/IndicatorObjectFactoryRemote.h 2011-03-31 19:28:30 +0000
20@@ -50,6 +50,8 @@
21
22 void AddProperties (GVariantBuilder *builder);
23
24+ GDBusProxy * GetRemoteProxy ();
25+
26 private:
27 IndicatorObjectProxyRemote* IndicatorForID (const char *id);
28 private:
29
30=== modified file 'src/PanelController.cpp'
31--- src/PanelController.cpp 2011-03-29 12:23:52 +0000
32+++ src/PanelController.cpp 2011-03-31 19:28:30 +0000
33@@ -25,7 +25,8 @@
34
35 PanelController::PanelController ()
36 : _bfb_size (66),
37- _opacity (1.0f)
38+ _opacity (1.0f),
39+ _open_menu_start_received (false)
40 {
41 UScreen *screen = UScreen::GetDefault ();
42
43@@ -63,6 +64,8 @@
44
45 view->StartFirstMenuShow ();
46 }
47+
48+ _open_menu_start_received = true;
49 }
50
51 void
52@@ -70,6 +73,10 @@
53 {
54 std::vector<nux::BaseWindow *>::iterator it, eit = _windows.end ();
55
56+ if (!_open_menu_start_received)
57+ return;
58+ _open_menu_start_received = false;
59+
60 for (it = _windows.begin (); it != eit; ++it)
61 {
62 PanelView *view = ViewForWindow (*it);
63
64=== modified file 'src/PanelController.h'
65--- src/PanelController.h 2011-03-29 12:23:52 +0000
66+++ src/PanelController.h 2011-03-31 19:28:30 +0000
67@@ -55,6 +55,8 @@
68 float _opacity;
69
70 sigc::connection _on_screen_change_connection;
71+
72+ bool _open_menu_start_received;
73 };
74
75 #endif // _PANEL_CONTROLLER_H_
76
77=== modified file 'src/PanelHomeButton.cpp'
78--- src/PanelHomeButton.cpp 2011-03-29 12:23:52 +0000
79+++ src/PanelHomeButton.cpp 2011-03-31 19:28:30 +0000
80@@ -113,10 +113,13 @@
81 cairo_set_line_width (cr, 1);
82
83 pixbuf = PanelStyle::GetDefault ()->GetHomeButton ();
84- gdk_cairo_set_source_pixbuf (cr, pixbuf,
85- (_button_width-gdk_pixbuf_get_width (pixbuf))/2,
86- (PANEL_HEIGHT-gdk_pixbuf_get_height (pixbuf))/2);
87- g_object_unref (pixbuf);
88+ if (GDK_IS_PIXBUF (pixbuf))
89+ {
90+ gdk_cairo_set_source_pixbuf (cr, pixbuf,
91+ (_button_width-gdk_pixbuf_get_width (pixbuf))/2,
92+ (PANEL_HEIGHT-gdk_pixbuf_get_height (pixbuf))/2);
93+ g_object_unref (pixbuf);
94+ }
95
96 cairo_paint (cr);
97
98
99=== modified file 'src/PanelMenuView.cpp'
100--- src/PanelMenuView.cpp 2011-03-30 00:29:57 +0000
101+++ src/PanelMenuView.cpp 2011-03-31 19:28:30 +0000
102@@ -1066,3 +1066,9 @@
103 {
104 return _we_control_active;
105 }
106+
107+bool
108+PanelMenuView::HasOurWindowFocused ()
109+{
110+ return _is_own_window;
111+}
112
113=== modified file 'src/PanelMenuView.h'
114--- src/PanelMenuView.h 2011-03-29 12:23:52 +0000
115+++ src/PanelMenuView.h 2011-03-31 19:28:30 +0000
116@@ -93,6 +93,8 @@
117 void SetMonitor (int monitor);
118 bool GetControlsActive ();
119
120+ bool HasOurWindowFocused ();
121+
122 protected:
123 const gchar * GetName ();
124 const gchar * GetChildsName ();
125
126=== modified file 'src/PanelView.cpp'
127--- src/PanelView.cpp 2011-03-29 12:23:52 +0000
128+++ src/PanelView.cpp 2011-03-31 19:28:30 +0000
129@@ -37,10 +37,6 @@
130 #include "IndicatorObjectFactoryRemote.h"
131 #include "PanelIndicatorObjectView.h"
132
133-#define S_NAME "com.canonical.Unity.Panel.Service"
134-#define S_PATH "/com/canonical/Unity/Panel/Service"
135-#define S_IFACE "com.canonical.Unity.Panel.Service"
136-
137 NUX_IMPLEMENT_OBJECT_TYPE (PanelView);
138
139 PanelView::PanelView (NUX_FILE_LINE_DECL)
140@@ -289,7 +285,8 @@
141 {
142 PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
143
144- if (view->_layout == NULL)
145+ if (view->_layout == NULL
146+ || (view == _menu_view && _menu_view->HasOurWindowFocused ()))
147 continue;
148
149 geo = view->GetAbsoluteGeometry ();
150@@ -391,7 +388,8 @@
151 {
152 PanelIndicatorObjectView *view = static_cast<PanelIndicatorObjectView *> (*it);
153
154- if (view->_layout == NULL)
155+ if (view->_layout == NULL
156+ || (view == _menu_view && _menu_view->HasOurWindowFocused ()))
157 continue;
158
159 std::list<Area *>::iterator it2;
160@@ -430,22 +428,6 @@
161 return _is_primary;
162 }
163
164-static void
165-on_sync_geometries_done_cb (GObject *source,
166- GAsyncResult *res,
167- gpointer data)
168-{
169- GVariant *args;
170- GError *error = NULL;
171-
172- args = g_dbus_proxy_call_finish ((GDBusProxy*) source, res, &error);
173- if (error != NULL)
174- {
175- g_warning ("Error when calling SyncGeometries: %s", error->message);
176- g_error_free (error);
177- }
178-}
179-
180 void
181 PanelView::SetPrimary (bool primary)
182 {
183@@ -458,8 +440,8 @@
184 PanelView::SyncGeometries ()
185 {
186 GVariantBuilder b;
187- GDBusProxy *bus_proxy;
188- GVariant *method_args;
189+ GDBusProxy *bus_proxy;
190+ GVariant *method_args;
191 std::list<Area *>::iterator it;
192
193 g_variant_builder_init (&b, G_VARIANT_TYPE ("(a(ssiiii))"));
194@@ -499,26 +481,16 @@
195 method_args = g_variant_builder_end (&b);
196
197 // Send geometries to the panel service
198- bus_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
199- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
200- NULL,
201- S_NAME,
202- S_PATH,
203- S_IFACE,
204- NULL,
205- NULL);
206+ bus_proxy =_remote->GetRemoteProxy ();
207 if (bus_proxy != NULL)
208 {
209 g_dbus_proxy_call (bus_proxy, "SyncGeometries", method_args,
210 G_DBUS_CALL_FLAGS_NONE,
211 -1,
212 NULL,
213- on_sync_geometries_done_cb,
214- this);
215- g_object_unref (bus_proxy);
216+ NULL,
217+ NULL);
218 }
219-
220- g_variant_unref (method_args);
221 }
222
223 void
224
225=== modified file 'src/PlacesGroupController.cpp'
226--- src/PlacesGroupController.cpp 2011-03-23 18:26:57 +0000
227+++ src/PlacesGroupController.cpp 2011-03-31 19:28:30 +0000
228@@ -23,11 +23,13 @@
229
230 #include "PlacesStyle.h"
231 #include "PlacesSimpleTile.h"
232+#include "PlacesHorizontalTile.h"
233
234 static const guint kPadding = 4;
235
236 PlacesGroupController::PlacesGroupController (PlaceEntry *entry, PlaceEntryGroup& group)
237-: _entry (entry),
238+: _type (RENDERER_TYPE_DEFAULT),
239+ _entry (entry),
240 _group (NULL),
241 _check_tiles_id (0)
242 {
243@@ -39,17 +41,23 @@
244 _group->SetName(group.GetName ());
245 _group->SetIcon (group.GetIcon ());
246
247+ if (g_strcmp0 (group.GetRenderer (), "UnityHorizontalTileRenderer") == 0)
248+ _type = RENDERER_TYPE_HORI_TILE;
249+
250 nux::GridHLayout *layout = new nux::GridHLayout (NUX_TRACKER_LOCATION);
251 layout->ForceChildrenSize (true);
252- layout->SetChildrenSize (style->GetTileWidth (), style->GetTileHeight ());
253 layout->EnablePartialVisibility (false);
254-
255 layout->SetVerticalExternalMargin (kPadding);
256 layout->SetHorizontalExternalMargin (kPadding);
257 layout->SetVerticalInternalMargin (kPadding);
258 layout->SetHorizontalInternalMargin (kPadding);
259 layout->SetHeightMatchContent (true);
260
261+ if (_type == RENDERER_TYPE_HORI_TILE)
262+ layout->SetChildrenSize (style->GetTileWidth () * 2, style->GetTileIconSize () + 24); //padding
263+ else
264+ layout->SetChildrenSize (style->GetTileWidth (), style->GetTileHeight ());
265+
266 _group->SetChildLayout (layout);
267 _group->SetVisible (false);
268 _group->SetExpanded (false);
269@@ -57,11 +65,19 @@
270 _group->expanded.connect (sigc::mem_fun (this, &PlacesGroupController::CheckTiles));
271 style->columns_changed.connect (sigc::mem_fun (this, &PlacesGroupController::CheckTiles));
272
273- _more_tile = new PlacesSimpleTile ("gtk-add",
274- _("Load more results..."),
275- style->GetTileIconSize (),
276- false,
277- "more-tile");
278+ if (_type == RENDERER_TYPE_HORI_TILE)
279+ _more_tile = new PlacesHorizontalTile ("gtk-add",
280+ _("Load more results..."),
281+ "",
282+ style->GetTileIconSize (),
283+ false,
284+ "more-tile");
285+ else
286+ _more_tile = new PlacesSimpleTile ("gtk-add",
287+ _("Load more results..."),
288+ style->GetTileIconSize (),
289+ false,
290+ "more-tile");
291 _more_tile->Reference ();
292 _more_tile->sigClick.connect (sigc::mem_fun (this, &PlacesGroupController::MoreTileClicked));
293 }
294@@ -95,17 +111,27 @@
295
296 gchar *result_name;
297 const gchar *result_icon;
298- PlacesSimpleTile *tile;
299+ gchar *result_comment;
300+ PlacesTile *tile;
301
302 result_name = g_markup_escape_text (result.GetName (), -1);
303+ result_comment = g_markup_escape_text (result.GetComment (), -1);
304 result_icon = result.GetIcon ();
305
306- tile = new PlacesSimpleTile (result_icon,
307- result_name,
308- style->GetTileIconSize (),
309- false,
310- result.GetId ());
311- tile->SetURI (result.GetURI ());
312+ if (_type == RENDERER_TYPE_HORI_TILE)
313+ tile = new PlacesHorizontalTile (result_icon,
314+ result_name,
315+ result_comment,
316+ style->GetTileIconSize (),
317+ false,
318+ result.GetId ());
319+ else
320+ tile = new PlacesSimpleTile (result_icon,
321+ result_name,
322+ style->GetTileIconSize (),
323+ false,
324+ result.GetId ());
325+
326 tile->QueueRelayout ();
327 tile->sigClick.connect (sigc::mem_fun (this, &PlacesGroupController::TileClicked));
328
329@@ -116,6 +142,7 @@
330 _group->SetVisible (true);
331
332 g_free (result_name);
333+ g_free (result_comment);
334 }
335
336 void
337
338=== modified file 'src/PlacesGroupController.h'
339--- src/PlacesGroupController.h 2011-03-20 16:33:05 +0000
340+++ src/PlacesGroupController.h 2011-03-31 19:28:30 +0000
341@@ -27,6 +27,12 @@
342 #include "PlacesGroup.h"
343 #include "PlacesTile.h"
344
345+enum PlacesGroupRendererType
346+{
347+ RENDERER_TYPE_DEFAULT = 0,
348+ RENDERER_TYPE_HORI_TILE
349+};
350+
351 class PlacesGroupController : public nux::Object, public Introspectable
352 {
353 public:
354@@ -57,6 +63,7 @@
355 void MoreTileClicked (PlacesTile *tile);
356
357 private:
358+ PlacesGroupRendererType _type;
359 PlaceEntry *_entry;
360 PlacesGroup *_group;
361 const void *_id;
362
363=== added file 'src/PlacesHorizontalTile.cpp'
364--- src/PlacesHorizontalTile.cpp 1970-01-01 00:00:00 +0000
365+++ src/PlacesHorizontalTile.cpp 2011-03-31 19:28:30 +0000
366@@ -0,0 +1,244 @@
367+/*
368+ * Copyright 2011 Canonical Ltd.
369+ *
370+ * This program is free software: you can redistribute it and/or modify it
371+ * under the terms of the GNU Lesser General Public License version 3, as
372+ * published by the Free Software Foundation.
373+ *
374+ * This program is distributed in the hope that it will be useful, but
375+ * WITHOUT ANY WARRANTY; without even the implied warranties of
376+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
377+ * PURPOSE. See the applicable version of the GNU Lesser General Public
378+ * License for more details.
379+ *
380+ * You should have received a copy of both the GNU Lesser General Public
381+ * License version 3 along with this program. If not, see
382+ * <http://www.gnu.org/licenses/>
383+ *
384+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
385+ *
386+ */
387+
388+#include "PlacesSettings.h"
389+#include "PlacesSettings.h"
390+#include "ubus-server.h"
391+#include "UBusMessages.h"
392+
393+#include "PlacesHorizontalTile.h"
394+
395+#include <Nux/HLayout.h>
396+#include <NuxImage/GdkGraphics.h>
397+#include <gtk/gtk.h>
398+#include <gdk/gdk.h>
399+
400+PlacesHorizontalTile::PlacesHorizontalTile (const char *icon_name,
401+ const char *label,
402+ const char *comment,
403+ int icon_size,
404+ bool defer_icon_loading,
405+ const void *id)
406+: PlacesTile (NUX_TRACKER_LOCATION, id),
407+ _label (NULL),
408+ _icon (NULL),
409+ _uri (NULL)
410+{
411+ _label = g_strdup (label);
412+ _icon = g_strdup (icon_name);
413+ _comment = g_strdup_printf ("<small>%s</small>", comment);
414+
415+ int w = (PlacesSettings::GetDefault ()->GetDefaultTileWidth () * 2) - icon_size - 24;//padding
416+
417+ nux::HLayout *layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
418+ layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
419+
420+ _icontex = new IconTexture (_icon, icon_size, defer_icon_loading);
421+ _icontex->SetMinMaxSize (icon_size * 1.5, icon_size);
422+ AddChild (_icontex);
423+ layout->AddView (_icontex, 0, nux::eCenter, nux::eFull);
424+
425+ layout->AddLayout (new nux::SpaceLayout (0, 0, 12, 12));
426+
427+ nux::VLayout *vlayout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
428+ layout->AddView (vlayout, 1, nux::eLeft, nux::eFull);
429+
430+ vlayout->AddLayout (new nux::SpaceLayout (0, 0, 6, 6));
431+
432+ _cairotext = new nux::StaticCairoText (_label);
433+ _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
434+ _cairotext->SetMaximumWidth (w);
435+ vlayout->AddView (_cairotext, 0, nux::eLeft, nux::eFull);
436+
437+ _cairotext = new nux::StaticCairoText (_comment);
438+ _cairotext->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
439+ _cairotext->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
440+ _cairotext->SetLines (-3);
441+ _cairotext->SetMaximumWidth (w);
442+ _cairotext->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.8f));
443+ vlayout->AddView (_cairotext, 1, nux::eLeft, nux::eFull);
444+
445+ SetLayout (layout);
446+
447+ SetDndEnabled (true, false);
448+}
449+
450+
451+PlacesHorizontalTile::~PlacesHorizontalTile ()
452+{
453+ g_free (_comment);
454+ g_free (_label);
455+ g_free (_icon);
456+ g_free (_uri);
457+}
458+
459+void
460+PlacesHorizontalTile::DndSourceDragBegin ()
461+{
462+ Reference ();
463+ ubus_server_send_message (ubus_server_get_default (),
464+ UBUS_PLACE_VIEW_CLOSE_REQUEST,
465+ NULL);
466+}
467+
468+nux::NBitmapData *
469+PlacesHorizontalTile::DndSourceGetDragImage ()
470+{
471+ nux::NBitmapData *result = 0;
472+ GdkPixbuf *pbuf;
473+ GtkIconTheme *theme;
474+ GtkIconInfo *info;
475+ GError *error = NULL;
476+ GIcon *icon;
477+
478+ const char *icon_name = _icon;
479+ int size = 64;
480+
481+ if (!icon_name)
482+ icon_name = "application-default-icon";
483+
484+ theme = gtk_icon_theme_get_default ();
485+ icon = g_icon_new_for_string (icon_name, NULL);
486+
487+ if (G_IS_ICON (icon))
488+ {
489+ info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, (GtkIconLookupFlags)0);
490+ g_object_unref (icon);
491+ }
492+ else
493+ {
494+ info = gtk_icon_theme_lookup_icon (theme,
495+ icon_name,
496+ size,
497+ (GtkIconLookupFlags) 0);
498+ }
499+
500+ if (!info)
501+ {
502+ info = gtk_icon_theme_lookup_icon (theme,
503+ "application-default-icon",
504+ size,
505+ (GtkIconLookupFlags) 0);
506+ }
507+
508+ if (gtk_icon_info_get_filename (info) == NULL)
509+ {
510+ gtk_icon_info_free (info);
511+ info = gtk_icon_theme_lookup_icon (theme,
512+ "application-default-icon",
513+ size,
514+ (GtkIconLookupFlags) 0);
515+ }
516+
517+ pbuf = gtk_icon_info_load_icon (info, &error);
518+ gtk_icon_info_free (info);
519+
520+ if (GDK_IS_PIXBUF (pbuf))
521+ {
522+ nux::GdkGraphics graphics (pbuf);
523+ result = graphics.GetBitmap ();
524+ g_object_unref (pbuf);
525+ }
526+
527+ return result;
528+}
529+
530+std::list<const char *>
531+PlacesHorizontalTile::DndSourceGetDragTypes ()
532+{
533+ std::list<const char*> result;
534+ result.push_back ("text/uri-list");
535+ return result;
536+}
537+
538+const char *
539+PlacesHorizontalTile::DndSourceGetDataForType (const char *type, int *size, int *format)
540+{
541+ *format = 8;
542+
543+ if (_uri)
544+ {
545+ *size = strlen (_uri);
546+ return _uri;
547+ }
548+ else
549+ {
550+ *size = 0;
551+ return 0;
552+ }
553+}
554+
555+void
556+PlacesHorizontalTile::DndSourceDragFinished (nux::DndAction result)
557+{
558+ UnReference ();
559+}
560+
561+nux::Geometry
562+PlacesHorizontalTile::GetHighlightGeometry ()
563+{
564+ nux::Geometry base = GetGeometry ();
565+ int width = 0, height = 0;
566+
567+ _icontex->GetTextureSize (&width, &height);
568+
569+ _highlight_geometry.x = 12;
570+ _highlight_geometry.y = 12;
571+ _highlight_geometry.width = width;
572+ _highlight_geometry.height = height;
573+
574+ return _highlight_geometry;
575+}
576+
577+void
578+PlacesHorizontalTile::SetURI (const char *uri)
579+{
580+ if (_uri)
581+ g_free (_uri);
582+
583+ _uri = NULL;
584+
585+ if (uri)
586+ _uri = g_strdup (uri);
587+}
588+
589+const gchar*
590+PlacesHorizontalTile::GetName ()
591+{
592+ return "PlacesHorizontalTile";
593+}
594+
595+const gchar *
596+PlacesHorizontalTile::GetChildsName ()
597+{
598+ return "PlacesHorizontalTileContents";
599+}
600+
601+void
602+PlacesHorizontalTile::AddProperties (GVariantBuilder *builder)
603+{
604+ nux::Geometry geo = GetGeometry ();
605+
606+ g_variant_builder_add (builder, "{sv}", "x", g_variant_new_int32 (geo.x));
607+ g_variant_builder_add (builder, "{sv}", "y", g_variant_new_int32 (geo.y));
608+ g_variant_builder_add (builder, "{sv}", "width", g_variant_new_int32 (geo.width));
609+ g_variant_builder_add (builder, "{sv}", "height", g_variant_new_int32 (geo.height));
610+}
611
612=== added file 'src/PlacesHorizontalTile.h'
613--- src/PlacesHorizontalTile.h 1970-01-01 00:00:00 +0000
614+++ src/PlacesHorizontalTile.h 2011-03-31 19:28:30 +0000
615@@ -0,0 +1,68 @@
616+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
617+/*
618+ * Copyright (C) 2011 Canonical Ltd
619+ *
620+ * This program is free software: you can redistribute it and/or modify
621+ * it under the terms of the GNU General Public License version 3 as
622+ * published by the Free Software Foundation.
623+ *
624+ * This program is distributed in the hope that it will be useful,
625+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
626+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
627+ * GNU General Public License for more details.
628+ *
629+ * You should have received a copy of the GNU General Public License
630+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
631+ *
632+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
633+ */
634+
635+#ifndef PLACES_HORIZONTAL_TILE_H
636+#define PLACES_HORIZONTAL_TILE_H
637+
638+#include <sigc++/sigc++.h>
639+
640+#include "IconTexture.h"
641+#include "Introspectable.h"
642+#include "PlacesTile.h"
643+#include "StaticCairoText.h"
644+
645+class PlacesHorizontalTile : public Introspectable, public PlacesTile
646+{
647+public:
648+
649+ PlacesHorizontalTile (const char *icon,
650+ const char *label,
651+ const char *comment,
652+ int icon_size=64,
653+ bool defer_icon_loading=false,
654+ const void *id=NULL);
655+ ~PlacesHorizontalTile ();
656+
657+ void SetURI (const char *uri);
658+
659+protected:
660+ nux::Geometry GetHighlightGeometry ();
661+
662+ const gchar * GetName ();
663+ const gchar * GetChildsName ();
664+ void AddProperties (GVariantBuilder *builder);
665+
666+ virtual void DndSourceDragBegin ();
667+ virtual nux::NBitmapData * DndSourceGetDragImage ();
668+ virtual std::list<const char *> DndSourceGetDragTypes ();
669+ virtual const char * DndSourceGetDataForType (const char *type, int *size, int *format);
670+ virtual void DndSourceDragFinished (nux::DndAction result);
671+
672+private:
673+ nux::Geometry _highlight_geometry;
674+ char* _label;
675+ char* _comment;
676+ char* _icon;
677+ char* _uri;
678+ IconTexture *_icontex;
679+ nux::StaticCairoText *_cairotext;
680+};
681+
682+
683+#endif /* PLACES_HORIZONTAL_TILE_H */
684
685=== modified file 'src/PlacesSearchBar.cpp'
686--- src/PlacesSearchBar.cpp 2011-03-29 15:24:56 +0000
687+++ src/PlacesSearchBar.cpp 2011-03-31 19:28:30 +0000
688@@ -103,6 +103,10 @@
689 OnFontChanged (NULL, NULL, this);
690
691 _cursor_moved_conn = _pango_entry->cursor_moved.connect (sigc::mem_fun (this, &PlacesSearchBar::OnLayeredLayoutQueueDraw));
692+
693+ ubus_server_register_interest (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN,
694+ (UBusCallback)PlacesSearchBar::OnPlacesClosed, this);
695+
696 }
697
698 PlacesSearchBar::~PlacesSearchBar ()
699@@ -360,6 +364,12 @@
700 g_free (font_desc);
701 }
702
703+void
704+PlacesSearchBar::OnPlacesClosed (GVariant *variant, PlacesSearchBar *self)
705+{
706+ self->_combo->GetMenuPage ()->StopMenu ();
707+}
708+
709 static void
710 draw_rounded_rect (cairo_t* cr,
711 double aspect,
712
713=== modified file 'src/PlacesSearchBar.h'
714--- src/PlacesSearchBar.h 2011-03-29 15:24:56 +0000
715+++ src/PlacesSearchBar.h 2011-03-31 19:28:30 +0000
716@@ -79,6 +79,7 @@
717
718 static bool OnLiveSearchTimeout (PlacesSearchBar *self);
719 static void OnFontChanged (GObject *object, GParamSpec *pspec, PlacesSearchBar *self);
720+ static void OnPlacesClosed (GVariant *variant, PlacesSearchBar *self);
721
722 private:
723 nux::AbstractPaintLayer *_bg_layer;
724
725=== modified file 'src/PlacesView.cpp'
726--- src/PlacesView.cpp 2011-03-24 01:47:55 +0000
727+++ src/PlacesView.cpp 2011-03-31 19:28:30 +0000
728@@ -179,6 +179,14 @@
729 return ret;
730 }
731
732+static gboolean
733+OnQueueDrawDrawDraw (PlacesView *self)
734+{
735+ self->QueueDraw ();
736+
737+ return FALSE;
738+}
739+
740 void
741 PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
742 {
743@@ -232,6 +240,8 @@
744 GfxContext.Push2DWindow (GfxContext.GetWindowWidth (), GfxContext.GetWindowHeight ());
745 GfxContext.ApplyClippingRectangle ();
746 }
747+
748+ g_timeout_add (0, (GSourceFunc)OnQueueDrawDrawDraw, this);
749 }
750
751 if (_bg_blur_texture.IsValid () && paint_blur)
752
753=== modified file 'src/SimpleLauncherIcon.cpp'
754--- src/SimpleLauncherIcon.cpp 2011-03-28 18:10:28 +0000
755+++ src/SimpleLauncherIcon.cpp 2011-03-31 19:28:30 +0000
756@@ -94,6 +94,7 @@
757
758 if (m_Icon)
759 m_Icon->UnReference ();
760+ m_Icon = 0;
761
762 if (!m_IconName)
763 return 0;
764@@ -139,6 +140,6 @@
765 {
766 self->m_Icon->UnReference ();
767 self->m_Icon = 0;
768+ self->needs_redraw.emit (self);
769 }
770- self->needs_redraw.emit (self);
771 }
772
773=== modified file 'src/StaticCairoText.cpp'
774--- src/StaticCairoText.cpp 2011-03-23 17:51:31 +0000
775+++ src/StaticCairoText.cpp 2011-03-31 19:28:30 +0000
776@@ -35,7 +35,8 @@
777 View (NUX_FILE_LINE_PARAM),
778 _fontstring (NULL),
779 _cairoGraphics (NULL),
780- _texture2D (NULL)
781+ _texture2D (NULL),
782+ _lines (-2)
783
784 {
785 _textColor = Color(1.0f, 1.0f, 1.0f, 1.0f);
786@@ -88,6 +89,14 @@
787 QueueDraw ();
788 }
789
790+void
791+StaticCairoText::SetLines (int lines)
792+{
793+ _lines = lines;
794+ UpdateTexture ();
795+ QueueDraw ();
796+}
797+
798 void StaticCairoText::PreLayoutManagement ()
799 {
800 int textWidth = 0;
801@@ -325,7 +334,7 @@
802
803
804 pango_layout_set_markup (layout, _text.GetTCharPtr(), -1);
805- pango_layout_set_height (layout, -2);
806+ pango_layout_set_height (layout, _lines);
807 pango_layout_set_width (layout, maxwidth * PANGO_SCALE);
808
809 pangoCtx = pango_layout_get_context (layout); // is not ref'ed
810@@ -406,7 +415,7 @@
811
812 pango_layout_set_markup (layout, _text.GetTCharPtr(), -1);
813 pango_layout_set_width (layout, textWidth * PANGO_SCALE);
814- pango_layout_set_height (layout, -2);
815+ pango_layout_set_height (layout, _lines);
816 pangoCtx = pango_layout_get_context (layout); // is not ref'ed
817 pango_cairo_context_set_font_options (pangoCtx,
818 gdk_screen_get_font_options (screen));
819
820=== modified file 'src/StaticCairoText.h'
821--- src/StaticCairoText.h 2011-03-20 18:15:16 +0000
822+++ src/StaticCairoText.h 2011-03-31 19:28:30 +0000
823@@ -86,6 +86,7 @@
824 void SetTextAlignment (AlignState state);
825 void SetTextVerticalAlignment (AlignState state);
826 void SetFont (const char *fontstring);
827+ void SetLines (int lines);
828
829 void GetTextExtents (int &width, int &height);
830
831@@ -111,6 +112,8 @@
832 int _pre_layout_width;
833 int _pre_layout_height;
834
835+ int _lines;
836+
837 void GetTextExtents (const TCHAR* font,
838 int& width,
839 int& height);
840
841=== modified file 'tests/CMakeLists.txt'
842--- tests/CMakeLists.txt 2011-03-24 02:07:30 +0000
843+++ tests/CMakeLists.txt 2011-03-31 19:28:30 +0000
844@@ -140,6 +140,8 @@
845 ../src/PlacesStyle.h
846 ../src/PlacesTile.cpp
847 ../src/PlacesTile.h
848+ ../src/PlacesHorizontalTile.cpp
849+ ../src/PlacesHorizontalTile.h
850 ../src/PlacesSimpleTile.cpp
851 ../src/PlacesSimpleTile.h
852 ../src/TextureCache.h