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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1275
Proposed branch: lp:~azzar1/unity/fix-733425
Merge into: lp:unity
Diff against target: 101 lines (+27/-15)
3 files modified
plugins/unityshell/src/Launcher.cpp (+24/-0)
plugins/unityshell/src/LauncherController.cpp (+2/-14)
plugins/unityshell/src/LauncherController.h (+1/-1)
To merge this branch: bzr merge lp:~azzar1/unity/fix-733425
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+67447@code.launchpad.net

Description of the change

Tries to solve bug #733425.
According to me, updating gsettings during the drag and drop has no sense, so update it at the end of the drag and drop.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Does indeed get rid of disk-I/O during the drag... nice! Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/Launcher.cpp'
2--- plugins/unityshell/src/Launcher.cpp 2011-06-30 15:21:07 +0000
3+++ plugins/unityshell/src/Launcher.cpp 2011-07-10 10:01:23 +0000
4@@ -34,6 +34,8 @@
5 #include "Nux/BaseWindow.h"
6 #include "Nux/WindowCompositor.h"
7
8+#include "BamfLauncherIcon.h"
9+#include "FavoriteStore.h"
10 #include "Launcher.h"
11 #include "LauncherIcon.h"
12 #include "SpacerLauncherIcon.h"
13@@ -2995,6 +2997,28 @@
14 }
15 else
16 {
17+
18+ std::list<BamfLauncherIcon *> launchers;
19+ std::list<BamfLauncherIcon *>::iterator it;
20+ unity::FavoriteList desktop_paths;
21+
22+ // Updates gsettings favorites.
23+ launchers = _model->GetSublist<BamfLauncherIcon> ();
24+ for (it = launchers.begin (); it != launchers.end (); it++)
25+ {
26+ BamfLauncherIcon *icon = *it;
27+
28+ if (!icon->IsSticky ())
29+ continue;
30+
31+ const char* desktop_file = icon->DesktopFile ();
32+
33+ if (desktop_file && strlen (desktop_file) > 0)
34+ desktop_paths.push_back(desktop_file);
35+ }
36+
37+ unity::FavoriteStore::GetDefault ().SetFavorites (desktop_paths);
38+
39 _drag_window->SetAnimationTarget ((int) (_drag_icon->GetCenter ().x), (int) (_drag_icon->GetCenter ().y));
40 _drag_window->StartAnimation ();
41
42
43=== modified file 'plugins/unityshell/src/LauncherController.cpp'
44--- plugins/unityshell/src/LauncherController.cpp 2011-06-05 00:30:33 +0000
45+++ plugins/unityshell/src/LauncherController.cpp 2011-07-10 10:01:23 +0000
46@@ -115,7 +115,7 @@
47 }
48 }
49
50-void LauncherController::SortAndSave()
51+void LauncherController::SortAndUpdate()
52 {
53 std::list<BamfLauncherIcon *> launchers;
54 std::list<BamfLauncherIcon *>::iterator it;
55@@ -126,8 +126,6 @@
56 launchers = _model->GetSublist<BamfLauncherIcon> ();
57 for (it = launchers.begin (); it != launchers.end (); it++)
58 {
59- BamfLauncherIcon *icon = *it;
60-
61 if (shortcut < 11 && (*it)->GetQuirk (LauncherIcon::QUIRK_VISIBLE))
62 {
63 buff = g_strdup_printf ("%d", shortcut % 10);
64@@ -140,17 +138,7 @@
65 {
66 (*it)->SetShortcut (0);
67 }
68-
69- if (!icon->IsSticky ())
70- continue;
71-
72- const char* desktop_file = icon->DesktopFile ();
73-
74- if (desktop_file && strlen (desktop_file) > 0)
75- desktop_paths.push_back(desktop_file);
76 }
77-
78- FavoriteStore::GetDefault().SetFavorites(desktop_paths);
79 }
80
81 void
82@@ -373,6 +361,6 @@
83 RegisterIcon (icon);
84 }
85
86- _model->order_changed.connect (sigc::mem_fun (this, &LauncherController::SortAndSave));
87+ _model->order_changed.connect (sigc::mem_fun (this, &LauncherController::SortAndUpdate));
88 }
89
90
91=== modified file 'plugins/unityshell/src/LauncherController.h'
92--- plugins/unityshell/src/LauncherController.h 2011-06-05 00:30:33 +0000
93+++ plugins/unityshell/src/LauncherController.h 2011-07-10 10:01:23 +0000
94@@ -71,7 +71,7 @@
95
96 guint32 _on_view_opened_id;
97
98- void SortAndSave ();
99+ void SortAndUpdate ();
100
101 void OnIconAdded (LauncherIcon *icon);
102