Merge lp:~gordallott/unity/unity-31-03-11-places-fixes into lp:unity

Proposed by Gord Allott
Status: Merged
Merged at revision: 1078
Proposed branch: lp:~gordallott/unity/unity-31-03-11-places-fixes
Merge into: lp:unity
Diff against target: 214 lines (+72/-9)
5 files modified
src/BamfLauncherIcon.cpp (+36/-3)
src/BamfLauncherIcon.h (+5/-0)
src/PlacesController.cpp (+5/-3)
src/PlacesView.cpp (+22/-1)
src/PlacesView.h (+4/-2)
To merge this branch: bzr merge lp:~gordallott/unity/unity-31-03-11-places-fixes
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+55765@code.launchpad.net

Description of the change

small fixes, bugs attached

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

Reverts out recent changes to trunk???

review: Needs Fixing
Revision history for this message
Gord Allott (gordallott) wrote :

> Reverts out recent changes to trunk???
Trunk would not build at the time, needed to build trunk - obviously would of handled that when merging back into trunk. shouldn't of been marked as needs fixing and has now missed release.

Revision history for this message
Jason Smith (jassmith) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/BamfLauncherIcon.cpp'
2--- src/BamfLauncherIcon.cpp 2011-04-02 08:36:07 +0000
3+++ src/BamfLauncherIcon.cpp 2011-04-05 09:30:54 +0000
4@@ -104,6 +104,8 @@
5 BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app, CompScreen *screen)
6 : SimpleLauncherIcon(IconManager)
7 {
8+ _cached_desktop_file = NULL;
9+ _cached_name = NULL;
10 m_App = app;
11 m_Screen = screen;
12 _remote_uri = 0;
13@@ -113,7 +115,7 @@
14 _menu_desktop_shortcuts = NULL;
15 char *icon_name = bamf_view_get_icon (BAMF_VIEW (m_App));
16
17- SetTooltipText (bamf_view_get_name (BAMF_VIEW (app)));
18+ SetTooltipText (BamfName ());
19 SetIconName (icon_name);
20 SetIconType (TYPE_APPLICATION);
21
22@@ -172,6 +174,9 @@
23 g_signal_handlers_disconnect_by_func (m_App, (void *) &BamfLauncherIcon::OnClosed, this);
24
25 g_object_unref (m_App);
26+
27+ g_free (_cached_desktop_file);
28+ g_free (_cached_name);
29 }
30
31 void
32@@ -199,7 +204,35 @@
33 const char*
34 BamfLauncherIcon::DesktopFile ()
35 {
36- return bamf_application_get_desktop_file (m_App);
37+ char *filename = NULL;
38+ filename = (char*) bamf_application_get_desktop_file (m_App);
39+
40+ if (filename != NULL)
41+ {
42+ if (_cached_desktop_file != NULL)
43+ g_free (_cached_desktop_file);
44+
45+ _cached_desktop_file = g_strdup (filename);
46+ }
47+
48+ return _cached_desktop_file;
49+}
50+
51+const char*
52+BamfLauncherIcon::BamfName ()
53+{
54+ char *name = NULL;
55+ name = (char *)bamf_view_get_name (BAMF_VIEW (m_App));
56+
57+ if (name != NULL)
58+ {
59+ if (_cached_name != NULL)
60+ g_free (_cached_name);
61+
62+ _cached_name = g_strdup (name);
63+ }
64+
65+ return _cached_name;
66 }
67
68 void
69@@ -825,7 +858,7 @@
70 }
71
72 gchar *app_name;
73- app_name = g_markup_escape_text (bamf_view_get_name (BAMF_VIEW (m_App)), -1);
74+ app_name = g_markup_escape_text (BamfName (), -1);
75
76 item = dbusmenu_menuitem_new ();
77 dbusmenu_menuitem_property_set (item,
78
79=== modified file 'src/BamfLauncherIcon.h'
80--- src/BamfLauncherIcon.h 2011-04-02 07:03:30 +0000
81+++ src/BamfLauncherIcon.h 2011-04-05 09:30:54 +0000
82@@ -66,6 +66,8 @@
83
84 std::list<char *> ValidateUrisForLaunch (std::list<char *> uris);
85
86+ const char* BamfName ();
87+
88 private:
89 BamfApplication *m_App;
90 CompScreen *m_Screen;
91@@ -80,6 +82,9 @@
92 sigc::connection _on_window_minimized_connection;
93 sigc::connection _hidden_changed_connection;
94
95+ gchar *_cached_desktop_file;
96+ gchar *_cached_name;
97+
98 void EnsureWindowState ();
99
100 void UpdateMenus ();
101
102=== modified file 'src/PlacesController.cpp'
103--- src/PlacesController.cpp 2011-03-24 00:35:26 +0000
104+++ src/PlacesController.cpp 2011-04-05 09:30:54 +0000
105@@ -159,8 +159,6 @@
106 _visible = false;
107 _fullscren_request = false;
108
109- _view->SetActiveEntry (NULL, 0, "");
110-
111 StartShowHideTimeline ();
112
113 ubus_server_send_message (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN, NULL);
114@@ -215,8 +213,12 @@
115 // Make sure the state is right
116 self->_window->SetOpacity (self->_visible ? 1.0f : 0.0f);
117 if (!self->_visible)
118+ {
119 self->_window->ShowWindow (false, false);
120-
121+ //reset the active entry
122+ self->_view->SetActiveEntry (NULL, 0, "");
123+ }
124+
125 return FALSE;
126 }
127 return TRUE;
128
129=== modified file 'src/PlacesView.cpp'
130--- src/PlacesView.cpp 2011-03-31 20:38:49 +0000
131+++ src/PlacesView.cpp 2011-04-05 09:30:54 +0000
132@@ -41,6 +41,7 @@
133
134 PlacesView::PlacesView (PlaceFactory *factory)
135 : nux::View (NUX_TRACKER_LOCATION),
136+ _close_idle (0),
137 _factory (factory),
138 _entry (NULL),
139 _size_mode (SIZE_MODE_FULLSCREEN),
140@@ -134,6 +135,11 @@
141
142 PlacesView::~PlacesView ()
143 {
144+ if (_close_idle != 0)
145+ {
146+ g_source_remove (_close_idle);
147+ _close_idle = 0;
148+ }
149 delete _home_entry;
150 }
151
152@@ -170,7 +176,6 @@
153 geo.height = _actual_height;
154 if (!geo.IsPointInside (ievent.e_x, ievent.e_y))
155 {
156- SetActiveEntry (NULL, 0, "");
157 return TraverseInfo |= nux::eMouseEventSolved;
158 }
159 }
160@@ -419,6 +424,7 @@
161 void
162 PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
163 {
164+
165 if (signal)
166 entry_changed.emit (entry);
167
168@@ -808,7 +814,22 @@
169 void
170 PlacesView::CloseRequest (GVariant *data, PlacesView *self)
171 {
172+ if (self->_close_idle != 0)
173+ {
174+ g_source_remove (self->_close_idle);
175+ self->_close_idle = 0;
176+ }
177+
178+ //add a timeout because the home view flashes on close
179+ self->_close_idle = g_timeout_add_seconds (100, (GSourceFunc)OnCloseTimeout, self);
180+}
181+
182+gboolean
183+PlacesView::OnCloseTimeout (PlacesView *self)
184+{
185+ self->_close_idle = 0;
186 self->SetActiveEntry (NULL, 0, "");
187+ return FALSE;
188 }
189
190 nux::TextEntry*
191
192=== modified file 'src/PlacesView.h'
193--- src/PlacesView.h 2011-03-24 01:18:18 +0000
194+++ src/PlacesView.h 2011-04-05 09:30:54 +0000
195@@ -101,8 +101,8 @@
196 void AddProperties (GVariantBuilder *builder);
197
198 private:
199- static void CloseRequest (GVariant *data, PlacesView *self);
200-
201+ static void CloseRequest (GVariant *data, PlacesView *self);
202+ static gboolean OnCloseTimeout (PlacesView *self);
203 void OnGroupAdded (PlaceEntry *entry, PlaceEntryGroup& group);
204 void OnResultAdded (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result);
205 void OnResultRemoved (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result);
206@@ -130,6 +130,8 @@
207 static gboolean OnSearchTimedOut (PlacesView *view);
208
209 private:
210+ guint _close_idle;
211+
212 PlaceFactory *_factory;
213 nux::HLayout *_layout;
214 nux::LayeredLayout *_layered_layout;