libgnomevfs2-mythtv/modules/mythtv-method.c
branchtrunk
changeset 753 8ee634511c1e
parent 747 7eeaef26704c
child 754 cb885ee44618
     1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Tue Jun 12 16:04:52 2007 +0100
     1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Thu Jun 14 18:22:32 2007 +0100
     1.3 @@ -52,664 +52,685 @@
     1.4  /* maximum number of bytes to be requested to the MythTV backend ( 64 Kbytes ) */
     1.5  #define MYTHTV_MAX_REQUEST_SIZE                     64*1024
     1.6  
     1.7 -typedef struct {
     1.8 -	GMythFile *file;
     1.9 -	GMythLiveTV *livetv;
    1.10 -    GMythBackendInfo *backend_info;
    1.11 -    GMythURI *gmyth_uri;
    1.12 -    GMythRecorder *live_recorder;
    1.13 -    gboolean started;
    1.14 -    gint64 offset;
    1.15 -    
    1.16 -    gboolean is_livetv; /* it is, or not a Live TV content transfer */
    1.17 -    gboolean is_local_file; /* tell if the file is local to the current content transfer */
    1.18 +typedef struct
    1.19 +{
    1.20 +  GMythFile *file;
    1.21 +  GMythLiveTV *livetv;
    1.22 +  GMythBackendInfo *backend_info;
    1.23 +  GMythURI *gmyth_uri;
    1.24 +  GMythRecorder *live_recorder;
    1.25 +  gboolean started;
    1.26 +  gint64 offset;
    1.27  
    1.28 -	gchar *channel_name;
    1.29 +  gboolean is_livetv;			/* it is, or not a Live TV content transfer */
    1.30 +  gboolean is_local_file;		/* tell if the file is local to the current content transfer */
    1.31  
    1.32 -	gint mythtv_version;
    1.33 -	gboolean configured;
    1.34 +  gchar *channel_name;
    1.35 +
    1.36 +  gint mythtv_version;
    1.37 +  gboolean configured;
    1.38  } MythtvHandle;
    1.39  
    1.40  
    1.41 -static GnomeVFSResult do_read (GnomeVFSMethod * method,
    1.42 -			       GnomeVFSMethodHandle * method_handle,
    1.43 -			       gpointer buffer,
    1.44 -			       GnomeVFSFileSize num_bytes,
    1.45 -			       GnomeVFSFileSize * bytes_read,
    1.46 -			       GnomeVFSContext * context);
    1.47 +static GnomeVFSResult do_read(GnomeVFSMethod * method,
    1.48 +							  GnomeVFSMethodHandle * method_handle,
    1.49 +							  gpointer buffer,
    1.50 +							  GnomeVFSFileSize num_bytes,
    1.51 +							  GnomeVFSFileSize * bytes_read,
    1.52 +							  GnomeVFSContext * context);
    1.53  
    1.54 -static GnomeVFSResult   myth_connection_start   (MythtvHandle * method_handle);
    1.55 -static void             myth_destroy_handle     (MythtvHandle * method_handle);
    1.56 -static GnomeVFSResult   myth_handle_new         (GnomeVFSURI * uri,
    1.57 -                                                 MythtvHandle ** method_handle);
    1.58 -static GnomeVFSResult   myth_get_file_info      (MythtvHandle * myth_handle,
    1.59 -                                                 GnomeVFSURI * uri,
    1.60 -                                                 GnomeVFSFileInfo * info);
    1.61 +static GnomeVFSResult myth_connection_start(MythtvHandle * method_handle);
    1.62 +static void myth_destroy_handle(MythtvHandle * method_handle);
    1.63 +static GnomeVFSResult myth_handle_new(GnomeVFSURI * uri,
    1.64 +									  MythtvHandle ** method_handle);
    1.65 +static GnomeVFSResult myth_get_file_info(MythtvHandle * myth_handle,
    1.66 +										 GnomeVFSURI * uri,
    1.67 +										 GnomeVFSFileInfo * info);
    1.68  
    1.69 -static GnomeVFSResult 
    1.70 -myth_handle_new (GnomeVFSURI * uri,
    1.71 -                 MythtvHandle ** method_handle)
    1.72 -{   
    1.73 -    gchar *tmp_str1;
    1.74 -    gchar *tmp_str2;
    1.75 +static GnomeVFSResult
    1.76 +myth_handle_new(GnomeVFSURI * uri, MythtvHandle ** method_handle)
    1.77 +{
    1.78 +  gchar *tmp_str1;
    1.79 +  gchar *tmp_str2;
    1.80  
    1.81 -    _GNOME_VFS_METHOD_PARAM_CHECK (*method_handle == NULL);
    1.82 -    
    1.83 -	if (gnome_vfs_uri_get_host_name (uri) == NULL) {
    1.84 -		return GNOME_VFS_ERROR_INVALID_HOST_NAME;
    1.85 +  _GNOME_VFS_METHOD_PARAM_CHECK(*method_handle == NULL);
    1.86 +
    1.87 +  if (gnome_vfs_uri_get_host_name(uri) == NULL)
    1.88 +	{
    1.89 +	  return GNOME_VFS_ERROR_INVALID_HOST_NAME;
    1.90  	}
    1.91  
    1.92 -    *method_handle = g_new0 (MythtvHandle, 1);
    1.93 -    (*method_handle)->mythtv_version = MYTHTV_VERSION_DEFAULT;
    1.94 -    
    1.95 -    (*method_handle)->is_livetv = FALSE;
    1.96 -    (*method_handle)->is_local_file = FALSE;
    1.97 -        
    1.98 -    tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
    1.99 -    tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   1.100 +  *method_handle = g_new0(MythtvHandle, 1);
   1.101 +  (*method_handle)->mythtv_version = MYTHTV_VERSION_DEFAULT;
   1.102  
   1.103 -    gchar *tmp_str3 = strstr (tmp_str2, ".nuv.avi");
   1.104 -    if (tmp_str3 != NULL) {
   1.105 -        tmp_str3[4] = '\0';
   1.106 -    }
   1.107 +  (*method_handle)->is_livetv = FALSE;
   1.108 +  (*method_handle)->is_local_file = FALSE;
   1.109  
   1.110 -    (*method_handle)->backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   1.111 -    (*method_handle)->gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   1.112 -    g_free (tmp_str1);
   1.113 -    g_free (tmp_str2);
   1.114 +  tmp_str1 = gnome_vfs_uri_to_string(uri, GNOME_VFS_URI_HIDE_NONE);
   1.115 +  tmp_str2 = gnome_vfs_unescape_string(tmp_str1, "");
   1.116  
   1.117 -    return GNOME_VFS_OK;
   1.118 -}   
   1.119 +  gchar *tmp_str3 = strstr(tmp_str2, ".nuv.avi");
   1.120 +  if (tmp_str3 != NULL)
   1.121 +	{
   1.122 +	  tmp_str3[4] = '\0';
   1.123 +	}
   1.124 +
   1.125 +  (*method_handle)->backend_info = gmyth_backend_info_new_with_uri(tmp_str2);
   1.126 +  (*method_handle)->gmyth_uri = gmyth_uri_new_with_value(tmp_str2);
   1.127 +  g_free(tmp_str1);
   1.128 +  g_free(tmp_str2);
   1.129 +
   1.130 +  return GNOME_VFS_OK;
   1.131 +}
   1.132  
   1.133  static void
   1.134 -myth_destroy_handle (MythtvHandle * method_handle)
   1.135 +myth_destroy_handle(MythtvHandle * method_handle)
   1.136  {
   1.137 -    //TODO: abort if in tranfer state
   1.138 -    
   1.139 -    if (method_handle->backend_info != NULL) {
   1.140 -        g_object_unref (method_handle->backend_info);
   1.141 -        method_handle->backend_info = NULL;
   1.142 -    }
   1.143 -    
   1.144 -    if (method_handle->channel_name != NULL) {
   1.145 -        g_free (method_handle->channel_name);
   1.146 -        method_handle->channel_name = NULL;
   1.147 -    }
   1.148 + //TODO: abort if in tranfer state
   1.149  
   1.150 -    if (method_handle->livetv != NULL) {
   1.151 -        g_object_unref (method_handle->livetv);
   1.152 -        method_handle->livetv = NULL;
   1.153 -    }
   1.154 +  if (method_handle->backend_info != NULL)
   1.155 +	{
   1.156 +	  g_object_unref(method_handle->backend_info);
   1.157 +	  method_handle->backend_info = NULL;
   1.158 +	}
   1.159  
   1.160 -    if (method_handle->file != NULL) {
   1.161 -        g_object_unref (method_handle->file);
   1.162 -        method_handle->file = NULL;
   1.163 -    }
   1.164 +  if (method_handle->channel_name != NULL)
   1.165 +	{
   1.166 +	  g_free(method_handle->channel_name);
   1.167 +	  method_handle->channel_name = NULL;
   1.168 +	}
   1.169  
   1.170 -    if (method_handle->gmyth_uri != NULL) {
   1.171 -        g_object_unref (method_handle->gmyth_uri);
   1.172 -        method_handle->gmyth_uri = NULL;
   1.173 -    }
   1.174 +  if (method_handle->livetv != NULL)
   1.175 +	{
   1.176 +	  g_object_unref(method_handle->livetv);
   1.177 +	  method_handle->livetv = NULL;
   1.178 +	}
   1.179  
   1.180 -    g_free (method_handle);
   1.181 +  if (method_handle->file != NULL)
   1.182 +	{
   1.183 +	  g_object_unref(method_handle->file);
   1.184 +	  method_handle->file = NULL;
   1.185 +	}
   1.186 +
   1.187 +  if (method_handle->gmyth_uri != NULL)
   1.188 +	{
   1.189 +	  g_object_unref(method_handle->gmyth_uri);
   1.190 +	  method_handle->gmyth_uri = NULL;
   1.191 +	}
   1.192 +
   1.193 +  g_free(method_handle);
   1.194  }
   1.195  
   1.196  static GnomeVFSResult
   1.197 -myth_get_file_info (MythtvHandle * myth_handle,
   1.198 -                    GnomeVFSURI * uri,
   1.199 -                    GnomeVFSFileInfo * info)
   1.200 +myth_get_file_info(MythtvHandle * myth_handle,
   1.201 +				   GnomeVFSURI * uri, GnomeVFSFileInfo * info)
   1.202  {
   1.203 -    GMythURI *gmyth_uri;
   1.204 -    GMythBackendInfo *backend_info;
   1.205 -    gboolean is_livetv;
   1.206 -    gboolean is_local;
   1.207 -    
   1.208 -    _GNOME_VFS_METHOD_PARAM_CHECK (info != NULL);
   1.209 -    
   1.210 -g_debug ("%s - %d", __FUNCTION__, __LINE__);
   1.211 +  GMythURI *gmyth_uri;
   1.212 +  GMythBackendInfo *backend_info;
   1.213 +  gboolean is_livetv;
   1.214 +  gboolean is_local;
   1.215  
   1.216 -    if (myth_handle == NULL) {
   1.217 -        gchar *tmp_str1;
   1.218 -        gchar *tmp_str2;
   1.219 -        
   1.220 -        tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   1.221 -        tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   1.222 +  _GNOME_VFS_METHOD_PARAM_CHECK(info != NULL);
   1.223  
   1.224 -        backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   1.225 -        gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   1.226 -        
   1.227 -        g_free (tmp_str1);
   1.228 -        g_free (tmp_str2);
   1.229 -    } else {
   1.230 -        backend_info = g_object_ref (myth_handle->backend_info);
   1.231 -        gmyth_uri = g_object_ref (myth_handle->gmyth_uri);
   1.232 -    }
   1.233 +  g_debug("%s - %d", __FUNCTION__, __LINE__);
   1.234  
   1.235 -    info->valid_fields = 0;
   1.236 -	info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | 
   1.237 -        GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | 
   1.238 -        GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
   1.239 -    
   1.240 -	info->type = GNOME_VFS_FILE_TYPE_REGULAR;
   1.241 -    
   1.242 -	/* fixme: get from file extension? */
   1.243 -	info->mime_type = g_strdup ("video/x-nuv");
   1.244 -	info->permissions = GNOME_VFS_PERM_USER_READ | 
   1.245 -        GNOME_VFS_PERM_OTHER_READ | 
   1.246 -        GNOME_VFS_PERM_GROUP_READ;
   1.247 -   
   1.248 -	info->name = g_strdup (gmyth_uri_get_path (gmyth_uri));
   1.249 -    
   1.250 -    /* file size for remote files */
   1.251 -    is_livetv = gmyth_uri_is_livetv (gmyth_uri);
   1.252 -    
   1.253 -    if (is_livetv == FALSE) {
   1.254 -        GMythFile *file = NULL;
   1.255 -        gboolean ret = FALSE;
   1.256 +  if (myth_handle == NULL)
   1.257 +	{
   1.258 +	  gchar *tmp_str1;
   1.259 +	  gchar *tmp_str2;
   1.260  
   1.261 -        /* Verifies if the file exists */
   1.262 -        if (!gmyth_util_file_exists (backend_info, 
   1.263 -                    gmyth_uri_get_path (gmyth_uri))) {
   1.264 -            g_object_unref (file);
   1.265 -            g_object_unref (backend_info);
   1.266 -            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.267 -            return GNOME_VFS_ERROR_NOT_FOUND;
   1.268 +	  tmp_str1 = gnome_vfs_uri_to_string(uri, GNOME_VFS_URI_HIDE_NONE);
   1.269 +	  tmp_str2 = gnome_vfs_unescape_string(tmp_str1, "");
   1.270 +
   1.271 +	  backend_info = gmyth_backend_info_new_with_uri(tmp_str2);
   1.272 +	  gmyth_uri = gmyth_uri_new_with_value(tmp_str2);
   1.273 +
   1.274 +	  g_free(tmp_str1);
   1.275 +	  g_free(tmp_str2);
   1.276 +	}
   1.277 +  else
   1.278 +	{
   1.279 +	  backend_info = g_object_ref(myth_handle->backend_info);
   1.280 +	  gmyth_uri = g_object_ref(myth_handle->gmyth_uri);
   1.281 +	}
   1.282 +
   1.283 +  info->valid_fields = 0;
   1.284 +  info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE |
   1.285 +	GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE |
   1.286 +	GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
   1.287 +
   1.288 +  info->type = GNOME_VFS_FILE_TYPE_REGULAR;
   1.289 +
   1.290 + /* fixme: get from file extension? */
   1.291 +  info->mime_type = g_strdup("video/x-nuv");
   1.292 +  info->permissions = GNOME_VFS_PERM_USER_READ |
   1.293 +	GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_GROUP_READ;
   1.294 +
   1.295 +  info->name = g_strdup(gmyth_uri_get_path(gmyth_uri));
   1.296 +
   1.297 + /* file size for remote files */
   1.298 +  is_livetv = gmyth_uri_is_livetv(gmyth_uri);
   1.299 +
   1.300 +  if (is_livetv == FALSE)
   1.301 +	{
   1.302 +	  GMythFile *file = NULL;
   1.303 +	  gboolean ret = FALSE;
   1.304 +
   1.305 +	 /* Verifies if the file exists */
   1.306 +	  if (!gmyth_util_file_exists(backend_info,
   1.307 +								  gmyth_uri_get_path(gmyth_uri)))
   1.308 +		{
   1.309 +		  g_object_unref(file);
   1.310 +		  g_object_unref(backend_info);
   1.311 +		  g_debug("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.312 +		  return GNOME_VFS_ERROR_NOT_FOUND;
   1.313  		}
   1.314  
   1.315 -        is_local = gmyth_uri_is_local_file (gmyth_uri);
   1.316 -        if (is_local == TRUE ) {
   1.317 -          file = GMYTH_FILE (gmyth_file_local_new(backend_info));
   1.318 -          ret = gmyth_file_local_open (GMYTH_FILE_LOCAL (file));
   1.319 -        } else {
   1.320 -          file = GMYTH_FILE (gmyth_file_transfer_new(backend_info));
   1.321 -          ret = gmyth_file_transfer_open (GMYTH_FILE_TRANSFER(file), 
   1.322 -                          gmyth_uri_get_path (gmyth_uri));
   1.323 -        }
   1.324 -        
   1.325 -        if (!ret) {
   1.326 -            g_object_unref (file);
   1.327 -            g_object_unref (backend_info);
   1.328 -            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.329 -            return GNOME_VFS_ERROR_NOT_FOUND;
   1.330 -        }
   1.331 -        
   1.332 -		info->size = gmyth_file_get_filesize (file);
   1.333 -        info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
   1.334 -		g_object_unref (file);
   1.335 +	  is_local = gmyth_uri_is_local_file(gmyth_uri);
   1.336 +	  if (is_local == TRUE)
   1.337 +		{
   1.338 +		  file = GMYTH_FILE(gmyth_file_local_new(backend_info));
   1.339 +		  ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(file));
   1.340 +		}
   1.341 +	  else
   1.342 +		{
   1.343 +		  file = GMYTH_FILE(gmyth_file_transfer_new(backend_info));
   1.344 +		  ret = gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(file),
   1.345 +										 gmyth_uri_get_path(gmyth_uri));
   1.346 +		}
   1.347 +
   1.348 +	  if (!ret)
   1.349 +		{
   1.350 +		  g_object_unref(file);
   1.351 +		  g_object_unref(backend_info);
   1.352 +		  g_debug("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.353 +		  return GNOME_VFS_ERROR_NOT_FOUND;
   1.354 +		}
   1.355 +
   1.356 +	  info->size = gmyth_file_get_filesize(file);
   1.357 +	  info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
   1.358 +	  g_object_unref(file);
   1.359  	}
   1.360  
   1.361 -    g_object_unref (backend_info);
   1.362 -    g_object_unref (gmyth_uri);
   1.363 -    
   1.364 -    return GNOME_VFS_OK;
   1.365 +  g_object_unref(backend_info);
   1.366 +  g_object_unref(gmyth_uri);
   1.367 +
   1.368 +  return GNOME_VFS_OK;
   1.369  }
   1.370  
   1.371  static GnomeVFSResult
   1.372 -myth_connection_start (MythtvHandle * method_handle)
   1.373 +myth_connection_start(MythtvHandle * method_handle)
   1.374  {
   1.375 -    GnomeVFSResult result = GNOME_VFS_OK;
   1.376 +  GnomeVFSResult result = GNOME_VFS_OK;
   1.377  
   1.378 -    _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   1.379 -    _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL);
   1.380 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle != NULL);
   1.381 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle->backend_info != NULL);
   1.382  
   1.383 -	/* Connect to the backend */
   1.384 -	if ( ( method_handle->is_livetv = gmyth_uri_is_livetv (method_handle->gmyth_uri) ) == TRUE) {
   1.385 -		method_handle->livetv = gmyth_livetv_new (method_handle->backend_info);
   1.386 -		method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri);
   1.387 -        
   1.388 -		if (method_handle->channel_name != NULL) {
   1.389 -		    if (gmyth_livetv_channel_name_setup (method_handle->livetv, 
   1.390 -                    method_handle->channel_name) == FALSE) {
   1.391 -                result = GNOME_VFS_ERROR_INVALID_URI;
   1.392 -    			goto error;
   1.393 + /* Connect to the backend */
   1.394 +  if ((method_handle->is_livetv =
   1.395 +	   gmyth_uri_is_livetv(method_handle->gmyth_uri)) == TRUE)
   1.396 +	{
   1.397 +	  method_handle->livetv = gmyth_livetv_new(method_handle->backend_info);
   1.398 +	  method_handle->channel_name =
   1.399 +		gmyth_uri_get_channel_name(method_handle->gmyth_uri);
   1.400 +
   1.401 +	  if (method_handle->channel_name != NULL)
   1.402 +		{
   1.403 +		  if (gmyth_livetv_channel_name_setup(method_handle->livetv,
   1.404 +											  method_handle->channel_name) ==
   1.405 +			  FALSE)
   1.406 +			{
   1.407 +			  result = GNOME_VFS_ERROR_INVALID_URI;
   1.408 +			  goto error;
   1.409  			}
   1.410 -		} else if (gmyth_livetv_setup (method_handle->livetv) == FALSE) {
   1.411 -                result = GNOME_VFS_ERROR_INVALID_URI;
   1.412 -                goto error;
   1.413  		}
   1.414 -        
   1.415 +	  else if (gmyth_livetv_setup(method_handle->livetv) == FALSE)
   1.416 +		{
   1.417 +		  result = GNOME_VFS_ERROR_INVALID_URI;
   1.418 +		  goto error;
   1.419 +		}
   1.420  
   1.421 -    	method_handle->file = 
   1.422 -            GMYTH_FILE( gmyth_livetv_create_file_transfer (method_handle->livetv) );
   1.423  
   1.424 -        if (method_handle->file == NULL) {
   1.425 -            result = GNOME_VFS_ERROR_INVALID_URI;
   1.426 -    		g_debug ("MythTV FileTransfer is NULL!\n");
   1.427 -            goto error;
   1.428 -        }
   1.429 +	  method_handle->file =
   1.430 +		GMYTH_FILE(gmyth_livetv_create_file_transfer(method_handle->livetv));
   1.431  
   1.432 -	    if (!gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(method_handle->file),
   1.433 -                                        method_handle->livetv->uri != NULL ? 
   1.434 -                                        gmyth_uri_get_path (method_handle->livetv->uri) :
   1.435 -                                        method_handle->livetv->proginfo->pathname->str)) {
   1.436 -        
   1.437 -            g_debug ("Couldn't open MythTV FileTransfer is NULL!\n");
   1.438 -            result = GNOME_VFS_ERROR_NOT_OPEN;
   1.439 -            goto error;
   1.440 -        }
   1.441 -    }
   1.442 -    else {
   1.443 -        gboolean ret = TRUE;
   1.444 -		/* Verifies if the file exists */
   1.445 -		if (!gmyth_util_file_exists (method_handle->backend_info, 
   1.446 -                    gmyth_uri_get_path (method_handle->gmyth_uri))) {
   1.447 +	  if (method_handle->file == NULL)
   1.448 +		{
   1.449 +		  result = GNOME_VFS_ERROR_INVALID_URI;
   1.450 +		  g_debug("MythTV FileTransfer is NULL!\n");
   1.451 +		  goto error;
   1.452 +		}
   1.453  
   1.454 -            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.455 -            goto error;
   1.456 +	  if (!gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(method_handle->file),
   1.457 +									method_handle->livetv->uri != NULL ?
   1.458 +									gmyth_uri_get_path(method_handle->livetv->
   1.459 +													   uri) : method_handle->
   1.460 +									livetv->proginfo->pathname->str))
   1.461 +		{
   1.462 +
   1.463 +		  g_debug("Couldn't open MythTV FileTransfer is NULL!\n");
   1.464 +		  result = GNOME_VFS_ERROR_NOT_OPEN;
   1.465 +		  goto error;
   1.466  		}
   1.467 -        
   1.468 -        if ( ( method_handle->is_local_file = gmyth_uri_is_local_file(method_handle->gmyth_uri) ) == TRUE )
   1.469 -        {
   1.470 -          method_handle->file = GMYTH_FILE( gmyth_file_local_new(method_handle->backend_info) );
   1.471 -          ret = gmyth_file_local_open ( GMYTH_FILE_LOCAL( method_handle->file ) );
   1.472 -        } else {
   1.473 -          method_handle->file = GMYTH_FILE( gmyth_file_transfer_new(method_handle->backend_info) );
   1.474 -          ret = gmyth_file_transfer_open ( GMYTH_FILE_TRANSFER(method_handle->file), 
   1.475 -                  gmyth_uri_get_path (method_handle->gmyth_uri));
   1.476 -        }
   1.477 +	}
   1.478 +  else
   1.479 +	{
   1.480 +	  gboolean ret = TRUE;
   1.481 +	 /* Verifies if the file exists */
   1.482 +	  if (!gmyth_util_file_exists(method_handle->backend_info,
   1.483 +								  gmyth_uri_get_path(method_handle->
   1.484 +													 gmyth_uri)))
   1.485 +		{
   1.486  
   1.487 -		/* sets the Playback monitor connection */
   1.488 -		if (!ret) {
   1.489 +		  g_debug("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.490 +		  goto error;
   1.491 +		}
   1.492  
   1.493 -            g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.494 -		    result = GNOME_VFS_ERROR_NOT_FOUND;
   1.495 -            goto error;
   1.496 -        }
   1.497 -	} /* if - LiveTV or not? */
   1.498 +	  if ((method_handle->is_local_file =
   1.499 +		   gmyth_uri_is_local_file(method_handle->gmyth_uri)) == TRUE)
   1.500 +		{
   1.501 +		  method_handle->file =
   1.502 +			GMYTH_FILE(gmyth_file_local_new(method_handle->backend_info));
   1.503 +		  ret = gmyth_file_local_open(GMYTH_FILE_LOCAL(method_handle->file));
   1.504 +		}
   1.505 +	  else
   1.506 +		{
   1.507 +		  method_handle->file =
   1.508 +			GMYTH_FILE(gmyth_file_transfer_new(method_handle->backend_info));
   1.509 +		  ret =
   1.510 +			gmyth_file_transfer_open(GMYTH_FILE_TRANSFER(method_handle->file),
   1.511 +									 gmyth_uri_get_path(method_handle->
   1.512 +														gmyth_uri));
   1.513 +		}
   1.514  
   1.515 -	method_handle->configured = TRUE;    
   1.516 +	 /* sets the Playback monitor connection */
   1.517 +	  if (!ret)
   1.518 +		{
   1.519  
   1.520 -    if (method_handle->file == NULL) {
   1.521 -        result = GNOME_VFS_ERROR_NOT_OPEN;
   1.522 -    }
   1.523 +		  g_debug("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   1.524 +		  result = GNOME_VFS_ERROR_NOT_FOUND;
   1.525 +		  goto error;
   1.526 +		}
   1.527 +	}							/* if - LiveTV or not? */
   1.528 +
   1.529 +  method_handle->configured = TRUE;
   1.530 +
   1.531 +  if (method_handle->file == NULL)
   1.532 +	{
   1.533 +	  result = GNOME_VFS_ERROR_NOT_OPEN;
   1.534 +	}
   1.535  
   1.536  error:
   1.537 -    
   1.538 -    return result; 
   1.539 +
   1.540 +  return result;
   1.541  }
   1.542  
   1.543  static GnomeVFSResult
   1.544 -do_open (GnomeVFSMethod * method,
   1.545 -	 GnomeVFSMethodHandle ** method_handle,
   1.546 -	 GnomeVFSURI * uri,
   1.547 -	 GnomeVFSOpenMode mode, GnomeVFSContext * context)
   1.548 +do_open(GnomeVFSMethod * method,
   1.549 +		GnomeVFSMethodHandle ** method_handle,
   1.550 +		GnomeVFSURI * uri, GnomeVFSOpenMode mode, GnomeVFSContext * context)
   1.551  {
   1.552 -	MythtvHandle *myth_handle = NULL;
   1.553 -    GnomeVFSResult result = GNOME_VFS_OK;
   1.554 +  MythtvHandle *myth_handle = NULL;
   1.555 +  GnomeVFSResult result = GNOME_VFS_OK;
   1.556  
   1.557 -	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   1.558 -	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
   1.559 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle != NULL);
   1.560 +  _GNOME_VFS_METHOD_PARAM_CHECK(uri != NULL);
   1.561  
   1.562 -	if (mode & GNOME_VFS_OPEN_WRITE) {
   1.563 -		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   1.564 +  if (mode & GNOME_VFS_OPEN_WRITE)
   1.565 +	{
   1.566 +	  return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   1.567  	}
   1.568  
   1.569 -    result = myth_handle_new (uri, &myth_handle);
   1.570 -    if (result != GNOME_VFS_OK) 
   1.571 -        return result;
   1.572 +  result = myth_handle_new(uri, &myth_handle);
   1.573 +  if (result != GNOME_VFS_OK)
   1.574 +	return result;
   1.575  
   1.576 -    result = myth_connection_start (myth_handle);
   1.577 -    if (result != GNOME_VFS_OK) {
   1.578 -        myth_destroy_handle (myth_handle);
   1.579 -        myth_handle = NULL;
   1.580 -        return result;
   1.581 -    }
   1.582 +  result = myth_connection_start(myth_handle);
   1.583 +  if (result != GNOME_VFS_OK)
   1.584 +	{
   1.585 +	  myth_destroy_handle(myth_handle);
   1.586 +	  myth_handle = NULL;
   1.587 +	  return result;
   1.588 +	}
   1.589  
   1.590 -    *method_handle = (GnomeVFSMethodHandle *) myth_handle;
   1.591 -    
   1.592 -    return result;
   1.593 +  *method_handle = (GnomeVFSMethodHandle *) myth_handle;
   1.594 +
   1.595 +  return result;
   1.596  }
   1.597  
   1.598  static GnomeVFSResult
   1.599 -do_create (GnomeVFSMethod	 *method,
   1.600 -	   GnomeVFSMethodHandle **method_handle,
   1.601 -	   GnomeVFSURI 		 *uri,
   1.602 -	   GnomeVFSOpenMode 	  mode,
   1.603 -	   gboolean 		  exclusive,
   1.604 -	   guint 		  perm,
   1.605 -	   GnomeVFSContext 	 *context)
   1.606 +do_create(GnomeVFSMethod * method,
   1.607 +		  GnomeVFSMethodHandle ** method_handle,
   1.608 +		  GnomeVFSURI * uri,
   1.609 +		  GnomeVFSOpenMode mode,
   1.610 +		  gboolean exclusive, guint perm, GnomeVFSContext * context)
   1.611  {
   1.612 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.613 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.614  }
   1.615  
   1.616  static GnomeVFSResult
   1.617 -do_close (GnomeVFSMethod * method,
   1.618 -        GnomeVFSMethodHandle * method_handle, 
   1.619 -        GnomeVFSContext * context)
   1.620 +do_close(GnomeVFSMethod * method,
   1.621 +		 GnomeVFSMethodHandle * method_handle, GnomeVFSContext * context)
   1.622  {
   1.623 -	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   1.624 +  MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   1.625  
   1.626 -    myth_destroy_handle (myth_handle);
   1.627 -    
   1.628 -	return GNOME_VFS_OK;
   1.629 +  myth_destroy_handle(myth_handle);
   1.630 +
   1.631 +  return GNOME_VFS_OK;
   1.632  }
   1.633  
   1.634  
   1.635  static GnomeVFSResult
   1.636 -do_read (GnomeVFSMethod * method,
   1.637 -	 GnomeVFSMethodHandle * method_handle,
   1.638 -	 gpointer buffer,
   1.639 -	 GnomeVFSFileSize num_bytes,
   1.640 -	 GnomeVFSFileSize * bytes_read, 
   1.641 -         GnomeVFSContext * context)
   1.642 +do_read(GnomeVFSMethod * method,
   1.643 +		GnomeVFSMethodHandle * method_handle,
   1.644 +		gpointer buffer,
   1.645 +		GnomeVFSFileSize num_bytes,
   1.646 +		GnomeVFSFileSize * bytes_read, GnomeVFSContext * context)
   1.647  {
   1.648 -    GnomeVFSResult retval = GNOME_VFS_OK;
   1.649 -    MythtvHandle *myth_handle;
   1.650 -    GMythFileReadResult result;
   1.651 -    GByteArray *myth_buffer = g_byte_array_new ();
   1.652 +  GnomeVFSResult retval = GNOME_VFS_OK;
   1.653 +  MythtvHandle *myth_handle;
   1.654 +  GMythFileReadResult result;
   1.655 +  GByteArray *myth_buffer = g_byte_array_new();
   1.656  
   1.657 -    _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   1.658 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle != NULL);
   1.659  
   1.660 -    myth_handle = (MythtvHandle *) method_handle;
   1.661 -    if ( myth_handle->is_local_file )
   1.662 -        result = gmyth_file_local_read ( GMYTH_FILE_LOCAL(myth_handle->file),
   1.663 -                                       myth_buffer,
   1.664 -                                       num_bytes, myth_handle->is_livetv );
   1.665 -    else
   1.666 -        result = gmyth_file_transfer_read ( GMYTH_FILE_TRANSFER(myth_handle->file),
   1.667 -                              		   myth_buffer,
   1.668 -                             		   num_bytes, myth_handle->is_livetv );
   1.669 +  myth_handle = (MythtvHandle *) method_handle;
   1.670 +  if (myth_handle->is_local_file)
   1.671 +	result = gmyth_file_local_read(GMYTH_FILE_LOCAL(myth_handle->file),
   1.672 +								   myth_buffer,
   1.673 +								   num_bytes, myth_handle->is_livetv);
   1.674 +  else
   1.675 +	result = gmyth_file_transfer_read(GMYTH_FILE_TRANSFER(myth_handle->file),
   1.676 +									  myth_buffer,
   1.677 +									  num_bytes, myth_handle->is_livetv);
   1.678  
   1.679 -    if (result == GMYTH_FILE_READ_ERROR) {
   1.680 -        retval = GNOME_VFS_ERROR_IO;
   1.681 -    }
   1.682 +  if (result == GMYTH_FILE_READ_ERROR)
   1.683 +	{
   1.684 +	  retval = GNOME_VFS_ERROR_IO;
   1.685 +	}
   1.686  
   1.687 -    if (result == GMYTH_FILE_READ_EOF) {
   1.688 -        retval = GNOME_VFS_ERROR_EOF;
   1.689 -    }
   1.690 +  if (result == GMYTH_FILE_READ_EOF)
   1.691 +	{
   1.692 +	  retval = GNOME_VFS_ERROR_EOF;
   1.693 +	}
   1.694  
   1.695 -    if (myth_buffer->len > 0) {
   1.696 -	    g_memmove (buffer, myth_buffer->data, myth_buffer->len);
   1.697 -        *bytes_read = (GnomeVFSFileSize) myth_buffer->len;
   1.698 -        myth_handle->offset += myth_buffer->len;
   1.699 -        g_byte_array_free (myth_buffer, TRUE);
   1.700 -    } 
   1.701 +  if (myth_buffer->len > 0)
   1.702 +	{
   1.703 +	  g_memmove(buffer, myth_buffer->data, myth_buffer->len);
   1.704 +	  *bytes_read = (GnomeVFSFileSize) myth_buffer->len;
   1.705 +	  myth_handle->offset += myth_buffer->len;
   1.706 +	  g_byte_array_free(myth_buffer, TRUE);
   1.707 +	}
   1.708  
   1.709 -	return retval;
   1.710 +  return retval;
   1.711  }
   1.712  
   1.713  static GnomeVFSResult
   1.714 -do_write (GnomeVFSMethod 	*method,
   1.715 -	  GnomeVFSMethodHandle  *method_handle,
   1.716 -	  gconstpointer 	 buffer,
   1.717 -	  GnomeVFSFileSize 	 num_bytes,
   1.718 -	  GnomeVFSFileSize 	*bytes_written,
   1.719 -	  GnomeVFSContext 	*context)
   1.720 +do_write(GnomeVFSMethod * method,
   1.721 +		 GnomeVFSMethodHandle * method_handle,
   1.722 +		 gconstpointer buffer,
   1.723 +		 GnomeVFSFileSize num_bytes,
   1.724 +		 GnomeVFSFileSize * bytes_written, GnomeVFSContext * context)
   1.725  {
   1.726 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.727 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.728  }
   1.729  
   1.730  static GnomeVFSResult
   1.731 -do_seek (GnomeVFSMethod	      *method,
   1.732 -	 GnomeVFSMethodHandle *method_handle,
   1.733 -	 GnomeVFSSeekPosition  whence,
   1.734 -	 GnomeVFSFileOffset    offset,
   1.735 -	 GnomeVFSContext      *context)
   1.736 +do_seek(GnomeVFSMethod * method,
   1.737 +		GnomeVFSMethodHandle * method_handle,
   1.738 +		GnomeVFSSeekPosition whence,
   1.739 +		GnomeVFSFileOffset offset, GnomeVFSContext * context)
   1.740  {
   1.741 -    MythtvHandle *myth_handle;
   1.742 -    guint64 whence_p  = 0;
   1.743 -    gint64 new_offset = 0;
   1.744 +  MythtvHandle *myth_handle;
   1.745 +  guint64 whence_p = 0;
   1.746 +  gint64 new_offset = 0;
   1.747  
   1.748 -     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   1.749 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle != NULL);
   1.750  
   1.751 -     myth_handle = (MythtvHandle *) method_handle;    
   1.752 -    
   1.753 -    g_debug ("seek offset %"G_GINT64_FORMAT" whence %d", offset, whence);
   1.754 +  myth_handle = (MythtvHandle *) method_handle;
   1.755  
   1.756 -    if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   1.757 -        return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.758 -    
   1.759 -    switch (whence)
   1.760 -    {
   1.761 -        case GNOME_VFS_SEEK_START:
   1.762 -            whence_p = 0;
   1.763 -            break;
   1.764 -        case GNOME_VFS_SEEK_CURRENT:
   1.765 -            whence_p = myth_handle->offset;
   1.766 -            break;
   1.767 -        case GNOME_VFS_SEEK_END:
   1.768 -            return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.769 -    }
   1.770 -    
   1.771 -    new_offset = gmyth_file_transfer_seek (myth_handle->file, offset, whence_p);
   1.772 -    if (new_offset != 0) {
   1.773 -        myth_handle->offset = new_offset;
   1.774 -        return GNOME_VFS_OK;
   1.775 -    }
   1.776 +  g_debug("seek offset %" G_GINT64_FORMAT " whence %d", offset, whence);
   1.777  
   1.778 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.779 +  if (gmyth_uri_is_livetv(myth_handle->gmyth_uri))
   1.780 +	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.781 +
   1.782 +  switch (whence)
   1.783 +	{
   1.784 +	case GNOME_VFS_SEEK_START:
   1.785 +	  whence_p = 0;
   1.786 +	  break;
   1.787 +	case GNOME_VFS_SEEK_CURRENT:
   1.788 +	  whence_p = myth_handle->offset;
   1.789 +	  break;
   1.790 +	case GNOME_VFS_SEEK_END:
   1.791 +	  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.792 +	}
   1.793 +
   1.794 +  new_offset = gmyth_file_transfer_seek(myth_handle->file, offset, whence_p);
   1.795 +  if (new_offset != 0)
   1.796 +	{
   1.797 +	  myth_handle->offset = new_offset;
   1.798 +	  return GNOME_VFS_OK;
   1.799 +	}
   1.800 +
   1.801 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.802  }
   1.803  
   1.804  static GnomeVFSResult
   1.805 -do_tell (GnomeVFSMethod       *method,
   1.806 -	 GnomeVFSMethodHandle *method_handle,
   1.807 -	 GnomeVFSFileSize   *offset_return)
   1.808 +do_tell(GnomeVFSMethod * method,
   1.809 +		GnomeVFSMethodHandle * method_handle,
   1.810 +		GnomeVFSFileSize * offset_return)
   1.811  {
   1.812 -	MythtvHandle *myth_handle = NULL;
   1.813 -    
   1.814 -     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   1.815 -     
   1.816 -    myth_handle = (MythtvHandle *) method_handle;
   1.817 -    *offset_return = myth_handle->offset;
   1.818 +  MythtvHandle *myth_handle = NULL;
   1.819  
   1.820 -    return GNOME_VFS_OK;
   1.821 +  _GNOME_VFS_METHOD_PARAM_CHECK(method_handle != NULL);
   1.822 +
   1.823 +  myth_handle = (MythtvHandle *) method_handle;
   1.824 +  *offset_return = myth_handle->offset;
   1.825 +
   1.826 +  return GNOME_VFS_OK;
   1.827  }
   1.828  
   1.829  static GnomeVFSResult
   1.830 -do_truncate_handle (GnomeVFSMethod *method,
   1.831 -		    GnomeVFSMethodHandle *method_handle,
   1.832 -		    GnomeVFSFileSize where,
   1.833 -		    GnomeVFSContext *context)
   1.834 +do_truncate_handle(GnomeVFSMethod * method,
   1.835 +				   GnomeVFSMethodHandle * method_handle,
   1.836 +				   GnomeVFSFileSize where, GnomeVFSContext * context)
   1.837  {
   1.838 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.839 +  return GNOME_VFS_ERROR_READ_ONLY;
   1.840  }
   1.841  
   1.842  static GnomeVFSResult
   1.843 -do_open_directory (GnomeVFSMethod 	    *method,
   1.844 -		   GnomeVFSMethodHandle    **method_handle,
   1.845 -		   GnomeVFSURI 		    *uri,
   1.846 -		   GnomeVFSFileInfoOptions   options,
   1.847 -		   GnomeVFSContext 	    *context) 
   1.848 +do_open_directory(GnomeVFSMethod * method,
   1.849 +				  GnomeVFSMethodHandle ** method_handle,
   1.850 +				  GnomeVFSURI * uri,
   1.851 +				  GnomeVFSFileInfoOptions options, GnomeVFSContext * context)
   1.852  {
   1.853 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.854 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.855  }
   1.856  
   1.857  static GnomeVFSResult
   1.858 -do_close_directory (GnomeVFSMethod 	 *method,
   1.859 -		    GnomeVFSMethodHandle *method_handle,
   1.860 -		    GnomeVFSContext 	 *context) 
   1.861 +do_close_directory(GnomeVFSMethod * method,
   1.862 +				   GnomeVFSMethodHandle * method_handle,
   1.863 +				   GnomeVFSContext * context)
   1.864  {
   1.865 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.866 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.867  }
   1.868  
   1.869  static GnomeVFSResult
   1.870 -do_read_directory (GnomeVFSMethod 	*method,
   1.871 -       		   GnomeVFSMethodHandle *method_handle,
   1.872 -       		   GnomeVFSFileInfo 	*file_info,
   1.873 -		   GnomeVFSContext 	*context)
   1.874 +do_read_directory(GnomeVFSMethod * method,
   1.875 +				  GnomeVFSMethodHandle * method_handle,
   1.876 +				  GnomeVFSFileInfo * file_info, GnomeVFSContext * context)
   1.877  {
   1.878 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.879 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.880  }
   1.881  
   1.882  
   1.883  static GnomeVFSResult
   1.884 -do_get_file_info (GnomeVFSMethod * method,
   1.885 -		  GnomeVFSURI * uri,
   1.886 -		  GnomeVFSFileInfo * file_info,
   1.887 -		  GnomeVFSFileInfoOptions options,
   1.888 -		  GnomeVFSContext * context)
   1.889 +do_get_file_info(GnomeVFSMethod * method,
   1.890 +				 GnomeVFSURI * uri,
   1.891 +				 GnomeVFSFileInfo * file_info,
   1.892 +				 GnomeVFSFileInfoOptions options, GnomeVFSContext * context)
   1.893  {
   1.894 -    return myth_get_file_info (NULL, uri, file_info);
   1.895 +  return myth_get_file_info(NULL, uri, file_info);
   1.896  }
   1.897  
   1.898  static GnomeVFSResult
   1.899 -do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   1.900 -            			      GnomeVFSMethodHandle 	*method_handle,
   1.901 -			                  GnomeVFSFileInfo 		*file_info,
   1.902 -            			      GnomeVFSFileInfoOptions    options,
   1.903 -			                  GnomeVFSContext 		*context)
   1.904 +do_get_file_info_from_handle(GnomeVFSMethod * method,
   1.905 +							 GnomeVFSMethodHandle * method_handle,
   1.906 +							 GnomeVFSFileInfo * file_info,
   1.907 +							 GnomeVFSFileInfoOptions options,
   1.908 +							 GnomeVFSContext * context)
   1.909  {
   1.910 -	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   1.911 +  MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   1.912  
   1.913 -    return myth_get_file_info (myth_handle, NULL, file_info);
   1.914 +  return myth_get_file_info(myth_handle, NULL, file_info);
   1.915  }
   1.916  
   1.917  static gboolean
   1.918 -do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   1.919 +do_is_local(GnomeVFSMethod * method, const GnomeVFSURI * uri)
   1.920  {
   1.921 -	return FALSE;
   1.922 +  return FALSE;
   1.923  }
   1.924  
   1.925  static GnomeVFSResult
   1.926 -do_make_directory (GnomeVFSMethod  *method, 
   1.927 -		            GnomeVFSURI     *uri,
   1.928 -                    guint 	    perm, 
   1.929 -		            GnomeVFSContext *context) 
   1.930 +do_make_directory(GnomeVFSMethod * method,
   1.931 +				  GnomeVFSURI * uri, guint perm, GnomeVFSContext * context)
   1.932  {
   1.933 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.934 -}
   1.935 -
   1.936 -static GnomeVFSResult 
   1.937 -do_remove_directory (GnomeVFSMethod  *method, 
   1.938 -		             GnomeVFSURI     *uri, 
   1.939 -		             GnomeVFSContext *context) 
   1.940 -{
   1.941 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.942 +  return GNOME_VFS_ERROR_READ_ONLY;
   1.943  }
   1.944  
   1.945  static GnomeVFSResult
   1.946 -do_move (GnomeVFSMethod  *method,
   1.947 -	 GnomeVFSURI 	 *old_uri,
   1.948 -	 GnomeVFSURI 	 *new_uri,
   1.949 -	 gboolean         force_replace,
   1.950 -	 GnomeVFSContext *context)
   1.951 +do_remove_directory(GnomeVFSMethod * method,
   1.952 +					GnomeVFSURI * uri, GnomeVFSContext * context)
   1.953  {
   1.954 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.955 -}
   1.956 -
   1.957 -static GnomeVFSResult 
   1.958 -do_unlink (GnomeVFSMethod  *method,
   1.959 -	   GnomeVFSURI 	   *uri,
   1.960 -	   GnomeVFSContext *context)
   1.961 -{
   1.962 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.963 -}
   1.964 -
   1.965 -static GnomeVFSResult 
   1.966 -do_check_same_fs (GnomeVFSMethod  *method,
   1.967 -		  GnomeVFSURI 	  *a,
   1.968 -		  GnomeVFSURI 	  *b,
   1.969 -		  gboolean 	  *same_fs_return,
   1.970 -		  GnomeVFSContext *context)
   1.971 -{
   1.972 -    return GNOME_VFS_ERROR_NOT_SUPPORTED;
   1.973 +  return GNOME_VFS_ERROR_READ_ONLY;
   1.974  }
   1.975  
   1.976  static GnomeVFSResult
   1.977 -do_set_file_info (GnomeVFSMethod 		*method,
   1.978 -		  GnomeVFSURI 			*uri,
   1.979 -		  const GnomeVFSFileInfo 	*info,
   1.980 -		  GnomeVFSSetFileInfoMask 	 mask,
   1.981 -		  GnomeVFSContext 		*context)
   1.982 +do_move(GnomeVFSMethod * method,
   1.983 +		GnomeVFSURI * old_uri,
   1.984 +		GnomeVFSURI * new_uri,
   1.985 +		gboolean force_replace, GnomeVFSContext * context)
   1.986  {
   1.987 -    return GNOME_VFS_ERROR_READ_ONLY;
   1.988 +  return GNOME_VFS_ERROR_READ_ONLY;
   1.989  }
   1.990  
   1.991  static GnomeVFSResult
   1.992 -do_truncate (GnomeVFSMethod *method,
   1.993 -	     GnomeVFSURI *uri,
   1.994 -	     GnomeVFSFileSize where,
   1.995 -	     GnomeVFSContext *context)
   1.996 +do_unlink(GnomeVFSMethod * method,
   1.997 +		  GnomeVFSURI * uri, GnomeVFSContext * context)
   1.998  {
   1.999 -    return GNOME_VFS_ERROR_READ_ONLY;
  1.1000 +  return GNOME_VFS_ERROR_READ_ONLY;
  1.1001  }
  1.1002  
  1.1003  static GnomeVFSResult
  1.1004 -do_find_directory (GnomeVFSMethod *method,
  1.1005 -		   GnomeVFSURI *near_uri,
  1.1006 -		   GnomeVFSFindDirectoryKind kind,
  1.1007 -		   GnomeVFSURI **result_uri,
  1.1008 -		   gboolean create_if_needed,
  1.1009 -		   gboolean find_if_needed,
  1.1010 -		   guint permissions,
  1.1011 -		   GnomeVFSContext *context)
  1.1012 +do_check_same_fs(GnomeVFSMethod * method,
  1.1013 +				 GnomeVFSURI * a,
  1.1014 +				 GnomeVFSURI * b,
  1.1015 +				 gboolean * same_fs_return, GnomeVFSContext * context)
  1.1016  {
  1.1017 -	return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1018 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1019  }
  1.1020  
  1.1021  static GnomeVFSResult
  1.1022 -do_create_symbolic_link (GnomeVFSMethod *method,
  1.1023 -			 GnomeVFSURI *uri,
  1.1024 -			 const char *target_reference,
  1.1025 -			 GnomeVFSContext *context)
  1.1026 +do_set_file_info(GnomeVFSMethod * method,
  1.1027 +				 GnomeVFSURI * uri,
  1.1028 +				 const GnomeVFSFileInfo * info,
  1.1029 +				 GnomeVFSSetFileInfoMask mask, GnomeVFSContext * context)
  1.1030  {
  1.1031 -    return GNOME_VFS_ERROR_READ_ONLY;
  1.1032 +  return GNOME_VFS_ERROR_READ_ONLY;
  1.1033  }
  1.1034  
  1.1035  static GnomeVFSResult
  1.1036 -do_monitor_add (GnomeVFSMethod *method,
  1.1037 -		GnomeVFSMethodHandle **method_handle_return,
  1.1038 -		GnomeVFSURI *uri,
  1.1039 -		GnomeVFSMonitorType monitor_type)
  1.1040 +do_truncate(GnomeVFSMethod * method,
  1.1041 +			GnomeVFSURI * uri,
  1.1042 +			GnomeVFSFileSize where, GnomeVFSContext * context)
  1.1043  {
  1.1044 -	return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1045 +  return GNOME_VFS_ERROR_READ_ONLY;
  1.1046  }
  1.1047  
  1.1048  static GnomeVFSResult
  1.1049 -do_monitor_cancel (GnomeVFSMethod *method,
  1.1050 -		   GnomeVFSMethodHandle *method_handle)
  1.1051 +do_find_directory(GnomeVFSMethod * method,
  1.1052 +				  GnomeVFSURI * near_uri,
  1.1053 +				  GnomeVFSFindDirectoryKind kind,
  1.1054 +				  GnomeVFSURI ** result_uri,
  1.1055 +				  gboolean create_if_needed,
  1.1056 +				  gboolean find_if_needed,
  1.1057 +				  guint permissions, GnomeVFSContext * context)
  1.1058  {
  1.1059 -	return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1060 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1061  }
  1.1062  
  1.1063  static GnomeVFSResult
  1.1064 -do_file_control (GnomeVFSMethod *method,
  1.1065 -		 GnomeVFSMethodHandle *method_handle,
  1.1066 -		 const char *operation,
  1.1067 -		 gpointer operation_data,
  1.1068 -		 GnomeVFSContext *context)
  1.1069 +do_create_symbolic_link(GnomeVFSMethod * method,
  1.1070 +						GnomeVFSURI * uri,
  1.1071 +						const char *target_reference,
  1.1072 +						GnomeVFSContext * context)
  1.1073  {
  1.1074 -	return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1075 +  return GNOME_VFS_ERROR_READ_ONLY;
  1.1076 +}
  1.1077 +
  1.1078 +static GnomeVFSResult
  1.1079 +do_monitor_add(GnomeVFSMethod * method,
  1.1080 +			   GnomeVFSMethodHandle ** method_handle_return,
  1.1081 +			   GnomeVFSURI * uri, GnomeVFSMonitorType monitor_type)
  1.1082 +{
  1.1083 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1084 +}
  1.1085 +
  1.1086 +static GnomeVFSResult
  1.1087 +do_monitor_cancel(GnomeVFSMethod * method,
  1.1088 +				  GnomeVFSMethodHandle * method_handle)
  1.1089 +{
  1.1090 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1091 +}
  1.1092 +
  1.1093 +static GnomeVFSResult
  1.1094 +do_file_control(GnomeVFSMethod * method,
  1.1095 +				GnomeVFSMethodHandle * method_handle,
  1.1096 +				const char *operation,
  1.1097 +				gpointer operation_data, GnomeVFSContext * context)
  1.1098 +{
  1.1099 +  return GNOME_VFS_ERROR_NOT_SUPPORTED;
  1.1100  }
  1.1101  
  1.1102  static GnomeVFSMethod method = {
  1.1103 -	sizeof (GnomeVFSMethod),
  1.1104 -	do_open, 
  1.1105 -	do_create,
  1.1106 -	do_close,
  1.1107 -	do_read, 
  1.1108 -	do_write,
  1.1109 -	do_seek,
  1.1110 -	do_tell,
  1.1111 -	do_truncate_handle, 
  1.1112 -	do_open_directory,
  1.1113 -	do_close_directory,
  1.1114 -	do_read_directory,
  1.1115 -	do_get_file_info,
  1.1116 -	do_get_file_info_from_handle,
  1.1117 -	do_is_local, 
  1.1118 -	do_make_directory, 
  1.1119 -	do_remove_directory,
  1.1120 -	do_move,
  1.1121 -	do_unlink,
  1.1122 -	do_check_same_fs,
  1.1123 -	do_set_file_info,
  1.1124 -	do_truncate, 
  1.1125 -	do_find_directory, 
  1.1126 -	do_create_symbolic_link,  
  1.1127 -	do_monitor_add,  
  1.1128 -	do_monitor_cancel,  
  1.1129 -	do_file_control 	
  1.1130 +  sizeof(GnomeVFSMethod),
  1.1131 +  do_open,
  1.1132 +  do_create,
  1.1133 +  do_close,
  1.1134 +  do_read,
  1.1135 +  do_write,
  1.1136 +  do_seek,
  1.1137 +  do_tell,
  1.1138 +  do_truncate_handle,
  1.1139 +  do_open_directory,
  1.1140 +  do_close_directory,
  1.1141 +  do_read_directory,
  1.1142 +  do_get_file_info,
  1.1143 +  do_get_file_info_from_handle,
  1.1144 +  do_is_local,
  1.1145 +  do_make_directory,
  1.1146 +  do_remove_directory,
  1.1147 +  do_move,
  1.1148 +  do_unlink,
  1.1149 +  do_check_same_fs,
  1.1150 +  do_set_file_info,
  1.1151 +  do_truncate,
  1.1152 +  do_find_directory,
  1.1153 +  do_create_symbolic_link,
  1.1154 +  do_monitor_add,
  1.1155 +  do_monitor_cancel,
  1.1156 +  do_file_control
  1.1157  };
  1.1158  
  1.1159  
  1.1160  GnomeVFSMethod *
  1.1161 -vfs_module_init (const char *method_name, const char *args)
  1.1162 +vfs_module_init(const char *method_name, const char *args)
  1.1163  {
  1.1164 -	return &method;
  1.1165 +  return &method;
  1.1166  }
  1.1167  
  1.1168  void
  1.1169 -vfs_module_shutdown (GnomeVFSMethod * method)
  1.1170 +vfs_module_shutdown(GnomeVFSMethod * method)
  1.1171  {
  1.1172  }