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
=== modified file 'src/DeviceLauncherIcon.cpp'
--- src/DeviceLauncherIcon.cpp 2011-02-22 13:46:36 +0000
+++ src/DeviceLauncherIcon.cpp 2011-02-24 15:01:07 +0000
@@ -60,42 +60,15 @@
60 60
61 {61 {
62 GIcon *icon;62 GIcon *icon;
63 gchar *icon_string;
6364
64 icon = g_volume_get_icon (_volume);65 icon = g_volume_get_icon (_volume);
65 if (G_IS_THEMED_ICON (icon))66 icon_string = g_icon_to_string (icon);
66 {67
67 const gchar * const *names;68 SetIconName (icon_string);
68
69 names = g_themed_icon_get_names (G_THEMED_ICON (icon));
70
71 if (names)
72 SetIconName (names[0]);
73 else
74 SetIconName (DEFAULT_ICON);
75 }
76 else if (G_IS_FILE_ICON (icon))
77 {
78 GFile *file;
79
80 file = g_file_icon_get_file (G_FILE_ICON (icon));
81 if (file)
82 {
83 gchar *path;
84
85 path = g_file_get_path (file);
86 SetIconName (path);
87
88 g_free (path);
89 }
90 else
91 SetIconName (DEFAULT_ICON);
92 }
93 else
94 {
95 SetIconName (DEFAULT_ICON);
96 }
9769
98 g_object_unref (icon);70 g_object_unref (icon);
71 g_free (icon_string);
99 }72 }
100 73
101 SetQuirk (QUIRK_VISIBLE, true);74 SetQuirk (QUIRK_VISIBLE, true);
10275
=== modified file 'src/IconTexture.cpp'
--- src/IconTexture.cpp 2011-02-22 23:37:17 +0000
+++ src/IconTexture.cpp 2011-02-24 15:01:07 +0000
@@ -41,7 +41,8 @@
41{41{
42 _icon_name = g_strdup (icon_name ? icon_name : DEFAULT_ICON);42 _icon_name = g_strdup (icon_name ? icon_name : DEFAULT_ICON);
4343
44 LoadIcon ();44 if (!g_strcmp0 (_icon_name, "") == 0)
45 LoadIcon ();
45}46}
4647
47IconTexture::~IconTexture ()48IconTexture::~IconTexture ()
4849
=== modified file 'src/LauncherIcon.cpp'
--- src/LauncherIcon.cpp 2011-02-24 09:29:49 +0000
+++ src/LauncherIcon.cpp 2011-02-24 15:01:07 +0000
@@ -229,16 +229,27 @@
229 GtkIconInfo *info;229 GtkIconInfo *info;
230 nux::BaseTexture *result;230 nux::BaseTexture *result;
231 GError *error = NULL;231 GError *error = NULL;
232 232 GIcon *icon;
233 theme = gtk_icon_theme_get_default ();233
234
235 if (!icon_name)234 if (!icon_name)
236 icon_name = g_strdup (DEFAULT_ICON);235 icon_name = g_strdup (DEFAULT_ICON);
237 236
238 info = gtk_icon_theme_lookup_icon (theme,237 theme = gtk_icon_theme_get_default ();
239 icon_name,238 icon = g_icon_new_for_string (icon_name, NULL);
240 size,239
241 (GtkIconLookupFlags) 0); 240 if (G_IS_ICON (icon))
241 {
242 info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, (GtkIconLookupFlags)0);
243 g_object_unref (icon);
244 }
245 else
246 {
247 info = gtk_icon_theme_lookup_icon (theme,
248 icon_name,
249 size,
250 (GtkIconLookupFlags) 0);
251 }
252
242 if (!info)253 if (!info)
243 {254 {
244 info = gtk_icon_theme_lookup_icon (theme,255 info = gtk_icon_theme_lookup_icon (theme,
@@ -249,13 +260,16 @@
249 260
250 if (gtk_icon_info_get_filename (info) == NULL)261 if (gtk_icon_info_get_filename (info) == NULL)
251 {262 {
263 gtk_icon_info_free (info);
264
252 info = gtk_icon_theme_lookup_icon (theme,265 info = gtk_icon_theme_lookup_icon (theme,
253 DEFAULT_ICON,266 DEFAULT_ICON,
254 size,267 size,
255 (GtkIconLookupFlags) 0);268 (GtkIconLookupFlags) 0);
256 }269 }
257 270
258 pbuf = gtk_icon_info_load_icon (info, &error);271 pbuf = gtk_icon_info_load_icon (info, &error);
272 gtk_icon_info_free (info);
259273
260 if (GDK_IS_PIXBUF (pbuf))274 if (GDK_IS_PIXBUF (pbuf))
261 {275 {
262276
=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
--- src/PanelIndicatorObjectEntryView.cpp 2011-02-15 16:45:30 +0000
+++ src/PanelIndicatorObjectEntryView.cpp 2011-02-24 15:01:07 +0000
@@ -212,7 +212,7 @@
212212
213 if (_proxy->GetPixbuf () && _proxy->icon_visible)213 if (_proxy->GetPixbuf () && _proxy->icon_visible)
214 {214 {
215 gdk_cairo_set_source_pixbuf (cr, pixbuf, x, (height - gdk_pixbuf_get_height (pixbuf))/2);215 gdk_cairo_set_source_pixbuf (cr, pixbuf, x, (int)((height - gdk_pixbuf_get_height (pixbuf))/2));
216 cairo_paint_with_alpha (cr, _proxy->icon_sensitive ? 1.0 : 0.5);216 cairo_paint_with_alpha (cr, _proxy->icon_sensitive ? 1.0 : 0.5);
217217
218 x += icon_width + SPACING;218 x += icon_width + SPACING;
@@ -230,7 +230,7 @@
230 textshadowcol.GetGreen (),230 textshadowcol.GetGreen (),
231 textshadowcol.GetBlue (),231 textshadowcol.GetBlue (),
232 1.0f - textshadowcol.GetRed ());232 1.0f - textshadowcol.GetRed ());
233 cairo_move_to (cr, x, ((height - text_height)/2)-1);233 cairo_move_to (cr, x, (int)(((height - text_height)/2)+1));
234 pango_cairo_show_layout (cr, layout);234 pango_cairo_show_layout (cr, layout);
235 cairo_stroke (cr);235 cairo_stroke (cr);
236236
@@ -240,7 +240,7 @@
240 textcol.GetGreen (),240 textcol.GetGreen (),
241 textcol.GetBlue (),241 textcol.GetBlue (),
242 _proxy->label_sensitive ? 1.0f : 0.0f);242 _proxy->label_sensitive ? 1.0f : 0.0f);
243 cairo_move_to (cr, x, (height - text_height)/2);243 cairo_move_to (cr, x, (int)((height - text_height)/2));
244 pango_cairo_show_layout (cr, layout);244 pango_cairo_show_layout (cr, layout);
245 cairo_stroke (cr);245 cairo_stroke (cr);
246 }246 }
@@ -295,7 +295,7 @@
295 PanelStyle *style = PanelStyle::GetDefault ();295 PanelStyle *style = PanelStyle::GetDefault ();
296 nux::Color bgtop = style->GetBackgroundTop ();296 nux::Color bgtop = style->GetBackgroundTop ();
297 nux::Color bgbot = style->GetBackgroundBottom ();297 nux::Color bgbot = style->GetBackgroundBottom ();
298 nux::Color line = style->GetTextShadow ();298 nux::Color line = style->GetLineColor ();
299299
300 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);300 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
301301
302302
=== modified file 'src/PanelStyle.cpp'
--- src/PanelStyle.cpp 2011-02-17 09:56:22 +0000
+++ src/PanelStyle.cpp 2011-02-24 15:01:07 +0000
@@ -81,11 +81,16 @@
81 _text.SetBlue ((float) style->text[0].blue / (float) 0xffff);81 _text.SetBlue ((float) style->text[0].blue / (float) 0xffff);
82 _text.SetAlpha (1.0f);82 _text.SetAlpha (1.0f);
8383
84 _text_shadow.SetRed ((float) style->dark[0].red / (float) 0xffff);84 _text_shadow.SetRed ((float) style->text[3].red / (float) 0xffff);
85 _text_shadow.SetGreen ((float) style->dark[0].green / (float) 0xffff);85 _text_shadow.SetGreen ((float) style->text[3].green / (float) 0xffff);
86 _text_shadow.SetBlue ((float) style->dark[0].blue / (float) 0xffff);86 _text_shadow.SetBlue ((float) style->text[3].blue / (float) 0xffff);
87 _text_shadow.SetAlpha (1.0f);87 _text_shadow.SetAlpha (1.0f);
8888
89 _line.SetRed ((float) style->dark[0].red / (float) 0xffff);
90 _line.SetGreen ((float) style->dark[0].green / (float) 0xffff);
91 _line.SetBlue ((float) style->dark[0].blue / (float) 0xffff);
92 _line.SetAlpha (1.0f);
93
89 _bg_top.SetRed ((float) style->bg[1].red / (float) 0xffff);94 _bg_top.SetRed ((float) style->bg[1].red / (float) 0xffff);
90 _bg_top.SetGreen ((float) style->bg[1].green / (float) 0xffff);95 _bg_top.SetGreen ((float) style->bg[1].green / (float) 0xffff);
91 _bg_top.SetBlue ((float) style->bg[1].blue / (float) 0xffff);96 _bg_top.SetBlue ((float) style->bg[1].blue / (float) 0xffff);
@@ -123,6 +128,12 @@
123 return _text_shadow;128 return _text_shadow;
124}129}
125130
131nux::Color&
132PanelStyle::GetLineColor ()
133{
134 return _line;
135}
136
126void137void
127PanelStyle::OnStyleChanged (GObject* gobject,138PanelStyle::OnStyleChanged (GObject* gobject,
128 GParamSpec* pspec,139 GParamSpec* pspec,
129140
=== modified file 'src/PanelStyle.h'
--- src/PanelStyle.h 2011-02-17 09:56:22 +0000
+++ src/PanelStyle.h 2011-02-24 15:01:07 +0000
@@ -52,6 +52,7 @@
52 nux::Color& GetBackgroundTop ();52 nux::Color& GetBackgroundTop ();
53 nux::Color& GetBackgroundBottom ();53 nux::Color& GetBackgroundBottom ();
54 nux::Color& GetTextShadow ();54 nux::Color& GetTextShadow ();
55 nux::Color& GetLineColor ();
5556
56 GdkPixbuf * GetBackground (int width, int height);57 GdkPixbuf * GetBackground (int width, int height);
5758
@@ -74,6 +75,7 @@
74 nux::Color _bg_top;75 nux::Color _bg_top;
75 nux::Color _bg_bottom;76 nux::Color _bg_bottom;
76 nux::Color _text_shadow;77 nux::Color _text_shadow;
78 nux::Color _line;
77};79};
7880
79#endif // PANEL_STYLE_H81#endif // PANEL_STYLE_H
8082
=== modified file 'src/PlaceEntry.h'
--- src/PlaceEntry.h 2011-02-22 13:14:15 +0000
+++ src/PlaceEntry.h 2011-02-24 15:01:07 +0000
@@ -86,6 +86,8 @@
86 virtual DeeModel * GetResultsModel () = 0;86 virtual DeeModel * GetResultsModel () = 0;
8787
88 virtual DeeModel * GetGlobalResultsModel () = 0;88 virtual DeeModel * GetGlobalResultsModel () = 0;
89 virtual DeeModel * GetGlobalGroupsModel () = 0;
90
89 // Signals91 // Signals
9092
91 sigc::signal<void, bool> active_changed;93 sigc::signal<void, bool> active_changed;
9294
=== modified file 'src/PlaceEntryHome.cpp'
--- src/PlaceEntryHome.cpp 2011-02-22 13:14:15 +0000
+++ src/PlaceEntryHome.cpp 2011-02-24 15:01:07 +0000
@@ -87,7 +87,7 @@
87 iter = dee_model_append (_groups_model, "", text, entry->GetIcon ());87 iter = dee_model_append (_groups_model, "", text, entry->GetIcon ());
88 _model_to_group[entry->GetGlobalResultsModel ()] = dee_model_get_position (_groups_model,88 _model_to_group[entry->GetGlobalResultsModel ()] = dee_model_get_position (_groups_model,
89 iter);89 iter);
9090 _model_to_group_model[entry->GetGlobalResultsModel ()] = entry->GetGlobalGroupsModel ();
91 g_signal_connect (entry->GetGlobalResultsModel (), "row-added",91 g_signal_connect (entry->GetGlobalResultsModel (), "row-added",
92 (GCallback)&PlaceEntryHome::OnResultAdded, this);92 (GCallback)&PlaceEntryHome::OnResultAdded, this);
93 g_signal_connect (entry->GetGlobalResultsModel (), "row-removed",93 g_signal_connect (entry->GetGlobalResultsModel (), "row-removed",
@@ -110,6 +110,10 @@
110void110void
111PlaceEntryHome::OnResultAdded (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self)111PlaceEntryHome::OnResultAdded (DeeModel *model, DeeModelIter *iter, PlaceEntryHome *self)
112{112{
113 // FIXME: This is a hack
114 if (dee_model_get_uint32 (model, iter, RESULT_GROUP_ID) == 5)
115 return;
116
113 dee_model_append (self->_results_model,117 dee_model_append (self->_results_model,
114 dee_model_get_string (model, iter, RESULT_URI),118 dee_model_get_string (model, iter, RESULT_URI),
115 dee_model_get_string (model, iter, RESULT_ICON),119 dee_model_get_string (model, iter, RESULT_ICON),
@@ -126,6 +130,10 @@
126 DeeModelIter *iter, *end;130 DeeModelIter *iter, *end;
127 const char *uri;131 const char *uri;
128132
133 // FIXME: This is a hack
134 if (dee_model_get_uint32 (model, it, RESULT_GROUP_ID) == 5)
135 return;
136
129 uri = dee_model_get_string (model, it, RESULT_URI);137 uri = dee_model_get_string (model, it, RESULT_URI);
130138
131 iter = dee_model_get_first_iter (self->_results_model);139 iter = dee_model_get_first_iter (self->_results_model);
@@ -152,7 +160,7 @@
152const gchar *160const gchar *
153PlaceEntryHome::GetName ()161PlaceEntryHome::GetName ()
154{162{
155 return _("Global Search");163 return "";
156}164}
157165
158const gchar *166const gchar *
159167
=== modified file 'src/PlaceEntryHome.h'
--- src/PlaceEntryHome.h 2011-02-22 13:14:15 +0000
+++ src/PlaceEntryHome.h 2011-02-24 15:01:07 +0000
@@ -65,6 +65,7 @@
65 DeeModel * GetResultsModel ();65 DeeModel * GetResultsModel ();
6666
67 DeeModel * GetGlobalResultsModel () { return NULL; };67 DeeModel * GetGlobalResultsModel () { return NULL; };
68 DeeModel * GetGlobalGroupsModel () { return NULL; };
6869
69private:70private:
70 void LoadExistingEntries ();71 void LoadExistingEntries ();
@@ -85,6 +86,7 @@
85 std::map<char *, gchar *> _hints;86 std::map<char *, gchar *> _hints;
8687
87 std::map<DeeModel *, int> _model_to_group;88 std::map<DeeModel *, int> _model_to_group;
89 std::map<DeeModel *, DeeModel *> _model_to_group_model;
88 std::vector<PlaceEntry *> _entries;90 std::vector<PlaceEntry *> _entries;
89};91};
9092
9193
=== modified file 'src/PlaceEntryRemote.cpp'
--- src/PlaceEntryRemote.cpp 2011-02-22 13:14:15 +0000
+++ src/PlaceEntryRemote.cpp 2011-02-24 15:01:07 +0000
@@ -55,6 +55,7 @@
55 _groups_model (NULL),55 _groups_model (NULL),
56 _results_model (NULL),56 _results_model (NULL),
57 _global_results_model (NULL),57 _global_results_model (NULL),
58 _global_groups_model (NULL),
58 _previous_search (NULL),59 _previous_search (NULL),
59 _previous_section (G_MAXUINT32)60 _previous_section (G_MAXUINT32)
60{61{
@@ -76,6 +77,7 @@
76 g_object_unref (_groups_model);77 g_object_unref (_groups_model);
77 g_object_unref (_results_model);78 g_object_unref (_results_model);
78 g_object_unref (_global_results_model);79 g_object_unref (_global_results_model);
80 g_object_unref (_global_groups_model);
79}81}
8082
81void83void
@@ -331,6 +333,12 @@
331 return _global_results_model;333 return _global_results_model;
332}334}
333335
336DeeModel *
337PlaceEntryRemote::GetGlobalGroupsModel ()
338{
339 return _global_groups_model;
340}
341
334/* Other methods */342/* Other methods */
335bool343bool
336PlaceEntryRemote::IsValid ()344PlaceEntryRemote::IsValid ()
@@ -379,7 +387,7 @@
379 _state_changed = true;387 _state_changed = true;
380 }388 }
381 389
382 if (g_strcmp0 (_icon, icon) != 0)390 if (g_strcmp0 ("", icon) != 0 && g_strcmp0 (_icon, icon) != 0)
383 {391 {
384 g_free (_icon);392 g_free (_icon);
385 _icon = g_strdup (icon);393 _icon = g_strdup (icon);
@@ -449,7 +457,17 @@
449 // FIXME: Spec says if global_renderer == "", then ShowInGlobal () == false, but currently457 // FIXME: Spec says if global_renderer == "", then ShowInGlobal () == false, but currently
450 // both places return ""458 // both places return ""
451459
452 // FIXME: Handle global groups model name460 if (!DEE_IS_SHARED_MODEL (_global_groups_model) ||
461 g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_groups_model)), global_groups_model) != 0)
462 {
463 if (DEE_IS_SHARED_MODEL (_global_groups_model))
464 g_object_unref (_global_groups_model);
465
466 _global_groups_model = dee_shared_model_new (global_groups_model);
467 dee_model_set_schema (_global_groups_model, "s", "s", "s", NULL);
468
469 _global_renderer_changed = true;
470 }
453471
454 if (!DEE_IS_SHARED_MODEL (_global_results_model) ||472 if (!DEE_IS_SHARED_MODEL (_global_results_model) ||
455 g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_results_model)), global_results_model) != 0)473 g_strcmp0 (dee_shared_model_get_swarm_name (DEE_SHARED_MODEL (_global_results_model)), global_results_model) != 0)
456474
=== modified file 'src/PlaceEntryRemote.h'
--- src/PlaceEntryRemote.h 2011-02-22 13:14:15 +0000
+++ src/PlaceEntryRemote.h 2011-02-24 15:01:07 +0000
@@ -67,6 +67,7 @@
67 DeeModel * GetResultsModel ();67 DeeModel * GetResultsModel ();
6868
69 DeeModel * GetGlobalResultsModel ();69 DeeModel * GetGlobalResultsModel ();
70 DeeModel * GetGlobalGroupsModel ();
7071
71 /* Other methods */72 /* Other methods */
72 bool IsValid ();73 bool IsValid ();
@@ -119,6 +120,7 @@
119 DeeModel *_results_model;120 DeeModel *_results_model;
120121
121 DeeModel *_global_results_model;122 DeeModel *_global_results_model;
123 DeeModel *_global_groups_model;
122124
123 gchar *_previous_search;125 gchar *_previous_search;
124 guint32 _previous_section;126 guint32 _previous_section;
125127
=== modified file 'src/PlacesGroup.cpp'
--- src/PlacesGroup.cpp 2011-02-22 23:37:17 +0000
+++ src/PlacesGroup.cpp 2011-02-24 15:01:07 +0000
@@ -51,23 +51,22 @@
51 //~ OnMouseEnter.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseEnter));51 //~ OnMouseEnter.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseEnter));
52 //~ OnMouseLeave.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseLeave));52 //~ OnMouseLeave.connect (sigc::mem_fun (this, &PlacesGroup::RecvMouseLeave));
5353
54 _icon_texture = new IconTexture ("", 24);
55 _icon_texture->SetMinimumSize (24, 24);
56
54 _label = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);57 _label = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
55 _label->SetFont ("Ubuntu normal 11");
56 _label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);58 _label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
57 _label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);59 _label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
58 _label->SetMaximumWidth (320);
59 _label->SetMinimumWidth (1);
6060
61 _title = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);61 _title = new nux::StaticCairoText ("", NUX_TRACKER_LOCATION);
62 _title->SetFont ("Ubuntu normal 11");
63 _title->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);62 _title->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END);
64 _title->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_RIGHT);63 _title->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT);
65 _title->SetMaximumWidth (320);
66 _title->SetMinimumWidth (1);
6764
68 _header_layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);65 _header_layout = new nux::HLayout ("", NUX_TRACKER_LOCATION);
66 _header_layout->SetHorizontalInternalMargin (12);
6967
70 _header_layout->AddView (_title, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL);68 _header_layout->AddView (_icon_texture, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
69 _header_layout->AddView (_title, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
71 _header_layout->AddSpace (1, 1);70 _header_layout->AddSpace (1, 1);
7271
73 // FIXME: We don't want to show this as it does nothing right now72 // FIXME: We don't want to show this as it does nothing right now
@@ -102,12 +101,15 @@
102101
103void PlacesGroup::SetTitle (const char *title)102void PlacesGroup::SetTitle (const char *title)
104{103{
105 _title_string = g_strdup (title);104 const gchar *temp = "<big>%s</big>";
105
106 _title_string = g_strdup_printf (temp, title);
106 UpdateTitle ();107 UpdateTitle ();
107}108}
108109
109void PlacesGroup::SetEmblem (const char *path_to_emblem)110void PlacesGroup::SetEmblem (const char *path_to_emblem)
110{111{
112 _icon_texture->SetByIconName (path_to_emblem, 24);
111}113}
112114
113void PlacesGroup::AddLayout (nux::Layout *layout)115void PlacesGroup::AddLayout (nux::Layout *layout)
114116
=== modified file 'src/PlacesGroup.h'
--- src/PlacesGroup.h 2011-02-21 23:00:30 +0000
+++ src/PlacesGroup.h 2011-02-24 15:01:07 +0000
@@ -36,6 +36,8 @@
36#include <sigc++/functors/ptr_fun.h>36#include <sigc++/functors/ptr_fun.h>
37#include <sigc++/functors/mem_fun.h>37#include <sigc++/functors/mem_fun.h>
3838
39#include "IconTexture.h"
40
39class PlacesGroup : public nux::View41class PlacesGroup : public nux::View
40{42{
41public:43public:
@@ -63,6 +65,7 @@
63 unsigned int _visible_items;65 unsigned int _visible_items;
6466
65 nux::Layout *_content;67 nux::Layout *_content;
68 IconTexture *_icon_texture;
66 nux::VLayout *_group_layout;69 nux::VLayout *_group_layout;
67 nux::HLayout *_header_layout;70 nux::HLayout *_header_layout;
6871
6972
=== modified file 'src/PlacesResultsController.cpp'
--- src/PlacesResultsController.cpp 2011-02-22 23:37:17 +0000
+++ src/PlacesResultsController.cpp 2011-02-24 15:01:07 +0000
@@ -153,13 +153,14 @@
153}153}
154154
155PlacesGroup *155PlacesGroup *
156PlacesResultsController::CreateGroup (const char *groupname)156PlacesResultsController::CreateGroup (const char *groupname, const char *icon)
157{157{
158 PlacesSettings *settings = PlacesSettings::GetDefault ();158 PlacesSettings *settings = PlacesSettings::GetDefault ();
159159
160 PlacesGroup *newgroup = new PlacesGroup (NUX_TRACKER_LOCATION);160 PlacesGroup *newgroup = new PlacesGroup (NUX_TRACKER_LOCATION);
161 newgroup->SinkReference ();161 newgroup->SinkReference ();
162 newgroup->SetTitle (groupname);162 newgroup->SetTitle (groupname);
163 newgroup->SetEmblem (icon);
163 newgroup->SetRowHeight (92);164 newgroup->SetRowHeight (92);
164 newgroup->SetItemDetail (1, 100);165 newgroup->SetItemDetail (1, 100);
165 newgroup->SetExpanded (true);166 newgroup->SetExpanded (true);
166167
=== modified file 'src/PlacesResultsController.h'
--- src/PlacesResultsController.h 2011-02-09 20:44:45 +0000
+++ src/PlacesResultsController.h 2011-02-24 15:01:07 +0000
@@ -46,7 +46,8 @@
46 void RemoveResultFromGroup (const char *groupname,46 void RemoveResultFromGroup (const char *groupname,
47 void *_id);47 void *_id);
48 void Clear ();48 void Clear ();
49 PlacesGroup *CreateGroup (const char *groupname);49 PlacesGroup *CreateGroup (const char *groupname,
50 const char *icon="");
50protected:51protected:
51 const gchar* GetName ();52 const gchar* GetName ();
52 void AddProperties (GVariantBuilder *builder);53 void AddProperties (GVariantBuilder *builder);
5354
=== modified file 'src/PlacesResultsView.cpp'
--- src/PlacesResultsView.cpp 2011-02-22 11:32:01 +0000
+++ src/PlacesResultsView.cpp 2011-02-24 15:01:07 +0000
@@ -34,6 +34,8 @@
34 _layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);34 _layout = new nux::VLayout ("", NUX_TRACKER_LOCATION);
3535
36 _layout->SetContentDistribution(nux::MAJOR_POSITION_TOP);36 _layout->SetContentDistribution(nux::MAJOR_POSITION_TOP);
37 _layout->SetHorizontalExternalMargin (14);
38 _layout->SetVerticalInternalMargin (14);
3739
38 setBorder (12);40 setBorder (12);
39 EnableVerticalScrollBar (true);41 EnableVerticalScrollBar (true);
4042
=== modified file 'src/PlacesSearchBar.cpp'
--- src/PlacesSearchBar.cpp 2011-02-22 23:37:17 +0000
+++ src/PlacesSearchBar.cpp 2011-02-24 15:01:07 +0000
@@ -48,15 +48,35 @@
48 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);48 _bg_layer = new nux::ColorLayer (nux::Color (0xff595853), true);
4949
50 _layout = new nux::HLayout (NUX_TRACKER_LOCATION);50 _layout = new nux::HLayout (NUX_TRACKER_LOCATION);
51 _layout->SetHorizontalInternalMargin (12);
52
53 _search_icon = new IconTexture ("find", 32);
54 _layout->AddView (_search_icon, 0);
55
56 _layered_layout = new nux::LayeredLayout ();
57
58 _hint = new nux::StaticCairoText (" ");
59 _hint->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.5f));
60 _layered_layout->AddLayer (_hint);
5161
52 _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION);62 _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION);
53 _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));63 _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged));
54 _layout->AddView (_pango_entry, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);64 _pango_entry->SetMinimumHeight (30);
65 _layered_layout->AddLayer (_pango_entry);
66
67 _layered_layout->SetPaintAll (true);
68 _layered_layout->SetActiveLayerN (1);
69
70 _layout->AddView (_layered_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
5571
56 _layout->SetVerticalExternalMargin (18);72 _layout->SetVerticalExternalMargin (18);
57 _layout->SetHorizontalExternalMargin (18);73 _layout->SetHorizontalExternalMargin (18);
58 74
59 SetCompositionLayout (_layout);75 SetCompositionLayout (_layout);
76
77 g_signal_connect (gtk_settings_get_default (), "notify::gtk-font-name",
78 G_CALLBACK (OnFontChanged), this);
79 OnFontChanged (NULL, NULL, this);
60}80}
6181
62PlacesSearchBar::~PlacesSearchBar ()82PlacesSearchBar::~PlacesSearchBar ()
@@ -123,19 +143,10 @@
123}143}
124144
125void145void
126PlacesSearchBar::PreLayoutManagement ()146PlacesSearchBar::SetActiveEntry (PlaceEntry *entry,
127{147 guint section_id,
128 nux::View::PreLayoutManagement ();148 const char *search_string,
129}149 bool ignore_search)
130
131long
132PlacesSearchBar::PostLayoutManagement (long LayoutResult)
133{
134 return nux::View::PostLayoutManagement (LayoutResult);
135}
136
137void
138PlacesSearchBar::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore)
139{150{
140 std::map<gchar *, gchar *> hints;151 std::map<gchar *, gchar *> hints;
141152
@@ -144,18 +155,25 @@
144 if (_entry)155 if (_entry)
145 {156 {
146 // i18n: This is for a dynamic place name i.e. "Search Files & Folders"157 // i18n: This is for a dynamic place name i.e. "Search Files & Folders"
147 const gchar *search_template = _("Search %s");158 const gchar *search_template = _("<span font_size='x-small' font_style='italic'>Search %s</span>");
148 gchar *res;159 gchar *res;
149160 gchar *tmp;
150 res = g_strdup_printf (search_template, _entry->GetName ());161
151 162 tmp = g_markup_escape_text (entry->GetName (), -1);
152 if (!ignore)163 res = g_strdup_printf (search_template, tmp);
164
165 _hint->SetText (res);
166
167 if (!ignore_search)
153 {168 {
154 _entry->SetActiveSection (section_id);169 _entry->SetActiveSection (section_id);
155 _entry->SetSearch (search_string ? search_string : "", hints);170 _entry->SetSearch (search_string ? search_string : "", hints);
156 }171 }
172
157 _pango_entry->SetText (search_string ? search_string : "");173 _pango_entry->SetText (search_string ? search_string : "");
174
158 g_free (res);175 g_free (res);
176 g_free (tmp);
159 }177 }
160 else178 else
161 {179 {
@@ -166,6 +184,8 @@
166void184void
167PlacesSearchBar::OnSearchChanged (nux::TextEntry *text_entry)185PlacesSearchBar::OnSearchChanged (nux::TextEntry *text_entry)
168{186{
187 bool is_empty;
188
169 if (_live_search_timeout)189 if (_live_search_timeout)
170 g_source_remove (_live_search_timeout);190 g_source_remove (_live_search_timeout);
171 191
@@ -175,6 +195,11 @@
175195
176 search_changed.emit (_pango_entry->GetText ().c_str ());196 search_changed.emit (_pango_entry->GetText ().c_str ());
177197
198
199 is_empty = g_strcmp0 (_pango_entry->GetText ().c_str (), "") == 0;
200 _hint->SetVisible (is_empty);
201
202 _hint->QueueDraw ();
178 _pango_entry->QueueDraw ();203 _pango_entry->QueueDraw ();
179 QueueDraw ();204 QueueDraw ();
180}205}
@@ -199,6 +224,36 @@
199 _live_search_timeout = 0;224 _live_search_timeout = 0;
200}225}
201226
227void
228PlacesSearchBar::OnFontChanged (GObject *object, GParamSpec *pspec, PlacesSearchBar *self)
229{
230#define HOW_LARGE 10
231 GtkSettings *settings;
232 gchar *font_name = NULL;
233 PangoFontDescription *desc;
234 gint size;
235 gchar *font_desc;
236
237 settings = gtk_settings_get_default ();
238 g_object_get (settings, "gtk-font-name", &font_name, NULL);
239
240 desc = pango_font_description_from_string (font_name);
241 self->_pango_entry->SetFontFamily (pango_font_description_get_family (desc));
242
243 size = pango_font_description_get_size (desc);
244 size /= pango_font_description_get_size_is_absolute (desc) ? 1 : PANGO_SCALE;
245 self->_pango_entry->SetFontSize ( size + HOW_LARGE);
246
247 self->_pango_entry->SetFontOptions (gdk_screen_get_font_options (gdk_screen_get_default ()));
248
249 font_desc = g_strdup_printf ("%s %d", pango_font_description_get_family (desc), size + HOW_LARGE);
250 self->_hint->SetFont (font_desc);
251
252 pango_font_description_free (desc);
253 g_free (font_name);
254 g_free (font_desc);
255}
256
202static void257static void
203draw_rounded_rect (cairo_t* cr,258draw_rounded_rect (cairo_t* cr,
204 double aspect,259 double aspect,
@@ -253,6 +308,7 @@
253 radius,308 radius,
254 180.0f * G_PI / 180.0f,309 180.0f * G_PI / 180.0f,
255 270.0f * G_PI / 180.0f);310 270.0f * G_PI / 180.0f);
311 cairo_close_path (cr);
256}312}
257313
258void314void
@@ -278,17 +334,27 @@
278 cairo_translate (cr, 0.5, 0.5);334 cairo_translate (cr, 0.5, 0.5);
279 cairo_set_line_width (cr, 1.0);335 cairo_set_line_width (cr, 1.0);
280336
281 cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 1.0f);
282
283 draw_rounded_rect (cr, 1.0f, x, y, RADIUS, width, height);337 draw_rounded_rect (cr, 1.0f, x, y, RADIUS, width, height);
284338
285 cairo_close_path (cr);339 cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.8f);
286
287 cairo_fill_preserve (cr);340 cairo_fill_preserve (cr);
288341
289 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.8f);342 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.8f);
290 cairo_stroke (cr);343 cairo_stroke (cr);
291344
345 //FIXME: This is until we get proper glow
346 draw_rounded_rect (cr, 1.0f, x-1, y-1, RADIUS, width+2, height+2);
347 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.4f);
348 cairo_stroke (cr);
349
350 draw_rounded_rect (cr, 1.0f, x-2, y-2, RADIUS, width+4, height+4);
351 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.2f);
352 cairo_stroke (cr);
353
354 draw_rounded_rect (cr, 1.0f, x-3, y-3, RADIUS, width+6, height+6);
355 cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.1f);
356 cairo_stroke (cr);
357
292 cairo_destroy (cr);358 cairo_destroy (cr);
293359
294 nux::NBitmapData* bitmap = cairo_graphics.GetBitmap();360 nux::NBitmapData* bitmap = cairo_graphics.GetBitmap();
295361
=== modified file 'src/PlacesSearchBar.h'
--- src/PlacesSearchBar.h 2011-02-20 13:23:09 +0000
+++ src/PlacesSearchBar.h 2011-02-24 15:01:07 +0000
@@ -20,8 +20,10 @@
20#ifndef PLACES_SEARCH_BAR_H20#ifndef PLACES_SEARCH_BAR_H
21#define PLACES_SEARCH_BAR_H21#define PLACES_SEARCH_BAR_H
2222
23#include <Nux/LayeredLayout.h>
24#include <Nux/TextureArea.h>
23#include <Nux/View.h>25#include <Nux/View.h>
24#include <Nux/TextureArea.h>26
25#include <NuxGraphics/GraphicsEngine.h>27#include <NuxGraphics/GraphicsEngine.h>
2628
27#include "Introspectable.h"29#include "Introspectable.h"
@@ -31,6 +33,11 @@
3133
32#include "PlaceEntry.h"34#include "PlaceEntry.h"
3335
36#include <gtk/gtk.h>
37
38#include "IconTexture.h"
39#include "StaticCairoText.h"
40
34class PlacesSearchBar : public Introspectable, public nux::View41class PlacesSearchBar : public Introspectable, public nux::View
35{42{
36 NUX_DECLARE_OBJECT_TYPE (PlacesSearchBar, nux::View);43 NUX_DECLARE_OBJECT_TYPE (PlacesSearchBar, nux::View);
@@ -42,10 +49,10 @@
42 virtual void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);49 virtual void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);
43 virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);50 virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
4451
45 virtual void PreLayoutManagement ();52 void SetActiveEntry (PlaceEntry *entry,
46 virtual long PostLayoutManagement (long LayoutResult);53 guint section_id,
4754 const char *search_string,
48 void SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool ignore=false);55 bool ignore=false);
4956
50 sigc::signal<void, const char *> search_changed;57 sigc::signal<void, const char *> search_changed;
51 58
@@ -61,15 +68,19 @@
61 void EmitLiveSearch ();68 void EmitLiveSearch ();
6269
63 static bool OnLiveSearchTimeout (PlacesSearchBar *self);70 static bool OnLiveSearchTimeout (PlacesSearchBar *self);
71 static void OnFontChanged (GObject *object, GParamSpec *pspec, PlacesSearchBar *self);
6472
65private:73private:
66 nux::AbstractPaintLayer *_bg_layer;74 nux::AbstractPaintLayer *_bg_layer;
67 nux::HLayout *_layout;75 nux::HLayout *_layout;
76 nux::LayeredLayout *_layered_layout;
77 nux::StaticCairoText *_hint;
68 nux::TextEntry *_pango_entry;78 nux::TextEntry *_pango_entry;
69 int _last_width;79 int _last_width;
70 int _last_height;80 int _last_height;
71 PlaceEntry *_entry;81 PlaceEntry *_entry;
72 guint _live_search_timeout;82 guint _live_search_timeout;
83 IconTexture *_search_icon;
73};84};
7485
75#endif86#endif
7687
=== modified file 'src/PlacesView.cpp'
--- src/PlacesView.cpp 2011-02-23 11:55:21 +0000
+++ src/PlacesView.cpp 2011-02-24 15:01:07 +0000
@@ -142,9 +142,6 @@
142void142void
143PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)143PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
144{144{
145 if ((!entry && _entry == _home_entry) && g_strcmp0 (search_string, "") == 0)
146 return;
147
148 if (signal)145 if (signal)
149 entry_changed.emit (entry);146 entry_changed.emit (entry);
150147
@@ -181,7 +178,11 @@
181 {178 {
182 _results_controller->CreateGroup (dee_model_get_string (groups,179 _results_controller->CreateGroup (dee_model_get_string (groups,
183 iter,180 iter,
184 PlaceEntry::GROUP_NAME));181 PlaceEntry::GROUP_NAME),
182 dee_model_get_string (groups,
183 iter,
184 PlaceEntry::GROUP_ICON));
185 g_debug ("%s", dee_model_get_string (groups, iter, PlaceEntry::GROUP_ICON));
185 iter = dee_model_next (groups, iter);186 iter = dee_model_next (groups, iter);
186 }187 }
187188
@@ -231,7 +232,12 @@
231void232void
232PlacesView::OnGroupAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self)233PlacesView::OnGroupAdded (DeeModel *model, DeeModelIter *iter, PlacesView *self)
233{234{
234 g_debug ("GroupAdded: %s", dee_model_get_string (model, iter, 1));235 self->_results_controller->CreateGroup (dee_model_get_string (model,
236 iter,
237 PlaceEntry::GROUP_NAME),
238 dee_model_get_string (model,
239 iter,
240 PlaceEntry::GROUP_ICON));
235}241}
236242
237243
238244
=== modified file 'src/StaticCairoText.cpp'
--- src/StaticCairoText.cpp 2011-02-22 23:37:17 +0000
+++ src/StaticCairoText.cpp 2011-02-24 15:01:07 +0000
@@ -162,13 +162,21 @@
162 gfxContext.GetRenderStates ().GetBlend (alpha, src, dest);162 gfxContext.GetRenderStates ().GetBlend (alpha, src, dest);
163 gfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);163 gfxContext.GetRenderStates ().SetBlend (true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
164164
165 Color col = Color::Black;
166 col.SetAlpha (0.0f);
167 gfxContext.QRP_Color (base.x,
168 base.y,
169 base.width,
170 base.height,
171 col);
172
165 gfxContext.QRP_1Tex (base.x,173 gfxContext.QRP_1Tex (base.x,
166 base.y,174 base.y + ((base.height - _cached_extent_height)/2),
167 base.width,175 base.width,
168 base.height,176 base.height,
169 _texture2D->GetDeviceTexture(),177 _texture2D->GetDeviceTexture(),
170 texxform,178 texxform,
171 _textColor);179 _textColor);
172 180
173 gfxContext.GetRenderStates ().SetBlend (alpha, src, dest);181 gfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
174 182
@@ -223,6 +231,7 @@
223 int width = 0;231 int width = 0;
224 int height = 0;232 int height = 0;
225 GetTextExtents (width, height);233 GetTextExtents (width, height);
234 SetMinimumHeight (height);
226 NeedRedraw ();235 NeedRedraw ();
227 sigFontChanged.emit (this);236 sigFontChanged.emit (this);
228}237}
229238
=== modified file 'src/StaticCairoText.h'
--- src/StaticCairoText.h 2011-02-21 23:00:30 +0000
+++ src/StaticCairoText.h 2011-02-24 15:01:07 +0000
@@ -106,7 +106,7 @@
106106
107 int _pre_layout_width;107 int _pre_layout_width;
108 int _pre_layout_height;108 int _pre_layout_height;
109109
110 void GetTextExtents (const TCHAR* font,110 void GetTextExtents (const TCHAR* font,
111 int& width,111 int& width,
112 int& height);112 int& height);