Merge lp:~dobey/ubuntuone-client/update-13-10 into lp:ubuntuone-client/stable-13-10

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 1396
Merged at revision: 1396
Proposed branch: lp:~dobey/ubuntuone-client/update-13-10
Merge into: lp:ubuntuone-client/stable-13-10
Diff against target: 9736 lines (+312/-9038)
61 files modified
.bzrignore (+2/-73)
Makefile.am (+0/-154)
VERSION (+0/-1)
autogen.sh (+0/-21)
configure.ac (+0/-186)
contrib/check-reactor-import (+3/-0)
contrib/draw-fsm (+2/-1)
data/Makefile.am (+0/-48)
docs/Makefile.am (+0/-7)
docs/reference/Makefile.am (+0/-62)
docs/reference/libsyncdaemon-docs.sgml (+0/-48)
libsyncdaemon/Makefile.am (+0/-114)
libsyncdaemon/libsyncdaemon-1.0.pc.in (+0/-11)
libsyncdaemon/libsyncdaemon.h (+0/-50)
libsyncdaemon/syncdaemon-authentication.c (+0/-298)
libsyncdaemon/syncdaemon-authentication.h (+0/-75)
libsyncdaemon/syncdaemon-config-interface.c (+0/-276)
libsyncdaemon/syncdaemon-config-interface.h (+0/-83)
libsyncdaemon/syncdaemon-credentials.c (+0/-215)
libsyncdaemon/syncdaemon-credentials.h (+0/-75)
libsyncdaemon/syncdaemon-daemon.c (+0/-1477)
libsyncdaemon/syncdaemon-daemon.h (+0/-172)
libsyncdaemon/syncdaemon-events-interface.c (+0/-130)
libsyncdaemon/syncdaemon-events-interface.h (+0/-71)
libsyncdaemon/syncdaemon-file-info.c (+0/-236)
libsyncdaemon/syncdaemon-file-info.h (+0/-78)
libsyncdaemon/syncdaemon-filesystem-interface.c (+0/-190)
libsyncdaemon/syncdaemon-filesystem-interface.h (+0/-84)
libsyncdaemon/syncdaemon-folder-info.c (+0/-176)
libsyncdaemon/syncdaemon-folder-info.h (+0/-73)
libsyncdaemon/syncdaemon-folders-interface.c (+0/-494)
libsyncdaemon/syncdaemon-folders-interface.h (+0/-76)
libsyncdaemon/syncdaemon-interface.c (+0/-274)
libsyncdaemon/syncdaemon-interface.h (+0/-70)
libsyncdaemon/syncdaemon-marshal.list (+0/-5)
libsyncdaemon/syncdaemon-metadata.c (+0/-284)
libsyncdaemon/syncdaemon-metadata.h (+0/-79)
libsyncdaemon/syncdaemon-publicfiles-interface.c (+0/-259)
libsyncdaemon/syncdaemon-publicfiles-interface.h (+0/-73)
libsyncdaemon/syncdaemon-share-info.c (+0/-357)
libsyncdaemon/syncdaemon-share-info.h (+0/-91)
libsyncdaemon/syncdaemon-shares-interface.c (+0/-497)
libsyncdaemon/syncdaemon-shares-interface.h (+0/-79)
libsyncdaemon/syncdaemon-status-info.c (+0/-259)
libsyncdaemon/syncdaemon-status-info.h (+0/-80)
libsyncdaemon/syncdaemon-status-interface.c (+0/-448)
libsyncdaemon/syncdaemon-status-interface.h (+0/-71)
libsyncdaemon/syncdaemon-transfer-info.c (+0/-247)
libsyncdaemon/syncdaemon-transfer-info.h (+0/-78)
libsyncdaemon/test-libsyncdaemon.c (+0/-536)
libsyncdaemon/utils.c (+0/-60)
libsyncdaemon/utils.h (+0/-48)
po/POTFILES.in (+0/-1)
run-tests (+34/-9)
run-tests.bat (+9/-4)
setup.cfg (+2/-0)
setup.py (+259/-0)
ubuntuone-client.pth (+1/-0)
ubuntuone/clientdefs.py.in (+0/-8)
windows/clientdefs.py (+0/-53)
windows/logging.conf (+0/-13)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/update-13-10
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+174032@code.launchpad.net

Commit message

[Rodney Dawes]

    Drop libsyncdaemon from tree and convert to pure Python project.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (3.6 MiB)

The attempt to merge lp:~dobey/ubuntuone-client/update-13-10 into lp:ubuntuone-client/stable-13-10 failed. Below is the output from the failed tests.

