Merge lp:~3v1n0/ubuntu/oneiric/nautilus/unity-launcher-support into lp:ubuntu/oneiric/nautilus

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merge reported by: Ken VanDine
Merged at revision: not available
Proposed branch: lp:~3v1n0/ubuntu/oneiric/nautilus/unity-launcher-support
Merge into: lp:ubuntu/oneiric/nautilus
Prerequisite: lp:~3v1n0/ubuntu/oneiric/nautilus/progress-indicator-support
Diff against target: 1438 lines (+989/-7)
26 files modified
.pc/applied-patches (+1/-0)
Makefile.in (+2/-0)
config.h.in (+3/-0)
configure (+158/-1)
configure.in (+26/-1)
cut-n-paste-code/Makefile.in (+2/-0)
cut-n-paste-code/libegg/Makefile.in (+2/-0)
data/Makefile.in (+2/-0)
data/icons/Makefile.in (+2/-0)
debian/changelog (+6/-1)
debian/patches/12_unity_launcher_support.patch (+455/-0)
debian/patches/series (+1/-0)
docs/Makefile.in (+2/-0)
docs/reference/Makefile.in (+2/-0)
docs/reference/libnautilus-extension/Makefile.in (+2/-0)
eel/Makefile.in (+2/-0)
icons/Makefile.in (+2/-0)
libnautilus-extension/Makefile.in (+2/-0)
libnautilus-private/Makefile.in (+2/-0)
libnautilus-private/nautilus-progress-info.c (+40/-0)
libnautilus-private/nautilus-progress-info.h (+2/-0)
nautilus-sendto-extension/Makefile.in (+2/-0)
src/Makefile.am (+2/-0)
src/Makefile.in (+8/-4)
src/nautilus-progress-ui-handler.c (+259/-0)
test/Makefile.in (+2/-0)
To merge this branch: bzr merge lp:~3v1n0/ubuntu/oneiric/nautilus/unity-launcher-support
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Ubuntu branches Pending
Review via email: mp+70685@code.launchpad.net

Description of the change

As discussed in the merge request of lp:~3v1n0/ubuntu/oneiric/nautilus/progress-indicator-support the nautilus file operation progress could be shown also using its unity launcher icon.

So, I've added some kind of Nautilus / Unity integration trough libunity facilities. Basically a progress bar is shown to indicate the effective progress of all the pending operations (to get this I had to edit also libnautilus-private), and a counter indicates the number of the pending operations (maybe it should be shown only if there are more than one operations).
Plus I've added two quicklist items that are enabled only during the transfer time which allows to show the progress window and to cancel all the pending operations (as requested by bug #784804).

You can see a screencast to show how it works here: http://go.3v1n0.net/px4pzv (also if it misses the "Cancel" quicklist).

The quicklist and progress bar are applied both to "nautilus.desktop" and "nautilus-home.desktop" launchers because currently libunity doesn't allow us to know if a given launcher is actually shown in the unity left-bar (I guess this is something that we should do). Also it could happen that someone will remove the nautilus-home and will use just the standard nautilus desktop file.

I've not reverted or disabled the patch at lp:~3v1n0/ubuntu/oneiric/nautilus/progress-indicator-support however I guess that if you prefer not to have both the indicator and the unity launcher progress bar, the faster way is to just compile the deb package with the --disable-appindicator option.

To post a comment you must log in.
Revision history for this message
Matthew Paul Thomas (mpt) wrote :

The use of a progress bar on the Unity launcher item looks good to me.

For the badge, I suggest showing it only if there are any tasks queued after the current one. (That is, the badge should never say "1".) That way you can tell at a glance whether the progress bar represents everything that you need to wait for before logging out etc, or whether there's more after that.

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

Actually, your changelog suggests that the launcher progress bar covers all tasks. I don't understand how this can work -- how do you know how big a task will be when Nautilus hasn't pre-flighted it yet? But if it does work, the badge isn't useful at all -- four tasks copying 250 files each aren't "more" than one task copying 1000 files.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Based on feedback from @mpt, I removed the counts and merges the rest. Thanks for the patch!

review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

@mpt the progress doesn't count the number of files to copy/move/any-other-action but the size of them.

About the unity icon count, shouldn't it be included when more than one transfer is in progress (and so shown only when transfers > 1)?

Revision history for this message
Noitidart (noitidart) wrote :

This is super nice. I would like to place a badge on my application using this method. I'm doing this with ctypes. I'm not so good at reading C code yet but if you can simplify it that would be very nice!

