Merge lp:~azzar1/unity/fix-1012000 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2411
Proposed branch: lp:~azzar1/unity/fix-1012000
Merge into: lp:unity
Diff against target: 240 lines (+17/-82)
6 files modified
CMakeLists.txt (+1/-1)
launcher/DeviceLauncherIcon.cpp (+1/-62)
launcher/DeviceLauncherIcon.h (+0/-6)
panel/PanelTitlebarGrabAreaView.cpp (+4/-2)
plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp (+7/-7)
tests/test_animator.cpp (+4/-4)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1012000
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Sam Spilsbury (community) Approve
Tim Penhey (community) Needs Information
Review via email: mp+109894@code.launchpad.net

Commit message

Fix compilation problems on quantal.

Description of the change

== Problem ==
Unity fails to build on quantal.

== Fix ==
Fix compilation errors.

#. Remove "Format..." menu item. libgdu is now deprecated and there is no way to show up the system format dialog.

#. 221 - test_animator_.animation_started.connect([&started_]() {
   222 + test_animator_.animation_started.connect([this]() {

All variables in the capture list should have automatic storage duration.

== Test ==
Not applicable.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Generally looks fine, but I'm confused about the capture lists in the tests at the end. What is with that?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Generally looks fine, but I'm confused about the capture lists in the tests at
> the end. What is with that?

You cannot use class members in the capture list. The standard recommends to use this.

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> You cannot use class members in the capture list. The standard recommends to
> use this.
>
> http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf

Where exactly? :o

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> > You cannot use class members in the capture list. The standard recommends to
> > use this.
> >
> > http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf
>
> Where exactly? :o

The identifiers in a capture-list are looked up using the usual rules for unqualified name
lookup (_basic.lookup.unqual_ 3.4.1); ****each such lookup shall find a variable or reference
with automatic storage duration***. An entity (i.e., a variable, a reference, or this) is said
to be explicitly captured if it appears in the lambda-expression's capture-list [...]

Another link: http://stackoverflow.com/questions/7895879/using-member-variable-in-lambda-capture-list-inside-a-member-function?rq=1

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> Another link: http://stackoverflow.com/questions/7895879/using-member-
> variable-in-lambda-capture-list-inside-a-member-function?rq=1

Well, I like the "gcc way" more... However according to that just passing [&] and using this-> inside the callback should work as well, isn't it?

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/802/console reported an error when processing this lp:~andyrock/unity/fix-1012000 branch.
Not merging it.

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/804/console reported an error when processing this lp:~andyrock/unity/fix-1012000 branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-06-08 09:08:47 +0000
3+++ CMakeLists.txt 2012-06-12 17:44:19 +0000
4@@ -127,7 +127,7 @@
5 #
6 # Compiz Plugins
7 #
8-set (UNITY_PLUGIN_DEPS "compiz;nux-2.0>=2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0;gdu;xfixes")
9+set (UNITY_PLUGIN_DEPS "compiz;nux-2.0>=2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0;xfixes")
10 find_package (PkgConfig)
11 pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
12 add_subdirectory(unity-shared)
13
14=== modified file 'launcher/DeviceLauncherIcon.cpp'
15--- launcher/DeviceLauncherIcon.cpp 2012-06-04 15:32:36 +0000
16+++ launcher/DeviceLauncherIcon.cpp 2012-06-12 17:44:19 +0000
17@@ -37,17 +37,14 @@
18 {
19 namespace
20 {
21+
22 nux::logging::Logger logger("unity.launcher");
23
24-GduDevice* get_device_for_device_file (const gchar *device_file);
25-
26 }
27
28 DeviceLauncherIcon::DeviceLauncherIcon(glib::Object<GVolume> const& volume)
29 : SimpleLauncherIcon()
30 , volume_(volume)
31- , device_file_(g_volume_get_identifier(volume_, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE))
32- , gdu_device_(get_device_for_device_file(device_file_))
33 {
34 DevicesSettings::GetDefault().changed.connect(sigc::mem_fun(this, &DeviceLauncherIcon::OnSettingsChanged));
35
36@@ -116,22 +113,6 @@
37
38 result.push_back(menu_item);
39
40- // "Format" item
41- if (gdu_device_ && !gdu_device_is_optical_disc(gdu_device_))
42- {
43- menu_item = dbusmenu_menuitem_new();
44-
45- // TRANSLATORS: This refers to the action of formatting a device
46- dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Format..."));
47- dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
48- dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
49-
50- g_signal_connect(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
51- G_CALLBACK(&DeviceLauncherIcon::OnFormat), this);
52-
53- result.push_back(menu_item);
54- }
55-
56 // "Eject" item
57 if (drive && g_drive_can_eject(drive))
58 {
59@@ -350,32 +331,6 @@
60 self->ActivateLauncherIcon(ActionArg(ActionArg::OTHER, 0));
61 }
62
63-void DeviceLauncherIcon::OnFormat(DbusmenuMenuitem* item,
64- int time,
65- DeviceLauncherIcon* self)
66-{
67- glib::Error error;
68-
69- gchar const* args[] = { "/usr/lib/gnome-disk-utility/gdu-format-tool",
70- "--device-file",
71- self->device_file_.Value(),
72- NULL};
73-
74- g_spawn_async(NULL, // working dir
75- const_cast<gchar **>(args),
76- NULL, // envp
77- (GSpawnFlags) 0, // flags
78- NULL, // child_setup
79- NULL, // user_data
80- NULL, // GPid *child_pid
81- &error);
82-
83- if (error)
84- {
85- LOG_WARNING(logger) << "Error launching " << args[0] << ": " << error;
86- }
87-}
88-
89 void DeviceLauncherIcon::OnEject(DbusmenuMenuitem* item,
90 int time,
91 DeviceLauncherIcon* self)
92@@ -485,21 +440,5 @@
93 return "DeviceLauncherIcon";
94 }
95
96-namespace
97-{
98-
99-GduDevice* get_device_for_device_file(const gchar *device_file)
100-{
101- if (device_file == NULL || strlen(device_file) <= 1)
102- return NULL;
103-
104- glib::Object<GduPool> pool(gdu_pool_new());
105- GduDevice *device = gdu_pool_get_by_device_file(pool, device_file);
106-
107- return device;
108-}
109-
110-} // anonymouse namespace
111-
112 } // namespace launcher
113 } // namespace unity
114
115=== modified file 'launcher/DeviceLauncherIcon.h'
116--- launcher/DeviceLauncherIcon.h 2012-06-04 14:38:51 +0000
117+++ launcher/DeviceLauncherIcon.h 2012-06-12 17:44:19 +0000
118@@ -21,9 +21,6 @@
119 #define _DEVICE_LAUNCHER_ICON_H__H
120
121 #include <gio/gio.h>
122-#define GDU_API_IS_SUBJECT_TO_CHANGE
123-G_BEGIN_DECLS
124-#include <gdu/gdu.h>
125 #include <UnityCore/GLibWrapper.h>
126 #include "SimpleLauncherIcon.h"
127
128@@ -55,7 +52,6 @@
129 void StopDrive();
130 static void OnTogglePin(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
131 static void OnOpen(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
132- static void OnFormat(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
133 static void OnEject(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
134 static void OnUnmount(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
135 static void OnChanged(GVolume* volume, DeviceLauncherIcon* self);
136@@ -68,9 +64,7 @@
137
138 private:
139 glib::Object<GVolume> volume_;
140- glib::String device_file_;
141 std::string name_;
142- glib::Object<GduDevice> gdu_device_;
143 bool keep_in_launcher_;
144 };
145
146
147=== modified file 'panel/PanelTitlebarGrabAreaView.cpp'
148--- panel/PanelTitlebarGrabAreaView.cpp 2012-06-08 19:18:36 +0000
149+++ panel/PanelTitlebarGrabAreaView.cpp 2012-06-12 17:44:19 +0000
150@@ -31,8 +31,10 @@
151 {
152 namespace
153 {
154- unsigned int MOUSE_DOWN_TIMEOUT = 150;
155- unsigned int MOUSE_MOVEMENT_TOLERANCE = 4;
156+
157+const int MOUSE_DOWN_TIMEOUT = 150;
158+const int MOUSE_MOVEMENT_TOLERANCE = 4;
159+
160 }
161
162 PanelTitlebarGrabArea::PanelTitlebarGrabArea()
163
164=== modified file 'plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp'
165--- plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp 2011-12-22 06:26:46 +0000
166+++ plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp 2012-06-12 17:44:19 +0000
167@@ -48,7 +48,7 @@
168 {
169 MaximizedVertMask,
170 MaximizedHorzMask,
171- 0, ~0,
172+ 0, static_cast<unsigned int>(~0),
173 LeftHandle | RightHandle | MiddleHandle
174 },
175 /* Horizontally maximized, don't care
176@@ -57,21 +57,21 @@
177 {
178 MaximizedHorzMask,
179 MaximizedVertMask,
180- 0, ~0,
181+ 0, static_cast<unsigned int>(~0),
182 TopHandle | BottomHandle | MiddleHandle
183 },
184 /* Maximized, don't care about the movement
185 * handle */
186 {
187 MaximizedVertMask | MaximizedHorzMask,
188- 0, 0, ~0,
189+ 0, 0, static_cast<unsigned int>(~0),
190 MiddleHandle
191 },
192 /* Immovable, don't show move handle */
193 {
194 0,
195- ~0,
196- ~0, MoveMask,
197+ static_cast<unsigned int>(~0),
198+ static_cast<unsigned int>(~0), MoveMask,
199 TopLeftHandle | TopHandle | TopRightHandle |
200 LeftHandle | RightHandle |
201 BottomLeftHandle | BottomHandle | BottomRightHandle
202@@ -79,8 +79,8 @@
203 /* Not resizable, don't show resize handle */
204 {
205 0,
206- ~0,
207- ~0, ResizeMask,
208+ static_cast<unsigned int>(~0),
209+ static_cast<unsigned int>(~0), ResizeMask,
210 MiddleHandle
211 },
212 };
213
214=== modified file 'tests/test_animator.cpp'
215--- tests/test_animator.cpp 2011-12-07 03:18:18 +0000
216+++ tests/test_animator.cpp 2012-06-12 17:44:19 +0000
217@@ -41,19 +41,19 @@
218 stopped_(false),
219 ended_(false)
220 {
221- test_animator_.animation_started.connect([&started_]() {
222+ test_animator_.animation_started.connect([this]() {
223 started_ = true;
224 });
225
226- test_animator_.animation_ended.connect([&ended_]() {
227+ test_animator_.animation_ended.connect([this]() {
228 ended_ = true;
229 });
230
231- test_animator_.animation_stopped.connect([&stopped_](double progress) {
232+ test_animator_.animation_stopped.connect([this](double progress) {
233 stopped_ = true;
234 });
235
236- test_animator_.animation_updated.connect([&](double progress) {
237+ test_animator_.animation_updated.connect([this](double progress) {
238 n_steps_++;
239 current_progress_ = progress;
240 got_update_ = true;