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