Merge lp:~dobey/ubuntu/lucid/ubuntuone-client/trunk into lp:ubuntu/lucid/ubuntuone-client
- Lucid (10.04)
- trunk
- Merge into lucid
Proposed by
dobey
on 2010-02-18
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~dobey/ubuntu/lucid/ubuntuone-client/trunk |
| Merge into: | lp:ubuntu/lucid/ubuntuone-client |
| Diff against target: |
28479 lines (+12474/-8183) 92 files modified
Makefile.am (+15/-6) Makefile.in (+26/-14) aclocal.m4 (+21/-5) bin/u1sdtool (+133/-57) bin/ubuntuone-client-applet (+0/-1063) bin/ubuntuone-client-preferences (+0/-360) bin/ubuntuone-login (+226/-0) bin/ubuntuone-preferences (+549/-0) bin/ubuntuone-syncdaemon (+6/-5) config.guess (+21/-49) config.sub (+11/-4) configure (+198/-115) configure.ac (+28/-2) contrib/dbus-docs (+196/-0) contrib/dbus_util.py (+72/-0) contrib/test (+16/-36) contrib/testing/testcase.py (+181/-48) data/Makefile.am (+19/-4) data/Makefile.in (+57/-20) data/com.ubuntuone.Authentication.service.in (+1/-1) data/logging.conf (+13/-0) data/logging.conf.in (+13/-0) data/syncdaemon.conf (+8/-8) data/ubuntuone-client-applet.desktop.in (+0/-9) data/ubuntuone-icons.rendercache (+1/-2) data/ubuntuone-icons.svg (+1017/-5096) data/ubuntuone-preferences.desktop.in (+14/-0) data/ubuntuone.menu.in (+1/-0) debian/changelog (+6/-0) debian/control (+7/-4) debian/python-ubuntuone-client.install (+1/-0) debian/ubuntuone-client-gnome.install (+4/-5) debian/ubuntuone-client.install (+1/-3) docs/man/u1sdtool.1 (+109/-15) docs/man/ubuntuone-client-applet.1 (+0/-16) docs/man/ubuntuone-client-preferences.1 (+0/-16) docs/man/ubuntuone-preferences.1 (+16/-0) docs/syncdaemon_dbus_api.txt (+280/-0) ltmain.sh (+4/-4) m4/libtool.m4 (+7/-6) m4/ltversion.m4 (+5/-5) nautilus/Makefile.am (+28/-0) nautilus/Makefile.in (+148/-19) nautilus/contacts-view.c (+507/-0) nautilus/contacts-view.h (+66/-0) nautilus/test-contacts-picker.c (+98/-0) nautilus/u1-contacts-picker.c (+170/-0) nautilus/u1-contacts-picker.h (+58/-0) nautilus/ubuntuone-marshallers.c (+123/-0) nautilus/ubuntuone-marshallers.list (+4/-0) nautilus/ubuntuone-nautilus.c (+147/-28) po/POTFILES.in (+4/-3) po/POTFILES.skip (+1/-0) tests/oauthdesktop/test_auth.py (+7/-1) tests/syncdaemon/test_action_predicates.py (+10/-5) tests/syncdaemon/test_action_queue.py (+487/-7) tests/syncdaemon/test_config.py (+154/-39) tests/syncdaemon/test_dbus.py (+689/-60) tests/syncdaemon/test_eq_inotify.py (+528/-19) tests/syncdaemon/test_eventqueue.py (+13/-1) tests/syncdaemon/test_fileshelf.py (+30/-1) tests/syncdaemon/test_fsm.py (+86/-58) tests/syncdaemon/test_hashqueue.py (+49/-9) tests/syncdaemon/test_localrescan.py (+415/-79) tests/syncdaemon/test_logger.py (+77/-0) tests/syncdaemon/test_sync.py (+46/-4) tests/syncdaemon/test_tools.py (+201/-8) tests/syncdaemon/test_u1sdtool.py (+102/-3) tests/syncdaemon/test_vm.py (+1763/-249) tests/test_login.py (+187/-0) tests/test_preferences.py (+247/-0) ubuntuone/oauthdesktop/auth.py (+6/-4) ubuntuone/oauthdesktop/main.py (+2/-2) ubuntuone/syncdaemon/__init__.py (+1/-0) ubuntuone/syncdaemon/action_queue.py (+298/-127) ubuntuone/syncdaemon/config.py (+180/-24) ubuntuone/syncdaemon/dbus_interface.py (+442/-31) ubuntuone/syncdaemon/event_queue.py (+161/-25) ubuntuone/syncdaemon/events_nanny.py (+7/-7) ubuntuone/syncdaemon/file_shelf.py (+19/-3) ubuntuone/syncdaemon/filesystem_manager.py (+51/-35) ubuntuone/syncdaemon/fsm/fsm.py (+3/-3) ubuntuone/syncdaemon/local_rescan.py (+88/-30) ubuntuone/syncdaemon/logger.py (+70/-15) ubuntuone/syncdaemon/main.py (+53/-58) ubuntuone/syncdaemon/marker.py (+3/-0) ubuntuone/syncdaemon/sync.py (+42/-16) ubuntuone/syncdaemon/tools.py (+244/-8) ubuntuone/syncdaemon/u1fsfsm.py (+77/-12) ubuntuone/syncdaemon/volume_manager.py (+973/-191) ubuntuone/u1sync/client.py (+23/-18) ubuntuone/u1sync/main.py (+3/-3) |
| To merge this branch: | bzr merge lp:~dobey/ubuntu/lucid/ubuntuone-client/trunk |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ubuntu branches | 2010-02-18 | Pending | |
|
Review via email:
|
|||
Commit Message
Description of the Change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'Makefile.am' |
| 2 | --- Makefile.am 2009-09-28 18:15:00 +0000 |
| 3 | +++ Makefile.am 2010-02-18 00:10:25 +0000 |
| 4 | @@ -18,17 +18,17 @@ |
| 5 | |
| 6 | # Install our scripts and extra data here |
| 7 | bin_SCRIPTS = \ |
| 8 | - bin/ubuntuone-client-applet \ |
| 9 | - bin/ubuntuone-client-preferences \ |
| 10 | + bin/ubuntuone-preferences \ |
| 11 | bin/u1sdtool \ |
| 12 | bin/u1sync |
| 13 | |
| 14 | -libexec_SCRIPTS = bin/ubuntuone-syncdaemon |
| 15 | +libexec_SCRIPTS = \ |
| 16 | + bin/ubuntuone-login \ |
| 17 | + bin/ubuntuone-syncdaemon |
| 18 | |
| 19 | manfilesdir = $(mandir)/man1 |
| 20 | manfiles_DATA = \ |
| 21 | - docs/man/ubuntuone-client-preferences.1 \ |
| 22 | - docs/man/ubuntuone-client-applet.1 \ |
| 23 | + docs/man/ubuntuone-preferences.1 \ |
| 24 | docs/man/u1sdtool.1 \ |
| 25 | docs/man/u1sync.1 |
| 26 | |
| 27 | @@ -52,16 +52,25 @@ |
| 28 | fi; \ |
| 29 | fi |
| 30 | |
| 31 | +logging.conf: data/logging.conf.in Makefile |
| 32 | + $(MAKE) -C data logging.conf |
| 33 | + |
| 34 | lint: protocol pylintrc Makefile |
| 35 | PYTHONPATH="$(PYTHONPATH)" SRCDIR="$(srcdir)" USE_PYFLAKES="true" \ |
| 36 | $(PYTHON) $(srcdir)/contrib/pylint-wrapper |
| 37 | |
| 38 | -check: lint Makefile |
| 39 | +test: protocol logging.conf $(clientdefs_DATA) Makefile |
| 40 | if test "x$(builddir)" == "x$(srcdir)"; then \ |
| 41 | PYTHONPATH="$(PYTHONPATH)" $(PYTHON) $(srcdir)/contrib/test; \ |
| 42 | fi |
| 43 | rm -rf _trial_temp |
| 44 | |
| 45 | +check: lint test Makefile |
| 46 | + |
| 47 | +docs: protocol Makefile |
| 48 | + PYTHONPATH="$(PYTHONPATH)" $(PYTHON) $(srcdir)/contrib/dbus-docs |
| 49 | + |
| 50 | + |
| 51 | protocol: ubuntuone Makefile |
| 52 | PROTOCOL="ubuntuone/storageprotocol"; \ |
| 53 | if [ ! -d $(USP_PATH) ]; then \ |
| 54 | |
| 55 | === modified file 'Makefile.in' |
| 56 | --- Makefile.in 2009-09-28 18:15:00 +0000 |
| 57 | +++ Makefile.in 2010-02-18 00:10:25 +0000 |
| 58 | @@ -1,4 +1,4 @@ |
| 59 | -# Makefile.in generated by automake 1.11 from Makefile.am. |
| 60 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. |
| 61 | # @configure_input@ |
| 62 | |
| 63 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
| 64 | @@ -183,6 +183,8 @@ |
| 65 | LIPO = @LIPO@ |
| 66 | LNDIR = @LNDIR@ |
| 67 | LN_S = @LN_S@ |
| 68 | +LOG_FILE_SIZE = @LOG_FILE_SIZE@ |
| 69 | +LOG_LEVEL = @LOG_LEVEL@ |
| 70 | LTLIBOBJS = @LTLIBOBJS@ |
| 71 | MAKEINFO = @MAKEINFO@ |
| 72 | MKDIR_P = @MKDIR_P@ |
| 73 | @@ -293,16 +295,17 @@ |
| 74 | |
| 75 | # Install our scripts and extra data here |
| 76 | bin_SCRIPTS = \ |
| 77 | - bin/ubuntuone-client-applet \ |
| 78 | - bin/ubuntuone-client-preferences \ |
| 79 | + bin/ubuntuone-preferences \ |
| 80 | bin/u1sdtool \ |
| 81 | bin/u1sync |
| 82 | |
| 83 | -libexec_SCRIPTS = bin/ubuntuone-syncdaemon |
| 84 | +libexec_SCRIPTS = \ |
| 85 | + bin/ubuntuone-login \ |
| 86 | + bin/ubuntuone-syncdaemon |
| 87 | + |
| 88 | manfilesdir = $(mandir)/man1 |
| 89 | manfiles_DATA = \ |
| 90 | - docs/man/ubuntuone-client-preferences.1 \ |
| 91 | - docs/man/ubuntuone-client-applet.1 \ |
| 92 | + docs/man/ubuntuone-preferences.1 \ |
| 93 | docs/man/u1sdtool.1 \ |
| 94 | docs/man/u1sync.1 |
| 95 | |
| 96 | @@ -522,7 +525,7 @@ |
| 97 | # (which will cause the Makefiles to be regenerated when you run `make'); |
| 98 | # (2) otherwise, pass the desired values on the `make' command line. |
| 99 | $(RECURSIVE_TARGETS): |
| 100 | - @failcom='exit 1'; \ |
| 101 | + @fail= failcom='exit 1'; \ |
| 102 | for f in x $$MAKEFLAGS; do \ |
| 103 | case $$f in \ |
| 104 | *=* | --[!k]*);; \ |
| 105 | @@ -547,7 +550,7 @@ |
| 106 | fi; test -z "$$fail" |
| 107 | |
| 108 | $(RECURSIVE_CLEAN_TARGETS): |
| 109 | - @failcom='exit 1'; \ |
| 110 | + @fail= failcom='exit 1'; \ |
| 111 | for f in x $$MAKEFLAGS; do \ |
| 112 | case $$f in \ |
| 113 | *=* | --[!k]*);; \ |
| 114 | @@ -711,7 +714,8 @@ |
| 115 | fi; \ |
| 116 | done |
| 117 | -test -n "$(am__skip_mode_fix)" \ |
| 118 | - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ |
| 119 | + || find "$(distdir)" -type d ! -perm -755 \ |
| 120 | + -exec chmod u+rwx,go+rx {} \; -o \ |
| 121 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ |
| 122 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ |
| 123 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ |
| 124 | @@ -755,17 +759,17 @@ |
| 125 | distcheck: dist |
| 126 | case '$(DIST_ARCHIVES)' in \ |
| 127 | *.tar.gz*) \ |
| 128 | - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ |
| 129 | + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ |
| 130 | *.tar.bz2*) \ |
| 131 | - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ |
| 132 | + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ |
| 133 | *.tar.lzma*) \ |
| 134 | - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ |
| 135 | + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ |
| 136 | *.tar.xz*) \ |
| 137 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ |
| 138 | *.tar.Z*) \ |
| 139 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ |
| 140 | *.shar.gz*) \ |
| 141 | - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ |
| 142 | + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ |
| 143 | *.zip*) \ |
| 144 | unzip $(distdir).zip ;;\ |
| 145 | esac |
| 146 | @@ -970,16 +974,24 @@ |
| 147 | fi; \ |
| 148 | fi |
| 149 | |
| 150 | +logging.conf: data/logging.conf.in Makefile |
| 151 | + $(MAKE) -C data logging.conf |
| 152 | + |
| 153 | lint: protocol pylintrc Makefile |
| 154 | PYTHONPATH="$(PYTHONPATH)" SRCDIR="$(srcdir)" USE_PYFLAKES="true" \ |
| 155 | $(PYTHON) $(srcdir)/contrib/pylint-wrapper |
| 156 | |
| 157 | -check: lint Makefile |
| 158 | +test: protocol logging.conf $(clientdefs_DATA) Makefile |
| 159 | if test "x$(builddir)" == "x$(srcdir)"; then \ |
| 160 | PYTHONPATH="$(PYTHONPATH)" $(PYTHON) $(srcdir)/contrib/test; \ |
| 161 | fi |
| 162 | rm -rf _trial_temp |
| 163 | |
| 164 | +check: lint test Makefile |
| 165 | + |
| 166 | +docs: protocol Makefile |
| 167 | + PYTHONPATH="$(PYTHONPATH)" $(PYTHON) $(srcdir)/contrib/dbus-docs |
| 168 | + |
| 169 | protocol: ubuntuone Makefile |
| 170 | PROTOCOL="ubuntuone/storageprotocol"; \ |
| 171 | if [ ! -d $(USP_PATH) ]; then \ |
| 172 | |
| 173 | === modified file 'aclocal.m4' |
| 174 | --- aclocal.m4 2009-08-26 12:15:00 +0000 |
| 175 | +++ aclocal.m4 2010-02-18 00:10:25 +0000 |
| 176 | @@ -1,4 +1,4 @@ |
| 177 | -# generated automatically by aclocal 1.11 -*- Autoconf -*- |
| 178 | +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- |
| 179 | |
| 180 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 181 | # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
| 182 | @@ -13,8 +13,8 @@ |
| 183 | |
| 184 | m4_ifndef([AC_AUTOCONF_VERSION], |
| 185 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
| 186 | -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, |
| 187 | -[m4_warning([this file was generated for autoconf 2.64. |
| 188 | +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, |
| 189 | +[m4_warning([this file was generated for autoconf 2.65. |
| 190 | You have another version of autoconf. It may work, but is not guaranteed to. |
| 191 | If you have problems, you may need to regenerate the build system entirely. |
| 192 | To do so, use the procedure documented by the package, typically `autoreconf'.])]) |
| 193 | @@ -224,7 +224,7 @@ |
| 194 | [am__api_version='1.11' |
| 195 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
| 196 | dnl require some minimum version. Point them to the right macro. |
| 197 | -m4_if([$1], [1.11], [], |
| 198 | +m4_if([$1], [1.11.1], [], |
| 199 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
| 200 | ]) |
| 201 | |
| 202 | @@ -240,7 +240,7 @@ |
| 203 | # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
| 204 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
| 205 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
| 206 | -[AM_AUTOMAKE_VERSION([1.11])dnl |
| 207 | +[AM_AUTOMAKE_VERSION([1.11.1])dnl |
| 208 | m4_ifndef([AC_AUTOCONF_VERSION], |
| 209 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
| 210 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
| 211 | @@ -1068,6 +1068,14 @@ |
| 212 | am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` |
| 213 | am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` |
| 214 | ;; |
| 215 | + *) |
| 216 | + case $am_py_prefix in |
| 217 | + /usr|/System*) ;; |
| 218 | + *) |
| 219 | + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages |
| 220 | + ;; |
| 221 | + esac |
| 222 | + ;; |
| 223 | esac |
| 224 | ]) |
| 225 | AC_SUBST([pythondir], [$am_cv_python_pythondir]) |
| 226 | @@ -1098,6 +1106,14 @@ |
| 227 | am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` |
| 228 | am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` |
| 229 | ;; |
| 230 | + *) |
| 231 | + case $am_py_exec_prefix in |
| 232 | + /usr|/System*) ;; |
| 233 | + *) |
| 234 | + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages |
| 235 | + ;; |
| 236 | + esac |
| 237 | + ;; |
| 238 | esac |
| 239 | ]) |
| 240 | AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) |
| 241 | |
| 242 | === modified file 'bin/u1sdtool' |
| 243 | --- bin/u1sdtool 2009-12-07 17:35:00 +0000 |
| 244 | +++ bin/u1sdtool 2010-02-18 00:10:25 +0000 |
| 245 | @@ -28,7 +28,7 @@ |
| 246 | |
| 247 | from dbus.mainloop.glib import DBusGMainLoop |
| 248 | from optparse import OptionParser |
| 249 | -from twisted.internet import reactor |
| 250 | +from twisted.internet import reactor, defer |
| 251 | |
| 252 | from ubuntuone.syncdaemon.tools import SyncDaemonTool |
| 253 | from ubuntuone.syncdaemon.dbus_interface import DBUS_IFACE_NAME |
| 254 | @@ -38,45 +38,16 @@ |
| 255 | show_downloads, |
| 256 | show_shares, |
| 257 | show_shared, |
| 258 | + show_folders, |
| 259 | + show_error, |
| 260 | + show_state, |
| 261 | + show_waiting_content, |
| 262 | + is_running, |
| 263 | ) |
| 264 | |
| 265 | |
| 266 | -def main(argv, stdout): |
| 267 | - usage = "Usage: %prog [option]" |
| 268 | - parser = OptionParser(usage=usage) |
| 269 | - parser.add_option("-w", "--wait", dest="wait", action="store_true", |
| 270 | - help="Wait until ubuntuone-syncdaemon reaches nirvana") |
| 271 | - parser.add_option("", "--accept-share", dest="accept_share", |
| 272 | - metavar="SHARE_ID", |
| 273 | - help="accept the share with the specified id") |
| 274 | - parser.add_option("", "--reject-share", dest="reject_share", |
| 275 | - metavar="SHARE_ID", |
| 276 | - help="reject the share with the specified id") |
| 277 | - parser.add_option("", "--list-shares", dest="list_shares", |
| 278 | - action="store_true", |
| 279 | - help=" get the list of shares") |
| 280 | - parser.add_option("", "--refresh-shares", dest="refresh_shares", |
| 281 | - action="store_true", |
| 282 | - help=" request a refresh of the list of shares to" |
| 283 | - " the server") |
| 284 | - parser.add_option("", "--offer-share", dest="offer_share", |
| 285 | - metavar="PATH USER SHARE_NAME ACCESS_LEVEL", |
| 286 | - help=" share PATH to USER. ") |
| 287 | - parser.add_option("", "--list-shared", dest="list_shared", |
| 288 | - action="store_true", |
| 289 | - help=" list the shared path's/shares offered. ") |
| 290 | - parser.add_option("", "--refresh", dest="refresh_path", |
| 291 | - metavar="PATH", help=" request a refresh of PATH") |
| 292 | - parser.add_option("", "--info", dest="path_info", |
| 293 | - metavar="PATH", help=" request the metadata of PATH") |
| 294 | - parser.add_option("", "--current-transfers", dest="current_transfers", |
| 295 | - action="store_true", |
| 296 | - help=" show the current uploads and downloads") |
| 297 | - parser.add_option("-q", "--quit", dest="quit", action='store_true', |
| 298 | - help="shutdown the syncdaemon") |
| 299 | - |
| 300 | - (options, args) = parser.parse_args(argv) |
| 301 | - |
| 302 | +def main(options, args, stdout): |
| 303 | + """entry point""" |
| 304 | loop = DBusGMainLoop(set_as_default=True) |
| 305 | bus = dbus.SessionBus(mainloop=loop) |
| 306 | sync_daemon_tool = SyncDaemonTool(bus) |
| 307 | @@ -86,6 +57,28 @@ |
| 308 | if out_encoding is None: |
| 309 | out_encoding = 'utf-8' |
| 310 | out = codecs.getwriter(out_encoding)(stdout, errors='replace') |
| 311 | + # start syncdaemon if it's required |
| 312 | + if not is_running() and not options.quit and not options.start: |
| 313 | + d = sync_daemon_tool.start() |
| 314 | + d.addBoth(lambda _: run(options, sync_daemon_tool, out)) |
| 315 | + else: |
| 316 | + d = run(options, sync_daemon_tool, out) |
| 317 | + |
| 318 | + def default_errback(error): |
| 319 | + """ default error handler. """ |
| 320 | + out.write("\nOops, an error ocurred:\n") |
| 321 | + error.printTraceback() |
| 322 | + |
| 323 | + def stop_reactor(result): |
| 324 | + """ stop the reactor. """ |
| 325 | + if reactor.running: |
| 326 | + reactor.stop() |
| 327 | + d.addErrback(default_errback) |
| 328 | + d.addCallback(stop_reactor) |
| 329 | + return d |
| 330 | + |
| 331 | + |
| 332 | +def run(options, sync_daemon_tool, out): |
| 333 | if options.wait: |
| 334 | def callback(result): |
| 335 | """ wait_for_nirvana callback (stop the reactor and exit)""" |
| 336 | @@ -104,12 +97,29 @@ |
| 337 | elif options.refresh_shares: |
| 338 | d = sync_daemon_tool.refresh_shares() |
| 339 | elif options.offer_share: |
| 340 | - if len(args) != 4: |
| 341 | - parser.error('--offer-share requires 4 arguments') |
| 342 | - d = sync_daemon_tool.offer_share(options.offer_share, *args[1:]) |
| 343 | + path, username, name, access_level = options.offer_share |
| 344 | + d = sync_daemon_tool.offer_share(path, username, name, access_level) |
| 345 | elif options.list_shared: |
| 346 | d = sync_daemon_tool.list_shared() |
| 347 | d.addCallback(lambda r: show_shared(r, out)) |
| 348 | + elif options.create_folder: |
| 349 | + if not os.path.exists(options.create_folder): |
| 350 | + parser.error("PATH: '%s' don't exists" % \ |
| 351 | + options.create_folder) |
| 352 | + d = sync_daemon_tool.create_folder(options.create_folder) |
| 353 | + d.addErrback(lambda r: show_error(r, out)) |
| 354 | + elif options.delete_folder: |
| 355 | + d = sync_daemon_tool.delete_folder(options.delete_folder) |
| 356 | + d.addErrback(lambda r: show_error(r, out)) |
| 357 | + elif options.list_folders: |
| 358 | + d = sync_daemon_tool.get_folders() |
| 359 | + d.addCallback(lambda r: show_folders(r, out)) |
| 360 | + elif options.subscribe_folder: |
| 361 | + d = sync_daemon_tool.subscribe_folder(options.subscribe_folder) |
| 362 | + d.addErrback(lambda r: show_error(r, out)) |
| 363 | + elif options.unsubscribe_folder: |
| 364 | + d = sync_daemon_tool.unsubscribe_folder(options.unsubscribe_folder) |
| 365 | + d.addErrback(lambda r: show_error(r, out)) |
| 366 | elif options.refresh_path: |
| 367 | if not os.path.exists(options.refresh_path): |
| 368 | parser.error("PATH: '%s' don't exists" % \ |
| 369 | @@ -129,32 +139,98 @@ |
| 370 | elif options.quit: |
| 371 | d = sync_daemon_tool.quit() |
| 372 | def shutdown_check(result): |
| 373 | - if result is None and \ |
| 374 | - DBUS_IFACE_NAME in bus.list_names(): |
| 375 | + if result is None and not is_running(): |
| 376 | out.write("ubuntuone-syncdaemon stopped.\n") |
| 377 | else: |
| 378 | out.write("ubuntuone-syncdaemon still running.\n") |
| 379 | d.addBoth(shutdown_check) |
| 380 | + elif options.connect: |
| 381 | + d = sync_daemon_tool.connect() |
| 382 | + elif options.disconnect: |
| 383 | + d = sync_daemon_tool.disconnect() |
| 384 | + elif options.status: |
| 385 | + d = sync_daemon_tool.get_status() |
| 386 | + d.addCallback(lambda r: show_state(r, out)) |
| 387 | + elif options.waiting_content: |
| 388 | + d = sync_daemon_tool.waiting_content() |
| 389 | + d.addCallback(lambda r: show_waiting_content(r, out)) |
| 390 | + elif options.schedule_next: |
| 391 | + share_id, node_id = options.schedule_next |
| 392 | + d = sync_daemon_tool.schedule_next(share_id, node_id) |
| 393 | + elif options.start: |
| 394 | + d = sync_daemon_tool.start() |
| 395 | else: |
| 396 | parser.print_help() |
| 397 | - sys.exit(1) |
| 398 | - |
| 399 | - def default_errback(error): |
| 400 | - """ default error handler. """ |
| 401 | - out.write("\nOops, an error ocurred:\n") |
| 402 | - error.printTraceback() |
| 403 | - |
| 404 | - def stop_reactor(result): |
| 405 | - """ stop the reactor. """ |
| 406 | - if reactor.running: |
| 407 | - reactor.stop() |
| 408 | - d.addErrback(default_errback) |
| 409 | - d.addCallback(stop_reactor) |
| 410 | - reactor.run() |
| 411 | + d = defer.succeed(None) |
| 412 | + return d |
| 413 | |
| 414 | |
| 415 | if __name__ == '__main__': |
| 416 | # disable the dbus warnings |
| 417 | warnings.filterwarnings('ignore', module='dbus') |
| 418 | - main(sys.argv, sys.stdout) |
| 419 | + usage = "Usage: %prog [option]" |
| 420 | + parser = OptionParser(usage=usage) |
| 421 | + parser.add_option("-w", "--wait", dest="wait", action="store_true", |
| 422 | + help="Wait until ubuntuone-syncdaemon reaches nirvana") |
| 423 | + parser.add_option("", "--accept-share", dest="accept_share", |
| 424 | + metavar="SHARE_ID", |
| 425 | + help="Accept the share with the specified id") |
| 426 | + parser.add_option("", "--reject-share", dest="reject_share", |
| 427 | + metavar="SHARE_ID", |
| 428 | + help="Reject the share with the specified id") |
| 429 | + parser.add_option("", "--list-shares", dest="list_shares", |
| 430 | + action="store_true", |
| 431 | + help="Get the list of shares") |
| 432 | + parser.add_option("", "--refresh-shares", dest="refresh_shares", |
| 433 | + action="store_true", |
| 434 | + help="Request a refresh of the list of shares to" |
| 435 | + " the server") |
| 436 | + parser.add_option("", "--offer-share", dest="offer_share", type="string", |
| 437 | + nargs=4, metavar="PATH USER SHARE_NAME ACCESS_LEVEL", |
| 438 | + help="Share PATH to USER. ") |
| 439 | + parser.add_option("", "--list-shared", dest="list_shared", |
| 440 | + action="store_true", |
| 441 | + help="List the shared path's/shares offered. ") |
| 442 | + parser.add_option("", "--create-folder", dest="create_folder", |
| 443 | + metavar="PATH", |
| 444 | + help="Create user defined folder in the specified path") |
| 445 | + parser.add_option("", "--delete-folder", dest="delete_folder", |
| 446 | + metavar="FOLDER_ID", |
| 447 | + help="Delete user defined folder in the specified path") |
| 448 | + parser.add_option("", "--list-folders", dest="list_folders", |
| 449 | + action="store_true", |
| 450 | + help="List all the user defined folders") |
| 451 | + parser.add_option("", "--subscribe-folder", dest="subscribe_folder", |
| 452 | + metavar="FOLDER_ID", |
| 453 | + help="Subscribe to the folder specified by id") |
| 454 | + parser.add_option("", "--unsubscribe-folder", dest="unsubscribe_folder", |
| 455 | + metavar="FOLDER_ID", |
| 456 | + help="Unsubscribe from the folder specified by id") |
| 457 | + parser.add_option("", "--refresh", dest="refresh_path", |
| 458 | + metavar="PATH", help="Request a refresh of PATH") |
| 459 | + parser.add_option("", "--info", dest="path_info", |
| 460 | + metavar="PATH", help="Request the metadata of PATH") |
| 461 | + parser.add_option("", "--current-transfers", dest="current_transfers", |
| 462 | + action="store_true", |
| 463 | + help=" show the current uploads and downloads") |
| 464 | + parser.add_option("-q", "--quit", dest="quit", action='store_true', |
| 465 | + help="Shutdown the syncdaemon") |
| 466 | + parser.add_option("-c", "--connect", dest="connect", action='store_true', |
| 467 | + help="Connect the syncdaemon") |
| 468 | + parser.add_option("-d", "--disconnect", dest="disconnect", |
| 469 | + action='store_true', help="Disconnect the syncdaemon") |
| 470 | + parser.add_option("-s", "--status", dest="status", action='store_true', |
| 471 | + help="Get the current status of syncdaemon") |
| 472 | + parser.add_option("", "--waiting-content", dest="waiting_content", |
| 473 | + action='store_true', help="Get the waiting content list") |
| 474 | + parser.add_option("", "--schedule-next", dest="schedule_next", |
| 475 | + metavar="SHARE_ID NODE_ID", nargs=2, type='string', |
| 476 | + help="Move the node to be the next in the queue of " |
| 477 | + "waiting commands") |
| 478 | + parser.add_option("", "--start", dest="start", action='store_true', |
| 479 | + help="Start syncdaemon if it's not running") |
| 480 | + |
| 481 | + (options, args) = parser.parse_args(sys.argv) |
| 482 | + reactor.callWhenRunning(main, options, args, sys.stdout) |
| 483 | + reactor.run() |
| 484 | |
| 485 | |
| 486 | === removed file 'bin/ubuntuone-client-applet' |
| 487 | --- bin/ubuntuone-client-applet 2009-12-07 17:35:00 +0000 |
| 488 | +++ bin/ubuntuone-client-applet 1970-01-01 00:00:00 +0000 |
| 489 | @@ -1,1063 +0,0 @@ |
| 490 | -#!/usr/bin/python |
| 491 | - |
| 492 | -# ubuntuone-client-applet - Tray icon applet for managing Ubuntu One |
| 493 | -# |
| 494 | -# Author: Rodney Dawes <rodney.dawes@canonical.com> |
| 495 | -# |
| 496 | -# Copyright 2009 Canonical Ltd. |
| 497 | -# |
| 498 | -# This program is free software: you can redistribute it and/or modify it |
| 499 | -# under the terms of the GNU General Public License version 3, as published |
| 500 | -# by the Free Software Foundation. |
| 501 | -# |
| 502 | -# This program is distributed in the hope that it will be useful, but |
| 503 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 504 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 505 | -# PURPOSE. See the GNU General Public License for more details. |
| 506 | -# |
| 507 | -# You should have received a copy of the GNU General Public License along |
| 508 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 509 | - |
| 510 | -from __future__ import with_statement |
| 511 | - |
| 512 | -import pygtk |
| 513 | -pygtk.require('2.0') |
| 514 | -import gobject |
| 515 | -import gtk |
| 516 | -import pango |
| 517 | -import os |
| 518 | -import subprocess |
| 519 | -import sys |
| 520 | -import gettext |
| 521 | -from ubuntuone import clientdefs |
| 522 | - |
| 523 | -import dbus.service |
| 524 | - |
| 525 | -# pylint: disable-msg=F0401 |
| 526 | -import pynotify |
| 527 | - |
| 528 | -from ConfigParser import ConfigParser |
| 529 | -from dbus.exceptions import DBusException |
| 530 | -from dbus.mainloop.glib import DBusGMainLoop |
| 531 | -from ubuntuone.oauthdesktop.main import Login |
| 532 | -from xdg.BaseDirectory import xdg_config_home |
| 533 | -from threading import Lock, Thread |
| 534 | -from urllib import quote |
| 535 | - |
| 536 | -from ubuntuone.oauthdesktop.logger import setupLogging |
| 537 | -logger = setupLogging("UbuntuOne.Client.Applet") |
| 538 | - |
| 539 | -DBusGMainLoop(set_as_default=True) |
| 540 | - |
| 541 | -_ = gettext.gettext |
| 542 | -ngettext = gettext.ngettext |
| 543 | - |
| 544 | -APPLET_BUS_NAME = "com.ubuntuone.ClientApplet" |
| 545 | -APPLET_CONFIG_NAME = APPLET_BUS_NAME + ".Config" |
| 546 | - |
| 547 | -DBUS_IFACE_NAME = "com.ubuntuone.SyncDaemon" |
| 548 | -DBUS_IFACE_SYNC_NAME = "com.ubuntuone.SyncDaemon.SyncDaemon" |
| 549 | -DBUS_IFACE_STATUS_NAME = "com.ubuntuone.SyncDaemon.Status" |
| 550 | -DBUS_IFACE_CONFIG_NAME = "com.ubuntuone.SyncDaemon.Config" |
| 551 | - |
| 552 | -DBUS_IFACE_AUTH_NAME = "com.ubuntuone.Authentication" |
| 553 | - |
| 554 | -OAUTH_REALM = "https://ubuntuone.com" |
| 555 | -OAUTH_CONSUMER = "ubuntuone" |
| 556 | -BOOKMARK_NAME = "Ubuntu One" |
| 557 | - |
| 558 | -NOTIFY_ICON_SIZE = 48 |
| 559 | - |
| 560 | -# Why thank you GTK+ for enforcing style-set and breaking API |
| 561 | -RCSTYLE = """ |
| 562 | -style 'dialogs' { |
| 563 | - GtkDialog::action-area-border = 12 |
| 564 | - GtkDialog::button-spacing = 6 |
| 565 | - GtkDialog::content-area-border = 0 |
| 566 | -} |
| 567 | -widget_class '*Dialog*' style 'dialogs' |
| 568 | -""" |
| 569 | - |
| 570 | -CONF_FILE = os.path.join(xdg_config_home, "ubuntuone", "ubuntuone-client.conf") |
| 571 | - |
| 572 | - |
| 573 | -def dbus_async(*args): |
| 574 | - """Simple handler to make dbus do stuff async.""" |
| 575 | - pass |
| 576 | - |
| 577 | -class AppletMain(object): |
| 578 | - """Main applet process class.""" |
| 579 | - |
| 580 | - def __init__(self, *args, **kw): |
| 581 | - """Initializes the child threads and dbus monitor.""" |
| 582 | - from twisted.internet import gtk2reactor |
| 583 | - gtk2reactor.install() |
| 584 | - login = Login(dbus.service.BusName(DBUS_IFACE_AUTH_NAME, |
| 585 | - bus=dbus.SessionBus())) |
| 586 | - |
| 587 | - logger.info(_("Starting Ubuntu One client version %s") % |
| 588 | - clientdefs.VERSION) |
| 589 | - |
| 590 | - # Whether or not we are authorized |
| 591 | - self.is_authorized = False |
| 592 | - |
| 593 | - # Load the config, with some defaults if it doesn't exist yet |
| 594 | - if not os.path.isdir(os.path.dirname(CONF_FILE)): |
| 595 | - os.makedirs(os.path.dirname(CONF_FILE)) |
| 596 | - |
| 597 | - self.config = ConfigParser() |
| 598 | - self.config.read(CONF_FILE) |
| 599 | - |
| 600 | - if not self.config.has_section("ubuntuone"): |
| 601 | - self.config.add_section("ubuntuone") |
| 602 | - |
| 603 | - if not self.config.has_option("ubuntuone", "show_applet"): |
| 604 | - self.config.set("ubuntuone", "show_applet", "1") |
| 605 | - |
| 606 | - if not self.config.has_option("ubuntuone", "connect"): |
| 607 | - self.config.set("ubuntuone", "connect", "0") |
| 608 | - |
| 609 | - if not self.config.has_option("ubuntuone", "connected"): |
| 610 | - self.config.set("ubuntuone", "connected", "False") |
| 611 | - |
| 612 | - if not self.config.has_option("ubuntuone", "bookmarked"): |
| 613 | - self.config.set("ubuntuone", "bookmarked", "False") |
| 614 | - |
| 615 | - self.show_applet = self.config.getint("ubuntuone", "show_applet") |
| 616 | - self.connect = self.config.getint("ubuntuone", "connect") |
| 617 | - self.connected = self.config.getboolean("ubuntuone", "connected") |
| 618 | - |
| 619 | - if not os.path.exists(CONF_FILE): |
| 620 | - with open(CONF_FILE, "w+b") as f: |
| 621 | - self.config.write(f) |
| 622 | - |
| 623 | - # Handle some DBus signals |
| 624 | - self.__bus = dbus.SessionBus() |
| 625 | - self.__bus.add_signal_receiver( |
| 626 | - handler_function=self.__new_credentials, |
| 627 | - signal_name="NewCredentials", |
| 628 | - dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 629 | - self.__bus.add_signal_receiver( |
| 630 | - handler_function=self.__auth_denied, |
| 631 | - signal_name="AuthorizationDenied", |
| 632 | - dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 633 | - self.__bus.add_signal_receiver( |
| 634 | - handler_function=self.__no_credentials, |
| 635 | - signal_name="NoCredentials", |
| 636 | - dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 637 | - self.__bus.add_signal_receiver( |
| 638 | - handler_function=self.__got_oauth_error, |
| 639 | - signal_name="OAuthError", |
| 640 | - dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 641 | - |
| 642 | - self.__icon = AppletIcon(main=self, config=self.config) |
| 643 | - |
| 644 | - def __new_credentials(self, realm=None, consumer_key=None, sender=None): |
| 645 | - """Signal callback for when we get new credentials.""" |
| 646 | - self.is_authorized = True |
| 647 | - |
| 648 | - self.__start_storage_daemon() |
| 649 | - self.add_to_autostart() |
| 650 | - |
| 651 | - self.set_up_desktopcouch_pairing(consumer_key) |
| 652 | - |
| 653 | - if self.connect == 2: |
| 654 | - return |
| 655 | - |
| 656 | - if self.connect == 1 and not self.connected: |
| 657 | - return |
| 658 | - |
| 659 | - try: |
| 660 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 661 | - follow_name_owner_changes=True) |
| 662 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 663 | - iface.connect(reply_handler=dbus_async, |
| 664 | - error_handler=self.sd_dbus_error) |
| 665 | - except DBusException, e: |
| 666 | - self.sd_dbus_error(e) |
| 667 | - |
| 668 | - def __auth_denied(self): |
| 669 | - """Signal callback for when auth was denied by user.""" |
| 670 | - self.is_authorized = False |
| 671 | - self.remove_from_autostart() |
| 672 | - |
| 673 | - def quit_error(e): |
| 674 | - """Only log when quit fails.""" |
| 675 | - logger.error(_("Quit Error: %s") % e.get_dbus_message()) |
| 676 | - |
| 677 | - try: |
| 678 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 679 | - follow_name_owner_changes=True) |
| 680 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 681 | - iface.quit(reply_handler=dbus_async, |
| 682 | - error_handler=quit_error) |
| 683 | - except DBusException, e: |
| 684 | - quit_error(e) |
| 685 | - |
| 686 | - from twisted.internet import reactor |
| 687 | - reactor.stop() |
| 688 | - |
| 689 | - def __no_credentials(self): |
| 690 | - """Signal callback for when no credentials exist in the keyring.""" |
| 691 | - self.is_authorized = False |
| 692 | - |
| 693 | - def __got_oauth_error(self, message=None): |
| 694 | - """Signal callback for when an OAuth error occured.""" |
| 695 | - def dialog_response(dialog, response): |
| 696 | - """Handle the dialog closing.""" |
| 697 | - dialog.destroy() |
| 698 | - |
| 699 | - if message: |
| 700 | - logger.error(message) |
| 701 | - dialog = gtk.Dialog(title=_("Ubuntu One: Error"), |
| 702 | - flags=gtk.DIALOG_NO_SEPARATOR, |
| 703 | - buttons=(gtk.STOCK_CLOSE, |
| 704 | - gtk.RESPONSE_CLOSE)) |
| 705 | - dialog.set_default_response(gtk.RESPONSE_CLOSE) |
| 706 | - dialog.set_icon_name("ubuntuone-client") |
| 707 | - |
| 708 | - area = dialog.get_content_area() |
| 709 | - |
| 710 | - hbox = gtk.HBox(spacing=12) |
| 711 | - hbox.set_border_width(12) |
| 712 | - area.pack_start(hbox) |
| 713 | - hbox.show() |
| 714 | - |
| 715 | - image = gtk.Image() |
| 716 | - image.set_from_icon_name("dialog-error", gtk.ICON_SIZE_DIALOG) |
| 717 | - image.set_alignment(0.5, 0.0) |
| 718 | - image.show() |
| 719 | - hbox.pack_start(image, False, False) |
| 720 | - |
| 721 | - vbox = gtk.VBox(spacing=12) |
| 722 | - vbox.show() |
| 723 | - hbox.pack_start(vbox) |
| 724 | - |
| 725 | - label = gtk.Label("<b>%s</b>" % _("Authorization Error")) |
| 726 | - label.set_use_markup(True) |
| 727 | - label.set_alignment(0.0, 0.5) |
| 728 | - label.show() |
| 729 | - vbox.pack_start(label, False, False) |
| 730 | - |
| 731 | - label = gtk.Label(message) |
| 732 | - label.set_line_wrap(True) |
| 733 | - label.set_max_width_chars(64) |
| 734 | - label.set_ellipsize(pango.ELLIPSIZE_MIDDLE) |
| 735 | - label.set_alignment(0.0, 0.0) |
| 736 | - label.show() |
| 737 | - vbox.pack_start(label, True, True) |
| 738 | - |
| 739 | - dialog.connect('close', dialog_response, gtk.RESPONSE_CLOSE) |
| 740 | - dialog.connect('response', dialog_response) |
| 741 | - |
| 742 | - dialog.show() |
| 743 | - else: |
| 744 | - logger.error(_("Got an OAuth error with no message.")) |
| 745 | - |
| 746 | - def check_for_token(self, do_login=False): |
| 747 | - """Method to check for an existing token.""" |
| 748 | - def local_dbus_error(e): |
| 749 | - """Can't talk to ourself?""" |
| 750 | - logger.error(_("Internal Error: %s") % e.get_dbus_message()) |
| 751 | - |
| 752 | - try: |
| 753 | - client = self.__bus.get_object(DBUS_IFACE_AUTH_NAME, "/", |
| 754 | - follow_name_owner_changes=True) |
| 755 | - iface = dbus.Interface(client, DBUS_IFACE_AUTH_NAME) |
| 756 | - iface.maybe_login(OAUTH_REALM, OAUTH_CONSUMER, |
| 757 | - do_login, |
| 758 | - reply_handler=dbus_async, |
| 759 | - error_handler=local_dbus_error) |
| 760 | - except DBusException, e: |
| 761 | - local_dbus_error(e) |
| 762 | - return False |
| 763 | - |
| 764 | - return False |
| 765 | - |
| 766 | - def __start_storage_daemon_maybe(self): |
| 767 | - """Start the storage daemon.""" |
| 768 | - try: |
| 769 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 770 | - follow_name_owner_changes=True) |
| 771 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 772 | - iface.get_rootdir(reply_handler=dbus_async, |
| 773 | - error_handler=self.sd_dbus_error) |
| 774 | - except DBusException, e: |
| 775 | - self.sd_dbus_error(e) |
| 776 | - return False |
| 777 | - |
| 778 | - return False |
| 779 | - |
| 780 | - def __start_storage_daemon(self): |
| 781 | - """Need to call dbus from a idle callback""" |
| 782 | - gobject.idle_add(self.__start_storage_daemon_maybe) |
| 783 | - |
| 784 | - def add_to_autostart(self): |
| 785 | - """Add ourself to the autostart config.""" |
| 786 | - autostart_entry = """[Desktop Entry] |
| 787 | -Name=Ubuntu One |
| 788 | -Exec=ubuntuone-client-applet |
| 789 | -Icon=ubuntuone-client |
| 790 | -Terminal=false |
| 791 | -Type=Application |
| 792 | -X-Ubuntu-Gettext-Domain=ubuntuone-client |
| 793 | -X-KDE-autostart-after=panel |
| 794 | -X-GNOME-Autostart-enabled=true |
| 795 | -""" |
| 796 | - if not os.path.exists(os.path.join(xdg_config_home, "autostart")): |
| 797 | - os.makedirs(os.path.join(xdg_config_home, "autostart")) |
| 798 | - |
| 799 | - file_path = os.path.join(xdg_config_home, "autostart", |
| 800 | - "ubuntuone-client-applet.desktop") |
| 801 | - if not os.path.exists(file_path): |
| 802 | - with open(file_path, "w+") as f: |
| 803 | - f.write(autostart_entry) |
| 804 | - |
| 805 | - def remove_from_autostart(self): |
| 806 | - """Remove ourself from the autostart config.""" |
| 807 | - path = os.path.join(xdg_config_home, "autostart", |
| 808 | - "ubuntuone-client-applet.desktop") |
| 809 | - try: |
| 810 | - os.unlink(path) |
| 811 | - except OSError: |
| 812 | - pass |
| 813 | - |
| 814 | - def set_up_desktopcouch_pairing(self, consumer_key): |
| 815 | - """Add a pairing record between desktopcouch and Ubuntu One""" |
| 816 | - try: |
| 817 | - from desktopcouch.pair.couchdb_pairing.couchdb_io import \ |
| 818 | - put_static_paired_service, PAIRED_SERVER_RECORD_TYPE |
| 819 | - from desktopcouch.records.server import CouchDatabase |
| 820 | - except ImportError: |
| 821 | - # desktopcouch is not installed |
| 822 | - logger.debug(_("Not adding desktopcouch pairing since" |
| 823 | - " desktopcouch is not installed")) |
| 824 | - return |
| 825 | - # Check whether there is already a record of the Ubuntu One service |
| 826 | - db = CouchDatabase("management", create=True) |
| 827 | - if not db.view_exists("ubuntu_one_pair_record","ubuntu_one_pair_record"): |
| 828 | - map_js = """function(doc) { |
| 829 | - if (doc.service_name == "ubuntuone") { |
| 830 | - if (doc.application_annotations && |
| 831 | - doc.application_annotations["Ubuntu One"] && |
| 832 | - doc.application_annotations["Ubuntu One"]["private_application_annotations"] && |
| 833 | - doc.application_annotations["Ubuntu One"]["private_application_annotations"]["deleted"]) { |
| 834 | - emit(doc._id, 1); |
| 835 | - } else { |
| 836 | - emit(doc._id, 0) |
| 837 | - } |
| 838 | - } |
| 839 | - }""" |
| 840 | - db.add_view("ubuntu_one_pair_record", map_js, None, |
| 841 | - "ubuntu_one_pair_record") |
| 842 | - results = db.execute_view("ubuntu_one_pair_record", |
| 843 | - "ubuntu_one_pair_record") |
| 844 | - found = False |
| 845 | - deleted = False |
| 846 | - # Results should contain either one row or no rows |
| 847 | - # If there is one row, its value will be 0, meaning that there is |
| 848 | - # already an Ubuntu One pairing record, or 1, meaning that there |
| 849 | - # was an Ubuntu One pairing record but it has since been unpaired |
| 850 | - # Only create a new record if there is not one already. Specifically, |
| 851 | - # do not add the record if there is a deleted one, as this means |
| 852 | - # that the user explicitly unpaired it! |
| 853 | - for row in results: |
| 854 | - found = True |
| 855 | - if row.value == 1: |
| 856 | - deleted = True |
| 857 | - logger.debug(_("Not adding desktopcouch pairing since" |
| 858 | - " the user has explicitly unpaired with Ubuntu One")) |
| 859 | - else: |
| 860 | - logger.debug(_("Not adding desktopcouch pairing since" |
| 861 | - " we are already paired")) |
| 862 | - if not found: |
| 863 | - put_static_paired_service(None, "ubuntuone") |
| 864 | - logger.debug(_("Pairing desktopcouch with Ubuntu One")) |
| 865 | - |
| 866 | - def main(self): |
| 867 | - """Starts the gtk main loop.""" |
| 868 | - from twisted.internet import reactor |
| 869 | - if self.connect != 2 or (self.connect == 1 and self.connected): |
| 870 | - gobject.idle_add(self.check_for_token, True) |
| 871 | - |
| 872 | - reactor.run() |
| 873 | - |
| 874 | - @property |
| 875 | - def authorized(self): |
| 876 | - """Are we authorized?""" |
| 877 | - return self.is_authorized |
| 878 | - |
| 879 | - def sd_dbus_error(self, error): |
| 880 | - """Got an error from DBus.""" |
| 881 | - self.__icon.sd_dbus_error(error) |
| 882 | - |
| 883 | - |
| 884 | - |
| 885 | -def do_config_open_real(): |
| 886 | - """Opens the preferences dialog.""" |
| 887 | - paths = os.environ["PATH"].split(":") |
| 888 | - dirpath = os.path.join(os.getcwd(), "bin") |
| 889 | - if os.path.isdir(dirpath): |
| 890 | - paths.insert(0, dirpath) |
| 891 | - os.environ["PATH"] = ":".join(paths) |
| 892 | - try: |
| 893 | - ret = subprocess.call(["ubuntuone-client-preferences"], |
| 894 | - env=os.environ) |
| 895 | - except OSError: |
| 896 | - ret = -1 |
| 897 | - if ret != 0: |
| 898 | - logger.error(_("Failed to open Ubuntu One preferences")) |
| 899 | - |
| 900 | -def do_config_open(): |
| 901 | - """Do the preferences opening in a thread.""" |
| 902 | - Thread(target=do_config_open_real, name="preferences").start() |
| 903 | - |
| 904 | -def do_xdg_open_real(path_or_url): |
| 905 | - """Utility method to run xdg-open with path_or_url.""" |
| 906 | - ret = subprocess.call(["xdg-open", path_or_url], env=os.environ) |
| 907 | - if ret != 0: |
| 908 | - logger.error(_("Failed to run 'xdg-open %s'") % path_or_url) |
| 909 | - |
| 910 | -def do_xdg_open(path_or_url): |
| 911 | - """Do the xdg-open in a thread.""" |
| 912 | - Thread(target=do_xdg_open_real, name="xdg", args=(path_or_url,)).start() |
| 913 | - |
| 914 | - |
| 915 | -class AppletIcon(gtk.StatusIcon): |
| 916 | - """ |
| 917 | - Custom StatusIcon derived from gtk.StatusIcon which supports |
| 918 | - animated icons and a few other nice things. |
| 919 | - """ |
| 920 | - |
| 921 | - def __init__(self, main=None, config=None, *args, **kw): |
| 922 | - """Initializes our custom StatusIcon based widget.""" |
| 923 | - super(AppletIcon, self).__init__(*args, **kw) |
| 924 | - # Hide until we get status, to avoid flickering |
| 925 | - self.set_visible(False) |
| 926 | - |
| 927 | - # The AppletMain object |
| 928 | - self.__main = main |
| 929 | - |
| 930 | - # A ConfigParser object that we can poke at |
| 931 | - self.__config = config |
| 932 | - self.__show_when = self.__config.getint("ubuntuone", "show_applet") |
| 933 | - |
| 934 | - self.__managed_dir = None |
| 935 | - |
| 936 | - self.__size = 24 |
| 937 | - self.__theme = gtk.icon_theme_get_default() |
| 938 | - iconpath = os.path.abspath(os.path.join( |
| 939 | - os.path.split(os.path.dirname(__file__))[0], |
| 940 | - "data")) |
| 941 | - self.__theme.append_search_path(iconpath) |
| 942 | - |
| 943 | - self.__theme.append_search_path(os.path.sep + os.path.join( |
| 944 | - "usr", "share", "ubuntuone-client", "icons")) |
| 945 | - self.__theme.append_search_path(os.path.sep + os.path.join( |
| 946 | - "usr", "local", "share", "ubuntuone-client", "icons")) |
| 947 | - |
| 948 | - self.set_from_icon_name('ubuntuone-client-offline') |
| 949 | - self.set_tooltip(_("Disconnected")) |
| 950 | - self.connect("popup-menu", self.__popup_menu) |
| 951 | - self.connect("activate", self.__do_action) |
| 952 | - |
| 953 | - self.__size_changed(self, self.__size) |
| 954 | - |
| 955 | - self.__litems = {} |
| 956 | - self.__ritems = {} |
| 957 | - self.__status_menu, self.__config_menu = self.__build_menus() |
| 958 | - |
| 959 | - self.__connected = False |
| 960 | - self.__need_update = False |
| 961 | - self.__fatal_error = False |
| 962 | - |
| 963 | - pynotify.init("Ubuntu One") |
| 964 | - |
| 965 | - # Managing applet visibility |
| 966 | - self.__visible = True |
| 967 | - self.__visible_id = 0 |
| 968 | - |
| 969 | - # Up/Dn status |
| 970 | - self.__lock = Lock() |
| 971 | - self.__updating = 0 |
| 972 | - self.__total = 0 |
| 973 | - self.__last_id = 0 |
| 974 | - |
| 975 | - self.__bus = dbus.SessionBus() |
| 976 | - |
| 977 | - # Our own DBus service, for the config to deal with |
| 978 | - self.__service = AppletConfig(icon=self) |
| 979 | - |
| 980 | - # DBus signal handling |
| 981 | - self.__bus.add_signal_receiver( |
| 982 | - handler_function=self.__status_changed, |
| 983 | - signal_name="StatusChanged", |
| 984 | - dbus_interface=DBUS_IFACE_STATUS_NAME) |
| 985 | - |
| 986 | - self.__bus.add_signal_receiver( |
| 987 | - handler_function=self.__queue_changed, |
| 988 | - signal_name="ContentQueueChanged", |
| 989 | - dbus_interface=DBUS_IFACE_STATUS_NAME) |
| 990 | - self.__bus.add_signal_receiver( |
| 991 | - handler_function=self.__transfer_started, |
| 992 | - signal_name="UploadStarted", |
| 993 | - dbus_interface=DBUS_IFACE_STATUS_NAME) |
| 994 | - self.__bus.add_signal_receiver( |
| 995 | - handler_function=self.__transfer_started, |
| 996 | - signal_name="DownloadStarted", |
| 997 | - dbus_interface=DBUS_IFACE_STATUS_NAME) |
| 998 | - |
| 999 | - gobject.idle_add(self.__get_root) |
| 1000 | - |
| 1001 | - def set_from_icon_name(self, icon): |
| 1002 | - """Handle fallbacks for setting our icon.""" |
| 1003 | - pixbuf = self.__theme.load_icon(icon, self.__size, |
| 1004 | - gtk.ICON_LOOKUP_GENERIC_FALLBACK) |
| 1005 | - self.set_from_pixbuf(pixbuf) |
| 1006 | - |
| 1007 | - def set_visibility_config(self, visibility): |
| 1008 | - """Update the visibility configuration.""" |
| 1009 | - self.__show_when = int(visibility) |
| 1010 | - self.__config.set("ubuntuone", "show_applet", str(self.__show_when)) |
| 1011 | - self.update_visibility() |
| 1012 | - |
| 1013 | - def set_connection_config(self, connect): |
| 1014 | - """Update the connection config.""" |
| 1015 | - self.__config.set("ubuntuone", "connect", str(connect)) |
| 1016 | - |
| 1017 | - def __update_transfer_status(self, done=False): |
| 1018 | - """Update the status display.""" |
| 1019 | - with self.__lock: |
| 1020 | - text = _("Updating file %(transfers)d of %(total)d...") % \ |
| 1021 | - dict(transfers=self.__updating, total=self.__total) |
| 1022 | - label = self.__litems["status"].get_child() |
| 1023 | - if done: |
| 1024 | - self.set_tooltip(_("Files updated.")) |
| 1025 | - self.set_from_icon_name("ubuntuone-client-idle") |
| 1026 | - label.set_text(_("Your files are up to date.")) |
| 1027 | - else: |
| 1028 | - label.set_markup("<i>%s</i>" % text) |
| 1029 | - |
| 1030 | - def __queue_changed(self, queue): |
| 1031 | - """Handle ContentQueueChanged.""" |
| 1032 | - total = 0 |
| 1033 | - d = queue.get('Download', None) |
| 1034 | - if d is not None: |
| 1035 | - total += int(d.get('count', 0)) |
| 1036 | - d = queue.get('Upload', None) |
| 1037 | - if d is not None: |
| 1038 | - total += int(d.get('count', 0)) |
| 1039 | - first = False |
| 1040 | - last = False |
| 1041 | - self.__visible = True |
| 1042 | - self.set_tooltip(_("Updating files...")) |
| 1043 | - self.update_visibility() |
| 1044 | - with self.__lock: |
| 1045 | - if self.__total == 0: |
| 1046 | - first = True |
| 1047 | - last = False |
| 1048 | - if self.__total != 0 and total == 0: |
| 1049 | - first = False |
| 1050 | - last = True |
| 1051 | - self.__total = total + self.__updating |
| 1052 | - if first: |
| 1053 | - self.set_from_icon_name("ubuntuone-client-updating") |
| 1054 | - n = pynotify.Notification( |
| 1055 | - _("Updating files..."), |
| 1056 | - _("Ubuntu One is now updating your files.")) |
| 1057 | - pixbuf = self.__theme.load_icon( |
| 1058 | - "ubuntuone-client-updating", NOTIFY_ICON_SIZE, |
| 1059 | - gtk.ICON_LOOKUP_GENERIC_FALLBACK) |
| 1060 | - n.set_icon_from_pixbuf(pixbuf) |
| 1061 | - n.show() |
| 1062 | - if last: |
| 1063 | - if self.__last_id != 0: |
| 1064 | - gobject.source_remove(self.__last_id) |
| 1065 | - self.__last_id = 0 |
| 1066 | - self.__last_id = gobject.timeout_add_seconds( |
| 1067 | - 15, self.__updating_completed) |
| 1068 | - |
| 1069 | - def __updating_completed(self): |
| 1070 | - """Timeout to avoid multiple started/finished notifications.""" |
| 1071 | - really_last = False |
| 1072 | - n = None |
| 1073 | - with self.__lock: |
| 1074 | - done = self.__total - self.__updating |
| 1075 | - if done == 0: |
| 1076 | - really_last = True |
| 1077 | - if not really_last: |
| 1078 | - return False |
| 1079 | - |
| 1080 | - with self.__lock: |
| 1081 | - n = pynotify.Notification( |
| 1082 | - _("Updating Finished"), |
| 1083 | - ngettext("Ubuntu One finished updating %(total)d file.", |
| 1084 | - "Ubuntu One finished updating %(total)d files.", |
| 1085 | - self.__total) % { 'total' : self.__total }) |
| 1086 | - self.__total = 0 |
| 1087 | - self.__updating = 0 |
| 1088 | - pixbuf = self.__theme.load_icon( |
| 1089 | - "ubuntuone-client-updating", NOTIFY_ICON_SIZE, |
| 1090 | - gtk.ICON_LOOKUP_GENERIC_FALLBACK) |
| 1091 | - n.set_icon_from_pixbuf(pixbuf) |
| 1092 | - n.show() |
| 1093 | - self.__update_transfer_status(True) |
| 1094 | - return False |
| 1095 | - |
| 1096 | - def __transfer_started(self, path): |
| 1097 | - """Handle the started signals.""" |
| 1098 | - with self.__lock: |
| 1099 | - self.__updating += 1 |
| 1100 | - self.__update_transfer_status() |
| 1101 | - |
| 1102 | - def update_visibility(self): |
| 1103 | - """Update the icon's visibility.""" |
| 1104 | - if self.__visible_id != 0: |
| 1105 | - gobject.source_remove(self.__visible_id) |
| 1106 | - self.__visible_id = 0 |
| 1107 | - |
| 1108 | - if (self.__visible and self.__show_when != 2) or self.__fatal_error: |
| 1109 | - self.set_visible(True) |
| 1110 | - return |
| 1111 | - |
| 1112 | - if self.__show_when == 2 and not self.__fatal_error: |
| 1113 | - self.set_visible(False) |
| 1114 | - return |
| 1115 | - |
| 1116 | - # If the icon is shown, set up a timeout to hide it |
| 1117 | - if self.get_visible(): |
| 1118 | - self.__visible_id = gobject.timeout_add_seconds( |
| 1119 | - 30, self.__hide_icon) |
| 1120 | - |
| 1121 | - def __status_changed(self, status): |
| 1122 | - """The sync daemon status changed.""" |
| 1123 | - if self.__managed_dir is None: |
| 1124 | - gobject.idle_add(self.__get_root) |
| 1125 | - |
| 1126 | - if self.__show_when != 0: |
| 1127 | - self.__visible = False |
| 1128 | - |
| 1129 | - state = status['name'] |
| 1130 | - |
| 1131 | - self.set_tooltip("Ubuntu One") |
| 1132 | - |
| 1133 | - if self.__fatal_error and state != "UNKNOWN_ERROR": |
| 1134 | - # Just blow your nose, and it's fixed, isn't it. |
| 1135 | - self.__fatal_error = False |
| 1136 | - self.__litems["connect"].set_sensitive(True) |
| 1137 | - self.__litems["disconnect"].set_sensitive(True) |
| 1138 | - |
| 1139 | - if state == "OFFLINE" or state.startswith("INIT") or \ |
| 1140 | - state.startswith("READY"): |
| 1141 | - self.set_from_icon_name("ubuntuone-client-offline") |
| 1142 | - self.set_tooltip(_("Disconnected")) |
| 1143 | - self.__connected = False |
| 1144 | - self.__visible = True |
| 1145 | - |
| 1146 | - elif state == "CAPABILITIES_MISMATCH": |
| 1147 | - self.__connected = False |
| 1148 | - self.__visible = True |
| 1149 | - # Pop up a notification |
| 1150 | - n = pynotify.Notification( |
| 1151 | - _("Capabilities Mismatch"), |
| 1152 | - _("There was a capabilities mismatch while attempting " |
| 1153 | - "to connect to the Ubuntu One server. You may " |
| 1154 | - "have installed a newer version of the client, for " |
| 1155 | - "which the server does not yet provide support. " |
| 1156 | - "A new version of the server should be accessible " |
| 1157 | - "soon. Please be patient while we update.")) |
| 1158 | - pixbuf = self.__theme.load_icon( |
| 1159 | - "ubuntuone-client-error", NOTIFY_ICON_SIZE, |
| 1160 | - gtk.ICON_LOOKUP_GENERIC_FALLBACK) |
| 1161 | - n.set_icon_from_pixbuf(pixbuf) |
| 1162 | - n.set_urgency(pynotify.URGENCY_CRITICAL) |
| 1163 | - n.show() |
| 1164 | - # Set the tooltip and icon on the applet |
| 1165 | - self.set_tooltip(_("Capabilities mismatch with server.")) |
| 1166 | - self.set_from_icon_name("ubuntuone-client-error") |
| 1167 | - |
| 1168 | - elif state == "IDLE" or state.startswith("READING") or \ |
| 1169 | - state.startswith("SCANNING"): |
| 1170 | - self.__connected = True |
| 1171 | - if self.__show_when != 0: |
| 1172 | - self.__visible = False |
| 1173 | - |
| 1174 | - elif state == "AUTH_FAILED": |
| 1175 | - self.__stop_syncdaemon() |
| 1176 | - self.set_from_icon_name("ubuntuone-client-error") |
| 1177 | - self.set_tooltip(_("Authentication failed")) |
| 1178 | - self.__connected = False |
| 1179 | - self.__visible = True |
| 1180 | - |
| 1181 | - def reauthorize_error(e): |
| 1182 | - """Simple dbus error handler.""" |
| 1183 | - logger.error(_("Error clearing token: %s") % str(e)) |
| 1184 | - |
| 1185 | - try: |
| 1186 | - def token_cleared(): |
| 1187 | - """Do the next step.""" |
| 1188 | - if self.__main: |
| 1189 | - self.__main.check_for_token(True) |
| 1190 | - |
| 1191 | - client = self.__bus.get_object(DBUS_IFACE_AUTH_NAME, |
| 1192 | - "/", follow_name_owner_changes=True) |
| 1193 | - iface = dbus.Interface(client, DBUS_IFACE_AUTH_NAME) |
| 1194 | - iface.clear_token(OAUTH_REALM, OAUTH_CONSUMER, |
| 1195 | - reply_handler=token_cleared, |
| 1196 | - error_handler=reauthorize_error) |
| 1197 | - except DBusException, e: |
| 1198 | - reauthorize_error(e) |
| 1199 | - |
| 1200 | - elif state == "UNKNOWN_ERROR": |
| 1201 | - # Disable some menu items |
| 1202 | - self.__litems["connect"].set_sensitive(False) |
| 1203 | - self.__litems["disconnect"].set_sensitive(False) |
| 1204 | - # Change the behavior to file a bug |
| 1205 | - if self.__fatal_error: |
| 1206 | - return |
| 1207 | - |
| 1208 | - self.__fatal_error = True |
| 1209 | - self.__visible = True |
| 1210 | - |
| 1211 | - # Pop up a notification |
| 1212 | - n = pynotify.Notification( |
| 1213 | - "Ubuntu One", |
| 1214 | - _("There was a fatal error in Ubuntu One. " + |
| 1215 | - "This may be a bug in the software. " |
| 1216 | - "Please click on the Ubuntu One icon " + |
| 1217 | - "in your panel to report a bug.")) |
| 1218 | - pixbuf = self.__theme.load_icon( |
| 1219 | - "ubuntuone-client-error", NOTIFY_ICON_SIZE, |
| 1220 | - gtk.ICON_LOOKUP_GENERIC_FALLBACK) |
| 1221 | - n.set_icon_from_pixbuf(pixbuf) |
| 1222 | - n.set_urgency(pynotify.URGENCY_CRITICAL) |
| 1223 | - n.show() |
| 1224 | - # Set the tooltip and icon on the applet |
| 1225 | - self.set_tooltip(_("Fatal Error")) |
| 1226 | - self.set_from_icon_name("ubuntuone-client-error") |
| 1227 | - |
| 1228 | - else: |
| 1229 | - self.__connected = True |
| 1230 | - self.set_from_icon_name("ubuntuone-client-idle") |
| 1231 | - if state.startswith("CONNECTING") or \ |
| 1232 | - state.startswith("START_CONNECTING") or \ |
| 1233 | - state.startswith("AUTHENTICATING") or \ |
| 1234 | - state.startswith("CONNECTED") or \ |
| 1235 | - state.startswith("START_CONNECTED"): |
| 1236 | - self.set_from_icon_name("ubuntuone-client-idle") |
| 1237 | - self.set_tooltip(_("Connecting")) |
| 1238 | - self.__visible = True |
| 1239 | - |
| 1240 | - self.update_visibility() |
| 1241 | - |
| 1242 | - if self.__connected: |
| 1243 | - self.__litems["connect"].hide() |
| 1244 | - self.__litems["disconnect"].show() |
| 1245 | - else: |
| 1246 | - self.__litems["connect"].show() |
| 1247 | - self.__litems["disconnect"].hide() |
| 1248 | - self.__config.set("ubuntuone", "connected", self.__connected) |
| 1249 | - |
| 1250 | - def __hide_icon(self): |
| 1251 | - """Timeout to hide tray icon after a period of inactivity.""" |
| 1252 | - if self.__show_when == 0: |
| 1253 | - return False |
| 1254 | - |
| 1255 | - self.__visible = False |
| 1256 | - self.__visible_id = 0 |
| 1257 | - self.set_visible(False) |
| 1258 | - return False |
| 1259 | - |
| 1260 | - def __get_root(self): |
| 1261 | - """Method to get the rootdir from the sync daemon.""" |
| 1262 | - # Get the managed root directory |
| 1263 | - try: |
| 1264 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 1265 | - follow_name_owner_changes=True) |
| 1266 | - except DBusException: |
| 1267 | - return False |
| 1268 | - |
| 1269 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 1270 | - def got_root(root): |
| 1271 | - """We got the root dir.""" |
| 1272 | - self.__managed_dir = root |
| 1273 | - if os.path.isdir(self.__managed_dir) and \ |
| 1274 | - os.access(self.__managed_dir, |
| 1275 | - os.F_OK | os.R_OK): |
| 1276 | - self.__ritems["open"].set_sensitive(True) |
| 1277 | - self.__add_to_places() |
| 1278 | - else: |
| 1279 | - self.__ritems["open"].set_sensitive(False) |
| 1280 | - |
| 1281 | - def got_err(error): |
| 1282 | - """Handle error from the dbus callback.""" |
| 1283 | - self.sd_dbus_error(error) |
| 1284 | - self.__managed_dir = None |
| 1285 | - self.__ritems["open"].set_sensitive(False) |
| 1286 | - |
| 1287 | - iface.get_rootdir(reply_handler=got_root, error_handler=got_err) |
| 1288 | - |
| 1289 | - # Now get the current status |
| 1290 | - try: |
| 1291 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/status", |
| 1292 | - follow_name_owner_changes=True) |
| 1293 | - iface = dbus.Interface(client, DBUS_IFACE_STATUS_NAME) |
| 1294 | - iface.current_status(reply_handler=self.__status_changed, |
| 1295 | - error_handler=self.sd_dbus_error) |
| 1296 | - except DBusException, e: |
| 1297 | - self.sd_dbus_error(e) |
| 1298 | - return False |
| 1299 | - |
| 1300 | - return False |
| 1301 | - |
| 1302 | - def __build_menus(self): |
| 1303 | - """Create the pop-up menu items.""" |
| 1304 | - # Create the left-click menu |
| 1305 | - lmenu = gtk.Menu() |
| 1306 | - |
| 1307 | - self.__litems["status"] = gtk.MenuItem( |
| 1308 | - label=_("Your files are up to date.")) |
| 1309 | - lmenu.append(self.__litems["status"]) |
| 1310 | - self.__litems["status"].set_sensitive(False) |
| 1311 | - self.__litems["status"].show() |
| 1312 | - |
| 1313 | - sep = gtk.SeparatorMenuItem() |
| 1314 | - lmenu.append(sep) |
| 1315 | - sep.show() |
| 1316 | - |
| 1317 | - self.__litems["connect"] = gtk.ImageMenuItem( |
| 1318 | - stock_id=gtk.STOCK_CONNECT) |
| 1319 | - lmenu.append(self.__litems["connect"]) |
| 1320 | - self.__litems["connect"].connect("activate", self.__toggle_state) |
| 1321 | - self.__litems["connect"].show() |
| 1322 | - |
| 1323 | - self.__litems["disconnect"] = gtk.ImageMenuItem( |
| 1324 | - stock_id=gtk.STOCK_DISCONNECT) |
| 1325 | - lmenu.append(self.__litems["disconnect"]) |
| 1326 | - self.__litems["disconnect"].connect("activate", self.__toggle_state) |
| 1327 | - |
| 1328 | - lmenu.show() |
| 1329 | - |
| 1330 | - # Create the right-click menu |
| 1331 | - rmenu = gtk.Menu() |
| 1332 | - |
| 1333 | - self.__ritems["bug"] = gtk.MenuItem(label=_("_Report a Problem")) |
| 1334 | - rmenu.append(self.__ritems["bug"]) |
| 1335 | - self.__ritems["bug"].connect("activate", self.__report_problem) |
| 1336 | - self.__ritems["bug"].show() |
| 1337 | - |
| 1338 | - self.__ritems["open"] = gtk.MenuItem(label=_("_Open Folder")) |
| 1339 | - rmenu.append(self.__ritems["open"]) |
| 1340 | - self.__ritems["open"].connect("activate", self.__open_folder) |
| 1341 | - self.__ritems["open"].set_sensitive(False) |
| 1342 | - self.__ritems["open"].show() |
| 1343 | - |
| 1344 | - self.__ritems["web"] = gtk.MenuItem(label=_("_Go to Web")) |
| 1345 | - rmenu.append(self.__ritems["web"]) |
| 1346 | - self.__ritems["web"].connect("activate", self.__open_website) |
| 1347 | - self.__ritems["web"].show() |
| 1348 | - |
| 1349 | - self.__ritems["config"] = gtk.ImageMenuItem( |
| 1350 | - stock_id=gtk.STOCK_PREFERENCES) |
| 1351 | - rmenu.append(self.__ritems["config"]) |
| 1352 | - self.__ritems["config"].connect("activate", self.__open_config) |
| 1353 | - self.__ritems["config"].show() |
| 1354 | - |
| 1355 | - sep = gtk.SeparatorMenuItem() |
| 1356 | - rmenu.append(sep) |
| 1357 | - sep.show() |
| 1358 | - |
| 1359 | - self.__ritems["quit"] = gtk.ImageMenuItem(stock_id=gtk.STOCK_QUIT) |
| 1360 | - rmenu.append(self.__ritems["quit"]) |
| 1361 | - self.__ritems["quit"].connect("activate", self.__quit_applet) |
| 1362 | - self.__ritems["quit"].show() |
| 1363 | - |
| 1364 | - rmenu.show() |
| 1365 | - |
| 1366 | - return lmenu, rmenu |
| 1367 | - |
| 1368 | - def __size_changed(self, icon, size, data=None): |
| 1369 | - """Callback for when the size changes.""" |
| 1370 | - if size < 24: |
| 1371 | - self.__size = 16 |
| 1372 | - elif size >= 24 and size < 32: |
| 1373 | - self.__size = 24 |
| 1374 | - elif size >= 32 and size < 48: |
| 1375 | - self.__size = 32 |
| 1376 | - elif size >= 48 and size < 64: |
| 1377 | - self.__size = 48 |
| 1378 | - else: |
| 1379 | - self.__size = size |
| 1380 | - |
| 1381 | - def __popup_menu(self, icon, button, timestamp, data=None): |
| 1382 | - """Pops up the context menu for the tray icon.""" |
| 1383 | - if button == 0: |
| 1384 | - self.__status_menu.popup(None, None, |
| 1385 | - gtk.status_icon_position_menu, |
| 1386 | - button, timestamp, icon) |
| 1387 | - else: |
| 1388 | - self.__config_menu.popup(None, None, |
| 1389 | - gtk.status_icon_position_menu, |
| 1390 | - button, timestamp, icon) |
| 1391 | - |
| 1392 | - def __stop_syncdaemon(self): |
| 1393 | - """Tell the syncdaemon to quit.""" |
| 1394 | - def quit_error(e): |
| 1395 | - """Just log and ignore.""" |
| 1396 | - logger.error(_("Quit Error: %s") % e.get_dbus_message()) |
| 1397 | - |
| 1398 | - try: |
| 1399 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 1400 | - follow_name_owner_changes=True) |
| 1401 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 1402 | - iface.quit(reply_handler=dbus_async, |
| 1403 | - error_handler=quit_error) |
| 1404 | - except DBusException, e: |
| 1405 | - quit_error(e) |
| 1406 | - |
| 1407 | - def __quit_applet(self, menuitem, data=None): |
| 1408 | - """Quit the daemon and closes the applet.""" |
| 1409 | - self.__stop_syncdaemon() |
| 1410 | - |
| 1411 | - from twisted.internet import reactor |
| 1412 | - reactor.stop() |
| 1413 | - |
| 1414 | - def __toggle_state(self, menuitem, data=None): |
| 1415 | - """Connects or disconnects the storage sync process.""" |
| 1416 | - try: |
| 1417 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/", |
| 1418 | - follow_name_owner_changes=True) |
| 1419 | - iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME) |
| 1420 | - if self.__connected: |
| 1421 | - iface.disconnect(reply_handler=dbus_async, |
| 1422 | - error_handler=self.sd_dbus_error) |
| 1423 | - else: |
| 1424 | - if self.__main and self.__main.authorized is False: |
| 1425 | - self.__main.check_for_token(do_login=True) |
| 1426 | - iface.connect(reply_handler=dbus_async, |
| 1427 | - error_handler=self.sd_dbus_error) |
| 1428 | - except DBusException, e: |
| 1429 | - self.sd_dbus_error(e) |
| 1430 | - |
| 1431 | - self.__config.set("ubuntuone", "connected", not self.__connected) |
| 1432 | - with open(CONF_FILE, "w+b") as f: |
| 1433 | - self.__config.write(f) |
| 1434 | - |
| 1435 | - def __open_folder(self, data=None): |
| 1436 | - """Opens the storage folder in the file manager.""" |
| 1437 | - if not self.__managed_dir or not os.path.isdir(self.__managed_dir): |
| 1438 | - return |
| 1439 | - |
| 1440 | - folder = "file://%s" % quote(self.__managed_dir) |
| 1441 | - do_xdg_open(folder) |
| 1442 | - |
| 1443 | - def __do_action(self, data=None): |
| 1444 | - """Handles the most appropriate action when the icon is clicked.""" |
| 1445 | - if self.__fatal_error: |
| 1446 | - self.__report_problem() |
| 1447 | - self.__quit_applet(None) |
| 1448 | - return |
| 1449 | - |
| 1450 | - if self.__need_update: |
| 1451 | - do_xdg_open("apt:ubuntuone-storage-protocol?refresh=yes") |
| 1452 | - return |
| 1453 | - |
| 1454 | - # Popup the status menu |
| 1455 | - self.emit("popup-menu", 0, gtk.get_current_event_time()) |
| 1456 | - |
| 1457 | - def __report_problem_real(self): |
| 1458 | - """Runs apport to report a problem against our code.""" |
| 1459 | - args = ["ubuntu-bug", "ubuntuone-client"] |
| 1460 | - ret = subprocess.call(args, env=os.environ) |
| 1461 | - if ret != 0: |
| 1462 | - logger.error(_("Failed to run 'ubuntu-bug'")) |
| 1463 | - |
| 1464 | - def __report_problem(self, data=None): |
| 1465 | - """Pops another thread to run apport in.""" |
| 1466 | - Thread(target=self.__report_problem_real, name="apport").start() |
| 1467 | - |
| 1468 | - def __open_website(self, data=None, url=None): |
| 1469 | - """Opens the one.ubuntu.com web site.""" |
| 1470 | - if url: |
| 1471 | - do_xdg_open(url) |
| 1472 | - else: |
| 1473 | - do_xdg_open("https://one.ubuntu.com/") |
| 1474 | - |
| 1475 | - |
| 1476 | - def __open_config(self, data=None): |
| 1477 | - """Opens the preferences dialog.""" |
| 1478 | - do_config_open() |
| 1479 | - |
| 1480 | - def __add_to_places(self): |
| 1481 | - """Add the managed directory to the .gtk-bookmarks file.""" |
| 1482 | - # Only add once |
| 1483 | - if self.__config.getboolean("ubuntuone", "bookmarked"): |
| 1484 | - return |
| 1485 | - |
| 1486 | - path = os.path.join(os.path.expanduser("~"), ".gtk-bookmarks") |
| 1487 | - with open(path, "a+") as f: |
| 1488 | - bookmarks_entry = "file://%s %s\n" % ( |
| 1489 | - quote(self.__managed_dir), BOOKMARK_NAME) |
| 1490 | - in_file = False |
| 1491 | - for line in f: |
| 1492 | - if line == bookmarks_entry: |
| 1493 | - in_file = True |
| 1494 | - if not in_file: |
| 1495 | - f.write(bookmarks_entry) |
| 1496 | - |
| 1497 | - self.__config.set("ubuntuone", "bookmarked", "True") |
| 1498 | - with open(CONF_FILE, "w+b") as f: |
| 1499 | - self.__config.write(f) |
| 1500 | - |
| 1501 | - def sd_dbus_error(self, error): |
| 1502 | - """ |
| 1503 | - Handle DBus errors for crucial syncdaemon calls, |
| 1504 | - and change the applet behavior slightly. |
| 1505 | - """ |
| 1506 | - logger.error(_("DBus Error: %s") % error.get_dbus_message()) |
| 1507 | - if self.__fatal_error: |
| 1508 | - return |
| 1509 | - |
| 1510 | - self.__fatal_error = True |
| 1511 | - self.__status_changed({'name' : 'UNKNOWN_ERROR'}) |
| 1512 | - |
| 1513 | - |
| 1514 | -class AppletConfig(dbus.service.Object): |
| 1515 | - """DBus Service object""" |
| 1516 | - |
| 1517 | - def __init__(self, icon, *args, **kwargs): |
| 1518 | - """Initialize our magic.""" |
| 1519 | - self.icon = icon |
| 1520 | - self.path = "/config" |
| 1521 | - self.bus = dbus.SessionBus() |
| 1522 | - bus_name = dbus.service.BusName(APPLET_BUS_NAME, |
| 1523 | - bus=self.bus) |
| 1524 | - dbus.service.Object.__init__(self, bus_name=bus_name, |
| 1525 | - object_path=self.path) |
| 1526 | - |
| 1527 | - @dbus.service.method(APPLET_CONFIG_NAME, |
| 1528 | - in_signature='i', out_signature='') |
| 1529 | - def set_visibility_config(self, visibility): |
| 1530 | - self.icon.set_visibility_config(visibility) |
| 1531 | - |
| 1532 | - @dbus.service.method(APPLET_CONFIG_NAME, |
| 1533 | - in_signature='i', out_signature='') |
| 1534 | - def set_connection_config(self, connect): |
| 1535 | - self.icon.set_connection_config(connect) |
| 1536 | - |
| 1537 | - |
| 1538 | -if __name__ == "__main__": |
| 1539 | - gettext.bindtextdomain(clientdefs.GETTEXT_PACKAGE, clientdefs.LOCALEDIR) |
| 1540 | - gettext.textdomain(clientdefs.GETTEXT_PACKAGE) |
| 1541 | - |
| 1542 | - # Register DBus service for making sure we run only one instance |
| 1543 | - bus = dbus.SessionBus() |
| 1544 | - if bus.request_name(APPLET_BUS_NAME, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) == dbus.bus.REQUEST_NAME_REPLY_EXISTS: |
| 1545 | - print _("Ubuntu One client applet already running, quitting") |
| 1546 | - do_config_open() |
| 1547 | - sys.exit(0) |
| 1548 | - |
| 1549 | - gtk.rc_parse_string(RCSTYLE) |
| 1550 | - |
| 1551 | - icon = AppletMain() |
| 1552 | - icon.main() |
| 1553 | |
| 1554 | === removed file 'bin/ubuntuone-client-preferences' |
| 1555 | --- bin/ubuntuone-client-preferences 2009-12-07 17:35:00 +0000 |
| 1556 | +++ bin/ubuntuone-client-preferences 1970-01-01 00:00:00 +0000 |
| 1557 | @@ -1,360 +0,0 @@ |
| 1558 | -#!/usr/bin/python |
| 1559 | - |
| 1560 | -# ubuntuone-client-applet - Tray icon applet for managing Ubuntu One |
| 1561 | -# |
| 1562 | -# Author: Rodney Dawes <rodney.dawes@canonical.com> |
| 1563 | -# |
| 1564 | -# Copyright 2009 Canonical Ltd. |
| 1565 | -# |
| 1566 | -# This program is free software: you can redistribute it and/or modify it |
| 1567 | -# under the terms of the GNU General Public License version 3, as published |
| 1568 | -# by the Free Software Foundation. |
| 1569 | -# |
| 1570 | -# This program is distributed in the hope that it will be useful, but |
| 1571 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 1572 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 1573 | -# PURPOSE. See the GNU General Public License for more details. |
| 1574 | -# |
| 1575 | -# You should have received a copy of the GNU General Public License along |
| 1576 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 1577 | - |
| 1578 | -from __future__ import with_statement |
| 1579 | - |
| 1580 | -import pygtk |
| 1581 | -pygtk.require('2.0') |
| 1582 | -import gobject |
| 1583 | -import gtk |
| 1584 | -import os |
| 1585 | -import gettext |
| 1586 | -from ubuntuone import clientdefs |
| 1587 | - |
| 1588 | -import dbus.service |
| 1589 | -from ConfigParser import ConfigParser |
| 1590 | -from dbus.exceptions import DBusException |
| 1591 | -from dbus.mainloop.glib import DBusGMainLoop |
| 1592 | -from xdg.BaseDirectory import xdg_config_home |
| 1593 | - |
| 1594 | -DBusGMainLoop(set_as_default=True) |
| 1595 | - |
| 1596 | -_ = gettext.gettext |
| 1597 | - |
| 1598 | -APPLET_IFACE_NAME = "com.ubuntuone.ClientApplet" |
| 1599 | -APPLET_IFACE_CONFIG_NAME = APPLET_IFACE_NAME + ".Config" |
| 1600 | - |
| 1601 | -DBUS_IFACE_NAME = "com.ubuntuone.SyncDaemon" |
| 1602 | -DBUS_IFACE_CONFIG_NAME = DBUS_IFACE_NAME + ".Config" |
| 1603 | - |
| 1604 | -# Why thank you GTK+ for enforcing style-set and breaking API |
| 1605 | -RCSTYLE = """ |
| 1606 | -style 'dialogs' { |
| 1607 | - GtkDialog::action-area-border = 12 |
| 1608 | - GtkDialog::button-spacing = 6 |
| 1609 | - GtkDialog::content-area-border = 0 |
| 1610 | -} |
| 1611 | -widget_class '*Dialog*' style 'dialogs' |
| 1612 | -""" |
| 1613 | - |
| 1614 | -CONF_FILE = os.path.join(xdg_config_home, "ubuntuone", "ubuntuone-client.conf") |
| 1615 | - |
| 1616 | -def dbus_async(*args): |
| 1617 | - """Simple handler to make dbus do stuff async.""" |
| 1618 | - pass |
| 1619 | - |
| 1620 | - |
| 1621 | -class AppletConfigDialog(gtk.Dialog): |
| 1622 | - """Preferences dialog.""" |
| 1623 | - |
| 1624 | - def __init__(self, config=None, *args, **kw): |
| 1625 | - """Initializes our config dialog.""" |
| 1626 | - super(AppletConfigDialog, self).__init__(*args, **kw) |
| 1627 | - self.set_title(_("Ubuntu One Preferences")) |
| 1628 | - self.set_has_separator(False) |
| 1629 | - self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) |
| 1630 | - self.set_default_response(gtk.RESPONSE_CLOSE) |
| 1631 | - self.set_icon_name("ubuntuone-client") |
| 1632 | - |
| 1633 | - self.connect("close", self.__handle_response, gtk.RESPONSE_CLOSE) |
| 1634 | - self.connect("response", self.__handle_response) |
| 1635 | - |
| 1636 | - self.config = config |
| 1637 | - |
| 1638 | - self.bw_enabled = False |
| 1639 | - self.up_limit = 2097152 |
| 1640 | - self.dn_limit = 2097152 |
| 1641 | - |
| 1642 | - self.__bus = dbus.SessionBus() |
| 1643 | - |
| 1644 | - try: |
| 1645 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 1646 | - follow_name_owner_changes=True) |
| 1647 | - iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 1648 | - iface.get_throttling_limits( |
| 1649 | - reply_handler=self.__got_limits, |
| 1650 | - error_handler=self.__dbus_error) |
| 1651 | - iface.bandwidth_throttling_enabled( |
| 1652 | - reply_handler=self.__got_enabled, |
| 1653 | - error_handler=self.__dbus_error) |
| 1654 | - except DBusException, e: |
| 1655 | - self.__dbus_error(e) |
| 1656 | - |
| 1657 | - # Timeout ID to avoid spamming DBus from spinbutton changes |
| 1658 | - self.__update_id = 0 |
| 1659 | - |
| 1660 | - self.load_config() |
| 1661 | - |
| 1662 | - self.__construct() |
| 1663 | - |
| 1664 | - def load_config(self): |
| 1665 | - """Load the configuration, and initilize if empty.""" |
| 1666 | - if not os.path.isdir(os.path.dirname(CONF_FILE)): |
| 1667 | - os.makedirs(os.path.dirname(CONF_FILE)) |
| 1668 | - |
| 1669 | - self.config = ConfigParser() |
| 1670 | - self.config.read(CONF_FILE) |
| 1671 | - |
| 1672 | - if not self.config.has_section("ubuntuone"): |
| 1673 | - self.config.add_section("ubuntuone") |
| 1674 | - |
| 1675 | - if not self.config.has_option("ubuntuone", "show_applet"): |
| 1676 | - self.config.set("ubuntuone", "show_applet", "1") |
| 1677 | - |
| 1678 | - if not self.config.has_option("ubuntuone", "connect"): |
| 1679 | - self.config.set("ubuntuone", "connect", "0") |
| 1680 | - |
| 1681 | - if not self.config.has_option("ubuntuone", "connected"): |
| 1682 | - self.config.set("ubuntuone", "connected", "False") |
| 1683 | - |
| 1684 | - if not os.path.exists(CONF_FILE): |
| 1685 | - self.save_config() |
| 1686 | - |
| 1687 | - def save_config(self): |
| 1688 | - """Write the configuration back to a file.""" |
| 1689 | - with open(CONF_FILE, "w+b") as f: |
| 1690 | - self.config.write(f) |
| 1691 | - |
| 1692 | - def quit(self): |
| 1693 | - """Exit the main loop.""" |
| 1694 | - gtk.main_quit() |
| 1695 | - |
| 1696 | - def __dbus_error(self, error): |
| 1697 | - """Error getting throttling config.""" |
| 1698 | - print repr(error) |
| 1699 | - |
| 1700 | - def __got_limits(self, limits): |
| 1701 | - """Got the throttling limits.""" |
| 1702 | - self.up_limit = int(limits['upload']) |
| 1703 | - self.dn_limit = int(limits['download']) |
| 1704 | - self.up_spin.set_value(self.up_limit / 1024) |
| 1705 | - self.dn_spin.set_value(self.dn_limit / 1024) |
| 1706 | - |
| 1707 | - def __got_enabled(self, enabled): |
| 1708 | - """Got the throttling enabled config.""" |
| 1709 | - self.bw_enabled = bool(enabled) |
| 1710 | - self.limit_check.set_active(self.bw_enabled) |
| 1711 | - |
| 1712 | - def __update_bw_settings(self): |
| 1713 | - """Update the bandwidth throttling config in syncdaemon.""" |
| 1714 | - self.bw_enabled = self.limit_check.get_active() |
| 1715 | - self.up_limit = self.up_spin.get_value_as_int() * 1024 |
| 1716 | - self.dn_limit = self.dn_spin.get_value_as_int() * 1024 |
| 1717 | - |
| 1718 | - try: |
| 1719 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 1720 | - follow_name_owner_changes=True) |
| 1721 | - iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 1722 | - iface.set_throttling_limits(self.dn_limit, self.up_limit, |
| 1723 | - reply_handler=dbus_async, |
| 1724 | - error_handler=self.__dbus_error) |
| 1725 | - if self.bw_enabled: |
| 1726 | - iface.enable_bandwidth_throttling( |
| 1727 | - reply_handler=dbus_async, |
| 1728 | - error_handler=self.__dbus_error) |
| 1729 | - else: |
| 1730 | - iface.disable_bandwidth_throttling( |
| 1731 | - reply_handler=dbus_async, |
| 1732 | - error_handler=self.__dbus_error) |
| 1733 | - except DBusException, e: |
| 1734 | - self.__dbus_error(e) |
| 1735 | - |
| 1736 | - def __handle_response(self, dialog, response): |
| 1737 | - """Handle the dialog's response.""" |
| 1738 | - self.hide() |
| 1739 | - self.config.set("ubuntuone", "show_applet", |
| 1740 | - self.show_menu.get_active()) |
| 1741 | - self.config.set("ubuntuone", "connect", |
| 1742 | - self.conn_menu.get_active()) |
| 1743 | - |
| 1744 | - self.__update_bw_settings() |
| 1745 | - self.save_config() |
| 1746 | - gtk.main_quit() |
| 1747 | - |
| 1748 | - def __show_menu_changed(self, menu, data=None): |
| 1749 | - """Update the config for showing the applet.""" |
| 1750 | - value = menu.get_active() |
| 1751 | - self.config.set("ubuntuone", "show_applet", str(value)) |
| 1752 | - try: |
| 1753 | - client = self.__bus.get_object(APPLET_IFACE_NAME, "/config", |
| 1754 | - follow_name_owner_changes=True) |
| 1755 | - iface = dbus.Interface(client, APPLET_IFACE_CONFIG_NAME) |
| 1756 | - iface.set_visibility_config(value, reply_handler=dbus_async, |
| 1757 | - error_handler=self.__dbus_error) |
| 1758 | - except DBusException, e: |
| 1759 | - self.__dbus_error(e) |
| 1760 | - |
| 1761 | - def __conn_menu_changed(self, menu, data=None): |
| 1762 | - """Update the config for showing the applet.""" |
| 1763 | - value = menu.get_active() |
| 1764 | - self.config.set("ubuntuone", "connect", str(value)) |
| 1765 | - try: |
| 1766 | - client = self.__bus.get_object(APPLET_IFACE_NAME, "/config", |
| 1767 | - follow_name_owner_changes=True) |
| 1768 | - iface = dbus.Interface(client, APPLET_IFACE_CONFIG_NAME) |
| 1769 | - iface.set_connection_config(value, reply_handler=dbus_async, |
| 1770 | - error_handler=self.__dbus_error) |
| 1771 | - except DBusException, e: |
| 1772 | - self.__dbus_error(e) |
| 1773 | - |
| 1774 | - def __bw_limit_toggled(self, button, data=None): |
| 1775 | - """Toggle the bw limit panel.""" |
| 1776 | - self.bw_enabled = self.limit_check.get_active() |
| 1777 | - self.bw_table.set_sensitive(self.bw_enabled) |
| 1778 | - try: |
| 1779 | - client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 1780 | - follow_name_owner_changes=True) |
| 1781 | - iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 1782 | - iface.set_throttling_limits(self.dn_limit, self.up_limit, |
| 1783 | - reply_handler=dbus_async, |
| 1784 | - error_handler=self.__dbus_error) |
| 1785 | - if self.bw_enabled: |
| 1786 | - iface.enable_bandwidth_throttling( |
| 1787 | - reply_handler=dbus_async, |
| 1788 | - error_handler=self.__dbus_error) |
| 1789 | - else: |
| 1790 | - iface.disable_bandwidth_throttling( |
| 1791 | - reply_handler=dbus_async, |
| 1792 | - error_handler=self.__dbus_error) |
| 1793 | - except DBusException, e: |
| 1794 | - self.__dbus_error(e) |
| 1795 | - |
| 1796 | - def __spinner_changed(self, button, data=None): |
| 1797 | - """Remove timeout and add anew.""" |
| 1798 | - if self.__update_id != 0: |
| 1799 | - gobject.source_remove(self.__update_id) |
| 1800 | - |
| 1801 | - self.__update_id = gobject.timeout_add_seconds( |
| 1802 | - 1, self.__update_bw_settings) |
| 1803 | - |
| 1804 | - def __construct(self): |
| 1805 | - """Construct the dialog's layout.""" |
| 1806 | - area = self.get_content_area() |
| 1807 | - |
| 1808 | - vbox = gtk.VBox(spacing=12) |
| 1809 | - vbox.set_border_width(12) |
| 1810 | - area.add(vbox) |
| 1811 | - vbox.show() |
| 1812 | - |
| 1813 | - # Put the first set of options in a table. |
| 1814 | - table = gtk.Table(rows=2, columns=2) |
| 1815 | - table.set_row_spacings(12) |
| 1816 | - table.set_col_spacings(6) |
| 1817 | - vbox.add(table) |
| 1818 | - table.show() |
| 1819 | - |
| 1820 | - label = gtk.Label(_("_Show icon:")) |
| 1821 | - label.set_use_underline(True) |
| 1822 | - label.set_alignment(0, 0.5) |
| 1823 | - table.attach(label, 0, 1, 0, 1) |
| 1824 | - label.show() |
| 1825 | - |
| 1826 | - self.show_menu = gtk.combo_box_new_text() |
| 1827 | - self.show_menu.connect("changed", self.__show_menu_changed) |
| 1828 | - label.set_mnemonic_widget(self.show_menu) |
| 1829 | - self.show_menu.append_text(_("Always")) |
| 1830 | - self.show_menu.append_text(_("When updating")) |
| 1831 | - self.show_menu.append_text(_("Never")) |
| 1832 | - self.show_menu.set_active(self.config.getint("ubuntuone", |
| 1833 | - "show_applet")) |
| 1834 | - table.attach(self.show_menu, 1, 2, 0, 1) |
| 1835 | - self.show_menu.show() |
| 1836 | - |
| 1837 | - label = gtk.Label(_("Connect on start:")) |
| 1838 | - label.set_use_underline(True) |
| 1839 | - label.set_alignment(0, 0.5) |
| 1840 | - table.attach(label, 0, 1, 1, 2) |
| 1841 | - label.show() |
| 1842 | - |
| 1843 | - self.conn_menu = gtk.combo_box_new_text() |
| 1844 | - self.conn_menu.connect("changed", self.__conn_menu_changed) |
| 1845 | - label.set_mnemonic_widget(self.conn_menu) |
| 1846 | - self.conn_menu.append_text(_("Automatically")) |
| 1847 | - self.conn_menu.append_text(_("Remember last")) |
| 1848 | - self.conn_menu.append_text(_("Never")) |
| 1849 | - self.conn_menu.set_active(self.config.getint("ubuntuone", |
| 1850 | - "connect")) |
| 1851 | - table.attach(self.conn_menu, 1, 2, 1, 2) |
| 1852 | - self.conn_menu.show() |
| 1853 | - |
| 1854 | - # Bandwidth limiting |
| 1855 | - self.limit_check = gtk.CheckButton(_("_Limit Bandwidth Usage")) |
| 1856 | - self.limit_check.connect("toggled", self.__bw_limit_toggled) |
| 1857 | - vbox.add(self.limit_check) |
| 1858 | - self.limit_check.show() |
| 1859 | - |
| 1860 | - hbox = gtk.HBox(spacing=12) |
| 1861 | - vbox.add(hbox) |
| 1862 | - hbox.show() |
| 1863 | - |
| 1864 | - label = gtk.Label() |
| 1865 | - hbox.add(label) |
| 1866 | - label.show() |
| 1867 | - |
| 1868 | - # Now put the bw limit bits in a table too |
| 1869 | - self.bw_table = gtk.Table(rows=2, columns=2) |
| 1870 | - self.bw_table.set_row_spacings(6) |
| 1871 | - self.bw_table.set_col_spacings(6) |
| 1872 | - self.bw_table.set_sensitive(False) |
| 1873 | - hbox.add(self.bw_table) |
| 1874 | - self.bw_table.show() |
| 1875 | - |
| 1876 | - # Upload speed |
| 1877 | - label = gtk.Label(_("Maximum _upload speed (KB/s):")) |
| 1878 | - label.set_use_underline(True) |
| 1879 | - label.set_alignment(0, 0.5) |
| 1880 | - self.bw_table.attach(label, 0, 1, 0, 1) |
| 1881 | - label.show() |
| 1882 | - |
| 1883 | - adjustment = gtk.Adjustment(value=2048.0, lower=0.0, upper=4096.0, |
| 1884 | - step_incr=64.0, page_incr=128.0) |
| 1885 | - self.up_spin = gtk.SpinButton(adjustment) |
| 1886 | - self.up_spin.connect("value-changed", self.__spinner_changed) |
| 1887 | - label.set_mnemonic_widget(self.up_spin) |
| 1888 | - self.bw_table.attach(self.up_spin, 1, 2, 0, 1) |
| 1889 | - self.up_spin.show() |
| 1890 | - |
| 1891 | - # Download speed |
| 1892 | - label = gtk.Label(_("Maximum _download speed (KB/s):")) |
| 1893 | - label.set_use_underline(True) |
| 1894 | - label.set_alignment(0, 0.5) |
| 1895 | - self.bw_table.attach(label, 0, 1, 1, 2) |
| 1896 | - label.show() |
| 1897 | - adjustment = gtk.Adjustment(value=2048.0, lower=0.0, upper=4096.0, |
| 1898 | - step_incr=64.0, page_incr=128.0) |
| 1899 | - self.dn_spin = gtk.SpinButton(adjustment) |
| 1900 | - self.dn_spin.connect("value-changed", self.__spinner_changed) |
| 1901 | - label.set_mnemonic_widget(self.dn_spin) |
| 1902 | - self.bw_table.attach(self.dn_spin, 1, 2, 1, 2) |
| 1903 | - self.dn_spin.show() |
| 1904 | - |
| 1905 | - |
| 1906 | -if __name__ == "__main__": |
| 1907 | - gettext.bindtextdomain(clientdefs.GETTEXT_PACKAGE, clientdefs.LOCALEDIR) |
| 1908 | - gettext.textdomain(clientdefs.GETTEXT_PACKAGE) |
| 1909 | - |
| 1910 | - gtk.rc_parse_string(RCSTYLE) |
| 1911 | - |
| 1912 | - try: |
| 1913 | - dialog = AppletConfigDialog() |
| 1914 | - dialog.show() |
| 1915 | - gtk.main() |
| 1916 | - except KeyboardInterrupt: |
| 1917 | - pass |
| 1918 | |
| 1919 | === added file 'bin/ubuntuone-login' |
| 1920 | --- bin/ubuntuone-login 1970-01-01 00:00:00 +0000 |
| 1921 | +++ bin/ubuntuone-login 2010-02-18 00:10:25 +0000 |
| 1922 | @@ -0,0 +1,226 @@ |
| 1923 | +#!/usr/bin/python |
| 1924 | + |
| 1925 | +# ubuntuone-login - Client side log-in utility for Ubuntu One |
| 1926 | +# |
| 1927 | +# Author: Rodney Dawes <rodney.dawes@canonical.com> |
| 1928 | +# |
| 1929 | +# Copyright 2009 Canonical Ltd. |
| 1930 | +# |
| 1931 | +# This program is free software: you can redistribute it and/or modify it |
| 1932 | +# under the terms of the GNU General Public License version 3, as published |
| 1933 | +# by the Free Software Foundation. |
| 1934 | +# |
| 1935 | +# This program is distributed in the hope that it will be useful, but |
| 1936 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 1937 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 1938 | +# PURPOSE. See the GNU General Public License for more details. |
| 1939 | +# |
| 1940 | +# You should have received a copy of the GNU General Public License along |
| 1941 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 1942 | + |
| 1943 | +import pygtk |
| 1944 | +pygtk.require('2.0') |
| 1945 | +import gtk |
| 1946 | +import pango |
| 1947 | +import sys |
| 1948 | +import gettext |
| 1949 | +from ubuntuone import clientdefs |
| 1950 | + |
| 1951 | +import dbus.service |
| 1952 | + |
| 1953 | +from dbus.mainloop.glib import DBusGMainLoop |
| 1954 | +from ubuntuone.oauthdesktop.main import Login |
| 1955 | + |
| 1956 | +from ubuntuone.oauthdesktop.logger import setupLogging |
| 1957 | +logger = setupLogging("ubuntuone-login") |
| 1958 | + |
| 1959 | +DBusGMainLoop(set_as_default=True) |
| 1960 | + |
| 1961 | +_ = gettext.gettext |
| 1962 | +ngettext = gettext.ngettext |
| 1963 | + |
| 1964 | +DBUS_IFACE_AUTH_NAME = "com.ubuntuone.Authentication" |
| 1965 | + |
| 1966 | +OAUTH_REALM = "https://ubuntuone.com" |
| 1967 | +OAUTH_CONSUMER = "ubuntuone" |
| 1968 | + |
| 1969 | +NOTIFY_ICON_SIZE = 48 |
| 1970 | + |
| 1971 | +# Why thank you GTK+ for enforcing style-set and breaking API |
| 1972 | +RCSTYLE = """ |
| 1973 | +style 'dialogs' { |
| 1974 | + GtkDialog::action-area-border = 12 |
| 1975 | + GtkDialog::button-spacing = 6 |
| 1976 | + GtkDialog::content-area-border = 0 |
| 1977 | +} |
| 1978 | +widget_class '*Dialog*' style 'dialogs' |
| 1979 | +""" |
| 1980 | + |
| 1981 | + |
| 1982 | +class LoginMain(object): |
| 1983 | + """Main login manager process class.""" |
| 1984 | + |
| 1985 | + def __init__(self, *args, **kw): |
| 1986 | + """Initializes the child threads and dbus monitor.""" |
| 1987 | + gtk.rc_parse_string(RCSTYLE) |
| 1988 | + |
| 1989 | + logger.info(_("Starting Ubuntu One login manager version %s") % |
| 1990 | + clientdefs.VERSION) |
| 1991 | + |
| 1992 | + self.__bus = dbus.SessionBus() |
| 1993 | + |
| 1994 | + def _connect_dbus_signals(self): |
| 1995 | + """Set up some signal handlers for DBus signals.""" |
| 1996 | + self.__bus.add_signal_receiver( |
| 1997 | + handler_function=self.new_credentials, |
| 1998 | + signal_name="NewCredentials", |
| 1999 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2000 | + self.__bus.add_signal_receiver( |
| 2001 | + handler_function=self.auth_denied, |
| 2002 | + signal_name="AuthorizationDenied", |
| 2003 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2004 | + self.__bus.add_signal_receiver( |
| 2005 | + handler_function=self.got_oauth_error, |
| 2006 | + signal_name="OAuthError", |
| 2007 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2008 | + |
| 2009 | + |
| 2010 | + def new_credentials(self, realm=None, consumer_key=None, sender=None): |
| 2011 | + """Signal callback for when we get new credentials.""" |
| 2012 | + self.set_up_desktopcouch_pairing(consumer_key) |
| 2013 | + |
| 2014 | + def auth_denied(self): |
| 2015 | + """Signal callback for when auth was denied by user.""" |
| 2016 | + logger.info(_("Access to Ubuntu One was denied.")) |
| 2017 | + |
| 2018 | + from twisted.internet import reactor |
| 2019 | + reactor.stop() |
| 2020 | + |
| 2021 | + def got_oauth_error(self, message=None): |
| 2022 | + """Signal callback for when an OAuth error occured.""" |
| 2023 | + def dialog_response(dialog, response): |
| 2024 | + """Handle the dialog closing.""" |
| 2025 | + dialog.destroy() |
| 2026 | + |
| 2027 | + if message: |
| 2028 | + logger.error(message) |
| 2029 | + dialog = gtk.Dialog(title=_("Ubuntu One: Error"), |
| 2030 | + flags=gtk.DIALOG_NO_SEPARATOR, |
| 2031 | + buttons=(gtk.STOCK_CLOSE, |
| 2032 | + gtk.RESPONSE_CLOSE)) |
| 2033 | + dialog.set_default_response(gtk.RESPONSE_CLOSE) |
| 2034 | + dialog.set_icon_name("ubuntuone-client") |
| 2035 | + |
| 2036 | + area = dialog.get_content_area() |
| 2037 | + |
| 2038 | + hbox = gtk.HBox(spacing=12) |
| 2039 | + hbox.set_border_width(12) |
| 2040 | + area.pack_start(hbox) |
| 2041 | + hbox.show() |
| 2042 | + |
| 2043 | + image = gtk.Image() |
| 2044 | + image.set_from_icon_name("dialog-error", gtk.ICON_SIZE_DIALOG) |
| 2045 | + image.set_alignment(0.5, 0.0) |
| 2046 | + image.show() |
| 2047 | + hbox.pack_start(image, False, False) |
| 2048 | + |
| 2049 | + vbox = gtk.VBox(spacing=12) |
| 2050 | + vbox.show() |
| 2051 | + hbox.pack_start(vbox) |
| 2052 | + |
| 2053 | + label = gtk.Label("<b>%s</b>" % _("Authorization Error")) |
| 2054 | + label.set_use_markup(True) |
| 2055 | + label.set_alignment(0.0, 0.5) |
| 2056 | + label.show() |
| 2057 | + vbox.pack_start(label, False, False) |
| 2058 | + |
| 2059 | + label = gtk.Label(message) |
| 2060 | + label.set_line_wrap(True) |
| 2061 | + label.set_max_width_chars(64) |
| 2062 | + label.set_ellipsize(pango.ELLIPSIZE_MIDDLE) |
| 2063 | + label.set_alignment(0.0, 0.0) |
| 2064 | + label.show() |
| 2065 | + vbox.pack_start(label, True, True) |
| 2066 | + |
| 2067 | + dialog.connect('close', dialog_response, gtk.RESPONSE_CLOSE) |
| 2068 | + dialog.connect('response', dialog_response) |
| 2069 | + |
| 2070 | + dialog.show() |
| 2071 | + else: |
| 2072 | + logger.error(_("Got an OAuth error with no message.")) |
| 2073 | + |
| 2074 | + def set_up_desktopcouch_pairing(self, consumer_key): |
| 2075 | + """Add a pairing record between desktopcouch and Ubuntu One""" |
| 2076 | + try: |
| 2077 | + from desktopcouch.pair.couchdb_pairing.couchdb_io import \ |
| 2078 | + put_static_paired_service |
| 2079 | + from desktopcouch.records.server import CouchDatabase |
| 2080 | + except ImportError: |
| 2081 | + # desktopcouch is not installed |
| 2082 | + logger.debug(_("Not adding desktopcouch pairing since" |
| 2083 | + " desktopcouch is not installed")) |
| 2084 | + return |
| 2085 | + # Check whether there is already a record of the Ubuntu One service |
| 2086 | + db = CouchDatabase("management", create=True) |
| 2087 | + if not db.view_exists("ubuntu_one_pair_record","ubuntu_one_pair_record"): |
| 2088 | + map_js = """function(doc) { |
| 2089 | + if (doc.service_name == "ubuntuone") { |
| 2090 | + if (doc.application_annotations && |
| 2091 | + doc.application_annotations["Ubuntu One"] && |
| 2092 | + doc.application_annotations["Ubuntu One"]["private_application_annotations"] && |
| 2093 | + doc.application_annotations["Ubuntu One"]["private_application_annotations"]["deleted"]) { |
| 2094 | + emit(doc._id, 1); |
| 2095 | + } else { |
| 2096 | + emit(doc._id, 0) |
| 2097 | + } |
| 2098 | + } |
| 2099 | + }""" |
| 2100 | + db.add_view("ubuntu_one_pair_record", map_js, None, |
| 2101 | + "ubuntu_one_pair_record") |
| 2102 | + results = db.execute_view("ubuntu_one_pair_record", |
| 2103 | + "ubuntu_one_pair_record") |
| 2104 | + found = False |
| 2105 | + # Results should contain either one row or no rows |
| 2106 | + # If there is one row, its value will be 0, meaning that there is |
| 2107 | + # already an Ubuntu One pairing record, or 1, meaning that there |
| 2108 | + # was an Ubuntu One pairing record but it has since been unpaired |
| 2109 | + # Only create a new record if there is not one already. Specifically, |
| 2110 | + # do not add the record if there is a deleted one, as this means |
| 2111 | + # that the user explicitly unpaired it! |
| 2112 | + for row in results: |
| 2113 | + found = True |
| 2114 | + if row.value == 1: |
| 2115 | + logger.debug(_("Not adding desktopcouch pairing since" |
| 2116 | + " the user has explicitly unpaired with Ubuntu One")) |
| 2117 | + else: |
| 2118 | + logger.debug(_("Not adding desktopcouch pairing since" |
| 2119 | + " we are already paired")) |
| 2120 | + if not found: |
| 2121 | + put_static_paired_service(None, "ubuntuone") |
| 2122 | + logger.debug(_("Pairing desktopcouch with Ubuntu One")) |
| 2123 | + |
| 2124 | + def main(self): |
| 2125 | + """Starts the gtk main loop.""" |
| 2126 | + self._connect_dbus_signals() |
| 2127 | + |
| 2128 | + from twisted.internet import reactor |
| 2129 | + reactor.run() |
| 2130 | + |
| 2131 | + |
| 2132 | +if __name__ == "__main__": |
| 2133 | + gettext.bindtextdomain(clientdefs.GETTEXT_PACKAGE, clientdefs.LOCALEDIR) |
| 2134 | + gettext.textdomain(clientdefs.GETTEXT_PACKAGE) |
| 2135 | + |
| 2136 | + # Register DBus service for making sure we run only one instance |
| 2137 | + bus = dbus.SessionBus() |
| 2138 | + if bus.request_name(DBUS_IFACE_AUTH_NAME, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) == dbus.bus.REQUEST_NAME_REPLY_EXISTS: |
| 2139 | + print _("Ubuntu One login manager already running, quitting") |
| 2140 | + sys.exit(0) |
| 2141 | + |
| 2142 | + from twisted.internet import gtk2reactor |
| 2143 | + gtk2reactor.install() |
| 2144 | + |
| 2145 | + login = Login(dbus.service.BusName(DBUS_IFACE_AUTH_NAME, |
| 2146 | + bus=dbus.SessionBus())) |
| 2147 | + manager = LoginMain() |
| 2148 | + manager.main() |
| 2149 | |
| 2150 | === added file 'bin/ubuntuone-preferences' |
| 2151 | --- bin/ubuntuone-preferences 1970-01-01 00:00:00 +0000 |
| 2152 | +++ bin/ubuntuone-preferences 2010-02-18 00:10:25 +0000 |
| 2153 | @@ -0,0 +1,549 @@ |
| 2154 | +#!/usr/bin/python |
| 2155 | + |
| 2156 | +# ubuntuone-client-applet - Tray icon applet for managing Ubuntu One |
| 2157 | +# |
| 2158 | +# Author: Rodney Dawes <rodney.dawes@canonical.com> |
| 2159 | +# |
| 2160 | +# Copyright 2009 Canonical Ltd. |
| 2161 | +# |
| 2162 | +# This program is free software: you can redistribute it and/or modify it |
| 2163 | +# under the terms of the GNU General Public License version 3, as published |
| 2164 | +# by the Free Software Foundation. |
| 2165 | +# |
| 2166 | +# This program is distributed in the hope that it will be useful, but |
| 2167 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 2168 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 2169 | +# PURPOSE. See the GNU General Public License for more details. |
| 2170 | +# |
| 2171 | +# You should have received a copy of the GNU General Public License along |
| 2172 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 2173 | + |
| 2174 | +from __future__ import division |
| 2175 | + |
| 2176 | +import pygtk |
| 2177 | +pygtk.require('2.0') |
| 2178 | +import gobject |
| 2179 | +import gtk |
| 2180 | +import os |
| 2181 | +import gettext |
| 2182 | +import gnomekeyring |
| 2183 | +import httplib2 |
| 2184 | +import simplejson |
| 2185 | +from oauth import oauth |
| 2186 | +from ubuntuone import clientdefs |
| 2187 | + |
| 2188 | +import dbus.service |
| 2189 | +from ConfigParser import ConfigParser |
| 2190 | +from dbus.exceptions import DBusException |
| 2191 | +from dbus.mainloop.glib import DBusGMainLoop |
| 2192 | +from xdg.BaseDirectory import xdg_config_home |
| 2193 | + |
| 2194 | +DBusGMainLoop(set_as_default=True) |
| 2195 | + |
| 2196 | +_ = gettext.gettext |
| 2197 | + |
| 2198 | +DBUS_IFACE_NAME = "com.ubuntuone.SyncDaemon" |
| 2199 | +DBUS_IFACE_CONFIG_NAME = DBUS_IFACE_NAME + ".Config" |
| 2200 | + |
| 2201 | +DBUS_IFACE_AUTH_NAME = "com.ubuntuone.Authentication" |
| 2202 | +DBUS_IFACE_AUTH_PATH = "/" |
| 2203 | + |
| 2204 | +# Why thank you GTK+ for enforcing style-set and breaking API |
| 2205 | +RCSTYLE = """ |
| 2206 | +style 'dialogs' { |
| 2207 | + GtkDialog::action-area-border = 12 |
| 2208 | + GtkDialog::button-spacing = 6 |
| 2209 | + GtkDialog::content-area-border = 0 |
| 2210 | +} |
| 2211 | +widget_class '*Dialog*' style 'dialogs' |
| 2212 | +""" |
| 2213 | + |
| 2214 | +def dbus_async(*args): |
| 2215 | + """Simple handler to make dbus do stuff async.""" |
| 2216 | + pass |
| 2217 | + |
| 2218 | + |
| 2219 | +class UbuntuOneDialog(gtk.Dialog): |
| 2220 | + """Preferences dialog.""" |
| 2221 | + |
| 2222 | + def __init__(self, config=None, *args, **kw): |
| 2223 | + """Initializes our config dialog.""" |
| 2224 | + super(UbuntuOneDialog, self).__init__(*args, **kw) |
| 2225 | + self.set_title(_("Ubuntu One Preferences")) |
| 2226 | + self.set_has_separator(False) |
| 2227 | + self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) |
| 2228 | + self.set_default_response(gtk.RESPONSE_CLOSE) |
| 2229 | + self.set_icon_name("ubuntuone") |
| 2230 | + |
| 2231 | + self.connect("close", self.__handle_response, gtk.RESPONSE_CLOSE) |
| 2232 | + self.connect("response", self.__handle_response) |
| 2233 | + |
| 2234 | + self.bw_enabled = False |
| 2235 | + self.up_limit = 2097152 |
| 2236 | + self.dn_limit = 2097152 |
| 2237 | + |
| 2238 | + self.__bus = dbus.SessionBus() |
| 2239 | + self.keyring = gnomekeyring |
| 2240 | + |
| 2241 | + try: |
| 2242 | + client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 2243 | + follow_name_owner_changes=True) |
| 2244 | + iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 2245 | + iface.get_throttling_limits( |
| 2246 | + reply_handler=self.__got_limits, |
| 2247 | + error_handler=self.__dbus_error) |
| 2248 | + iface.bandwidth_throttling_enabled( |
| 2249 | + reply_handler=self.__got_enabled, |
| 2250 | + error_handler=self.__dbus_error) |
| 2251 | + except DBusException, e: |
| 2252 | + self.__dbus_error(e) |
| 2253 | + |
| 2254 | + # Timeout ID to avoid spamming DBus from spinbutton changes |
| 2255 | + self.__update_id = 0 |
| 2256 | + |
| 2257 | + self.__construct() |
| 2258 | + |
| 2259 | + def quit(self): |
| 2260 | + """Exit the main loop.""" |
| 2261 | + gtk.main_quit() |
| 2262 | + |
| 2263 | + def __dbus_error(self, error): |
| 2264 | + """Error getting throttling config.""" |
| 2265 | + print repr(error) |
| 2266 | + |
| 2267 | + def __got_limits(self, limits): |
| 2268 | + """Got the throttling limits.""" |
| 2269 | + self.up_limit = int(limits['upload']) |
| 2270 | + self.dn_limit = int(limits['download']) |
| 2271 | + self.up_spin.set_value(self.up_limit / 1024) |
| 2272 | + self.dn_spin.set_value(self.dn_limit / 1024) |
| 2273 | + |
| 2274 | + def __got_enabled(self, enabled): |
| 2275 | + """Got the throttling enabled config.""" |
| 2276 | + self.bw_enabled = bool(enabled) |
| 2277 | + self.limit_check.set_active(self.bw_enabled) |
| 2278 | + |
| 2279 | + def __update_bw_settings(self): |
| 2280 | + """Update the bandwidth throttling config in syncdaemon.""" |
| 2281 | + self.bw_enabled = self.limit_check.get_active() |
| 2282 | + self.up_limit = self.up_spin.get_value_as_int() * 1024 |
| 2283 | + self.dn_limit = self.dn_spin.get_value_as_int() * 1024 |
| 2284 | + |
| 2285 | + try: |
| 2286 | + client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 2287 | + follow_name_owner_changes=True) |
| 2288 | + iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 2289 | + iface.set_throttling_limits(self.dn_limit, self.up_limit, |
| 2290 | + reply_handler=dbus_async, |
| 2291 | + error_handler=self.__dbus_error) |
| 2292 | + if self.bw_enabled: |
| 2293 | + iface.enable_bandwidth_throttling( |
| 2294 | + reply_handler=dbus_async, |
| 2295 | + error_handler=self.__dbus_error) |
| 2296 | + else: |
| 2297 | + iface.disable_bandwidth_throttling( |
| 2298 | + reply_handler=dbus_async, |
| 2299 | + error_handler=self.__dbus_error) |
| 2300 | + except DBusException, e: |
| 2301 | + self.__dbus_error(e) |
| 2302 | + |
| 2303 | + def __handle_response(self, dialog, response): |
| 2304 | + """Handle the dialog's response.""" |
| 2305 | + self.hide() |
| 2306 | + self.__update_bw_settings() |
| 2307 | + gtk.main_quit() |
| 2308 | + |
| 2309 | + def __bw_limit_toggled(self, button, data=None): |
| 2310 | + """Toggle the bw limit panel.""" |
| 2311 | + self.bw_enabled = self.limit_check.get_active() |
| 2312 | + self.bw_table.set_sensitive(self.bw_enabled) |
| 2313 | + try: |
| 2314 | + client = self.__bus.get_object(DBUS_IFACE_NAME, "/config", |
| 2315 | + follow_name_owner_changes=True) |
| 2316 | + iface = dbus.Interface(client, DBUS_IFACE_CONFIG_NAME) |
| 2317 | + iface.set_throttling_limits(self.dn_limit, self.up_limit, |
| 2318 | + reply_handler=dbus_async, |
| 2319 | + error_handler=self.__dbus_error) |
| 2320 | + if self.bw_enabled: |
| 2321 | + iface.enable_bandwidth_throttling( |
| 2322 | + reply_handler=dbus_async, |
| 2323 | + error_handler=self.__dbus_error) |
| 2324 | + else: |
| 2325 | + iface.disable_bandwidth_throttling( |
| 2326 | + reply_handler=dbus_async, |
| 2327 | + error_handler=self.__dbus_error) |
| 2328 | + except DBusException, e: |
| 2329 | + self.__dbus_error(e) |
| 2330 | + |
| 2331 | + def __spinner_changed(self, button, data=None): |
| 2332 | + """Remove timeout and add anew.""" |
| 2333 | + if self.__update_id != 0: |
| 2334 | + gobject.source_remove(self.__update_id) |
| 2335 | + |
| 2336 | + self.__update_id = gobject.timeout_add_seconds( |
| 2337 | + 1, self.__update_bw_settings) |
| 2338 | + |
| 2339 | + def _format_for_gb_display(self, bytes): |
| 2340 | + """Format bytes into reasonable gb display.""" |
| 2341 | + gb = bytes / 1024 / 1024 / 1024 |
| 2342 | + if gb < 1.0: |
| 2343 | + mb = bytes / 1024 / 1024 |
| 2344 | + if mb < 1.0: |
| 2345 | + return (bytes / 1024, 'KB') |
| 2346 | + return (mb, 'MB') |
| 2347 | + return (gb, 'GB') |
| 2348 | + |
| 2349 | + def update_quota_display(self, used, total): |
| 2350 | + """Update the quota display.""" |
| 2351 | + percent = (float(used) / float(total)) * 100 |
| 2352 | + real_used, real_type = self._format_for_gb_display(used) |
| 2353 | + self.usage_label.set_text( |
| 2354 | + _("%(used)0.1f %(type)s Used (%(percent)0.1f%%)") % { |
| 2355 | + 'used' : real_used, |
| 2356 | + 'type' : real_type, |
| 2357 | + 'percent' : percent }) |
| 2358 | + self.usage_graph.set_fraction(percent / 100) |
| 2359 | + |
| 2360 | + def request_REST_info(self, url, method): |
| 2361 | + """Make a REST request and return the resulting dict, or None.""" |
| 2362 | + consumer = oauth.OAuthConsumer("ubuntuone", "hammertime") |
| 2363 | + items = [] |
| 2364 | + items = self.keyring.find_items_sync( |
| 2365 | + gnomekeyring.ITEM_GENERIC_SECRET, |
| 2366 | + {'ubuntuone-realm': "https://ubuntuone.com", |
| 2367 | + 'oauth-consumer-key': consumer.key}) |
| 2368 | + token = oauth.OAuthToken.from_string(items[0].secret) |
| 2369 | + request = oauth.OAuthRequest.from_consumer_and_token( |
| 2370 | + http_url=url, http_method=method, oauth_consumer=consumer, |
| 2371 | + token=token) |
| 2372 | + request.sign_request(oauth.OAuthSignatureMethod_HMAC_SHA1(), |
| 2373 | + consumer, token) |
| 2374 | + client = httplib2.Http() |
| 2375 | + headers = {} |
| 2376 | + headers.update(request.to_header()) |
| 2377 | + resp, content = client.request(url, method, headers=headers) |
| 2378 | + if resp['status'] == '200': |
| 2379 | + return simplejson.loads(content) |
| 2380 | + # FIXME: Log json parsing failures |
| 2381 | + else: |
| 2382 | + # FIXME: Log errors |
| 2383 | + return None |
| 2384 | + |
| 2385 | + def request_quota_info(self): |
| 2386 | + """Request new quota info from server, and update display.""" |
| 2387 | + quota = self.request_REST_info('https://one.ubuntu.com/api/quota/', |
| 2388 | + 'GET') |
| 2389 | + if quota: |
| 2390 | + self.update_quota_display(quota['used'], quota['total']) |
| 2391 | + |
| 2392 | + def request_account_info(self): |
| 2393 | + """Request account info from server, and update display.""" |
| 2394 | + user = self.request_REST_info('https://one.ubuntu.com/api/account/', |
| 2395 | + 'GET') |
| 2396 | + if user: |
| 2397 | + self.name_label.set_text(user['nickname']) |
| 2398 | + self.user_label.set_text(user['username']) |
| 2399 | + self.mail_label.set_text(user['email']) |
| 2400 | + |
| 2401 | + def toggle_db_sync(self, dbname, disable=False): |
| 2402 | + """ |
| 2403 | + Toggle whether a db in desktopcouch is synchronized to the |
| 2404 | + Ubuntu One couchdb server. |
| 2405 | + """ |
| 2406 | + # FIXME: Actually enable/disable the dbs if desktopcouch exists |
| 2407 | + |
| 2408 | + def __db_check_toggled(self, checkbutton): |
| 2409 | + """Handle toggling a desktopcouch service toggling.""" |
| 2410 | + dbname = checkbutton.get_data('dbname') |
| 2411 | + self.toggle_db_sync(dbname, not checkbutton.get_active()) |
| 2412 | + |
| 2413 | + def __files_check_toggled(self, checkbutton): |
| 2414 | + """Handle toggling the files service.""" |
| 2415 | + enable = checkbutton.get_active() |
| 2416 | + if enable: |
| 2417 | + self.music_check.set_sensitive(True) |
| 2418 | + if self.music_check.get_active(): |
| 2419 | + self.__music_check_toggled(self.music_check) |
| 2420 | + else: |
| 2421 | + self.music_check.set_sensitive(False) |
| 2422 | + # FIXME: Actually stop or start ubuntuone-syncdaemon |
| 2423 | + |
| 2424 | + def __music_check_toggled(self, checkbutton): |
| 2425 | + """Handle toggling the music download service.""" |
| 2426 | + if not self.files_check.get_active(): |
| 2427 | + return |
| 2428 | + # FIXME: Actually subscribe or unsubscribe to the UDF |
| 2429 | + |
| 2430 | + def __construct(self): |
| 2431 | + """Construct the dialog's layout.""" |
| 2432 | + area = self.get_content_area() |
| 2433 | + |
| 2434 | + vbox = gtk.VBox(spacing=12) |
| 2435 | + vbox.set_border_width(12) |
| 2436 | + area.add(vbox) |
| 2437 | + vbox.show() |
| 2438 | + |
| 2439 | + # Usage text/progress bar |
| 2440 | + hbox = gtk.HBox(homogeneous=True) |
| 2441 | + vbox.pack_start(hbox, False, False) |
| 2442 | + hbox.show() |
| 2443 | + |
| 2444 | + label = gtk.Label("") |
| 2445 | + hbox.add(label) |
| 2446 | + label.show() |
| 2447 | + |
| 2448 | + rbox = gtk.VBox(spacing=2) |
| 2449 | + hbox.pack_end(rbox) |
| 2450 | + rbox.show() |
| 2451 | + |
| 2452 | + self.usage_label = gtk.Label("") |
| 2453 | + self.usage_label.set_alignment(0.5, 0.5) |
| 2454 | + rbox.add(self.usage_label) |
| 2455 | + self.usage_label.show() |
| 2456 | + |
| 2457 | + self.usage_graph = gtk.ProgressBar() |
| 2458 | + rbox.add(self.usage_graph) |
| 2459 | + self.usage_graph.show() |
| 2460 | + |
| 2461 | + self.update_quota_display(0, 2) |
| 2462 | + |
| 2463 | + # Notebook |
| 2464 | + self.notebook = gtk.Notebook() |
| 2465 | + vbox.add(self.notebook) |
| 2466 | + self.notebook.show() |
| 2467 | + |
| 2468 | + # Account tab |
| 2469 | + account = gtk.VBox(spacing=12) |
| 2470 | + account.set_border_width(6) |
| 2471 | + self.notebook.append_page(account) |
| 2472 | + self.notebook.set_tab_label_text(account, _("Account")) |
| 2473 | + account.show() |
| 2474 | + |
| 2475 | + # User info in account tab |
| 2476 | + table = gtk.Table(rows=3, columns=2) |
| 2477 | + table.set_row_spacings(6) |
| 2478 | + table.set_col_spacings(6) |
| 2479 | + account.pack_start(table, False, False) |
| 2480 | + table.show() |
| 2481 | + |
| 2482 | + label = gtk.Label(_("_Name:")) |
| 2483 | + label.set_use_underline(True) |
| 2484 | + label.set_alignment(0.0, 0.5) |
| 2485 | + table.attach(label, 0, 1, 0, 1) |
| 2486 | + label.show() |
| 2487 | + |
| 2488 | + self.name_label = gtk.Label("") |
| 2489 | + self.name_label.set_use_underline(True) |
| 2490 | + self.name_label.set_alignment(0.0, 0.5) |
| 2491 | + table.attach(self.name_label, 1, 2, 0, 1) |
| 2492 | + self.name_label.show() |
| 2493 | + |
| 2494 | + label = gtk.Label(_("_Username:")) |
| 2495 | + label.set_use_underline(True) |
| 2496 | + label.set_alignment(0.0, 0.5) |
| 2497 | + table.attach(label, 0, 1, 1, 2) |
| 2498 | + label.show() |
| 2499 | + |
| 2500 | + self.user_label = gtk.Label("") |
| 2501 | + self.user_label.set_use_underline(True) |
| 2502 | + self.user_label.set_alignment(0.0, 0.5) |
| 2503 | + table.attach(self.user_label, 1, 2, 1, 2) |
| 2504 | + self.user_label.show() |
| 2505 | + |
| 2506 | + label = gtk.Label(_("_E-mail:")) |
| 2507 | + label.set_use_underline(True) |
| 2508 | + label.set_alignment(0.0, 0.5) |
| 2509 | + table.attach(label, 0, 1, 2, 3) |
| 2510 | + label.show() |
| 2511 | + |
| 2512 | + self.mail_label = gtk.Label("") |
| 2513 | + self.mail_label.set_use_underline(True) |
| 2514 | + self.mail_label.set_alignment(0.0, 0.5) |
| 2515 | + table.attach(self.mail_label, 1, 2, 2, 3) |
| 2516 | + self.mail_label.show() |
| 2517 | + |
| 2518 | + # Devices tab |
| 2519 | + devices = gtk.VBox(spacing=12) |
| 2520 | + devices.set_border_width(6) |
| 2521 | + self.notebook.append_page(devices) |
| 2522 | + self.notebook.set_tab_label_text(devices, _("Devices")) |
| 2523 | + devices.show() |
| 2524 | + |
| 2525 | + # Bandwidth limiting |
| 2526 | + self.limit_check = gtk.CheckButton(_("_Limit Bandwidth Usage")) |
| 2527 | + self.limit_check.connect("toggled", self.__bw_limit_toggled) |
| 2528 | + devices.pack_start(self.limit_check, False, False) |
| 2529 | + self.limit_check.show() |
| 2530 | + |
| 2531 | + hbox = gtk.HBox(spacing=12) |
| 2532 | + devices.pack_start(hbox, False, False) |
| 2533 | + hbox.show() |
| 2534 | + |
| 2535 | + label = gtk.Label() |
| 2536 | + hbox.pack_start(label, False, False) |
| 2537 | + label.show() |
| 2538 | + |
| 2539 | + # Now put the bw limit bits in a table too |
| 2540 | + self.bw_table = gtk.Table(rows=2, columns=2) |
| 2541 | + self.bw_table.set_row_spacings(6) |
| 2542 | + self.bw_table.set_col_spacings(6) |
| 2543 | + self.bw_table.set_sensitive(False) |
| 2544 | + hbox.pack_start(self.bw_table, False, False) |
| 2545 | + self.bw_table.show() |
| 2546 | + |
| 2547 | + # Upload speed |
| 2548 | + label = gtk.Label(_("Maximum _upload speed (KB/s):")) |
| 2549 | + label.set_use_underline(True) |
| 2550 | + label.set_alignment(0, 0.5) |
| 2551 | + self.bw_table.attach(label, 0, 1, 0, 1) |
| 2552 | + label.show() |
| 2553 | + |
| 2554 | + adjustment = gtk.Adjustment(value=2048.0, lower=0.0, upper=4096.0, |
| 2555 | + step_incr=64.0, page_incr=128.0) |
| 2556 | + self.up_spin = gtk.SpinButton(adjustment) |
| 2557 | + self.up_spin.connect("value-changed", self.__spinner_changed) |
| 2558 | + label.set_mnemonic_widget(self.up_spin) |
| 2559 | + self.bw_table.attach(self.up_spin, 1, 2, 0, 1) |
| 2560 | + self.up_spin.show() |
| 2561 | + |
| 2562 | + # Download speed |
| 2563 | + label = gtk.Label(_("Maximum _download speed (KB/s):")) |
| 2564 | + label.set_use_underline(True) |
| 2565 | + label.set_alignment(0, 0.5) |
| 2566 | + self.bw_table.attach(label, 0, 1, 1, 2) |
| 2567 | + label.show() |
| 2568 | + adjustment = gtk.Adjustment(value=2048.0, lower=0.0, upper=4096.0, |
| 2569 | + step_incr=64.0, page_incr=128.0) |
| 2570 | + self.dn_spin = gtk.SpinButton(adjustment) |
| 2571 | + self.dn_spin.connect("value-changed", self.__spinner_changed) |
| 2572 | + label.set_mnemonic_widget(self.dn_spin) |
| 2573 | + self.bw_table.attach(self.dn_spin, 1, 2, 1, 2) |
| 2574 | + self.dn_spin.show() |
| 2575 | + |
| 2576 | + # Services tab |
| 2577 | + services = gtk.VBox(spacing=12) |
| 2578 | + services.set_border_width(6) |
| 2579 | + self.notebook.append_page(services) |
| 2580 | + self.notebook.set_tab_label_text(services, _("Services")) |
| 2581 | + # FIXME: These are all disabled for the moment |
| 2582 | + services.set_sensitive(False) |
| 2583 | + services.show() |
| 2584 | + |
| 2585 | + self.bookmarks_check = gtk.CheckButton(_("_Bookmarks")) |
| 2586 | + self.bookmarks_check.set_data('dbname', 'bookmarks') |
| 2587 | + self.bookmarks_check.connect('toggled', self.__db_check_toggled) |
| 2588 | + services.pack_start(self.bookmarks_check, False, False) |
| 2589 | + self.bookmarks_check.show() |
| 2590 | + |
| 2591 | + self.abook_check = gtk.CheckButton(_("C_ontacts")) |
| 2592 | + self.abook_check.set_data('dbname', 'contacts') |
| 2593 | + self.abook_check.connect('toggled', self.__db_check_toggled) |
| 2594 | + services.pack_start(self.abook_check, False, False) |
| 2595 | + self.abook_check.show() |
| 2596 | + |
| 2597 | + fbox = gtk.VBox(spacing=6) |
| 2598 | + services.pack_start(fbox, False, False) |
| 2599 | + fbox.show() |
| 2600 | + |
| 2601 | + self.files_check = gtk.CheckButton(_("_File Synchronization")) |
| 2602 | + self.files_check.set_active(True) |
| 2603 | + self.files_check.connect('toggled', self.__files_check_toggled) |
| 2604 | + fbox.pack_start(self.files_check, False, False) |
| 2605 | + self.files_check.show() |
| 2606 | + |
| 2607 | + alignment = gtk.Alignment(0.0, 0.5) |
| 2608 | + alignment.set_padding(0, 0, 12, 0) |
| 2609 | + fbox.pack_start(alignment, False, False) |
| 2610 | + alignment.show() |
| 2611 | + |
| 2612 | + self.music_check = gtk.CheckButton(_("_Music Download")) |
| 2613 | + self.music_check.set_active(True) |
| 2614 | + self.music_check.connect('toggled', self.__music_check_toggled) |
| 2615 | + alignment.add(self.music_check) |
| 2616 | + self.music_check.show() |
| 2617 | + |
| 2618 | +class UbuntuoneLoginHandler(object): |
| 2619 | + """Class to handle registration/login, in case we aren't already.""" |
| 2620 | + |
| 2621 | + def __init__(self, *args, **kw): |
| 2622 | + self.bus = dbus.SessionBus() |
| 2623 | + |
| 2624 | + self.newcreds = None |
| 2625 | + self.oautherr = None |
| 2626 | + self.authdeny = None |
| 2627 | + |
| 2628 | + def got_newcredentials(self, realm, consumer_key): |
| 2629 | + """Show our dialog, since we can do stuff now.""" |
| 2630 | + self.disconnect_signal_handlers() |
| 2631 | + dialog = UbuntuOneDialog() |
| 2632 | + dialog.request_quota_info() |
| 2633 | + dialog.request_account_info() |
| 2634 | + dialog.show() |
| 2635 | + |
| 2636 | + def got_oautherror(self, message=None): |
| 2637 | + """Got an error during oauth.""" |
| 2638 | + gtk.main_quit() |
| 2639 | + |
| 2640 | + def got_authdenied(self): |
| 2641 | + """User denied access.""" |
| 2642 | + gtk.main_quit() |
| 2643 | + |
| 2644 | + def got_dbus_error(self, error): |
| 2645 | + """Got a DBusError.""" |
| 2646 | + gtk.main_quit() |
| 2647 | + |
| 2648 | + def register_signal_handlers(self): |
| 2649 | + """Register the dbus signal handlers.""" |
| 2650 | + self.newcreds = self.bus.add_signal_receiver( |
| 2651 | + handler_function=self.got_newcredentials, |
| 2652 | + signal_name='NewCredentials', |
| 2653 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2654 | + self.oautherr = self.bus.add_signal_receiver( |
| 2655 | + handler_function=self.got_oautherror, |
| 2656 | + signal_name='OAuthError', |
| 2657 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2658 | + self.authdeny = self.bus.add_signal_receiver( |
| 2659 | + handler_function=self.got_authdenied, |
| 2660 | + signal_name='AuthorizationDenied', |
| 2661 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2662 | + |
| 2663 | + def disconnect_signal_handlers(self): |
| 2664 | + """Disconnect the dbus signal handlers, so we don't break.""" |
| 2665 | + self.bus.remove_signal_receiver( |
| 2666 | + self.newcreds, |
| 2667 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2668 | + self.bus.remove_signal_receiver( |
| 2669 | + self.oautherr, |
| 2670 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2671 | + self.bus.remove_signal_receiver( |
| 2672 | + self.authdeny, |
| 2673 | + dbus_interface=DBUS_IFACE_AUTH_NAME) |
| 2674 | + |
| 2675 | + def do_login_check(self): |
| 2676 | + """Log in to U1 or validate that we already are.""" |
| 2677 | + try: |
| 2678 | + client = self.bus.get_object(DBUS_IFACE_AUTH_NAME, |
| 2679 | + DBUS_IFACE_AUTH_PATH, |
| 2680 | + follow_name_owner_changes=True) |
| 2681 | + iface = dbus.Interface(client, DBUS_IFACE_AUTH_NAME) |
| 2682 | + iface.login('https://ubuntuone.com', 'ubuntuone', |
| 2683 | + reply_handler=dbus_async, |
| 2684 | + error_handler=self.got_dbus_error) |
| 2685 | + except DBusException, e: |
| 2686 | + self.got_dbus_error(e) |
| 2687 | + |
| 2688 | + |
| 2689 | +if __name__ == "__main__": |
| 2690 | + gettext.bindtextdomain(clientdefs.GETTEXT_PACKAGE, clientdefs.LOCALEDIR) |
| 2691 | + gettext.textdomain(clientdefs.GETTEXT_PACKAGE) |
| 2692 | + |
| 2693 | + gtk.rc_parse_string(RCSTYLE) |
| 2694 | + gobject.set_application_name("Ubuntu One") |
| 2695 | + |
| 2696 | + try: |
| 2697 | + login = UbuntuoneLoginHandler() |
| 2698 | + login.register_signal_handlers() |
| 2699 | + login.do_login_check() |
| 2700 | + gtk.main() |
| 2701 | + except KeyboardInterrupt: |
| 2702 | + pass |
| 2703 | |
| 2704 | === modified file 'bin/ubuntuone-syncdaemon' |
| 2705 | --- bin/ubuntuone-syncdaemon 2009-09-28 18:15:00 +0000 |
| 2706 | +++ bin/ubuntuone-syncdaemon 2010-02-18 00:10:25 +0000 |
| 2707 | @@ -31,7 +31,7 @@ |
| 2708 | import sys |
| 2709 | import shutil |
| 2710 | |
| 2711 | -from ubuntuone.syncdaemon import dbus_interface, logger |
| 2712 | +from ubuntuone.syncdaemon import dbus_interface, logger, config |
| 2713 | from ubuntuone.syncdaemon.config import ( |
| 2714 | get_config_files, |
| 2715 | get_parsers, |
| 2716 | @@ -75,14 +75,15 @@ |
| 2717 | configs.append(args.pop(0)) |
| 2718 | if len(configs) == 0: |
| 2719 | configs.extend(get_config_files()) |
| 2720 | - (parser, options, argv) = configglue(file(configs[0]), *configs[1:], |
| 2721 | - args=args, usage=usage, |
| 2722 | - extra_parsers=get_parsers()) |
| 2723 | + (parser, options, argv) = config.configglue(file(configs[0]), *configs[1:], |
| 2724 | + args=args, usage=usage) |
| 2725 | |
| 2726 | if options.debug: |
| 2727 | logger.set_debug('stdout file') |
| 2728 | else: |
| 2729 | - logger.set_level(options.log_level) |
| 2730 | + logger.configure_logging(options.logging_level, |
| 2731 | + options.logging_file_size, |
| 2732 | + options.logging_backup_count) |
| 2733 | |
| 2734 | # check we're not running as root, or have explicitely and in |
| 2735 | # length expressed our desire to do so |
| 2736 | |
| 2737 | === modified file 'config.guess' |
| 2738 | --- config.guess 2009-07-27 16:00:00 +0000 |
| 2739 | +++ config.guess 2010-02-18 00:10:25 +0000 |
| 2740 | @@ -1,10 +1,10 @@ |
| 2741 | #! /bin/sh |
| 2742 | # Attempt to guess a canonical system name. |
| 2743 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 2744 | -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
| 2745 | +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
| 2746 | # Free Software Foundation, Inc. |
| 2747 | |
| 2748 | -timestamp='2009-04-27' |
| 2749 | +timestamp='2009-06-10' |
| 2750 | |
| 2751 | # This file is free software; you can redistribute it and/or modify it |
| 2752 | # under the terms of the GNU General Public License as published by |
| 2753 | @@ -170,7 +170,7 @@ |
| 2754 | arm*|i386|m68k|ns32k|sh3*|sparc|vax) |
| 2755 | eval $set_cc_for_build |
| 2756 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ |
| 2757 | - | grep __ELF__ >/dev/null |
| 2758 | + | grep -q __ELF__ |
| 2759 | then |
| 2760 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). |
| 2761 | # Return netbsd for either. FIX? |
| 2762 | @@ -656,7 +656,7 @@ |
| 2763 | # => hppa64-hp-hpux11.23 |
| 2764 | |
| 2765 | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | |
| 2766 | - grep __LP64__ >/dev/null |
| 2767 | + grep -q __LP64__ |
| 2768 | then |
| 2769 | HP_ARCH="hppa2.0w" |
| 2770 | else |
| 2771 | @@ -822,6 +822,9 @@ |
| 2772 | [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) |
| 2773 | echo i${UNAME_MACHINE}-pc-mks |
| 2774 | exit ;; |
| 2775 | + 8664:Windows_NT:*) |
| 2776 | + echo x86_64-pc-mks |
| 2777 | + exit ;; |
| 2778 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
| 2779 | # How do we know it's Interix rather than the generic POSIX subsystem? |
| 2780 | # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we |
| 2781 | @@ -882,40 +885,17 @@ |
| 2782 | m68*:Linux:*:*) |
| 2783 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
| 2784 | exit ;; |
| 2785 | - mips:Linux:*:*) |
| 2786 | - eval $set_cc_for_build |
| 2787 | - sed 's/^ //' << EOF >$dummy.c |
| 2788 | - #undef CPU |
| 2789 | - #undef mips |
| 2790 | - #undef mipsel |
| 2791 | - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) |
| 2792 | - CPU=mipsel |
| 2793 | - #else |
| 2794 | - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) |
| 2795 | - CPU=mips |
| 2796 | - #else |
| 2797 | - CPU= |
| 2798 | - #endif |
| 2799 | - #endif |
| 2800 | -EOF |
| 2801 | - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' |
| 2802 | - /^CPU/{ |
| 2803 | - s: ::g |
| 2804 | - p |
| 2805 | - }'`" |
| 2806 | - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
| 2807 | - ;; |
| 2808 | - mips64:Linux:*:*) |
| 2809 | - eval $set_cc_for_build |
| 2810 | - sed 's/^ //' << EOF >$dummy.c |
| 2811 | - #undef CPU |
| 2812 | - #undef mips64 |
| 2813 | - #undef mips64el |
| 2814 | - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) |
| 2815 | - CPU=mips64el |
| 2816 | - #else |
| 2817 | - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) |
| 2818 | - CPU=mips64 |
| 2819 | + mips:Linux:*:* | mips64:Linux:*:*) |
| 2820 | + eval $set_cc_for_build |
| 2821 | + sed 's/^ //' << EOF >$dummy.c |
| 2822 | + #undef CPU |
| 2823 | + #undef ${UNAME_MACHINE} |
| 2824 | + #undef ${UNAME_MACHINE}el |
| 2825 | + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) |
| 2826 | + CPU=${UNAME_MACHINE}el |
| 2827 | + #else |
| 2828 | + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) |
| 2829 | + CPU=${UNAME_MACHINE} |
| 2830 | #else |
| 2831 | CPU= |
| 2832 | #endif |
| 2833 | @@ -947,7 +927,7 @@ |
| 2834 | EV67) UNAME_MACHINE=alphaev67 ;; |
| 2835 | EV68*) UNAME_MACHINE=alphaev68 ;; |
| 2836 | esac |
| 2837 | - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null |
| 2838 | + objdump --private-headers /bin/sh | grep -q ld.so.1 |
| 2839 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi |
| 2840 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} |
| 2841 | exit ;; |
| 2842 | @@ -1001,14 +981,6 @@ |
| 2843 | elf32-i386) |
| 2844 | TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" |
| 2845 | ;; |
| 2846 | - a.out-i386-linux) |
| 2847 | - echo "${UNAME_MACHINE}-pc-linux-gnuaout" |
| 2848 | - exit ;; |
| 2849 | - "") |
| 2850 | - # Either a pre-BFD a.out linker (linux-gnuoldld) or |
| 2851 | - # one that does not give us useful --help. |
| 2852 | - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" |
| 2853 | - exit ;; |
| 2854 | esac |
| 2855 | # Determine whether the default compiler is a.out or elf |
| 2856 | eval $set_cc_for_build |
| 2857 | @@ -1074,7 +1046,7 @@ |
| 2858 | i*86:syllable:*:*) |
| 2859 | echo ${UNAME_MACHINE}-pc-syllable |
| 2860 | exit ;; |
| 2861 | - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) |
| 2862 | + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) |
| 2863 | echo i386-unknown-lynxos${UNAME_RELEASE} |
| 2864 | exit ;; |
| 2865 | i*86:*DOS:*:*) |
| 2866 | @@ -1182,7 +1154,7 @@ |
| 2867 | rs6000:LynxOS:2.*:*) |
| 2868 | echo rs6000-unknown-lynxos${UNAME_RELEASE} |
| 2869 | exit ;; |
| 2870 | - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) |
| 2871 | + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) |
| 2872 | echo powerpc-unknown-lynxos${UNAME_RELEASE} |
| 2873 | exit ;; |
| 2874 | SM[BE]S:UNIX_SV:*:*) |
| 2875 | |
| 2876 | === modified file 'config.sub' |
| 2877 | --- config.sub 2009-07-27 16:00:00 +0000 |
| 2878 | +++ config.sub 2010-02-18 00:10:25 +0000 |
| 2879 | @@ -1,10 +1,10 @@ |
| 2880 | #! /bin/sh |
| 2881 | # Configuration validation subroutine script. |
| 2882 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 2883 | -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
| 2884 | +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
| 2885 | # Free Software Foundation, Inc. |
| 2886 | |
| 2887 | -timestamp='2009-04-17' |
| 2888 | +timestamp='2009-06-11' |
| 2889 | |
| 2890 | # This file is (in principle) common to ALL GNU software. |
| 2891 | # The presence of a machine in this file suggests that SOME GNU software |
| 2892 | @@ -153,6 +153,9 @@ |
| 2893 | os= |
| 2894 | basic_machine=$1 |
| 2895 | ;; |
| 2896 | + -bluegene*) |
| 2897 | + os=-cnk |
| 2898 | + ;; |
| 2899 | -sim | -cisco | -oki | -wec | -winbond) |
| 2900 | os= |
| 2901 | basic_machine=$1 |
| 2902 | @@ -467,6 +470,10 @@ |
| 2903 | basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` |
| 2904 | os=-linux |
| 2905 | ;; |
| 2906 | + bluegene*) |
| 2907 | + basic_machine=powerpc-ibm |
| 2908 | + os=-cnk |
| 2909 | + ;; |
| 2910 | c90) |
| 2911 | basic_machine=c90-cray |
| 2912 | os=-unicos |
| 2913 | @@ -1260,7 +1267,7 @@ |
| 2914 | # Each alternative MUST END IN A *, to match a version number. |
| 2915 | # -sysv* is not here because it comes later, after sysvr4. |
| 2916 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ |
| 2917 | - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ |
| 2918 | + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ |
| 2919 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ |
| 2920 | | -kopensolaris* \ |
| 2921 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ |
| 2922 | @@ -1613,7 +1620,7 @@ |
| 2923 | -sunos*) |
| 2924 | vendor=sun |
| 2925 | ;; |
| 2926 | - -aix*) |
| 2927 | + -cnk*|-aix*) |
| 2928 | vendor=ibm |
| 2929 | ;; |
| 2930 | -beos*) |
| 2931 | |
| 2932 | === modified file 'configure' |
| 2933 | --- configure 2009-12-07 17:35:00 +0000 |
| 2934 | +++ configure 2010-02-18 00:10:25 +0000 |
| 2935 | @@ -1,10 +1,12 @@ |
| 2936 | #! /bin/sh |
| 2937 | # Guess values for system-dependent variables and create Makefiles. |
| 2938 | -# Generated by GNU Autoconf 2.64 for ubuntuone-client 1.1.0. |
| 2939 | +# Generated by GNU Autoconf 2.65 for ubuntuone-client 1.1.2. |
| 2940 | +# |
| 2941 | # |
| 2942 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
| 2943 | -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software |
| 2944 | -# Foundation, Inc. |
| 2945 | +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, |
| 2946 | +# Inc. |
| 2947 | +# |
| 2948 | # |
| 2949 | # This configure script is free software; the Free Software Foundation |
| 2950 | # gives unlimited permission to copy, distribute and modify it. |
| 2951 | @@ -673,7 +675,8 @@ |
| 2952 | |
| 2953 | |
| 2954 | |
| 2955 | -exec 7<&0 </dev/null 6>&1 |
| 2956 | +test -n "$DJDIR" || exec 7<&0 </dev/null |
| 2957 | +exec 6>&1 |
| 2958 | |
| 2959 | # Name of the host. |
| 2960 | # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, |
| 2961 | @@ -695,8 +698,8 @@ |
| 2962 | # Identity of this package. |
| 2963 | PACKAGE_NAME='ubuntuone-client' |
| 2964 | PACKAGE_TARNAME='ubuntuone-client' |
| 2965 | -PACKAGE_VERSION='1.1.0' |
| 2966 | -PACKAGE_STRING='ubuntuone-client 1.1.0' |
| 2967 | +PACKAGE_VERSION='1.1.2' |
| 2968 | +PACKAGE_STRING='ubuntuone-client 1.1.2' |
| 2969 | PACKAGE_BUGREPORT='' |
| 2970 | PACKAGE_URL='' |
| 2971 | |
| 2972 | @@ -756,6 +759,8 @@ |
| 2973 | PYTHON_PREFIX |
| 2974 | PYTHON_VERSION |
| 2975 | PYTHON |
| 2976 | +LOG_FILE_SIZE |
| 2977 | +LOG_LEVEL |
| 2978 | ENABLE_RENDERING_FALSE |
| 2979 | ENABLE_RENDERING_TRUE |
| 2980 | ICONTOOL_RENDER |
| 2981 | @@ -911,6 +916,7 @@ |
| 2982 | enable_libtool_lock |
| 2983 | enable_nls |
| 2984 | enable_rendering |
| 2985 | +enable_debug |
| 2986 | enable_pycentral |
| 2987 | with_protocol |
| 2988 | with_dbus_services |
| 2989 | @@ -1470,7 +1476,7 @@ |
| 2990 | # Omit some internal or obsolete options to make the list less imposing. |
| 2991 | # This message is too long to be a string in the A/UX 3.1 sh. |
| 2992 | cat <<_ACEOF |
| 2993 | -\`configure' configures ubuntuone-client 1.1.0 to adapt to many kinds of systems. |
| 2994 | +\`configure' configures ubuntuone-client 1.1.2 to adapt to many kinds of systems. |
| 2995 | |
| 2996 | Usage: $0 [OPTION]... [VAR=VALUE]... |
| 2997 | |
| 2998 | @@ -1541,7 +1547,7 @@ |
| 2999 | |
| 3000 | if test -n "$ac_init_help"; then |
| 3001 | case $ac_init_help in |
| 3002 | - short | recursive ) echo "Configuration of ubuntuone-client 1.1.0:";; |
| 3003 | + short | recursive ) echo "Configuration of ubuntuone-client 1.1.2:";; |
| 3004 | esac |
| 3005 | cat <<\_ACEOF |
| 3006 | |
| 3007 | @@ -1557,8 +1563,9 @@ |
| 3008 | optimize for fast installation [default=yes] |
| 3009 | --disable-libtool-lock avoid locking (might break parallel builds) |
| 3010 | --disable-nls do not use Native Language Support |
| 3011 | - --enable-rendering Enable icon rendering default=auto |
| 3012 | - --enable-pycentral Enable usage of pycentral default=disabled |
| 3013 | + --enable-rendering Enable icon rendering [default=auto] |
| 3014 | + --enable-debug Enable debug logging by default [default=auto] |
| 3015 | + --enable-pycentral Enable usage of pycentral [default=disabled] |
| 3016 | |
| 3017 | Optional Packages: |
| 3018 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
| 3019 | @@ -1566,7 +1573,7 @@ |
| 3020 | --with-pic try to use only PIC/non-PIC objects [default=use |
| 3021 | both] |
| 3022 | --with-gnu-ld assume the C compiler uses GNU ld [default=no] |
| 3023 | - --with-protocol Specify path to storage protocol default=auto |
| 3024 | + --with-protocol Specify path to storage protocol [default=auto] |
| 3025 | --with-dbus-services=<dir> |
| 3026 | where D-BUS services directory is |
| 3027 | |
| 3028 | @@ -1576,7 +1583,7 @@ |
| 3029 | LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a |
| 3030 | nonstandard directory <lib dir> |
| 3031 | LIBS libraries to pass to the linker, e.g. -l<library> |
| 3032 | - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if |
| 3033 | + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if |
| 3034 | you have headers in a nonstandard directory <include dir> |
| 3035 | CPP C preprocessor |
| 3036 | PKG_CONFIG path to pkg-config utility |
| 3037 | @@ -1653,8 +1660,8 @@ |
| 3038 | test -n "$ac_init_help" && exit $ac_status |
| 3039 | if $ac_init_version; then |
| 3040 | cat <<\_ACEOF |
| 3041 | -ubuntuone-client configure 1.1.0 |
| 3042 | -generated by GNU Autoconf 2.64 |
| 3043 | +ubuntuone-client configure 1.1.2 |
| 3044 | +generated by GNU Autoconf 2.65 |
| 3045 | |
| 3046 | Copyright (C) 2009 Free Software Foundation, Inc. |
| 3047 | This configure script is free software; the Free Software Foundation |
| 3048 | @@ -1701,7 +1708,7 @@ |
| 3049 | ac_retval=1 |
| 3050 | fi |
| 3051 | eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} |
| 3052 | - return $ac_retval |
| 3053 | + as_fn_set_status $ac_retval |
| 3054 | |
| 3055 | } # ac_fn_c_try_compile |
| 3056 | |
| 3057 | @@ -1747,7 +1754,7 @@ |
| 3058 | # left behind by Apple's compiler. We do this before executing the actions. |
| 3059 | rm -rf conftest.dSYM conftest_ipa8_conftest.oo |
| 3060 | eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} |
| 3061 | - return $ac_retval |
| 3062 | + as_fn_set_status $ac_retval |
| 3063 | |
| 3064 | } # ac_fn_c_try_link |
| 3065 | |
| 3066 | @@ -1815,7 +1822,7 @@ |
| 3067 | ac_retval=1 |
| 3068 | fi |
| 3069 | eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} |
| 3070 | - return $ac_retval |
| 3071 | + as_fn_set_status $ac_retval |
| 3072 | |
| 3073 | } # ac_fn_c_try_cpp |
| 3074 | |
| 3075 | @@ -1857,7 +1864,7 @@ |
| 3076 | fi |
| 3077 | rm -rf conftest.dSYM conftest_ipa8_conftest.oo |
| 3078 | eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} |
| 3079 | - return $ac_retval |
| 3080 | + as_fn_set_status $ac_retval |
| 3081 | |
| 3082 | } # ac_fn_c_try_run |
| 3083 | |
| 3084 | @@ -1931,8 +1938,8 @@ |
| 3085 | This file contains any messages produced by compilers while |
| 3086 | running configure, to aid debugging if configure makes a mistake. |
| 3087 | |
| 3088 | -It was created by ubuntuone-client $as_me 1.1.0, which was |
| 3089 | -generated by GNU Autoconf 2.64. Invocation command line was |
| 3090 | +It was created by ubuntuone-client $as_me 1.1.2, which was |
| 3091 | +generated by GNU Autoconf 2.65. Invocation command line was |
| 3092 | |
| 3093 | $ $0 $@ |
| 3094 | |
| 3095 | @@ -2185,7 +2192,7 @@ |
| 3096 | for ac_site_file in "$ac_site_file1" "$ac_site_file2" |
| 3097 | do |
| 3098 | test "x$ac_site_file" = xNONE && continue |
| 3099 | - if test -r "$ac_site_file"; then |
| 3100 | + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then |
| 3101 | { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 |
| 3102 | $as_echo "$as_me: loading site script $ac_site_file" >&6;} |
| 3103 | sed 's/^/| /' "$ac_site_file" >&5 |
| 3104 | @@ -2194,9 +2201,9 @@ |
| 3105 | done |
| 3106 | |
| 3107 | if test -r "$cache_file"; then |
| 3108 | - # Some versions of bash will fail to source /dev/null (special |
| 3109 | - # files actually), so we avoid doing that. |
| 3110 | - if test -f "$cache_file"; then |
| 3111 | + # Some versions of bash will fail to source /dev/null (special files |
| 3112 | + # actually), so we avoid doing that. DJGPP emulates it as a regular file. |
| 3113 | + if test /dev/null != "$cache_file" && test -f "$cache_file"; then |
| 3114 | { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 |
| 3115 | $as_echo "$as_me: loading cache $cache_file" >&6;} |
| 3116 | case $cache_file in |
| 3117 | @@ -2617,6 +2624,7 @@ |
| 3118 | |
| 3119 | fi |
| 3120 | |
| 3121 | + test -d ./--version && rmdir ./--version |
| 3122 | if test "${ac_cv_path_mkdir+set}" = set; then |
| 3123 | MKDIR_P="$ac_cv_path_mkdir -p" |
| 3124 | else |
| 3125 | @@ -2624,7 +2632,6 @@ |
| 3126 | # value for MKDIR_P within a source directory, because that will |
| 3127 | # break other packages using the cache if that directory is |
| 3128 | # removed, or if the value is a relative name. |
| 3129 | - test -d ./--version && rmdir ./--version |
| 3130 | MKDIR_P="$ac_install_sh -d" |
| 3131 | fi |
| 3132 | fi |
| 3133 | @@ -2741,7 +2748,7 @@ |
| 3134 | |
| 3135 | # Define the identity of the package. |
| 3136 | PACKAGE='ubuntuone-client' |
| 3137 | - VERSION='1.1.0' |
| 3138 | + VERSION='1.1.2' |
| 3139 | |
| 3140 | |
| 3141 | cat >>confdefs.h <<_ACEOF |
| 3142 | @@ -3168,32 +3175,30 @@ |
| 3143 | ... rest of stderr output deleted ... |
| 3144 | 10q' conftest.err >conftest.er1 |
| 3145 | cat conftest.er1 >&5 |
| 3146 | - rm -f conftest.er1 conftest.err |
| 3147 | fi |
| 3148 | + rm -f conftest.er1 conftest.err |
| 3149 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3150 | test $ac_status = 0; } |
| 3151 | done |
| 3152 | |
| 3153 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| 3154 | /* end confdefs.h. */ |
| 3155 | -#include <stdio.h> |
| 3156 | + |
| 3157 | int |
| 3158 | main () |
| 3159 | { |
| 3160 | -FILE *f = fopen ("conftest.out", "w"); |
| 3161 | - return ferror (f) || fclose (f) != 0; |
| 3162 | |
| 3163 | ; |
| 3164 | return 0; |
| 3165 | } |
| 3166 | _ACEOF |
| 3167 | ac_clean_files_save=$ac_clean_files |
| 3168 | -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" |
| 3169 | +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" |
| 3170 | # Try to create an executable without -o first, disregard a.out. |
| 3171 | # It will help us diagnose broken compilers, and finding out an intuition |
| 3172 | # of exeext. |
| 3173 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 |
| 3174 | -$as_echo_n "checking for C compiler default output file name... " >&6; } |
| 3175 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 |
| 3176 | +$as_echo_n "checking whether the C compiler works... " >&6; } |
| 3177 | ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` |
| 3178 | |
| 3179 | # The possible output files: |
| 3180 | @@ -3255,10 +3260,10 @@ |
| 3181 | else |
| 3182 | ac_file='' |
| 3183 | fi |
| 3184 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 |
| 3185 | -$as_echo "$ac_file" >&6; } |
| 3186 | if test -z "$ac_file"; then : |
| 3187 | - $as_echo "$as_me: failed program was:" >&5 |
| 3188 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
| 3189 | +$as_echo "no" >&6; } |
| 3190 | +$as_echo "$as_me: failed program was:" >&5 |
| 3191 | sed 's/^/| /' conftest.$ac_ext >&5 |
| 3192 | |
| 3193 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
| 3194 | @@ -3266,51 +3271,18 @@ |
| 3195 | { as_fn_set_status 77 |
| 3196 | as_fn_error "C compiler cannot create executables |
| 3197 | See \`config.log' for more details." "$LINENO" 5; }; } |
| 3198 | +else |
| 3199 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| 3200 | +$as_echo "yes" >&6; } |
| 3201 | fi |
| 3202 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 |
| 3203 | +$as_echo_n "checking for C compiler default output file name... " >&6; } |
| 3204 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 |
| 3205 | +$as_echo "$ac_file" >&6; } |
| 3206 | ac_exeext=$ac_cv_exeext |
| 3207 | |
| 3208 | -# Check that the compiler produces executables we can run. If not, either |
| 3209 | -# the compiler is broken, or we cross compile. |
| 3210 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 |
| 3211 | -$as_echo_n "checking whether the C compiler works... " >&6; } |
| 3212 | -# If not cross compiling, check that we can run a simple program. |
| 3213 | -if test "$cross_compiling" != yes; then |
| 3214 | - if { ac_try='./$ac_file' |
| 3215 | - { { case "(($ac_try" in |
| 3216 | - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
| 3217 | - *) ac_try_echo=$ac_try;; |
| 3218 | -esac |
| 3219 | -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" |
| 3220 | -$as_echo "$ac_try_echo"; } >&5 |
| 3221 | - (eval "$ac_try") 2>&5 |
| 3222 | - ac_status=$? |
| 3223 | - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3224 | - test $ac_status = 0; }; }; then |
| 3225 | - cross_compiling=no |
| 3226 | - else |
| 3227 | - if test "$cross_compiling" = maybe; then |
| 3228 | - cross_compiling=yes |
| 3229 | - else |
| 3230 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
| 3231 | -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} |
| 3232 | -as_fn_error "cannot run C compiled programs. |
| 3233 | -If you meant to cross compile, use \`--host'. |
| 3234 | -See \`config.log' for more details." "$LINENO" 5; } |
| 3235 | - fi |
| 3236 | - fi |
| 3237 | -fi |
| 3238 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| 3239 | -$as_echo "yes" >&6; } |
| 3240 | - |
| 3241 | -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out |
| 3242 | +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out |
| 3243 | ac_clean_files=$ac_clean_files_save |
| 3244 | -# Check that the compiler produces executables we can run. If not, either |
| 3245 | -# the compiler is broken, or we cross compile. |
| 3246 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 |
| 3247 | -$as_echo_n "checking whether we are cross compiling... " >&6; } |
| 3248 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 |
| 3249 | -$as_echo "$cross_compiling" >&6; } |
| 3250 | - |
| 3251 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 |
| 3252 | $as_echo_n "checking for suffix of executables... " >&6; } |
| 3253 | if { { ac_try="$ac_link" |
| 3254 | @@ -3343,13 +3315,72 @@ |
| 3255 | as_fn_error "cannot compute suffix of executables: cannot compile and link |
| 3256 | See \`config.log' for more details." "$LINENO" 5; } |
| 3257 | fi |
| 3258 | -rm -f conftest$ac_cv_exeext |
| 3259 | +rm -f conftest conftest$ac_cv_exeext |
| 3260 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 |
| 3261 | $as_echo "$ac_cv_exeext" >&6; } |
| 3262 | |
| 3263 | rm -f conftest.$ac_ext |
| 3264 | EXEEXT=$ac_cv_exeext |
| 3265 | ac_exeext=$EXEEXT |
| 3266 | +cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| 3267 | +/* end confdefs.h. */ |
| 3268 | +#include <stdio.h> |
| 3269 | +int |
| 3270 | +main () |
| 3271 | +{ |
| 3272 | +FILE *f = fopen ("conftest.out", "w"); |
| 3273 | + return ferror (f) || fclose (f) != 0; |
| 3274 | + |
| 3275 | + ; |
| 3276 | + return 0; |
| 3277 | +} |
| 3278 | +_ACEOF |
| 3279 | +ac_clean_files="$ac_clean_files conftest.out" |
| 3280 | +# Check that the compiler produces executables we can run. If not, either |
| 3281 | +# the compiler is broken, or we cross compile. |
| 3282 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 |
| 3283 | +$as_echo_n "checking whether we are cross compiling... " >&6; } |
| 3284 | +if test "$cross_compiling" != yes; then |
| 3285 | + { { ac_try="$ac_link" |
| 3286 | +case "(($ac_try" in |
| 3287 | + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
| 3288 | + *) ac_try_echo=$ac_try;; |
| 3289 | +esac |
| 3290 | +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" |
| 3291 | +$as_echo "$ac_try_echo"; } >&5 |
| 3292 | + (eval "$ac_link") 2>&5 |
| 3293 | + ac_status=$? |
| 3294 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3295 | + test $ac_status = 0; } |
| 3296 | + if { ac_try='./conftest$ac_cv_exeext' |
| 3297 | + { { case "(($ac_try" in |
| 3298 | + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
| 3299 | + *) ac_try_echo=$ac_try;; |
| 3300 | +esac |
| 3301 | +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" |
| 3302 | +$as_echo "$ac_try_echo"; } >&5 |
| 3303 | + (eval "$ac_try") 2>&5 |
| 3304 | + ac_status=$? |
| 3305 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3306 | + test $ac_status = 0; }; }; then |
| 3307 | + cross_compiling=no |
| 3308 | + else |
| 3309 | + if test "$cross_compiling" = maybe; then |
| 3310 | + cross_compiling=yes |
| 3311 | + else |
| 3312 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
| 3313 | +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} |
| 3314 | +as_fn_error "cannot run C compiled programs. |
| 3315 | +If you meant to cross compile, use \`--host'. |
| 3316 | +See \`config.log' for more details." "$LINENO" 5; } |
| 3317 | + fi |
| 3318 | + fi |
| 3319 | +fi |
| 3320 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 |
| 3321 | +$as_echo "$cross_compiling" >&6; } |
| 3322 | + |
| 3323 | +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out |
| 3324 | +ac_clean_files=$ac_clean_files_save |
| 3325 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 |
| 3326 | $as_echo_n "checking for suffix of object files... " >&6; } |
| 3327 | if test "${ac_cv_objext+set}" = set; then : |
| 3328 | @@ -4119,8 +4150,8 @@ |
| 3329 | ... rest of stderr output deleted ... |
| 3330 | 10q' conftest.err >conftest.er1 |
| 3331 | cat conftest.er1 >&5 |
| 3332 | - rm -f conftest.er1 conftest.err |
| 3333 | fi |
| 3334 | + rm -f conftest.er1 conftest.err |
| 3335 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3336 | test $ac_status = 0; } |
| 3337 | done |
| 3338 | @@ -4472,8 +4503,8 @@ |
| 3339 | |
| 3340 | |
| 3341 | |
| 3342 | -macro_version='2.2.6' |
| 3343 | -macro_revision='1.3012' |
| 3344 | +macro_version='2.2.6b' |
| 3345 | +macro_revision='1.3017' |
| 3346 | |
| 3347 | |
| 3348 | |
| 3349 | @@ -5144,13 +5175,13 @@ |
| 3350 | else |
| 3351 | lt_cv_nm_interface="BSD nm" |
| 3352 | echo "int some_variable = 0;" > conftest.$ac_ext |
| 3353 | - (eval echo "\"\$as_me:5147: $ac_compile\"" >&5) |
| 3354 | + (eval echo "\"\$as_me:5178: $ac_compile\"" >&5) |
| 3355 | (eval "$ac_compile" 2>conftest.err) |
| 3356 | cat conftest.err >&5 |
| 3357 | - (eval echo "\"\$as_me:5150: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
| 3358 | + (eval echo "\"\$as_me:5181: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
| 3359 | (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) |
| 3360 | cat conftest.err >&5 |
| 3361 | - (eval echo "\"\$as_me:5153: output\"" >&5) |
| 3362 | + (eval echo "\"\$as_me:5184: output\"" >&5) |
| 3363 | cat conftest.out >&5 |
| 3364 | if $GREP 'External.*some_variable' conftest.out > /dev/null; then |
| 3365 | lt_cv_nm_interface="MS dumpbin" |
| 3366 | @@ -5616,7 +5647,7 @@ |
| 3367 | ;; |
| 3368 | |
| 3369 | # This must be Linux ELF. |
| 3370 | -linux* | k*bsd*-gnu) |
| 3371 | +linux* | k*bsd*-gnu | kopensolaris*-gnu) |
| 3372 | lt_cv_deplibs_check_method=pass_all |
| 3373 | ;; |
| 3374 | |
| 3375 | @@ -6355,7 +6386,7 @@ |
| 3376 | ;; |
| 3377 | *-*-irix6*) |
| 3378 | # Find out which ABI we are using. |
| 3379 | - echo '#line 6358 "configure"' > conftest.$ac_ext |
| 3380 | + echo '#line 6389 "configure"' > conftest.$ac_ext |
| 3381 | if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 |
| 3382 | (eval $ac_compile) 2>&5 |
| 3383 | ac_status=$? |
| 3384 | @@ -7885,11 +7916,11 @@ |
| 3385 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
| 3386 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 3387 | -e 's:$: $lt_compiler_flag:'` |
| 3388 | - (eval echo "\"\$as_me:7888: $lt_compile\"" >&5) |
| 3389 | + (eval echo "\"\$as_me:7919: $lt_compile\"" >&5) |
| 3390 | (eval "$lt_compile" 2>conftest.err) |
| 3391 | ac_status=$? |
| 3392 | cat conftest.err >&5 |
| 3393 | - echo "$as_me:7892: \$? = $ac_status" >&5 |
| 3394 | + echo "$as_me:7923: \$? = $ac_status" >&5 |
| 3395 | if (exit $ac_status) && test -s "$ac_outfile"; then |
| 3396 | # The compiler can only warn and ignore the option if not recognized |
| 3397 | # So say no if there are warnings other than the usual output. |
| 3398 | @@ -8054,7 +8085,7 @@ |
| 3399 | lt_prog_compiler_static='-non_shared' |
| 3400 | ;; |
| 3401 | |
| 3402 | - linux* | k*bsd*-gnu) |
| 3403 | + linux* | k*bsd*-gnu | kopensolaris*-gnu) |
| 3404 | case $cc_basename in |
| 3405 | # old Intel for x86_64 which still supported -KPIC. |
| 3406 | ecc*) |
| 3407 | @@ -8224,11 +8255,11 @@ |
| 3408 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
| 3409 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 3410 | -e 's:$: $lt_compiler_flag:'` |
| 3411 | - (eval echo "\"\$as_me:8227: $lt_compile\"" >&5) |
| 3412 | + (eval echo "\"\$as_me:8258: $lt_compile\"" >&5) |
| 3413 | (eval "$lt_compile" 2>conftest.err) |
| 3414 | ac_status=$? |
| 3415 | cat conftest.err >&5 |
| 3416 | - echo "$as_me:8231: \$? = $ac_status" >&5 |
| 3417 | + echo "$as_me:8262: \$? = $ac_status" >&5 |
| 3418 | if (exit $ac_status) && test -s "$ac_outfile"; then |
| 3419 | # The compiler can only warn and ignore the option if not recognized |
| 3420 | # So say no if there are warnings other than the usual output. |
| 3421 | @@ -8329,11 +8360,11 @@ |
| 3422 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
| 3423 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 3424 | -e 's:$: $lt_compiler_flag:'` |
| 3425 | - (eval echo "\"\$as_me:8332: $lt_compile\"" >&5) |
| 3426 | + (eval echo "\"\$as_me:8363: $lt_compile\"" >&5) |
| 3427 | (eval "$lt_compile" 2>out/conftest.err) |
| 3428 | ac_status=$? |
| 3429 | cat out/conftest.err >&5 |
| 3430 | - echo "$as_me:8336: \$? = $ac_status" >&5 |
| 3431 | + echo "$as_me:8367: \$? = $ac_status" >&5 |
| 3432 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
| 3433 | then |
| 3434 | # The compiler can only warn and ignore the option if not recognized |
| 3435 | @@ -8384,11 +8415,11 @@ |
| 3436 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
| 3437 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
| 3438 | -e 's:$: $lt_compiler_flag:'` |
| 3439 | - (eval echo "\"\$as_me:8387: $lt_compile\"" >&5) |
| 3440 | + (eval echo "\"\$as_me:8418: $lt_compile\"" >&5) |
| 3441 | (eval "$lt_compile" 2>out/conftest.err) |
| 3442 | ac_status=$? |
| 3443 | cat out/conftest.err >&5 |
| 3444 | - echo "$as_me:8391: \$? = $ac_status" >&5 |
| 3445 | + echo "$as_me:8422: \$? = $ac_status" >&5 |
| 3446 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
| 3447 | then |
| 3448 | # The compiler can only warn and ignore the option if not recognized |
| 3449 | @@ -8527,6 +8558,7 @@ |
| 3450 | fi |
| 3451 | supports_anon_versioning=no |
| 3452 | case `$LD -v 2>&1` in |
| 3453 | + *GNU\ gold*) supports_anon_versioning=yes ;; |
| 3454 | *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 |
| 3455 | *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... |
| 3456 | *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... |
| 3457 | @@ -8618,7 +8650,7 @@ |
| 3458 | archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' |
| 3459 | ;; |
| 3460 | |
| 3461 | - gnu* | linux* | tpf* | k*bsd*-gnu) |
| 3462 | + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) |
| 3463 | tmp_diet=no |
| 3464 | if test "$host_os" = linux-dietlibc; then |
| 3465 | case $cc_basename in |
| 3466 | @@ -10080,7 +10112,7 @@ |
| 3467 | ;; |
| 3468 | |
| 3469 | # This must be Linux ELF. |
| 3470 | -linux* | k*bsd*-gnu) |
| 3471 | +linux* | k*bsd*-gnu | kopensolaris*-gnu) |
| 3472 | version_type=linux |
| 3473 | need_lib_prefix=no |
| 3474 | need_version=no |
| 3475 | @@ -10767,7 +10799,7 @@ |
| 3476 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 3477 | lt_status=$lt_dlunknown |
| 3478 | cat > conftest.$ac_ext <<_LT_EOF |
| 3479 | -#line 10770 "configure" |
| 3480 | +#line 10802 "configure" |
| 3481 | #include "confdefs.h" |
| 3482 | |
| 3483 | #if HAVE_DLFCN_H |
| 3484 | @@ -10863,7 +10895,7 @@ |
| 3485 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
| 3486 | lt_status=$lt_dlunknown |
| 3487 | cat > conftest.$ac_ext <<_LT_EOF |
| 3488 | -#line 10866 "configure" |
| 3489 | +#line 10898 "configure" |
| 3490 | #include "confdefs.h" |
| 3491 | |
| 3492 | #if HAVE_DLFCN_H |
| 3493 | @@ -11893,6 +11925,37 @@ |
| 3494 | fi |
| 3495 | |
| 3496 | |
| 3497 | +# Alter default logging if we're development vs. stable |
| 3498 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking development series build" >&5 |
| 3499 | +$as_echo_n "checking development series build... " >&6; } |
| 3500 | +DEVVERSION="`echo $PACKAGE_VERSION|cut -d. -f2`" |
| 3501 | +if expr $DEVVERSION % 2 > /dev/null != "0"; then |
| 3502 | + debugging=yes |
| 3503 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| 3504 | +$as_echo "yes" >&6; } |
| 3505 | +else |
| 3506 | + debugging=no |
| 3507 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
| 3508 | +$as_echo "no" >&6; } |
| 3509 | +fi |
| 3510 | + |
| 3511 | +# Check whether --enable-debug was given. |
| 3512 | +if test "${enable_debug+set}" = set; then : |
| 3513 | + enableval=$enable_debug; enable_debug=$enableval |
| 3514 | +else |
| 3515 | + enable_debug=$debugging |
| 3516 | +fi |
| 3517 | + |
| 3518 | +if test "x$enable_debug" != "xno"; then |
| 3519 | + LOG_LEVEL="DEBUG" |
| 3520 | + LOG_FILE_SIZE="10485760" |
| 3521 | +else |
| 3522 | + LOG_LEVEL="INFO" |
| 3523 | + LOG_FILE_SIZE="1048576" |
| 3524 | +fi |
| 3525 | + |
| 3526 | + |
| 3527 | + |
| 3528 | # Check for python 2.5 |
| 3529 | |
| 3530 | |
| 3531 | @@ -12058,6 +12121,14 @@ |
| 3532 | am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` |
| 3533 | am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` |
| 3534 | ;; |
| 3535 | + *) |
| 3536 | + case $am_py_prefix in |
| 3537 | + /usr|/System*) ;; |
| 3538 | + *) |
| 3539 | + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages |
| 3540 | + ;; |
| 3541 | + esac |
| 3542 | + ;; |
| 3543 | esac |
| 3544 | |
| 3545 | fi |
| 3546 | @@ -12088,6 +12159,14 @@ |
| 3547 | am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` |
| 3548 | am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` |
| 3549 | ;; |
| 3550 | + *) |
| 3551 | + case $am_py_exec_prefix in |
| 3552 | + /usr|/System*) ;; |
| 3553 | + *) |
| 3554 | + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages |
| 3555 | + ;; |
| 3556 | + esac |
| 3557 | + ;; |
| 3558 | esac |
| 3559 | |
| 3560 | fi |
| 3561 | @@ -12167,12 +12246,12 @@ |
| 3562 | pkg_cv_NAUTILUS_CFLAGS="$NAUTILUS_CFLAGS" |
| 3563 | else |
| 3564 | if test -n "$PKG_CONFIG" && \ |
| 3565 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= 2.6.0\""; } >&5 |
| 3566 | - ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= 2.6.0") 2>&5 |
| 3567 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0\""; } >&5 |
| 3568 | + ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0") 2>&5 |
| 3569 | ac_status=$? |
| 3570 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3571 | test $ac_status = 0; }; then |
| 3572 | - pkg_cv_NAUTILUS_CFLAGS=`$PKG_CONFIG --cflags "libnautilus-extension >= 2.6.0" 2>/dev/null` |
| 3573 | + pkg_cv_NAUTILUS_CFLAGS=`$PKG_CONFIG --cflags "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0" 2>/dev/null` |
| 3574 | else |
| 3575 | pkg_failed=yes |
| 3576 | fi |
| 3577 | @@ -12185,12 +12264,12 @@ |
| 3578 | pkg_cv_NAUTILUS_LIBS="$NAUTILUS_LIBS" |
| 3579 | else |
| 3580 | if test -n "$PKG_CONFIG" && \ |
| 3581 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= 2.6.0\""; } >&5 |
| 3582 | - ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= 2.6.0") 2>&5 |
| 3583 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0\""; } >&5 |
| 3584 | + ($PKG_CONFIG --exists --print-errors "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0") 2>&5 |
| 3585 | ac_status=$? |
| 3586 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 3587 | test $ac_status = 0; }; then |
| 3588 | - pkg_cv_NAUTILUS_LIBS=`$PKG_CONFIG --libs "libnautilus-extension >= 2.6.0" 2>/dev/null` |
| 3589 | + pkg_cv_NAUTILUS_LIBS=`$PKG_CONFIG --libs "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0" 2>/dev/null` |
| 3590 | else |
| 3591 | pkg_failed=yes |
| 3592 | fi |
| 3593 | @@ -12209,14 +12288,14 @@ |
| 3594 | _pkg_short_errors_supported=no |
| 3595 | fi |
| 3596 | if test $_pkg_short_errors_supported = yes; then |
| 3597 | - NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnautilus-extension >= 2.6.0"` |
| 3598 | + NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0"` |
| 3599 | else |
| 3600 | - NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnautilus-extension >= 2.6.0"` |
| 3601 | + NAUTILUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0"` |
| 3602 | fi |
| 3603 | # Put the nasty error message in config.log where it belongs |
| 3604 | echo "$NAUTILUS_PKG_ERRORS" >&5 |
| 3605 | |
| 3606 | - as_fn_error "Package requirements (libnautilus-extension >= 2.6.0) were not met: |
| 3607 | + as_fn_error "Package requirements (libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0) were not met: |
| 3608 | |
| 3609 | $NAUTILUS_PKG_ERRORS |
| 3610 | |
| 3611 | @@ -12893,8 +12972,8 @@ |
| 3612 | # report actual input values of CONFIG_FILES etc. instead of their |
| 3613 | # values after options handling. |
| 3614 | ac_log=" |
| 3615 | -This file was extended by ubuntuone-client $as_me 1.1.0, which was |
| 3616 | -generated by GNU Autoconf 2.64. Invocation command line was |
| 3617 | +This file was extended by ubuntuone-client $as_me 1.1.2, which was |
| 3618 | +generated by GNU Autoconf 2.65. Invocation command line was |
| 3619 | |
| 3620 | CONFIG_FILES = $CONFIG_FILES |
| 3621 | CONFIG_HEADERS = $CONFIG_HEADERS |
| 3622 | @@ -12934,6 +13013,7 @@ |
| 3623 | |
| 3624 | -h, --help print this help, then exit |
| 3625 | -V, --version print version number and configuration settings, then exit |
| 3626 | + --config print configuration, then exit |
| 3627 | -q, --quiet, --silent |
| 3628 | do not print progress messages |
| 3629 | -d, --debug don't remove temporary files |
| 3630 | @@ -12956,10 +13036,11 @@ |
| 3631 | |
| 3632 | _ACEOF |
| 3633 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
| 3634 | +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
| 3635 | ac_cs_version="\\ |
| 3636 | -ubuntuone-client config.status 1.1.0 |
| 3637 | -configured by $0, generated by GNU Autoconf 2.64, |
| 3638 | - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
| 3639 | +ubuntuone-client config.status 1.1.2 |
| 3640 | +configured by $0, generated by GNU Autoconf 2.65, |
| 3641 | + with options \\"\$ac_cs_config\\" |
| 3642 | |
| 3643 | Copyright (C) 2009 Free Software Foundation, Inc. |
| 3644 | This config.status script is free software; the Free Software Foundation |
| 3645 | @@ -12997,6 +13078,8 @@ |
| 3646 | ac_cs_recheck=: ;; |
| 3647 | --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) |
| 3648 | $as_echo "$ac_cs_version"; exit ;; |
| 3649 | + --config | --confi | --conf | --con | --co | --c ) |
| 3650 | + $as_echo "$ac_cs_config"; exit ;; |
| 3651 | --debug | --debu | --deb | --de | --d | -d ) |
| 3652 | debug=: ;; |
| 3653 | --file | --fil | --fi | --f ) |
| 3654 | @@ -13444,7 +13527,7 @@ |
| 3655 | t delim |
| 3656 | :nl |
| 3657 | h |
| 3658 | -s/\(.\{148\}\).*/\1/ |
| 3659 | +s/\(.\{148\}\)..*/\1/ |
| 3660 | t more1 |
| 3661 | s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ |
| 3662 | p |
| 3663 | @@ -13458,7 +13541,7 @@ |
| 3664 | t nl |
| 3665 | :delim |
| 3666 | h |
| 3667 | -s/\(.\{148\}\).*/\1/ |
| 3668 | +s/\(.\{148\}\)..*/\1/ |
| 3669 | t more2 |
| 3670 | s/["\\]/\\&/g; s/^/"/; s/$/"/ |
| 3671 | p |
| 3672 | |
| 3673 | === modified file 'configure.ac' |
| 3674 | --- configure.ac 2009-12-07 17:35:00 +0000 |
| 3675 | +++ configure.ac 2010-02-18 00:10:25 +0000 |
| 3676 | @@ -1,7 +1,7 @@ |
| 3677 | dnl Process this file with autoconf to produce a configure script. |
| 3678 | AC_PREREQ(2.53) |
| 3679 | |
| 3680 | -AC_INIT([ubuntuone-client], [1.1.0]) |
| 3681 | +AC_INIT([ubuntuone-client], [1.1.2]) |
| 3682 | AC_CONFIG_SRCDIR([config.h.in]) |
| 3683 | |
| 3684 | AM_INIT_AUTOMAKE([1.10 foreign]) |
| 3685 | @@ -46,6 +46,32 @@ |
| 3686 | fi |
| 3687 | AM_CONDITIONAL(ENABLE_RENDERING, test "x$enable_rendering" = "xyes") |
| 3688 | |
| 3689 | +# Alter default logging if we're development vs. stable |
| 3690 | +AC_MSG_CHECKING([development series build]) |
| 3691 | +DEVVERSION="`echo $PACKAGE_VERSION|cut -d. -f2`" |
| 3692 | +if expr $DEVVERSION % 2 > /dev/null != "0"; then |
| 3693 | + debugging=yes |
| 3694 | + AC_MSG_RESULT([yes]) |
| 3695 | +else |
| 3696 | + debugging=no |
| 3697 | + AC_MSG_RESULT([no]) |
| 3698 | +fi |
| 3699 | + |
| 3700 | +AC_ARG_ENABLE([debug], |
| 3701 | + AC_HELP_STRING([--enable-debug], |
| 3702 | + [Enable debug logging by default [default=auto]]), |
| 3703 | + enable_debug=$enableval, |
| 3704 | + enable_debug=$debugging) |
| 3705 | +if test "x$enable_debug" != "xno"; then |
| 3706 | + LOG_LEVEL="DEBUG" |
| 3707 | + LOG_FILE_SIZE="10485760" |
| 3708 | +else |
| 3709 | + LOG_LEVEL="INFO" |
| 3710 | + LOG_FILE_SIZE="1048576" |
| 3711 | +fi |
| 3712 | +AC_SUBST(LOG_LEVEL) |
| 3713 | +AC_SUBST(LOG_FILE_SIZE) |
| 3714 | + |
| 3715 | # Check for python 2.5 |
| 3716 | AM_PATH_PYTHON([2.5]) |
| 3717 | |
| 3718 | @@ -90,7 +116,7 @@ |
| 3719 | AC_SUBST(USP_PATH) |
| 3720 | |
| 3721 | # Stuff we need to build the extension shlib |
| 3722 | -PKG_CHECK_MODULES(NAUTILUS, [libnautilus-extension >= 2.6.0]) |
| 3723 | +PKG_CHECK_MODULES(NAUTILUS, [libnautilus-extension >= 2.6.0 libebook-1.2 gconf-2.0]) |
| 3724 | AC_SUBST(NAUTILUS_CFLAGS) |
| 3725 | AC_SUBST(NAUTILUS_LIBS) |
| 3726 | |
| 3727 | |
| 3728 | === modified file 'contrib/__init__.pyc' |
| 3729 | Binary files contrib/__init__.pyc 2009-12-07 17:35:00 +0000 and contrib/__init__.pyc 2010-02-18 00:10:25 +0000 differ |
| 3730 | === added file 'contrib/dbus-docs' |
| 3731 | --- contrib/dbus-docs 1970-01-01 00:00:00 +0000 |
| 3732 | +++ contrib/dbus-docs 2010-02-18 00:10:25 +0000 |
| 3733 | @@ -0,0 +1,196 @@ |
| 3734 | +#!/usr/bin/env python |
| 3735 | +# |
| 3736 | +# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com> |
| 3737 | +# |
| 3738 | +# Copyright 2009 Canonical Ltd. |
| 3739 | +# |
| 3740 | +# This program is free software: you can redistribute it and/or modify it |
| 3741 | +# under the terms of the GNU General Public License version 3, as published |
| 3742 | +# by the Free Software Foundation. |
| 3743 | +# |
| 3744 | +# This program is distributed in the hope that it will be useful, but |
| 3745 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 3746 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 3747 | +# PURPOSE. See the GNU General Public License for more details. |
| 3748 | +# |
| 3749 | +# You should have received a copy of the GNU General Public License along |
| 3750 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 3751 | + |
| 3752 | +from twisted.internet import glib2reactor |
| 3753 | +glib2reactor.install() |
| 3754 | + |
| 3755 | +import sys |
| 3756 | +import os |
| 3757 | +import signal |
| 3758 | +import dbus |
| 3759 | +import subprocess |
| 3760 | +import shutil |
| 3761 | + |
| 3762 | +from xml.etree import ElementTree |
| 3763 | + |
| 3764 | +sys.path.insert(0, os.path.abspath(".")) |
| 3765 | + |
| 3766 | +from contrib.dbus_util import DBusRunner |
| 3767 | +from contrib.testing.testcase import ( |
| 3768 | + FakeMain, |
| 3769 | + DBusGMainLoop, |
| 3770 | + DBusInterface, |
| 3771 | + FakeNetworkManager, |
| 3772 | +) |
| 3773 | + |
| 3774 | +from ubuntuone.syncdaemon.dbus_interface import ( |
| 3775 | + DBUS_IFACE_SYNC_NAME, |
| 3776 | + DBUS_IFACE_STATUS_NAME, |
| 3777 | + DBUS_IFACE_EVENTS_NAME, |
| 3778 | + DBUS_IFACE_FS_NAME, |
| 3779 | + DBUS_IFACE_SHARES_NAME, |
| 3780 | + DBUS_IFACE_CONFIG_NAME, |
| 3781 | + DBUS_IFACE_FOLDERS_NAME, |
| 3782 | +) |
| 3783 | +from ubuntuone.syncdaemon.tools import DBusClient |
| 3784 | +from twisted.internet import reactor, defer |
| 3785 | + |
| 3786 | + |
| 3787 | +iface_path = ((DBUS_IFACE_SYNC_NAME, '/'), (DBUS_IFACE_CONFIG_NAME, '/config'), |
| 3788 | + (DBUS_IFACE_EVENTS_NAME, '/events'), |
| 3789 | + (DBUS_IFACE_FS_NAME, '/filesystem'), |
| 3790 | + (DBUS_IFACE_SHARES_NAME, '/shares'), |
| 3791 | + (DBUS_IFACE_STATUS_NAME, '/status'), |
| 3792 | + (DBUS_IFACE_FOLDERS_NAME, '/folders'), |
| 3793 | + ) |
| 3794 | + |
| 3795 | + |
| 3796 | +def parse_introspect_data(xml): |
| 3797 | + """Parse the xml returned by Introspect and returns a dict""" |
| 3798 | + info = dict() |
| 3799 | + e = ElementTree.fromstring(xml) |
| 3800 | + for c in e.findall('interface'): |
| 3801 | + # ignore other interfaces |
| 3802 | + if not c.attrib['name'].startswith('com.ubuntuone'): |
| 3803 | + continue |
| 3804 | + iface_name = c.attrib['name'] |
| 3805 | + info[iface_name] = dict() |
| 3806 | + # methods |
| 3807 | + methods = dict() |
| 3808 | + for method in c.findall('method'): |
| 3809 | + meth_name = method.attrib['name'] |
| 3810 | + args = [] |
| 3811 | + for arg in method.findall('arg'): |
| 3812 | + dir = arg.attrib['direction'] |
| 3813 | + type = arg.attrib['type'] |
| 3814 | + if 'name' in arg.attrib: |
| 3815 | + name = arg.attrib['name'] |
| 3816 | + args.append((type, dir, name)) |
| 3817 | + else: |
| 3818 | + args.append((type, dir)) |
| 3819 | + docstrings = method.findall('docstring') |
| 3820 | + docstring = docstrings[0].text if docstrings else 'No docstring' |
| 3821 | + methods[meth_name] = dict(args=args, docstring=docstring) |
| 3822 | + info[iface_name]['methods'] = methods |
| 3823 | + # signals |
| 3824 | + signals = dict() |
| 3825 | + for signal in c.findall('signal'): |
| 3826 | + sig_name = signal.attrib['name'] |
| 3827 | + args = [] |
| 3828 | + for arg in signal.findall('arg'): |
| 3829 | + type = arg.attrib['type'] |
| 3830 | + name = arg.attrib['name'] |
| 3831 | + args.append((type, name)) |
| 3832 | + docstrings = signal.findall('docstring') |
| 3833 | + docstring = docstrings[0].text if docstrings else 'No docstring' |
| 3834 | + signals[sig_name] = dict(args=args, docstring=docstring) |
| 3835 | + info[iface_name]['signals'] = signals |
| 3836 | + return info |
| 3837 | + |
| 3838 | + |
| 3839 | +def get_info(path): |
| 3840 | + """Get all the introspectable info from 'path'""" |
| 3841 | + d = defer.Deferred() |
| 3842 | + client = DBusClient(bus, path, 'org.freedesktop.DBus.Introspectable') |
| 3843 | + client.call_method('Introspect', reply_handler=d.callback, |
| 3844 | + error_handler=d.errback) |
| 3845 | + return d |
| 3846 | + |
| 3847 | + |
| 3848 | +def dump_to_stream(info_by_path, stream): |
| 3849 | + print >>stream, "SyncDaemon DBus API\n" |
| 3850 | + for path, interfaces in info_by_path.items(): |
| 3851 | + print >>stream, "Object path: %s" % path |
| 3852 | + for iface_name, kinds in interfaces.items(): |
| 3853 | + print >>stream, " Interface: %s" % iface_name |
| 3854 | + print >>stream, " Methods:" |
| 3855 | + for meth_name, val in kinds['methods'].items(): |
| 3856 | + in_args = ','.join([arg[2] + '=' + arg[0] for arg in |
| 3857 | + val['args'] if arg[1] == 'in']) |
| 3858 | + out_args = ','.join([arg[0] for arg in val['args'] |
| 3859 | + if arg[1] == 'out']) |
| 3860 | + if out_args and in_args: |
| 3861 | + print >>stream, " %s(%s) -> %s" % (meth_name, in_args, |
| 3862 | + out_args) |
| 3863 | + elif in_args: |
| 3864 | + print >>stream, " %s(%s)" % (meth_name, in_args) |
| 3865 | + else: |
| 3866 | + print >>stream, " %s()" % meth_name |
| 3867 | + print >>stream, " %s\n" % val['docstring'] |
| 3868 | + print >>stream, " Signals:" |
| 3869 | + for signal_name, val in kinds['signals'].items(): |
| 3870 | + in_args = ','.join([arg[1] + '=' + arg[0] \ |
| 3871 | + for arg in val['args']]) |
| 3872 | + if in_args: |
| 3873 | + print >>stream, " %s(%s)" % (signal_name, in_args) |
| 3874 | + else: |
| 3875 | + print >>stream, " %s(%s)" % signal_name |
| 3876 | + print >>stream, " %s\n" % val['docstring'] |
| 3877 | + |
| 3878 | + |
| 3879 | +@defer.inlineCallbacks |
| 3880 | +def main(bus): |
| 3881 | + """Entry point""" |
| 3882 | + info_by_path = dict() |
| 3883 | + for iface, path in iface_path: |
| 3884 | + xml = yield get_info(path) |
| 3885 | + obj_info = parse_introspect_data(xml) |
| 3886 | + info_by_path[path] = obj_info |
| 3887 | + dest_file = os.path.join(os.getcwd(), 'docs', 'syncdaemon_dbus_api.txt') |
| 3888 | + with open(dest_file, 'w') as f: |
| 3889 | + dump_to_stream(info_by_path, f) |
| 3890 | + reactor.stop() |
| 3891 | + |
| 3892 | + |
| 3893 | +def start_syncdaemon(tmp_dir): |
| 3894 | + """Starts a syncdaemon instance just like the one used in the test suite""" |
| 3895 | + xdg_cache = os.path.join(tmp_dir, 'xdg_cache') |
| 3896 | + data_dir = os.path.join(xdg_cache, 'data') |
| 3897 | + partials_dir = os.path.join(xdg_cache, 'partials') |
| 3898 | + root_dir = os.path.join(tmp_dir, 'root') |
| 3899 | + shares_dir = os.path.join(tmp_dir, 'shares') |
| 3900 | + main = FakeMain(root_dir, shares_dir, data_dir, partials_dir) |
| 3901 | + loop = DBusGMainLoop(set_as_default=True) |
| 3902 | + bus = dbus.bus.BusConnection(mainloop=loop) |
| 3903 | + nm = FakeNetworkManager(bus) |
| 3904 | + dbus_iface = DBusInterface(bus, main, system_bus=bus) |
| 3905 | + main.dbus_iface = dbus_iface |
| 3906 | + return main, bus |
| 3907 | + |
| 3908 | + |
| 3909 | +if __name__ == '__main__': |
| 3910 | + dbus_runner = DBusRunner() |
| 3911 | + dbus_runner.startDBus() |
| 3912 | + tmp_dir = os.path.join(os.getcwd(), 'tmp') |
| 3913 | + try: |
| 3914 | + |
| 3915 | + m, bus = start_syncdaemon(tmp_dir) |
| 3916 | + try: |
| 3917 | + reactor.callWhenRunning(main, bus) |
| 3918 | + reactor.run() |
| 3919 | + finally: |
| 3920 | + m.quit() |
| 3921 | + finally: |
| 3922 | + dbus_runner.stopDBus() |
| 3923 | + # remove the tmp dir |
| 3924 | + os.chmod(tmp_dir, 0777) |
| 3925 | + for dirpath, dirs, _ in os.walk(tmp_dir): |
| 3926 | + for dir in dirs: |
| 3927 | + os.chmod(os.path.join(dirpath, dir), 0777) |
| 3928 | + shutil.rmtree(tmp_dir) |
| 3929 | + |
| 3930 | |
| 3931 | === added file 'contrib/dbus_util.py' |
| 3932 | --- contrib/dbus_util.py 1970-01-01 00:00:00 +0000 |
| 3933 | +++ contrib/dbus_util.py 2010-02-18 00:10:25 +0000 |
| 3934 | @@ -0,0 +1,72 @@ |
| 3935 | +# |
| 3936 | +# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com> |
| 3937 | +# |
| 3938 | +# Copyright 2009 Canonical Ltd. |
| 3939 | +# |
| 3940 | +# This program is free software: you can redistribute it and/or modify it |
| 3941 | +# under the terms of the GNU General Public License version 3, as published |
| 3942 | +# by the Free Software Foundation. |
| 3943 | +# |
| 3944 | +# This program is distributed in the hope that it will be useful, but |
| 3945 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
| 3946 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 3947 | +# PURPOSE. See the GNU General Public License for more details. |
| 3948 | +# |
| 3949 | +# You should have received a copy of the GNU General Public License along |
| 3950 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
| 3951 | + |
| 3952 | +import os |
| 3953 | +import signal |
| 3954 | +import subprocess |
| 3955 | + |
| 3956 | +from distutils.spawn import find_executable |
| 3957 | + |
| 3958 | + |
| 3959 | +class DBusLaunchError(Exception): |
| 3960 | + """Error while launching dbus-daemon""" |
| 3961 | + pass |
| 3962 | + |
| 3963 | +class NotFoundError(Exception): |
| 3964 | + """Not found error""" |
| 3965 | + pass |
| 3966 | + |
| 3967 | + |
| 3968 | +class DBusRunner(object): |
| 3969 | + |
| 3970 | + def __init__(self): |
| 3971 | + self.dbus_address = None |
| 3972 | + self.dbus_pid = None |
| 3973 | + self.running = False |
| 3974 | + |
| 3975 | + def startDBus(self): |
| 3976 | + """Start our own session bus daemon for testing.""" |
| 3977 | + dbus = find_executable("dbus-daemon") |
| 3978 | + if not dbus: |
| 3979 | + raise NotFoundError("dbus-daemon was not found.") |
| 3980 | + |
| 3981 | + config_file = os.path.join(os.getcwd(), "contrib", "testing", |
| 3982 | + "dbus-session.conf") |
| 3983 | + dbus_args = ["--fork", |
| 3984 | + "--config-file=" + config_file, |
| 3985 | + "--print-address=1", |
| 3986 | + "--print-pid=2"] |
| 3987 | + p = subprocess.Popen([dbus] + dbus_args, |
| 3988 | + bufsize=4096, stdout=subprocess.PIPE, |
| 3989 | + stderr=subprocess.PIPE) |
| 3990 | + |
| 3991 | + self.dbus_address = "".join(p.stdout.readlines()).strip() |
| 3992 | + self.dbus_pid = int("".join(p.stderr.readlines()).strip()) |
| 3993 | + |
| 3994 | + if self.dbus_address != "": |
| 3995 | + os.environ["DBUS_SESSION_BUS_ADDRESS"] = self.dbus_address |
| 3996 | + else: |
| 3997 | + os.kill(self.dbus_pid, signal.SIGKILL) |
| 3998 | + raise DBusLaunchError("There was a problem launching dbus-daemon.") |
| 3999 | + self.running = True |
| 4000 | + |
| 4001 | + def stopDBus(self): |
| 4002 | + """Stop our DBus session bus daemon.""" |
| 4003 | + del os.environ["DBUS_SESSION_BUS_ADDRESS"] |
| 4004 | + os.kill(self.dbus_pid, signal.SIGKILL) |
| 4005 | + self.running = False |
| 4006 | + |
| 4007 | |
| 4008 | === added file 'contrib/dbus_util.pyc' |
| 4009 | Binary files contrib/dbus_util.pyc 1970-01-01 00:00:00 +0000 and contrib/dbus_util.pyc 2010-02-18 00:10:25 +0000 differ |
| 4010 | === modified file 'contrib/mocker.pyc' |
| 4011 | Binary files contrib/mocker.pyc 2009-12-07 17:35:00 +0000 and contrib/mocker.pyc 2010-02-18 00:10:25 +0000 differ |
| 4012 | === modified file 'contrib/test' |
| 4013 | --- contrib/test 2009-12-07 17:35:00 +0000 |
| 4014 | +++ contrib/test 2010-02-18 00:10:25 +0000 |
| 4015 | @@ -66,37 +66,7 @@ |
| 4016 | suite.addTests(module_suite) |
| 4017 | return suite |
| 4018 | |
| 4019 | - def startDBus(self): |
| 4020 | - """Start our own session bus daemon for testing.""" |
| 4021 | - dbus = find_executable("dbus-daemon") |
| 4022 | - if not dbus: |
| 4023 | - raise NotFoundError("dbus-daemon was not found.") |
| 4024 | - |
| 4025 | - config_file = os.path.join(os.getcwd(), "contrib", "testing", |
| 4026 | - "dbus-session.conf") |
| 4027 | - dbus_args = ["--fork", |
| 4028 | - "--config-file=" + config_file, |
| 4029 | - "--print-address=1", |
| 4030 | - "--print-pid=2"] |
| 4031 | - p = subprocess.Popen([dbus] + dbus_args, |
| 4032 | - bufsize=4096, stdout=subprocess.PIPE, |
| 4033 | - stderr=subprocess.PIPE) |
| 4034 | - |
| 4035 | - self.dbus_address = "".join(p.stdout.readlines()).strip() |
| 4036 | - self.dbus_pid = int("".join(p.stderr.readlines()).strip()) |
| 4037 | - |
| 4038 | - if self.dbus_address != "": |
| 4039 | - os.environ["DBUS_SESSION_BUS_ADDRESS"] = self.dbus_address |
| 4040 | - else: |
| 4041 | - os.kill(self.dbus_pid, signal.SIGKILL) |
| 4042 | - raise DBusLaunchError("There was a problem launching dbus-daemon.") |
| 4043 | - |
| 4044 | - def stopDBus(self): |
| 4045 | - """Stop our DBus session bus daemon.""" |
| 4046 | - del os.environ["DBUS_SESSION_BUS_ADDRESS"] |
| 4047 | - os.kill(self.dbus_pid, signal.SIGKILL) |
| 4048 | - |
| 4049 | - def run(self, testpath, test_pattern=None): |
| 4050 | + def run(self, testpath, test_pattern=None, loops=None): |
| 4051 | """run the tests. """ |
| 4052 | # install the glib2reactor before any import of the reactor to avoid |
| 4053 | # using the default SelectReactor and be able to run the dbus tests |
| 4054 | @@ -106,7 +76,9 @@ |
| 4055 | from twisted.trial.reporter import TreeReporter |
| 4056 | from twisted.trial.runner import TrialRunner |
| 4057 | |
| 4058 | - self.startDBus() |
| 4059 | + from contrib.dbus_util import DBusRunner |
| 4060 | + dbus_runner = DBusRunner() |
| 4061 | + dbus_runner.startDBus() |
| 4062 | |
| 4063 | workingDirectory = os.path.join(os.getcwd(), "_trial_temp", "tmp") |
| 4064 | runner = TrialRunner(reporterFactory=TreeReporter, realTimeErrors=True, |
| 4065 | @@ -115,17 +87,22 @@ |
| 4066 | # setup a custom XDG_CACHE_HOME and create the logs directory |
| 4067 | xdg_cache = os.path.join(os.getcwd(), "_trial_temp", "xdg_cache") |
| 4068 | os.environ["XDG_CACHE_HOME"] = xdg_cache |
| 4069 | - # setup the ROOT_DIR env var |
| 4070 | - os.environ['ROOT_DIR'] = os.getcwd() |
| 4071 | + # setup the ROOTDIR env var |
| 4072 | + os.environ['ROOTDIR'] = os.getcwd() |
| 4073 | if not os.path.exists(xdg_cache): |
| 4074 | os.makedirs(xdg_cache) |
| 4075 | success = 0 |
| 4076 | try: |
| 4077 | suite = self._collect_tests(testpath, test_pattern) |
| 4078 | + if loops: |
| 4079 | + old_suite = suite |
| 4080 | + suite = unittest.TestSuite() |
| 4081 | + for x in xrange(loops): |
| 4082 | + suite.addTest(old_suite) |
| 4083 | result = runner.run(suite) |
| 4084 | success = result.wasSuccessful() |
| 4085 | finally: |
| 4086 | - self.stopDBus() |
| 4087 | + dbus_runner.stopDBus() |
| 4088 | if not success: |
| 4089 | sys.exit(1) |
| 4090 | else: |
| 4091 | @@ -138,6 +115,9 @@ |
| 4092 | parser = OptionParser(usage=usage) |
| 4093 | parser.add_option("-t", "--test", dest="test", |
| 4094 | help = "run specific tests, e.g: className.methodName") |
| 4095 | + parser.add_option("-l", "--loop", dest="loops", type="int", default=1, |
| 4096 | + help = "loop selected tests LOOPS number of times", |
| 4097 | + metavar="LOOPS") |
| 4098 | |
| 4099 | (options, args) = parser.parse_args() |
| 4100 | if args: |
| 4101 | @@ -147,4 +127,4 @@ |
| 4102 | sys.exit() |
| 4103 | else: |
| 4104 | testpath = None |
| 4105 | - TestRunner().run(testpath, options.test) |
| 4106 | + TestRunner().run(testpath, options.test, options.loops) |
| 4107 | |
| 4108 | === modified file 'contrib/testing/__init__.pyc' |
| 4109 | Binary files contrib/testing/__init__.pyc 2009-12-07 17:35:00 +0000 and contrib/testing/__init__.pyc 2010-02-18 00:10:25 +0000 differ |
| 4110 | === modified file 'contrib/testing/testcase.py' |
| 4111 | --- contrib/testing/testcase.py 2009-10-16 13:35:00 +0000 |
| 4112 | +++ contrib/testing/testcase.py 2010-02-18 00:10:25 +0000 |
| 4113 | @@ -19,11 +19,12 @@ |
| 4114 | |
| 4115 | import dbus |
| 4116 | from dbus.mainloop.glib import DBusGMainLoop |
| 4117 | +import contextlib |
| 4118 | import logging |
| 4119 | import os |
| 4120 | import shutil |
| 4121 | |
| 4122 | - |
| 4123 | +from ubuntuone.oauthdesktop.main import Login, LoginProcessor |
| 4124 | from ubuntuone.syncdaemon import ( |
| 4125 | config, |
| 4126 | action_queue, |
| 4127 | @@ -32,16 +33,33 @@ |
| 4128 | interfaces, |
| 4129 | volume_manager, |
| 4130 | main, |
| 4131 | + local_rescan, |
| 4132 | ) |
| 4133 | from ubuntuone.syncdaemon.dbus_interface import ( |
| 4134 | DBusInterface, |
| 4135 | DBusExposedObject, |
| 4136 | NM_STATE_CONNECTED, |
| 4137 | NM_STATE_DISCONNECTED, |
| 4138 | + DBUS_IFACE_AUTH_NAME, |
| 4139 | ) |
| 4140 | from twisted.internet import defer |
| 4141 | +from twisted.python import failure |
| 4142 | from twisted.trial.unittest import TestCase as TwistedTestCase |
| 4143 | from zope.interface import implements |
| 4144 | +from oauth import oauth |
| 4145 | + |
| 4146 | + |
| 4147 | +@contextlib.contextmanager |
| 4148 | +def environ(env_var, new_value): |
| 4149 | + """context manager to replace/add an environ value""" |
| 4150 | + old_value = os.environ.get(env_var, None) |
| 4151 | + os.environ[env_var] = new_value |
| 4152 | + yield |
| 4153 | + if old_value is None: |
| 4154 | + os.environ.pop(env_var) |
| 4155 | + else: |
| 4156 | + os.environ[env_var] = old_value |
| 4157 | + |
| 4158 | |
| 4159 | class FakeOAuthClient(object): |
| 4160 | """ Fake OAuthClient""" |
| 4161 | @@ -49,7 +67,7 @@ |
| 4162 | def __init__(self, realm): |
| 4163 | """ create the instance. """ |
| 4164 | self.realm = realm |
| 4165 | - self.consumer = 'ubuntuone' |
| 4166 | + self.consumer = oauth.OAuthConsumer('ubuntuone', 'hammertime') |
| 4167 | |
| 4168 | def get_access_token(self): |
| 4169 | """ returns a Token""" |
| 4170 | @@ -103,13 +121,15 @@ |
| 4171 | self.partials_dir, self.vm) |
| 4172 | self.event_q = event_queue.EventQueue(self.fs) |
| 4173 | self.fs.register_eq(self.event_q) |
| 4174 | - self.action_q = FakeActionQueue(self.event_q) |
| 4175 | + self.action_q = FakeActionQueue(self.event_q, main=self) |
| 4176 | self.state = main.SyncDaemonStateManager(self, 2, 0) |
| 4177 | self.event_q.subscribe(self.vm) |
| 4178 | self.vm.init_root() |
| 4179 | self.hash_q = FakeHashQueue() |
| 4180 | self.mark = FakeMark() |
| 4181 | self.dbus_iface = FakeDBusInterface() |
| 4182 | + self.lr = local_rescan.LocalRescan(self.vm, self.fs, |
| 4183 | + self.event_q, self.action_q) |
| 4184 | |
| 4185 | def _connect_aq(self, token): |
| 4186 | """ Connect the fake action queue """ |
| 4187 | @@ -193,14 +213,18 @@ |
| 4188 | |
| 4189 | def setUp(self): |
| 4190 | TwistedTestCase.setUp(self) |
| 4191 | - # invalidate the current config |
| 4192 | + # use the config from the branch |
| 4193 | + self.old_get_config_files = config.get_config_files |
| 4194 | + config.get_config_files = lambda: [os.path.join(os.environ['ROOTDIR'], |
| 4195 | + 'data', 'syncdaemon.conf')] |
| 4196 | + # fake a very basic config file with sane defaults for the tests |
| 4197 | config_file = os.path.join(self.mktemp('config'), 'syncdaemon.conf') |
| 4198 | - # fake a very basic config file with sane defaults for the tests |
| 4199 | with open(config_file, 'w') as fp: |
| 4200 | fp.write('[bandwidth_throttling]\n') |
| 4201 | fp.write('on = False\n') |
| 4202 | fp.write('read_limit = -1\n') |
| 4203 | fp.write('write_limit = -1\n') |
| 4204 | + # invalidate the current config |
| 4205 | config._user_config = None |
| 4206 | config.get_user_config(config_file=config_file) |
| 4207 | |
| 4208 | @@ -208,7 +232,8 @@ |
| 4209 | """ cleanup the temp dir. """ |
| 4210 | # invalidate the current config |
| 4211 | config._user_config = None |
| 4212 | - config.get_user_config() |
| 4213 | + # restore the old get_config_files |
| 4214 | + config.get_config_files = self.old_get_config_files |
| 4215 | if hasattr(self, '__root'): |
| 4216 | self.rmtree(self.__root) |
| 4217 | return TwistedTestCase.tearDown(self) |
| 4218 | @@ -253,7 +278,7 @@ |
| 4219 | |
| 4220 | def tearDown(self): |
| 4221 | """ Cleanup the test. """ |
| 4222 | - d = self.cleanup_signal_receivers() |
| 4223 | + d = self.cleanup_signal_receivers(self.signal_receivers) |
| 4224 | d.addBoth(self._tearDown) |
| 4225 | d.addBoth(lambda _: BaseTwistedTestCase.tearDown(self)) |
| 4226 | return d |
| 4227 | @@ -272,18 +297,22 @@ |
| 4228 | self.log.info("finished test %s.%s", self.__class__.__name__, |
| 4229 | self._testMethodName) |
| 4230 | |
| 4231 | - def error_handler(self, *error): |
| 4232 | + def error_handler(self, error): |
| 4233 | """ default error handler for DBus calls. """ |
| 4234 | - self.fail(error) |
| 4235 | + if isinstance(error, failure.Failure): |
| 4236 | + self.fail(error.getErrorMessage()) |
| 4237 | + else: |
| 4238 | + self.fail(str(error)) |
| 4239 | |
| 4240 | - def cleanup_signal_receivers(self): |
| 4241 | + def cleanup_signal_receivers(self, signal_receivers): |
| 4242 | """ cleanup self.signal_receivers and returns a deferred """ |
| 4243 | deferreds = [] |
| 4244 | - for match in self.signal_receivers: |
| 4245 | + for match in signal_receivers: |
| 4246 | d = defer.Deferred() |
| 4247 | def callback(*args): |
| 4248 | """ callback that accepts *args. """ |
| 4249 | - d.callback(args) |
| 4250 | + if not d.called: |
| 4251 | + d.callback(args) |
| 4252 | self.bus.call_async(dbus.bus.BUS_DAEMON_NAME, |
| 4253 | dbus.bus.BUS_DAEMON_PATH, |
| 4254 | dbus.bus.BUS_DAEMON_IFACE, 'RemoveMatch', 's', |
| 4255 | @@ -297,14 +326,15 @@ |
| 4256 | |
| 4257 | |
| 4258 | class FakeActionQueue(object): |
| 4259 | - """ stub implementation """ |
| 4260 | + """Stub implementation.""" |
| 4261 | |
| 4262 | implements(interfaces.IActionQueue) |
| 4263 | |
| 4264 | def __init__(self, eq, *args, **kwargs): |
| 4265 | """ Creates the instance """ |
| 4266 | self.eq = self.event_queue = eq |
| 4267 | - self.client = action_queue.ActionQueueProtocol() |
| 4268 | + self.client = action_queue.ActionQueue.protocol() |
| 4269 | + self.client.disconnect = lambda: None |
| 4270 | self.uploading = {} |
| 4271 | self.downloading = {} |
| 4272 | # pylint: disable-msg=C0103 |
| 4273 | @@ -324,76 +354,68 @@ |
| 4274 | self.throttling = False |
| 4275 | |
| 4276 | def connect(self, host=None, port=None, user_ssl=False): |
| 4277 | - """ stub implementation """ |
| 4278 | + """Stub implementation.""" |
| 4279 | self.eq.push('SYS_CONNECTION_MADE') |
| 4280 | |
| 4281 | def disconnect(self): |
| 4282 | - """ stub implementation """ |
| 4283 | - pass |
| 4284 | + """Stub implementation.""" |
| 4285 | |
| 4286 | def enable_throttling(self, value): |
| 4287 | self.throttling = value |
| 4288 | |
| 4289 | def cancel_download(self, share_id, node_id): |
| 4290 | - """ stub implementation """ |
| 4291 | - pass |
| 4292 | + """Stub implementation.""" |
| 4293 | |
| 4294 | def cancel_upload(self, share_id, node_id): |
| 4295 | - """ stub implementation """ |
| 4296 | - pass |
| 4297 | + """Stub implementation.""" |
| 4298 | |
| 4299 | def download(self, share_id, node_id, server_hash, fileobj): |
| 4300 | - """ stub implementation """ |
| 4301 | - pass |
| 4302 | + """Stub implementation.""" |
| 4303 | |
| 4304 | def upload(self, share_id, node_id, previous_hash, hash, crc32, |
| 4305 | size, deflated_size, fileobj): |
| 4306 | - """ stub implementation """ |
| 4307 | - pass |
| 4308 | + """Stub implementation.""" |
| 4309 | |
| 4310 | def make_file(self, share_id, parent_id, name, marker): |
| 4311 | - """ stub implementation """ |
| 4312 | - pass |
| 4313 | + """Stub implementation.""" |
| 4314 | |
| 4315 | def make_dir(self, share_id, parent_id, name, marker): |
| 4316 | - """ stub implementation """ |
| 4317 | - pass |
| 4318 | + """Stub implementation.""" |
| 4319 | |
| 4320 | def move(self, share_id, node_id, old_parent_id, new_parent_id, new_name): |
| 4321 | - """ stub implementation """ |
| 4322 | - pass |
| 4323 | + """Stub implementation.""" |
| 4324 | |
| 4325 | def unlink(self, share_id, node_id): |
| 4326 | - """ stub implementation """ |
| 4327 | - pass |
| 4328 | + """Stub implementation.""" |
| 4329 | |
| 4330 | def query(self, items): |
| 4331 | - """ stub implementation """ |
| 4332 | - pass |
| 4333 | + """Stub implementation.""" |
| 4334 | |
| 4335 | def listdir(self, share_id, node_id, server_hash, fileobj): |
| 4336 | - """ stub implementation """ |
| 4337 | - pass |
| 4338 | + """Stub implementation.""" |
| 4339 | |
| 4340 | def list_shares(self): |
| 4341 | + """Stub implementation.""" |
| 4342 | + |
| 4343 | + def list_volumes(self): |
| 4344 | """ stub implementation """ |
| 4345 | pass |
| 4346 | |
| 4347 | def answer_share(self, share_id, answer): |
| 4348 | - """ stub implementation """ |
| 4349 | + """Stub implementation.""" |
| 4350 | self.eq.push('AQ_ANSWER_SHARE_OK', share_id, answer) |
| 4351 | |
| 4352 | def create_share(self, *args): |
| 4353 | """ sutb implementation """ |
| 4354 | - pass |
| 4355 | |
| 4356 | def inquire_free_space(self, share_id): |
| 4357 | - """ stub implementation """ |
| 4358 | - pass |
| 4359 | + """Stub implementation.""" |
| 4360 | |
| 4361 | def inquire_account_info(self): |
| 4362 | - """ stub implementation """ |
| 4363 | - pass |
| 4364 | + """Stub implementation.""" |
| 4365 | + |
| 4366 | + def delete_volume(self, volume_id): |
| 4367 | + """Stub implementation.""" |
| 4368 | |
| 4369 | |
| 4370 | class MementoHandler(logging.Handler): |
| 4371 | @@ -464,12 +486,13 @@ |
| 4372 | |
| 4373 | def __init__(self, root_path): |
| 4374 | """ Creates the instance""" |
| 4375 | - self.root = volume_manager.Share(root_path, access_level='Modify') |
| 4376 | + self.root = volume_manager.Share(path=root_path, access_level='Modify') |
| 4377 | self.shares = {'':self.root} |
| 4378 | + self.udfs = {} |
| 4379 | self.log = logging.getLogger('ubuntuone.SyncDaemon.VM-test') |
| 4380 | |
| 4381 | def add_share(self, share): |
| 4382 | - """ Adss share to the shares dict """ |
| 4383 | + """Add share to the shares dict.""" |
| 4384 | self.shares[share.id] = share |
| 4385 | # if the share don't exists, create it |
| 4386 | if not os.path.exists(share.path): |
| 4387 | @@ -478,7 +501,117 @@ |
| 4388 | if not share.can_write(): |
| 4389 | os.chmod(share.path, 0555) |
| 4390 | |
| 4391 | + def add_udf(self, udf): |
| 4392 | + """Add udf to the udfs dict.""" |
| 4393 | + self.udfs[udf.id] = udf |
| 4394 | + |
| 4395 | def on_server_root(self, _): |
| 4396 | - """ |
| 4397 | - Do nothing |
| 4398 | - """ |
| 4399 | + """Do nothing.""" |
| 4400 | + |
| 4401 | + def share_deleted(self, _): |
| 4402 | + """Do nothing.""" |
| 4403 | + |
| 4404 | + def get_volume(self, id): |
| 4405 | + """Returns a share or a UDF.""" |
| 4406 | + try: |
| 4407 | + return self.shares[id] |
| 4408 | + except KeyError: |
| 4409 | + return self.udfs[id] |
| 4410 | + |
| 4411 | + def get_volumes(self, access_level='Modify', all_volumes=False): |
| 4412 | + """Simple get_volumes for FakeVolumeManager.""" |
| 4413 | + for share in self.shares.values(): |
| 4414 | + if all_volumes or share.access_level == access_level: |
| 4415 | + yield share |
| 4416 | + for udf in self.udfs.values(): |
| 4417 | + if all_volumes or udf.subscribed: |
| 4418 | + yield udf |
| 4419 | + |
| 4420 | + def unsubscribe_udf(self, udf_id): |
| 4421 | + """Mark the UDF with udf_id as unsubscribed.""" |
| 4422 | + udf = self.udfs[udf_id] |
| 4423 | + udf.subscribed = False |
| 4424 | + self.udfs[udf_id] = udf |
| 4425 | + |
| 4426 | + def delete_volume(self, volume_id): |
| 4427 | + """Request the deletion of a volume.""" |
| 4428 | + |
| 4429 | +# OAuth stubs |
| 4430 | +class FakeLoginProcessor(LoginProcessor): |
| 4431 | + """Stub login processor.""" |
| 4432 | + |
| 4433 | + def __init__(self, dbus_object): |
| 4434 | + """Initialize the login processor.""" |
| 4435 | + LoginProcessor.__init__(self, dbus_object, use_libnotify=False) |
| 4436 | + self.next_login_cb = None |
| 4437 | + |
| 4438 | + def login(self, realm, consumer_key, error_handler=None, |
| 4439 | + reply_handler=None, do_login=True): |
| 4440 | + """Stub, call self.next_login_cb or send NewCredentials if |
| 4441 | + self.next_login_cb isn't defined. |
| 4442 | + """ |
| 4443 | + self.realm = str(realm) |
| 4444 | + self.consumer_key = str(consumer_key) |
| 4445 | + if self.next_login_cb: |
| 4446 | + cb = self.next_login_cb[0] |
| 4447 | + args = self.next_login_cb[1] |
| 4448 | + self.next_login_cb = None |
| 4449 | + return cb(*args) |
| 4450 | + else: |
| 4451 | + self.dbus_object.NewCredentials(realm, consumer_key) |
| 4452 | + |
| 4453 | + def clear_token(self, realm, consumer_key): |
| 4454 | + """Stub, do nothing""" |
| 4455 | + pass |
| 4456 | + |
| 4457 | + def next_login_with(self, callback, args=tuple()): |
| 4458 | + """shortcircuit the next call to login and call the specified callback. |
| 4459 | + callback is usually one of: self.got_token, self.got_no_token, |
| 4460 | + self.got_denial or self.got_error. |
| 4461 | + """ |
| 4462 | + self.next_login_cb = (callback, args) |
| 4463 | + |
| 4464 | + |
| 4465 | +class FakeLogin(Login): |
| 4466 | + """Stub Object which listens for D-Bus OAuth requests""" |
| 4467 | + |
| 4468 | + def __init__(self, bus): |
| 4469 | + """Initiate the object.""" |
| 4470 | + self.bus = bus |
| 4471 | + self.busName = dbus.service.BusName(DBUS_IFACE_AUTH_NAME, bus=self.bus) |
| 4472 | + # bypass the parent class __init__ as it has the path hardcoded |
| 4473 | + # and we can't use '/' as the path, as we are already using it |
| 4474 | + # for syncdaemon. pylint: disable-msg=W0233,W0231 |
| 4475 | + dbus.service.Object.__init__(self, object_path="/oauthdesktop", |
| 4476 | + bus_name=self.busName) |
| 4477 | + self.processor = FakeLoginProcessor(self) |
| 4478 | + self.currently_authing = False |
| 4479 | + |
| 4480 | + def shutdown(self): |
| 4481 | + """Shutdown and remove any trace from the bus""" |
| 4482 | + self.busName.get_bus().release_name(self.busName.get_name()) |
| 4483 | + self.remove_from_connection() |
| 4484 | + |
| 4485 | + |
| 4486 | +class Listener(object): |
| 4487 | + """Helper class to gather events.""" |
| 4488 | + |
| 4489 | + def __init__(self): |
| 4490 | + self.events = [] |
| 4491 | + |
| 4492 | + def handle_default(self, event_name, *args, **kwargs): |
| 4493 | + """Keep record of every event.""" |
| 4494 | + self.events.append((event_name, args, kwargs)) |
| 4495 | + |
| 4496 | + |
| 4497 | +def noop(*args, **kwargs): |
| 4498 | + """No op.""" |
| 4499 | + |
| 4500 | + |
| 4501 | +class DummyClass(object): |
| 4502 | + """Dummy class, does nothing.""" |
| 4503 | + |
| 4504 | + def __getattribute__(self, name): |
| 4505 | + """Any attribute is a no-op.""" |
| 4506 | + return noop |
| 4507 | + |
| 4508 | |
| 4509 | === modified file 'contrib/testing/testcase.pyc' |
| 4510 | Binary files contrib/testing/testcase.pyc 2009-12-07 17:35:00 +0000 and contrib/testing/testcase.pyc 2010-02-18 00:10:25 +0000 differ |
| 4511 | === modified file 'data/Makefile.am' |
| 4512 | --- data/Makefile.am 2009-09-28 18:15:00 +0000 |
| 4513 | +++ data/Makefile.am 2010-02-18 00:10:25 +0000 |
| 4514 | @@ -6,17 +6,29 @@ |
| 4515 | crashdb_DATA = ubuntuone-client-crashdb.conf |
| 4516 | |
| 4517 | configdir = $(sysconfdir)/xdg/ubuntuone |
| 4518 | -config_DATA = oauth_urls syncdaemon.conf |
| 4519 | +config_in_files = logging.conf.in |
| 4520 | +config_DATA = oauth_urls syncdaemon.conf $(config_in_files:.conf.in=.conf) |
| 4521 | |
| 4522 | oauthdir = $(configdir)/oauth_registration.d |
| 4523 | oauth_DATA = oauth_registration.d/ubuntuone |
| 4524 | |
| 4525 | +memenudir = $(datadir)/indicators/me |
| 4526 | +memenu_in_files = ubuntuone.menu.in |
| 4527 | +memenu_DATA = $(memenu_in_files:.menu.in=.menu) |
| 4528 | + |
| 4529 | +%.menu: %.menu.in |
| 4530 | + @sed -e "s|\@DATADIR\@|$(datadir)|" $< > $@ |
| 4531 | + |
| 4532 | desktopdir = $(datadir)/applications |
| 4533 | -desktop_in_files = ubuntuone-client-applet.desktop.in |
| 4534 | +desktop_in_files = ubuntuone-preferences.desktop.in |
| 4535 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
| 4536 | |
| 4537 | @INTLTOOL_DESKTOP_RULE@ |
| 4538 | |
| 4539 | +%.conf: %.conf.in |
| 4540 | + @sed -e "s|\@LOG_LEVEL\@|$(LOG_LEVEL)|" \ |
| 4541 | + -e "s|\@LOG_FILE_SIZE\@|$(LOG_FILE_SIZE)|" $< > $@ |
| 4542 | + |
| 4543 | hicolordir = $(datadir)/icons/hicolor |
| 4544 | privateiconsdir = $(pkgdatadir)/icons/hicolor |
| 4545 | emblem_in_files = \ |
| 4546 | @@ -117,7 +129,9 @@ |
| 4547 | rm -rf icons |
| 4548 | |
| 4549 | EXTRA_DIST = \ |
| 4550 | - $(desktop_in_files) \ |
| 4551 | + $(config_in_files) \ |
| 4552 | + $(memenu_in_files) \ |
| 4553 | + $(desktop_in_files) \ |
| 4554 | $(service_in_files) \ |
| 4555 | $(emblem_in_files) \ |
| 4556 | $(icon_in_files) \ |
| 4557 | @@ -128,7 +142,8 @@ |
| 4558 | oauth_registration.d |
| 4559 | |
| 4560 | CLEANFILES = \ |
| 4561 | - $(desktop_DATA) \ |
| 4562 | + $(memenu_DATA) \ |
| 4563 | + $(desktop_DATA) \ |
| 4564 | $(service_DATA) \ |
| 4565 | $(emblem_files) \ |
| 4566 | hicolor |
| 4567 | |
| 4568 | === modified file 'data/Makefile.in' |
| 4569 | --- data/Makefile.in 2009-09-28 18:15:00 +0000 |
| 4570 | +++ data/Makefile.in 2010-02-18 00:10:25 +0000 |
| 4571 | @@ -1,4 +1,4 @@ |
| 4572 | -# Makefile.in generated by automake 1.11 from Makefile.am. |
| 4573 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. |
| 4574 | # @configure_input@ |
| 4575 | |
| 4576 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
| 4577 | @@ -72,9 +72,10 @@ |
| 4578 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' |
| 4579 | am__installdirs = "$(DESTDIR)$(apportdir)" "$(DESTDIR)$(configdir)" \ |
| 4580 | "$(DESTDIR)$(crashdbdir)" "$(DESTDIR)$(desktopdir)" \ |
| 4581 | - "$(DESTDIR)$(oauthdir)" "$(DESTDIR)$(servicedir)" |
| 4582 | + "$(DESTDIR)$(memenudir)" "$(DESTDIR)$(oauthdir)" \ |
| 4583 | + "$(DESTDIR)$(servicedir)" |
| 4584 | DATA = $(apport_DATA) $(config_DATA) $(crashdb_DATA) $(desktop_DATA) \ |
| 4585 | - $(oauth_DATA) $(service_DATA) |
| 4586 | + $(memenu_DATA) $(oauth_DATA) $(service_DATA) |
| 4587 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
| 4588 | ACLOCAL = @ACLOCAL@ |
| 4589 | ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ |
| 4590 | @@ -126,6 +127,8 @@ |
| 4591 | LIPO = @LIPO@ |
| 4592 | LNDIR = @LNDIR@ |
| 4593 | LN_S = @LN_S@ |
| 4594 | +LOG_FILE_SIZE = @LOG_FILE_SIZE@ |
| 4595 | +LOG_LEVEL = @LOG_LEVEL@ |
| 4596 | LTLIBOBJS = @LTLIBOBJS@ |
| 4597 | MAKEINFO = @MAKEINFO@ |
| 4598 | MKDIR_P = @MKDIR_P@ |
| 4599 | @@ -224,11 +227,15 @@ |
| 4600 | crashdbdir = $(sysconfdir)/apport/crashdb.conf.d |
| 4601 | crashdb_DATA = ubuntuone-client-crashdb.conf |
| 4602 | configdir = $(sysconfdir)/xdg/ubuntuone |
| 4603 | -config_DATA = oauth_urls syncdaemon.conf |
| 4604 | +config_in_files = logging.conf.in |
| 4605 | +config_DATA = oauth_urls syncdaemon.conf $(config_in_files:.conf.in=.conf) |
| 4606 | oauthdir = $(configdir)/oauth_registration.d |
| 4607 | oauth_DATA = oauth_registration.d/ubuntuone |
| 4608 | +memenudir = $(datadir)/indicators/me |
| 4609 | +memenu_in_files = ubuntuone.menu.in |
| 4610 | +memenu_DATA = $(memenu_in_files:.menu.in=.menu) |
| 4611 | desktopdir = $(datadir)/applications |
| 4612 | -desktop_in_files = ubuntuone-client-applet.desktop.in |
| 4613 | +desktop_in_files = ubuntuone-preferences.desktop.in |
| 4614 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
| 4615 | hicolordir = $(datadir)/icons/hicolor |
| 4616 | privateiconsdir = $(pkgdatadir)/icons/hicolor |
| 4617 | @@ -248,7 +255,9 @@ |
| 4618 | icon_cache = $(icon_in_files:.svg=.rendercache) |
| 4619 | icon_files = $(shell BUILDDIR="$(builddir)"; for i in `find $$BUILDDIR -name "*.rendercache"`; do cat $$i|sort|uniq; done) |
| 4620 | EXTRA_DIST = \ |
| 4621 | - $(desktop_in_files) \ |
| 4622 | + $(config_in_files) \ |
| 4623 | + $(memenu_in_files) \ |
| 4624 | + $(desktop_in_files) \ |
| 4625 | $(service_in_files) \ |
| 4626 | $(emblem_in_files) \ |
| 4627 | $(icon_in_files) \ |
| 4628 | @@ -259,7 +268,8 @@ |
| 4629 | oauth_registration.d |
| 4630 | |
| 4631 | CLEANFILES = \ |
| 4632 | - $(desktop_DATA) \ |
| 4633 | + $(memenu_DATA) \ |
| 4634 | + $(desktop_DATA) \ |
| 4635 | $(service_DATA) \ |
| 4636 | $(emblem_files) \ |
| 4637 | hicolor |
| 4638 | @@ -387,6 +397,26 @@ |
| 4639 | test -n "$$files" || exit 0; \ |
| 4640 | echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \ |
| 4641 | cd "$(DESTDIR)$(desktopdir)" && rm -f $$files |
| 4642 | +install-memenuDATA: $(memenu_DATA) |
| 4643 | + @$(NORMAL_INSTALL) |
| 4644 | + test -z "$(memenudir)" || $(MKDIR_P) "$(DESTDIR)$(memenudir)" |
| 4645 | + @list='$(memenu_DATA)'; test -n "$(memenudir)" || list=; \ |
| 4646 | + for p in $$list; do \ |
| 4647 | + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
| 4648 | + echo "$$d$$p"; \ |
| 4649 | + done | $(am__base_list) | \ |
| 4650 | + while read files; do \ |
| 4651 | + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(memenudir)'"; \ |
| 4652 | + $(INSTALL_DATA) $$files "$(DESTDIR)$(memenudir)" || exit $$?; \ |
| 4653 | + done |
| 4654 | + |
| 4655 | +uninstall-memenuDATA: |
| 4656 | + @$(NORMAL_UNINSTALL) |
| 4657 | + @list='$(memenu_DATA)'; test -n "$(memenudir)" || list=; \ |
| 4658 | + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
| 4659 | + test -n "$$files" || exit 0; \ |
| 4660 | + echo " ( cd '$(DESTDIR)$(memenudir)' && rm -f" $$files ")"; \ |
| 4661 | + cd "$(DESTDIR)$(memenudir)" && rm -f $$files |
| 4662 | install-oauthDATA: $(oauth_DATA) |
| 4663 | @$(NORMAL_INSTALL) |
| 4664 | test -z "$(oauthdir)" || $(MKDIR_P) "$(DESTDIR)$(oauthdir)" |
| 4665 | @@ -471,7 +501,7 @@ |
| 4666 | check: check-am |
| 4667 | all-am: Makefile $(DATA) |
| 4668 | installdirs: |
| 4669 | - for dir in "$(DESTDIR)$(apportdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(crashdbdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(oauthdir)" "$(DESTDIR)$(servicedir)"; do \ |
| 4670 | + for dir in "$(DESTDIR)$(apportdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(crashdbdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(memenudir)" "$(DESTDIR)$(oauthdir)" "$(DESTDIR)$(servicedir)"; do \ |
| 4671 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
| 4672 | done |
| 4673 | install: install-am |
| 4674 | @@ -523,7 +553,7 @@ |
| 4675 | |
| 4676 | install-data-am: install-apportDATA install-configDATA \ |
| 4677 | install-crashdbDATA install-data-local install-desktopDATA \ |
| 4678 | - install-oauthDATA install-serviceDATA |
| 4679 | + install-memenuDATA install-oauthDATA install-serviceDATA |
| 4680 | |
| 4681 | install-dvi: install-dvi-am |
| 4682 | |
| 4683 | @@ -570,7 +600,7 @@ |
| 4684 | |
| 4685 | uninstall-am: uninstall-apportDATA uninstall-configDATA \ |
| 4686 | uninstall-crashdbDATA uninstall-desktopDATA uninstall-local \ |
| 4687 | - uninstall-oauthDATA uninstall-serviceDATA |
| 4688 | + uninstall-memenuDATA uninstall-oauthDATA uninstall-serviceDATA |
| 4689 | |
| 4690 | .MAKE: install-am install-strip |
| 4691 | |
| 4692 | @@ -582,19 +612,26 @@ |
| 4693 | install-data-local install-desktopDATA install-dvi \ |
| 4694 | install-dvi-am install-exec install-exec-am install-html \ |
| 4695 | install-html-am install-info install-info-am install-man \ |
| 4696 | - install-oauthDATA install-pdf install-pdf-am install-ps \ |
| 4697 | - install-ps-am install-serviceDATA install-strip installcheck \ |
| 4698 | - installcheck-am installdirs maintainer-clean \ |
| 4699 | - maintainer-clean-generic maintainer-clean-local mostlyclean \ |
| 4700 | - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ |
| 4701 | - uninstall uninstall-am uninstall-apportDATA \ |
| 4702 | - uninstall-configDATA uninstall-crashdbDATA \ |
| 4703 | - uninstall-desktopDATA uninstall-local uninstall-oauthDATA \ |
| 4704 | - uninstall-serviceDATA |
| 4705 | - |
| 4706 | + install-memenuDATA install-oauthDATA install-pdf \ |
| 4707 | + install-pdf-am install-ps install-ps-am install-serviceDATA \ |
| 4708 | + install-strip installcheck installcheck-am installdirs \ |
| 4709 | + maintainer-clean maintainer-clean-generic \ |
| 4710 | + maintainer-clean-local mostlyclean mostlyclean-generic \ |
| 4711 | + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ |
| 4712 | + uninstall-apportDATA uninstall-configDATA \ |
| 4713 | + uninstall-crashdbDATA uninstall-desktopDATA uninstall-local \ |
| 4714 | + uninstall-memenuDATA uninstall-oauthDATA uninstall-serviceDATA |
| 4715 | + |
| 4716 | + |
| 4717 | +%.menu: %.menu.in |
| 4718 | + @sed -e "s|\@DATADIR\@|$(datadir)|" $< > $@ |
| 4719 | |
| 4720 | @INTLTOOL_DESKTOP_RULE@ |
| 4721 | |
| 4722 | +%.conf: %.conf.in |
| 4723 | + @sed -e "s|\@LOG_LEVEL\@|$(LOG_LEVEL)|" \ |
| 4724 | + -e "s|\@LOG_FILE_SIZE\@|$(LOG_FILE_SIZE)|" $< > $@ |
| 4725 | + |
| 4726 | %.icon: %.icon.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache |
| 4727 | |
| 4728 | %.service: %.service.in |
| 4729 | |
| 4730 | === modified file 'data/com.ubuntuone.Authentication.service.in' |
| 4731 | --- data/com.ubuntuone.Authentication.service.in 2009-06-30 12:00:00 +0000 |
| 4732 | +++ data/com.ubuntuone.Authentication.service.in 2010-02-18 00:10:25 +0000 |
| 4733 | @@ -1,3 +1,3 @@ |
| 4734 | [D-BUS Service] |
| 4735 | Name=com.ubuntuone.Authentication |
| 4736 | -Exec=@bindir@/ubuntuone-client-applet |
| 4737 | +Exec=@libexecdir@/ubuntuone-login |
| 4738 | |
| 4739 | === removed file 'data/icons/16x16/apps/ubuntuone-client.png' |
| 4740 | Binary files data/icons/16x16/apps/ubuntuone-client.png 2009-09-28 18:15:00 +0000 and data/icons/16x16/apps/ubuntuone-client.png 1970-01-01 00:00:00 +0000 differ |
| 4741 | === added file 'data/icons/16x16/apps/ubuntuone.png' |
| 4742 | Binary files data/icons/16x16/apps/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/icons/16x16/apps/ubuntuone.png 2010-02-18 00:10:25 +0000 differ |
| 4743 | === removed file 'data/icons/16x16/status/ubuntuone-client-offline.png' |
| 4744 | Binary files data/icons/16x16/status/ubuntuone-client-offline.png 2009-09-28 18:15:00 +0000 and data/icons/16x16/status/ubuntuone-client-offline.png 1970-01-01 00:00:00 +0000 differ |
| 4745 | === removed file 'data/icons/24x24/apps/ubuntuone-client.png' |
| 4746 | Binary files data/icons/24x24/apps/ubuntuone-client.png 2009-09-28 18:15:00 +0000 and data/icons/24x24/apps/ubuntuone-client.png 1970-01-01 00:00:00 +0000 differ |
| 4747 | === added file 'data/icons/24x24/apps/ubuntuone.png' |
| 4748 | Binary files data/icons/24x24/apps/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/icons/24x24/apps/ubuntuone.png 2010-02-18 00:10:25 +0000 differ |
| 4749 | === removed file 'data/icons/24x24/status/ubuntuone-client-offline.png' |
| 4750 | Binary files data/icons/24x24/status/ubuntuone-client-offline.png 2009-09-28 18:15:00 +0000 and data/icons/24x24/status/ubuntuone-client-offline.png 1970-01-01 00:00:00 +0000 differ |
| 4751 | === removed file 'data/icons/32x32/apps/ubuntuone-client.png' |
| 4752 | Binary files data/icons/32x32/apps/ubuntuone-client.png 2009-09-28 18:15:00 +0000 and data/icons/32x32/apps/ubuntuone-client.png 1970-01-01 00:00:00 +0000 differ |
| 4753 | === added file 'data/icons/32x32/apps/ubuntuone.png' |
| 4754 | Binary files data/icons/32x32/apps/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/icons/32x32/apps/ubuntuone.png 2010-02-18 00:10:25 +0000 differ |
| 4755 | === removed file 'data/icons/32x32/status/ubuntuone-client-offline.png' |
| 4756 | Binary files data/icons/32x32/status/ubuntuone-client-offline.png 2009-09-28 18:15:00 +0000 and data/icons/32x32/status/ubuntuone-client-offline.png 1970-01-01 00:00:00 +0000 differ |
| 4757 | === removed file 'data/icons/48x48/apps/ubuntuone-client.png' |
| 4758 | Binary files data/icons/48x48/apps/ubuntuone-client.png 2009-09-28 18:15:00 +0000 and data/icons/48x48/apps/ubuntuone-client.png 1970-01-01 00:00:00 +0000 differ |
| 4759 | === added file 'data/icons/48x48/apps/ubuntuone.png' |
| 4760 | Binary files data/icons/48x48/apps/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/icons/48x48/apps/ubuntuone.png 2010-02-18 00:10:25 +0000 differ |
| 4761 | === removed file 'data/icons/48x48/status/ubuntuone-client-offline.png' |
| 4762 | Binary files data/icons/48x48/status/ubuntuone-client-offline.png 2009-09-28 18:15:00 +0000 and data/icons/48x48/status/ubuntuone-client-offline.png 1970-01-01 00:00:00 +0000 differ |
| 4763 | === added file 'data/logging.conf' |
| 4764 | --- data/logging.conf 1970-01-01 00:00:00 +0000 |
| 4765 | +++ data/logging.conf 2010-02-18 00:10:25 +0000 |
| 4766 | @@ -0,0 +1,13 @@ |
| 4767 | +[logging] |
| 4768 | +level.default = DEBUG |
| 4769 | +level.parser = log_level |
| 4770 | +level.help = Set the log level (TRACE, DEBUG, INFO, WARNING, ERROR, NOTE |
| 4771 | + CRITICAL, FATAL) |
| 4772 | + |
| 4773 | +file_size.default = 10485760 |
| 4774 | +file_size.parser = int |
| 4775 | +file_size.help = max file size (the file will be rotated) |
| 4776 | + |
| 4777 | +backup_count.default = 5 |
| 4778 | +backup_count.parser = int |
| 4779 | +backup_count.help = number of rotated log files to keep around. |
| 4780 | |
| 4781 | === added file 'data/logging.conf.in' |
| 4782 | --- data/logging.conf.in 1970-01-01 00:00:00 +0000 |
| 4783 | +++ data/logging.conf.in 2010-02-18 00:10:25 +0000 |
| 4784 | @@ -0,0 +1,13 @@ |
| 4785 | +[logging] |
| 4786 | +level.default = @LOG_LEVEL@ |
| 4787 | +level.parser = log_level |
| 4788 | +level.help = Set the log level (TRACE, DEBUG, INFO, WARNING, ERROR, NOTE |
| 4789 | + CRITICAL, FATAL) |
| 4790 | + |
| 4791 | +file_size.default = @LOG_FILE_SIZE@ |
| 4792 | +file_size.parser = int |
| 4793 | +file_size.help = max file size (the file will be rotated) |
| 4794 | + |
| 4795 | +backup_count.default = 5 |
| 4796 | +backup_count.parser = int |
| 4797 | +backup_count.help = number of rotated log files to keep around. |
| 4798 | |
| 4799 | === modified file 'data/syncdaemon.conf' |
| 4800 | --- data/syncdaemon.conf 2009-09-28 18:15:00 +0000 |
| 4801 | +++ data/syncdaemon.conf 2010-02-18 00:10:25 +0000 |
| 4802 | @@ -47,18 +47,13 @@ |
| 4803 | im_ok_with_being_root_pretty_please_let_me_be_root.help = Allows the syncdaemon |
| 4804 | to run as root. Please don't use this option. |
| 4805 | |
| 4806 | -log_level.default = INFO |
| 4807 | -log_level.parser = log_level |
| 4808 | -log_level.help = Set the log level (TRACE, DEBUG, INFO, WARNING, ERROR, NOTE |
| 4809 | - CRITICAL, FATAL) |
| 4810 | - |
| 4811 | send_events_over_dbus.default = False |
| 4812 | send_events_over_dbus.parser = bool |
| 4813 | send_events_over_dbus.action = store_true |
| 4814 | send_events_over_dbus.help = Enable sending "Event" singals for each internal |
| 4815 | event |
| 4816 | |
| 4817 | -handshake_timeout.default = 30 |
| 4818 | +handshake_timeout.default = 50 |
| 4819 | handshake_timeout.parser = int |
| 4820 | handshake_timeout.help = The timeout for the connection and related states, in seconds |
| 4821 | |
| 4822 | @@ -67,18 +62,23 @@ |
| 4823 | max_handshake_timeouts.help = The number of consecutive handshake timeouts |
| 4824 | before we give up |
| 4825 | |
| 4826 | +udf_autosubscribe.default = True |
| 4827 | +udf_autosubscribe.parser = bool |
| 4828 | +udf_autosubscribe.help = Autosubsribe to new User Defined Folders, 'on' by default. |
| 4829 | + (accepted values: 1/0, on/off, true/false and yes/no) |
| 4830 | + |
| 4831 | [bandwidth_throttling] |
| 4832 | on.default = False |
| 4833 | on.parser = bool |
| 4834 | on.action = store_true |
| 4835 | on.help = Enable bandwidth throttling |
| 4836 | |
| 4837 | -read_limit.default = -1 |
| 4838 | +read_limit.default = 2097152 |
| 4839 | read_limit.parser = throttling_limit |
| 4840 | read_limit.metavar = DOWNLOAD_LIMIT |
| 4841 | read_limit.help = Set the download limit (bytes/sec). |
| 4842 | |
| 4843 | -write_limit.default = -1 |
| 4844 | +write_limit.default = 2097152 |
| 4845 | write_limit.parser = throttling_limit |
| 4846 | write_limit.metavar = UPLOAD_LIMIT |
| 4847 | write_limit.help = Set the upload limit (bytes/sec). |
| 4848 | |
| 4849 | === removed file 'data/ubuntuone-client-applet.desktop.in' |
| 4850 | --- data/ubuntuone-client-applet.desktop.in 2009-08-11 16:45:00 +0000 |
| 4851 | +++ data/ubuntuone-client-applet.desktop.in 1970-01-01 00:00:00 +0000 |
| 4852 | @@ -1,9 +0,0 @@ |
| 4853 | -[Desktop Entry] |
| 4854 | -Name=Ubuntu One |
| 4855 | -_Comment=Access and manage your Ubuntu One account |
| 4856 | -Exec=ubuntuone-client-applet |
| 4857 | -Icon=ubuntuone-client |
| 4858 | -Terminal=false |
| 4859 | -Type=Application |
| 4860 | -Categories=GTK;Network;TrayIcon; |
| 4861 | -X-Ubuntu-Gettext-Domain=ubuntuone-client |
| 4862 | |
| 4863 | === modified file 'data/ubuntuone-icons.rendercache' |
| 4864 | --- data/ubuntuone-icons.rendercache 2009-09-28 18:15:00 +0000 |
| 4865 | +++ data/ubuntuone-icons.rendercache 2010-02-18 00:10:25 +0000 |
| 4866 | @@ -1,6 +1,5 @@ |
| 4867 | status/ubuntuone-client-error.png |
| 4868 | -status/ubuntuone-client-offline.png |
| 4869 | emblems/emblem-ubuntuone-unsynchronized.png |
| 4870 | status/ubuntuone-client-updating.png |
| 4871 | emblems/emblem-ubuntuone-updating.png |
| 4872 | -apps/ubuntuone-client.png |
| 4873 | +apps/ubuntuone.png |
| 4874 | |
| 4875 | === modified file 'data/ubuntuone-icons.svg' |
| 4876 | --- data/ubuntuone-icons.svg 2009-09-28 18:15:00 +0000 |
| 4877 | +++ data/ubuntuone-icons.svg 2010-02-18 00:10:25 +0000 |
| 4878 | @@ -17,7 +17,7 @@ |
| 4879 | height="600" |
| 4880 | id="svg11300" |
| 4881 | sodipodi:version="0.32" |
| 4882 | - inkscape:version="0.47pre1 r21720" |
| 4883 | + inkscape:version="0.47 r22583" |
| 4884 | sodipodi:docname="ubuntuone-icons.svg" |
| 4885 | inkscape:output_extension="org.inkscape.output.svg.inkscape" |
| 4886 | version="1.0" |
| 4887 | @@ -1522,16 +1522,6 @@ |
| 4888 | inkscape:vp_x="0 : 0.5 : 1" |
| 4889 | sodipodi:type="inkscape:persp3d" /> |
| 4890 | <linearGradient |
| 4891 | - inkscape:collect="always" |
| 4892 | - xlink:href="#XMLID_63_" |
| 4893 | - id="linearGradient6446" |
| 4894 | - gradientUnits="userSpaceOnUse" |
| 4895 | - gradientTransform="matrix(2.4956521,0,0,2.4956521,-223.97574,-53.226089)" |
| 4896 | - x1="113.0654" |
| 4897 | - y1="100.6621" |
| 4898 | - x2="113.0654" |
| 4899 | - y2="94.512703" /> |
| 4900 | - <linearGradient |
| 4901 | x1="113.0654" |
| 4902 | y1="100.6621" |
| 4903 | x2="113.0654" |
| 4904 | @@ -1552,17 +1542,6 @@ |
| 4905 | id="stop500" /> |
| 4906 | </linearGradient> |
| 4907 | <radialGradient |
| 4908 | - inkscape:collect="always" |
| 4909 | - xlink:href="#XMLID_64_" |
| 4910 | - id="radialGradient6448" |
| 4911 | - gradientUnits="userSpaceOnUse" |
| 4912 | - gradientTransform="matrix(2.4956521,0,0,2.4956521,-223.97574,-53.226089)" |
| 4913 | - cx="113.0654" |
| 4914 | - cy="97.587898" |
| 4915 | - fx="113.667" |
| 4916 | - fy="98" |
| 4917 | - r="2.5631001" /> |
| 4918 | - <radialGradient |
| 4919 | cx="113.0654" |
| 4920 | cy="97.587898" |
| 4921 | r="2.5631001" |
| 4922 | @@ -1588,16 +1567,6 @@ |
| 4923 | id="stop511" /> |
| 4924 | </radialGradient> |
| 4925 | <linearGradient |
| 4926 | - inkscape:collect="always" |
| 4927 | - xlink:href="#linearGradient4120" |
| 4928 | - id="linearGradient6430" |
| 4929 | - gradientUnits="userSpaceOnUse" |
| 4930 | - gradientTransform="matrix(0.3024372,0,0,0.3560377,303.56427,209.43456)" |
| 4931 | - x1="7.6046205" |
| 4932 | - y1="28.481176" |
| 4933 | - x2="36.183067" |
| 4934 | - y2="40.943935" /> |
| 4935 | - <linearGradient |
| 4936 | id="linearGradient4120"> |
| 4937 | <stop |
| 4938 | style="stop-color:#555753;stop-opacity:1" |
| 4939 | @@ -1608,17 +1577,6 @@ |
| 4940 | offset="1.0000000" |
| 4941 | id="stop4124" /> |
| 4942 | </linearGradient> |
| 4943 | - <radialGradient |
| 4944 | - inkscape:collect="always" |
| 4945 | - xlink:href="#linearGradient4244" |
| 4946 | - id="radialGradient6427" |
| 4947 | - gradientUnits="userSpaceOnUse" |
| 4948 | - gradientTransform="matrix(0.4569434,0.4167071,-0.2525086,0.6234641,302.55498,203.55522)" |
| 4949 | - cx="15.571491" |
| 4950 | - cy="2.958519" |
| 4951 | - fx="15.571491" |
| 4952 | - fy="2.958519" |
| 4953 | - r="20.935818" /> |
| 4954 | <linearGradient |
| 4955 | id="linearGradient4244"> |
| 4956 | <stop |
| 4957 | @@ -1634,39 +1592,6 @@ |
| 4958 | offset="1.0000000" |
| 4959 | id="stop4248" /> |
| 4960 | </linearGradient> |
| 4961 | - <radialGradient |
| 4962 | - inkscape:collect="always" |
| 4963 | - xlink:href="#linearGradient7497" |
| 4964 | - id="radialGradient6424" |
| 4965 | - gradientUnits="userSpaceOnUse" |
| 4966 | - gradientTransform="matrix(0.05803462,0.01454178,-0.00385459,0.0639583,303.56081,200.28873)" |
| 4967 | - cx="150.17931" |
| 4968 | - cy="301.80243" |
| 4969 | - fx="150.17931" |
| 4970 | - fy="301.80243" |
| 4971 | - r="106.18474" /> |
| 4972 | - <linearGradient |
| 4973 | - inkscape:collect="always" |
| 4974 | - id="linearGradient7497"> |
| 4975 | - <stop |
| 4976 | - style="stop-color:#ffffff;stop-opacity:1;" |
| 4977 | - offset="0" |
| 4978 | - id="stop7499" /> |
| 4979 | - <stop |
| 4980 | - style="stop-color:#ffffff;stop-opacity:0;" |
| 4981 | - offset="1" |
| 4982 | - id="stop7501" /> |
| 4983 | - </linearGradient> |
| 4984 | - <linearGradient |
| 4985 | - inkscape:collect="always" |
| 4986 | - xlink:href="#linearGradient7243" |
| 4987 | - id="linearGradient6442" |
| 4988 | - gradientUnits="userSpaceOnUse" |
| 4989 | - gradientTransform="matrix(5.0962816,0,0,5.0962816,25.377261,30.286921)" |
| 4990 | - x1="7.0625" |
| 4991 | - y1="35.28125" |
| 4992 | - x2="24.6875" |
| 4993 | - y2="35.28125" /> |
| 4994 | <linearGradient |
| 4995 | id="linearGradient7243"> |
| 4996 | <stop |
| 4997 | @@ -1679,39 +1604,6 @@ |
| 4998 | style="stop-color:#bbbbbb;stop-opacity:0.0000000;" /> |
| 4999 | </linearGradient> |
| 5000 | <linearGradient |
The diff has been truncated for viewing.