Can you please show me a simplest example so I can emulate this.
I really appreciate this I have been trying for a couple months on this.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Noitidart, does this help you https://wiki.ubuntu.com/Unity/LauncherAPI ?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2011-08-07 21:22:32 +0000
3+++ .pc/applied-patches 2011-08-07 21:22:32 +0000
4@@ -8,3 +8,4 @@
5 09_no-initial-fade.patch
6 10_show_in_unity.patch
7 11_copy_skipping_pager.patch
8+12_unity_launcher_support.patch
9
10=== modified file 'Makefile.in'
11--- Makefile.in 2011-08-07 21:22:32 +0000
12+++ Makefile.in 2011-08-07 21:22:32 +0000
13@@ -235,6 +235,8 @@
14 SET_MAKE = @SET_MAKE@
15 SHELL = @SHELL@
16 STRIP = @STRIP@
17+UNITY_CFLAGS = @UNITY_CFLAGS@
18+UNITY_LIBS = @UNITY_LIBS@
19 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
20 USE_NLS = @USE_NLS@
21 VERSION = @VERSION@
22
23=== modified file 'config.h.in'
24--- config.h.in 2011-08-07 21:22:32 +0000
25+++ config.h.in 2011-08-07 21:22:32 +0000
26@@ -105,6 +105,9 @@
27 /* Define to 1 if you have the <unistd.h> header file. */
28 #undef HAVE_UNISTD_H
29
30+/* Have Unity */
31+#undef HAVE_UNITY
32+
33 /* Define to 1 if you have the <X11/XF86keysym.h> header file. */
34 #undef HAVE_X11_XF86KEYSYM_H
35
36
37=== modified file 'configure'
38--- configure 2011-08-07 21:22:32 +0000
39+++ configure 2011-08-07 21:22:32 +0000
40@@ -638,6 +638,10 @@
41 BASE_LIBS
42 BASE_CFLAGS
43 WARNING_CFLAGS
44+UNITY_LIBS
45+UNITY_CFLAGS
46+HAVE_UNITY_FALSE
47+HAVE_UNITY_TRUE
48 APP_INDICATOR_LIBS
49 APP_INDICATOR_CFLAGS
50 HAVE_APP_INDICATOR_FALSE
51@@ -867,6 +871,7 @@
52 enable_empty_view
53 enable_packagekit
54 enable_appindicator
55+enable_unity
56 enable_more_warnings
57 enable_introspection
58 enable_update_mimedb
59@@ -891,6 +896,8 @@
60 EXEMPI_LIBS
61 APP_INDICATOR_CFLAGS
62 APP_INDICATOR_LIBS
63+UNITY_CFLAGS
64+UNITY_LIBS
65 BASE_CFLAGS
66 BASE_LIBS
67 COMMON_CFLAGS
68@@ -1542,6 +1549,7 @@
69 --enable-empty-view Enable empty view
70 --disable-packagekit build without PackageKit support
71 --disable-appindicator build without appindicator support
72+ --disable-unity build without unity launcher support
73 --enable-more-warnings Maximum compiler warnings
74 --enable-introspection=[no/auto/yes]
75 Enable introspection for this build
76@@ -1585,6 +1593,9 @@
77 C compiler flags for APP_INDICATOR, overriding pkg-config
78 APP_INDICATOR_LIBS
79 linker flags for APP_INDICATOR, overriding pkg-config
80+ UNITY_CFLAGS
81+ C compiler flags for UNITY, overriding pkg-config
82+ UNITY_LIBS linker flags for UNITY, overriding pkg-config
83 BASE_CFLAGS C compiler flags for BASE, overriding pkg-config
84 BASE_LIBS linker flags for BASE, overriding pkg-config
85 COMMON_CFLAGS
86@@ -15463,7 +15474,6 @@
87 fi
88
89
90-
91 if false; then
92 HAVE_APP_INDICATOR_TRUE=
93 HAVE_APP_INDICATOR_FALSE='#'
94@@ -15586,6 +15596,136 @@
95 fi
96
97
98+ if false; then
99+ HAVE_UNITY_TRUE=
100+ HAVE_UNITY_FALSE='#'
101+else
102+ HAVE_UNITY_TRUE='#'
103+ HAVE_UNITY_FALSE=
104+fi
105+
106+
107+# Check whether --enable-unity was given.
108+if test "${enable_unity+set}" = set; then :
109+ enableval=$enable_unity;
110+fi
111+
112+
113+msg_unity=no
114+if test "x$enable_unity" != "xno"; then
115+
116+pkg_failed=no
117+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UNITY" >&5
118+$as_echo_n "checking for UNITY... " >&6; }
119+
120+if test -n "$UNITY_CFLAGS"; then
121+ pkg_cv_UNITY_CFLAGS="$UNITY_CFLAGS"
122+ elif test -n "$PKG_CONFIG"; then
123+ if test -n "$PKG_CONFIG" && \
124+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"unity >= 4.0.0
125+ dbusmenu-glib-0.4 >= 0.4.90\""; } >&5
126+ ($PKG_CONFIG --exists --print-errors "unity >= 4.0.0
127+ dbusmenu-glib-0.4 >= 0.4.90") 2>&5
128+ ac_status=$?
129+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
130+ test $ac_status = 0; }; then
131+ pkg_cv_UNITY_CFLAGS=`$PKG_CONFIG --cflags "unity >= 4.0.0
132+ dbusmenu-glib-0.4 >= 0.4.90" 2>/dev/null`
133+ test "x$?" != "x0" && pkg_failed=yes
134+else
135+ pkg_failed=yes
136+fi
137+ else
138+ pkg_failed=untried
139+fi
140+if test -n "$UNITY_LIBS"; then
141+ pkg_cv_UNITY_LIBS="$UNITY_LIBS"
142+ elif test -n "$PKG_CONFIG"; then
143+ if test -n "$PKG_CONFIG" && \
144+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"unity >= 4.0.0
145+ dbusmenu-glib-0.4 >= 0.4.90\""; } >&5
146+ ($PKG_CONFIG --exists --print-errors "unity >= 4.0.0
147+ dbusmenu-glib-0.4 >= 0.4.90") 2>&5
148+ ac_status=$?
149+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
150+ test $ac_status = 0; }; then
151+ pkg_cv_UNITY_LIBS=`$PKG_CONFIG --libs "unity >= 4.0.0
152+ dbusmenu-glib-0.4 >= 0.4.90" 2>/dev/null`
153+ test "x$?" != "x0" && pkg_failed=yes
154+else
155+ pkg_failed=yes
156+fi
157+ else
158+ pkg_failed=untried
159+fi
160+
161+
162+
163+if test $pkg_failed = yes; then
164+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
165+$as_echo "no" >&6; }
166+
167+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
168+ _pkg_short_errors_supported=yes
169+else
170+ _pkg_short_errors_supported=no
171+fi
172+ if test $_pkg_short_errors_supported = yes; then
173+ UNITY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "unity >= 4.0.0
174+ dbusmenu-glib-0.4 >= 0.4.90" 2>&1`
175+ else
176+ UNITY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "unity >= 4.0.0
177+ dbusmenu-glib-0.4 >= 0.4.90" 2>&1`
178+ fi
179+ # Put the nasty error message in config.log where it belongs
180+ echo "$UNITY_PKG_ERRORS" >&5
181+
182+ if 0; then
183+ HAVE_UNITY_TRUE=
184+ HAVE_UNITY_FALSE='#'
185+else
186+ HAVE_UNITY_TRUE='#'
187+ HAVE_UNITY_FALSE=
188+fi
189+
190+
191+elif test $pkg_failed = untried; then
192+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
193+$as_echo "no" >&6; }
194+ if 0; then
195+ HAVE_UNITY_TRUE=
196+ HAVE_UNITY_FALSE='#'
197+else
198+ HAVE_UNITY_TRUE='#'
199+ HAVE_UNITY_FALSE=
200+fi
201+
202+
203+else
204+ UNITY_CFLAGS=$pkg_cv_UNITY_CFLAGS
205+ UNITY_LIBS=$pkg_cv_UNITY_LIBS
206+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
207+$as_echo "yes" >&6; }
208+
209+ if 1; then
210+ HAVE_UNITY_TRUE=
211+ HAVE_UNITY_FALSE='#'
212+else
213+ HAVE_UNITY_TRUE='#'
214+ HAVE_UNITY_FALSE=
215+fi
216+
217+
218+$as_echo "#define HAVE_UNITY 1" >>confdefs.h
219+
220+
221+ msg_unity=yes
222+fi
223+
224+
225+fi
226+
227+
228
229 WARNING_CFLAGS=""
230
231@@ -16502,6 +16642,22 @@
232 as_fn_error $? "conditional \"HAVE_APP_INDICATOR\" was never defined.
233 Usually this means the macro was only invoked conditionally." "$LINENO" 5
234 fi
235+if test -z "${HAVE_UNITY_TRUE}" && test -z "${HAVE_UNITY_FALSE}"; then
236+ as_fn_error $? "conditional \"HAVE_UNITY\" was never defined.
237+Usually this means the macro was only invoked conditionally." "$LINENO" 5
238+fi
239+if test -z "${HAVE_UNITY_TRUE}" && test -z "${HAVE_UNITY_FALSE}"; then
240+ as_fn_error $? "conditional \"HAVE_UNITY\" was never defined.
241+Usually this means the macro was only invoked conditionally." "$LINENO" 5
242+fi
243+if test -z "${HAVE_UNITY_TRUE}" && test -z "${HAVE_UNITY_FALSE}"; then
244+ as_fn_error $? "conditional \"HAVE_UNITY\" was never defined.
245+Usually this means the macro was only invoked conditionally." "$LINENO" 5
246+fi
247+if test -z "${HAVE_UNITY_TRUE}" && test -z "${HAVE_UNITY_FALSE}"; then
248+ as_fn_error $? "conditional \"HAVE_UNITY\" was never defined.
249+Usually this means the macro was only invoked conditionally." "$LINENO" 5
250+fi
251 if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then
252 as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined.
253 Usually this means the macro was only invoked conditionally." "$LINENO" 5
254@@ -18816,6 +18972,7 @@
255 libexempi support: $msg_xmp
256 PackageKit support: $msg_packagekit
257 AppIndicator support: $msg_appindicator
258+ Unity support: $msg_unity
259 nautilus-sendto ext: $enable_nst_extension
260
261 profiling support: ${profiling_support}
262
263=== modified file 'configure.in'
264--- configure.in 2011-08-07 21:22:32 +0000
265+++ configure.in 2011-08-07 21:22:32 +0000
266@@ -10,6 +10,8 @@
267 m4_define(exif_minver, 0.6.20)
268 m4_define(exempi_minver, 2.1.0)
269 m4_define(notify_minver, 0.7.0)
270+m4_define(unity_minver, 4.0.0)
271+m4_define(dbusmenu_minver, 0.4.90)
272 m4_define(appindicator_minver, 0.3.90)
273
274
275@@ -204,7 +206,6 @@
276
277 dnl ==========================================================================
278
279-
280 AM_CONDITIONAL(HAVE_APP_INDICATOR, false)
281
282 AC_ARG_ENABLE(appindicator,
283@@ -227,6 +228,29 @@
284
285 dnl ==========================================================================
286
287+AM_CONDITIONAL(HAVE_UNITY, false)
288+
289+AC_ARG_ENABLE(unity,
290+ AC_HELP_STRING([--disable-unity],
291+ [build without unity launcher support]))
292+
293+msg_unity=no
294+if test "x$enable_unity" != "xno"; then
295+ PKG_CHECK_MODULES(UNITY,
296+ [unity >= unity_minver
297+ dbusmenu-glib-0.4 >= dbusmenu_minver], [
298+ AM_CONDITIONAL(HAVE_UNITY, 1)
299+ AC_DEFINE(HAVE_UNITY, 1, [Have Unity])
300+ ]
301+ msg_unity=yes,
302+ [AM_CONDITIONAL(HAVE_UNITY, 0)
303+ ])
304+ AC_SUBST(UNITY_CFLAGS)
305+ AC_SUBST(UNITY_LIBS)
306+fi
307+
308+dnl ==========================================================================
309+
310 dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
311
312 WARNING_CFLAGS=""
313@@ -385,6 +409,7 @@
314 libexempi support: $msg_xmp
315 PackageKit support: $msg_packagekit
316 AppIndicator support: $msg_appindicator
317+ Unity support: $msg_unity
318 nautilus-sendto ext: $enable_nst_extension
319
320 profiling support: ${profiling_support}
321
322=== modified file 'cut-n-paste-code/Makefile.in'
323--- cut-n-paste-code/Makefile.in 2011-08-07 21:22:32 +0000
324+++ cut-n-paste-code/Makefile.in 2011-08-07 21:22:32 +0000
325@@ -218,6 +218,8 @@
326 SET_MAKE = @SET_MAKE@
327 SHELL = @SHELL@
328 STRIP = @STRIP@
329+UNITY_CFLAGS = @UNITY_CFLAGS@
330+UNITY_LIBS = @UNITY_LIBS@
331 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
332 USE_NLS = @USE_NLS@
333 VERSION = @VERSION@
334
335=== modified file 'cut-n-paste-code/libegg/Makefile.in'
336--- cut-n-paste-code/libegg/Makefile.in 2011-08-07 21:22:32 +0000
337+++ cut-n-paste-code/libegg/Makefile.in 2011-08-07 21:22:32 +0000
338@@ -214,6 +214,8 @@
339 SET_MAKE = @SET_MAKE@
340 SHELL = @SHELL@
341 STRIP = @STRIP@
342+UNITY_CFLAGS = @UNITY_CFLAGS@
343+UNITY_LIBS = @UNITY_LIBS@
344 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
345 USE_NLS = @USE_NLS@
346 VERSION = @VERSION@
347
348=== modified file 'data/Makefile.in'
349--- data/Makefile.in 2011-08-07 21:22:32 +0000
350+++ data/Makefile.in 2011-08-07 21:22:32 +0000
351@@ -248,6 +248,8 @@
352 SET_MAKE = @SET_MAKE@
353 SHELL = @SHELL@
354 STRIP = @STRIP@
355+UNITY_CFLAGS = @UNITY_CFLAGS@
356+UNITY_LIBS = @UNITY_LIBS@
357 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
358 USE_NLS = @USE_NLS@
359 VERSION = @VERSION@
360
361=== modified file 'data/icons/Makefile.in'
362--- data/icons/Makefile.in 2011-08-07 21:22:32 +0000
363+++ data/icons/Makefile.in 2011-08-07 21:22:32 +0000
364@@ -180,6 +180,8 @@
365 SET_MAKE = @SET_MAKE@
366 SHELL = @SHELL@
367 STRIP = @STRIP@
368+UNITY_CFLAGS = @UNITY_CFLAGS@
369+UNITY_LIBS = @UNITY_LIBS@
370 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
371 USE_NLS = @USE_NLS@
372 VERSION = @VERSION@
373
374=== modified file 'debian/changelog'
375--- debian/changelog 2011-08-07 21:22:32 +0000
376+++ debian/changelog 2011-08-07 21:22:32 +0000
377@@ -3,8 +3,13 @@
378 * debian/patches/07_use_application_indicator.patch:
379 Updated to work with current implementation, added middle-click and
380 transfer information support
381+ * debian/patches/12_unity_launcher_support.patch:
382+ Added new patch to include support to the unity launcher.
383+ When a file operation is in progress the nautilus launcher icon
384+ gets a progress bar and the count of the active transfers, plus
385+ a quicklist item to bring on top/show the transfers window.
386
387- -- Marco Trevisan (Treviño) <mail@3v1n0.net> Sat, 06 Aug 2011 04:51:04 +0200
388+ -- Marco Trevisan (Treviño) <3v1n0@ubuntu.com> Sun, 07 Aug 2011 19:41:46 +0200
389
390 nautilus (1:3.1.4-0ubuntu2) oneiric; urgency=low
391
392
393=== added file 'debian/patches/12_unity_launcher_support.patch'
394--- debian/patches/12_unity_launcher_support.patch 1970-01-01 00:00:00 +0000
395+++ debian/patches/12_unity_launcher_support.patch 2011-08-07 21:22:32 +0000
396@@ -0,0 +1,455 @@
397+Index: nautilus/configure.in
398+===================================================================
399+--- nautilus.orig/configure.in 2011-08-07 16:56:01.503335238 +0200
400++++ nautilus/configure.in 2011-08-07 17:03:01.660461281 +0200
401+@@ -10,6 +10,8 @@
402+ m4_define(exif_minver, 0.6.20)
403+ m4_define(exempi_minver, 2.1.0)
404+ m4_define(notify_minver, 0.7.0)
405++m4_define(unity_minver, 4.0.0)
406++m4_define(dbusmenu_minver, 0.4.90)
407+ m4_define(appindicator_minver, 0.3.90)
408+
409+
410+@@ -204,7 +206,6 @@
411+
412+ dnl ==========================================================================
413+
414+-
415+ AM_CONDITIONAL(HAVE_APP_INDICATOR, false)
416+
417+ AC_ARG_ENABLE(appindicator,
418+@@ -227,6 +228,29 @@
419+
420+ dnl ==========================================================================
421+
422++AM_CONDITIONAL(HAVE_UNITY, false)
423++
424++AC_ARG_ENABLE(unity,
425++ AC_HELP_STRING([--disable-unity],
426++ [build without unity launcher support]))
427++
428++msg_unity=no
429++if test "x$enable_unity" != "xno"; then
430++ PKG_CHECK_MODULES(UNITY,
431++ [unity >= unity_minver
432++ dbusmenu-glib-0.4 >= dbusmenu_minver], [
433++ AM_CONDITIONAL(HAVE_UNITY, 1)
434++ AC_DEFINE(HAVE_UNITY, 1, [Have Unity])
435++ ]
436++ msg_unity=yes,
437++ [AM_CONDITIONAL(HAVE_UNITY, 0)
438++ ])
439++ AC_SUBST(UNITY_CFLAGS)
440++ AC_SUBST(UNITY_LIBS)
441++fi
442++
443++dnl ==========================================================================
444++
445+ dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
446+
447+ WARNING_CFLAGS=""
448+@@ -385,6 +409,7 @@
449+ libexempi support: $msg_xmp
450+ PackageKit support: $msg_packagekit
451+ AppIndicator support: $msg_appindicator
452++ Unity support: $msg_unity
453+ nautilus-sendto ext: $enable_nst_extension
454+
455+ profiling support: ${profiling_support}
456+Index: nautilus/src/Makefile.am
457+===================================================================
458+--- nautilus.orig/src/Makefile.am 2011-08-07 16:56:07.360331570 +0200
459++++ nautilus/src/Makefile.am 2011-08-07 17:00:52.652083163 +0200
460+@@ -31,6 +31,7 @@
461+ -DVERSION="\"$(VERSION)\"" \
462+ $(DISABLE_DEPRECATED_CFLAGS) \
463+ $(APP_INDICATOR_CFLAGS) \
464++ $(UNITY_CFLAGS) \
465+ $(NULL)
466+
467+ LDADD =\
468+@@ -43,6 +44,7 @@
469+ $(EXEMPI_LIBS) \
470+ $(POPT_LIBS) \
471+ $(APP_INDICATOR_LIBS) \
472++ $(UNITY_LIBS) \
473+ $(NULL)
474+
475+ nautilus_SOURCES = \
476+Index: nautilus/src/nautilus-progress-ui-handler.c
477+===================================================================
478+--- nautilus.orig/src/nautilus-progress-ui-handler.c 2011-08-07 16:56:17.095339123 +0200
479++++ nautilus/src/nautilus-progress-ui-handler.c 2011-08-07 23:02:36.649226967 +0200
480+@@ -41,6 +41,10 @@
481+ #include <libappindicator/app-indicator.h>
482+ #endif
483+
484++#ifdef HAVE_UNITY
485++#include <unity.h>
486++#endif
487++
488+ struct _NautilusProgressUIHandlerPriv {
489+ NautilusProgressInfoManager *manager;
490+
491+@@ -55,6 +59,9 @@
492+ #else
493+ GtkStatusIcon *status_icon;
494+ #endif
495++#ifdef HAVE_UNITY
496++ GList *launcher_entries;
497++#endif
498+ };
499+
500+ G_DEFINE_TYPE (NautilusProgressUIHandler, nautilus_progress_ui_handler, G_TYPE_OBJECT);
501+@@ -259,6 +266,250 @@
502+ g_free (tooltip);
503+ }
504+
505++#ifdef HAVE_UNITY
506++
507++static void
508++progress_ui_handler_unity_progress_changed (NautilusProgressInfo *info,
509++ NautilusProgressUIHandler *self)
510++{
511++ g_return_if_fail (self);
512++ g_return_if_fail (self->priv->launcher_entries);
513++ g_return_if_fail (self->priv->manager);
514++
515++ GList *infos, *l;
516++ double progress;
517++ size_t info_n = 0;
518++ double c, current = 0;
519++ double t, total = 0;
520++
521++ infos = nautilus_progress_info_manager_get_all_infos (self->priv->manager);
522++
523++ for (l = infos; l; l = l->next) {
524++ NautilusProgressInfo *i = l->data;
525++ c = nautilus_progress_info_get_current (i);
526++ t = nautilus_progress_info_get_total (i);
527++
528++ if (c < 0) c = 0;
529++ if (t <= 0) continue;
530++
531++ total += t;
532++ current += c;
533++ info_n++;
534++ }
535++
536++ progress = current / total;
537++ if (progress > 1.0)
538++ progress = 1.0;
539++
540++ for (l = self->priv->launcher_entries; l; l = l->next) {
541++ UnityLauncherEntry *entry = l->data;
542++ unity_launcher_entry_set_progress (entry, progress);
543++ }
544++}
545++
546++static void
547++progress_ui_handler_disable_unity_urgency (UnityLauncherEntry *entry)
548++{
549++ g_return_if_fail (entry);
550++
551++ unity_launcher_entry_set_urgent (entry, FALSE);
552++}
553++
554++static void
555++progress_ui_handler_unity_quicklist_show_activated (DbusmenuMenuitem *menu,
556++ guint timestamp,
557++ NautilusProgressUIHandler *self)
558++{
559++ g_return_if_fail (self);
560++
561++ if (!gtk_widget_get_visible (self->priv->progress_window)) {
562++ gtk_window_present (GTK_WINDOW (self->priv->progress_window));
563++ } else {
564++ gtk_window_set_keep_above (GTK_WINDOW (self->priv->progress_window), TRUE);
565++ gtk_window_set_keep_above (GTK_WINDOW (self->priv->progress_window), FALSE);
566++ }
567++}
568++
569++static void
570++progress_ui_handler_unity_quicklist_cancel_activated (DbusmenuMenuitem *menu,
571++ guint timestamp,
572++ NautilusProgressUIHandler *self)
573++{
574++ g_return_if_fail (self);
575++ g_return_if_fail (self->priv->manager);
576++
577++ GList *infos, *l;
578++ infos = nautilus_progress_info_manager_get_all_infos (self->priv->manager);
579++
580++ for (l = infos; l; l = l->next) {
581++ NautilusProgressInfo *info = l->data;
582++ nautilus_progress_info_cancel (info);
583++ }
584++}
585++
586++static DbusmenuMenuitem *
587++progress_ui_handler_build_unity_quicklist (NautilusProgressUIHandler *self)
588++{
589++ DbusmenuMenuitem *ql = dbusmenu_menuitem_new ();
590++ dbusmenu_menuitem_property_set_bool (ql,
591++ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
592++
593++ DbusmenuMenuitem *quickmenu = dbusmenu_menuitem_new ();
594++ dbusmenu_menuitem_property_set (quickmenu,
595++ DBUSMENU_MENUITEM_PROP_LABEL,
596++ _("Show copy dialog"));
597++ dbusmenu_menuitem_property_set_bool (quickmenu,
598++ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
599++ dbusmenu_menuitem_child_append (ql, quickmenu);
600++ g_signal_connect (quickmenu, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
601++ (GCallback) progress_ui_handler_unity_quicklist_show_activated,
602++ self);
603++
604++ quickmenu = dbusmenu_menuitem_new ();
605++ dbusmenu_menuitem_property_set (quickmenu,
606++ DBUSMENU_MENUITEM_PROP_LABEL,
607++ _("Cancel all in-progress actions"));
608++ dbusmenu_menuitem_property_set_bool (quickmenu,
609++ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
610++ dbusmenu_menuitem_child_append (ql, quickmenu);
611++ g_signal_connect (quickmenu, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
612++ (GCallback) progress_ui_handler_unity_quicklist_cancel_activated,
613++ self);
614++
615++ return ql;
616++}
617++
618++static DbusmenuMenuitem *
619++progress_ui_handler_ensure_unity_entry_quicklist (NautilusProgressUIHandler *self,
620++ UnityLauncherEntry *entry)
621++{
622++ g_return_if_fail (self);
623++ DbusmenuMenuitem *ql;
624++
625++ ql = unity_launcher_entry_get_quicklist (entry);
626++
627++ if (ql)
628++ return ql;
629++
630++ ql = progress_ui_handler_build_unity_quicklist (self);
631++ unity_launcher_entry_set_quicklist (entry, ql);
632++
633++ return ql;
634++}
635++
636++static DbusmenuMenuitem *
637++progress_ui_handler_ensure_unity_quicklist (NautilusProgressUIHandler *self)
638++{
639++ g_return_if_fail (self);
640++ GList *l;
641++
642++ DbusmenuMenuitem *ql = progress_ui_handler_build_unity_quicklist (self);
643++
644++ for (l = self->priv->launcher_entries; l; l = l->next) {
645++ UnityLauncherEntry *entry = l->data;
646++ unity_launcher_entry_set_quicklist (entry, ql);
647++ }
648++}
649++
650++static void
651++progress_ui_handler_show_unity_quicklist (NautilusProgressUIHandler *self,
652++ UnityLauncherEntry *entry,
653++ gboolean show)
654++{
655++ g_return_if_fail (self);
656++ g_return_if_fail (entry);
657++
658++ DbusmenuMenuitem *ql;
659++ GList *children, *l;
660++
661++ ql = progress_ui_handler_ensure_unity_entry_quicklist (self, entry);
662++
663++ dbusmenu_menuitem_property_set_bool (ql,
664++ DBUSMENU_MENUITEM_PROP_VISIBLE, show);
665++
666++ children = dbusmenu_menuitem_get_children (ql);
667++
668++ for (l = children; l; l = l->next) {
669++ DbusmenuMenuitem *child = l->data;
670++ dbusmenu_menuitem_property_set_bool(child,
671++ DBUSMENU_MENUITEM_PROP_VISIBLE, show);
672++ }
673++}
674++
675++static void
676++progress_ui_handler_unity_launcher_entry_add (NautilusProgressUIHandler *self,
677++ const gchar *entry_id)
678++{
679++ GList **entries;
680++ UnityLauncherEntry *entry;
681++
682++ entries = &(self->priv->launcher_entries);
683++ entry = unity_launcher_entry_get_for_desktop_id (entry_id);
684++
685++ if (entry) {
686++ *entries = g_list_prepend (*entries, entry);
687++ }
688++}
689++
690++static void
691++progress_ui_handler_update_unity_launcher_entry (NautilusProgressUIHandler *self,
692++ NautilusProgressInfo *info,
693++ UnityLauncherEntry *entry)
694++{
695++ g_return_if_fail (self);
696++ g_return_if_fail (entry);
697++
698++ if (self->priv->active_infos > 0) {
699++ unity_launcher_entry_set_count (entry, self->priv->active_infos);
700++ unity_launcher_entry_set_count_visible (entry, TRUE);
701++
702++ unity_launcher_entry_set_progress_visible (entry, TRUE);
703++ progress_ui_handler_show_unity_quicklist (self, entry, TRUE);
704++ } else {
705++ unity_launcher_entry_set_count_visible (entry, FALSE);
706++ unity_launcher_entry_set_progress_visible (entry, FALSE);
707++ progress_ui_handler_show_unity_quicklist (self, entry, FALSE);
708++ GCancellable *pc = nautilus_progress_info_get_cancellable (info);
709++
710++ if (!g_cancellable_is_cancelled (pc)) {
711++ unity_launcher_entry_set_urgent (entry, TRUE);
712++
713++ g_timeout_add_seconds (2, (GSourceFunc)
714++ progress_ui_handler_disable_unity_urgency,
715++ entry);
716++ }
717++ }
718++}
719++
720++static void
721++progress_ui_handler_update_unity_launcher (NautilusProgressUIHandler *self,
722++ NautilusProgressInfo *info,
723++ gboolean added)
724++{
725++ g_return_if_fail (self);
726++ GList *l;
727++
728++ if (!self->priv->launcher_entries) {
729++ progress_ui_handler_unity_launcher_entry_add (self, "nautilus.desktop");
730++ progress_ui_handler_unity_launcher_entry_add (self, "nautilus-home.desktop");
731++ g_return_if_fail (g_list_length (self->priv->launcher_entries) != 0);
732++
733++ progress_ui_handler_ensure_unity_quicklist (self);
734++ }
735++
736++ for (l = self->priv->launcher_entries; l; l = l->next) {
737++ UnityLauncherEntry *entry = l->data;
738++ progress_ui_handler_update_unity_launcher_entry (self, info, entry);
739++ }
740++
741++ if (added) {
742++ g_signal_connect (info, "progress-changed",
743++ (GCallback) progress_ui_handler_unity_progress_changed,
744++ self);
745++ }
746++}
747++#endif
748++
749+ static gboolean
750+ progress_window_delete_event (GtkWidget *widget,
751+ GdkEvent *event,
752+@@ -403,6 +654,10 @@
753+ progress_ui_handler_show_complete_notification (self);
754+ }
755+ }
756++
757++#ifdef HAVE_UNITY
758++ progress_ui_handler_update_unity_launcher (self, info, FALSE);
759++#endif
760+ }
761+
762+ static void
763+@@ -425,6 +680,10 @@
764+ progress_ui_handler_update_notification_or_status (self);
765+ }
766+ }
767++
768++#ifdef HAVE_UNITY
769++ progress_ui_handler_update_unity_launcher (self, info, TRUE);
770++#endif
771+ }
772+
773+ typedef struct {
774+Index: nautilus/libnautilus-private/nautilus-progress-info.c
775+===================================================================
776+--- nautilus.orig/libnautilus-private/nautilus-progress-info.c 2011-08-07 21:13:11.131766698 +0200
777++++ nautilus/libnautilus-private/nautilus-progress-info.c 2011-08-07 21:56:03.829423510 +0200
778+@@ -52,6 +52,8 @@
779+ char *status;
780+ char *details;
781+ double progress;
782++ double current;
783++ double total;
784+ gboolean activity_mode;
785+ gboolean started;
786+ gboolean finished;
787+@@ -233,6 +235,42 @@
788+ return res;
789+ }
790+
791++double
792++nautilus_progress_info_get_current (NautilusProgressInfo *info)
793++{
794++ int current;
795++
796++ G_LOCK (progress_info);
797++
798++ if (info->activity_mode) {
799++ current = 0.0;
800++ } else {
801++ current = info->current;
802++ }
803++
804++ G_UNLOCK (progress_info);
805++
806++ return current;
807++}
808++
809++double
810++nautilus_progress_info_get_total (NautilusProgressInfo *info)
811++{
812++ int total;
813++
814++ G_LOCK (progress_info);
815++
816++ if (info->activity_mode) {
817++ total = -1.0;
818++ } else {
819++ total = info->total;
820++ }
821++
822++ G_UNLOCK (progress_info);
823++
824++ return total;
825++}
826++
827+ void
828+ nautilus_progress_info_cancel (NautilusProgressInfo *info)
829+ {
830+@@ -566,6 +604,8 @@
831+ ) {
832+ info->activity_mode = FALSE;
833+ info->progress = current_percent;
834++ info->current = current;
835++ info->total = total;
836+ info->progress_at_idle = TRUE;
837+ queue_idle (info, FALSE);
838+ }
839+Index: nautilus/libnautilus-private/nautilus-progress-info.h
840+===================================================================
841+--- nautilus.orig/libnautilus-private/nautilus-progress-info.h 2011-08-07 21:13:11.191765945 +0200
842++++ nautilus/libnautilus-private/nautilus-progress-info.h 2011-08-07 21:56:12.969308604 +0200
843+@@ -62,6 +62,8 @@
844+ gboolean nautilus_progress_info_get_is_started (NautilusProgressInfo *info);
845+ gboolean nautilus_progress_info_get_is_finished (NautilusProgressInfo *info);
846+ gboolean nautilus_progress_info_get_is_paused (NautilusProgressInfo *info);
847++double nautilus_progress_info_get_current (NautilusProgressInfo *info);
848++double nautilus_progress_info_get_total (NautilusProgressInfo *info);
849+
850+ void nautilus_progress_info_start (NautilusProgressInfo *info);
851+ void nautilus_progress_info_finish (NautilusProgressInfo *info);
852
853=== modified file 'debian/patches/series'
854--- debian/patches/series 2011-08-07 21:22:32 +0000
855+++ debian/patches/series 2011-08-07 21:22:32 +0000
856@@ -10,3 +10,4 @@
857 10_show_in_unity.patch
858 11_copy_skipping_pager.patch
859
860+12_unity_launcher_support.patch
861
862=== modified file 'docs/Makefile.in'
863--- docs/Makefile.in 2011-08-07 21:22:32 +0000
864+++ docs/Makefile.in 2011-08-07 21:22:32 +0000
865@@ -243,6 +243,8 @@
866 SET_MAKE = @SET_MAKE@
867 SHELL = @SHELL@
868 STRIP = @STRIP@
869+UNITY_CFLAGS = @UNITY_CFLAGS@
870+UNITY_LIBS = @UNITY_LIBS@
871 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
872 USE_NLS = @USE_NLS@
873 VERSION = @VERSION@
874
875=== modified file 'docs/reference/Makefile.in'
876--- docs/reference/Makefile.in 2011-08-07 21:22:32 +0000
877+++ docs/reference/Makefile.in 2011-08-07 21:22:32 +0000
878@@ -218,6 +218,8 @@
879 SET_MAKE = @SET_MAKE@
880 SHELL = @SHELL@
881 STRIP = @STRIP@
882+UNITY_CFLAGS = @UNITY_CFLAGS@
883+UNITY_LIBS = @UNITY_LIBS@
884 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
885 USE_NLS = @USE_NLS@
886 VERSION = @VERSION@
887
888=== modified file 'docs/reference/libnautilus-extension/Makefile.in'
889--- docs/reference/libnautilus-extension/Makefile.in 2011-08-07 21:22:32 +0000
890+++ docs/reference/libnautilus-extension/Makefile.in 2011-08-07 21:22:32 +0000
891@@ -185,6 +185,8 @@
892 SET_MAKE = @SET_MAKE@
893 SHELL = @SHELL@
894 STRIP = @STRIP@
895+UNITY_CFLAGS = @UNITY_CFLAGS@
896+UNITY_LIBS = @UNITY_LIBS@
897 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
898 USE_NLS = @USE_NLS@
899 VERSION = @VERSION@
900
901=== modified file 'eel/Makefile.in'
902--- eel/Makefile.in 2011-08-07 21:22:32 +0000
903+++ eel/Makefile.in 2011-08-07 21:22:32 +0000
904@@ -232,6 +232,8 @@
905 SET_MAKE = @SET_MAKE@
906 SHELL = @SHELL@
907 STRIP = @STRIP@
908+UNITY_CFLAGS = @UNITY_CFLAGS@
909+UNITY_LIBS = @UNITY_LIBS@
910 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
911 USE_NLS = @USE_NLS@
912 VERSION = @VERSION@
913
914=== modified file 'icons/Makefile.in'
915--- icons/Makefile.in 2011-08-07 21:22:32 +0000
916+++ icons/Makefile.in 2011-08-07 21:22:32 +0000
917@@ -202,6 +202,8 @@
918 SET_MAKE = @SET_MAKE@
919 SHELL = @SHELL@
920 STRIP = @STRIP@
921+UNITY_CFLAGS = @UNITY_CFLAGS@
922+UNITY_LIBS = @UNITY_LIBS@
923 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
924 USE_NLS = @USE_NLS@
925 VERSION = @VERSION@
926
927=== modified file 'libnautilus-extension/Makefile.in'
928--- libnautilus-extension/Makefile.in 2011-08-07 21:22:32 +0000
929+++ libnautilus-extension/Makefile.in 2011-08-07 21:22:32 +0000
930@@ -255,6 +255,8 @@
931 SET_MAKE = @SET_MAKE@
932 SHELL = @SHELL@
933 STRIP = @STRIP@
934+UNITY_CFLAGS = @UNITY_CFLAGS@
935+UNITY_LIBS = @UNITY_LIBS@
936 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
937 USE_NLS = @USE_NLS@
938 VERSION = @VERSION@
939
940=== modified file 'libnautilus-private/Makefile.in'
941--- libnautilus-private/Makefile.in 2011-08-07 21:22:32 +0000
942+++ libnautilus-private/Makefile.in 2011-08-07 21:22:32 +0000
943@@ -287,6 +287,8 @@
944 SET_MAKE = @SET_MAKE@
945 SHELL = @SHELL@
946 STRIP = @STRIP@
947+UNITY_CFLAGS = @UNITY_CFLAGS@
948+UNITY_LIBS = @UNITY_LIBS@
949 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
950 USE_NLS = @USE_NLS@
951 VERSION = @VERSION@
952
953=== modified file 'libnautilus-private/nautilus-progress-info.c'
954--- libnautilus-private/nautilus-progress-info.c 2011-05-16 18:53:51 +0000
955+++ libnautilus-private/nautilus-progress-info.c 2011-08-07 21:22:32 +0000
956@@ -52,6 +52,8 @@
957 char *status;
958 char *details;
959 double progress;
960+ double current;
961+ double total;
962 gboolean activity_mode;
963 gboolean started;
964 gboolean finished;
965@@ -233,6 +235,42 @@
966 return res;
967 }
968
969+double
970+nautilus_progress_info_get_current (NautilusProgressInfo *info)
971+{
972+ int current;
973+
974+ G_LOCK (progress_info);
975+
976+ if (info->activity_mode) {
977+ current = 0.0;
978+ } else {
979+ current = info->current;
980+ }
981+
982+ G_UNLOCK (progress_info);
983+
984+ return current;
985+}
986+
987+double
988+nautilus_progress_info_get_total (NautilusProgressInfo *info)
989+{
990+ int total;
991+
992+ G_LOCK (progress_info);
993+
994+ if (info->activity_mode) {
995+ total = -1.0;
996+ } else {
997+ total = info->total;
998+ }
999+
1000+ G_UNLOCK (progress_info);
1001+
1002+ return total;
1003+}
1004+
1005 void
1006 nautilus_progress_info_cancel (NautilusProgressInfo *info)
1007 {
1008@@ -566,6 +604,8 @@
1009 ) {
1010 info->activity_mode = FALSE;
1011 info->progress = current_percent;
1012+ info->current = current;
1013+ info->total = total;
1014 info->progress_at_idle = TRUE;
1015 queue_idle (info, FALSE);
1016 }
1017
1018=== modified file 'libnautilus-private/nautilus-progress-info.h'
1019--- libnautilus-private/nautilus-progress-info.h 2009-05-04 12:17:03 +0000
1020+++ libnautilus-private/nautilus-progress-info.h 2011-08-07 21:22:32 +0000
1021@@ -62,6 +62,8 @@
1022 gboolean nautilus_progress_info_get_is_started (NautilusProgressInfo *info);
1023 gboolean nautilus_progress_info_get_is_finished (NautilusProgressInfo *info);
1024 gboolean nautilus_progress_info_get_is_paused (NautilusProgressInfo *info);
1025+double nautilus_progress_info_get_current (NautilusProgressInfo *info);
1026+double nautilus_progress_info_get_total (NautilusProgressInfo *info);
1027
1028 void nautilus_progress_info_start (NautilusProgressInfo *info);
1029 void nautilus_progress_info_finish (NautilusProgressInfo *info);
1030
1031=== modified file 'nautilus-sendto-extension/Makefile.in'
1032--- nautilus-sendto-extension/Makefile.in 2011-08-07 21:22:32 +0000
1033+++ nautilus-sendto-extension/Makefile.in 2011-08-07 21:22:32 +0000
1034@@ -238,6 +238,8 @@
1035 SET_MAKE = @SET_MAKE@
1036 SHELL = @SHELL@
1037 STRIP = @STRIP@
1038+UNITY_CFLAGS = @UNITY_CFLAGS@
1039+UNITY_LIBS = @UNITY_LIBS@
1040 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
1041 USE_NLS = @USE_NLS@
1042 VERSION = @VERSION@
1043
1044=== modified file 'src/Makefile.am'
1045--- src/Makefile.am 2011-08-07 21:22:32 +0000
1046+++ src/Makefile.am 2011-08-07 21:22:32 +0000
1047@@ -31,6 +31,7 @@
1048 -DVERSION="\"$(VERSION)\"" \
1049 $(DISABLE_DEPRECATED_CFLAGS) \
1050 $(APP_INDICATOR_CFLAGS) \
1051+ $(UNITY_CFLAGS) \
1052 $(NULL)
1053
1054 LDADD =\
1055@@ -43,6 +44,7 @@
1056 $(EXEMPI_LIBS) \
1057 $(POPT_LIBS) \
1058 $(APP_INDICATOR_LIBS) \
1059+ $(UNITY_LIBS) \
1060 $(NULL)
1061
1062 nautilus_SOURCES = \
1063
1064=== modified file 'src/Makefile.in'
1065--- src/Makefile.in 2011-08-07 21:22:32 +0000
1066+++ src/Makefile.in 2011-08-07 21:22:32 +0000
1067@@ -161,7 +161,7 @@
1068 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1069 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1070 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1071- $(am__DEPENDENCIES_1)
1072+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
1073 AM_V_lt = $(am__v_lt_$(V))
1074 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
1075 am__v_lt_0 = --silent
1076@@ -175,7 +175,7 @@
1077 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1078 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1079 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1080- $(am__DEPENDENCIES_1)
1081+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
1082 am_nautilus_connect_server_OBJECTS = nautilus-bookmark-list.$(OBJEXT) \
1083 nautilus-connect-server-dialog.$(OBJEXT) \
1084 nautilus-connect-server-dialog-main.$(OBJEXT) \
1085@@ -188,7 +188,7 @@
1086 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1087 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1088 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1089- $(am__DEPENDENCIES_1)
1090+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
1091 am_nautilus_convert_metadata_OBJECTS = \
1092 nautilus-convert-metadata.$(OBJEXT) $(am__objects_1)
1093 nautilus_convert_metadata_OBJECTS = \
1094@@ -199,7 +199,7 @@
1095 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1096 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1097 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
1098- $(am__DEPENDENCIES_1)
1099+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
1100 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
1101 depcomp = $(SHELL) $(top_srcdir)/depcomp
1102 am__depfiles_maybe = depfiles
1103@@ -382,6 +382,8 @@
1104 SET_MAKE = @SET_MAKE@
1105 SHELL = @SHELL@
1106 STRIP = @STRIP@
1107+UNITY_CFLAGS = @UNITY_CFLAGS@
1108+UNITY_LIBS = @UNITY_LIBS@
1109 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
1110 USE_NLS = @USE_NLS@
1111 VERSION = @VERSION@
1112@@ -462,6 +464,7 @@
1113 -DVERSION="\"$(VERSION)\"" \
1114 $(DISABLE_DEPRECATED_CFLAGS) \
1115 $(APP_INDICATOR_CFLAGS) \
1116+ $(UNITY_CFLAGS) \
1117 $(NULL)
1118
1119 LDADD = \
1120@@ -474,6 +477,7 @@
1121 $(EXEMPI_LIBS) \
1122 $(POPT_LIBS) \
1123 $(APP_INDICATOR_LIBS) \
1124+ $(UNITY_LIBS) \
1125 $(NULL)
1126
1127 nautilus_SOURCES = nautilus-actions.h nautilus-application.c \
1128
1129=== modified file 'src/nautilus-progress-ui-handler.c'
1130--- src/nautilus-progress-ui-handler.c 2011-08-07 21:22:32 +0000
1131+++ src/nautilus-progress-ui-handler.c 2011-08-07 21:22:32 +0000
1132@@ -41,6 +41,10 @@
1133 #include <libappindicator/app-indicator.h>
1134 #endif
1135
1136+#ifdef HAVE_UNITY
1137+#include <unity.h>
1138+#endif
1139+
1140 struct _NautilusProgressUIHandlerPriv {
1141 NautilusProgressInfoManager *manager;
1142
1143@@ -55,6 +59,9 @@
1144 #else
1145 GtkStatusIcon *status_icon;
1146 #endif
1147+#ifdef HAVE_UNITY
1148+ GList *launcher_entries;
1149+#endif
1150 };
1151
1152 G_DEFINE_TYPE (NautilusProgressUIHandler, nautilus_progress_ui_handler, G_TYPE_OBJECT);
1153@@ -259,6 +266,250 @@
1154 g_free (tooltip);
1155 }
1156
1157+#ifdef HAVE_UNITY
1158+
1159+static void
1160+progress_ui_handler_unity_progress_changed (NautilusProgressInfo *info,
1161+ NautilusProgressUIHandler *self)
1162+{
1163+ g_return_if_fail (self);
1164+ g_return_if_fail (self->priv->launcher_entries);
1165+ g_return_if_fail (self->priv->manager);
1166+
1167+ GList *infos, *l;
1168+ double progress;
1169+ size_t info_n = 0;
1170+ double c, current = 0;
1171+ double t, total = 0;
1172+
1173+ infos = nautilus_progress_info_manager_get_all_infos (self->priv->manager);
1174+
1175+ for (l = infos; l; l = l->next) {
1176+ NautilusProgressInfo *i = l->data;
1177+ c = nautilus_progress_info_get_current (i);
1178+ t = nautilus_progress_info_get_total (i);
1179+
1180+ if (c < 0) c = 0;
1181+ if (t <= 0) continue;
1182+
1183+ total += t;
1184+ current += c;
1185+ info_n++;
1186+ }
1187+
1188+ progress = current / total;
1189+ if (progress > 1.0)
1190+ progress = 1.0;
1191+
1192+ for (l = self->priv->launcher_entries; l; l = l->next) {
1193+ UnityLauncherEntry *entry = l->data;
1194+ unity_launcher_entry_set_progress (entry, progress);
1195+ }
1196+}
1197+
1198+static void
1199+progress_ui_handler_disable_unity_urgency (UnityLauncherEntry *entry)
1200+{
1201+ g_return_if_fail (entry);
1202+
1203+ unity_launcher_entry_set_urgent (entry, FALSE);
1204+}
1205+
1206+static void
1207+progress_ui_handler_unity_quicklist_show_activated (DbusmenuMenuitem *menu,
1208+ guint timestamp,
1209+ NautilusProgressUIHandler *self)
1210+{
1211+ g_return_if_fail (self);
1212+
1213+ if (!gtk_widget_get_visible (self->priv->progress_window)) {
1214+ gtk_window_present (GTK_WINDOW (self->priv->progress_window));
1215+ } else {
1216+ gtk_window_set_keep_above (GTK_WINDOW (self->priv->progress_window), TRUE);
1217+ gtk_window_set_keep_above (GTK_WINDOW (self->priv->progress_window), FALSE);
1218+ }
1219+}
1220+
1221+static void
1222+progress_ui_handler_unity_quicklist_cancel_activated (DbusmenuMenuitem *menu,
1223+ guint timestamp,
1224+ NautilusProgressUIHandler *self)
1225+{
1226+ g_return_if_fail (self);
1227+ g_return_if_fail (self->priv->manager);
1228+
1229+ GList *infos, *l;
1230+ infos = nautilus_progress_info_manager_get_all_infos (self->priv->manager);
1231+
1232+ for (l = infos; l; l = l->next) {
1233+ NautilusProgressInfo *info = l->data;
1234+ nautilus_progress_info_cancel (info);
1235+ }
1236+}
1237+
1238+static DbusmenuMenuitem *
1239+progress_ui_handler_build_unity_quicklist (NautilusProgressUIHandler *self)
1240+{
1241+ DbusmenuMenuitem *ql = dbusmenu_menuitem_new ();
1242+ dbusmenu_menuitem_property_set_bool (ql,
1243+ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
1244+
1245+ DbusmenuMenuitem *quickmenu = dbusmenu_menuitem_new ();
1246+ dbusmenu_menuitem_property_set (quickmenu,
1247+ DBUSMENU_MENUITEM_PROP_LABEL,
1248+ _("Show copy dialog"));
1249+ dbusmenu_menuitem_property_set_bool (quickmenu,
1250+ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
1251+ dbusmenu_menuitem_child_append (ql, quickmenu);
1252+ g_signal_connect (quickmenu, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
1253+ (GCallback) progress_ui_handler_unity_quicklist_show_activated,
1254+ self);
1255+
1256+ quickmenu = dbusmenu_menuitem_new ();
1257+ dbusmenu_menuitem_property_set (quickmenu,
1258+ DBUSMENU_MENUITEM_PROP_LABEL,
1259+ _("Cancel all in-progress actions"));
1260+ dbusmenu_menuitem_property_set_bool (quickmenu,
1261+ DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
1262+ dbusmenu_menuitem_child_append (ql, quickmenu);
1263+ g_signal_connect (quickmenu, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
1264+ (GCallback) progress_ui_handler_unity_quicklist_cancel_activated,
1265+ self);
1266+
1267+ return ql;
1268+}
1269+
1270+static DbusmenuMenuitem *
1271+progress_ui_handler_ensure_unity_entry_quicklist (NautilusProgressUIHandler *self,
1272+ UnityLauncherEntry *entry)
1273+{
1274+ g_return_if_fail (self);
1275+ DbusmenuMenuitem *ql;
1276+
1277+ ql = unity_launcher_entry_get_quicklist (entry);
1278+
1279+ if (ql)
1280+ return ql;
1281+
1282+ ql = progress_ui_handler_build_unity_quicklist (self);
1283+ unity_launcher_entry_set_quicklist (entry, ql);
1284+
1285+ return ql;
1286+}
1287+
1288+static DbusmenuMenuitem *
1289+progress_ui_handler_ensure_unity_quicklist (NautilusProgressUIHandler *self)
1290+{
1291+ g_return_if_fail (self);
1292+ GList *l;
1293+
1294+ DbusmenuMenuitem *ql = progress_ui_handler_build_unity_quicklist (self);
1295+
1296+ for (l = self->priv->launcher_entries; l; l = l->next) {
1297+ UnityLauncherEntry *entry = l->data;
1298+ unity_launcher_entry_set_quicklist (entry, ql);
1299+ }
1300+}
1301+
1302+static void
1303+progress_ui_handler_show_unity_quicklist (NautilusProgressUIHandler *self,
1304+ UnityLauncherEntry *entry,
1305+ gboolean show)
1306+{
1307+ g_return_if_fail (self);
1308+ g_return_if_fail (entry);
1309+
1310+ DbusmenuMenuitem *ql;
1311+ GList *children, *l;
1312+
1313+ ql = progress_ui_handler_ensure_unity_entry_quicklist (self, entry);
1314+
1315+ dbusmenu_menuitem_property_set_bool (ql,
1316+ DBUSMENU_MENUITEM_PROP_VISIBLE, show);
1317+
1318+ children = dbusmenu_menuitem_get_children (ql);
1319+
1320+ for (l = children; l; l = l->next) {
1321+ DbusmenuMenuitem *child = l->data;
1322+ dbusmenu_menuitem_property_set_bool(child,
1323+ DBUSMENU_MENUITEM_PROP_VISIBLE, show);
1324+ }
1325+}
1326+
1327+static void
1328+progress_ui_handler_unity_launcher_entry_add (NautilusProgressUIHandler *self,
1329+ const gchar *entry_id)
1330+{
1331+ GList **entries;
1332+ UnityLauncherEntry *entry;
1333+
1334+ entries = &(self->priv->launcher_entries);
1335+ entry = unity_launcher_entry_get_for_desktop_id (entry_id);
1336+
1337+ if (entry) {
1338+ *entries = g_list_prepend (*entries, entry);
1339+ }
1340+}
1341+
1342+static void
1343+progress_ui_handler_update_unity_launcher_entry (NautilusProgressUIHandler *self,
1344+ NautilusProgressInfo *info,
1345+ UnityLauncherEntry *entry)
1346+{
1347+ g_return_if_fail (self);
1348+ g_return_if_fail (entry);
1349+
1350+ if (self->priv->active_infos > 0) {
1351+ unity_launcher_entry_set_count (entry, self->priv->active_infos);
1352+ unity_launcher_entry_set_count_visible (entry, TRUE);
1353+
1354+ unity_launcher_entry_set_progress_visible (entry, TRUE);
1355+ progress_ui_handler_show_unity_quicklist (self, entry, TRUE);
1356+ } else {
1357+ unity_launcher_entry_set_count_visible (entry, FALSE);
1358+ unity_launcher_entry_set_progress_visible (entry, FALSE);
1359+ progress_ui_handler_show_unity_quicklist (self, entry, FALSE);
1360+ GCancellable *pc = nautilus_progress_info_get_cancellable (info);
1361+
1362+ if (!g_cancellable_is_cancelled (pc)) {
1363+ unity_launcher_entry_set_urgent (entry, TRUE);
1364+
1365+ g_timeout_add_seconds (2, (GSourceFunc)
1366+ progress_ui_handler_disable_unity_urgency,
1367+ entry);
1368+ }
1369+ }
1370+}
1371+
1372+static void
1373+progress_ui_handler_update_unity_launcher (NautilusProgressUIHandler *self,
1374+ NautilusProgressInfo *info,
1375+ gboolean added)
1376+{
1377+ g_return_if_fail (self);
1378+ GList *l;
1379+
1380+ if (!self->priv->launcher_entries) {
1381+ progress_ui_handler_unity_launcher_entry_add (self, "nautilus.desktop");
1382+ progress_ui_handler_unity_launcher_entry_add (self, "nautilus-home.desktop");
1383+ g_return_if_fail (g_list_length (self->priv->launcher_entries) != 0);
1384+
1385+ progress_ui_handler_ensure_unity_quicklist (self);
1386+ }
1387+
1388+ for (l = self->priv->launcher_entries; l; l = l->next) {
1389+ UnityLauncherEntry *entry = l->data;
1390+ progress_ui_handler_update_unity_launcher_entry (self, info, entry);
1391+ }
1392+
1393+ if (added) {
1394+ g_signal_connect (info, "progress-changed",
1395+ (GCallback) progress_ui_handler_unity_progress_changed,
1396+ self);
1397+ }
1398+}
1399+#endif
1400+
1401 static gboolean
1402 progress_window_delete_event (GtkWidget *widget,
1403 GdkEvent *event,
1404@@ -403,6 +654,10 @@
1405 progress_ui_handler_show_complete_notification (self);
1406 }
1407 }
1408+
1409+#ifdef HAVE_UNITY
1410+ progress_ui_handler_update_unity_launcher (self, info, FALSE);
1411+#endif
1412 }
1413
1414 static void
1415@@ -425,6 +680,10 @@
1416 progress_ui_handler_update_notification_or_status (self);
1417 }
1418 }
1419+
1420+#ifdef HAVE_UNITY
1421+ progress_ui_handler_update_unity_launcher (self, info, TRUE);
1422+#endif
1423 }
1424
1425 typedef struct {
1426
1427=== modified file 'test/Makefile.in'
1428--- test/Makefile.in 2011-08-07 21:22:32 +0000
1429+++ test/Makefile.in 2011-08-07 21:22:32 +0000
1430@@ -247,6 +247,8 @@
1431 SET_MAKE = @SET_MAKE@
1432 SHELL = @SHELL@
1433 STRIP = @STRIP@
1434+UNITY_CFLAGS = @UNITY_CFLAGS@
1435+UNITY_LIBS = @UNITY_LIBS@
1436 UPDATE_MIME_DATABASE = @UPDATE_MIME_DATABASE@
1437 USE_NLS = @USE_NLS@
1438 VERSION = @VERSION@

Subscribers

People subscribed via source and target branches