Beispiel #1
0
static void
do_replace (GVfsBackend *backend,
	    GVfsJobOpenForWrite *job,
	    const char *filename,
	    const char *etag,
	    gboolean make_backup,
	    GFileCreateFlags flags)
{
  GFile *file;
  GFileOutputStream *out;
  GError *error;
  
  file = g_vfs_get_file_for_path (g_vfs_get_local (),
				  filename);

  error = NULL;
  out = g_file_replace (file,
			etag, make_backup,
			flags, G_VFS_JOB (job)->cancellable,
			&error);
  g_object_unref (file);
  if (out)
    {
      g_vfs_job_open_for_write_set_can_seek (job, FALSE);
      g_vfs_job_open_for_write_set_handle (job, out);
      g_vfs_job_succeeded (G_VFS_JOB (job));
    }
  else
    {
      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
      g_error_free (error);
    }
}
Beispiel #2
0
static void
do_query_info (GVfsBackend *backend,
	       GVfsJobQueryInfo *job,
	       const char *filename,
	       GFileQueryInfoFlags flags,
	       GFileInfo *info,
	       GFileAttributeMatcher *matcher)
{
  GFile *file;
  GFileInfo *info2;
  GError *error;
  GVfs *local_vfs;

  g_print ("do_get_file_info (%s)\n", filename);
  
  local_vfs = g_vfs_get_local ();
  file = g_vfs_get_file_for_path (local_vfs, filename);

  error = NULL;
  info2 = g_file_query_info (file, job->attributes, flags,
			     NULL, &error);

  if (info2)
    {
      g_file_info_copy_into (info2, info);
      g_object_unref (info2);
      g_vfs_job_succeeded (G_VFS_JOB (job));
    }
  else
    g_vfs_job_failed_from_error (G_VFS_JOB (job), error);

  g_object_unref (file);
}
Beispiel #3
0
static VALUE
vfs_get_local(G_GNUC_UNUSED VALUE self)
{
        return GOBJ2RVAL(g_vfs_get_local());
}