Merge lp:~canonical-dx-team/unity/unity.trash-can into lp:unity

Proposed by Jason Smith on 2010-11-24
Status: Merged
Approved by: Neil J. Patel on 2010-11-24
Approved revision: 625
Merged at revision: 625
Proposed branch: lp:~canonical-dx-team/unity/unity.trash-can
Merge into: lp:unity
Diff against target: 272 lines (+105/-19)
11 files modified
po/unity.pot (+1/-1)
src/BamfLauncherIcon.cpp (+1/-1)
src/BamfLauncherIcon.h (+1/-1)
src/Launcher.cpp (+2/-1)
src/LauncherController.cpp (+11/-1)
src/LauncherController.h (+3/-1)
src/LauncherModel.cpp (+1/-4)
src/SimpleLauncherIcon.cpp (+1/-1)
src/SimpleLauncherIcon.h (+1/-8)
src/TrashLauncherIcon.cpp (+47/-0)
src/TrashLauncherIcon.h (+36/-0)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.trash-can
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2010-11-24 Approve on 2010-11-24
Review via email: mp+41781@code.launchpad.net
To post a comment you must log in.
Neil J. Patel (njpatel) wrote :

Looks good, approved.

review: Approve

=== modified file 'po/unity.pot'
--- po/unity.pot 2010-11-23 11:36:14 +0000
+++ po/unity.pot 2010-11-24 19:11:42 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: <email address hidden>\n"
-"POT-Creation-Date: 2010-11-22 14:36+0000\n"
+"POT-Creation-Date: 2010-11-24 13:32-0500\n"

Why do I keep seeing this file modified? Please clean up your diffs.

