Merge lp:~azzar1/unity/fix-713432-6.0 into lp:unity/6.0

Proposed by Andrea Azzarone
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 2758
Proposed branch: lp:~azzar1/unity/fix-713432-6.0
Merge into: lp:unity/6.0
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-713432-6.0
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Review via email: mp+127544@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
Łukasz Zemczak (sil2100) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/VolumeImp.cpp'
2--- launcher/VolumeImp.cpp 2012-09-28 13:14:08 +0000
3+++ launcher/VolumeImp.cpp 2012-10-02 17:13:21 +0000
4@@ -150,9 +150,11 @@
5
6 void MountAndOnFinishOpenInFileManager()
7 {
8+ glib::Object<GMountOperation> mount_op(gtk_mount_operation_new(nullptr));
9+
10 g_volume_mount(volume_,
11 (GMountMountFlags) 0,
12- nullptr,
13+ mount_op,
14 nullptr,
15 (GAsyncReadyCallback) &Impl::OnMountFinish,
16 this);
17
18=== modified file 'tests/gmockvolume.c'
19--- tests/gmockvolume.c 2012-09-28 13:14:08 +0000
20+++ tests/gmockvolume.c 2012-10-02 17:13:21 +0000
21@@ -95,6 +95,7 @@
22 mock_volume->label = g_strdup("");
23 mock_volume->uuid = g_strdup_printf("%u", uuid);
24 mock_volume->mount = NULL;
25+ mock_volume->last_mount_had_mount_op = FALSE;
26 }
27
28 GMockVolume *
29@@ -227,7 +228,10 @@
30 GAsyncReadyCallback callback,
31 gpointer user_data)
32 {
33- g_mock_volume_set_mount(G_MOCK_VOLUME(volume), G_MOUNT(g_mock_mount_new()));
34+ GMockVolume *mock_volume = G_MOCK_VOLUME(volume);
35+
36+ mock_volume->last_mount_had_mount_op = (mount_operation != NULL);
37+ g_mock_volume_set_mount(mock_volume, G_MOUNT(g_mock_mount_new()));
38
39 callback(NULL,
40 G_ASYNC_RESULT (g_simple_async_result_new (NULL, NULL, NULL, NULL)),
41@@ -282,6 +286,12 @@
42 return NULL;
43 }
44
45+gboolean
46+g_mock_volume_last_mount_had_mount_operation (GMockVolume* volume)
47+{
48+ return volume->last_mount_had_mount_op;
49+}
50+
51 static void
52 g_mock_volume_iface_init (GVolumeIface *iface)
53 {
54
55=== modified file 'tests/gmockvolume.h'
56--- tests/gmockvolume.h 2012-09-28 13:14:08 +0000
57+++ tests/gmockvolume.h 2012-10-02 17:13:21 +0000
58@@ -45,6 +45,7 @@
59 char *uuid;
60 char *label;
61 GMount *mount;
62+ gboolean last_mount_had_mount_op;
63 };
64
65 struct _GMockVolumeClass {
66@@ -61,6 +62,8 @@
67 void g_mock_volume_set_uuid (GMockVolume *volume, const char *uuid);
68 void g_mock_volume_set_mount (GMockVolume *volume, GMount *mount);
69
70+gboolean g_mock_volume_last_mount_had_mount_operation (GMockVolume *volume);
71+
72 G_END_DECLS
73
74 #endif // UNITYSHELL_G_MOCK_VOLUME_H
75
76=== modified file 'tests/test_volume_imp.cpp'
77--- tests/test_volume_imp.cpp 2012-09-28 13:14:08 +0000
78+++ tests/test_volume_imp.cpp 2012-10-02 17:13:21 +0000
79@@ -132,12 +132,14 @@
80 .Times(1);
81
82 volume_->MountAndOpenInFileManager();
83+ EXPECT_EQ(g_mock_volume_last_mount_had_mount_operation(gvolume_), TRUE);
84 EXPECT_TRUE(volume_->IsMounted());
85
86 EXPECT_CALL(*file_manager_opener_, Open(ROOT_FILE_URI))
87 .Times(1);
88
89 volume_->MountAndOpenInFileManager();
90+ EXPECT_EQ(g_mock_volume_last_mount_had_mount_operation(gvolume_), TRUE);
91 EXPECT_TRUE(volume_->IsMounted());
92 }
93

Subscribers

People subscribed via source and target branches