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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2788
Proposed branch: lp:~azzar1/unity/fix-1059672
Merge into: lp:unity
Diff against target: 92 lines (+19/-2)
4 files modified
launcher/VolumeImp.cpp (+3/-1)
tests/gmockvolume.c (+11/-1)
tests/gmockvolume.h (+3/-0)
tests/test_volume_imp.cpp (+2/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1059672
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+127533@code.launchpad.net

Commit message

Use GMountOperation in g_volume_mount. GMountOperation provides a mechanism for interacting with the use.

Description of the change

== Problem ==
Cannot mount encrypted drives via launcher.

== Fix ==
Use GMountOperation in g_volume_mount.

== Test ==
Unit test added.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/VolumeImp.cpp'
--- launcher/VolumeImp.cpp 2012-09-18 11:05:14 +0000
+++ launcher/VolumeImp.cpp 2012-10-02 16:38:22 +0000
@@ -150,9 +150,11 @@
150150
151 void MountAndOnFinishOpenInFileManager()151 void MountAndOnFinishOpenInFileManager()
152 {152 {
153 glib::Object<GMountOperation> mount_op(gtk_mount_operation_new(nullptr));
154
153 g_volume_mount(volume_,155 g_volume_mount(volume_,
154 (GMountMountFlags) 0,156 (GMountMountFlags) 0,
155 nullptr,157 mount_op,
156 nullptr,158 nullptr,
157 (GAsyncReadyCallback) &Impl::OnMountFinish,159 (GAsyncReadyCallback) &Impl::OnMountFinish,
158 this);160 this);
159161
=== modified file 'tests/gmockvolume.c'
--- tests/gmockvolume.c 2012-09-19 16:50:41 +0000
+++ tests/gmockvolume.c 2012-10-02 16:38:22 +0000
@@ -95,6 +95,7 @@
95 mock_volume->label = g_strdup("");95 mock_volume->label = g_strdup("");
96 mock_volume->uuid = g_strdup_printf("%u", uuid);96 mock_volume->uuid = g_strdup_printf("%u", uuid);
97 mock_volume->mount = NULL;97 mock_volume->mount = NULL;
98 mock_volume->last_mount_had_mount_op = FALSE;
98}99}
99100
100GMockVolume *101GMockVolume *
@@ -227,7 +228,10 @@
227 GAsyncReadyCallback callback,228 GAsyncReadyCallback callback,
228 gpointer user_data)229 gpointer user_data)
229{230{
230 g_mock_volume_set_mount(G_MOCK_VOLUME(volume), G_MOUNT(g_mock_mount_new()));231 GMockVolume *mock_volume = G_MOCK_VOLUME(volume);
232
233 mock_volume->last_mount_had_mount_op = (mount_operation != NULL);
234 g_mock_volume_set_mount(mock_volume, G_MOUNT(g_mock_mount_new()));
231235
232 callback(NULL,236 callback(NULL,
233 G_ASYNC_RESULT (g_simple_async_result_new (NULL, NULL, NULL, NULL)),237 G_ASYNC_RESULT (g_simple_async_result_new (NULL, NULL, NULL, NULL)),
@@ -282,6 +286,12 @@
282 return NULL;286 return NULL;
283}287}
284288
289gboolean
290g_mock_volume_last_mount_had_mount_operation (GMockVolume* volume)
291{
292 return volume->last_mount_had_mount_op;
293}
294
285static void295static void
286g_mock_volume_iface_init (GVolumeIface *iface)296g_mock_volume_iface_init (GVolumeIface *iface)
287{297{
288298
=== modified file 'tests/gmockvolume.h'
--- tests/gmockvolume.h 2012-09-18 10:25:57 +0000
+++ tests/gmockvolume.h 2012-10-02 16:38:22 +0000
@@ -45,6 +45,7 @@
45 char *uuid;45 char *uuid;
46 char *label;46 char *label;
47 GMount *mount;47 GMount *mount;
48 gboolean last_mount_had_mount_op;
48};49};
4950
50struct _GMockVolumeClass {51struct _GMockVolumeClass {
@@ -61,6 +62,8 @@
61void g_mock_volume_set_uuid (GMockVolume *volume, const char *uuid);62void g_mock_volume_set_uuid (GMockVolume *volume, const char *uuid);
62void g_mock_volume_set_mount (GMockVolume *volume, GMount *mount);63void g_mock_volume_set_mount (GMockVolume *volume, GMount *mount);
6364
65gboolean g_mock_volume_last_mount_had_mount_operation (GMockVolume *volume);
66
64G_END_DECLS67G_END_DECLS
6568
66#endif // UNITYSHELL_G_MOCK_VOLUME_H69#endif // UNITYSHELL_G_MOCK_VOLUME_H
6770
=== modified file 'tests/test_volume_imp.cpp'
--- tests/test_volume_imp.cpp 2012-09-18 11:05:14 +0000
+++ tests/test_volume_imp.cpp 2012-10-02 16:38:22 +0000
@@ -132,12 +132,14 @@
132 .Times(1);132 .Times(1);
133133
134 volume_->MountAndOpenInFileManager();134 volume_->MountAndOpenInFileManager();
135 EXPECT_EQ(g_mock_volume_last_mount_had_mount_operation(gvolume_), TRUE);
135 EXPECT_TRUE(volume_->IsMounted());136 EXPECT_TRUE(volume_->IsMounted());
136137
137 EXPECT_CALL(*file_manager_opener_, Open(ROOT_FILE_URI))138 EXPECT_CALL(*file_manager_opener_, Open(ROOT_FILE_URI))
138 .Times(1);139 .Times(1);
139140
140 volume_->MountAndOpenInFileManager();141 volume_->MountAndOpenInFileManager();
142 EXPECT_EQ(g_mock_volume_last_mount_had_mount_operation(gvolume_), TRUE);
141 EXPECT_TRUE(volume_->IsMounted());143 EXPECT_TRUE(volume_->IsMounted());
142}144}
143145