Merge lp:~unity-team/unity/more-dash-fixes-2011-02-24 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: 888
Proposed branch: lp:~unity-team/unity/more-dash-fixes-2011-02-24
Merge into: lp:unity
Diff against target: 848 lines (+237/-103)
21 files modified
src/DeviceLauncherIcon.cpp (+5/-32)
src/IconTexture.cpp (+2/-1)
src/LauncherIcon.cpp (+22/-8)
src/PanelIndicatorObjectEntryView.cpp (+4/-4)
src/PanelStyle.cpp (+14/-3)
src/PanelStyle.h (+2/-0)
src/PlaceEntry.h (+2/-0)
src/PlaceEntryHome.cpp (+10/-2)
src/PlaceEntryHome.h (+2/-0)
src/PlaceEntryRemote.cpp (+20/-2)
src/PlaceEntryRemote.h (+2/-0)
src/PlacesGroup.cpp (+11/-9)
src/PlacesGroup.h (+3/-0)
src/PlacesResultsController.cpp (+2/-1)
src/PlacesResultsController.h (+2/-1)
src/PlacesResultsView.cpp (+2/-0)
src/PlacesSearchBar.cpp (+89/-23)
src/PlacesSearchBar.h (+16/-5)
src/PlacesView.cpp (+11/-5)
src/StaticCairoText.cpp (+15/-6)
src/StaticCairoText.h (+1/-1)
To merge this branch: bzr merge lp:~unity-team/unity/more-dash-fixes-2011-02-24
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+51133@code.launchpad.net

Description of the change

- You'll need nux trunk
- Bugs linked
- Lots and lots of other stuff, this is branch 2/4 for the A3 release so, yeah, somethings still don't work :)

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Awesome, totally didn't realise that this branch was all about the features :) This is what should work:

- Groups have icons
- Search hint behind text entry
- text entry has big text
- you don't get the "Search for foo" thing anymore when a search fails (this is temporary)
- everything paints properly

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/DeviceLauncherIcon.cpp'
2--- src/DeviceLauncherIcon.cpp 2011-02-22 13:46:36 +0000
3+++ src/DeviceLauncherIcon.cpp 2011-02-24 15:01:07 +0000
4@@ -60,42 +60,15 @@
5
6 {
7 GIcon *icon;
8+ gchar *icon_string;
9
10 icon = g_volume_get_icon (_volume);
11- if (G_IS_THEMED_ICON (icon))
12- {
13- const gchar * const *names;
14-
15- names = g_themed_icon_get_names (G_THEMED_ICON (icon));
16-
17- if (names)
18- SetIconName (names[0]);
19- else
20- SetIconName (DEFAULT_ICON);
21- }
22- else if (G_IS_FILE_ICON (icon))
23- {
24- GFile *file;
25-
26- file = g_file_icon_get_file (G_FILE_ICON (icon));
27- if (file)
28- {
29- gchar *path;
30-
31- path = g_file_get_path (file);
32- SetIconName (path);
33-
34- g_free (path);
35- }
36- else
37- SetIconName (DEFAULT_ICON);
38- }
39- else
40- {
41- SetIconName (DEFAULT_ICON);
42- }
43+ icon_string = g_icon_to_string (icon);
44+
45+ SetIconName (icon_string);
46
47 g_object_unref (icon);
48+ g_free (icon_string);
49 }
50
51 SetQuirk (QUIRK_VISIBLE, true);
52
53=== modified file 'src/IconTexture.cpp'
54--- src/IconTexture.cpp 2011-02-22 23:37:17 +0000
55+++ src/IconTexture.cpp 2011-02-24 15:01:07 +0000
56@@ -41,7 +41,8 @@
57 {
58 _icon_name = g_strdup (icon_name ? icon_name : DEFAULT_ICON);
59
60- LoadIcon ();
61+ if (!g_strcmp0 (_icon_name, "") == 0)
62+ LoadIcon ();
63 }
64
65 IconTexture::~IconTexture ()
66
67=== modified file 'src/LauncherIcon.cpp'
68--- src/LauncherIcon.cpp 2011-02-24 09:29:49 +0000
69+++ src/LauncherIcon.cpp 2011-02-24 15:01:07 +0000
70@@ -229,16 +229,27 @@
71 GtkIconInfo *info;
72 nux::BaseTexture *result;
73 GError *error = NULL;
74-
75- theme = gtk_icon_theme_get_default ();
76-
77+ GIcon *icon;
78+
79 if (!icon_name)
80 icon_name = g_strdup (DEFAULT_ICON);
81
82- info = gtk_icon_theme_lookup_icon (theme,
83- icon_name,
84- size,
85- (GtkIconLookupFlags) 0);
86+ theme = gtk_icon_theme_get_default ();
87+ icon = g_icon_new_for_string (icon_name, NULL);
88+
89+ if (G_IS_ICON (icon))
90+ {
91+ info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, (GtkIconLookupFlags)0);
92+ g_object_unref (icon);
93+ }
94+ else
95+ {
96+ info = gtk_icon_theme_lookup_icon (theme,
97+ icon_name,
98+ size,
99+ (GtkIconLookupFlags) 0);
100+ }
101+
102 if (!info)
103 {
104 info = gtk_icon_theme_lookup_icon (theme,
105@@ -249,13 +260,16 @@
106
107 if (gtk_icon_info_get_filename (info) == NULL)
108 {
109+ gtk_icon_info_free (info);
110+
111 info = gtk_icon_theme_lookup_icon (theme,
112 DEFAULT_ICON,
113 size,
114 (GtkIconLookupFlags) 0);
115 }
116-
117+
118 pbuf = gtk_icon_info_load_icon (info, &error);
119+ gtk_icon_info_free (info);
120
121 if (GDK_IS_PIXBUF (pbuf))
122 {
123
124=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
125--- src/PanelIndicatorObjectEntryView.cpp 2011-02-15 16:45:30 +0000
126+++ src/PanelIndicatorObjectEntryView.cpp 2011-02-24 15:01:07 +0000
127@@ -212,7 +212,7 @@
128
129 if (_proxy->GetPixbuf () && _proxy->icon_visible)
130 {
131- gdk_cairo_set_source_pixbuf (cr, pixbuf, x, (height - gdk_pixbuf_get_height (pixbuf))/2);
132+ gdk_cairo_set_source_pixbuf (cr, pixbuf, x, (int)((height - gdk_pixbuf_get_height (pixbuf))/2));
133 cairo_paint_with_alpha (cr, _proxy->icon_sensitive ? 1.0 : 0.5);
134
135 x += icon_width + SPACING;
136@@ -230,7 +230,7 @@
137 textshadowcol.GetGreen (),
138 textshadowcol.GetBlue (),
139 1.0f - textshadowcol.GetRed ());
140- cairo_move_to (cr, x, ((height - text_height)/2)-1);
141+ cairo_move_to (cr, x, (int)(((height - text_height)/2)+1));
142 pango_cairo_show_layout (cr, layout);
143 cairo_stroke (cr);
144
145@@ -240,7 +240,7 @@
146 textcol.GetGreen (),
147 textcol.GetBlue (),
148 _proxy->label_sensitive ? 1.0f : 0.0f);
149- cairo_move_to (cr, x, (height - text_height)/2);
150+ cairo_move_to (cr, x, (int)((height - text_height)/2));
151 pango_cairo_show_layout (cr, layout);
152 cairo_stroke (cr);
153 }
154@@ -295,7 +295,7 @@
155 PanelStyle *style = PanelStyle::GetDefault ();
156 nux::Color bgtop = style->GetBackgroundTop ();
157 nux::Color bgbot = style->GetBackgroundBottom ();
158- nux::Color line = style->GetTextShadow ();
159+ nux::Color line = style->GetLineColor ();
160
161 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
162
163
164=== modified file 'src/PanelStyle.cpp'
165--- src/PanelStyle.cpp 2011-02-17 09:56:22 +0000
166+++ src/PanelStyle.cpp 2011-02-24 15:01:07 +0000
167@@ -81,11 +81,16 @@
168 _text.SetBlue ((float) style->text[0].blue / (float) 0xffff);
169 _text.SetAlpha (1.0f);
170
171- _text_shadow.SetRed ((float) style->dark[0].red / (float) 0xffff);
172- _text_shadow.SetGreen ((float) style->dark[0].green / (float) 0xffff);
173- _text_shadow.SetBlue ((float) style->dark[0].blue / (float) 0xffff);
174+ _text_shadow.SetRed ((float) style->text[3].red / (float) 0xffff);
175+ _text_shadow.SetGreen ((float) style->text[3].green / (float) 0xffff);
176+ _text_shadow.SetBlue ((float) style->text[3].blue / (float) 0xffff);
177 _text_shadow.SetAlpha (1.0f);
178
179+ _line.SetRed ((float) style->dark[0].red / (float) 0xffff);
180+ _line.SetGreen ((float) style->dark[0].green / (float) 0xffff);
181+ _line.SetBlue ((float) style->dark[0].blue / (float) 0xffff);
182+ _line.SetAlpha (1.0f);
183+
184 _bg_top.SetRed ((float) style->bg[1].red / (float) 0xffff);
185 _bg_top.SetGreen ((float) style->bg[1].green / (float) 0xffff);
186 _bg_top.SetBlue ((float) style->bg[1].blue / (float) 0xffff);
187@@ -123,6 +128,12 @@
188 return _text_shadow;
189 }
190
191+nux::Color&
192+PanelStyle::GetLineColor ()
193+{
194+ return _line;
195+}
196+
197 void
198 PanelStyle::OnStyleChanged (GObject* gobject,
199 GParamSpec* pspec,
200
201=== modified file 'src/PanelStyle.h'
202--- src/PanelStyle.h 2011-02-17 09:56:22 +0000
203+++ src/PanelStyle.h 2011-02-24 15:01:07 +0000
204@@ -52,6 +52,7 @@
205 nux::Color& GetBackgroundTop ();
206 nux::Color& GetBackgroundBottom ();
207 nux::Color& GetTextShadow ();
208+ nux::Color& GetLineColor ();
209
210 GdkPixbuf * GetBackground (int width, int height);
211
212@@ -74,6 +75,7 @@
213 nux::Color _bg_top;
214 nux::Color _bg_bottom;
215 nux::Color _text_shadow;
216+ nux::Color _line;
217 };
218
219 #endif // PANEL_STYLE_H
220
221=== modified file 'src/PlaceEntry.h'
222--- src/PlaceEntry.h 2011-02-22 13:14:15 +0000
223+++ src/PlaceEntry.h 2011-02-24 15:01:07 +0000
224@@ -86,6 +86,8 @@
225 virtual DeeModel * GetResultsModel () = 0;
226
227 virtual DeeModel * GetGlobalResultsModel () = 0;
228+ virtual DeeModel * GetGlobalGroupsModel () = 0;
229+
230 // Signals
231
232 sigc::signal<void, bool> active_changed;
233
234=== modified file 'src/PlaceEntryHome.cpp'
235--- src/PlaceEntryHome.cpp 2011-02-22 13:14:15 +0000
236+++ src/PlaceEntryHome.cpp 2011-02-24 15:01:07 +0000
237@@ -87,7 +87,7 @@
238 iter = dee_model_append (_groups_model, "", text, entry->GetIcon ());
239 _model_to_group[entry->GetGlobalResultsModel ()] = dee_model_get_position (_groups_model,
240 iter);
241-
242+ _model_to_group_model[entry->GetGlobalResultsModel ()] = entry->GetGlobalGroupsModel ();
243 g_signal_connect (entry->GetGlobalResultsModel (), "row-added",
244 (GCallback)&PlaceEntryHome::OnResultAdded, this);
245 g_signal_connect (entry->GetGlobalResultsModel (), "row-removed",
246@@ -110,6 +110,10 @@
247 void
248 PlaceEntryHome::OnResultAdded (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self)
249 {
250+ // FIXME: This is a hack
251+ if (dee_model_get_uint32 (model, iter, RESULT_GROUP_ID) == 5)
252+ return;
253+
254 dee_model_append (self->_results_model,
255 dee_model_get_string (model, iter, RESULT_URI),
256 dee_model_get_string (model, iter, RESULT_ICON),
257@@ -126,6 +130,10 @@
258 DeeModelIter *iter, *end;
259 const char *uri;
260
261+ // FIXME: This is a hack
262+ if (dee_model_get_uint32 (model, it, RESULT_GROUP_ID) == 5)
263+ return;
264+
265 uri = dee_model_get_string (model, it, RESULT_URI);
266
267 iter = dee_model_get_first_iter (self->_results_model);
268@@ -152,7 +160,7 @@
269 const gchar *
270 PlaceEntryHome::GetName ()
271 {
272- return _("Global Search");
273+ return "";
274 }
275
276 const gchar *
277
278=== modified file 'src/PlaceEntryHome.h'
279--- src/PlaceEntryHome.h 2011-02-22 13:14:15 +0000
280+++ src/PlaceEntryHome.h 2011-02-24 15:01:07 +0000
281@@ -65,6 +65,7 @@
282 DeeModel * GetResultsModel ();
283
284 DeeModel * GetGlobalResultsModel () { return NULL; };
285+ DeeModel * GetGlobalGroupsModel () { return NULL; };
286
287 private:
288 void LoadExistingEntries ();
289@@ -85,6 +86,7 @@
290 std::map<char *, gchar *> _hints;
291
292 std::map<DeeModel *, int> _model_to_group;
293+ std::map<DeeModel *, DeeModel *> _model_to_group_model;
294 std::vector<PlaceEntry *> _entries;
295 };
296
297
298=== modified file 'src/PlaceEntryRemote.cpp'
299--- src/PlaceEntryRemote.cpp 2011-02-22 13:14:15 +0000
300+++ src/PlaceEntryRemote.cpp 2011-02-24 15:01:07 +0000
301@@ -55,6 +55,7 @@
302 _groups_model (NULL),
303 _results_model (NULL),
304 _global_results_model (NULL),
305+ _global_groups_model (NULL),
306 _previous_search (NULL),
307 _previous_section (G_MAXUINT32)
308 {
309@@ -76,6 +77,7 @@
310 g_object_unref (_groups_model);
311 g_object_unref (_results_model);
312 g_object_unref (_global_results_model);
313+ g_object_unref (_global_groups_model);
314 }
315
316 void
317@@ -331,6 +333,12 @@
318 return _global_results_model;
319 }
320
321+DeeModel *
322+PlaceEntryRemote::GetGlobalGroupsModel ()
323+{
324+ return _global_groups_model;
325+}
326+
327 /* Other methods */
328 bool
329 PlaceEntryRemote::IsValid ()
330@@ -379,7 +387,7 @@
331 _state_changed = true;
332 }
333
334- if (g_strcmp0 (_icon, icon) != 0)
335+ if (g_strcmp0 ("", icon) != 0 && g_strcmp0 (_icon, icon) != 0)
336 {
337 g_free (_icon);
338 _icon = g_strdup (icon);
339@@ -449,7 +457,17 @@
340 // FIXME: Spec says if global_renderer == "", then ShowInGlobal () == false, but currently
341 // both places return ""
342
343- // FIXME: Handle global groups model name
344+ if (!DEE_IS_SHARED_MODEL (_global_groups_model) ||
345+ g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_groups_model)), global_groups_model) != 0)
346+ {
347+ if (DEE_IS_SHARED_MODEL (_global_groups_model))
348+ g_object_unref (_global_groups_model);
349+
350+ _global_groups_model = dee_shared_model_new (global_groups_model);
351+ dee_model_set_schema (_global_groups_model, "s", "s", "s", NULL);
352+
353+ _global_renderer_changed = true;
354+ }
355
356 if (!DEE_IS_SHARED_MODEL (_global_results_model) ||
357 g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_results_model)), global_results_model) != 0)
358
359=== modified file 'src/PlaceEntryRemote.h'
360--- src/PlaceEntryRemote.h 2011-02-22 13:14:15 +0000
361+++ src/PlaceEntryRemote.h 2011-02-24 15:01:07 +0000
362@@ -67,6 +67,7 @@
363 DeeModel * GetResultsModel ();
364
365 DeeModel * GetGlobalResultsModel ();
366+ DeeModel * GetGlobalGroupsModel ();
367
368 /* Other methods */
369 bool IsValid ();
370@@ -119,6 +120,7 @@
371 DeeModel *_results_model;
372
373 DeeModel *_global_results_model;
374+ DeeModel *_global_groups_model;
375
376 gchar *_previous_search;
377 guint32 _previous_section;
378
379=== modified file 'src/PlacesGroup.cpp'
380--- src/PlacesGroup.cpp 2011-02-22 23:37:17 +0000
381+++ src/PlacesGroup.cpp 2011-02-24 15:01:07 +0000
382@@ -51,23 +51,22 @@
383 //~ OnMouseEnter.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseEnter));
384 //~ OnMouseLeave.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseLeave));
385
386+ _icon_texture = new IconTexture ("", 24);
387+ _icon_texture->SetMinimumSize (24, 24);
388+
389 _label = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
390- _label->SetFont ("Ubuntu normal 11");
391 _label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
392 _label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
393- _label->SetMaximumWidth (320);
394- _label->SetMinimumWidth (1);
395
396 _title = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
397- _title->SetFont ("Ubuntu normal 11");
398 _title->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
399- _title->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_RIGHT);
400- _title->SetMaximumWidth (320);
401- _title->SetMinimumWidth (1);
402+ _title->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
403
404 _header_layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
405+ _header_layout->SetHorizontalInternalMargin (12);
406
407- _header_layout->AddView (_title, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);
408+ _header_layout->AddView (_icon_texture, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
409+ _header_layout->AddView (_title, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
410 _header_layout->AddSpace (1, 1);
411
412 // FIXME: We don't want to show this as it does nothing right now
413@@ -102,12 +101,15 @@
414
415 void PlacesGroup::SetTitle (const char *title)
416 {
417- _title_string = g_strdup (title);
418+ const gchar *temp = "<big>%s</big>";
419+
420+ _title_string = g_strdup_printf (temp, title);
421 UpdateTitle ();
422 }
423
424 void PlacesGroup::SetEmblem (const char *path_to_emblem)
425 {
426+ _icon_texture->SetByIconName (path_to_emblem, 24);
427 }
428
429 void PlacesGroup::AddLayout (nux::Layout *layout)
430
431=== modified file 'src/PlacesGroup.h'
432--- src/PlacesGroup.h 2011-02-21 23:00:30 +0000
433+++ src/PlacesGroup.h 2011-02-24 15:01:07 +0000
434@@ -36,6 +36,8 @@
435 #include <sigc++/functors/ptr_fun.h>
436 #include <sigc++/functors/mem_fun.h>
437
438+#include "IconTexture.h"
439+
440 class PlacesGroup : public nux::View
441 {
442 public:
443@@ -63,6 +65,7 @@
444 unsigned int _visible_items;
445
446 nux::Layout *_content;
447+ IconTexture *_icon_texture;
448 nux::VLayout *_group_layout;
449 nux::HLayout *_header_layout;
450
451
452=== modified file 'src/PlacesResultsController.cpp'
453--- src/PlacesResultsController.cpp 2011-02-22 23:37:17 +0000
454+++ src/PlacesResultsController.cpp 2011-02-24 15:01:07 +0000
455@@ -153,13 +153,14 @@
456 }
457
458 PlacesGroup *
459-PlacesResultsController::CreateGroup (const char *groupname)
460+PlacesResultsController::CreateGroup (const char *groupname, const char *icon)
461 {
462 PlacesSettings *settings = PlacesSettings::GetDefault ();
463
464 PlacesGroup *newgroup = new PlacesGroup (NUX_TRACKER_LOCATION);
465 newgroup->SinkReference ();
466 newgroup->SetTitle (groupname);
467+ newgroup->SetEmblem (icon);
468 newgroup->SetRowHeight (92);
469 newgroup->SetItemDetail (1, 100);
470 newgroup->SetExpanded (true);
471
472=== modified file 'src/PlacesResultsController.h'
473--- src/PlacesResultsController.h 2011-02-09 20:44:45 +0000
474+++ src/PlacesResultsController.h 2011-02-24 15:01:07 +0000
475@@ -46,7 +46,8 @@
476 void RemoveResultFromGroup (const char *groupname,
477 void *_id);
478 void Clear ();
479- PlacesGroup *CreateGroup (const char *groupname);
480+ PlacesGroup *CreateGroup (const char *groupname,
481+ const char *icon="");
482 protected:
483 const gchar* GetName ();
484 void AddProperties (GVariantBuilder *builder);
485
486=== modified file 'src/PlacesResultsView.cpp'
487--- src/PlacesResultsView.cpp 2011-02-22 11:32:01 +0000
488+++ src/PlacesResultsView.cpp 2011-02-24 15:01:07 +0000
489@@ -34,6 +34,8 @@
490 _layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
491
492 _layout->SetContentDistribution(nux::MAJOR_POSITION_TOP);
493+ _layout->SetHorizontalExternalMargin (14);
494+ _layout->SetVerticalInternalMargin (14);
495
496 setBorder (12);
497 EnableVerticalScrollBar (true);
498
499=== modified file 'src/PlacesSearchBar.cpp'
500--- src/PlacesSearchBar.cpp 2011-02-22 23:37:17 +0000
501+++ src/PlacesSearchBar.cpp 2011-02-24 15:01:07 +0000
502@@ -48,15 +48,35 @@
503 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);
504
505 _layout = new nux::HLayout (NUX_TRACKER_LOCATION);
506+ _layout->SetHorizontalInternalMargin (12);
507+
508+ _search_icon = new IconTexture ("find", 32);
509+ _layout->AddView (_search_icon, 0);
510+
511+ _layered_layout = new nux::LayeredLayout ();
512+
513+ _hint = new nux::StaticCairoText (" ");
514+ _hint->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.5f));
515+ _layered_layout->AddLayer (_hint);
516
517 _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION);
518 _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));
519- _layout->AddView (_pango_entry, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
520+ _pango_entry->SetMinimumHeight (30);
521+ _layered_layout->AddLayer (_pango_entry);
522+
523+ _layered_layout->SetPaintAll (true);
524+ _layered_layout->SetActiveLayerN (1);
525+
526+ _layout->AddView (_layered_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
527
528 _layout->SetVerticalExternalMargin (18);
529 _layout->SetHorizontalExternalMargin (18);
530
531 SetCompositionLayout (_layout);
532+
533+ g_signal_connect (gtk_settings_get_default (), "notify::gtk-font-name",
534+ G_CALLBACK (OnFontChanged), this);
535+ OnFontChanged (NULL, NULL, this);
536 }
537
538 PlacesSearchBar::~PlacesSearchBar ()
539@@ -123,19 +143,10 @@
540 }
541
542 void
543-PlacesSearchBar::PreLayoutManagement ()
544-{
545- nux::View::PreLayoutManagement ();
546-}
547-
548-long
549-PlacesSearchBar::PostLayoutManagement (long LayoutResult)
550-{
551- return nux::View::PostLayoutManagement (LayoutResult);
552-}
553-
554-void
555-PlacesSearchBar::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore)
556+PlacesSearchBar::SetActiveEntry (PlaceEntry *entry,
557+ guint section_id,
558+ const char *search_string,
559+ bool ignore_search)
560 {
561 std::map<gchar *, gchar *> hints;
562
563@@ -144,18 +155,25 @@
564 if (_entry)
565 {
566 // i18n: This is for a dynamic place name i.e. "Search Files & Folders"
567- const gchar *search_template = _("Search %s");
568+ const gchar *search_template = _("<span font_size='x-small' font_style='italic'>Search %s</span>");
569 gchar *res;
570-
571- res = g_strdup_printf (search_template, _entry->GetName ());
572-
573- if (!ignore)
574+ gchar *tmp;
575+
576+ tmp = g_markup_escape_text (entry->GetName (), -1);
577+ res = g_strdup_printf (search_template, tmp);
578+
579+ _hint->SetText (res);
580+
581+ if (!ignore_search)
582 {
583 _entry->SetActiveSection (section_id);
584 _entry->SetSearch (search_string ? search_string : "", hints);
585 }
586+
587 _pango_entry->SetText (search_string ? search_string : "");
588+
589 g_free (res);
590+ g_free (tmp);
591 }
592 else
593 {
594@@ -166,6 +184,8 @@
595 void
596 PlacesSearchBar::OnSearchChanged (nux::TextEntry *text_entry)
597 {
598+ bool is_empty;
599+
600 if (_live_search_timeout)
601 g_source_remove (_live_search_timeout);
602
603@@ -175,6 +195,11 @@
604
605 search_changed.emit (_pango_entry->GetText ().c_str ());
606
607+
608+ is_empty = g_strcmp0 (_pango_entry->GetText ().c_str (), "") == 0;
609+ _hint->SetVisible (is_empty);
610+
611+ _hint->QueueDraw ();
612 _pango_entry->QueueDraw ();
613 QueueDraw ();
614 }
615@@ -199,6 +224,36 @@
616 _live_search_timeout = 0;
617 }
618
619+void
620+PlacesSearchBar::OnFontChanged (GObject *object, GParamSpec *pspec, PlacesSearchBar *self)
621+{
622+#define HOW_LARGE 10
623+ GtkSettings *settings;
624+ gchar *font_name = NULL;
625+ PangoFontDescription *desc;
626+ gint size;
627+ gchar *font_desc;
628+
629+ settings = gtk_settings_get_default ();
630+ g_object_get (settings, "gtk-font-name", &font_name, NULL);
631+
632+ desc = pango_font_description_from_string (font_name);
633+ self->_pango_entry->SetFontFamily (pango_font_description_get_family (desc));
634+
635+ size = pango_font_description_get_size (desc);
636+ size /= pango_font_description_get_size_is_absolute (desc) ? 1 : PANGO_SCALE;
637+ self->_pango_entry->SetFontSize ( size + HOW_LARGE);
638+
639+ self->_pango_entry->SetFontOptions (gdk_screen_get_font_options (gdk_screen_get_default ()));
640+
641+ font_desc = g_strdup_printf ("%s %d", pango_font_description_get_family (desc), size + HOW_LARGE);
642+ self->_hint->SetFont (font_desc);
643+
644+ pango_font_description_free (desc);
645+ g_free (font_name);
646+ g_free (font_desc);
647+}
648+
649 static void
650 draw_rounded_rect (cairo_t* cr,
651 double aspect,
652@@ -253,6 +308,7 @@
653 radius,
654 180.0f * G_PI / 180.0f,
655 270.0f * G_PI / 180.0f);
656+ cairo_close_path (cr);
657 }
658
659 void
660@@ -278,17 +334,27 @@
661 cairo_translate (cr, 0.5, 0.5);
662 cairo_set_line_width (cr, 1.0);
663
664- cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 1.0f);
665-
666 draw_rounded_rect (cr, 1.0f, x, y, RADIUS, width, height);
667
668- cairo_close_path (cr);
669-
670+ cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.8f);
671 cairo_fill_preserve (cr);
672
673 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.8f);
674 cairo_stroke (cr);
675
676+ //FIXME: This is until we get proper glow
677+ draw_rounded_rect (cr, 1.0f, x-1, y-1, RADIUS, width+2, height+2);
678+ cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.4f);
679+ cairo_stroke (cr);
680+
681+ draw_rounded_rect (cr, 1.0f, x-2, y-2, RADIUS, width+4, height+4);
682+ cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.2f);
683+ cairo_stroke (cr);
684+
685+ draw_rounded_rect (cr, 1.0f, x-3, y-3, RADIUS, width+6, height+6);
686+ cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.1f);
687+ cairo_stroke (cr);
688+
689 cairo_destroy (cr);
690
691 nux::NBitmapData* bitmap = cairo_graphics.GetBitmap();
692
693=== modified file 'src/PlacesSearchBar.h'
694--- src/PlacesSearchBar.h 2011-02-20 13:23:09 +0000
695+++ src/PlacesSearchBar.h 2011-02-24 15:01:07 +0000
696@@ -20,8 +20,10 @@
697 #ifndef PLACES_SEARCH_BAR_H
698 #define PLACES_SEARCH_BAR_H
699
700+#include <Nux/LayeredLayout.h>
701+#include <Nux/TextureArea.h>
702 #include <Nux/View.h>
703-#include <Nux/TextureArea.h>
704+
705 #include <NuxGraphics/GraphicsEngine.h>
706
707 #include "Introspectable.h"
708@@ -31,6 +33,11 @@
709
710 #include "PlaceEntry.h"
711
712+#include <gtk/gtk.h>
713+
714+#include "IconTexture.h"
715+#include "StaticCairoText.h"
716+
717 class PlacesSearchBar : public Introspectable, public nux::View
718 {
719 NUX_DECLARE_OBJECT_TYPE (PlacesSearchBar, nux::View);
720@@ -42,10 +49,10 @@
721 virtual void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);
722 virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
723
724- virtual void PreLayoutManagement ();
725- virtual long PostLayoutManagement (long LayoutResult);
726-
727- void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore=false);
728+ void SetActiveEntry (PlaceEntry *entry,
729+ guint section_id,
730+ const char *search_string,
731+ bool ignore=false);
732
733 sigc::signal<void, const char *> search_changed;
734
735@@ -61,15 +68,19 @@
736 void EmitLiveSearch ();
737
738 static bool OnLiveSearchTimeout (PlacesSearchBar *self);
739+ static void OnFontChanged (GObject *object, GParamSpec *pspec, PlacesSearchBar *self);
740
741 private:
742 nux::AbstractPaintLayer *_bg_layer;
743 nux::HLayout *_layout;
744+ nux::LayeredLayout *_layered_layout;
745+ nux::StaticCairoText *_hint;
746 nux::TextEntry *_pango_entry;
747 int _last_width;
748 int _last_height;
749 PlaceEntry *_entry;
750 guint _live_search_timeout;
751+ IconTexture *_search_icon;
752 };
753
754 #endif
755
756=== modified file 'src/PlacesView.cpp'
757--- src/PlacesView.cpp 2011-02-23 11:55:21 +0000
758+++ src/PlacesView.cpp 2011-02-24 15:01:07 +0000
759@@ -142,9 +142,6 @@
760 void
761 PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
762 {
763- if ((!entry && _entry == _home_entry) && g_strcmp0 (search_string, "") == 0)
764- return;
765-
766 if (signal)
767 entry_changed.emit (entry);
768
769@@ -181,7 +178,11 @@
770 {
771 _results_controller->CreateGroup (dee_model_get_string (groups,
772 iter,
773- PlaceEntry::GROUP_NAME));
774+ PlaceEntry::GROUP_NAME),
775+ dee_model_get_string (groups,
776+ iter,
777+ PlaceEntry::GROUP_ICON));
778+ g_debug ("%s", dee_model_get_string (groups, iter, PlaceEntry::GROUP_ICON));
779 iter = dee_model_next (groups, iter);
780 }
781
782@@ -231,7 +232,12 @@
783 void
784 PlacesView::OnGroupAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self)
785 {
786- g_debug ("GroupAdded: %s", dee_model_get_string (model, iter, 1));
787+ self->_results_controller->CreateGroup (dee_model_get_string (model,
788+ iter,
789+ PlaceEntry::GROUP_NAME),
790+ dee_model_get_string (model,
791+ iter,
792+ PlaceEntry::GROUP_ICON));
793 }
794
795
796
797=== modified file 'src/StaticCairoText.cpp'
798--- src/StaticCairoText.cpp 2011-02-22 23:37:17 +0000
799+++ src/StaticCairoText.cpp 2011-02-24 15:01:07 +0000
800@@ -162,13 +162,21 @@
801 gfxContext.GetRenderStates ().GetBlend (alpha, src, dest);
802 gfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
803
804+ Color col = Color::Black;
805+ col.SetAlpha (0.0f);
806+ gfxContext.QRP_Color (base.x,
807+ base.y,
808+ base.width,
809+ base.height,
810+ col);
811+
812 gfxContext.QRP_1Tex (base.x,
813- base.y,
814- base.width,
815- base.height,
816- _texture2D->GetDeviceTexture(),
817- texxform,
818- _textColor);
819+ base.y + ((base.height - _cached_extent_height)/2),
820+ base.width,
821+ base.height,
822+ _texture2D->GetDeviceTexture(),
823+ texxform,
824+ _textColor);
825
826 gfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
827
828@@ -223,6 +231,7 @@
829 int width = 0;
830 int height = 0;
831 GetTextExtents (width, height);
832+ SetMinimumHeight (height);
833 NeedRedraw ();
834 sigFontChanged.emit (this);
835 }
836
837=== modified file 'src/StaticCairoText.h'
838--- src/StaticCairoText.h 2011-02-21 23:00:30 +0000
839+++ src/StaticCairoText.h 2011-02-24 15:01:07 +0000
840@@ -106,7 +106,7 @@
841
842 int _pre_layout_width;
843 int _pre_layout_height;
844-
845+
846 void GetTextExtents (const TCHAR* font,
847 int& width,
848 int& height);