[gvfs] AFP: add try_mount implementation
- From: Christian Kellner <gicmo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] AFP: add try_mount implementation
- Date: Thu, 25 Aug 2011 19:20:41 +0000 (UTC)
commit 23ca625147538f1bae9bd7eb95f0155ce47dadec
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Wed May 25 00:36:09 2011 +0200
AFP: add try_mount implementation
daemon/gvfsbackendafp.c | 29 +++++++++++++++++++++++++++++
daemon/gvfsbackendafp.h | 13 ++++++++-----
2 files changed, 37 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsbackendafp.c b/daemon/gvfsbackendafp.c
index acc30b2..154c41e 100644
--- a/daemon/gvfsbackendafp.c
+++ b/daemon/gvfsbackendafp.c
@@ -22,6 +22,10 @@
#include <config.h>
+#include <stdlib.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+
#include "gvfsjobmount.h"
@@ -38,6 +42,31 @@ try_mount (GVfsBackend *backend,
GMountSource *mount_source,
gboolean is_automount)
{
+ GVfsBackendAfp *afp_backend = G_VFS_BACKEND_AFP (backend);
+
+ const char *host, *portstr, *user;
+ guint16 port = 548;
+
+ host = g_mount_spec_get (mount_spec, "host");
+ if (host == NULL)
+ {
+ g_vfs_job_failed (G_VFS_JOB (job),
+ G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+ _("No hostname specified"));
+ return TRUE;
+ }
+
+ portstr = g_mount_spec_get (mount_spec, "port");
+ if (portstr != NULL)
+ {
+ port = atoi (portstr);
+ }
+
+ afp_backend->addr = g_network_address_new (host, port);
+
+ user = g_mount_spec_get (mount_spec, "user");
+ afp_backend->user = g_strdup (user);
+
return FALSE;
}
diff --git a/daemon/gvfsbackendafp.h b/daemon/gvfsbackendafp.h
index 4edf2ac..230c7f6 100644
--- a/daemon/gvfsbackendafp.h
+++ b/daemon/gvfsbackendafp.h
@@ -28,11 +28,11 @@
G_BEGIN_DECLS
#define G_VFS_TYPE_BACKEND_AFP (g_vfs_backend_afp_get_type ())
-#define G_VFS_BACKEND_AFP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VFS_BACKEND_AFP, GVfsBackendAfp))
-#define G_VFS_BACKEND_AFP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_VFS_BACKEND_AFP, GVfsBackendAfpClass))
-#define G_IS_VFS_BACKEND_AFP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VFS_BACKEND_AFP))
-#define G_IS_VFS_BACKEND_AFP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_VFS_BACKEND_AFP))
-#define G_VFS_BACKEND_AFP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_VFS_BACKEND_AFP, GVfsBackendAfpClass))
+#define G_VFS_BACKEND_AFP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_VFS_TYPE_BACKEND_AFP, GVfsBackendAfp))
+#define G_VFS_BACKEND_AFP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_VFS_TYPE_BACKEND_AFP, GVfsBackendAfpClass))
+#define G_IS_VFS_BACKEND_AFP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_VFS_TYPE_BACKEND_AFP))
+#define G_IS_VFS_BACKEND_AFP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_VFS_TYPE_BACKEND_AFP))
+#define G_VFS_BACKEND_AFP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_VFS_TYPE_BACKEND_AFP, GVfsBackendAfpClass))
typedef struct _GVfsBackendAfpClass GVfsBackendAfpClass;
typedef struct _GVfsBackendAfp GVfsBackendAfp;
@@ -45,6 +45,9 @@ struct _GVfsBackendAfpClass
struct _GVfsBackendAfp
{
GVfsBackend parent_instance;
+
+ GSocketConnectable *addr;
+ char *user;
};
GType g_vfs_backend_afp_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]