+
+TrashLauncherIcon::TrashLauncherIcon (Launcher* IconManager)
+: SimpleLauncherIcon(IconManager)
+{
+ SetTooltipText ("Trash");

Should the "Trash" tooltip not be marked for translation?

+void
+TrashLauncherIcon::OnMouseClick (int button)
+{
+ if (button == 1)
+ {
+ GError *error = NULL;
+
+ g_spawn_command_line_async ("xdg-open trash://", &error);
+
+ if (error)
+ g_error_free (error);
+ }
+}

Instead of doing 'xdg-open trash://' I'd rather see a purely
programmatic approach like
g_app_info_launch_default_for_uri("trash://"...) this will also open
the possibility of spawning the trash:// view on the right screen.

Also, please print out the error with g_critical() if it's set.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/unity.pot'
2--- po/unity.pot 2010-11-23 11:36:14 +0000
3+++ po/unity.pot 2010-11-24 19:11:42 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: ayatana-dev@lists.launchpad.net\n"
8-"POT-Creation-Date: 2010-11-22 14:36+0000\n"
9+"POT-Creation-Date: 2010-11-24 13:32-0500\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13
14=== modified file 'src/BamfLauncherIcon.cpp'
15--- src/BamfLauncherIcon.cpp 2010-11-24 02:13:08 +0000
16+++ src/BamfLauncherIcon.cpp 2010-11-24 19:11:42 +0000
17@@ -28,7 +28,7 @@
18 #include <core/core.h>
19 #include <core/atoms.h>
20
21-BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app, CompScreen *screen, NUX_FILE_LINE_DECL)
22+BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app, CompScreen *screen)
23 : SimpleLauncherIcon(IconManager)
24 {
25 m_App = app;
26
27=== modified file 'src/BamfLauncherIcon.h'
28--- src/BamfLauncherIcon.h 2010-11-24 02:13:08 +0000
29+++ src/BamfLauncherIcon.h 2010-11-24 19:11:42 +0000
30@@ -35,7 +35,7 @@
31 class BamfLauncherIcon : public SimpleLauncherIcon
32 {
33 public:
34- BamfLauncherIcon(Launcher* IconManager, BamfApplication *app, CompScreen *screen, NUX_FILE_LINE_PROTO);
35+ BamfLauncherIcon(Launcher* IconManager, BamfApplication *app, CompScreen *screen);
36 ~BamfLauncherIcon();
37
38
39
40=== modified file 'src/Launcher.cpp'
41--- src/Launcher.cpp 2010-11-24 02:13:08 +0000
42+++ src/Launcher.cpp 2010-11-24 19:11:42 +0000
43@@ -953,7 +953,7 @@
44 nux::Matrix4 ProjectionMatrix;
45 nux::Matrix4 ViewProjectionMatrix;
46
47- if(nux::Abs (arg.folding_rads) < 0.15f)
48+ if(nux::Abs (arg.folding_rads) < 0.01f)
49 icon->GetDeviceTexture()->SetFiltering(GL_NEAREST, GL_NEAREST);
50 else
51 icon->GetDeviceTexture()->SetFiltering(GL_LINEAR, GL_LINEAR);
52@@ -1327,6 +1327,7 @@
53
54 bool Launcher::MenuNotify(LauncherIcon* Icon)
55 {
56+
57 return true;
58 }
59
60
61=== modified file 'src/LauncherController.cpp'
62--- src/LauncherController.cpp 2010-11-24 00:43:37 +0000
63+++ src/LauncherController.cpp 2010-11-24 19:11:42 +0000
64@@ -21,12 +21,13 @@
65 #include "LauncherIcon.h"
66 #include "Launcher.h"
67 #include "PluginAdapter.h"
68+#include "TrashLauncherIcon.h"
69
70
71 #include <Nux/Nux.h>
72 #include <Nux/BaseWindow.h>
73
74-LauncherController::LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window, NUX_FILE_LINE_DECL)
75+LauncherController::LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window)
76 {
77 _launcher = launcher;
78 _window = window;
79@@ -39,6 +40,7 @@
80
81 g_timeout_add (5000, (GSourceFunc) &LauncherController::BamfTimerCallback, this);
82 InsertExpoAction ();
83+ InsertTrash ();
84 }
85
86 LauncherController::~LauncherController()
87@@ -53,6 +55,14 @@
88 }
89
90 void
91+LauncherController::InsertTrash ()
92+{
93+ TrashLauncherIcon *icon;
94+ icon = new TrashLauncherIcon (_launcher);
95+ RegisterIcon (icon);
96+}
97+
98+void
99 LauncherController::InsertExpoAction ()
100 {
101 SimpleLauncherIcon *expoIcon;
102
103=== modified file 'src/LauncherController.h'
104--- src/LauncherController.h 2010-11-12 17:32:48 +0000
105+++ src/LauncherController.h 2010-11-24 19:11:42 +0000
106@@ -40,7 +40,7 @@
107 {
108
109 public:
110- LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window, NUX_FILE_LINE_PROTO);
111+ LauncherController(Launcher* launcher, CompScreen *screen, nux::BaseWindow* window);
112 ~LauncherController();
113
114
115@@ -55,6 +55,8 @@
116 int _sort_priority;
117
118 void InsertExpoAction ();
119+
120+ void InsertTrash ();
121
122 void RegisterIcon (LauncherIcon *icon);
123
124
125=== modified file 'src/LauncherModel.cpp'
126--- src/LauncherModel.cpp 2010-11-16 00:25:17 +0000
127+++ src/LauncherModel.cpp 2010-11-24 19:11:42 +0000
128@@ -36,10 +36,7 @@
129
130 bool LauncherModel::IconShouldShelf (LauncherIcon *icon)
131 {
132- return icon->Type () == LAUNCHER_ICON_TYPE_END ||
133- icon->Type () == LAUNCHER_ICON_TYPE_TRASH ||
134- icon->Type () == LAUNCHER_ICON_TYPE_DEVICE ||
135- icon->Type () == LAUNCHER_ICON_TYPE_PLACE;
136+ return icon->Type () == LAUNCHER_ICON_TYPE_TRASH;
137 }
138
139 void
140
141=== modified file 'src/SimpleLauncherIcon.cpp'
142--- src/SimpleLauncherIcon.cpp 2010-11-10 14:42:46 +0000
143+++ src/SimpleLauncherIcon.cpp 2010-11-24 19:11:42 +0000
144@@ -22,7 +22,7 @@
145 #include "SimpleLauncherIcon.h"
146 #include "Launcher.h"
147
148-SimpleLauncherIcon::SimpleLauncherIcon (Launcher* IconManager, NUX_FILE_LINE_DECL)
149+SimpleLauncherIcon::SimpleLauncherIcon (Launcher* IconManager)
150 : LauncherIcon(IconManager)
151 {
152 m_Icon = 0;
153
154=== modified file 'src/SimpleLauncherIcon.h'
155--- src/SimpleLauncherIcon.h 2010-11-10 14:42:46 +0000
156+++ src/SimpleLauncherIcon.h 2010-11-24 19:11:42 +0000
157@@ -19,13 +19,6 @@
158 #ifndef SIMPLELAUNCHERICON_H
159 #define SIMPLELAUNCHERICON_H
160
161-/* Compiz */
162-#include <core/core.h>
163-
164-#include <Nux/BaseWindow.h>
165-#include <NuxCore/Math/MathInc.h>
166-#include <sigc++/sigc++.h>
167-
168 #include "LauncherIcon.h"
169
170 class Launcher;
171@@ -33,7 +26,7 @@
172 class SimpleLauncherIcon : public LauncherIcon
173 {
174 public:
175- SimpleLauncherIcon(Launcher* IconManager, NUX_FILE_LINE_PROTO);
176+ SimpleLauncherIcon(Launcher* IconManager);
177 ~SimpleLauncherIcon();
178
179 /* override */
180
181=== added file 'src/TrashLauncherIcon.cpp'
182--- src/TrashLauncherIcon.cpp 1970-01-01 00:00:00 +0000
183+++ src/TrashLauncherIcon.cpp 2010-11-24 19:11:42 +0000
184@@ -0,0 +1,47 @@
185+/*
186+ * Copyright (C) 2010 Canonical Ltd
187+ *
188+ * This program is free software: you can redistribute it and/or modify
189+ * it under the terms of the GNU General Public License version 3 as
190+ * published by the Free Software Foundation.
191+ *
192+ * This program is distributed in the hope that it will be useful,
193+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
194+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
195+ * GNU General Public License for more details.
196+ *
197+ * You should have received a copy of the GNU General Public License
198+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
199+ *
200+ * Authored by: Jason Smith <jason.smith@canonical.com>
201+ */
202+
203+#include "TrashLauncherIcon.h"
204+
205+TrashLauncherIcon::TrashLauncherIcon (Launcher* IconManager)
206+: SimpleLauncherIcon(IconManager)
207+{
208+ SetTooltipText ("Trash");
209+ SetIconName ("user-trash");
210+ SetQuirk (LAUNCHER_ICON_QUIRK_VISIBLE, true);
211+ SetQuirk (LAUNCHER_ICON_QUIRK_RUNNING, false);
212+ SetIconType (LAUNCHER_ICON_TYPE_TRASH);
213+}
214+
215+TrashLauncherIcon::~TrashLauncherIcon()
216+{
217+}
218+
219+void
220+TrashLauncherIcon::OnMouseClick (int button)
221+{
222+ if (button == 1)
223+ {
224+ GError *error = NULL;
225+
226+ g_spawn_command_line_async ("xdg-open trash://", &error);
227+
228+ if (error)
229+ g_error_free (error);
230+ }
231+}
232
233=== added file 'src/TrashLauncherIcon.h'
234--- src/TrashLauncherIcon.h 1970-01-01 00:00:00 +0000
235+++ src/TrashLauncherIcon.h 2010-11-24 19:11:42 +0000
236@@ -0,0 +1,36 @@
237+/*
238+ * Copyright (C) 2010 Canonical Ltd
239+ *
240+ * This program is free software: you can redistribute it and/or modify
241+ * it under the terms of the GNU General Public License version 3 as
242+ * published by the Free Software Foundation.
243+ *
244+ * This program is distributed in the hope that it will be useful,
245+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
246+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
247+ * GNU General Public License for more details.
248+ *
249+ * You should have received a copy of the GNU General Public License
250+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
251+ *
252+ * Authored by: Jason Smith <jason.smith@canonical.com>
253+ */
254+
255+#ifndef TRASHLAUNCHERICON_H
256+#define TRASHLAUNCHERICON_H
257+
258+#include "SimpleLauncherIcon.h"
259+
260+class TrashLauncherIcon : public SimpleLauncherIcon
261+{
262+
263+public:
264+ TrashLauncherIcon (Launcher *launcher);
265+ ~TrashLauncherIcon ();
266+
267+protected:
268+ void OnMouseClick (int button);
269+
270+};
271+
272+#endif // TRASHLAUNCHERICON_H