[gvfs/wip/rishi/goa: 6/6] Drop the URI mapper



commit 32c821d10253104d3134ceed0398b3bbe5df57d1
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Aug 20 13:22:54 2015 +0200

    Drop the URI mapper

 client/Makefile.am         |    1 -
 client/gdaemonvfs.c        |    2 -
 client/googleuri.c         |  194 --------------------------------------------
 daemon/gvfsbackendgoogle.c |   24 +++---
 4 files changed, 11 insertions(+), 210 deletions(-)
---
diff --git a/client/Makefile.am b/client/Makefile.am
index c9aa1f6..8c7b76a 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -22,7 +22,6 @@ gvfsclientinclude_HEADERS = \
 
 URI_PARSER_SOURCES = \
        smburi.c \
-       googleuri.c \
        httpuri.c \
        afpuri.c \
        $(NULL)
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 758fd98..11435e8 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -1488,7 +1488,6 @@ g_daemon_vfs_class_init (GDaemonVfsClass *class)
 /* Module API */
 
 void g_vfs_uri_mapper_smb_register (GIOModule *module);
-void g_vfs_uri_mapper_google_register (GIOModule *module);
 void g_vfs_uri_mapper_http_register (GIOModule *module);
 void g_vfs_uri_mapper_afp_register (GIOModule *module);
 
@@ -1524,7 +1523,6 @@ g_io_module_load (GIOModule *module)
   
   g_vfs_uri_mapper_register (module);
   g_vfs_uri_mapper_smb_register (module);
-  g_vfs_uri_mapper_google_register (module);
   g_vfs_uri_mapper_http_register (module);
   g_vfs_uri_mapper_afp_register (module);
 }
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index dad8381..101a789 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -60,6 +60,7 @@ struct _GVfsBackendGoogle
   GRecMutex mutex;
   GoaClient *client;
   gboolean entries_stale;
+  gchar *account_identity;
   guint entries_stale_timeout;
 };
 
@@ -411,7 +412,6 @@ build_file_info (GVfsBackendGoogle      *self,
 
   if (is_symlink)
     {
-      const gchar *mount_identity;
       const gchar *type;
       gchar *escaped_filename = NULL;
       gchar *target_uri = NULL;
@@ -419,9 +419,8 @@ build_file_info (GVfsBackendGoogle      *self,
       file_type = G_FILE_TYPE_SYMBOLIC_LINK;
 
       type = g_mount_spec_get (spec, "type");
-      mount_identity = g_mount_spec_get (spec, "goa-identity");
       escaped_filename = escape_filename (filename);
-      target_uri = g_strdup_printf ("%s://%s%s", type, mount_identity, escaped_filename);
+      target_uri = g_strdup_printf ("%s://%s%s", type, self->account_identity, escaped_filename);
       g_file_info_set_symlink_target (info, target_uri);
       g_free (target_uri);
       g_free (escaped_filename);
@@ -1515,7 +1514,8 @@ g_vfs_backend_google_mount (GVfsBackend  *_self,
   GList *accounts = NULL;
   GList *l;
   gboolean account_found = FALSE;
-  const gchar *mount_identity;
+  const gchar *host;
+  const gchar *user;
 
   g_debug ("+ mount\n");
 
@@ -1531,12 +1531,9 @@ g_vfs_backend_google_mount (GVfsBackend  *_self,
         }
     }
 
-  mount_identity = g_mount_spec_get (spec, "goa-identity");
-  if (mount_identity == NULL)
-    {
-      g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Invalid mount spec"));
-      goto out;
-    }
+  host = g_mount_spec_get (spec, "host");
+  user = g_mount_spec_get (spec, "user");
+  self->account_identity = g_strconcat (user, "@", host, NULL);
 
   accounts = goa_client_get_accounts (self->client);
   for (l = accounts; l != NULL && !account_found; l = l->next)
@@ -1551,7 +1548,7 @@ g_vfs_backend_google_mount (GVfsBackend  *_self,
       provider_type = goa_account_dup_provider_type (account);
 
       if (g_strcmp0 (provider_type, "google") == 0 &&
-          g_strcmp0 (account_identity, mount_identity) == 0)
+          g_strcmp0 (account_identity, self->account_identity) == 0)
         {
           GDataGoaAuthorizer *authorizer;
 
@@ -1580,12 +1577,12 @@ g_vfs_backend_google_mount (GVfsBackend  *_self,
                         G_IO_ERROR,
                         G_IO_ERROR_INVALID_ARGUMENT,
                         _("Failed to find a matching GOA account: %s"),
-                        mount_identity);
+                        self->account_identity);
       goto out;
     }
 
   g_vfs_backend_set_mount_spec (_self, spec);
-  g_vfs_backend_set_display_name (_self, mount_identity);
+  g_vfs_backend_set_display_name (_self, self->account_identity);
   g_vfs_job_succeeded (G_VFS_JOB (job));
 
  out:
@@ -2473,6 +2470,7 @@ g_vfs_backend_google_finalize (GObject *_self)
 
   g_hash_table_foreach (self->monitors, remove_monitor_weak_ref, self->monitors);
   g_hash_table_unref (self->monitors);
+  g_free (self->account_identity);
 
   g_rec_mutex_clear (&self->mutex);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]