*** Running test suite for tests ***
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/contrib
creating build/lib.linux-x86_64-2.7/contrib/testing
copying contrib/testing/testcase.py -> build/lib.linux-x86_64-2.7/contrib/testing
copying contrib/testing/__init__.py -> build/lib.linux-x86_64-2.7/contrib/testing
creating build/lib.linux-x86_64-2.7/ubuntuone
creating build/lib.linux-x86_64-2.7/ubuntuone/platform
creating build/lib.linux-x86_64-2.7/ubuntuone/platform/credentials
copying ubuntuone/platform/credentials/ipc_service.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/credentials
copying ubuntuone/platform/credentials/dbus_service.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/credentials
copying ubuntuone/platform/credentials/__init__.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/credentials
creating build/lib.linux-x86_64-2.7/ubuntuone/platform/filesystem_notifications
creating build/lib.linux-x86_64-2.7/ubuntuone/platform/filesystem_notifications/notify_processor
copying ubuntuone/platform/filesystem_notifications/notify_processor/linux.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/filesystem_notifications/notify_processor
copying ubuntuone/platform/filesystem_notifications/notify_processor/common.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/filesystem_notifications/notify_processor
copying ubuntuone/platform/filesystem_notifications/notify_processor/__init__.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/filesystem_notifications/notify_processor
creating build/lib.linux-x86_64-2.7/ubuntuone/proxy
copying ubuntuone/proxy/common.py -> build/lib.linux-x86_64-2.7/ubuntuone/proxy
copying ubuntuone/proxy/tunnel_client.py -> build/lib.linux-x86_64-2.7/ubuntuone/proxy
copying ubuntuone/proxy/tunnel_server.py -> build/lib.linux-x86_64-2.7/ubuntuone/proxy
copying ubuntuone/proxy/logger.py -> build/lib.linux-x86_64-2.7/ubuntuone/proxy
copying ubuntuone/proxy/__init__.py -> build/lib.linux-x86_64-2.7/ubuntuone/proxy
creating build/lib.linux-x86_64-2.7/ubuntuone/status
copying ubuntuone/status/notification.py -> build/lib.linux-x86_64-2.7/ubuntuone/status
copying ubuntuone/status/logger.py -> build/lib.linux-x86_64-2.7/ubuntuone/status
copying ubuntuone/status/aggregator.py -> build/lib.linux-x86_64-2.7/ubuntuone/status
copying ubuntuone/status/__init__.py -> build/lib.linux-x86_64-2.7/ubuntuone/status
creating build/lib.linux-x86_64-2.7/ubuntuone/platform/notification
copying ubuntuone/platform/notification/linux.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/notification
copying ubuntuone/platform/notification/windows.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/notification
copying ubuntuone/platform/notification/__init__.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/notification
creating build/lib.linux-x86_64-2.7/ubuntuone/platform/tools
copying ubuntuone/platform/tools/linux.py -> build/lib.linux-x86_64-2.7/ubuntuone/platform/tools
copying ubuntuone/platform/tools/__init__.py -...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-02-09 19:54:46 +0000
3+++ .bzrignore 2013-07-10 19:40:32 +0000
4@@ -1,86 +1,15 @@
5-Makefile
6-Makefile.in
7-Makefile.in.in
8 POTFILES
9-.deps
10-.libs
11-autom4te.cache
12 build
13 dist
14-m4
15-tmp
16 _trial_temp
17-aclocal.m4
18-config.guess
19-config.h
20-config.h.in
21-config.log
22-config.status
23-config.sub
24-configure
25-depcomp
26-install-sh
27-intltool-*
28-libtool
29-ltmain.sh
30-missing
31-setup.py
32-stamp-*
33+*.egg-info
34+
35 *.desktop
36 *.gmo
37-*.icon
38-*.la
39-*.lo
40-*.menu
41 *_pb2.py
42 *.pot
43 *.pyc
44-*.rendercache
45 *.service
46-.intltool-merge-cache
47-gtk-doc.make
48
49-ubuntuone-client-*.tar.*
50-hicolor
51-icons
52-storageprotocol
53 clientdefs.py
54-docs/syncdaemon_dbus_api.txt
55-docs/reference/html*
56-docs/reference/libsyncdaemon-decl-list.txt
57-docs/reference/libsyncdaemon-decl-list.txt.bak
58-docs/reference/libsyncdaemon-decl.txt
59-docs/reference/libsyncdaemon-decl.txt.bak
60-docs/reference/libsyncdaemon-overrides.txt
61-docs/reference/libsyncdaemon-sections.txt
62-docs/reference/libsyncdaemon-undeclared.txt
63-docs/reference/libsyncdaemon-undocumented.txt
64-docs/reference/libsyncdaemon-unused.txt
65-docs/reference/libsyncdaemon.args
66-docs/reference/libsyncdaemon.hierarchy
67-docs/reference/libsyncdaemon.interfaces
68-docs/reference/libsyncdaemon.prerequisites
69-docs/reference/libsyncdaemon.signals
70-docs/reference/libsyncdaemon.types
71-docs/reference/*.stamp
72-docs/reference/tmpl
73-docs/reference/xml*
74 logging.conf
75-ubuntuone-marshallers.[ch]
76-
77-nautilus/test-contacts-picker
78-nautilus/test-highlight
79-
80-libsyncdaemon/syncdaemon-marshal.[ch]
81-libsyncdaemon/test-libsyncdaemon
82-libsyncdaemon/test-libsyncdaemon-vapi
83-libsyncdaemon/test-libsyncdaemon-vapi.c
84-libsyncdaemon/libsyncdaemon-1.0.pc
85-libsyncdaemon/Syncdaemon-1.0.gir
86-libsyncdaemon/Syncdaemon-1.0.typelib
87-libsyncdaemon/libsyncdaemon-1.0.deps
88-libsyncdaemon/libsyncdaemon-1.0.vapi
89-*_vala.stamp
90-
91-ubuntuone.gnome-settings-plugin
92-test-gsd-ubuntuone
93
94=== removed file 'Makefile.am'
95--- Makefile.am 2013-05-29 13:45:19 +0000
96+++ Makefile.am 1970-01-01 00:00:00 +0000
97@@ -1,154 +0,0 @@
98-SUBDIRS = data libsyncdaemon po docs
99-
100-# Shut libtoolize up
101-ACLOCAL_AMFLAGS = -I m4
102-
103-# PYTHONPATH for local Python scripts
104-PYTHONPATH="$(SSO_PATH):$(USP_PATH):$(top_builddir):$(top_srcdir)"
105-
106-# Python packages we want to install
107-pythonpkgdir = $(pythondir)/$(PACKAGE)
108-pypackages = \
109- ubuntuone \
110- $(shell SRCDIR="ubuntuone"; for i in `find $$SRCDIR -type d`; do DIRNAME=`basename $$i`; if [ "x$$DIRNAME" != "xtest" ]; then printf "$$i "; fi; done)
111-
112-# Install our scripts and extra data here
113-bin_SCRIPTS = \
114- bin/ubuntuone-launch \
115- bin/u1sdtool
116-
117-libexec_SCRIPTS = \
118- bin/ubuntuone-syncdaemon \
119- bin/ubuntuone-proxy-tunnel \
120- bin/ubuntuone-login
121-
122-clientdefsdir = $(pythonpkgdir)/ubuntuone
123-clientdefs_in_files = ubuntuone/clientdefs.py.in
124-clientdefs_DATA = $(clientdefs_in_files:.py.in=.py)
125-
126-# Don't end up pulling in storage-protocol source as well
127-pyfiles = $(shell SRCDIR="$(top_srcdir)/ubuntuone"; for i in `find $$SRCDIR -type f -name "*.py"`; do if [ ! -f $$i.in ]; then printf "$$i "; fi; done)
128-
129-$(clientdefs_DATA): $(clientdefs_in_files) ubuntuone
130- sed -e 's|\@localedir\@|$(localedir)|g' \
131- -e 's|\@libexecdir\@|$(libexecdir)|g' \
132- -e 's|\@GETTEXT_PACKAGE\@|$(GETTEXT_PACKAGE)|g' \
133- -e 's|\@SSO_APP_NAME\@|$(SSO_APP_NAME)|g' \
134- -e 's|\@SSO_TC_URL\@|$(SSO_TC_URL)|g' \
135- -e 's|\@SSO_PING_URL\@|$(SSO_PING_URL)|g' \
136- -e 's|\@VERSION\@|$(VERSION)|g' < $< > $@
137-
138-logging.conf: data/logging.conf.in Makefile
139- $(MAKE) -C data logging.conf
140-
141-lint: $(clientdefs_DATA) Makefile
142- PYTHONPATH="$(PYTHONPATH)" SRCDIR="$(srcdir)" USE_PYFLAKES="true" u1lint -i ubuntuone/platform/filesystem_notifications/pyinotify_agnostic.py
143-
144-test: logging.conf $(clientdefs_DATA) Makefile
145- echo "$(PYTHONPATH)"
146- if test "x$(builddir)" == "x$(srcdir)"; then \
147- PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -p tests/platform/windows,tests/proxy -i "test_windows.py,test_darwin.py,test_fsevents_daemon.py" tests || exit 1; \
148- PYTHONPATH="$(PYTHONPATH)" u1trial -r qt4 -p tests/platform/windows -i "test_windows.py,test_darwin.py" tests/proxy || exit 1; \
149- PYTHONPATH="$(PYTHONPATH)" $(PYTHON) tests/platform/check_reactor_import.py || exit 1; \
150- fi
151- rm -rf _trial_temp
152-
153-test-proxy: logging.conf $(clientdefs_DATA) Makefile
154- if test "x$(builddir)" == "x$(srcdir)"; then \
155- PYTHONPATH="$(PYTHONPATH)" u1trial -r qt4 -p tests/platform/windows -i "test_windows.py,test_darwin.py" tests/proxy || exit 1; \
156- fi
157- rm -rf _trial_temp
158-
159-test-coverage: logging.conf $(clientdefs_DATA) Makefile
160- if test "x$(builddir)" == "x$(srcdir)"; then \
161- PYTHONPATH="$(PYTHONPATH)" u1trial -r $(REACTOR) -c -p tests/platform/windows -i "test_windows.py,test_darwin.py" tests; \
162- fi
163- rm -rf _trial_temp
164-
165-check: lint test Makefile
166-
167-docs: $(clientdefs_DATA) Makefile
168- $(mkdir_p) docs
169- if test "x$(builddir)" != "x$(srcdir)" -a -f "$(srcdir)/docs/syncdaemon_dbus_api.txt"; then \
170- $(LN_S) "$(top_srcdir)/docs/syncdaemon_dbus_api.txt" "docs/syncdaemon_dbus_api.txt"; \
171- else \
172- PYTHONPATH="$(PYTHONPATH)" SRCDIR="$(srcdir)" $(PYTHON) $(srcdir)/contrib/dbus-docs; \
173- fi
174-
175-ubuntuone: Makefile
176- if test "x$(builddir)" != "x$(srcdir)"; then \
177- $(mkdir_p) ubuntuone; \
178- $(mkdir_p) tests; \
179- (cd ubuntuone && $(LNDIR) $(srcdir)/../ubuntuone > /dev/null); \
180- (cd tests && $(LNDIR) $(srcdir)/../tests > /dev/null); \
181- fi
182-
183-all-local: logging.conf $(clientdefs_DATA)
184-
185-sd_path = ubuntuone/syncdaemon
186-
187-u1fsfsm: $(srcdir)/ubuntuone/syncdaemon/u1fsfsm.ods
188- PYTHONPATH=$(PYTHONPATH) \
189- HAS_OOFFICE="true" \
190- XDG_CACHE_HOME="$(builddir)/_trial_temp/xdg_cache" \
191- $(PYTHON) -t $(srcdir)/$(sd_path)/fsm/fsm_parser.py \
192- -o $(builddir)/$(sd_path)/u1fsfsm.py $<
193- PYTHONPATH=$(PYTHONPATH) \
194- HAS_OOFFICE="true" \
195- XDG_CACHE_HOME="$(builddir)/_trial_temp/xdg_cache" \
196- $(PYTHON) -t $(srcdir)/$(sd_path)/fsm/fsm.py \
197- $(srcdir)/$(sd_path)/u1fsfsm.py
198-
199-install-data-local: $(clientdefs_DATA)
200- for package in $(pypackages); do \
201- $(mkdir_p) $(DESTDIR)$(pythonpkgdir)/$$package; \
202- for module in $(top_srcdir)/$$package/*.py; do \
203- $(install_sh_DATA) $$module $(DESTDIR)$(pythonpkgdir)/$$package; \
204- done; \
205- done
206- echo "$(PACKAGE)" > $(DESTDIR)$(pythondir)/$(PACKAGE).pth
207-
208-uninstall-local:
209- for package in $(pypackages); do \
210- for module in $(top_srcdir)/$$package/*.py; do \
211- modname=`basename $$module`; \
212- rm -f $(DESTDIR)$(pythonpkgdir)/$$package/$$modname; \
213- done; \
214- rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(pythonpkgdir)/$$package; \
215- done
216- rm -f $(DESTDIR)$(pythondir)/$(PACKAGE).pth
217-
218-clean-local:
219- for i in `find $(builddir) -name "*.pyc"`; do \
220- rm -f $$i; \
221- done
222- rm -rf build dist _trial_temp
223-
224-EXTRA_DIST = \
225- $(srcdir)/ubuntuone/syncdaemon/u1fsfsm.ods \
226- $(pyfiles) \
227- $(clientdefs_in_files) \
228- LICENSE \
229- LICENSE.OpenSSL \
230- HACKING \
231- VERSION \
232- bin \
233- contrib \
234- tests
235-
236-CLEANFILES = \
237- $(clientdefs_DATA)
238-
239-MAINTAINERCLEANFILES = \
240- Makefile.in \
241- aclocal.m4 \
242- config.guess \
243- config.h.in \
244- config.sub \
245- configure \
246- depcomp \
247- install-sh \
248- libtool \
249- ltmain.sh \
250- missing \
251- mkinstalldirs
252
253=== removed file 'VERSION'
254--- VERSION 2013-05-30 18:46:21 +0000
255+++ VERSION 1970-01-01 00:00:00 +0000
256@@ -1,1 +0,0 @@
257-13.05
258
259=== removed file 'autogen.sh'
260--- autogen.sh 2012-01-03 12:52:20 +0000
261+++ autogen.sh 1970-01-01 00:00:00 +0000
262@@ -1,21 +0,0 @@
263-#!/bin/sh
264-# Run this to generate all the initial makefiles, etc.
265-
266-srcdir=`dirname $0`
267-test -z "$srcdir" && srcdir=.
268-
269-PKG_NAME="ubuntuone-client"
270-REQUIRED_AUTOMAKE_VERSION="1.10"
271-
272-(test -f $srcdir/configure.ac) || {
273- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
274- echo " top-level $PKG_NAME directory"
275- exit 1
276-}
277-
278-which gnome-autogen.sh || {
279- echo "You need to install gnome-common from the GNOME source repository"
280- exit 1
281-}
282-
283-USE_GNOME2_MACROS=1 . gnome-autogen.sh
284
285=== removed file 'configure.ac'
286--- configure.ac 2013-02-21 20:59:11 +0000
287+++ configure.ac 1970-01-01 00:00:00 +0000
288@@ -1,186 +0,0 @@
289-dnl Process this file with autoconf to produce a configure script.
290-AC_PREREQ(2.53)
291-
292-# We need to omit the trailing newline when catting the VERSION file
293-AC_INIT([ubuntuone-client], m4_esyscmd([cat VERSION | tr -d '\012']))
294-AC_CONFIG_SRCDIR([config.h.in])
295-
296-AM_INIT_AUTOMAKE([1.10 foreign tar-ustar])
297-AM_CONFIG_HEADER([config.h])
298-
299-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
300-
301-AC_ISC_POSIX
302-AC_PROG_CC
303-AC_PROG_LIBTOOL
304-PKG_PROG_PKG_CONFIG([0.19])
305-IT_PROG_INTLTOOL([0.40.0])
306-
307-GETTEXT_PACKAGE="${PACKAGE}"
308-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
309- [translation domain of this package])
310-AC_SUBST(GETTEXT_PACKAGE)
311-localedir='$(prefix)/$(DATADIRNAME)/locale'
312-AC_SUBST(localedir)
313-
314-# Workaround to make aclocal get the right flags
315-AC_CONFIG_MACRO_DIR([m4])
316-AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS} -I m4")
317-
318-# Need lndir for builddir != srcdir builds, because Python is not sane
319-AC_PATH_PROG([LNDIR], [lndir], [])
320-if test "x$LNDIR" = "x"; then
321- AC_MSG_ERROR([lndir is required to build ubuntuone-client])
322-fi
323-
324-# Alter default logging if we're development vs. stable
325-AC_MSG_CHECKING([development series build])
326-DEVVERSION="`echo $PACKAGE_VERSION|cut -d. -f2`"
327-if expr $DEVVERSION % 2 > /dev/null != "0"; then
328- debugging=yes
329- AC_MSG_RESULT([yes])
330-else
331- debugging=no
332- AC_MSG_RESULT([no])
333-fi
334-
335-AC_ARG_ENABLE([debug],
336- AC_HELP_STRING([--enable-debug],
337- [Enable debug logging by default [default=auto]]),
338- enable_debug=$enableval,
339- enable_debug=$debugging)
340-if test "x$enable_debug" != "xno"; then
341- LOG_LEVEL="DEBUG"
342- LOG_FILE_SIZE="10485760"
343- CFLAGS="${CFLAGS} -Wall -Werror"
344- AC_SUBST(CFLAGS)
345-else
346- LOG_LEVEL="INFO"
347- LOG_FILE_SIZE="1048576"
348-fi
349-AC_SUBST(LOG_LEVEL)
350-AC_SUBST(LOG_FILE_SIZE)
351-
352-# Check for python 2.6
353-AM_PATH_PYTHON([2.6])
354-
355-# Specify the path for ubuntu-sso-client source
356-AC_MSG_CHECKING([for ubuntu-sso-client])
357-AC_ARG_WITH([sso],
358- AC_HELP_STRING([--with-sso],
359- [Specify path to ubuntu-sso-client [default=auto]]),
360- [with_sso=$withval],
361- [with_sso=auto])
362-SSO_PATH=""
363-if test "x$with_sso" = "xauto"; then
364- SSO_PATH=""
365- AC_MSG_RESULT([using system path])
366-else
367- SSO_PATH="$with_sso"
368- AC_MSG_RESULT([$SSO_PATH])
369-fi
370-AC_SUBST(SSO_PATH)
371-
372-# Specify the path for ubuntuone-storage-protocol source
373-AC_MSG_CHECKING([for ubuntuone-storage-protocol])
374-AC_ARG_WITH([protocol],
375- AC_HELP_STRING([--with-protocol],
376- [Specify path to storage protocol [default=auto]]),
377- [with_protocol=$withval],
378- [with_protocol=auto])
379-USP_PATH=""
380-if test "x$with_protocol" = "xauto"; then
381- USP_PATH=""
382- AC_MSG_RESULT([using system path])
383-else
384- USP_PATH="$with_protocol"
385- AC_MSG_RESULT([$USP_PATH])
386-fi
387-AC_SUBST(USP_PATH)
388-
389-PKG_CHECK_MODULES(DBUS, [dbus-glib-1 >= 0.70])
390-AC_SUBST(DBUS_CFLAGS)
391-AC_SUBST(DBUS_LIBS)
392-
393-##################################################
394-# Check for gtk-doc.
395-##################################################
396-GTK_DOC_CHECK(1.0)
397-DISTCHECK_CONFIGURE_FLAGS="--enable-gtk-doc --enable-debug"
398-AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
399-
400-##################################################
401-# Check for introspection
402-##################################################
403-GOBJECT_INTROSPECTION_CHECK([0.6.4])
404-AC_MSG_CHECKING([if gobject-introspection requires new options])
405-$PKG_CONFIG --atleast-version=0.9.4 gobject-introspection-1.0
406-new_introspection=$?
407-if test "x$new_introspection" = "x0"; then
408- AC_MSG_RESULT([yes])
409-else
410- AC_MSG_RESULT([no])
411-fi
412-AM_CONDITIONAL([HAVE_NEW_INTROSPECTION], [test "x$new_introspection" = "x0"])
413-
414-# Fix up some junk from GIR
415-if test "x$found_introspection" = "xyes"; then
416- INTROSPECTION_GIRDIR_NAME="`basename ${INTROSPECTION_GIRDIR}`"
417- INTROSPECTION_TYPELIBDIR_NAME="`basename ${INTROSPECTION_TYPELIBDIR}`"
418- AC_SUBST(INTROSPECTION_GIRDIR_NAME)
419- AC_SUBST(INTROSPECTION_TYPELIBDIR_NAME)
420-fi
421-
422-dnl glib-genmarshal
423-AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
424-
425-LIBSYNCDAEMON_CURRENT=1
426-LIBSYNCDAEMON_REVISION=0
427-LIBSYNCDAEMON_AGE=0
428-AC_SUBST(LIBSYNCDAEMON_CURRENT)
429-AC_SUBST(LIBSYNCDAEMON_REVISION)
430-AC_SUBST(LIBSYNCDAEMON_AGE)
431-
432-dnl ---------------------------------------------------------------------------
433-dnl - Are we specifying a different dbus root ?
434-dnl ---------------------------------------------------------------------------
435-AC_ARG_WITH(dbus-services,
436- [AC_HELP_STRING([--with-dbus-services=<dir>],
437- [where D-BUS services directory is])])
438-if ! test -z "$with_dbus_services" ; then
439- DBUS_SERVICES_DIR="$with_dbus_services"
440-else
441- # D-BUS 0.23 and higher use $prefix/share/dbus-1/services
442- DBUS_SERVICES_DIR="\${datadir}/dbus-1/services"
443-fi
444-AC_SUBST(DBUS_SERVICES_DIR)
445-
446-dnl Strings to pass to SSO data
447-SSO_APP_NAME="Ubuntu One"
448-SSO_TC_URL="https://one.ubuntu.com/terms/"
449-SSO_PING_URL="https://one.ubuntu.com/oauth/sso-finished-so-get-tokens/"
450-AC_SUBST(SSO_APP_NAME)
451-AC_SUBST(SSO_TC_URL)
452-AC_SUBST(SSO_PING_URL)
453-AC_DEFINE_UNQUOTED([SSO_APP_NAME], ["$SSO_APP_NAME"], ["The Ubuntu One app name."])
454-AC_DEFINE_UNQUOTED([SSO_TC_URL], ["$SSO_TC_URL"], ["The Ubuntu One terms and conditions URL."])
455-AC_DEFINE_UNQUOTED([SSO_PING_URL], ["$SSO_PING_URL"], ["The Ubuntu One url to ping to when new tokens are stored."])
456-
457-AC_CONFIG_FILES([
458-Makefile
459-data/Makefile
460-libsyncdaemon/Makefile
461-libsyncdaemon/libsyncdaemon-1.0.pc
462-po/Makefile.in
463-docs/Makefile
464-docs/reference/Makefile
465-])
466-
467-if [[ -n "$(lsb_release -r | grep -v '1[2-9].[0-9][0-9]')" ]]; then
468- REACTOR="glib";
469-else
470- REACTOR="gi"
471-fi
472-AC_SUBST(REACTOR)
473-
474-AC_OUTPUT
475
476=== renamed file 'tests/platform/check_reactor_import.py' => 'contrib/check-reactor-import' (properties changed: -x to +x)
477--- tests/platform/check_reactor_import.py 2012-07-30 21:44:45 +0000
478+++ contrib/check-reactor-import 2013-07-10 19:40:32 +0000
479@@ -40,9 +40,12 @@
480
481 import __builtin__
482
483+import os
484 import sys
485 import traceback
486
487+sys.path.append(os.path.abspath(os.getcwd()))
488+
489
490 def fake_import(*args, **kwargs):
491 """A wrapper for __import__ that dies when importing reactor."""
492
493=== renamed file 'ubuntuone/syncdaemon/fsm/fsm_draw.py' => 'contrib/draw-fsm' (properties changed: -x to +x)
494--- ubuntuone/syncdaemon/fsm/fsm_draw.py 2012-04-09 20:07:05 +0000
495+++ contrib/draw-fsm 2013-07-10 19:40:32 +0000
496@@ -1,3 +1,4 @@
497+#!/usr/bin/python
498 # ubuntuone.syncdaemon.fsm.fsm_draw - draw a fsm
499 #
500 # Author: Lucio Torre <lucio.torre@canonical.com>
501@@ -35,7 +36,7 @@
502 import sys
503
504 # pylint: disable-msg=F0401
505-import gtk
506+from gi.repository import Gtk as gtk
507
508 import xdot
509 from ubuntuone.syncdaemon.fsm import fsm
510
511=== removed file 'data/Makefile.am'
512--- data/Makefile.am 2013-02-13 20:57:13 +0000
513+++ data/Makefile.am 1970-01-01 00:00:00 +0000
514@@ -1,48 +0,0 @@
515-
516-apportdir = $(datadir)/apport/package-hooks
517-apport_DATA = source_ubuntuone-client.py
518-
519-crashdbdir = $(sysconfdir)/apport/crashdb.conf.d
520-crashdb_DATA = ubuntuone-client-crashdb.conf
521-
522-configdir = $(sysconfdir)/xdg/ubuntuone
523-config_in_files = logging.conf.in
524-config_out_files = $(config_in_files:.conf.in=.conf)
525-config_files = syncdaemon.conf
526-config_DATA = $(config_files) $(config_out_files)
527-
528-autostartdir = $(sysconfdir)/xdg/autostart
529-autostart_in_files = ubuntuone-launch.desktop.in
530-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
531-
532-@INTLTOOL_DESKTOP_RULE@
533-
534-%.conf: %.conf.in
535- @sed -e "s|\@LOG_LEVEL\@|$(LOG_LEVEL)|" \
536- -e "s|\@LOG_FILE_SIZE\@|$(LOG_FILE_SIZE)|" $< > $@
537-
538-servicedir = $(DBUS_SERVICES_DIR)
539-service_in_files = \
540- com.ubuntuone.SyncDaemon.service.in \
541- com.ubuntuone.Credentials.service.in
542-service_DATA = $(service_in_files:.service.in=.service)
543-
544-%.service: %.service.in
545- @sed -e "s|\@libexecdir\@|$(libexecdir)|" \
546- -e "s|\@bindir\@|$(bindir)|" $< > $@
547-
548-EXTRA_DIST = \
549- $(config_in_files) \
550- $(config_files) \
551- $(autostart_in_files) \
552- $(service_in_files) \
553- $(apport_DATA) \
554- $(crashdb_DATA)
555-
556-CLEANFILES = \
557- $(config_out_files) \
558- $(autostart_DATA) \
559- $(service_DATA)
560-
561-MAINTAINERCLEANFILES = \
562- Makefile.in
563
564=== removed file 'docs/Makefile.am'
565--- docs/Makefile.am 2012-03-13 16:53:57 +0000
566+++ docs/Makefile.am 1970-01-01 00:00:00 +0000
567@@ -1,7 +0,0 @@
568-SUBDIRS = reference
569-
570-manfilesdir = $(mandir)/man1
571-manfiles_DATA = \
572- man/u1sdtool.1
573-
574-EXTRA_DIST=$(manfiles_DATA)
575
576=== removed directory 'docs/reference'
577=== removed file 'docs/reference/Makefile.am'
578--- docs/reference/Makefile.am 2010-10-19 15:38:45 +0000
579+++ docs/reference/Makefile.am 1970-01-01 00:00:00 +0000
580@@ -1,62 +0,0 @@
581-## Process this file with automake to produce Makefile.in
582-
583-# Dummy targets we need to make distcheck and check pass
584-test test-report perf-report full-report:
585- ## Ignore
586-
587-# automake requirements
588-AUTOMAKE_OPTIONS = 1.7
589-
590-# The name of the module
591-DOC_MODULE=libsyncdaemon
592-
593-# The top-level SGML file. You can change this if you want to.
594-DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
595-
596-# The directory containing the source code. Relative to $(srcdir).
597-DOC_SOURCE_DIR=../../libsyncdaemon
598-
599-# Extra options to pass to gtkdoc-scangobj. Not normally needed.
600-SCANGOBJ_OPTIONS=
601-
602-# Extra options to supply to gtkdoc-scan.
603-# Fx --rebuild-types --rebuild-sections
604-SCAN_OPTIONS=
605-
606-# Extra options to supply to gtkdoc-mkdb.
607-MKDB_OPTIONS=--sgml-mode --output-format=xml --ignore-files=trio
608-
609-# Extra options to supply to gtkdoc-fixref. Not normally needed.
610-FIXXREF_OPTIONS=
611-
612-# Used for dependencies. The docs will be rebuilt if any of these change.
613-HFILE_GLOB=$(top_srcdir)/libsyncdaemon/syncdaemon-*.h
614-CFILE_GLOB=$(top_srcdir)/libsyncdaemon/syncdaemon-*.c
615-
616-# Header files to ignore when scanning.
617-IGNORE_HFILES= \
618- utils.h
619-
620-# Images to copy into HTML directory.
621-HTML_IMAGES=
622-
623-# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
624-content_files =
625-
626-# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
627-INCLUDES=-I$(top_srcdir)/libsyncdaemon \
628- $(DBUS_CFLAGS)
629-
630-GTKDOC_LIBS=$(DBUS_LIBS) \
631- $(top_builddir)/libsyncdaemon/libsyncdaemon-1.0.la
632-
633-# This includes the standard gtk-doc make rules, copied by gtkdocize.
634-include $(top_srcdir)/gtk-doc.make
635-
636-# Other files to distribute
637-# e.g. EXTRA_DIST += version.xml.in
638-EXTRA_DIST += \
639- libsyncdaemon.types \
640- libsyncdaemon-docs.sgml
641-# libsyncdaemon-sections.txt
642-
643
644=== removed file 'docs/reference/libsyncdaemon-docs.sgml'
645--- docs/reference/libsyncdaemon-docs.sgml 2010-10-19 13:28:23 +0000
646+++ docs/reference/libsyncdaemon-docs.sgml 1970-01-01 00:00:00 +0000
647@@ -1,48 +0,0 @@
648-<?xml version="1.0"?>
649-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
650- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
651-[
652- <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
653-]>
654-<book id="index">
655- <bookinfo>
656- <title>libsyncdaemon Reference Manual</title>
657- <releaseinfo>
658- for libsyncdaemon [VERSION].
659- The latest version of this documentation can be found on-line at
660- <ulink role="online-location" url="http://[SERVER]/libsyncdaemon/index.html">http://[SERVER]/libsyncdaemon/</ulink>.
661- </releaseinfo>
662- </bookinfo>
663-
664- <chapter>
665- <title>[Insert title here]</title>
666- <xi:include href="xml/syncdaemon-metadata.xml"/>
667- <xi:include href="xml/syncdaemon-events-interface.xml"/>
668- <xi:include href="xml/syncdaemon-file-info.xml"/>
669- <xi:include href="xml/syncdaemon-transfer-info.xml"/>
670- <xi:include href="xml/syncdaemon-share-info.xml"/>
671- <xi:include href="xml/syncdaemon-filesystem-interface.xml"/>
672- <xi:include href="xml/syncdaemon-status-interface.xml"/>
673- <xi:include href="xml/syncdaemon-config-interface.xml"/>
674- <xi:include href="xml/syncdaemon-publicfiles-interface.xml"/>
675- <xi:include href="xml/syncdaemon-authentication.xml"/>
676- <xi:include href="xml/syncdaemon-shares-interface.xml"/>
677- <xi:include href="xml/syncdaemon-credentials.xml"/>
678- <xi:include href="xml/syncdaemon-folders-interface.xml"/>
679- <xi:include href="xml/syncdaemon-daemon.xml"/>
680- <xi:include href="xml/syncdaemon-interface.xml"/>
681- <xi:include href="xml/syncdaemon-folder-info.xml"/>
682- <xi:include href="xml/syncdaemon-status-info.xml"/>
683-
684- </chapter>
685- <chapter id="object-tree">
686- <title>Object Hierarchy</title>
687- <xi:include href="xml/tree_index.sgml"/>
688- </chapter>
689- <index id="api-index-full">
690- <title>API Index</title>
691- <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
692- </index>
693-
694- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
695-</book>
696
697=== removed directory 'libsyncdaemon'
698=== removed file 'libsyncdaemon/Makefile.am'
699--- libsyncdaemon/Makefile.am 2012-09-17 19:18:24 +0000
700+++ libsyncdaemon/Makefile.am 1970-01-01 00:00:00 +0000
701@@ -1,114 +0,0 @@
702-CLEANFILES = $(NULL)
703-
704-lib_LTLIBRARIES = libsyncdaemon-1.0.la
705-
706-noinst_PROGRAMS = test-libsyncdaemon
707-
708-INCLUDES = \
709- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
710- -I$(top_srcdir) \
711- $(DBUS_CFLAGS)
712-
713-# Marshallers
714-MARSHAL_GENERATED = syncdaemon-marshal.c syncdaemon-marshal.h
715-
716-syncdaemon-marshal.h: syncdaemon-marshal.list $(GLIB_GENMARSHAL)
717- $(GLIB_GENMARSHAL) $< --header --prefix=_syncdaemon_marshal > $@
718-
719-syncdaemon-marshal.c: syncdaemon-marshal.list $(GLIB_GENMARSHAL) syncdaemon-marshal.h
720- $(GLIB_GENMARSHAL) $< --body --prefix=_syncdaemon_marshal > $@
721-
722-syncdaemonincludedir = $(includedir)/libsyncdaemon-1.0/libsyncdaemon
723-syncdaemoninclude_HEADERS = \
724- libsyncdaemon.h \
725- syncdaemon-authentication.h \
726- syncdaemon-daemon.h \
727- syncdaemon-config-interface.h \
728- syncdaemon-credentials.h \
729- syncdaemon-events-interface.h \
730- syncdaemon-file-info.h \
731- syncdaemon-filesystem-interface.h \
732- syncdaemon-folder-info.h \
733- syncdaemon-folders-interface.h \
734- syncdaemon-metadata.h \
735- syncdaemon-publicfiles-interface.h \
736- syncdaemon-share-info.h \
737- syncdaemon-shares-interface.h \
738- syncdaemon-status-info.h \
739- syncdaemon-status-interface.h \
740- syncdaemon-transfer-info.h \
741- syncdaemon-interface.h
742-
743-libsyncdaemon_1_0_la_SOURCES = \
744- syncdaemon-marshal.c \
745- syncdaemon-authentication.c \
746- syncdaemon-daemon.c \
747- syncdaemon-config-interface.c \
748- syncdaemon-credentials.c \
749- syncdaemon-events-interface.c \
750- syncdaemon-file-info.c \
751- syncdaemon-filesystem-interface.c \
752- syncdaemon-folder-info.c \
753- syncdaemon-folders-interface.c \
754- syncdaemon-metadata.c \
755- syncdaemon-publicfiles-interface.c \
756- syncdaemon-share-info.c \
757- syncdaemon-shares-interface.c \
758- syncdaemon-status-info.c \
759- syncdaemon-status-interface.c \
760- syncdaemon-transfer-info.c \
761- syncdaemon-interface.c \
762- utils.c
763-
764-libsyncdaemon_1_0_la_LIBADD = \
765- $(DBUS_LIBS)
766-libsyncdaemon_1_0_la_LDFLAGS = -version-info $(LIBSYNCDAEMON_CURRENT):$(LIBSYNCDAEMON_REVISION):$(LIBSYNCDAEMON_AGE)
767-
768-test_libsyncdaemon_SOURCES = test-libsyncdaemon.c
769-test_libsyncdaemon_LDADD = libsyncdaemon-1.0.la $(DBUS_LIBS)
770-
771-pkgconfigdir = $(libdir)/pkgconfig
772-pkgconfig_DATA = libsyncdaemon-1.0.pc
773-
774-MAINTAINERCLEANFILES = \
775- Makefile.in \
776- $(MARSHAL_GENERATED)
777-
778-EXTRA_DIST = \
779- syncdaemon-marshal.list \
780- utils.h \
781- $(MARSHAL_GENERATED)
782-
783--include $(INTROSPECTION_MAKEFILE)
784-INTROSPECTION_GIRS =
785-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
786-INTROSPECTION_SCANNER_ARGS = \
787- --add-include-path=$(srcdir) \
788- --c-include="libsyncdaemon/libsyncdaemon.h"
789-
790-if HAVE_NEW_INTROSPECTION
791-INTROSPECTION_SCANNER_ARGS += --identifier-prefix=Syncdaemon --warn-all
792-endif
793-
794-if HAVE_INTROSPECTION
795-introspection_files = \
796- $(syncdaemoninclude_HEADERS) \
797- $(shell ls syncdaemon*.[ch])
798-Syncdaemon-1.0.gir: libsyncdaemon-1.0.la Makefile
799-Syncdaemon_1_0_gir_NAMESPACE = Syncdaemon
800-Syncdaemon_1_0_gir_INCLUDES = GObject-2.0
801-Syncdaemon_1_0_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir)
802-Syncdaemon_1_0_gir_LIBS = libsyncdaemon-1.0.la
803-Syncdaemon_1_0_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
804-Syncdaemon_1_0_gir_EXPORT_PACKAGES = libsyncdaemon-1.0
805-INTROSPECTION_GIRS += Syncdaemon-1.0.gir
806-
807-girdir = $(datadir)/$(INTROSPECTION_GIRDIR_NAME)
808-gir_DATA = $(INTROSPECTION_GIRS)
809-
810-typelibsdir = $(libdir)/$(INTROSPECTION_TYPELIBDIR_NAME)
811-typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
812-
813-CLEANFILES += $(gir_DATA) $(typelibs_DATA)
814-
815-endif # HAVE_INTROSPECTION
816
817=== removed file 'libsyncdaemon/libsyncdaemon-1.0.pc.in'
818--- libsyncdaemon/libsyncdaemon-1.0.pc.in 2010-06-24 12:14:39 +0000
819+++ libsyncdaemon/libsyncdaemon-1.0.pc.in 1970-01-01 00:00:00 +0000
820@@ -1,11 +0,0 @@
821-prefix=@prefix@
822-exec_prefix=${prefix}
823-libdir=${exec_prefix}/lib
824-includedir=${exec_prefix}/include
825-
826-Name: libsyncdaemon
827-Description: Ubuntu One SyncDaemon access library
828-Version: @VERSION@
829-Libs: -L${libdir} -lsyncdaemon-1.0
830-Cflags: -I${includedir}/libsyncdaemon-1.0
831-Requires: gobject-2.0
832
833=== removed file 'libsyncdaemon/libsyncdaemon.h'
834--- libsyncdaemon/libsyncdaemon.h 2012-04-09 20:07:05 +0000
835+++ libsyncdaemon/libsyncdaemon.h 1970-01-01 00:00:00 +0000
836@@ -1,50 +0,0 @@
837-/*
838- * Syncdaemon API
839- *
840- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
841- *
842- * Copyright 2010-2012 Canonical Ltd.
843- *
844- * This program is free software: you can redistribute it and/or modify it
845- * under the terms of the GNU General Public License version 3, as published
846- * by the Free Software Foundation.
847- *
848- * This program is distributed in the hope that it will be useful, but
849- * WITHOUT ANY WARRANTY; without even the implied warranties of
850- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
851- * PURPOSE. See the GNU General Public License for more details.
852- *
853- * You should have received a copy of the GNU General Public License along
854- * with this program. If not, see <http://www.gnu.org/licenses/>.
855- *
856- * In addition, as a special exception, the copyright holders give
857- * permission to link the code of portions of this program with the
858- * OpenSSL library under certain conditions as described in each
859- * individual source file, and distribute linked combinations
860- * including the two.
861- * You must obey the GNU General Public License in all respects
862- * for all of the code used other than OpenSSL. If you modify
863- * file(s) with this exception, you may extend this exception to your
864- * version of the file(s), but you are not obligated to do so. If you
865- * do not wish to do so, delete this exception statement from your
866- * version. If you delete this exception statement from all source
867- * files in the program, then also delete it here.
868- *
869- */
870-
871-#include <libsyncdaemon/syncdaemon-authentication.h>
872-#include <libsyncdaemon/syncdaemon-config-interface.h>
873-#include <libsyncdaemon/syncdaemon-credentials.h>
874-#include <libsyncdaemon/syncdaemon-daemon.h>
875-#include <libsyncdaemon/syncdaemon-events-interface.h>
876-#include <libsyncdaemon/syncdaemon-file-info.h>
877-#include <libsyncdaemon/syncdaemon-filesystem-interface.h>
878-#include <libsyncdaemon/syncdaemon-folder-info.h>
879-#include <libsyncdaemon/syncdaemon-folders-interface.h>
880-#include <libsyncdaemon/syncdaemon-interface.h>
881-#include <libsyncdaemon/syncdaemon-publicfiles-interface.h>
882-#include <libsyncdaemon/syncdaemon-share-info.h>
883-#include <libsyncdaemon/syncdaemon-shares-interface.h>
884-#include <libsyncdaemon/syncdaemon-status-info.h>
885-#include <libsyncdaemon/syncdaemon-status-interface.h>
886-#include <libsyncdaemon/syncdaemon-transfer-info.h>
887
888=== removed file 'libsyncdaemon/syncdaemon-authentication.c'
889--- libsyncdaemon/syncdaemon-authentication.c 2012-04-09 20:07:05 +0000
890+++ libsyncdaemon/syncdaemon-authentication.c 1970-01-01 00:00:00 +0000
891@@ -1,298 +0,0 @@
892-/*
893- * Syncdaemon API
894- *
895- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
896- *
897- * Copyright 2010-2012 Canonical Ltd.
898- *
899- * This program is free software: you can redistribute it and/or modify it
900- * under the terms of the GNU General Public License version 3, as published
901- * by the Free Software Foundation.
902- *
903- * This program is distributed in the hope that it will be useful, but
904- * WITHOUT ANY WARRANTY; without even the implied warranties of
905- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
906- * PURPOSE. See the GNU General Public License for more details.
907- *
908- * You should have received a copy of the GNU General Public License along
909- * with this program. If not, see <http://www.gnu.org/licenses/>.
910- *
911- * In addition, as a special exception, the copyright holders give
912- * permission to link the code of portions of this program with the
913- * OpenSSL library under certain conditions as described in each
914- * individual source file, and distribute linked combinations
915- * including the two.
916- * You must obey the GNU General Public License in all respects
917- * for all of the code used other than OpenSSL. If you modify
918- * file(s) with this exception, you may extend this exception to your
919- * version of the file(s), but you are not obligated to do so. If you
920- * do not wish to do so, delete this exception statement from your
921- * version. If you delete this exception statement from all source
922- * files in the program, then also delete it here.
923- *
924- */
925-
926-#include "config.h"
927-#include <string.h>
928-#include <glib/gi18n-lib.h>
929-#include <dbus/dbus-glib.h>
930-#include "syncdaemon-authentication.h"
931-#include "syncdaemon-marshal.h"
932-
933-G_DEFINE_TYPE(SyncdaemonAuthentication, syncdaemon_authentication, G_TYPE_OBJECT)
934-
935-struct _SyncdaemonAuthenticationPrivate {
936- DBusGConnection *bus;
937- DBusGProxy *proxy;
938- gboolean has_credentials;
939- SyncdaemonCredentials *credentials;
940-};
941-
942-/* Signals */
943-enum {
944- CREDENTIALS_FOUND_SIGNAL,
945- AUTHORIZATION_CANCELLED_SIGNAL,
946- ERROR_SIGNAL,
947- LAST_SIGNAL
948-};
949-
950-static guint auth_signals[LAST_SIGNAL] = { 0, };
951-
952-static void
953-syncdaemon_authentication_finalize (GObject *object)
954-{
955- SyncdaemonAuthentication *auth = SYNCDAEMON_AUTHENTICATION (object);
956-
957- if (auth->priv != NULL) {
958- if (auth->priv->credentials != NULL)
959- g_object_unref (G_OBJECT (auth->priv->credentials));
960- if (auth->priv->proxy != NULL)
961- g_object_unref (G_OBJECT (auth->priv->proxy));
962- if (auth->priv->bus != NULL)
963- dbus_g_connection_unref (auth->priv->bus);
964-
965- g_free (auth->priv);
966- }
967-
968- G_OBJECT_CLASS (syncdaemon_authentication_parent_class)->finalize (object);
969-}
970-
971-static void
972-syncdaemon_authentication_class_init (SyncdaemonAuthenticationClass *klass)
973-{
974- GObjectClass *object_class = G_OBJECT_CLASS (klass);
975-
976- object_class->finalize = syncdaemon_authentication_finalize;
977-
978- /* Register signals */
979- auth_signals[CREDENTIALS_FOUND_SIGNAL] = g_signal_new ("credentials_found",
980- G_TYPE_FROM_CLASS (klass),
981- (GSignalFlags) G_SIGNAL_RUN_LAST,
982- G_STRUCT_OFFSET (SyncdaemonAuthenticationClass, credentials_found),
983- NULL, NULL,
984- g_cclosure_marshal_VOID__OBJECT,
985- G_TYPE_NONE, 1,
986- G_TYPE_OBJECT);
987- auth_signals[AUTHORIZATION_CANCELLED_SIGNAL] = g_signal_new ("authorization_cancelled",
988- G_TYPE_FROM_CLASS (klass),
989- (GSignalFlags) G_SIGNAL_RUN_LAST,
990- G_STRUCT_OFFSET (SyncdaemonAuthenticationClass, authorization_cancelled),
991- NULL, NULL,
992- g_cclosure_marshal_VOID__VOID,
993- G_TYPE_NONE, 0);
994- auth_signals[ERROR_SIGNAL] = g_signal_new ("error",
995- G_TYPE_FROM_CLASS (klass),
996- (GSignalFlags) G_SIGNAL_RUN_LAST,
997- G_STRUCT_OFFSET (SyncdaemonAuthenticationClass, error),
998- NULL, NULL,
999- g_cclosure_marshal_VOID__STRING,
1000- G_TYPE_NONE, 1,
1001- G_TYPE_STRING);
1002-}
1003-
1004-static void
1005-credentials_found_cb (DBusGProxy *proxy, GHashTable *result, gpointer user_data)
1006-{
1007- SyncdaemonAuthentication *auth = SYNCDAEMON_AUTHENTICATION (user_data);
1008-
1009- g_debug ("Authorization completed!");
1010-
1011- if (auth->priv->credentials != NULL)
1012- g_object_unref (G_OBJECT (auth->priv->credentials));
1013-
1014- auth->priv->credentials = syncdaemon_credentials_new_from_hash_table (result);
1015- auth->priv->has_credentials = TRUE;
1016-
1017- g_signal_emit (auth, auth_signals[CREDENTIALS_FOUND_SIGNAL], 0, auth->priv->credentials);
1018-}
1019-
1020-static void
1021-authorization_denied_cb (DBusGProxy *proxy, gpointer user_data)
1022-{
1023- g_debug ("Authorization denied");
1024-
1025- g_signal_emit (user_data, auth_signals[AUTHORIZATION_CANCELLED_SIGNAL], 0);
1026-}
1027-
1028-static void
1029-credentials_error_cb (DBusGProxy *proxy, GHashTable *error_dict, gpointer user_data)
1030-{
1031- g_debug ("Authorization error");
1032-
1033- g_signal_emit (user_data, auth_signals[ERROR_SIGNAL], 0,
1034- g_hash_table_lookup (error_dict, "message"));
1035-}
1036-
1037-static void
1038-credentials_not_found_cb (DBusGProxy *proxy, gpointer user_data)
1039-{
1040- SyncdaemonAuthentication *auth = SYNCDAEMON_AUTHENTICATION (user_data);
1041-
1042- g_debug ("Credentials for Ubuntu One not found!");
1043-
1044- if (auth->priv->credentials != NULL)
1045- g_object_unref (G_OBJECT (auth->priv->credentials));
1046- auth->priv->has_credentials = FALSE;
1047-
1048- g_signal_emit (auth, auth_signals[ERROR_SIGNAL], 0,
1049- "Credentials not found.");
1050-}
1051-
1052-static void
1053-syncdaemon_authentication_init (SyncdaemonAuthentication *auth)
1054-{
1055- GError *error = NULL;
1056-
1057- auth->priv = g_new0 (SyncdaemonAuthenticationPrivate, 1);
1058- auth->priv->has_credentials = FALSE;
1059-
1060- /* Initialize DBus */
1061- auth->priv->bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
1062- if (error != NULL) {
1063- g_warning ("Couldn't get session bus: %s", error->message);
1064- g_error_free (error);
1065- } else {
1066- auth->priv->proxy = dbus_g_proxy_new_for_name (auth->priv->bus, "com.ubuntuone.Credentials",
1067- "/credentials", "com.ubuntuone.CredentialsManagement");
1068- if (auth->priv->proxy != NULL) {
1069- dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsFound",
1070- dbus_g_type_get_map ("GHashTable",
1071- G_TYPE_STRING,
1072- G_TYPE_STRING),
1073- G_TYPE_INVALID);
1074- dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsFound",
1075- G_CALLBACK (credentials_found_cb), auth, NULL);
1076-
1077- dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsNotFound",
1078- G_TYPE_INVALID);
1079- dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsNotFound",
1080- G_CALLBACK (credentials_not_found_cb), auth, NULL);
1081-
1082- dbus_g_proxy_add_signal (auth->priv->proxy, "AuthorizationDenied",
1083- G_TYPE_INVALID);
1084- dbus_g_proxy_connect_signal (auth->priv->proxy, "AuthorizationDenied",
1085- G_CALLBACK (authorization_denied_cb), auth, NULL);
1086-
1087- dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsError",
1088- dbus_g_type_get_map ("GHashTable",
1089- G_TYPE_STRING,
1090- G_TYPE_STRING),
1091- G_TYPE_INVALID);
1092- dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsError",
1093- G_CALLBACK (credentials_error_cb), auth, NULL);
1094- } else
1095- g_warning ("Couldn't get proxy for com.ubuntuone.CredentialsManagement");
1096-
1097- }
1098-}
1099-
1100-/**
1101- * syncdaemon_authentication_find_credentials:
1102- */
1103-SyncdaemonCredentials *
1104-syncdaemon_authentication_find_credentials (SyncdaemonAuthentication *auth)
1105-{
1106- SyncdaemonCredentials *result = NULL;
1107- g_return_val_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth), NULL);
1108-
1109- if (!auth->priv->has_credentials) {
1110- GHashTable *credentials;
1111- GError *error = NULL;
1112-
1113- if (dbus_g_proxy_call (auth->priv->proxy, "find_credentials_sync", &error,
1114- G_TYPE_INVALID,
1115- dbus_g_type_get_map ("GHashTable",
1116- G_TYPE_STRING,
1117- G_TYPE_STRING), &credentials,
1118- G_TYPE_INVALID)) {
1119- if (g_hash_table_size (credentials) >= 4) {
1120- auth->priv->credentials = syncdaemon_credentials_new_from_hash_table (credentials);
1121- auth->priv->has_credentials = TRUE;
1122- result = auth->priv->credentials;
1123- } else {
1124- g_debug ("Got less number of items (%i) in credentials hash table than expected (4)!",
1125- g_hash_table_size (credentials));
1126- }
1127- g_hash_table_destroy (credentials);
1128- } else {
1129- g_warning ("Could not get credentials: %s", error->message);
1130- g_error_free (error);
1131- }
1132- }
1133-
1134- return result;
1135-}
1136-
1137-/**
1138- * syncdaemon_authentication_has_credentials:
1139- */
1140-gboolean
1141-syncdaemon_authentication_has_credentials (SyncdaemonAuthentication *auth)
1142-{
1143- g_return_val_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth), FALSE);
1144-
1145- if (auth->priv->has_credentials)
1146- return TRUE;
1147-
1148- return syncdaemon_authentication_find_credentials (auth) != NULL;
1149-}
1150-
1151-/**
1152- * syncdaemon_authentication_login_or_register:
1153- */
1154-void
1155-syncdaemon_authentication_login_or_register (SyncdaemonAuthentication *auth)
1156-{
1157- GHashTable *params = g_hash_table_new (g_str_hash, g_str_equal);
1158-
1159- g_return_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth));
1160-
1161- g_hash_table_insert (params, "window_id", "0"); /* FIXME: get window ID */
1162-
1163- dbus_g_proxy_call_no_reply (auth->priv->proxy, "register",
1164- dbus_g_type_get_map ("GHashTable",
1165- G_TYPE_STRING,
1166- G_TYPE_STRING), params,
1167- G_TYPE_INVALID,
1168- G_TYPE_INVALID);
1169-
1170- g_hash_table_destroy (params);
1171-}
1172-
1173-/**
1174- * syncdaemon_authentication_clear_token:
1175- */
1176-void
1177-syncdaemon_authentication_clear_token (SyncdaemonAuthentication *auth)
1178-{
1179- GError *error = NULL;
1180-
1181- g_return_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth));
1182-
1183- if (!dbus_g_proxy_call (auth->priv->proxy, "clear_credentials", &error,
1184- G_TYPE_INVALID,
1185- G_TYPE_INVALID)) {
1186- g_warning ("Error calling 'clear_credentials': %s", error->message);
1187- g_error_free (error);
1188- }
1189-}
1190
1191=== removed file 'libsyncdaemon/syncdaemon-authentication.h'
1192--- libsyncdaemon/syncdaemon-authentication.h 2012-04-09 20:07:05 +0000
1193+++ libsyncdaemon/syncdaemon-authentication.h 1970-01-01 00:00:00 +0000
1194@@ -1,75 +0,0 @@
1195-/*
1196- * Syncdaemon API
1197- *
1198- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1199- *
1200- * Copyright 2010-2012 Canonical Ltd.
1201- *
1202- * This program is free software: you can redistribute it and/or modify it
1203- * under the terms of the GNU General Public License version 3, as published
1204- * by the Free Software Foundation.
1205- *
1206- * This program is distributed in the hope that it will be useful, but
1207- * WITHOUT ANY WARRANTY; without even the implied warranties of
1208- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1209- * PURPOSE. See the GNU General Public License for more details.
1210- *
1211- * You should have received a copy of the GNU General Public License along
1212- * with this program. If not, see <http://www.gnu.org/licenses/>.
1213- *
1214- * In addition, as a special exception, the copyright holders give
1215- * permission to link the code of portions of this program with the
1216- * OpenSSL library under certain conditions as described in each
1217- * individual source file, and distribute linked combinations
1218- * including the two.
1219- * You must obey the GNU General Public License in all respects
1220- * for all of the code used other than OpenSSL. If you modify
1221- * file(s) with this exception, you may extend this exception to your
1222- * version of the file(s), but you are not obligated to do so. If you
1223- * do not wish to do so, delete this exception statement from your
1224- * version. If you delete this exception statement from all source
1225- * files in the program, then also delete it here.
1226- *
1227- */
1228-
1229-#ifndef __SYNCDAEMON_AUTHENTICATION_H__
1230-#define __SYNCDAEMON_AUTHENTICATION_H__
1231-
1232-#include <glib-object.h>
1233-#include "syncdaemon-credentials.h"
1234-
1235-G_BEGIN_DECLS
1236-
1237-#define SYNCDAEMON_TYPE_AUTHENTICATION (syncdaemon_authentication_get_type ())
1238-#define SYNCDAEMON_AUTHENTICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_AUTHENTICATION, SyncdaemonAuthentication))
1239-#define SYNCDAEMON_IS_AUTHENTICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_AUTHENTICATION))
1240-#define SYNCDAEMON_AUTHENTICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_AUTHENTICATION, SyncdaemonAuthenticationClass))
1241-#define SYNCDAEMON_IS_AUTHENTICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_AUTHENTICATION))
1242-#define SYNCDAEMON_AUTHENTICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_AUTHENTICATION, SyncdaemonAuthenticationClass))
1243-
1244-typedef struct _SyncdaemonAuthenticationPrivate SyncdaemonAuthenticationPrivate;
1245-
1246-typedef struct {
1247- GObject parent;
1248- SyncdaemonAuthenticationPrivate *priv;
1249-} SyncdaemonAuthentication;
1250-
1251-typedef struct {
1252- GObjectClass parent_class;
1253-
1254- void (* credentials_found) (SyncdaemonAuthentication *auth, SyncdaemonCredentials *credentials);
1255- void (* authorization_cancelled) (SyncdaemonAuthentication *auth);
1256- void (* error) (SyncdaemonAuthentication *auth, const gchar *error);
1257-} SyncdaemonAuthenticationClass;
1258-
1259-GType syncdaemon_authentication_get_type (void);
1260-SyncdaemonAuthentication *syncdaemon_authentication_new (void);
1261-
1262-SyncdaemonCredentials *syncdaemon_authentication_find_credentials (SyncdaemonAuthentication *auth);
1263-gboolean syncdaemon_authentication_has_credentials (SyncdaemonAuthentication *auth);
1264-void syncdaemon_authentication_login_or_register (SyncdaemonAuthentication *auth);
1265-void syncdaemon_authentication_clear_token (SyncdaemonAuthentication *auth);
1266-
1267-G_END_DECLS
1268-
1269-#endif
1270
1271=== removed file 'libsyncdaemon/syncdaemon-config-interface.c'
1272--- libsyncdaemon/syncdaemon-config-interface.c 2012-04-09 20:07:05 +0000
1273+++ libsyncdaemon/syncdaemon-config-interface.c 1970-01-01 00:00:00 +0000
1274@@ -1,276 +0,0 @@
1275-/*
1276- * Syncdaemon API
1277- *
1278- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1279- *
1280- * Copyright 2010-2012 Canonical Ltd.
1281- *
1282- * This program is free software: you can redistribute it and/or modify it
1283- * under the terms of the GNU General Public License version 3, as published
1284- * by the Free Software Foundation.
1285- *
1286- * This program is distributed in the hope that it will be useful, but
1287- * WITHOUT ANY WARRANTY; without even the implied warranties of
1288- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1289- * PURPOSE. See the GNU General Public License for more details.
1290- *
1291- * You should have received a copy of the GNU General Public License along
1292- * with this program. If not, see <http://www.gnu.org/licenses/>.
1293- *
1294- * In addition, as a special exception, the copyright holders give
1295- * permission to link the code of portions of this program with the
1296- * OpenSSL library under certain conditions as described in each
1297- * individual source file, and distribute linked combinations
1298- * including the two.
1299- * You must obey the GNU General Public License in all respects
1300- * for all of the code used other than OpenSSL. If you modify
1301- * file(s) with this exception, you may extend this exception to your
1302- * version of the file(s), but you are not obligated to do so. If you
1303- * do not wish to do so, delete this exception statement from your
1304- * version. If you delete this exception statement from all source
1305- * files in the program, then also delete it here.
1306- *
1307- */
1308-
1309-#include "config.h"
1310-#ifdef HAVE_GDBUS
1311-#else
1312-#include <dbus/dbus-glib.h>
1313-#endif
1314-#include "syncdaemon-config-interface.h"
1315-
1316-G_DEFINE_TYPE(SyncdaemonConfigInterface, syncdaemon_config_interface, SYNCDAEMON_TYPE_INTERFACE)
1317-
1318-struct _SyncdaemonConfigInterfacePrivate {
1319- GObject *proxy;
1320-};
1321-
1322-static void
1323-syncdaemon_config_interface_finalize (GObject *object)
1324-{
1325- SyncdaemonConfigInterface *interface = SYNCDAEMON_CONFIG_INTERFACE (object);
1326-
1327- if (interface->priv != NULL) {
1328- g_free (interface->priv);
1329- }
1330-
1331- G_OBJECT_CLASS (syncdaemon_config_interface_parent_class)->finalize (object);
1332-}
1333-
1334-static void
1335-syncdaemon_config_interface_class_init (SyncdaemonConfigInterfaceClass *klass)
1336-{
1337- GObjectClass *object_class = G_OBJECT_CLASS (klass);
1338-
1339- object_class->finalize = syncdaemon_config_interface_finalize;
1340-}
1341-
1342-static void
1343-syncdaemon_config_interface_init (SyncdaemonConfigInterface *interface)
1344-{
1345- interface->priv = g_new0 (SyncdaemonConfigInterfacePrivate, 1);
1346-
1347- /* Setup DBus proxy */
1348- interface->priv->proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (interface),
1349- "com.ubuntuone.SyncDaemon",
1350- "/config", "com.ubuntuone.SyncDaemon.Config");
1351-}
1352-
1353-/**
1354- * syncdaemon_config_interface_new:
1355- */
1356-SyncdaemonConfigInterface *
1357-syncdaemon_config_interface_new (SyncdaemonDaemon *daemon)
1358-{
1359- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
1360-
1361- return g_object_new (SYNCDAEMON_TYPE_CONFIG_INTERFACE, "daemon", daemon, NULL);
1362-}
1363-
1364-static gboolean
1365-get_boolean_method (SyncdaemonConfigInterface *interface, const gchar *method)
1366-{
1367- gboolean enabled;
1368- GError *error = NULL;
1369-
1370- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), method, &error,
1371- G_TYPE_INVALID,
1372- G_TYPE_BOOLEAN, &enabled,
1373- G_TYPE_INVALID)) {
1374- g_warning ("Failed calling %s: %s", method, error->message);
1375- g_error_free (error);
1376-
1377- return FALSE;
1378- }
1379-
1380- return enabled;
1381-}
1382-
1383-static void
1384-enable_setting_method (SyncdaemonConfigInterface *interface,
1385- const gchar *enable_method,
1386- const gchar *disable_method,
1387- gboolean enabled)
1388-{
1389- GError *error = NULL;
1390-
1391- if (enabled) {
1392- dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), enable_method, &error,
1393- G_TYPE_INVALID,
1394- G_TYPE_INVALID);
1395- } else {
1396- dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), disable_method, &error,
1397- G_TYPE_INVALID,
1398- G_TYPE_INVALID);
1399- }
1400-
1401- if (error) {
1402- g_warning ("Failed calling %s: %s", enabled ? enable_method : disable_method, error->message);
1403- g_error_free (error);
1404- }
1405-}
1406-
1407-/**
1408- * syncdaemon_config_interface_get_bandwidth_throttling:
1409- */
1410-gboolean
1411-syncdaemon_config_interface_get_bandwidth_throttling (SyncdaemonConfigInterface *interface)
1412-{
1413- g_return_val_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface), FALSE);
1414-
1415- return get_boolean_method (interface, "bandwidth_throttling_enabled");
1416-}
1417-
1418-/**
1419- * syncdaemon_config_interface_set_bandwidth_throttling:
1420- */
1421-void
1422-syncdaemon_config_interface_set_bandwidth_throttling (SyncdaemonConfigInterface *interface, gboolean enabled)
1423-{
1424- g_return_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface));
1425-
1426- enable_setting_method (interface, "enable_bandwidth_throttling", "disable_bandwidth_throttling", enabled);
1427-}
1428-
1429-/**
1430- * syncdaemon_config_interface_get_files_sync:
1431- */
1432-gboolean
1433-syncdaemon_config_interface_get_files_sync (SyncdaemonConfigInterface *interface)
1434-{
1435- gboolean enabled;
1436- GError *error = NULL;
1437-
1438- g_return_val_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface), FALSE);
1439-
1440- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "files_sync_enabled", &error,
1441- G_TYPE_INVALID,
1442- G_TYPE_BOOLEAN, &enabled,
1443- G_TYPE_INVALID)) {
1444- g_warning ("Failed calling files_sync_enabled: %s", error->message);
1445- g_error_free (error);
1446-
1447- return FALSE;
1448- }
1449-
1450- return enabled;
1451-}
1452-
1453-/**
1454- * syncdaemon_config_interface_set_files_sync:
1455- */
1456-void
1457-syncdaemon_config_interface_set_files_sync (SyncdaemonConfigInterface *interface, gboolean enabled)
1458-{
1459- GError *error = NULL;
1460-
1461- g_return_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface));
1462-
1463- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "set_files_sync_enabled", &error,
1464- G_TYPE_BOOLEAN, enabled,
1465- G_TYPE_INVALID,
1466- G_TYPE_INVALID)) {
1467- g_warning ("Failed calling set_files_sync_enabled: %s", error->message);
1468- g_error_free (error);
1469- }
1470-}
1471-
1472-/**
1473- * syncdaemon_config_interface_get_throttling_limits:
1474- */
1475-void
1476-syncdaemon_config_interface_get_throttling_limits (SyncdaemonConfigInterface *interface,
1477- gint *download,
1478- gint *upload)
1479-{
1480- GHashTable *result;
1481- GError *error = NULL;
1482-
1483- g_return_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface));
1484-
1485- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "get_throttling_limits", &error,
1486- G_TYPE_INVALID,
1487- dbus_g_type_get_map ("GHashTable",
1488- G_TYPE_STRING,
1489- G_TYPE_INT), &result,
1490- G_TYPE_INVALID)) {
1491- g_warning ("Failed calling get_throttling_limits: %s", error->message);
1492- g_error_free (error);
1493- } else {
1494- gint *download_got, *upload_got;
1495-
1496- download_got = g_hash_table_lookup (result, "download");
1497- upload_got = g_hash_table_lookup (result, "upload");
1498-
1499- if (download != NULL)
1500- *download = *download_got;
1501- if (upload != NULL)
1502- *upload = *upload_got;
1503-
1504- g_hash_table_destroy (result);
1505- }
1506-}
1507-
1508-/**
1509- * syncdaemon_config_interface_set_throttling_limits:
1510- */
1511-void
1512-syncdaemon_config_interface_set_throttling_limits (SyncdaemonConfigInterface *interface,
1513- gint download,
1514- gint upload)
1515-{
1516- GError *error = NULL;
1517-
1518- g_return_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface));
1519-
1520- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "set_throttling_limits", &error,
1521- G_TYPE_INT, download,
1522- G_TYPE_INT, upload,
1523- G_TYPE_INVALID,
1524- G_TYPE_INVALID)) {
1525- g_warning ("Failed calling set_throttling_limits: %s", error->message);
1526- g_error_free (error);
1527- }
1528-}
1529-
1530-/**
1531- * syncdaemon_config_interface_get_udf_autosubscribe:
1532- */
1533-gboolean
1534-syncdaemon_config_interface_get_udf_autosubscribe (SyncdaemonConfigInterface *interface)
1535-{
1536- g_return_val_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface), FALSE);
1537-
1538- return get_boolean_method (interface, "udf_autosubscribe_enabled");
1539-}
1540-
1541-/**
1542- * syncdaemon_config_interface_set_bandwidth_throttling_enabled:
1543- */
1544-void
1545-syncdaemon_config_interface_set_udf_autosubscribe (SyncdaemonConfigInterface *interface, gboolean enabled)
1546-{
1547- g_return_if_fail (SYNCDAEMON_IS_CONFIG_INTERFACE (interface));
1548-
1549- enable_setting_method (interface, "enable_udf_autosubscribe", "disable_udf_autosubscribe", enabled);
1550-}
1551
1552=== removed file 'libsyncdaemon/syncdaemon-config-interface.h'
1553--- libsyncdaemon/syncdaemon-config-interface.h 2012-04-09 20:07:05 +0000
1554+++ libsyncdaemon/syncdaemon-config-interface.h 1970-01-01 00:00:00 +0000
1555@@ -1,83 +0,0 @@
1556-/*
1557- * Syncdaemon API
1558- *
1559- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1560- *
1561- * Copyright 2010-2012 Canonical Ltd.
1562- *
1563- * This program is free software: you can redistribute it and/or modify it
1564- * under the terms of the GNU General Public License version 3, as published
1565- * by the Free Software Foundation.
1566- *
1567- * This program is distributed in the hope that it will be useful, but
1568- * WITHOUT ANY WARRANTY; without even the implied warranties of
1569- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1570- * PURPOSE. See the GNU General Public License for more details.
1571- *
1572- * You should have received a copy of the GNU General Public License along
1573- * with this program. If not, see <http://www.gnu.org/licenses/>.
1574- *
1575- * In addition, as a special exception, the copyright holders give
1576- * permission to link the code of portions of this program with the
1577- * OpenSSL library under certain conditions as described in each
1578- * individual source file, and distribute linked combinations
1579- * including the two.
1580- * You must obey the GNU General Public License in all respects
1581- * for all of the code used other than OpenSSL. If you modify
1582- * file(s) with this exception, you may extend this exception to your
1583- * version of the file(s), but you are not obligated to do so. If you
1584- * do not wish to do so, delete this exception statement from your
1585- * version. If you delete this exception statement from all source
1586- * files in the program, then also delete it here.
1587- *
1588- */
1589-
1590-#ifndef __SYNCDAEMON_CONFIG_INTERFACE_H__
1591-#define __SYNCDAEMON_CONFIG_INTERFACE_H__
1592-
1593-#include "syncdaemon-daemon.h"
1594-#include "syncdaemon-interface.h"
1595-
1596-G_BEGIN_DECLS
1597-
1598-#define SYNCDAEMON_TYPE_CONFIG_INTERFACE (syncdaemon_config_interface_get_type ())
1599-#define SYNCDAEMON_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_CONFIG_INTERFACE, SyncdaemonConfigInterface))
1600-#define SYNCDAEMON_IS_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_CONFIG_INTERFACE))
1601-#define SYNCDAEMON_CONFIG_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_CONFIG_INTERFACE, SyncdaemonConfigInterfaceClass))
1602-#define SYNCDAEMON_IS_CONFIG_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_CONFIG_INTERFACE))
1603-#define SYNCDAEMON_CONFIG_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_CONFIG_INTERFACE, SyncdaemonConfigInterfaceClass))
1604-
1605-typedef struct _SyncdaemonConfigInterfacePrivate SyncdaemonConfigInterfacePrivate;
1606-
1607-typedef struct {
1608- SyncdaemonInterface parent;
1609- SyncdaemonConfigInterfacePrivate *priv;
1610-} SyncdaemonConfigInterface;
1611-
1612-typedef struct {
1613- SyncdaemonInterfaceClass parent_class;
1614-} SyncdaemonConfigInterfaceClass;
1615-
1616-GType syncdaemon_config_interface_get_type (void);
1617-
1618-SyncdaemonConfigInterface *syncdaemon_config_interface_new (SyncdaemonDaemon *daemon);
1619-
1620-gboolean syncdaemon_config_interface_get_bandwidth_throttling (SyncdaemonConfigInterface *interface);
1621-void syncdaemon_config_interface_set_bandwidth_throttling (SyncdaemonConfigInterface *interface,
1622- gboolean enabled);
1623-gboolean syncdaemon_config_interface_get_files_sync (SyncdaemonConfigInterface *interface);
1624-void syncdaemon_config_interface_set_files_sync (SyncdaemonConfigInterface *interface,
1625- gboolean enabled);
1626-void syncdaemon_config_interface_get_throttling_limits (SyncdaemonConfigInterface *interface,
1627- gint *download,
1628- gint *upload);
1629-void syncdaemon_config_interface_set_throttling_limits (SyncdaemonConfigInterface *interface,
1630- gint download,
1631- gint upload);
1632-gboolean syncdaemon_config_interface_get_udf_autosubscribe (SyncdaemonConfigInterface *interface);
1633-void syncdaemon_config_interface_set_udf_autosubscribe (SyncdaemonConfigInterface *interface,
1634- gboolean enabled);
1635-
1636-G_END_DECLS
1637-
1638-#endif
1639
1640=== removed file 'libsyncdaemon/syncdaemon-credentials.c'
1641--- libsyncdaemon/syncdaemon-credentials.c 2012-04-09 20:07:05 +0000
1642+++ libsyncdaemon/syncdaemon-credentials.c 1970-01-01 00:00:00 +0000
1643@@ -1,215 +0,0 @@
1644-/*
1645- * Syncdaemon API
1646- *
1647- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1648- *
1649- * Copyright 2010-2012 Canonical Ltd.
1650- *
1651- * This program is free software: you can redistribute it and/or modify it
1652- * under the terms of the GNU General Public License version 3, as published
1653- * by the Free Software Foundation.
1654- *
1655- * This program is distributed in the hope that it will be useful, but
1656- * WITHOUT ANY WARRANTY; without even the implied warranties of
1657- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1658- * PURPOSE. See the GNU General Public License for more details.
1659- *
1660- * You should have received a copy of the GNU General Public License along
1661- * with this program. If not, see <http://www.gnu.org/licenses/>.
1662- *
1663- * In addition, as a special exception, the copyright holders give
1664- * permission to link the code of portions of this program with the
1665- * OpenSSL library under certain conditions as described in each
1666- * individual source file, and distribute linked combinations
1667- * including the two.
1668- * You must obey the GNU General Public License in all respects
1669- * for all of the code used other than OpenSSL. If you modify
1670- * file(s) with this exception, you may extend this exception to your
1671- * version of the file(s), but you are not obligated to do so. If you
1672- * do not wish to do so, delete this exception statement from your
1673- * version. If you delete this exception statement from all source
1674- * files in the program, then also delete it here.
1675- *
1676- */
1677-
1678-#include "syncdaemon-credentials.h"
1679-
1680-G_DEFINE_TYPE(SyncdaemonCredentials, syncdaemon_credentials, G_TYPE_OBJECT)
1681-
1682-struct _SyncdaemonCredentialsPrivate {
1683- gchar *consumer_key;
1684- gchar *consumer_secret;
1685- gchar *token;
1686- gchar *token_secret;
1687-};
1688-
1689-static void
1690-syncdaemon_credentials_finalize (GObject *object)
1691-{
1692- SyncdaemonCredentials *credentials = SYNCDAEMON_CREDENTIALS (object);
1693-
1694- if (credentials->priv != NULL) {
1695- if (credentials->priv->consumer_key != NULL)
1696- g_free (credentials->priv->consumer_key);
1697- if (credentials->priv->consumer_secret != NULL)
1698- g_free (credentials->priv->consumer_secret);
1699- if (credentials->priv->token != NULL)
1700- g_free (credentials->priv->token);
1701- if (credentials->priv->token_secret != NULL)
1702- g_free (credentials->priv->token_secret);
1703-
1704- g_free (credentials->priv);
1705- }
1706-
1707- G_OBJECT_CLASS (syncdaemon_credentials_parent_class)->finalize (object);
1708-}
1709-
1710-static void
1711-syncdaemon_credentials_class_init (SyncdaemonCredentialsClass *klass)
1712-{
1713- GObjectClass *object_class = G_OBJECT_CLASS (klass);
1714-
1715- object_class->finalize = syncdaemon_credentials_finalize;
1716-}
1717-
1718-static void
1719-syncdaemon_credentials_init (SyncdaemonCredentials *credentials)
1720-{
1721- credentials->priv = g_new0 (SyncdaemonCredentialsPrivate, 1);
1722-}
1723-
1724-/**
1725- * syncdaemon_credentials_new:
1726- */
1727-SyncdaemonCredentials *
1728-syncdaemon_credentials_new (void)
1729-{
1730- return g_object_new (SYNCDAEMON_TYPE_CREDENTIALS, NULL);
1731-}
1732-
1733-/**
1734- * syncdaemon_credentials_new_from_hash_table:
1735- */
1736-SyncdaemonCredentials *
1737-syncdaemon_credentials_new_from_hash_table (GHashTable *hash)
1738-{
1739- SyncdaemonCredentials *credentials;
1740-
1741- credentials = g_object_new (SYNCDAEMON_TYPE_CREDENTIALS, NULL);
1742- if (hash != NULL) {
1743- syncdaemon_credentials_set_consumer_key (
1744- credentials,
1745- g_hash_table_lookup (hash, "consumer_key"));
1746- syncdaemon_credentials_set_consumer_secret (
1747- credentials,
1748- g_hash_table_lookup (hash, "consumer_secret"));
1749- syncdaemon_credentials_set_token (
1750- credentials,
1751- g_hash_table_lookup (hash, "token"));
1752- syncdaemon_credentials_set_token_secret (
1753- credentials,
1754- g_hash_table_lookup (hash, "token_secret"));
1755- }
1756-
1757- return credentials;
1758-}
1759-
1760-/**
1761- * syncdaemon_credentials_get_oauth_consumer_token:
1762- */
1763-const gchar *
1764-syncdaemon_credentials_get_consumer_key (SyncdaemonCredentials *credentials)
1765-{
1766- g_return_val_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials), NULL);
1767-
1768- return (const gchar *) credentials->priv->consumer_key;
1769-}
1770-
1771-/**
1772- * syncdaemon_credentials_set_consumer_key:
1773- */
1774-void
1775-syncdaemon_credentials_set_consumer_key (SyncdaemonCredentials *credentials, const gchar *consumer_key)
1776-{
1777- g_return_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials));
1778-
1779- if (credentials->priv->consumer_key != NULL)
1780- g_free (credentials->priv->consumer_key);
1781-
1782- credentials->priv->consumer_key = g_strdup (consumer_key);
1783-}
1784-
1785-/**
1786- * syncdaemon_credentials_get_consumer_secret:
1787- */
1788-const gchar *
1789-syncdaemon_credentials_get_consumer_secret (SyncdaemonCredentials *credentials)
1790-{
1791- g_return_val_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials), NULL);
1792-
1793- return (const gchar *) credentials->priv->consumer_secret;
1794-}
1795-
1796-/**
1797- * syncdaemon_credentials_set_consumer_secret:
1798- */
1799-void
1800-syncdaemon_credentials_set_consumer_secret (SyncdaemonCredentials *credentials, const gchar *consumer_secret)
1801-{
1802- g_return_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials));
1803-
1804- if (credentials->priv->consumer_secret != NULL)
1805- g_free (credentials->priv->consumer_secret);
1806-
1807- credentials->priv->consumer_secret = g_strdup (consumer_secret);
1808-}
1809-
1810-/**
1811- * syncdaemon_credentials_get_token:
1812- */
1813-const gchar *
1814-syncdaemon_credentials_get_token (SyncdaemonCredentials *credentials)
1815-{
1816- g_return_val_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials), NULL);
1817-
1818- return (const gchar *) credentials->priv->token;
1819-}
1820-
1821-/**
1822- * syncdaemon_credentials_set_token:
1823- */
1824-void
1825-syncdaemon_credentials_set_token (SyncdaemonCredentials *credentials, const gchar *token)
1826-{
1827- g_return_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials));
1828-
1829- if (credentials->priv->token != NULL)
1830- g_free (credentials->priv->token);
1831-
1832- credentials->priv->token = g_strdup (token);
1833-}
1834-
1835-/**
1836- * syncdaemon_credentials_get_token_secret:
1837- */
1838-const gchar *
1839-syncdaemon_credentials_get_token_secret (SyncdaemonCredentials *credentials)
1840-{
1841- g_return_val_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials), NULL);
1842-
1843- return (const gchar *) credentials->priv->token_secret;
1844-}
1845-
1846-/**
1847- * syncdaemon_credentials_set_token_secret:
1848- */
1849-void
1850-syncdaemon_credentials_set_token_secret (SyncdaemonCredentials *credentials, const gchar *token_secret)
1851-{
1852- g_return_if_fail (SYNCDAEMON_IS_CREDENTIALS (credentials));
1853-
1854- if (credentials->priv->token_secret != NULL)
1855- g_free (credentials->priv->token_secret);
1856-
1857- credentials->priv->token_secret = g_strdup (token_secret);
1858-}
1859
1860=== removed file 'libsyncdaemon/syncdaemon-credentials.h'
1861--- libsyncdaemon/syncdaemon-credentials.h 2012-04-09 20:07:05 +0000
1862+++ libsyncdaemon/syncdaemon-credentials.h 1970-01-01 00:00:00 +0000
1863@@ -1,75 +0,0 @@
1864-/*
1865- * Syncdaemon API
1866- *
1867- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1868- *
1869- * Copyright 2010-2012 Canonical Ltd.
1870- *
1871- * This program is free software: you can redistribute it and/or modify it
1872- * under the terms of the GNU General Public License version 3, as published
1873- * by the Free Software Foundation.
1874- *
1875- * This program is distributed in the hope that it will be useful, but
1876- * WITHOUT ANY WARRANTY; without even the implied warranties of
1877- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1878- * PURPOSE. See the GNU General Public License for more details.
1879- *
1880- * You should have received a copy of the GNU General Public License along
1881- * with this program. If not, see <http://www.gnu.org/licenses/>.
1882- *
1883- * In addition, as a special exception, the copyright holders give
1884- * permission to link the code of portions of this program with the
1885- * OpenSSL library under certain conditions as described in each
1886- * individual source file, and distribute linked combinations
1887- * including the two.
1888- * You must obey the GNU General Public License in all respects
1889- * for all of the code used other than OpenSSL. If you modify
1890- * file(s) with this exception, you may extend this exception to your
1891- * version of the file(s), but you are not obligated to do so. If you
1892- * do not wish to do so, delete this exception statement from your
1893- * version. If you delete this exception statement from all source
1894- * files in the program, then also delete it here.
1895- *
1896- */
1897-
1898-#ifndef __SYNCDAEMON_CREDENTIALS_H__
1899-#define __SYNCDAEMON_CREDENTIALS_H__
1900-
1901-#include <glib-object.h>
1902-
1903-G_BEGIN_DECLS
1904-
1905-#define SYNCDAEMON_TYPE_CREDENTIALS (syncdaemon_credentials_get_type ())
1906-#define SYNCDAEMON_CREDENTIALS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_CREDENTIALS, SyncdaemonCredentials))
1907-#define SYNCDAEMON_IS_CREDENTIALS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_CREDENTIALS))
1908-#define SYNCDAEMON_CREDENTIALS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_CREDENTIALS, SyncdaemonCredentialsClass))
1909-#define SYNCDAEMON_IS_CREDENTIALS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_CREDENTIALS))
1910-#define SYNCDAEMON_CREDENTIALS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_CREDENTIALS, SyncdaemonCredentialsClass))
1911-
1912-typedef struct _SyncdaemonCredentialsPrivate SyncdaemonCredentialsPrivate;
1913-
1914-typedef struct {
1915- GObject parent;
1916- SyncdaemonCredentialsPrivate *priv;
1917-} SyncdaemonCredentials;
1918-
1919-typedef struct {
1920- GObjectClass parent_class;
1921-} SyncdaemonCredentialsClass;
1922-
1923-GType syncdaemon_credentials_get_type (void);
1924-SyncdaemonCredentials *syncdaemon_credentials_new (void);
1925-SyncdaemonCredentials *syncdaemon_credentials_new_from_hash_table (GHashTable *hash);
1926-
1927-const gchar *syncdaemon_credentials_get_consumer_key (SyncdaemonCredentials *credentials);
1928-void syncdaemon_credentials_set_consumer_key (SyncdaemonCredentials *credentials, const gchar *consumer_key);
1929-const gchar *syncdaemon_credentials_get_consumer_secret (SyncdaemonCredentials *credentials);
1930-void syncdaemon_credentials_set_consumer_secret (SyncdaemonCredentials *credentials, const gchar *consumer_secret);
1931-const gchar *syncdaemon_credentials_get_token (SyncdaemonCredentials *credentials);
1932-void syncdaemon_credentials_set_token (SyncdaemonCredentials *credentials, const gchar *token);
1933-const gchar *syncdaemon_credentials_get_token_secret (SyncdaemonCredentials *credentials);
1934-void syncdaemon_credentials_set_token_secret (SyncdaemonCredentials *credentials, const gchar *token_secret);
1935-
1936-G_END_DECLS
1937-
1938-#endif
1939
1940=== removed file 'libsyncdaemon/syncdaemon-daemon.c'
1941--- libsyncdaemon/syncdaemon-daemon.c 2012-04-13 23:36:32 +0000
1942+++ libsyncdaemon/syncdaemon-daemon.c 1970-01-01 00:00:00 +0000
1943@@ -1,1477 +0,0 @@
1944-/*
1945- * Syncdaemon API
1946- *
1947- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
1948- *
1949- * Copyright 2010-2012 Canonical Ltd.
1950- *
1951- * This program is free software: you can redistribute it and/or modify it
1952- * under the terms of the GNU General Public License version 3, as published
1953- * by the Free Software Foundation.
1954- *
1955- * This program is distributed in the hope that it will be useful, but
1956- * WITHOUT ANY WARRANTY; without even the implied warranties of
1957- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1958- * PURPOSE. See the GNU General Public License for more details.
1959- *
1960- * You should have received a copy of the GNU General Public License along
1961- * with this program. If not, see <http://www.gnu.org/licenses/>.
1962- *
1963- * In addition, as a special exception, the copyright holders give
1964- * permission to link the code of portions of this program with the
1965- * OpenSSL library under certain conditions as described in each
1966- * individual source file, and distribute linked combinations
1967- * including the two.
1968- * You must obey the GNU General Public License in all respects
1969- * for all of the code used other than OpenSSL. If you modify
1970- * file(s) with this exception, you may extend this exception to your
1971- * version of the file(s), but you are not obligated to do so. If you
1972- * do not wish to do so, delete this exception statement from your
1973- * version. If you delete this exception statement from all source
1974- * files in the program, then also delete it here.
1975- *
1976- */
1977-
1978-#include "config.h"
1979-#include <string.h>
1980-#ifdef HAVE_GDBUS
1981-#include <gio/gio.h>
1982-#else
1983-#include <dbus/dbus-glib.h>
1984-#include <dbus/dbus-glib-bindings.h>
1985-#endif
1986-#include "syncdaemon-daemon.h"
1987-#include "syncdaemon-config-interface.h"
1988-#include "syncdaemon-events-interface.h"
1989-#include "syncdaemon-filesystem-interface.h"
1990-#include "syncdaemon-folders-interface.h"
1991-#include "syncdaemon-publicfiles-interface.h"
1992-#include "syncdaemon-shares-interface.h"
1993-#include "syncdaemon-status-interface.h"
1994-#include "syncdaemon-marshal.h"
1995-
1996-#define SYNCDAEMON_DBUS_NAME "com.ubuntuone.SyncDaemon"
1997-
1998-G_DEFINE_TYPE(SyncdaemonDaemon, syncdaemon_daemon, G_TYPE_OBJECT)
1999-
2000-struct _SyncdaemonDaemonPrivate {
2001-#ifdef HAVE_GDBUS
2002- GDBusConnection *bus;
2003- GDbusProxy *dbus_proxy;
2004-#else
2005- DBusGConnection *bus;
2006- DBusGProxy *dbus_proxy;
2007-#endif
2008-
2009- /* Interfaces */
2010- GObject *daemon_interface;
2011- GHashTable *subinterfaces;
2012-
2013- /* Status */
2014- gboolean ready;
2015- gboolean connected;
2016- gchar *root_dir;
2017- SyncdaemonAuthentication *auth;
2018-};
2019-
2020-/* Signals */
2021-enum {
2022- READY_SIGNAL,
2023- CONNECTED_SIGNAL,
2024- DISCONNECTED_SIGNAL,
2025- STATUS_CHANGED_SIGNAL,
2026- ERROR_SIGNAL,
2027- EVENT_SIGNAL,
2028- FOLDER_CREATED_SIGNAL,
2029- FOLDER_DELETED_SIGNAL,
2030- FOLDER_SUBSCRIBED_SIGNAL,
2031- FOLDER_UNSUBSCRIBED_SIGNAL,
2032- FILE_PUBLISHED_SIGNAL,
2033- FILE_UNPUBLISHED_SIGNAL,
2034- SHARE_CREATED_SIGNAL,
2035- SHARE_DELETED_SIGNAL,
2036- DOWNLOAD_STARTED_SIGNAL,
2037- DOWNLOAD_FILE_PROGRESS_SIGNAL,
2038- DOWNLOAD_FINISHED_SIGNAL,
2039- UPLOAD_STARTED_SIGNAL,
2040- UPLOAD_FILE_PROGRESS_SIGNAL,
2041- UPLOAD_FINISHED_SIGNAL,
2042- QUOTA_EXCEEDED_SIGNAL,
2043- LAST_SIGNAL
2044-};
2045-
2046-static guint daemon_signals[LAST_SIGNAL] = { 0, };
2047-
2048-static void
2049-syncdaemon_daemon_finalize (GObject *object)
2050-{
2051- SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (object);
2052-
2053- if (daemon->priv != NULL) {
2054- g_hash_table_destroy (daemon->priv->subinterfaces);
2055-
2056- if (daemon->priv->dbus_proxy != NULL)
2057- g_object_unref (daemon->priv->dbus_proxy);
2058-
2059- if (daemon->priv->bus != NULL) {
2060-#ifdef HAVE_GDBUS
2061- g_object_unref (G_OBJECT (daemon->priv->bus));
2062-#else
2063- dbus_g_connection_unref (daemon->priv->bus);
2064-#endif
2065- }
2066-
2067- if (daemon->priv->root_dir != NULL)
2068- g_free (daemon->priv->root_dir);
2069-
2070- if (daemon->priv->auth != NULL)
2071- g_object_unref (G_OBJECT (daemon->priv->auth));
2072-
2073- g_free (daemon->priv);
2074- }
2075-
2076- G_OBJECT_CLASS (syncdaemon_daemon_parent_class)->finalize (object);
2077-}
2078-
2079-static void
2080-syncdaemon_daemon_class_init (SyncdaemonDaemonClass *klass)
2081-{
2082- GObjectClass *object_class = G_OBJECT_CLASS (klass);
2083-
2084- object_class->finalize = syncdaemon_daemon_finalize;
2085-
2086- /* Register signals */
2087- daemon_signals[READY_SIGNAL] = g_signal_new ("ready",
2088- G_TYPE_FROM_CLASS (klass),
2089- (GSignalFlags) G_SIGNAL_RUN_LAST,
2090- G_STRUCT_OFFSET (SyncdaemonDaemonClass, ready),
2091- NULL, NULL,
2092- g_cclosure_marshal_VOID__VOID,
2093- G_TYPE_NONE, 0);
2094- daemon_signals[CONNECTED_SIGNAL] = g_signal_new ("connected",
2095- G_TYPE_FROM_CLASS (klass),
2096- (GSignalFlags) G_SIGNAL_RUN_LAST,
2097- G_STRUCT_OFFSET (SyncdaemonDaemonClass, connected),
2098- NULL, NULL,
2099- g_cclosure_marshal_VOID__VOID,
2100- G_TYPE_NONE, 0);
2101- daemon_signals[DISCONNECTED_SIGNAL] = g_signal_new ("disconnected",
2102- G_TYPE_FROM_CLASS (klass),
2103- (GSignalFlags) G_SIGNAL_RUN_LAST,
2104- G_STRUCT_OFFSET (SyncdaemonDaemonClass, disconnected),
2105- NULL, NULL,
2106- g_cclosure_marshal_VOID__VOID,
2107- G_TYPE_NONE, 0);
2108- daemon_signals[STATUS_CHANGED_SIGNAL] = g_signal_new ("status_changed",
2109- G_TYPE_FROM_CLASS (klass),
2110- (GSignalFlags) G_SIGNAL_RUN_LAST,
2111- G_STRUCT_OFFSET (SyncdaemonDaemonClass, status_changed),
2112- NULL, NULL,
2113- g_cclosure_marshal_VOID__OBJECT,
2114- G_TYPE_NONE, 1,
2115- G_TYPE_OBJECT);
2116- daemon_signals[EVENT_SIGNAL] = g_signal_new ("event",
2117- G_TYPE_FROM_CLASS (klass),
2118- (GSignalFlags) G_SIGNAL_RUN_LAST,
2119- G_STRUCT_OFFSET (SyncdaemonDaemonClass, event),
2120- NULL, NULL,
2121- g_cclosure_marshal_VOID__POINTER,
2122- G_TYPE_NONE, 1,
2123- G_TYPE_POINTER);
2124- daemon_signals[ERROR_SIGNAL] = g_signal_new ("error",
2125- G_TYPE_FROM_CLASS (klass),
2126- (GSignalFlags) G_SIGNAL_RUN_LAST,
2127- G_STRUCT_OFFSET (SyncdaemonDaemonClass, error),
2128- NULL, NULL,
2129- _syncdaemon_marshal_VOID__STRING_POINTER,
2130- G_TYPE_NONE, 2,
2131- G_TYPE_STRING, G_TYPE_POINTER);
2132- daemon_signals[FOLDER_CREATED_SIGNAL] = g_signal_new ("folder_created",
2133- G_TYPE_FROM_CLASS (klass),
2134- (GSignalFlags) G_SIGNAL_RUN_LAST,
2135- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_created),
2136- NULL, NULL,
2137- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2138- G_TYPE_NONE, 2,
2139- G_TYPE_BOOLEAN,
2140- G_TYPE_OBJECT);
2141- daemon_signals[FOLDER_DELETED_SIGNAL] = g_signal_new ("folder_deleted",
2142- G_TYPE_FROM_CLASS (klass),
2143- (GSignalFlags) G_SIGNAL_RUN_LAST,
2144- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_deleted),
2145- NULL, NULL,
2146- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2147- G_TYPE_NONE, 2,
2148- G_TYPE_BOOLEAN,
2149- G_TYPE_OBJECT);
2150- daemon_signals[FOLDER_SUBSCRIBED_SIGNAL] = g_signal_new ("folder_subscribed",
2151- G_TYPE_FROM_CLASS (klass),
2152- (GSignalFlags) G_SIGNAL_RUN_LAST,
2153- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_subscribed),
2154- NULL, NULL,
2155- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2156- G_TYPE_NONE, 2,
2157- G_TYPE_BOOLEAN,
2158- G_TYPE_OBJECT);
2159- daemon_signals[FOLDER_UNSUBSCRIBED_SIGNAL] = g_signal_new ("folder_unsubscribed",
2160- G_TYPE_FROM_CLASS (klass),
2161- (GSignalFlags) G_SIGNAL_RUN_LAST,
2162- G_STRUCT_OFFSET (SyncdaemonDaemonClass, folder_unsubscribed),
2163- NULL, NULL,
2164- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2165- G_TYPE_NONE, 2,
2166- G_TYPE_BOOLEAN,
2167- G_TYPE_OBJECT);
2168- daemon_signals[FILE_PUBLISHED_SIGNAL] = g_signal_new ("file_published",
2169- G_TYPE_FROM_CLASS (klass),
2170- (GSignalFlags) G_SIGNAL_RUN_LAST,
2171- G_STRUCT_OFFSET (SyncdaemonDaemonClass, file_published),
2172- NULL, NULL,
2173- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2174- G_TYPE_NONE, 2,
2175- G_TYPE_BOOLEAN,
2176- G_TYPE_OBJECT);
2177- daemon_signals[FILE_UNPUBLISHED_SIGNAL] = g_signal_new ("file_unpublished",
2178- G_TYPE_FROM_CLASS (klass),
2179- (GSignalFlags) G_SIGNAL_RUN_LAST,
2180- G_STRUCT_OFFSET (SyncdaemonDaemonClass, file_unpublished),
2181- NULL, NULL,
2182- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2183- G_TYPE_NONE, 2,
2184- G_TYPE_BOOLEAN,
2185- G_TYPE_OBJECT);
2186- daemon_signals[SHARE_CREATED_SIGNAL] = g_signal_new ("share_created",
2187- G_TYPE_FROM_CLASS (klass),
2188- (GSignalFlags) G_SIGNAL_RUN_LAST,
2189- G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_created),
2190- NULL, NULL,
2191- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2192- G_TYPE_NONE, 2,
2193- G_TYPE_BOOLEAN,
2194- G_TYPE_OBJECT);
2195- daemon_signals[SHARE_DELETED_SIGNAL] = g_signal_new ("share_deleted",
2196- G_TYPE_FROM_CLASS (klass),
2197- (GSignalFlags) G_SIGNAL_RUN_LAST,
2198- G_STRUCT_OFFSET (SyncdaemonDaemonClass, share_deleted),
2199- NULL, NULL,
2200- _syncdaemon_marshal_VOID__BOOLEAN_OBJECT,
2201- G_TYPE_NONE, 2,
2202- G_TYPE_BOOLEAN,
2203- G_TYPE_OBJECT);
2204- daemon_signals[DOWNLOAD_STARTED_SIGNAL] = g_signal_new ("download_started",
2205- G_TYPE_FROM_CLASS (klass),
2206- (GSignalFlags) G_SIGNAL_RUN_LAST,
2207- G_STRUCT_OFFSET (SyncdaemonDaemonClass, download_started),
2208- NULL, NULL,
2209- g_cclosure_marshal_VOID__STRING,
2210- G_TYPE_NONE, 1,
2211- G_TYPE_STRING);
2212- daemon_signals[DOWNLOAD_FILE_PROGRESS_SIGNAL] = g_signal_new ("download_file_progress",
2213- G_TYPE_FROM_CLASS (klass),
2214- (GSignalFlags) G_SIGNAL_RUN_LAST,
2215- G_STRUCT_OFFSET (SyncdaemonDaemonClass, download_file_progress),
2216- NULL, NULL,
2217- _syncdaemon_marshal_VOID__STRING_OBJECT,
2218- G_TYPE_NONE, 2,
2219- G_TYPE_STRING, G_TYPE_OBJECT);
2220- daemon_signals[DOWNLOAD_FINISHED_SIGNAL] = g_signal_new ("download_finished",
2221- G_TYPE_FROM_CLASS (klass),
2222- (GSignalFlags) G_SIGNAL_RUN_LAST,
2223- G_STRUCT_OFFSET (SyncdaemonDaemonClass, download_finished),
2224- NULL, NULL,
2225- _syncdaemon_marshal_VOID__STRING_OBJECT,
2226- G_TYPE_NONE, 2,
2227- G_TYPE_STRING, G_TYPE_OBJECT);
2228- daemon_signals[UPLOAD_STARTED_SIGNAL] = g_signal_new ("upload_started",
2229- G_TYPE_FROM_CLASS (klass),
2230- (GSignalFlags) G_SIGNAL_RUN_LAST,
2231- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_started),
2232- NULL, NULL,
2233- g_cclosure_marshal_VOID__STRING,
2234- G_TYPE_NONE, 1,
2235- G_TYPE_STRING);
2236- daemon_signals[UPLOAD_FILE_PROGRESS_SIGNAL] = g_signal_new ("upload_file_progress",
2237- G_TYPE_FROM_CLASS (klass),
2238- (GSignalFlags) G_SIGNAL_RUN_LAST,
2239- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_file_progress),
2240- NULL, NULL,
2241- _syncdaemon_marshal_VOID__STRING_OBJECT,
2242- G_TYPE_NONE, 2,
2243- G_TYPE_STRING, G_TYPE_OBJECT);
2244- daemon_signals[UPLOAD_FINISHED_SIGNAL] = g_signal_new ("upload_finished",
2245- G_TYPE_FROM_CLASS (klass),
2246- (GSignalFlags) G_SIGNAL_RUN_LAST,
2247- G_STRUCT_OFFSET (SyncdaemonDaemonClass, upload_finished),
2248- NULL, NULL,
2249- _syncdaemon_marshal_VOID__STRING_OBJECT,
2250- G_TYPE_NONE, 2,
2251- G_TYPE_STRING, G_TYPE_OBJECT);
2252- daemon_signals[QUOTA_EXCEEDED_SIGNAL] = g_signal_new ("quota_exceeded",
2253- G_TYPE_FROM_CLASS (klass),
2254- (GSignalFlags) G_SIGNAL_RUN_LAST,
2255- G_STRUCT_OFFSET (SyncdaemonDaemonClass, quota_exceeded),
2256- NULL, NULL,
2257- g_cclosure_marshal_VOID__POINTER,
2258- G_TYPE_NONE, 1,
2259- G_TYPE_POINTER);
2260-}
2261-
2262-static void
2263-quota_exceeded_cb (DBusGProxy *proxy, GHashTable *volume_info, gpointer user_data)
2264-{
2265- SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
2266-
2267- if (daemon != NULL)
2268- g_signal_emit_by_name (daemon, "quota_exceeded", volume_info);
2269-}
2270-
2271-static gboolean
2272-ready_signal_idle_cb (gpointer user_data)
2273-{
2274- SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
2275-
2276- g_signal_emit (daemon, daemon_signals[READY_SIGNAL], 0);
2277-
2278- return FALSE;
2279-}
2280-
2281-static void
2282-setup_daemon_interface (SyncdaemonDaemon *daemon)
2283-{
2284- GObject *proxy = NULL;
2285-
2286- if (daemon->priv->daemon_interface != NULL)
2287- g_object_unref (daemon->priv->daemon_interface);
2288- daemon->priv->daemon_interface = g_object_new (SYNCDAEMON_TYPE_INTERFACE,
2289- "daemon", daemon,
2290- NULL);
2291- proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface),
2292- SYNCDAEMON_DBUS_NAME, "/",
2293- "com.ubuntuone.SyncDaemon.SyncDaemon");
2294- if (proxy != NULL) {
2295- daemon->priv->ready = TRUE;
2296-
2297- dbus_g_proxy_add_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
2298- dbus_g_type_get_map ("GHashTable",
2299- G_TYPE_STRING,
2300- G_TYPE_STRING),
2301- G_TYPE_INVALID);
2302- dbus_g_proxy_connect_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
2303- G_CALLBACK (quota_exceeded_cb),
2304- daemon, NULL);
2305-
2306- /* Now get all the interfaces so that we get the signals from them */
2307- syncdaemon_daemon_get_config_interface (daemon);
2308- syncdaemon_daemon_get_events_interface (daemon);
2309- syncdaemon_daemon_get_filesystem_interface (daemon);
2310- syncdaemon_daemon_get_folders_interface (daemon);
2311- syncdaemon_daemon_get_publicfiles_interface (daemon);
2312- syncdaemon_daemon_get_shares_interface (daemon);
2313- syncdaemon_daemon_get_status_interface (daemon);
2314-
2315- /* Emit the signal in an idle callback so that callers get it when syncdaemon is running
2316- and hence signal is emitted in the _init method */
2317- g_idle_add ((GSourceFunc) ready_signal_idle_cb, daemon);
2318- }
2319-
2320-}
2321-
2322-static void
2323-name_owner_changed_cb (DBusGProxy *proxy,
2324- const char *name,
2325- const char *old_owner,
2326- const char *new_owner,
2327- gpointer user_data)
2328-{
2329- SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
2330-
2331- if (g_strcmp0 (name, SYNCDAEMON_DBUS_NAME) == 0) {
2332- if (new_owner != NULL && strlen (new_owner) > 0) {
2333- g_debug ("Got notification of SyncDaemon startup in NameOwnerChanged");
2334- setup_daemon_interface (daemon);
2335- } else {
2336- daemon->priv->ready = FALSE;
2337-
2338- g_debug ("Syncdaemon service died");
2339- if (daemon->priv->daemon_interface != NULL) {
2340- g_object_unref (daemon->priv->daemon_interface);
2341- daemon->priv->daemon_interface = NULL;
2342- }
2343-
2344- g_hash_table_remove_all (daemon->priv->subinterfaces);
2345- daemon->priv->connected = FALSE;
2346- }
2347- }
2348-}
2349-
2350-static void
2351-syncdaemon_daemon_init (SyncdaemonDaemon *daemon)
2352-{
2353- gboolean has_owner;
2354- GError *error = NULL;
2355-
2356- daemon->priv = g_new0 (SyncdaemonDaemonPrivate, 1);
2357-
2358- daemon->priv->ready = FALSE;
2359- daemon->priv->connected = FALSE;
2360- daemon->priv->subinterfaces = g_hash_table_new_full (g_str_hash, g_str_equal,
2361- g_free, g_object_unref);
2362- daemon->priv->auth = g_object_new (SYNCDAEMON_TYPE_AUTHENTICATION, NULL);
2363-
2364- /* Initialize DBus */
2365-#ifdef HAVE_GDBUS
2366- daemon->priv->bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
2367-#else
2368- daemon->priv->bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
2369-#endif
2370- if (error != NULL) {
2371- g_warning ("Couldn't get session bus: %s", error->message);
2372- g_error_free (error);
2373- return;
2374- }
2375-
2376- daemon->priv->dbus_proxy = dbus_g_proxy_new_for_name (daemon->priv->bus,
2377- "org.freedesktop.DBus",
2378- "/org/freedesktop/DBus",
2379- "org.freedesktop.DBus");
2380-
2381- /* Check if syncdaemon is running */
2382- error = NULL;
2383- if (org_freedesktop_DBus_name_has_owner (daemon->priv->dbus_proxy, SYNCDAEMON_DBUS_NAME, &has_owner, &error)) {
2384- if (has_owner) {
2385- /* Already running, so initialize ourselves */
2386- g_debug ("SyncDaemon already running, initializing SyncdaemonDaemon object");
2387- setup_daemon_interface (daemon);
2388- } else
2389- g_debug ("Syncdaemon not running, waiting for it to start in NameOwnerChanged");
2390- } else {
2391- /* The DBus call failed, so just wait for SyncDaemon to start in name_owner_changed_cb */
2392- g_warning ("Error calling NameHasOwner: %s", error->message);
2393- g_error_free (error);
2394- }
2395-
2396- /* Listen to DBus for syncdaemon restarts */
2397- dbus_g_proxy_add_signal (DBUS_G_PROXY (daemon->priv->dbus_proxy), "NameOwnerChanged",
2398- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
2399- G_TYPE_INVALID);
2400- dbus_g_proxy_connect_signal (DBUS_G_PROXY (daemon->priv->dbus_proxy),
2401- "NameOwnerChanged",
2402- G_CALLBACK (name_owner_changed_cb),
2403- daemon, NULL);
2404-}
2405-
2406-/**
2407- * syncdaemon_daemon_new:
2408- *
2409- * Create a new #SyncdaemonDaemon object, which provides access to the
2410- * Syncdaemon daemon.
2411- *
2412- * Return value: A new #SyncdaemonDaemon object.
2413- */
2414-SyncdaemonDaemon *
2415-syncdaemon_daemon_new (void)
2416-{
2417- return g_object_new (SYNCDAEMON_TYPE_DAEMON, NULL);
2418-}
2419-
2420-/**
2421- * syncdaemon_daemon_is_ready:
2422- */
2423-gboolean
2424-syncdaemon_daemon_is_ready (SyncdaemonDaemon *daemon)
2425-{
2426- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2427-
2428- return daemon->priv->ready;
2429-}
2430-
2431-static void
2432-connect_response_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
2433-{
2434- GError *error = NULL;
2435- SyncdaemonDaemon *daemon = (SyncdaemonDaemon *) user_data;
2436-
2437- if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
2438- daemon->priv->connected = TRUE;
2439- g_signal_emit (daemon, daemon_signals[CONNECTED_SIGNAL], 0);
2440- } else {
2441- g_warning ("Syncdaemon cannot connect: %s", error->message);
2442- g_error_free (error);
2443- }
2444-}
2445-
2446-/**
2447- * syncdaemon_daemon_connect:
2448- */
2449-gboolean
2450-syncdaemon_daemon_connect (SyncdaemonDaemon *daemon)
2451-{
2452- GObject *proxy;
2453-
2454- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2455-
2456- proxy = syncdaemon_interface_get_proxy_object (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface));
2457- if (proxy != NULL) {
2458-#ifdef HAVE_GDBUS
2459-#else
2460- if (!dbus_g_proxy_begin_call (DBUS_G_PROXY (proxy), "connect",
2461- connect_response_cb, daemon, NULL,
2462- G_TYPE_INVALID)) {
2463- g_warning ("Call to 'connect' method failed");
2464-
2465- return FALSE;
2466- }
2467-#endif
2468- }
2469-
2470- return TRUE;
2471-}
2472-
2473-static void
2474-disconnect_response_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
2475-{
2476- GError *error = NULL;
2477- SyncdaemonDaemon *daemon = (SyncdaemonDaemon *) user_data;
2478-
2479- if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
2480- daemon->priv->connected = FALSE;
2481- g_signal_emit (daemon, daemon_signals[DISCONNECTED_SIGNAL], 0);
2482- } else {
2483- g_warning ("Syncdaemon cannot disconnect: %s", error->message);
2484- g_error_free (error);
2485- }
2486-}
2487-
2488-/**
2489- * syncdaemon_daemon_interface_disconnect:
2490- */
2491-gboolean
2492-syncdaemon_daemon_disconnect (SyncdaemonDaemon *daemon)
2493-{
2494- GObject *proxy;
2495-
2496- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2497-
2498- proxy = syncdaemon_interface_get_proxy_object (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface));
2499- if (proxy != NULL) {
2500-#ifdef HAVE_GDBUS
2501-#else
2502- if (!dbus_g_proxy_begin_call (DBUS_G_PROXY (proxy), "disconnect",
2503- disconnect_response_cb, daemon, NULL,
2504- G_TYPE_INVALID)) {
2505- g_warning ("Call to 'disconnect' method failed");
2506-
2507- return FALSE;
2508- }
2509-#endif
2510- }
2511-
2512- return TRUE;
2513-}
2514-
2515-/**
2516- * syncdaemon_daemon_interface_quit:
2517- */
2518-gboolean
2519-syncdaemon_daemon_quit (SyncdaemonDaemon *daemon)
2520-{
2521- GObject *proxy;
2522-
2523- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2524-
2525- proxy = syncdaemon_interface_get_proxy_object (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface));
2526- if (proxy != NULL) {
2527- GError *error = NULL;
2528-
2529-#ifdef HAVE_GDBUS
2530-#else
2531- if (!dbus_g_proxy_call (DBUS_G_PROXY (proxy), "quit", &error,
2532- G_TYPE_INVALID,
2533- G_TYPE_INVALID)) {
2534- g_warning ("Could not quit syncdaemon: %s", error->message);
2535- g_error_free (error);
2536-
2537- return FALSE;
2538- }
2539-#endif
2540- }
2541-
2542- return TRUE;
2543-}
2544-
2545-/**
2546- * syncdaemon_daemon_get_root_dir:
2547- */
2548-const gchar *
2549-syncdaemon_daemon_get_root_dir (SyncdaemonDaemon *daemon)
2550-{
2551- GObject *proxy;
2552-
2553- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
2554-
2555- if (daemon->priv->root_dir != NULL)
2556- return (const gchar *) daemon->priv->root_dir;
2557-
2558- proxy = syncdaemon_interface_get_proxy_object (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface));
2559- if (proxy != NULL) {
2560- gchar *new_root_dir;
2561- GError *error = NULL;
2562-
2563-#ifdef HAVE_GDBUS
2564-#else
2565- if (!dbus_g_proxy_call (DBUS_G_PROXY (proxy), "get_rootdir", &error,
2566- G_TYPE_INVALID,
2567- G_TYPE_STRING, &new_root_dir,
2568- G_TYPE_INVALID)) {
2569- g_warning ("Could not get syncdaemon's root dir: %s", error->message);
2570- g_error_free (error);
2571-
2572- return NULL;
2573- }
2574-#endif
2575-
2576- daemon->priv->root_dir = new_root_dir;
2577-
2578- return (const gchar *) daemon->priv->root_dir;
2579- }
2580-
2581- return NULL;
2582-}
2583-
2584-/**
2585- * syncdaemon_daemon_has_network:
2586- */
2587-gboolean
2588-syncdaemon_daemon_has_network (SyncdaemonDaemon *daemon)
2589-{
2590- SyncdaemonInterface *interface;
2591- gboolean result = FALSE;
2592-
2593- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2594-
2595- interface = syncdaemon_daemon_get_status_interface (daemon);
2596- if (SYNCDAEMON_IS_STATUS_INTERFACE (interface)) {
2597- SyncdaemonStatusInfo *status_info;
2598-
2599- status_info = syncdaemon_status_interface_get_current_status (SYNCDAEMON_STATUS_INTERFACE (interface));
2600- if (g_strrstr (syncdaemon_status_info_get_connection (status_info), "With Network") != NULL)
2601- result = TRUE;
2602-
2603- g_object_unref (G_OBJECT (status_info));
2604- }
2605-
2606- return result;
2607-}
2608-
2609-/**
2610- * syncdaemon_daemon_get_authentication:
2611- */
2612-SyncdaemonAuthentication *
2613-syncdaemon_daemon_get_authentication (SyncdaemonDaemon *daemon)
2614-{
2615- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
2616-
2617- return daemon->priv->auth;
2618-}
2619-
2620-/**
2621- * syncdaemon_daemon_get_bandwidth_throttling:
2622- * @daemon: A #SyncdaemonDaemon object
2623- *
2624- * Get whether bandwidth throttling is enabled or not.
2625- *
2626- * Return value: TRUE if enabled, FALSE if disabled.
2627- */
2628-gboolean
2629-syncdaemon_daemon_get_bandwidth_throttling (SyncdaemonDaemon *daemon)
2630-{
2631- SyncdaemonInterface *interface;
2632-
2633- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2634-
2635- interface = syncdaemon_daemon_get_config_interface (daemon);
2636- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2637- return syncdaemon_config_interface_get_bandwidth_throttling (SYNCDAEMON_CONFIG_INTERFACE (interface));
2638-
2639- return FALSE;
2640-}
2641-
2642-/**
2643- * syncdaemon_daemon_set_bandwidth_throttling:
2644- * @daemon: A #SyncdaemonDaemon object
2645- * @enabled: Whether to enable bandwidth throttling or not.
2646- *
2647- * Enable or disable bandwidth throttling.
2648- */
2649-void
2650-syncdaemon_daemon_set_bandwidth_throttling (SyncdaemonDaemon *daemon, gboolean enabled)
2651-{
2652- SyncdaemonInterface *interface;
2653-
2654- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2655-
2656- interface = syncdaemon_daemon_get_config_interface (daemon);
2657- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2658- syncdaemon_config_interface_set_bandwidth_throttling (SYNCDAEMON_CONFIG_INTERFACE (interface), enabled);
2659-}
2660-
2661-/**
2662- * syncdaemon_daemon_get_files_sync:
2663- * @daemon: A #SyncdaemonDaemon object
2664- *
2665- * Get whether file syncing is enabled or not.
2666- *
2667- * Return value: TRUE if enabled, FALSE if disabled.
2668- */
2669-gboolean
2670-syncdaemon_daemon_get_files_sync (SyncdaemonDaemon *daemon)
2671-{
2672- SyncdaemonInterface *interface;
2673-
2674- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2675-
2676- interface = syncdaemon_daemon_get_config_interface (daemon);
2677- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2678- return syncdaemon_config_interface_get_files_sync (SYNCDAEMON_CONFIG_INTERFACE (interface));
2679-
2680- return FALSE;
2681-}
2682-
2683-/**
2684- * syncdaemon_daemon_set_files_sync:
2685- * @daemon: A #SyncdaemonDaemon object
2686- * @enabled: Whether to enable file syncing or not.
2687- *
2688- * Enable or disable file syncing.
2689- */
2690-void
2691-syncdaemon_daemon_set_files_sync (SyncdaemonDaemon *daemon, gboolean enabled)
2692-{
2693- SyncdaemonInterface *interface;
2694-
2695- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2696-
2697- interface = syncdaemon_daemon_get_config_interface (daemon);
2698- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2699- syncdaemon_config_interface_set_files_sync (SYNCDAEMON_CONFIG_INTERFACE (interface), enabled);
2700-}
2701-
2702-/**
2703- * syncdaemon_daemon_get_throttling_limits:
2704- * @daemon: A #SyncdaemonDaemon object
2705- * @download: Placeholder for download limits
2706- * @upload: Placeholder for upload limits
2707- *
2708- * Retrieve download and upload throttling limits.
2709- */
2710-void
2711-syncdaemon_daemon_get_throttling_limits (SyncdaemonDaemon *daemon, gint *download, gint *upload)
2712-{
2713- SyncdaemonInterface *interface;
2714-
2715- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2716-
2717- interface = syncdaemon_daemon_get_config_interface (daemon);
2718- if (interface != NULL) {
2719- syncdaemon_config_interface_get_throttling_limits (SYNCDAEMON_CONFIG_INTERFACE (interface),
2720- download,
2721- upload);
2722- }
2723-}
2724-
2725-/**
2726- * syncdaemon_daemon_set_throttling_limits:
2727- * @daemon: A #SyncdaemonDaemon object
2728- * @download: Download limit
2729- * @upload: Upload limit
2730- *
2731- * Set download and upload throttling limits.
2732- */
2733-void
2734-syncdaemon_daemon_set_throttling_limits (SyncdaemonDaemon *daemon, gint download, gint upload)
2735-{
2736- SyncdaemonInterface *interface;
2737-
2738- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2739-
2740- interface = syncdaemon_daemon_get_config_interface (daemon);
2741- if (interface != NULL) {
2742- syncdaemon_config_interface_set_throttling_limits (SYNCDAEMON_CONFIG_INTERFACE (interface),
2743- download,
2744- upload);
2745- }
2746-}
2747-
2748-/**
2749- * syncdaemon_daemon_get_udf_autosubscribe:
2750- * @daemon: A #SyncdaemonDaemon object
2751- *
2752- * Get whether autosubscription for UDFs is enabled or not.
2753- *
2754- * Return value: TRUE if enabled, FALSE if disabled.
2755- */
2756-gboolean
2757-syncdaemon_daemon_get_udf_autosubscribe (SyncdaemonDaemon *daemon)
2758-{
2759- SyncdaemonInterface *interface;
2760-
2761- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2762-
2763- interface = syncdaemon_daemon_get_config_interface (daemon);
2764- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2765- return syncdaemon_config_interface_get_udf_autosubscribe (SYNCDAEMON_CONFIG_INTERFACE (interface));
2766-
2767- return FALSE;
2768-}
2769-
2770-/**
2771- * syncdaemon_daemon_set_udf_autosubscribe:
2772- * @daemon: A #SyncdaemonDaemon object
2773- * @enabled: Whether to enable UDF autosubscription or not.
2774- *
2775- * Enable or disable UDF autosubscription.
2776- */
2777-void
2778-syncdaemon_daemon_set_udf_autosubscribe (SyncdaemonDaemon *daemon, gboolean enabled)
2779-{
2780- SyncdaemonInterface *interface;
2781-
2782- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2783-
2784- interface = syncdaemon_daemon_get_config_interface (daemon);
2785- if (SYNCDAEMON_IS_CONFIG_INTERFACE (interface))
2786- syncdaemon_config_interface_set_udf_autosubscribe (SYNCDAEMON_CONFIG_INTERFACE (interface), enabled);
2787-}
2788-
2789-/**
2790- * syncdaemon_daemon_get_metadata:
2791- * @daemon: A #SyncdaemonDaemon object
2792- * @path: Path to check metadata for
2793- * @with_subtree_sync_check: For folders, whether to check the status of all its children
2794- *
2795- * Retrieve metadata for a file or folder inside a Ubuntu One directory.
2796- *
2797- * Return value: Metadata for the specified path.
2798- */
2799-SyncdaemonMetadata *
2800-syncdaemon_daemon_get_metadata (SyncdaemonDaemon *daemon, const gchar *path, gboolean with_subtree_sync_check)
2801-{
2802- SyncdaemonInterface *interface;
2803-
2804- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
2805-
2806- interface = syncdaemon_daemon_get_filesystem_interface (daemon);
2807- if (interface != NULL) {
2808- return syncdaemon_filesystem_interface_get_metadata (SYNCDAEMON_FILESYSTEM_INTERFACE (interface),
2809- path,
2810- with_subtree_sync_check);
2811- }
2812-
2813- return NULL;
2814-}
2815-
2816-/**
2817- * syncdaemon_daemon_get_folders:
2818- * @daemon: A #SyncdaemonDaemon object
2819- *
2820- * Retrieve the list of folders setup for synchronization with Ubuntu One.
2821- *
2822- * Return value: A list of #SyncdaemonFolderInfo containing all the folders being
2823- * synchronized by the user. When no longer needed, the list should be freed
2824- * by calling g_slist_free.
2825- */
2826-GSList *
2827-syncdaemon_daemon_get_folders (SyncdaemonDaemon *daemon)
2828-{
2829- SyncdaemonInterface *interface;
2830-
2831- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
2832-
2833- interface = syncdaemon_daemon_get_folders_interface (daemon);
2834- if (interface != NULL)
2835- return syncdaemon_folders_interface_get_folders (SYNCDAEMON_FOLDERS_INTERFACE (interface));
2836-
2837- return NULL;
2838-}
2839-
2840-/**
2841- * syncdaemon_daemon_get_folder_info:
2842- * @daemon: A #SyncdaemonDaemon object
2843- * @path: Full path of the folder for which to retrieve information.
2844- *
2845- * Get information about a folder under Ubuntu One.
2846- *
2847- * Return value: A #SyncdaemonFolderInfo object containing all the information
2848- * for the node. When no longer needed, it should be freed by calling
2849- * g_object_unref.
2850- */
2851-SyncdaemonFolderInfo *
2852-syncdaemon_daemon_get_folder_info (SyncdaemonDaemon *daemon, const gchar *path)
2853-{
2854- SyncdaemonInterface *interface;
2855-
2856- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
2857-
2858- interface = syncdaemon_daemon_get_folders_interface (daemon);
2859- if (interface != NULL)
2860- return syncdaemon_folders_interface_get_info (SYNCDAEMON_FOLDERS_INTERFACE (interface), path);
2861-
2862- return NULL;
2863-}
2864-
2865-/**
2866- * syncdaemon_daemon_is_folder_enabled:
2867- * @daemon: A #SyncdaemonDaemon object
2868- * @path: The folder path to check
2869- * @is_root: Placeholder for returning whether the given path is a U1 root folder
2870- *
2871- * Check whether a given path is a folder enabled for synchronization to U1.
2872- *
2873- * Return value: TRUE if the folder is enabled, FALSE otherwise.
2874- */
2875-gboolean
2876-syncdaemon_daemon_is_folder_enabled (SyncdaemonDaemon *daemon, const gchar *path, gboolean *is_root)
2877-{
2878- const gchar *root;
2879- gchar *root_with_slash;
2880- gboolean managed = FALSE, is_subscribed = FALSE;
2881- gchar *dirpath;
2882- SyncdaemonInterface *interface;
2883-
2884- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
2885- g_return_val_if_fail (path != NULL, FALSE);
2886-
2887- *is_root = FALSE;
2888-
2889- /* First check the root folder */
2890- root = syncdaemon_daemon_get_root_dir (daemon);
2891- if (g_strcmp0 (path, root) == 0) {
2892- *is_root = TRUE;
2893- return TRUE;
2894- } else {
2895- root_with_slash = g_build_filename (root, G_DIR_SEPARATOR_S, NULL);
2896-
2897- if (g_str_has_prefix (path, root_with_slash)) {
2898- g_free(root_with_slash);
2899- return TRUE;
2900- }
2901- g_free(root_with_slash);
2902- }
2903- /* Now check the 'Shared With Me' directory */
2904- dirpath = g_build_filename (root, "Shared With Me", NULL);
2905- if (g_strcmp0 (path, dirpath) == 0) {
2906- g_free (dirpath);
2907- return FALSE;
2908- }
2909- g_free (dirpath);
2910-
2911- /* And finally check UDFs */
2912- interface = syncdaemon_daemon_get_folders_interface (daemon);
2913- if (SYNCDAEMON_IS_FOLDERS_INTERFACE (interface)) {
2914- GSList *udfs, *l;
2915-
2916- udfs = syncdaemon_folders_interface_get_folders (SYNCDAEMON_FOLDERS_INTERFACE (interface));
2917- for (l = udfs; l != NULL; l = l->next) {
2918- const gchar *tmp_path;
2919- gchar *tmp_path_with_slash;
2920- SyncdaemonFolderInfo *finfo = SYNCDAEMON_FOLDER_INFO (l->data);
2921-
2922- tmp_path = syncdaemon_folder_info_get_path (finfo);
2923- is_subscribed = syncdaemon_folder_info_get_subscribed (finfo);
2924-
2925- tmp_path_with_slash = g_strconcat (tmp_path, G_DIR_SEPARATOR_S, NULL);
2926- if (g_strcmp0 (path, tmp_path) == 0) {
2927- managed = is_subscribed;
2928- *is_root = TRUE;
2929- break;
2930- } else if (g_str_has_prefix (path, tmp_path_with_slash)) {
2931- managed = is_subscribed;
2932- break;
2933- }
2934- g_free (tmp_path_with_slash);
2935- }
2936-
2937- g_slist_free (udfs);
2938- }
2939-
2940- return managed;
2941-}
2942-
2943-/**
2944- * syncdaemon_daemon_create_folder:
2945- * @daemon: A #SyncdaemonDaemon object
2946- * @path: The full path of the folder to create
2947- *
2948- * Enable a folder for Ubuntu One synchronization.
2949- *
2950- * The result of the operation can be retrieved by connecting to the "folder_created"
2951- * signal of the #SyncdaemonDaemon object.
2952- */
2953-void
2954-syncdaemon_daemon_create_folder (SyncdaemonDaemon *daemon, const gchar *path)
2955-{
2956- SyncdaemonInterface *interface;
2957-
2958- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2959-
2960- interface = syncdaemon_daemon_get_folders_interface (daemon);
2961- if (interface != NULL)
2962- syncdaemon_folders_interface_create (SYNCDAEMON_FOLDERS_INTERFACE (interface), path);
2963- else
2964- g_signal_emit (daemon, daemon_signals[FOLDER_CREATED_SIGNAL], 0, FALSE, NULL);
2965-}
2966-
2967-/**
2968- * syncdaemon_daemon_delete_folder:
2969- * @daemon: A #SyncdaemonDaemon object
2970- * @path: The full path of the folder to delete
2971- *
2972- * Disable a folder for Ubuntu One synchronization.
2973- *
2974- * The result of the operation can be retrieved by connecting to the "folder_deleted"
2975- * signal of the #SyncdaemonDaemon object.
2976- */
2977-void
2978-syncdaemon_daemon_delete_folder (SyncdaemonDaemon *daemon, const gchar *path)
2979-{
2980- SyncdaemonInterface *interface;
2981-
2982- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
2983-
2984- interface = syncdaemon_daemon_get_folders_interface (daemon);
2985- if (interface != NULL)
2986- syncdaemon_folders_interface_delete (SYNCDAEMON_FOLDERS_INTERFACE (interface), path);
2987- else
2988- g_signal_emit (daemon, daemon_signals[FOLDER_DELETED_SIGNAL], 0, FALSE, NULL);
2989-}
2990-
2991-/**
2992- * syncdaemon_daemon_subscribe_folder:
2993- * @daemon: A #SyncdaemonDaemon object
2994- * @path: The full path of the folder to subscribe
2995- *
2996- * Subscribe a folder for Ubuntu One synchronization.
2997- *
2998- * The result of the operation can be retrieved by connecting to the "folder_subscribed"
2999- * signal of the #SyncdaemonDaemon object.
3000- */
3001-void
3002-syncdaemon_daemon_subscribe_folder (SyncdaemonDaemon *daemon, const gchar *path)
3003-{
3004- SyncdaemonInterface *interface;
3005-
3006- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
3007-
3008- interface = syncdaemon_daemon_get_folders_interface (daemon);
3009- if (interface != NULL)
3010- syncdaemon_folders_interface_subscribe (SYNCDAEMON_FOLDERS_INTERFACE (interface), path);
3011- else
3012- g_signal_emit (daemon, daemon_signals[FOLDER_SUBSCRIBED_SIGNAL], 0, FALSE, NULL);
3013-}
3014-
3015-/**
3016- * syncdaemon_daemon_unsubscribe_folder:
3017- * @daemon: A #SyncdaemonDaemon object
3018- * @path: The full path of the folder to unsubscribe
3019- *
3020- * Unsubscribe a folder from Ubuntu One synchronization.
3021- *
3022- * The result of the operation can be retrieved by connecting to the "folder_unsubscribed"
3023- * signal of the #SyncdaemonDaemon object.
3024- */
3025-void
3026-syncdaemon_daemon_unsubscribe_folder (SyncdaemonDaemon *daemon, const gchar *path)
3027-{
3028- SyncdaemonInterface *interface;
3029-
3030- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
3031-
3032- interface = syncdaemon_daemon_get_folders_interface (daemon);
3033- if (interface != NULL)
3034- syncdaemon_folders_interface_unsubscribe (SYNCDAEMON_FOLDERS_INTERFACE (interface), path);
3035- else
3036- g_signal_emit (daemon, daemon_signals[FOLDER_UNSUBSCRIBED_SIGNAL], 0, FALSE, NULL);
3037-}
3038-
3039-/**
3040- * syncdaemon_daemon_publish_file:
3041- * @daemon: A #SyncdaemonDaemon object
3042- * @path: Full path of the file to be published
3043- *
3044- * Publish a file on Ubuntu One. When the file is successfully published, the "file_published"
3045- * signal will be emitted.
3046- *
3047- * Return value: TRUE if successful, FALSE otherwise.
3048- */
3049-gboolean
3050-syncdaemon_daemon_publish_file (SyncdaemonDaemon *daemon, const gchar *path)
3051-{
3052- SyncdaemonMetadata *metadata;
3053- gboolean result = FALSE;
3054-
3055- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
3056-
3057- /* First, retrieve the metadata */
3058- metadata = syncdaemon_daemon_get_metadata (daemon, path, FALSE);
3059- if (metadata != NULL) {
3060- SyncdaemonInterface *interface;
3061-
3062- interface = syncdaemon_daemon_get_publicfiles_interface (daemon);
3063- syncdaemon_publicfiles_interface_change_public_access (
3064- SYNCDAEMON_PUBLICFILES_INTERFACE (interface),
3065- syncdaemon_metadata_get_share_id (metadata),
3066- syncdaemon_metadata_get_node_id (metadata),
3067- TRUE);
3068-
3069- result = TRUE;
3070-
3071- g_object_unref (metadata);
3072- }
3073-
3074- return result;
3075-}
3076-
3077-/**
3078- * syncdaemon_daemon_unpublish_file:
3079- * @daemon: A #SyncdaemonDaemon object
3080- * @path: Full path of the file to be unpublished
3081- *
3082- * Unpublish a file from Ubuntu One. When the file is successfully unpublished, the "file_unpublished"
3083- * signal will be emitted.
3084- *
3085- * Return value: TRUE if successful, FALSE otherwise.
3086- */
3087-gboolean
3088-syncdaemon_daemon_unpublish_file (SyncdaemonDaemon *daemon, const gchar *path)
3089-{
3090- SyncdaemonMetadata *metadata;
3091- gboolean result = FALSE;
3092-
3093- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), FALSE);
3094-
3095- /* First, retrieve the metadata */
3096- metadata = syncdaemon_daemon_get_metadata (daemon, path, FALSE);
3097- if (metadata != NULL) {
3098- SyncdaemonInterface *interface;
3099-
3100- interface = syncdaemon_daemon_get_publicfiles_interface (daemon);
3101- syncdaemon_publicfiles_interface_change_public_access (
3102- SYNCDAEMON_PUBLICFILES_INTERFACE (interface),
3103- syncdaemon_metadata_get_share_id (metadata),
3104- syncdaemon_metadata_get_node_id (metadata),
3105- FALSE);
3106-
3107- result = TRUE;
3108-
3109- g_object_unref (metadata);
3110- }
3111-
3112- return result;
3113-}
3114-
3115-/**
3116- * syncdaemon_daemon_get_public_files:
3117- * @daemon: A #SyncdaemonDaemon object
3118- *
3119- * Retrieve the list of public files.
3120- *
3121- * Return value: A #GSList of #SyncdaemonFileInfo objects, each of which describes
3122- * a published file for the user. When no longer needed, this list should be
3123- * freed by calling g_slist_free, but the data within the list should never
3124- * be freed, as it belongs to the library.
3125- */
3126-GSList *
3127-syncdaemon_daemon_get_public_files (SyncdaemonDaemon *daemon)
3128-{
3129- SyncdaemonInterface *interface;
3130-
3131- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3132-
3133- interface = syncdaemon_daemon_get_publicfiles_interface (daemon);
3134- if (interface != NULL) {
3135- return syncdaemon_publicfiles_interface_get_public_files (
3136- SYNCDAEMON_PUBLICFILES_INTERFACE (interface));
3137- }
3138-
3139- return NULL;
3140-}
3141-
3142-/**
3143- * syncdaemon_daemon_create_share:
3144- * @daemon: A #SyncdaemonDaemon object
3145- * @path: Full path of the folder to be shared
3146- * @usernames: List of users with whom to share the folder
3147- * @name: Name to be used for the share
3148- * @allow_modifications: Whether to allow modifications to the list of users
3149- *
3150- * Share a Ubuntu One folder with a list of users.
3151- *
3152- * The result of the operation can be retrieved by connecting to the "share_created"
3153- * signal of the #SyncdaemonDaemon object.
3154- */
3155-void
3156-syncdaemon_daemon_create_share (SyncdaemonDaemon *daemon,
3157- const gchar *path,
3158- GSList *usernames,
3159- const gchar *name,
3160- gboolean allow_modifications)
3161-{
3162- SyncdaemonInterface *interface;
3163-
3164- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
3165-
3166- interface = syncdaemon_daemon_get_shares_interface (daemon);
3167- if (interface != NULL) {
3168- syncdaemon_shares_interface_create (SYNCDAEMON_SHARES_INTERFACE (interface),
3169- path,
3170- usernames,
3171- name,
3172- allow_modifications);
3173- } else
3174- g_signal_emit (daemon, daemon_signals[SHARE_CREATED_SIGNAL], 0, FALSE, NULL);
3175-}
3176-
3177-/**
3178- * syncdaemon_daemon_delete_share:
3179- * @daemon: A #SyncdaemonDaemon object
3180- * @path: Full path of the folder to be shared
3181- *
3182- * Stop sharing a Ubuntu One folder.
3183- *
3184- * The result of the operation can be retrieved by connecting to the "share_deleted"
3185- * signal of the #SyncdaemonDaemon object.
3186- */
3187-void
3188-syncdaemon_daemon_delete_share (SyncdaemonDaemon *daemon, const gchar *path)
3189-{
3190- SyncdaemonInterface *interface;
3191-
3192- g_return_if_fail (SYNCDAEMON_IS_DAEMON (daemon));
3193-
3194- interface = syncdaemon_daemon_get_shares_interface (daemon);
3195- if (interface != NULL)
3196- syncdaemon_shares_interface_delete (SYNCDAEMON_SHARES_INTERFACE (interface), path);
3197- else
3198- g_signal_emit (daemon, daemon_signals[SHARE_DELETED_SIGNAL], 0, FALSE, NULL);
3199-}
3200-
3201-/**
3202- * syncdaemon_daemon_get_shared_folders:
3203- * @daemon: A #SyncdaemonDaemon object
3204- *
3205- * Get the list of folders shared by the user with other users.
3206- *
3207- * Return value: A GSList of #SyncdaemonShareInfo objects. When no longer needed,
3208- * the list should be freed by calling #g_slist_free.
3209- */
3210-GSList *
3211-syncdaemon_daemon_get_shared_folders (SyncdaemonDaemon *daemon)
3212-{
3213- SyncdaemonInterface *interface;
3214-
3215- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3216-
3217- interface = syncdaemon_daemon_get_shares_interface (daemon);
3218- if (interface != NULL)
3219- return syncdaemon_shares_interface_get_shared (SYNCDAEMON_SHARES_INTERFACE (interface));
3220-
3221- return NULL;
3222-}
3223-
3224-/**
3225- * syncdaemon_daemon_get_shares:
3226- * @daemon: A #SyncdaemonDaemon object
3227- *
3228- * Get the list of folders shared by other users with the current user.
3229- *
3230- * Return value: A GSList of #SyncdaemonShareInfo objects. When no longer needed,
3231- * the list should be freed by calling #g_slist_free.
3232- */
3233-GSList *
3234-syncdaemon_daemon_get_shares (SyncdaemonDaemon *daemon)
3235-{
3236- SyncdaemonInterface *interface;
3237-
3238- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3239-
3240- interface = syncdaemon_daemon_get_shares_interface (daemon);
3241- if (interface != NULL)
3242- return syncdaemon_shares_interface_get_shares (SYNCDAEMON_SHARES_INTERFACE (interface));
3243-
3244- return NULL;
3245-}
3246-
3247-/**
3248- * syncdaemon_daemon_get_current_status:
3249- * @daemon: A #SyncdaemonDaemon object
3250- *
3251- * Retrieve the current status of SyncDaemon.
3252- *
3253- * Return value: A #SyncdaemonStatusInfo object containing information about
3254- * Syncdaemon's current status. When no longer needed, it should be freed by
3255- * calling g_object_unref.
3256- */
3257-SyncdaemonStatusInfo *
3258-syncdaemon_daemon_get_current_status (SyncdaemonDaemon *daemon)
3259-{
3260- SyncdaemonInterface *interface;
3261-
3262- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3263-
3264- interface = syncdaemon_daemon_get_status_interface (daemon);
3265- if (interface != NULL)
3266- return syncdaemon_status_interface_get_current_status (SYNCDAEMON_STATUS_INTERFACE (interface));
3267-
3268- return NULL;
3269-}
3270-
3271-/**
3272- * syncdaemon_daemon_get_current_downloads:
3273- * @daemon: A #SyncdaemonDaemon object
3274- *
3275- * Retrieve the list of downloads in progress.
3276- *
3277- * Return value: A GSList of #SyncdaemonTransferInfo objects, each of which contains
3278- * information about a file download in progress. The data in the list belongs to
3279- * the library, so when no longer needed, the list should be freed by just calling
3280- * g_slist_free.
3281- */
3282-GSList *
3283-syncdaemon_daemon_get_current_downloads (SyncdaemonDaemon *daemon)
3284-{
3285- SyncdaemonInterface *interface;
3286-
3287- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3288-
3289- interface = syncdaemon_daemon_get_status_interface (daemon);
3290- if (interface != NULL)
3291- return syncdaemon_status_interface_get_current_downloads (SYNCDAEMON_STATUS_INTERFACE (interface));
3292-
3293- return NULL;
3294-}
3295-
3296-/**
3297- * syncdaemon_daemon_get_current_uploads:
3298- * @daemon: A #SyncdaemonDaemon object
3299- *
3300- * Retrieve the list of uploads in progress.
3301- *
3302- * Return value: A GSList of #SyncdaemonTransferInfo objects, each of which contains
3303- * information about a file upload in progress. The data in the list belongs to
3304- * the library, so when no longer needed, the list should be freed by just calling
3305- * g_slist_free.
3306- */
3307-GSList *
3308-syncdaemon_daemon_get_current_uploads (SyncdaemonDaemon *daemon)
3309-{
3310- SyncdaemonInterface *interface;
3311-
3312- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3313-
3314- interface = syncdaemon_daemon_get_status_interface (daemon);
3315- if (interface != NULL)
3316- return syncdaemon_status_interface_get_current_uploads (SYNCDAEMON_STATUS_INTERFACE (interface));
3317-
3318- return NULL;
3319-}
3320-
3321-typedef SyncdaemonInterface * (* SDINewFunc) (SyncdaemonDaemon * daemon);
3322-
3323-static SyncdaemonInterface *
3324-get_interface (SyncdaemonDaemon *daemon, const gchar *path, SDINewFunc new_func)
3325-{
3326- SyncdaemonInterface *interface;
3327-
3328- interface = g_hash_table_lookup (daemon->priv->subinterfaces, path);
3329- if (interface == NULL) {
3330- interface = new_func (daemon);
3331- if (SYNCDAEMON_IS_INTERFACE (interface))
3332- g_hash_table_insert (daemon->priv->subinterfaces, g_strdup (path), interface);
3333- }
3334-
3335- return interface;
3336-}
3337-
3338-/**
3339- * syncdaemon_daemon_get_config_interface:
3340- */
3341-SyncdaemonInterface *
3342-syncdaemon_daemon_get_config_interface (SyncdaemonDaemon *daemon)
3343-{
3344- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3345-
3346- return get_interface (daemon, "/config",
3347- (SDINewFunc) syncdaemon_config_interface_new);
3348-}
3349-
3350-/**
3351- * syncdaemon_daemon_get_events_interface:
3352- */
3353-SyncdaemonInterface *
3354-syncdaemon_daemon_get_events_interface (SyncdaemonDaemon *daemon)
3355-{
3356- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3357-
3358- return get_interface (daemon, "/events",
3359- (SDINewFunc) syncdaemon_events_interface_new);
3360-}
3361-
3362-/**
3363- * syncdaemon_daemon_get_filesystem_interface:
3364- */
3365-SyncdaemonInterface *
3366-syncdaemon_daemon_get_filesystem_interface (SyncdaemonDaemon *daemon)
3367-{
3368- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3369-
3370- return get_interface (daemon, "/filesystem",
3371- (SDINewFunc) syncdaemon_filesystem_interface_new);
3372-}
3373-
3374-/**
3375- * syncdaemon_daemon_get_folders_interface:
3376- */
3377-SyncdaemonInterface *
3378-syncdaemon_daemon_get_folders_interface (SyncdaemonDaemon *daemon)
3379-{
3380- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3381-
3382- return get_interface (daemon, "/folders",
3383- (SDINewFunc) syncdaemon_folders_interface_new);
3384-}
3385-
3386-/**
3387- * syncdaemon_daemon_get_publicfiles_interface:
3388- */
3389-SyncdaemonInterface *
3390-syncdaemon_daemon_get_publicfiles_interface (SyncdaemonDaemon *daemon)
3391-{
3392- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3393-
3394- return get_interface (daemon, "/publicfiles",
3395- (SDINewFunc) syncdaemon_publicfiles_interface_new);
3396-}
3397-
3398-/**
3399- * syncdaemon_daemon_get_shares_interface:
3400- */
3401-SyncdaemonInterface *
3402-syncdaemon_daemon_get_shares_interface (SyncdaemonDaemon *daemon)
3403-{
3404- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3405-
3406- return get_interface (daemon, "/shares",
3407- (SDINewFunc) syncdaemon_shares_interface_new);
3408-}
3409-
3410-/**
3411- * syncdaemon_daemon_get_status_interface:
3412- */
3413-SyncdaemonInterface *
3414-syncdaemon_daemon_get_status_interface (SyncdaemonDaemon *daemon)
3415-{
3416- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3417-
3418- return get_interface (daemon, "/status",
3419- (SDINewFunc) syncdaemon_status_interface_new);
3420-}
3421
3422=== removed file 'libsyncdaemon/syncdaemon-daemon.h'
3423--- libsyncdaemon/syncdaemon-daemon.h 2012-04-09 20:07:05 +0000
3424+++ libsyncdaemon/syncdaemon-daemon.h 1970-01-01 00:00:00 +0000
3425@@ -1,172 +0,0 @@
3426-/*
3427- * Syncdaemon API
3428- *
3429- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
3430- *
3431- * Copyright 2010-2012 Canonical Ltd.
3432- *
3433- * This program is free software: you can redistribute it and/or modify it
3434- * under the terms of the GNU General Public License version 3, as published
3435- * by the Free Software Foundation.
3436- *
3437- * This program is distributed in the hope that it will be useful, but
3438- * WITHOUT ANY WARRANTY; without even the implied warranties of
3439- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3440- * PURPOSE. See the GNU General Public License for more details.
3441- *
3442- * You should have received a copy of the GNU General Public License along
3443- * with this program. If not, see <http://www.gnu.org/licenses/>.
3444- *
3445- * In addition, as a special exception, the copyright holders give
3446- * permission to link the code of portions of this program with the
3447- * OpenSSL library under certain conditions as described in each
3448- * individual source file, and distribute linked combinations
3449- * including the two.
3450- * You must obey the GNU General Public License in all respects
3451- * for all of the code used other than OpenSSL. If you modify
3452- * file(s) with this exception, you may extend this exception to your
3453- * version of the file(s), but you are not obligated to do so. If you
3454- * do not wish to do so, delete this exception statement from your
3455- * version. If you delete this exception statement from all source
3456- * files in the program, then also delete it here.
3457- *
3458- */
3459-
3460-#ifndef __SYNCDAEMON_DAEMON_H__
3461-#define __SYNCDAEMON_DAEMON_H__
3462-
3463-#include <glib-object.h>
3464-#include "syncdaemon-authentication.h"
3465-#include "syncdaemon-file-info.h"
3466-#include "syncdaemon-folder-info.h"
3467-#include "syncdaemon-interface.h"
3468-#include "syncdaemon-metadata.h"
3469-#include "syncdaemon-share-info.h"
3470-#include "syncdaemon-status-info.h"
3471-#include "syncdaemon-transfer-info.h"
3472-
3473-G_BEGIN_DECLS
3474-
3475-#define SYNCDAEMON_TYPE_DAEMON (syncdaemon_daemon_get_type ())
3476-#define SYNCDAEMON_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_DAEMON, SyncdaemonDaemon))
3477-#define SYNCDAEMON_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_DAEMON))
3478-#define SYNCDAEMON_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_DAEMON, SyncdaemonDaemonClass))
3479-#define SYNCDAEMON_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_DAEMON))
3480-#define SYNCDAEMON_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_DAEMON, SyncdaemonDaemonClass))
3481-
3482-typedef struct _SyncdaemonDaemonPrivate SyncdaemonDaemonPrivate;
3483-
3484-typedef struct {
3485- GObject parent;
3486- SyncdaemonDaemonPrivate *priv;
3487-} SyncdaemonDaemon;
3488-
3489-typedef struct {
3490- GObjectClass parent_class;
3491-
3492- /* Signals */
3493- void (* ready) (SyncdaemonDaemon *daemon);
3494-
3495- void (* connected) (SyncdaemonDaemon *daemon);
3496- void (* disconnected) (SyncdaemonDaemon *daemon);
3497- void (* status_changed) (SyncdaemonDaemon *daemon, SyncdaemonStatusInfo *status_info);
3498-
3499- void (* event) (SyncdaemonDaemon *daemon, GHashTable *event_dict);
3500- void (* error) (SyncdaemonDaemon *daemon, const gchar *signal, GHashTable *extra_args);
3501-
3502- void (* folder_created) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info);
3503- void (* folder_deleted) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info);
3504- void (* folder_subscribed) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info);
3505- void (* folder_unsubscribed) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFolderInfo *folder_info);
3506-
3507- void (* file_published) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFileInfo *file_info);
3508- void (* file_unpublished) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonFileInfo *file_info);
3509-
3510- void (* share_created) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info);
3511- void (* share_deleted) (SyncdaemonDaemon *daemon, gboolean success, SyncdaemonShareInfo *share_info);
3512-
3513- void (* download_started) (SyncdaemonDaemon *daemon, const gchar *path);
3514- void (* download_file_progress) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
3515- void (* download_finished) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
3516- void (* upload_started) (SyncdaemonDaemon *daemon, const gchar *path);
3517- void (* upload_file_progress) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
3518- void (* upload_finished) (SyncdaemonDaemon *daemon, const gchar *path, SyncdaemonTransferInfo *tinfo);
3519-
3520- void (* quota_exceeded) (SyncdaemonDaemon *daemon, GHashTable *volume_info);
3521-} SyncdaemonDaemonClass;
3522-
3523-GType syncdaemon_daemon_get_type (void);
3524-
3525-SyncdaemonDaemon *syncdaemon_daemon_new (void);
3526-
3527-gboolean syncdaemon_daemon_is_ready (SyncdaemonDaemon *daemon);
3528-
3529-gboolean syncdaemon_daemon_connect (SyncdaemonDaemon *daemon);
3530-gboolean syncdaemon_daemon_disconnect (SyncdaemonDaemon *daemon);
3531-gboolean syncdaemon_daemon_quit (SyncdaemonDaemon *daemon);
3532-const gchar *syncdaemon_daemon_get_root_dir (SyncdaemonDaemon *daemon);
3533-
3534-gboolean syncdaemon_daemon_has_network (SyncdaemonDaemon *daemon);
3535-SyncdaemonAuthentication *syncdaemon_daemon_get_authentication (SyncdaemonDaemon *daemon);
3536-
3537-/* Configuration */
3538-gboolean syncdaemon_daemon_get_bandwidth_throttling (SyncdaemonDaemon *daemon);
3539-void syncdaemon_daemon_set_bandwidth_throttling (SyncdaemonDaemon *daemon, gboolean enabled);
3540-gboolean syncdaemon_daemon_get_files_sync (SyncdaemonDaemon *daemon);
3541-void syncdaemon_daemon_set_files_sync (SyncdaemonDaemon *daemon, gboolean enabled);
3542-void syncdaemon_daemon_get_throttling_limits (SyncdaemonDaemon *daemon, gint *download, gint *upload);
3543-void syncdaemon_daemon_set_throttling_limits (SyncdaemonDaemon *daemon, gint download, gint upload);
3544-gboolean syncdaemon_daemon_get_udf_autosubscribe (SyncdaemonDaemon *daemon);
3545-void syncdaemon_daemon_set_udf_autosubscribe (SyncdaemonDaemon *daemon, gboolean enabled);
3546-
3547-/* File system operations */
3548-SyncdaemonMetadata *syncdaemon_daemon_get_metadata (SyncdaemonDaemon *daemon,
3549- const gchar *path,
3550- gboolean with_subtree_sync_check);
3551-
3552-
3553-/* Folders operations */
3554-GSList *syncdaemon_daemon_get_folders (SyncdaemonDaemon *daemon);
3555-SyncdaemonFolderInfo*syncdaemon_daemon_get_folder_info (SyncdaemonDaemon *daemon, const gchar *path);
3556-gboolean syncdaemon_daemon_is_folder_enabled (SyncdaemonDaemon *daemon,
3557- const gchar *path,
3558- gboolean *is_root);
3559-void syncdaemon_daemon_create_folder (SyncdaemonDaemon *daemon, const gchar *path);
3560-void syncdaemon_daemon_delete_folder (SyncdaemonDaemon *daemon, const gchar *path);
3561-void syncdaemon_daemon_subscribe_folder (SyncdaemonDaemon *daemon, const gchar *path);
3562-void syncdaemon_daemon_unsubscribe_folder (SyncdaemonDaemon *daemon, const gchar *path);
3563-
3564-/* Public files operations */
3565-gboolean syncdaemon_daemon_publish_file (SyncdaemonDaemon *daemon, const gchar *path);
3566-gboolean syncdaemon_daemon_unpublish_file (SyncdaemonDaemon *daemon, const gchar *path);
3567-GSList *syncdaemon_daemon_get_public_files (SyncdaemonDaemon *daemon);
3568-
3569-/* Shares operations */
3570-void syncdaemon_daemon_create_share (SyncdaemonDaemon *daemon,
3571- const gchar *path,
3572- GSList *usernames,
3573- const gchar *name,
3574- gboolean allow_modifications);
3575-void syncdaemon_daemon_delete_share (SyncdaemonDaemon *daemon, const gchar *path);
3576-GSList *syncdaemon_daemon_get_shared_folders (SyncdaemonDaemon *daemon);
3577-GSList *syncdaemon_daemon_get_shares (SyncdaemonDaemon *daemon);
3578-
3579-/* Status operations */
3580-SyncdaemonStatusInfo*syncdaemon_daemon_get_current_status (SyncdaemonDaemon *daemon);
3581-GSList *syncdaemon_daemon_get_current_downloads (SyncdaemonDaemon *daemon);
3582-GSList *syncdaemon_daemon_get_current_uploads (SyncdaemonDaemon *daemon);
3583-
3584-/*
3585- * Low level DBus interface access
3586- */
3587-SyncdaemonInterface *syncdaemon_daemon_get_config_interface (SyncdaemonDaemon *daemon);
3588-SyncdaemonInterface *syncdaemon_daemon_get_events_interface (SyncdaemonDaemon *daemon);
3589-SyncdaemonInterface *syncdaemon_daemon_get_filesystem_interface (SyncdaemonDaemon *daemon);
3590-SyncdaemonInterface *syncdaemon_daemon_get_folders_interface (SyncdaemonDaemon *daemon);
3591-SyncdaemonInterface *syncdaemon_daemon_get_publicfiles_interface (SyncdaemonDaemon *daemon);
3592-SyncdaemonInterface *syncdaemon_daemon_get_shares_interface (SyncdaemonDaemon *daemon);
3593-SyncdaemonInterface *syncdaemon_daemon_get_status_interface (SyncdaemonDaemon *daemon);
3594-
3595-G_END_DECLS
3596-
3597-#endif
3598
3599=== removed file 'libsyncdaemon/syncdaemon-events-interface.c'
3600--- libsyncdaemon/syncdaemon-events-interface.c 2012-04-09 20:07:05 +0000
3601+++ libsyncdaemon/syncdaemon-events-interface.c 1970-01-01 00:00:00 +0000
3602@@ -1,130 +0,0 @@
3603-/*
3604- * Syncdaemon API
3605- *
3606- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
3607- *
3608- * Copyright 2010-2012 Canonical Ltd.
3609- *
3610- * This program is free software: you can redistribute it and/or modify it
3611- * under the terms of the GNU General Public License version 3, as published
3612- * by the Free Software Foundation.
3613- *
3614- * This program is distributed in the hope that it will be useful, but
3615- * WITHOUT ANY WARRANTY; without even the implied warranties of
3616- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3617- * PURPOSE. See the GNU General Public License for more details.
3618- *
3619- * You should have received a copy of the GNU General Public License along
3620- * with this program. If not, see <http://www.gnu.org/licenses/>.
3621- *
3622- * In addition, as a special exception, the copyright holders give
3623- * permission to link the code of portions of this program with the
3624- * OpenSSL library under certain conditions as described in each
3625- * individual source file, and distribute linked combinations
3626- * including the two.
3627- * You must obey the GNU General Public License in all respects
3628- * for all of the code used other than OpenSSL. If you modify
3629- * file(s) with this exception, you may extend this exception to your
3630- * version of the file(s), but you are not obligated to do so. If you
3631- * do not wish to do so, delete this exception statement from your
3632- * version. If you delete this exception statement from all source
3633- * files in the program, then also delete it here.
3634- *
3635- */
3636-
3637-#include "config.h"
3638-#ifdef HAVE_GDBUS
3639-#else
3640-#include <dbus/dbus-glib.h>
3641-#endif
3642-#include "syncdaemon-events-interface.h"
3643-
3644-G_DEFINE_TYPE(SyncdaemonEventsInterface, syncdaemon_events_interface, SYNCDAEMON_TYPE_INTERFACE)
3645-
3646-struct _SyncdaemonEventsInterfacePrivate {
3647- GObject *proxy;
3648-};
3649-
3650-static void
3651-syncdaemon_events_interface_finalize (GObject *object)
3652-{
3653- SyncdaemonEventsInterface *interface = SYNCDAEMON_EVENTS_INTERFACE (object);
3654-
3655- if (interface->priv != NULL) {
3656- g_free (interface->priv);
3657- }
3658-
3659- G_OBJECT_CLASS (syncdaemon_events_interface_parent_class)->finalize (object);
3660-}
3661-
3662-static void
3663-syncdaemon_events_interface_class_init (SyncdaemonEventsInterfaceClass *klass)
3664-{
3665- GObjectClass *object_class = G_OBJECT_CLASS (klass);
3666-
3667- object_class->finalize = syncdaemon_events_interface_finalize;
3668-}
3669-
3670-static void
3671-event_cb (DBusGProxy *proxy, GHashTable *event_dict, gpointer user_data)
3672-{
3673- SyncdaemonDaemon *daemon = NULL;
3674- SyncdaemonEventsInterface *interface = SYNCDAEMON_EVENTS_INTERFACE (user_data);
3675-
3676- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
3677- if (daemon != NULL)
3678- g_signal_emit_by_name (daemon, "event", event_dict);
3679-}
3680-
3681-static void
3682-syncdaemon_events_interface_init (SyncdaemonEventsInterface *interface)
3683-{
3684- interface->priv = g_new0 (SyncdaemonEventsInterfacePrivate, 1);
3685-
3686- /* Setup DBus proxy */
3687- interface->priv->proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (interface),
3688- "com.ubuntuone.SyncDaemon",
3689- "/events", "com.ubuntuone.SyncDaemon.Events");
3690- if (interface->priv->proxy != NULL) {
3691- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "Event",
3692- dbus_g_type_get_map ("GHashTable",
3693- G_TYPE_STRING,
3694- G_TYPE_STRING),
3695- G_TYPE_INVALID);
3696- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "Event",
3697- G_CALLBACK (event_cb), interface, NULL);
3698- }
3699-}
3700-
3701-/**
3702- * syncdaemon_events_interface_new:
3703- */
3704-SyncdaemonEventsInterface *
3705-syncdaemon_events_interface_new (SyncdaemonDaemon *daemon)
3706-{
3707- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
3708-
3709- return g_object_new (SYNCDAEMON_TYPE_EVENTS_INTERFACE, "daemon", daemon, NULL);
3710-}
3711-
3712-/**
3713- * syncdaemon_events_interface_push_event:
3714- */
3715-void
3716-syncdaemon_events_interface_push_event (SyncdaemonEventsInterface *interface,
3717- const gchar *event_name,
3718- const gchar **args)
3719-{
3720- GError *error = NULL;
3721-
3722- g_return_if_fail (SYNCDAEMON_IS_EVENTS_INTERFACE (interface));
3723-
3724- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "push_event", &error,
3725- G_TYPE_STRING, event_name,
3726- G_TYPE_STRV, args,
3727- G_TYPE_INVALID,
3728- G_TYPE_INVALID)) {
3729- g_warning ("Failed calling push_event: %s", error->message);
3730- g_error_free (error);
3731- }
3732-}
3733
3734=== removed file 'libsyncdaemon/syncdaemon-events-interface.h'
3735--- libsyncdaemon/syncdaemon-events-interface.h 2012-04-09 20:07:05 +0000
3736+++ libsyncdaemon/syncdaemon-events-interface.h 1970-01-01 00:00:00 +0000
3737@@ -1,71 +0,0 @@
3738-/*
3739- * Syncdaemon API
3740- *
3741- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
3742- *
3743- * Copyright 2010-2012 Canonical Ltd.
3744- *
3745- * This program is free software: you can redistribute it and/or modify it
3746- * under the terms of the GNU General Public License version 3, as published
3747- * by the Free Software Foundation.
3748- *
3749- * This program is distributed in the hope that it will be useful, but
3750- * WITHOUT ANY WARRANTY; without even the implied warranties of
3751- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3752- * PURPOSE. See the GNU General Public License for more details.
3753- *
3754- * You should have received a copy of the GNU General Public License along
3755- * with this program. If not, see <http://www.gnu.org/licenses/>.
3756- *
3757- * In addition, as a special exception, the copyright holders give
3758- * permission to link the code of portions of this program with the
3759- * OpenSSL library under certain conditions as described in each
3760- * individual source file, and distribute linked combinations
3761- * including the two.
3762- * You must obey the GNU General Public License in all respects
3763- * for all of the code used other than OpenSSL. If you modify
3764- * file(s) with this exception, you may extend this exception to your
3765- * version of the file(s), but you are not obligated to do so. If you
3766- * do not wish to do so, delete this exception statement from your
3767- * version. If you delete this exception statement from all source
3768- * files in the program, then also delete it here.
3769- *
3770- */
3771-
3772-#ifndef __SYNCDAEMON_EVENTS_INTERFACE_H__
3773-#define __SYNCDAEMON_EVENTS_INTERFACE_H__
3774-
3775-#include "syncdaemon-daemon.h"
3776-#include "syncdaemon-interface.h"
3777-
3778-G_BEGIN_DECLS
3779-
3780-#define SYNCDAEMON_TYPE_EVENTS_INTERFACE (syncdaemon_events_interface_get_type ())
3781-#define SYNCDAEMON_EVENTS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_EVENTS_INTERFACE, SyncdaemonEventsInterface))
3782-#define SYNCDAEMON_IS_EVENTS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_EVENTS_INTERFACE))
3783-#define SYNCDAEMON_EVENTS_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_EVENTS_INTERFACE, SyncdaemonEventsInterfaceClass))
3784-#define SYNCDAEMON_IS_EVENTS_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_EVENTS_INTERFACE))
3785-#define SYNCDAEMON_EVENTS_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_EVENTS_INTERFACE, SyncdaemonEventsInterfaceClass))
3786-
3787-typedef struct _SyncdaemonEventsInterfacePrivate SyncdaemonEventsInterfacePrivate;
3788-
3789-typedef struct {
3790- SyncdaemonInterface parent;
3791- SyncdaemonEventsInterfacePrivate *priv;
3792-} SyncdaemonEventsInterface;
3793-
3794-typedef struct {
3795- SyncdaemonInterfaceClass parent_class;
3796-} SyncdaemonEventsInterfaceClass;
3797-
3798-GType syncdaemon_events_interface_get_type (void);
3799-
3800-SyncdaemonEventsInterface *syncdaemon_events_interface_new (SyncdaemonDaemon *daemon);
3801-
3802-void syncdaemon_events_interface_push_event (SyncdaemonEventsInterface *interface,
3803- const gchar *event_name,
3804- const gchar **args);
3805-
3806-G_END_DECLS
3807-
3808-#endif
3809
3810=== removed file 'libsyncdaemon/syncdaemon-file-info.c'
3811--- libsyncdaemon/syncdaemon-file-info.c 2012-04-09 20:07:05 +0000
3812+++ libsyncdaemon/syncdaemon-file-info.c 1970-01-01 00:00:00 +0000
3813@@ -1,236 +0,0 @@
3814-/*
3815- * Syncdaemon API
3816- *
3817- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
3818- *
3819- * Copyright 2010-2012 Canonical Ltd.
3820- *
3821- * This program is free software: you can redistribute it and/or modify it
3822- * under the terms of the GNU General Public License version 3, as published
3823- * by the Free Software Foundation.
3824- *
3825- * This program is distributed in the hope that it will be useful, but
3826- * WITHOUT ANY WARRANTY; without even the implied warranties of
3827- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
3828- * PURPOSE. See the GNU General Public License for more details.
3829- *
3830- * You should have received a copy of the GNU General Public License along
3831- * with this program. If not, see <http://www.gnu.org/licenses/>.
3832- *
3833- * In addition, as a special exception, the copyright holders give
3834- * permission to link the code of portions of this program with the
3835- * OpenSSL library under certain conditions as described in each
3836- * individual source file, and distribute linked combinations
3837- * including the two.
3838- * You must obey the GNU General Public License in all respects
3839- * for all of the code used other than OpenSSL. If you modify
3840- * file(s) with this exception, you may extend this exception to your
3841- * version of the file(s), but you are not obligated to do so. If you
3842- * do not wish to do so, delete this exception statement from your
3843- * version. If you delete this exception statement from all source
3844- * files in the program, then also delete it here.
3845- *
3846- */
3847-
3848-#include "syncdaemon-file-info.h"
3849-
3850-G_DEFINE_TYPE(SyncdaemonFileInfo, syncdaemon_file_info, G_TYPE_OBJECT)
3851-
3852-struct _SyncdaemonFileInfoPrivate {
3853- gchar *volume_id;
3854- gchar *node_id;
3855- gchar *public_url;
3856- gchar *path;
3857- gboolean is_public;
3858-};
3859-
3860-static void
3861-syncdaemon_file_info_finalize (GObject *object)
3862-{
3863- SyncdaemonFileInfo *finfo = SYNCDAEMON_FILE_INFO (object);
3864-
3865- if (finfo->priv != NULL) {
3866- if (finfo->priv->volume_id != NULL)
3867- g_free (finfo->priv->volume_id);
3868-
3869- if (finfo->priv->node_id != NULL)
3870- g_free (finfo->priv->node_id);
3871-
3872- if (finfo->priv->public_url != NULL)
3873- g_free (finfo->priv->public_url);
3874-
3875- if (finfo->priv->path != NULL)
3876- g_free (finfo->priv->path);
3877-
3878- g_free (finfo->priv);
3879- }
3880-
3881- G_OBJECT_CLASS (syncdaemon_file_info_parent_class)->finalize (object);
3882-}
3883-
3884-static void
3885-syncdaemon_file_info_class_init (SyncdaemonFileInfoClass *klass)
3886-{
3887- GObjectClass *object_class = G_OBJECT_CLASS (klass);
3888-
3889- object_class->finalize = syncdaemon_file_info_finalize;
3890-}
3891-
3892-static void
3893-syncdaemon_file_info_init (SyncdaemonFileInfo *finfo)
3894-{
3895- finfo->priv = g_new0 (SyncdaemonFileInfoPrivate, 1);
3896-}
3897-
3898-/**
3899- * syncdaemon_file_info_new:
3900- */
3901-SyncdaemonFileInfo *
3902-syncdaemon_file_info_new (void)
3903-{
3904- return g_object_new (SYNCDAEMON_TYPE_FILE_INFO, NULL);
3905-}
3906-
3907-/**
3908- * syncdaemon_file_info_new_from_hash_table:
3909- */
3910-SyncdaemonFileInfo *
3911-syncdaemon_file_info_new_from_hash_table (GHashTable *hash)
3912-{
3913- SyncdaemonFileInfo *finfo;
3914-
3915- finfo = g_object_new (SYNCDAEMON_TYPE_FILE_INFO, NULL);
3916- if (hash != NULL) {
3917- syncdaemon_file_info_set_volume_id (finfo, g_hash_table_lookup (hash, "volume_id"));
3918- syncdaemon_file_info_set_node_id (finfo, g_hash_table_lookup (hash, "node_id"));
3919- syncdaemon_file_info_set_public_url (finfo, g_hash_table_lookup (hash, "public_url"));
3920- syncdaemon_file_info_set_path (finfo, g_hash_table_lookup (hash, "path"));
3921- syncdaemon_file_info_set_is_public (
3922- finfo,
3923- g_strcmp0 (g_hash_table_lookup (hash, "is_public"), "True") == 0);
3924- }
3925-
3926- return finfo;
3927-}
3928-
3929-/**
3930- * syncdaemon_file_info_get_volume_id:
3931- */
3932-const gchar *
3933-syncdaemon_file_info_get_volume_id (SyncdaemonFileInfo *finfo)
3934-{
3935- g_return_val_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo), NULL);
3936-
3937- return (const gchar *) finfo->priv->volume_id;
3938-}
3939-
3940-/**
3941- * syncdaemon_file_info_set_volume_id:
3942- */
3943-void
3944-syncdaemon_file_info_set_volume_id (SyncdaemonFileInfo *finfo, const gchar *volume_id)
3945-{
3946- g_return_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo));
3947-
3948- if (finfo->priv->volume_id != NULL)
3949- g_free (finfo->priv->volume_id);
3950-
3951- finfo->priv->volume_id = g_strdup (volume_id);
3952-}
3953-
3954-/**
3955- * syncdaemon_file_info_get_node_id:
3956- */
3957-const gchar *
3958-syncdaemon_file_info_get_node_id (SyncdaemonFileInfo *finfo)
3959-{
3960- g_return_val_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo), NULL);
3961-
3962- return (const gchar *) finfo->priv->node_id;
3963-}
3964-
3965-/**
3966- * syncdaemon_file_info_set_node_id:
3967- */
3968-void
3969-syncdaemon_file_info_set_node_id (SyncdaemonFileInfo *finfo, const gchar *node_id)
3970-{
3971- g_return_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo));
3972-
3973- if (finfo->priv->node_id != NULL)
3974- g_free (finfo->priv->node_id);
3975-
3976- finfo->priv->node_id = g_strdup (node_id);
3977-}
3978-
3979-/**
3980- * syncdaemon_file_info_get_public_url:
3981- */
3982-const gchar *
3983-syncdaemon_file_info_get_public_url (SyncdaemonFileInfo *finfo)
3984-{
3985- g_return_val_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo), NULL);
3986-
3987- return (const gchar *) finfo->priv->public_url;
3988-}
3989-
3990-/**
3991- * syncdaemon_file_info_set_public_url:
3992- */
3993-void
3994-syncdaemon_file_info_set_public_url (SyncdaemonFileInfo *finfo, const gchar *public_url)
3995-{
3996- g_return_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo));
3997-
3998- if (finfo->priv->public_url != NULL)
3999- g_free (finfo->priv->public_url);
4000-
4001- finfo->priv->public_url = g_strdup (public_url);
4002-}
4003-
4004-/**
4005- * syncdaemon_file_info_get_path:
4006- */
4007-const gchar *
4008-syncdaemon_file_info_get_path (SyncdaemonFileInfo *finfo)
4009-{
4010- g_return_val_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo), NULL);
4011-
4012- return (const gchar *) finfo->priv->path;
4013-}
4014-
4015-/**
4016- * syncdaemon_file_info_set_path:
4017- */
4018-void
4019-syncdaemon_file_info_set_path (SyncdaemonFileInfo *finfo, const gchar *path)
4020-{
4021- g_return_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo));
4022-
4023- if (finfo->priv->path != NULL)
4024- g_free (finfo->priv->path);
4025-
4026- finfo->priv->path = g_strdup (path);
4027-}
4028-
4029-/**
4030- * syncdaemon_file_info_get_is_public:
4031- */
4032-gboolean
4033-syncdaemon_file_info_get_is_public (SyncdaemonFileInfo *finfo)
4034-{
4035- g_return_val_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo), FALSE);
4036-
4037- return finfo->priv->is_public;
4038-}
4039-
4040-/**
4041- * syncdaemon_file_info_set_is_public:
4042- */
4043-void
4044-syncdaemon_file_info_set_is_public (SyncdaemonFileInfo *finfo, gboolean is_public)
4045-{
4046- g_return_if_fail (SYNCDAEMON_IS_FILE_INFO (finfo));
4047-
4048- finfo->priv->is_public = is_public;
4049-}
4050
4051=== removed file 'libsyncdaemon/syncdaemon-file-info.h'
4052--- libsyncdaemon/syncdaemon-file-info.h 2012-04-09 20:07:05 +0000
4053+++ libsyncdaemon/syncdaemon-file-info.h 1970-01-01 00:00:00 +0000
4054@@ -1,78 +0,0 @@
4055-/*
4056- * Syncdaemon API
4057- *
4058- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4059- *
4060- * Copyright 2010-2012 Canonical Ltd.
4061- *
4062- * This program is free software: you can redistribute it and/or modify it
4063- * under the terms of the GNU General Public License version 3, as published
4064- * by the Free Software Foundation.
4065- *
4066- * This program is distributed in the hope that it will be useful, but
4067- * WITHOUT ANY WARRANTY; without even the implied warranties of
4068- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4069- * PURPOSE. See the GNU General Public License for more details.
4070- *
4071- * You should have received a copy of the GNU General Public License along
4072- * with this program. If not, see <http://www.gnu.org/licenses/>.
4073- *
4074- * In addition, as a special exception, the copyright holders give
4075- * permission to link the code of portions of this program with the
4076- * OpenSSL library under certain conditions as described in each
4077- * individual source file, and distribute linked combinations
4078- * including the two.
4079- * You must obey the GNU General Public License in all respects
4080- * for all of the code used other than OpenSSL. If you modify
4081- * file(s) with this exception, you may extend this exception to your
4082- * version of the file(s), but you are not obligated to do so. If you
4083- * do not wish to do so, delete this exception statement from your
4084- * version. If you delete this exception statement from all source
4085- * files in the program, then also delete it here.
4086- *
4087- */
4088-
4089-#ifndef __SYNCDAEMON_FILE_INFO_H__
4090-#define __SYNCDAEMON_FILE_INFO_H__
4091-
4092-#include <glib-object.h>
4093-
4094-G_BEGIN_DECLS
4095-
4096-#define SYNCDAEMON_TYPE_FILE_INFO (syncdaemon_file_info_get_type ())
4097-#define SYNCDAEMON_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_FILE_INFO, SyncdaemonFileInfo))
4098-#define SYNCDAEMON_IS_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_FILE_INFO))
4099-#define SYNCDAEMON_FILE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_FILE_INFO, SyncdaemonFileInfoClass))
4100-#define SYNCDAEMON_IS_FILE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_FILE_INFO))
4101-#define SYNCDAEMON_FILE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_FILE_INFO, SyncdaemonFileInfoClass))
4102-
4103-typedef struct _SyncdaemonFileInfoPrivate SyncdaemonFileInfoPrivate;
4104-
4105-typedef struct {
4106- GObject parent;
4107- SyncdaemonFileInfoPrivate *priv;
4108-} SyncdaemonFileInfo;
4109-
4110-typedef struct {
4111- GObjectClass parent_class;
4112-} SyncdaemonFileInfoClass;
4113-
4114-GType syncdaemon_file_info_get_type (void);
4115-SyncdaemonFileInfo *syncdaemon_file_info_new (void);
4116-SyncdaemonFileInfo *syncdaemon_file_info_new_from_hash_table (GHashTable *hash);
4117-
4118-const gchar *syncdaemon_file_info_get_volume_id (SyncdaemonFileInfo *finfo);
4119-void syncdaemon_file_info_set_volume_id (SyncdaemonFileInfo *finfo, const gchar *volume_id);
4120-const gchar *syncdaemon_file_info_get_node_id (SyncdaemonFileInfo *finfo);
4121-void syncdaemon_file_info_set_node_id (SyncdaemonFileInfo *finfo, const gchar *node_id);
4122-const gchar *syncdaemon_file_info_get_path (SyncdaemonFileInfo *finfo);
4123-void syncdaemon_file_info_set_path (SyncdaemonFileInfo *finfo, const gchar *path);
4124-
4125-gboolean syncdaemon_file_info_get_is_public (SyncdaemonFileInfo *finfo);
4126-void syncdaemon_file_info_set_is_public (SyncdaemonFileInfo *finfo, gboolean is_public);
4127-const gchar *syncdaemon_file_info_get_public_url (SyncdaemonFileInfo *finfo);
4128-void syncdaemon_file_info_set_public_url (SyncdaemonFileInfo *finfo, const gchar *public_url);
4129-
4130-G_END_DECLS
4131-
4132-#endif
4133
4134=== removed file 'libsyncdaemon/syncdaemon-filesystem-interface.c'
4135--- libsyncdaemon/syncdaemon-filesystem-interface.c 2012-04-09 20:07:05 +0000
4136+++ libsyncdaemon/syncdaemon-filesystem-interface.c 1970-01-01 00:00:00 +0000
4137@@ -1,190 +0,0 @@
4138-/*
4139- * Syncdaemon API
4140- *
4141- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4142- *
4143- * Copyright 2010-2012 Canonical Ltd.
4144- *
4145- * This program is free software: you can redistribute it and/or modify it
4146- * under the terms of the GNU General Public License version 3, as published
4147- * by the Free Software Foundation.
4148- *
4149- * This program is distributed in the hope that it will be useful, but
4150- * WITHOUT ANY WARRANTY; without even the implied warranties of
4151- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4152- * PURPOSE. See the GNU General Public License for more details.
4153- *
4154- * You should have received a copy of the GNU General Public License along
4155- * with this program. If not, see <http://www.gnu.org/licenses/>.
4156- *
4157- * In addition, as a special exception, the copyright holders give
4158- * permission to link the code of portions of this program with the
4159- * OpenSSL library under certain conditions as described in each
4160- * individual source file, and distribute linked combinations
4161- * including the two.
4162- * You must obey the GNU General Public License in all respects
4163- * for all of the code used other than OpenSSL. If you modify
4164- * file(s) with this exception, you may extend this exception to your
4165- * version of the file(s), but you are not obligated to do so. If you
4166- * do not wish to do so, delete this exception statement from your
4167- * version. If you delete this exception statement from all source
4168- * files in the program, then also delete it here.
4169- *
4170- */
4171-
4172-#include "config.h"
4173-#ifdef HAVE_GDBUS
4174-#else
4175-#include <dbus/dbus-glib.h>
4176-#endif
4177-#include "syncdaemon-filesystem-interface.h"
4178-
4179-G_DEFINE_TYPE(SyncdaemonFilesystemInterface, syncdaemon_filesystem_interface, SYNCDAEMON_TYPE_INTERFACE)
4180-
4181-struct _SyncdaemonFilesystemInterfacePrivate {
4182- GObject *proxy;
4183-};
4184-
4185-static void
4186-syncdaemon_filesystem_interface_finalize (GObject *object)
4187-{
4188- SyncdaemonFilesystemInterface *interface = SYNCDAEMON_FILESYSTEM_INTERFACE (object);
4189-
4190- if (interface->priv != NULL) {
4191- g_free (interface->priv);
4192- }
4193-
4194- G_OBJECT_CLASS (syncdaemon_filesystem_interface_parent_class)->finalize (object);
4195-}
4196-
4197-static void
4198-syncdaemon_filesystem_interface_class_init (SyncdaemonFilesystemInterfaceClass *klass)
4199-{
4200- GObjectClass *object_class = G_OBJECT_CLASS (klass);
4201-
4202- object_class->finalize = syncdaemon_filesystem_interface_finalize;
4203-}
4204-
4205-static void
4206-syncdaemon_filesystem_interface_init (SyncdaemonFilesystemInterface *interface)
4207-{
4208- interface->priv = g_new0 (SyncdaemonFilesystemInterfacePrivate, 1);
4209-
4210- /* Setup DBus proxy */
4211- interface->priv->proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (interface),
4212- "com.ubuntuone.SyncDaemon",
4213- "/filesystem", "com.ubuntuone.SyncDaemon.FileSystem");
4214-}
4215-
4216-/**
4217- * syncdaemon_filesystem_interface_new:
4218- */
4219-SyncdaemonFilesystemInterface *
4220-syncdaemon_filesystem_interface_new (SyncdaemonDaemon *daemon)
4221-{
4222- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
4223-
4224- return g_object_new (SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE, "daemon", daemon, NULL);
4225-}
4226-
4227-/**
4228- * syncdaemon_filesystem_interface_get_metadata:
4229- */
4230-SyncdaemonMetadata *
4231-syncdaemon_filesystem_interface_get_metadata (SyncdaemonFilesystemInterface *interface,
4232- const gchar *path,
4233- gboolean with_subtree_sync_check)
4234-{
4235- GError *error = NULL;
4236- GHashTable *hash;
4237- const char *method;
4238-
4239- g_return_val_if_fail (SYNCDAEMON_IS_FILESYSTEM_INTERFACE (interface), NULL);
4240-
4241- if (with_subtree_sync_check)
4242- method = "get_metadata_and_quick_tree_synced";
4243- else
4244- method = "get_metadata";
4245-
4246- if (!dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), method, &error,
4247- G_TYPE_STRING, path,
4248- G_TYPE_INVALID,
4249- dbus_g_type_get_map ("GHashTable",
4250- G_TYPE_STRING,
4251- G_TYPE_STRING), &hash,
4252- G_TYPE_INVALID)) {
4253- g_warning ("Failed calling %s: %s", method, error->message);
4254- g_error_free (error);
4255-
4256- return NULL;
4257- }
4258-
4259- return syncdaemon_metadata_new_from_hash_table (hash);
4260-}
4261-
4262-typedef struct {
4263- SyncdaemonFilesystemInterface *interface;
4264- SyncdaemonGotMetadataFunc callback;
4265- gpointer user_data;
4266-} GotMetadataData;
4267-
4268-static void
4269-got_metadata_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
4270-{
4271- GHashTable *hash;
4272- GError *error = NULL;
4273- GotMetadataData *gmd = (GotMetadataData *) user_data;
4274-
4275- if (dbus_g_proxy_end_call (proxy, call_id, &error,
4276- dbus_g_type_get_map ("GHashTable",
4277- G_TYPE_STRING,
4278- G_TYPE_STRING), &hash,
4279- G_TYPE_INVALID)) {
4280- SyncdaemonMetadata *metadata;
4281-
4282- metadata = syncdaemon_metadata_new_from_hash_table (hash);
4283- gmd->callback (gmd->interface, TRUE, metadata, gmd->user_data);
4284-
4285- /* Free memory */
4286- g_object_unref (G_OBJECT (metadata));
4287- g_hash_table_destroy (hash);
4288- } else {
4289- g_warning ("Error getting metadata: %s", error->message);
4290- g_error_free (error);
4291- gmd->callback (gmd->interface, FALSE, NULL, gmd->user_data);
4292- }
4293-
4294- g_free (gmd);
4295-}
4296-
4297-/**
4298- * syncdaemon_filesystem_interface_get_metadata_async:
4299- */
4300-void
4301-syncdaemon_filesystem_interface_get_metadata_async (SyncdaemonFilesystemInterface *interface,
4302- const gchar *path,
4303- gboolean with_subtree_sync_check,
4304- SyncdaemonGotMetadataFunc callback,
4305- gpointer user_data)
4306-{
4307- GotMetadataData *gmd;
4308- const gchar *method;
4309-
4310- g_return_if_fail (SYNCDAEMON_IS_FILESYSTEM_INTERFACE (interface));
4311-
4312- if (with_subtree_sync_check)
4313- method = "get_metadata_and_quick_tree_synced";
4314- else
4315- method = "get_metadata";
4316-
4317- gmd = g_new0 (GotMetadataData, 1);
4318- gmd->interface = interface;
4319- gmd->callback = callback;
4320- gmd->user_data = user_data;
4321-
4322- dbus_g_proxy_begin_call (DBUS_G_PROXY (interface->priv->proxy),
4323- method,
4324- got_metadata_cb, gmd, NULL,
4325- G_TYPE_STRING, path,
4326- G_TYPE_INVALID);
4327-}
4328
4329=== removed file 'libsyncdaemon/syncdaemon-filesystem-interface.h'
4330--- libsyncdaemon/syncdaemon-filesystem-interface.h 2012-04-09 20:07:05 +0000
4331+++ libsyncdaemon/syncdaemon-filesystem-interface.h 1970-01-01 00:00:00 +0000
4332@@ -1,84 +0,0 @@
4333-/*
4334- * Syncdaemon API
4335- *
4336- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4337- *
4338- * Copyright 2010-2012 Canonical Ltd.
4339- *
4340- * This program is free software: you can redistribute it and/or modify it
4341- * under the terms of the GNU General Public License version 3, as published
4342- * by the Free Software Foundation.
4343- *
4344- * This program is distributed in the hope that it will be useful, but
4345- * WITHOUT ANY WARRANTY; without even the implied warranties of
4346- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4347- * PURPOSE. See the GNU General Public License for more details.
4348- *
4349- * You should have received a copy of the GNU General Public License along
4350- * with this program. If not, see <http://www.gnu.org/licenses/>.
4351- *
4352- * In addition, as a special exception, the copyright holders give
4353- * permission to link the code of portions of this program with the
4354- * OpenSSL library under certain conditions as described in each
4355- * individual source file, and distribute linked combinations
4356- * including the two.
4357- * You must obey the GNU General Public License in all respects
4358- * for all of the code used other than OpenSSL. If you modify
4359- * file(s) with this exception, you may extend this exception to your
4360- * version of the file(s), but you are not obligated to do so. If you
4361- * do not wish to do so, delete this exception statement from your
4362- * version. If you delete this exception statement from all source
4363- * files in the program, then also delete it here.
4364- *
4365- */
4366-
4367-#ifndef __SYNCDAEMON_FILESYSTEM_INTERFACE_H__
4368-#define __SYNCDAEMON_FILESYSTEM_INTERFACE_H__
4369-
4370-#include "syncdaemon-daemon.h"
4371-#include "syncdaemon-interface.h"
4372-#include "syncdaemon-metadata.h"
4373-
4374-G_BEGIN_DECLS
4375-
4376-#define SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE (syncdaemon_filesystem_interface_get_type ())
4377-#define SYNCDAEMON_FILESYSTEM_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE, SyncdaemonFilesystemInterface))
4378-#define SYNCDAEMON_IS_FILESYSTEM_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE))
4379-#define SYNCDAEMON_FILESYSTEM_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE, SyncdaemonFilesystemInterfaceClass))
4380-#define SYNCDAEMON_IS_FILESYSTEM_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE))
4381-#define SYNCDAEMON_FILESYSTEM_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_FILESYSTEM_INTERFACE, SyncdaemonFilesystemInterfaceClass))
4382-
4383-typedef struct _SyncdaemonFilesystemInterfacePrivate SyncdaemonFilesystemInterfacePrivate;
4384-
4385-typedef struct {
4386- SyncdaemonInterface parent;
4387- SyncdaemonFilesystemInterfacePrivate *priv;
4388-} SyncdaemonFilesystemInterface;
4389-
4390-typedef struct {
4391- SyncdaemonInterfaceClass parent_class;
4392-} SyncdaemonFilesystemInterfaceClass;
4393-
4394-GType syncdaemon_filesystem_interface_get_type (void);
4395-
4396-SyncdaemonFilesystemInterface *syncdaemon_filesystem_interface_new (SyncdaemonDaemon *daemon);
4397-
4398-SyncdaemonMetadata *syncdaemon_filesystem_interface_get_metadata (SyncdaemonFilesystemInterface *interface,
4399- const gchar *path,
4400- gboolean with_subtree_sync_check);
4401-
4402-typedef void (* SyncdaemonGotMetadataFunc) (SyncdaemonFilesystemInterface *interface,
4403- gboolean success,
4404- SyncdaemonMetadata *metadata,
4405- gpointer user_data);
4406-
4407-void syncdaemon_filesystem_interface_get_metadata_async (SyncdaemonFilesystemInterface *interface,
4408- const gchar *path,
4409- gboolean with_subtree_sync_check,
4410- SyncdaemonGotMetadataFunc callback,
4411- gpointer user_data);
4412-
4413-
4414-G_END_DECLS
4415-
4416-#endif
4417
4418=== removed file 'libsyncdaemon/syncdaemon-folder-info.c'
4419--- libsyncdaemon/syncdaemon-folder-info.c 2012-04-09 20:07:05 +0000
4420+++ libsyncdaemon/syncdaemon-folder-info.c 1970-01-01 00:00:00 +0000
4421@@ -1,176 +0,0 @@
4422-/*
4423- * Syncdaemon API
4424- *
4425- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4426- *
4427- * Copyright 2010-2012 Canonical Ltd.
4428- *
4429- * This program is free software: you can redistribute it and/or modify it
4430- * under the terms of the GNU General Public License version 3, as published
4431- * by the Free Software Foundation.
4432- *
4433- * This program is distributed in the hope that it will be useful, but
4434- * WITHOUT ANY WARRANTY; without even the implied warranties of
4435- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4436- * PURPOSE. See the GNU General Public License for more details.
4437- *
4438- * You should have received a copy of the GNU General Public License along
4439- * with this program. If not, see <http://www.gnu.org/licenses/>.
4440- *
4441- * In addition, as a special exception, the copyright holders give
4442- * permission to link the code of portions of this program with the
4443- * OpenSSL library under certain conditions as described in each
4444- * individual source file, and distribute linked combinations
4445- * including the two.
4446- * You must obey the GNU General Public License in all respects
4447- * for all of the code used other than OpenSSL. If you modify
4448- * file(s) with this exception, you may extend this exception to your
4449- * version of the file(s), but you are not obligated to do so. If you
4450- * do not wish to do so, delete this exception statement from your
4451- * version. If you delete this exception statement from all source
4452- * files in the program, then also delete it here.
4453- *
4454- */
4455-
4456-#include "syncdaemon-folder-info.h"
4457-
4458-G_DEFINE_TYPE(SyncdaemonFolderInfo, syncdaemon_folder_info, G_TYPE_OBJECT)
4459-
4460-struct _SyncdaemonFolderInfoPrivate {
4461- gchar *path;
4462- gboolean subscribed;
4463- gchar *volume_id;
4464-};
4465-
4466-static void
4467-syncdaemon_folder_info_finalize (GObject *object)
4468-{
4469- SyncdaemonFolderInfo *finfo = SYNCDAEMON_FOLDER_INFO (object);
4470-
4471- if (finfo->priv != NULL) {
4472- if (finfo->priv->path != NULL)
4473- g_free (finfo->priv->path);
4474-
4475- if (finfo->priv->volume_id != NULL)
4476- g_free (finfo->priv->volume_id);
4477-
4478- g_free (finfo->priv);
4479- }
4480-
4481- G_OBJECT_CLASS (syncdaemon_folder_info_parent_class)->finalize (object);
4482-}
4483-
4484-static void
4485-syncdaemon_folder_info_class_init (SyncdaemonFolderInfoClass *klass)
4486-{
4487- GObjectClass *object_class = G_OBJECT_CLASS (klass);
4488-
4489- object_class->finalize = syncdaemon_folder_info_finalize;
4490-}
4491-
4492-static void
4493-syncdaemon_folder_info_init (SyncdaemonFolderInfo *finfo)
4494-{
4495- finfo->priv = g_new0 (SyncdaemonFolderInfoPrivate, 1);
4496-}
4497-
4498-/**
4499- * syncdaemon_folder_info_new:
4500- */
4501-SyncdaemonFolderInfo *
4502-syncdaemon_folder_info_new (void)
4503-{
4504- return g_object_new (SYNCDAEMON_TYPE_FOLDER_INFO, NULL);
4505-}
4506-
4507-/**
4508- * syncdaemon_folder_info_new_from_hash_table:
4509- */
4510-SyncdaemonFolderInfo *
4511-syncdaemon_folder_info_new_from_hash_table (GHashTable *hash)
4512-{
4513- SyncdaemonFolderInfo *finfo;
4514-
4515- finfo = g_object_new (SYNCDAEMON_TYPE_FOLDER_INFO, NULL);
4516- if (hash != NULL) {
4517- syncdaemon_folder_info_set_path (finfo, g_hash_table_lookup (hash, "path"));
4518- syncdaemon_folder_info_set_subscribed (
4519- finfo,
4520- g_strcmp0 (g_hash_table_lookup (hash, "subscribed"), "True") == 0);
4521- syncdaemon_folder_info_set_volume_id (finfo, g_hash_table_lookup (hash, "volume_id"));
4522- }
4523-
4524- return finfo;
4525-}
4526-
4527-/**
4528- * syncdaemon_folder_info_get_path:
4529- */
4530-const gchar *
4531-syncdaemon_folder_info_get_path (SyncdaemonFolderInfo *finfo)
4532-{
4533- g_return_val_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo), NULL);
4534-
4535- return (const gchar *) finfo->priv->path;
4536-}
4537-
4538-/**
4539- * syncdaemon_folder_info_set_path:
4540- */
4541-void
4542-syncdaemon_folder_info_set_path (SyncdaemonFolderInfo *finfo, const gchar *path)
4543-{
4544- g_return_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo));
4545-
4546- if (finfo->priv->path != NULL)
4547- g_free (finfo->priv->path);
4548-
4549- finfo->priv->path = g_strdup (path);
4550-}
4551-
4552-/**
4553- * syncdaemon_folder_info_get_subscribed:
4554- */
4555-gboolean
4556-syncdaemon_folder_info_get_subscribed (SyncdaemonFolderInfo *finfo)
4557-{
4558- g_return_val_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo), FALSE);
4559-
4560- return finfo->priv->subscribed;
4561-}
4562-
4563-/**
4564- * syncdaemon_folder_info_set_subscribed:
4565- */
4566-void
4567-syncdaemon_folder_info_set_subscribed (SyncdaemonFolderInfo *finfo, gboolean subscribed)
4568-{
4569- g_return_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo));
4570-
4571- finfo->priv->subscribed = subscribed;
4572-}
4573-
4574-/**
4575- * syncdaemon_folder_info_get_volume_id:
4576- */
4577-const gchar *
4578-syncdaemon_folder_info_get_volume_id (SyncdaemonFolderInfo *finfo)
4579-{
4580- g_return_val_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo), NULL);
4581-
4582- return (const gchar *) finfo->priv->volume_id;
4583-}
4584-
4585-/**
4586- * syncdaemon_folder_info_set_volume_id:
4587- */
4588-void
4589-syncdaemon_folder_info_set_volume_id (SyncdaemonFolderInfo *finfo, const gchar *volume_id)
4590-{
4591- g_return_if_fail (SYNCDAEMON_IS_FOLDER_INFO (finfo));
4592-
4593- if (finfo->priv->volume_id != NULL)
4594- g_free (finfo->priv->volume_id);
4595-
4596- finfo->priv->volume_id = g_strdup (volume_id);
4597-}
4598
4599=== removed file 'libsyncdaemon/syncdaemon-folder-info.h'
4600--- libsyncdaemon/syncdaemon-folder-info.h 2012-04-09 20:07:05 +0000
4601+++ libsyncdaemon/syncdaemon-folder-info.h 1970-01-01 00:00:00 +0000
4602@@ -1,73 +0,0 @@
4603-/*
4604- * Syncdaemon API
4605- *
4606- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4607- *
4608- * Copyright 2010-2012 Canonical Ltd.
4609- *
4610- * This program is free software: you can redistribute it and/or modify it
4611- * under the terms of the GNU General Public License version 3, as published
4612- * by the Free Software Foundation.
4613- *
4614- * This program is distributed in the hope that it will be useful, but
4615- * WITHOUT ANY WARRANTY; without even the implied warranties of
4616- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4617- * PURPOSE. See the GNU General Public License for more details.
4618- *
4619- * You should have received a copy of the GNU General Public License along
4620- * with this program. If not, see <http://www.gnu.org/licenses/>.
4621- *
4622- * In addition, as a special exception, the copyright holders give
4623- * permission to link the code of portions of this program with the
4624- * OpenSSL library under certain conditions as described in each
4625- * individual source file, and distribute linked combinations
4626- * including the two.
4627- * You must obey the GNU General Public License in all respects
4628- * for all of the code used other than OpenSSL. If you modify
4629- * file(s) with this exception, you may extend this exception to your
4630- * version of the file(s), but you are not obligated to do so. If you
4631- * do not wish to do so, delete this exception statement from your
4632- * version. If you delete this exception statement from all source
4633- * files in the program, then also delete it here.
4634- *
4635- */
4636-
4637-#ifndef __SYNCDAEMON_FOLDER_INFO_H__
4638-#define __SYNCDAEMON_FOLDER_INFO_H__
4639-
4640-#include <glib-object.h>
4641-
4642-G_BEGIN_DECLS
4643-
4644-#define SYNCDAEMON_TYPE_FOLDER_INFO (syncdaemon_folder_info_get_type ())
4645-#define SYNCDAEMON_FOLDER_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNCDAEMON_TYPE_FOLDER_INFO, SyncdaemonFolderInfo))
4646-#define SYNCDAEMON_IS_FOLDER_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNCDAEMON_TYPE_FOLDER_INFO))
4647-#define SYNCDAEMON_FOLDER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNCDAEMON_TYPE_FOLDER_INFO, SyncdaemonFolderInfoClass))
4648-#define SYNCDAEMON_IS_FOLDER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNCDAEMON_TYPE_FOLDER_INFO))
4649-#define SYNCDAEMON_FOLDER_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNCDAEMON_TYPE_FOLDER_INFO, SyncdaemonFolderInfoClass))
4650-
4651-typedef struct _SyncdaemonFolderInfoPrivate SyncdaemonFolderInfoPrivate;
4652-
4653-typedef struct {
4654- GObject parent;
4655- SyncdaemonFolderInfoPrivate *priv;
4656-} SyncdaemonFolderInfo;
4657-
4658-typedef struct {
4659- GObjectClass parent_class;
4660-} SyncdaemonFolderInfoClass;
4661-
4662-GType syncdaemon_folder_info_get_type (void);
4663-SyncdaemonFolderInfo *syncdaemon_folder_info_new (void);
4664-SyncdaemonFolderInfo *syncdaemon_folder_info_new_from_hash_table (GHashTable *hash);
4665-
4666-const gchar *syncdaemon_folder_info_get_path (SyncdaemonFolderInfo *finfo);
4667-void syncdaemon_folder_info_set_path (SyncdaemonFolderInfo *finfo, const gchar *path);
4668-gboolean syncdaemon_folder_info_get_subscribed (SyncdaemonFolderInfo *finfo);
4669-void syncdaemon_folder_info_set_subscribed (SyncdaemonFolderInfo *finfo, gboolean subscribed);
4670-const gchar *syncdaemon_folder_info_get_volume_id (SyncdaemonFolderInfo *finfo);
4671-void syncdaemon_folder_info_set_volume_id (SyncdaemonFolderInfo *finfo, const gchar *volume_id);
4672-
4673-G_END_DECLS
4674-
4675-#endif
4676
4677=== removed file 'libsyncdaemon/syncdaemon-folders-interface.c'
4678--- libsyncdaemon/syncdaemon-folders-interface.c 2012-04-09 20:07:05 +0000
4679+++ libsyncdaemon/syncdaemon-folders-interface.c 1970-01-01 00:00:00 +0000
4680@@ -1,494 +0,0 @@
4681-/*
4682- * Syncdaemon API
4683- *
4684- * Authors: Rodrigo Moya <rodrigo.moya@canonical.com>
4685- *
4686- * Copyright 2010-2012 Canonical Ltd.
4687- *
4688- * This program is free software: you can redistribute it and/or modify it
4689- * under the terms of the GNU General Public License version 3, as published
4690- * by the Free Software Foundation.
4691- *
4692- * This program is distributed in the hope that it will be useful, but
4693- * WITHOUT ANY WARRANTY; without even the implied warranties of
4694- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
4695- * PURPOSE. See the GNU General Public License for more details.
4696- *
4697- * You should have received a copy of the GNU General Public License along
4698- * with this program. If not, see <http://www.gnu.org/licenses/>.
4699- *
4700- * In addition, as a special exception, the copyright holders give
4701- * permission to link the code of portions of this program with the
4702- * OpenSSL library under certain conditions as described in each
4703- * individual source file, and distribute linked combinations
4704- * including the two.
4705- * You must obey the GNU General Public License in all respects
4706- * for all of the code used other than OpenSSL. If you modify
4707- * file(s) with this exception, you may extend this exception to your
4708- * version of the file(s), but you are not obligated to do so. If you
4709- * do not wish to do so, delete this exception statement from your
4710- * version. If you delete this exception statement from all source
4711- * files in the program, then also delete it here.
4712- *
4713- */
4714-
4715-#include "config.h"
4716-#include "syncdaemon-folders-interface.h"
4717-#include "utils.h"
4718-
4719-G_DEFINE_TYPE(SyncdaemonFoldersInterface, syncdaemon_folders_interface, SYNCDAEMON_TYPE_INTERFACE)
4720-
4721-struct _SyncdaemonFoldersInterfacePrivate {
4722- GObject *proxy;
4723- GHashTable *folders;
4724-};
4725-
4726-static void
4727-syncdaemon_folders_interface_finalize (GObject *object)
4728-{
4729- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (object);
4730-
4731- if (interface->priv != NULL) {
4732- if (interface->priv->folders != NULL)
4733- g_hash_table_destroy (interface->priv->folders);
4734-
4735- g_free (interface->priv);
4736- }
4737-
4738- G_OBJECT_CLASS (syncdaemon_folders_interface_parent_class)->finalize (object);
4739-}
4740-
4741-static void
4742-syncdaemon_folders_interface_class_init (SyncdaemonFoldersInterfaceClass *klass)
4743-{
4744- GObjectClass *object_class = G_OBJECT_CLASS (klass);
4745-
4746- object_class->finalize = syncdaemon_folders_interface_finalize;
4747-}
4748-
4749-static void
4750-folder_created_cb (DBusGProxy *proxy, GHashTable *hash, gpointer user_data)
4751-{
4752- SyncdaemonFolderInfo *folder_info;
4753- SyncdaemonDaemon *daemon = NULL;
4754- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4755-
4756- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4757-
4758- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4759-
4760- /* Update our cache of folders */
4761- if (interface->priv->folders != NULL) {
4762- g_hash_table_insert (interface->priv->folders,
4763- g_strdup (syncdaemon_folder_info_get_path (folder_info)),
4764- folder_info);
4765-
4766- if (daemon != NULL)
4767- g_signal_emit_by_name (daemon, "folder_created", TRUE, folder_info);
4768- } else {
4769- if (daemon != NULL)
4770- g_signal_emit_by_name (daemon, "folder_created", TRUE, folder_info);
4771- g_object_unref (G_OBJECT (folder_info));
4772- }
4773-}
4774-
4775-static void
4776-folder_create_error_cb (DBusGProxy *proxy, GHashTable *hash, gchar *error, gpointer user_data)
4777-{
4778- SyncdaemonDaemon *daemon = NULL;
4779- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4780-
4781- /* Notify listeners */
4782- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4783- if (daemon != NULL) {
4784- SyncdaemonFolderInfo *folder_info;
4785-
4786- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4787- g_signal_emit_by_name (daemon, "folder_created", FALSE, folder_info);
4788- g_object_unref (G_OBJECT (folder_info));
4789- }
4790-}
4791-
4792-static void
4793-folder_deleted_cb (DBusGProxy *proxy, GHashTable *hash, gpointer user_data)
4794-{
4795- SyncdaemonFolderInfo *folder_info;
4796- SyncdaemonDaemon *daemon = NULL;
4797- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4798-
4799- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4800-
4801- /* Notify listeners */
4802- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4803- if (daemon != NULL)
4804- g_signal_emit_by_name (daemon, "folder_deleted", TRUE, folder_info);
4805-
4806- /* Update our cache of folders */
4807- if (interface->priv->folders != NULL)
4808- g_hash_table_remove (interface->priv->folders,
4809- syncdaemon_folder_info_get_path (folder_info));
4810-
4811- g_object_unref (G_OBJECT (folder_info));
4812-}
4813-
4814-static void
4815-folder_delete_error_cb (DBusGProxy *proxy, GHashTable *hash, gchar *error, gpointer user_data)
4816-{
4817- SyncdaemonFolderInfo *folder_info;
4818- SyncdaemonDaemon *daemon = NULL;
4819- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4820-
4821- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4822-
4823- /* Notify listeners */
4824- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4825- if (daemon != NULL)
4826- g_signal_emit_by_name (daemon, "folder_deleted", FALSE, folder_info);
4827-
4828- g_object_unref (G_OBJECT (folder_info));
4829-}
4830-
4831-static void
4832-folder_subscribed_cb (DBusGProxy *proxy, GHashTable *hash, gpointer user_data)
4833-{
4834- SyncdaemonFolderInfo *folder_info;
4835- SyncdaemonDaemon *daemon = NULL;
4836- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4837-
4838- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4839-
4840- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4841- if (daemon != NULL)
4842- g_signal_emit_by_name (daemon, "folder_subscribed", TRUE, folder_info);
4843-
4844- if (interface->priv->folders != NULL) {
4845- g_hash_table_insert (interface->priv->folders,
4846- g_strdup (syncdaemon_folder_info_get_path (folder_info)),
4847- folder_info);
4848- } else
4849- g_object_unref (G_OBJECT (folder_info));
4850-}
4851-
4852-static void
4853-folder_subscribe_error_cb (DBusGProxy *proxy, GHashTable *hash, gchar *error, gpointer user_data)
4854-{
4855- SyncdaemonFolderInfo *folder_info;
4856- SyncdaemonDaemon *daemon = NULL;
4857- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4858-
4859- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4860-
4861- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4862- if (daemon != NULL)
4863- g_signal_emit_by_name (daemon, "folder_subscribed", FALSE, folder_info);
4864-
4865- g_object_unref (G_OBJECT (folder_info));
4866-}
4867-
4868-static void
4869-folder_unsubscribed_cb (DBusGProxy *proxy, GHashTable *hash, gpointer user_data)
4870-{
4871- SyncdaemonFolderInfo *folder_info;
4872- SyncdaemonDaemon *daemon = NULL;
4873- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4874-
4875- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4876-
4877- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4878- if (daemon != NULL)
4879- g_signal_emit_by_name (daemon, "folder_unsubscribed", TRUE, folder_info);
4880-
4881- if (interface->priv->folders != NULL) {
4882- g_hash_table_insert (interface->priv->folders,
4883- g_strdup (syncdaemon_folder_info_get_path (folder_info)),
4884- folder_info);
4885- } else
4886- g_object_unref (G_OBJECT (folder_info));
4887-}
4888-
4889-static void
4890-folder_unsubscribe_error_cb (DBusGProxy *proxy, GHashTable *hash, gchar *error, gpointer user_data)
4891-{
4892- SyncdaemonFolderInfo *folder_info;
4893- SyncdaemonDaemon *daemon = NULL;
4894- SyncdaemonFoldersInterface *interface = SYNCDAEMON_FOLDERS_INTERFACE (user_data);
4895-
4896- folder_info = syncdaemon_folder_info_new_from_hash_table (hash);
4897-
4898- g_object_get (G_OBJECT (interface), "daemon", &daemon, NULL);
4899- if (daemon != NULL)
4900- g_signal_emit_by_name (daemon, "folder_unsubscribed", FALSE, folder_info);
4901-
4902- g_object_unref (G_OBJECT (folder_info));
4903-}
4904-
4905-static void
4906-syncdaemon_folders_interface_init (SyncdaemonFoldersInterface *interface)
4907-{
4908- interface->priv = g_new0 (SyncdaemonFoldersInterfacePrivate, 1);
4909-
4910- /* Setup DBus proxy */
4911- interface->priv->proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (interface),
4912- "com.ubuntuone.SyncDaemon",
4913- "/folders", "com.ubuntuone.SyncDaemon.Folders");
4914- if (interface->priv->proxy != NULL) {
4915- /* Connect to DBus proxy signals */
4916- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderCreated",
4917- dbus_g_type_get_map ("GHashTable",
4918- G_TYPE_STRING,
4919- G_TYPE_STRING),
4920- G_TYPE_INVALID);
4921- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderCreated",
4922- G_CALLBACK (folder_created_cb), interface, NULL);
4923-
4924- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderDeleted",
4925- dbus_g_type_get_map ("GHashTable",
4926- G_TYPE_STRING,
4927- G_TYPE_STRING),
4928- G_TYPE_INVALID);
4929- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderDeleted",
4930- G_CALLBACK (folder_deleted_cb), interface, NULL);
4931-
4932- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderSubscribed",
4933- dbus_g_type_get_map ("GHashTable",
4934- G_TYPE_STRING,
4935- G_TYPE_STRING),
4936- G_TYPE_INVALID);
4937- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderSubscribed",
4938- G_CALLBACK (folder_subscribed_cb), interface, NULL);
4939-
4940- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderUnSubscribed",
4941- dbus_g_type_get_map ("GHashTable",
4942- G_TYPE_STRING,
4943- G_TYPE_STRING),
4944- G_TYPE_INVALID);
4945- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderUnSubscribed",
4946- G_CALLBACK (folder_unsubscribed_cb), interface, NULL);
4947-
4948- /* Error signals */
4949- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderCreateError",
4950- dbus_g_type_get_map ("GHashTable",
4951- G_TYPE_STRING,
4952- G_TYPE_STRING),
4953- G_TYPE_STRING,
4954- G_TYPE_INVALID);
4955- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderCreateError",
4956- G_CALLBACK (folder_create_error_cb), interface, NULL);
4957-
4958- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderDeleteError",
4959- dbus_g_type_get_map ("GHashTable",
4960- G_TYPE_STRING,
4961- G_TYPE_STRING),
4962- G_TYPE_STRING,
4963- G_TYPE_INVALID);
4964- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderDeleteError",
4965- G_CALLBACK (folder_delete_error_cb), interface, NULL);
4966-
4967- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderSubscribeError",
4968- dbus_g_type_get_map ("GHashTable",
4969- G_TYPE_STRING,
4970- G_TYPE_STRING),
4971- G_TYPE_STRING,
4972- G_TYPE_INVALID);
4973- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderSubscribeError",
4974- G_CALLBACK (folder_subscribe_error_cb), interface, NULL);
4975-
4976- dbus_g_proxy_add_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderUnSubscribeError",
4977- dbus_g_type_get_map ("GHashTable",
4978- G_TYPE_STRING,
4979- G_TYPE_STRING),
4980- G_TYPE_STRING,
4981- G_TYPE_INVALID);
4982- dbus_g_proxy_connect_signal (DBUS_G_PROXY (interface->priv->proxy), "FolderUnSubscribeError",
4983- G_CALLBACK (folder_unsubscribe_error_cb), interface, NULL);
4984- }
4985-}
4986-
4987-/**
4988- * syncdaemon_folders_interface_new:
4989- */
4990-SyncdaemonFoldersInterface *
4991-syncdaemon_folders_interface_new (SyncdaemonDaemon *daemon)
4992-{
4993- g_return_val_if_fail (SYNCDAEMON_IS_DAEMON (daemon), NULL);
4994-
4995- return g_object_new (SYNCDAEMON_TYPE_FOLDERS_INTERFACE, "daemon", daemon, NULL);
4996-}
4997-
4998-/**
4999- * syncdaemon_folders_interface_create:
5000- */
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: