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