Merge lp:~bilalakhtar/unity/sd-card-stop-device-960910 into lp:unity

Proposed by Bilal Akhtar on 2012-08-08
Status: Merged
Approved by: Bilal Akhtar on 2012-08-23
Approved revision: 2545
Merged at revision: 2615
Proposed branch: lp:~bilalakhtar/unity/sd-card-stop-device-960910
Merge into: lp:unity
Diff against target: 82 lines (+28/-1)
4 files modified
launcher/DeviceLauncherIcon.cpp (+6/-0)
launcher/DeviceLauncherIcon.h (+2/-1)
launcher/LauncherController.cpp (+2/-0)
manual-tests/Launcher.txt (+18/-0)
To merge this branch: bzr merge lp:~bilalakhtar/unity/sd-card-stop-device-960910
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) 2012-08-08 Approve on 2012-08-15
Tim Penhey (community) 2012-08-08 Needs Information on 2012-08-14
Review via email: mp+118771@code.launchpad.net

This proposal supersedes a proposal from 2012-08-03.

Commit message

Dragging and dropping a SD card to the trash should 'safely remove' the card

Description of the change

SD cards can now be stopped if their DeviceLauncherIcon is dragged into Trash. Fixes bug #960910 .

Also, added manual test.

To post a comment you must log in.
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

Test? I think a manual test would be needed here.

review: Needs Fixing
Marco Trevisan (Treviño) (3v1n0) wrote :

You could also test this using the mock we have for devices...

Tim Penhey (thumper) wrote :

Marco, could you explain how a quick unit test could be written?

I have a very strong preference for an automated test.

review: Needs Information
Andrea Azzarone (azzar1) wrote :

+1. I'll add a unit-test with my refactor (WIP).

review: Approve
Unity Merger (unity-merger) wrote :

No commit message specified.

Omer Akram (om26er) wrote :

added commit message and setting back to approved so this gets in.

Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in launcher/DeviceLauncherIcon.cpp
text conflict in launcher/DeviceLauncherIcon.h
text conflict in manual-tests/Launcher.txt

Bilal Akhtar (bilalakhtar) wrote :

Fixed the conflicts, branch now ready to be merged again.

Bilal Akhtar (bilalakhtar) wrote :

Can I mark it Approved again?

Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1109/console reported an error when processing this lp:~bilalakhtar/unity/sd-card-stop-device-960910 branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/DeviceLauncherIcon.cpp'
2--- launcher/DeviceLauncherIcon.cpp 2012-08-15 18:34:56 +0000
3+++ launcher/DeviceLauncherIcon.cpp 2012-08-21 18:01:19 +0000
4@@ -117,6 +117,12 @@
5 return g_volume_can_eject(volume_);
6 }
7
8+bool
9+DeviceLauncherIcon::CanStop()
10+{
11+ return g_drive_can_stop(g_volume_get_drive(volume_));
12+}
13+
14 AbstractLauncherIcon::MenuItemsVector DeviceLauncherIcon::GetMenus()
15 {
16 MenuItemsVector result;
17
18=== modified file 'launcher/DeviceLauncherIcon.h'
19--- launcher/DeviceLauncherIcon.h 2012-08-15 17:22:33 +0000
20+++ launcher/DeviceLauncherIcon.h 2012-08-21 18:01:19 +0000
21@@ -40,7 +40,9 @@
22
23 void OnRemoved();
24 bool CanEject();
25+ bool CanStop();
26 void Eject();
27+ void StopDrive();
28
29 protected:
30 MenuItemsVector GetMenus();
31@@ -52,7 +54,6 @@
32 void ActivateLauncherIcon(ActionArg arg);
33 void ShowMount(GMount* mount);
34 void Unmount();
35- void StopDrive();
36 void OnTogglePin(DbusmenuMenuitem* item, int time);
37 void OnSettingsChanged();
38 void ShowNotification(std::string const&, unsigned, glib::Object<GdkPixbuf> const&, std::string const&);
39
40=== modified file 'launcher/LauncherController.cpp'
41--- launcher/LauncherController.cpp 2012-08-10 10:08:13 +0000
42+++ launcher/LauncherController.cpp 2012-08-21 18:01:19 +0000
43@@ -428,6 +428,8 @@
44
45 if (device_icon && device_icon->CanEject())
46 device_icon->Eject();
47+ else if (device_icon && device_icon->CanStop())
48+ device_icon->StopDrive();
49
50 break;
51 }
52
53=== modified file 'manual-tests/Launcher.txt'
54--- manual-tests/Launcher.txt 2012-08-13 18:58:37 +0000
55+++ manual-tests/Launcher.txt 2012-08-21 18:01:19 +0000
56@@ -696,8 +696,26 @@
57 * See https://bugs.launchpad.net/unity/+bug/980942/+attachment/3059914/+files/launcher-accordion-effect-tooltip-bug.ogv.
58
59
60+Stop SD card by dragging it's icon to trash
61+---------------------------------------------------
62+
63+Setup:
64+ * Have an SD Card reader and an SD Card
65+
66+Actions:
67+ * Insert the SD card into the SD card reader.
68+ * Wait for the SD card to mount.
69+ * Drag and drop the SD card icon into the trash.
70+
71+Expected result:
72+ * The SD card launcher icon appears in the launcher after the SD card is mounted
73+ * After the icon is dragged into the trash, the SD card is "stopped"
74+ * A notification appears, stating that the SD card has been stopped.
75+
76+
77 No flickering when resizing the launcher
78 -----------------------------------------
79+
80 Actions:
81 * Open gedit.
82 * Maximize it. Make sure it remains maximized during the test.