summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2009-06-30 14:48:06 +0000
committerMichael Albinus <michael.albinus@gmx.de>2009-06-30 14:48:06 +0000
commit7ae3ea65e3ee04b8afe7cd364c7029856597a56a (patch)
tree98f4a984519cba675c78b85707009147198869c4
parent4f4126e6a32887ae2f6ebf99e4da038f5cc0b290 (diff)
downloademacs-7ae3ea65e3ee04b8afe7cd364c7029856597a56a.tar.gz
* net/tramp-gvfs.el (tramp-gvfs-methods): Add "synce" method.
(tramp-gvfs-connection-mounted-p): Handle empty user name for synce. (tramp-synce-list-devices, tramp-synce-parse-device-names): New defuns. (top): Add completion function for "synce" method.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/net/tramp-gvfs.el40
2 files changed, 45 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 037e0981c71..17a21d0b4fa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,13 @@
* net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
also the 'rename case, when setting file modes. (Bug#3712)
+ * net/tramp-gvfs.el (tramp-gvfs-methods): Add "synce" method.
+ (tramp-gvfs-connection-mounted-p): Handle empty user name for
+ synce.
+ (tramp-synce-list-devices, tramp-synce-parse-device-names): New
+ defuns.
+ (top): Add completion function for "synce" method.
+
2009-06-30 Kenichi Handa <handa@m17n.org>
* international/fontset.el (setup-default-fontset): Add CJK fonts
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 640a281594b..aaba49e8154 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -98,7 +98,7 @@
(require 'url-parse)
(require 'zeroconf)
-(defcustom tramp-gvfs-methods '("dav" "davs" "obex")
+(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
"*List of methods for remote files, accessed with GVFS."
:group 'tramp
:type '(repeat (choice (const "dav")
@@ -106,7 +106,8 @@
(const "ftp")
(const "obex")
(const "sftp")
- (const "smb"))))
+ (const "smb")
+ (const "synce"))))
(defcustom tramp-gvfs-zeroconf-domain "local"
"*Zeroconf domain to be used for discovering services, like host names."
@@ -898,6 +899,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
(setq host (tramp-bluez-device host)))
(when (and (string-equal "dav" method) (string-equal "true" ssl))
(setq method "davs"))
+ (when (and (string-equal "synce" method) (zerop (length user)))
+ (setq user (or (tramp-file-name-user vec) "")))
(unless (zerop (length domain))
(setq user (concat user tramp-prefix-domain-format domain)))
(unless (zerop (length port))
@@ -1171,6 +1174,39 @@ be used."
(tramp-set-completion-function
"davs" '((tramp-zeroconf-parse-webdav-device-names ""))))
+
+;; D-Bus SYNCE functions.
+
+(defun tramp-synce-list-devices ()
+ "Returns all discovered synce devices as list."
+ (let (tramp-synce-devices)
+ (dolist (device
+ (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
+ :system "org.freedesktop.Hal"
+ "/org/freedesktop/Hal/Manager"
+ "org.freedesktop.Hal.Manager" "GetAllDevices"))
+ (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
+ :system "org.freedesktop.Hal" device
+ "org.freedesktop.Hal.Device" "PropertyExists" "sync.plugin")
+ (add-to-list
+ 'tramp-synce-devices
+ (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
+ :system "org.freedesktop.Hal" device
+ "org.freedesktop.Hal.Device"
+ "GetPropertyString" "pda.pocketpc.name"))))
+ (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices)
+ tramp-synce-devices))
+
+(defun tramp-synce-parse-device-names (ignore)
+ "Return a list of (nil host) tuples allowed to access."
+ (mapcar
+ (lambda (x) (list nil x))
+ (tramp-synce-list-devices)))
+
+;; Add completion function for SYNCE method.
+(tramp-set-completion-function
+ "synce" '((tramp-synce-parse-device-names "")))
+
(provide 'tramp-gvfs)
;;; TODO: