libgnomevfs2-mythtv/modules/mythtv-method.c
author leo_sobral
Tue Mar 27 16:01:23 2007 +0100 (2007-03-27)
branchtrunk
changeset 457 4a65804a0a5f
parent 456 96a51561bed6
child 459 edaab488eaeb
permissions -rwxr-xr-x
[svn r462] removed unused debug info
     1 /*
     2  * @author Hallyson Melo <hallyson.melo@indt.org.br>
     3  *
     4  * This program is free software; you can redistribute it and/or modify
     5  * it under the terms of the GNU Lesser General Public License as published by
     6  * the Free Software Foundation; either version 2 of the License, or
     7  * (at your option) any later version.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU Lesser General Public License
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  */
    18 
    19 #ifdef HAVE_CONFIG_H
    20 #include <config.h>
    21 #endif
    22 
    23 #include <string.h>
    24 #include <glib.h>
    25 #include <glib/gprintf.h>
    26 #include <glib/gstdio.h>
    27 #include <math.h>
    28 
    29 #include <libgnomevfs/gnome-vfs-module.h>
    30 #include <libgnomevfs/gnome-vfs-utils.h>
    31 
    32 #include <gmyth/gmyth_file_transfer.h>
    33 #include <gmyth/gmyth_livetv.h>
    34 #include <gmyth/gmyth_uri.h>
    35 #include <gmyth/gmyth_recorder.h>
    36 #include <gmyth/gmyth_backendinfo.h>
    37 #include <gmyth/gmyth_util.h>
    38 #include <gmyth/gmyth_remote_util.h>
    39 #include <gmyth/gmyth_tvchain.h>
    40 #include <gmyth/gmyth_programinfo.h>
    41 
    42 #define GST_MYTHTV_ID_NUM               1
    43 #define MYTHTV_VERSION_DEFAULT          30
    44 #define MYTHTV_TRANSFER_MAX_WAITS       100
    45 
    46 /* internal GnomeVFS plug-in buffer size ( 120 Kbytes ) */
    47 #define MYTHTV_BUFFER_SIZE                          80*1024
    48 /* internally sized GnomeVFS plug-in buffer ( 4 Kbytes ) */
    49 #define MYTHTV_MAX_VFS_BUFFER_SIZE                  4096
    50 /* maximum number of bytes to be requested to the MythTV backend ( 64 Kbytes ) */
    51 #define MYTHTV_MAX_REQUEST_SIZE                     64*1024
    52 
    53 typedef struct {
    54 	GMythFileTransfer *file_transfer;
    55 	GMythLiveTV *livetv;
    56     GMythBackendInfo *backend_info;
    57     GMythURI *gmyth_uri;
    58     GMythRecorder *live_recorder;
    59     gint64 offset;
    60 
    61 	gchar *channel_name;
    62 
    63 	gint mythtv_version;
    64 	gboolean configured;
    65 } MythtvHandle;
    66 
    67 
    68 static GnomeVFSResult do_read (GnomeVFSMethod * method,
    69 			       GnomeVFSMethodHandle * method_handle,
    70 			       gpointer buffer,
    71 			       GnomeVFSFileSize num_bytes,
    72 			       GnomeVFSFileSize * bytes_read,
    73 			       GnomeVFSContext * context);
    74 
    75 static GnomeVFSResult   myth_connection_start   (MythtvHandle * method_handle);
    76 static void             myth_destroy_handle     (MythtvHandle * method_handle);
    77 static GnomeVFSResult   myth_handle_new         (GnomeVFSURI * uri,
    78                                                  MythtvHandle ** method_handle);
    79 static GnomeVFSResult   myth_get_file_info      (MythtvHandle * myth_handle,
    80                                                  GnomeVFSURI * uri,
    81                                                  GnomeVFSFileInfo * info);
    82 
    83 static GnomeVFSResult 
    84 myth_handle_new (GnomeVFSURI * uri,
    85                  MythtvHandle ** method_handle)
    86 {   
    87     gchar *tmp_str1;
    88     gchar *tmp_str2;
    89 
    90     _GNOME_VFS_METHOD_PARAM_CHECK (*method_handle == NULL);
    91     
    92 	if (gnome_vfs_uri_get_host_name (uri) == NULL) {
    93 		return GNOME_VFS_ERROR_INVALID_HOST_NAME;
    94 	}
    95 
    96     *method_handle = g_new0 (MythtvHandle, 1);
    97     (*method_handle)->mythtv_version = MYTHTV_VERSION_DEFAULT;
    98         
    99     tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   100     tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   101 
   102     (*method_handle)->backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   103     (*method_handle)->gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   104     g_free (tmp_str1);
   105     g_free (tmp_str2);
   106 
   107     return GNOME_VFS_OK;
   108 }   
   109 
   110 static void
   111 myth_destroy_handle (MythtvHandle * method_handle)
   112 {
   113     //TODO: abort if in tranfer state
   114     
   115     if (method_handle->backend_info != NULL) {
   116         g_object_unref (method_handle->backend_info);
   117         method_handle->backend_info = NULL;
   118     }
   119     
   120     if (method_handle->channel_name != NULL) {
   121         g_free (method_handle->channel_name);
   122         method_handle->channel_name = NULL;
   123     }
   124 
   125     if (method_handle->livetv != NULL) {
   126         g_object_unref (method_handle->livetv);
   127         method_handle->livetv = NULL;
   128     }
   129 
   130     if (method_handle->file_transfer != NULL) {
   131         g_object_unref (method_handle->file_transfer);
   132         method_handle->file_transfer = NULL;
   133     }
   134 
   135     if (method_handle->gmyth_uri != NULL) {
   136         g_object_unref (method_handle->gmyth_uri);
   137         method_handle->gmyth_uri = NULL;
   138     }
   139 
   140     g_free (method_handle);
   141 }
   142 
   143 static GnomeVFSResult
   144 myth_get_file_info (MythtvHandle * myth_handle,
   145                     GnomeVFSURI * uri,
   146                     GnomeVFSFileInfo * info)
   147 {
   148     GMythURI *gmyth_uri;
   149     GMythBackendInfo *backend_info;
   150     
   151     _GNOME_VFS_METHOD_PARAM_CHECK (info != NULL);
   152 
   153     if (myth_handle == NULL) {
   154         gchar *tmp_str1;
   155         gchar *tmp_str2;
   156         
   157         tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   158         tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   159 
   160         backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   161         gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   162         
   163         g_free (tmp_str1);
   164         g_free (tmp_str2);
   165     } else {
   166         backend_info = g_object_ref (myth_handle->backend_info);
   167         gmyth_uri = g_object_ref (myth_handle->gmyth_uri);
   168     }
   169 
   170     info->valid_fields = 0;
   171 	info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | 
   172         GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | 
   173         GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
   174     
   175 	info->type = GNOME_VFS_FILE_TYPE_REGULAR;
   176     
   177 	/* fixme: get from file extension? */
   178 	info->mime_type = g_strdup ("video/x-nuv");
   179 	info->permissions = GNOME_VFS_PERM_USER_READ | 
   180         GNOME_VFS_PERM_OTHER_READ | 
   181         GNOME_VFS_PERM_GROUP_READ;
   182 
   183    
   184 	info->name = g_strdup (gmyth_uri_get_path (gmyth_uri));
   185 
   186     /* file size for remote files */
   187     if (gmyth_uri_is_livetv (gmyth_uri) == FALSE) {
   188         GMythFileTransfer *file_transfer = gmyth_file_transfer_new (backend_info);
   189         
   190         /* Verifies if the file exists */
   191         if (!gmyth_util_file_exists (backend_info, 
   192                     gmyth_uri_get_path (gmyth_uri))) {
   193             g_object_unref (backend_info);
   194             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   195             return GNOME_VFS_ERROR_NOT_FOUND;
   196 		}
   197 	
   198 		info->size = gmyth_file_transfer_get_filesize (file_transfer);
   199         info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
   200 		g_object_unref (file_transfer);
   201 	}
   202 
   203     g_object_unref (backend_info);
   204     g_object_unref (gmyth_uri);
   205     
   206     return GNOME_VFS_OK;
   207 }
   208 
   209 static GnomeVFSResult
   210 myth_connection_start (MythtvHandle * method_handle)
   211 {
   212     GnomeVFSResult result = GNOME_VFS_OK;
   213 
   214     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   215     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL);
   216 
   217     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   218     
   219 	/* Connect to the backend */
   220 	if (gmyth_uri_is_livetv (method_handle->gmyth_uri) == TRUE) {
   221         
   222         g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   223         
   224 		method_handle->livetv = gmyth_livetv_new (method_handle->backend_info);
   225 		method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri);
   226         
   227 		g_debug ("[%s] Channel name = %s\n", __FUNCTION__, 
   228                 method_handle->channel_name);
   229         
   230 		if (method_handle->channel_name != NULL) {
   231 		    if (gmyth_livetv_channel_name_setup (method_handle->livetv, 
   232                     method_handle->channel_name) == FALSE) {
   233                 result = GNOME_VFS_ERROR_INVALID_URI;
   234     			goto error;
   235 			}
   236 		} else if (gmyth_livetv_setup (method_handle->livetv) == FALSE) {
   237                 result = GNOME_VFS_ERROR_INVALID_URI;
   238                 goto error;
   239 		}
   240         
   241         g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   242 
   243     	method_handle->file_transfer = 
   244             gmyth_livetv_create_file_transfer (method_handle->livetv);
   245 
   246         if (method_handle->file_transfer == NULL) {
   247             result = GNOME_VFS_ERROR_INVALID_URI;
   248     		g_debug ("MythTV FileTransfer is NULL!\n");
   249             goto error;
   250         }
   251 
   252 	    if (!gmyth_file_transfer_open (method_handle->file_transfer,
   253                                         method_handle->livetv->uri != NULL ? 
   254                                         gmyth_uri_get_path (method_handle->livetv->uri) :
   255                                         method_handle->livetv->proginfo->pathname->str)) {
   256         
   257             g_debug ("Couldn't open MythTV FileTransfer is NULL!\n");
   258             result = GNOME_VFS_ERROR_NOT_OPEN;
   259             goto error;
   260         }
   261     }
   262     else {
   263         method_handle->file_transfer = 
   264             gmyth_file_transfer_new (method_handle->backend_info);
   265 
   266 		/* Verifies if the file exists */
   267 		if (!gmyth_util_file_exists (method_handle->backend_info, 
   268                     gmyth_uri_get_path (method_handle->gmyth_uri))) {
   269 
   270             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   271 		    result = GNOME_VFS_ERROR_NOT_FOUND;
   272             goto error;
   273 		}
   274 
   275 		/* sets the Playback monitor connection */
   276 		result = gmyth_file_transfer_open (method_handle->file_transfer,
   277                   					    gmyth_uri_get_path (method_handle->gmyth_uri));
   278 	} /* if - LiveTV or not? */
   279 
   280 	method_handle->configured = TRUE;    
   281 
   282     if (method_handle->file_transfer == NULL) {
   283         result = GNOME_VFS_ERROR_NOT_OPEN;
   284         goto error;
   285     }
   286 	g_return_val_if_fail (method_handle->file_transfer != NULL, 
   287             GNOME_VFS_ERROR_NOT_OPEN);
   288 
   289 error:
   290     
   291     return result; 
   292 }
   293 
   294 static GnomeVFSResult
   295 do_open (GnomeVFSMethod * method,
   296 	 GnomeVFSMethodHandle ** method_handle,
   297 	 GnomeVFSURI * uri,
   298 	 GnomeVFSOpenMode mode, GnomeVFSContext * context)
   299 {
   300 	MythtvHandle *myth_handle = NULL;
   301     GnomeVFSResult result = GNOME_VFS_OK;
   302 
   303     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   304 
   305 	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   306 	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
   307 
   308 	if (mode & GNOME_VFS_OPEN_WRITE) {
   309 		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   310 	}
   311 
   312     result = myth_handle_new (uri, &myth_handle);
   313     if (result != GNOME_VFS_OK) 
   314         return result;
   315 
   316     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   317     result = myth_connection_start (myth_handle);
   318     if (result != GNOME_VFS_OK) {
   319         myth_destroy_handle (myth_handle);
   320         myth_handle = NULL;
   321         return result;
   322     }
   323     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   324 
   325     *method_handle = (GnomeVFSMethodHandle *) myth_handle;
   326     
   327     return result;
   328 }
   329 
   330 static GnomeVFSResult
   331 do_create (GnomeVFSMethod	 *method,
   332 	   GnomeVFSMethodHandle **method_handle,
   333 	   GnomeVFSURI 		 *uri,
   334 	   GnomeVFSOpenMode 	  mode,
   335 	   gboolean 		  exclusive,
   336 	   guint 		  perm,
   337 	   GnomeVFSContext 	 *context)
   338 {
   339     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   340 }
   341 
   342 static GnomeVFSResult
   343 do_close (GnomeVFSMethod * method,
   344         GnomeVFSMethodHandle * method_handle, 
   345         GnomeVFSContext * context)
   346 {
   347 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   348 
   349     myth_destroy_handle (myth_handle);
   350     
   351 	return GNOME_VFS_OK;
   352 }
   353 
   354 
   355 static GnomeVFSResult
   356 do_read (GnomeVFSMethod * method,
   357 	 GnomeVFSMethodHandle * method_handle,
   358 	 gpointer buffer,
   359 	 GnomeVFSFileSize num_bytes,
   360 	 GnomeVFSFileSize * bytes_read, 
   361          GnomeVFSContext * context)
   362 {
   363     GnomeVFSResult result;
   364     MythtvHandle *myth_handle;
   365     gint64 total_read = 0;
   366     GByteArray *myth_buffer = g_byte_array_new ();
   367 
   368     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   369 
   370     
   371     myth_handle = (MythtvHandle *) method_handle;
   372     result = GNOME_VFS_OK;
   373 
   374     g_debug ("Reading %"G_GUINT64_FORMAT" bytes", num_bytes);
   375     
   376     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   377 
   378     total_read = gmyth_file_transfer_read (myth_handle->file_transfer,
   379                               		   myth_buffer,
   380                          		   num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri));
   381 
   382 
   383     g_debug ("total read %"G_GINT64_FORMAT, total_read);
   384 
   385     if (total_read == -1) {
   386         result = GNOME_VFS_ERROR_IO;
   387         total_read = 0;
   388     }
   389 
   390     if (total_read < num_bytes) {
   391         result = GNOME_VFS_ERROR_EOF;
   392     }
   393 
   394     g_debug ("F: %s L: %d", __FUNCTION__, __LINE__);
   395 
   396     
   397     if (total_read > 0) {
   398 	g_memmove (buffer, myth_buffer->data, total_read);
   399         g_byte_array_free (myth_buffer, TRUE);
   400         myth_handle->offset += total_read;
   401     } else {
   402         g_debug ("Nao leu nada");
   403     }
   404 
   405 
   406     *bytes_read = (GnomeVFSFileSize) total_read;
   407 
   408 	return result;
   409 }
   410 
   411 static GnomeVFSResult
   412 do_write (GnomeVFSMethod 	*method,
   413 	  GnomeVFSMethodHandle  *method_handle,
   414 	  gconstpointer 	 buffer,
   415 	  GnomeVFSFileSize 	 num_bytes,
   416 	  GnomeVFSFileSize 	*bytes_written,
   417 	  GnomeVFSContext 	*context)
   418 {
   419     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   420 }
   421 
   422 static GnomeVFSResult
   423 do_seek (GnomeVFSMethod	      *method,
   424 	 GnomeVFSMethodHandle *method_handle,
   425 	 GnomeVFSSeekPosition  whence,
   426 	 GnomeVFSFileOffset    offset,
   427 	 GnomeVFSContext      *context)
   428 {
   429 	MythtvHandle *myth_handle;
   430     guint64 whence_p = 0;
   431     gint64 new_offset =0;
   432 
   433      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   434 
   435      myth_handle = (MythtvHandle *) method_handle;    
   436     
   437     g_debug ("seek offset%"G_GINT64_FORMAT" whence %d", offset, whence);
   438 
   439     if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   440         return GNOME_VFS_ERROR_NOT_SUPPORTED;
   441     
   442     switch (whence)
   443     {
   444         case GNOME_VFS_SEEK_START:
   445             whence_p = 0;
   446             break;
   447         case GNOME_VFS_SEEK_CURRENT:
   448             whence_p = myth_handle->offset;
   449             break;
   450         case GNOME_VFS_SEEK_END:
   451             return GNOME_VFS_ERROR_NOT_SUPPORTED;
   452     }
   453     
   454     new_offset = gmyth_file_transfer_seek (myth_handle->file_transfer, offset, whence_p);
   455     if (new_offset != 0) {
   456         myth_handle->offset = new_offset;
   457         return GNOME_VFS_OK;
   458     }
   459 
   460     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   461 }
   462 
   463 static GnomeVFSResult
   464 do_tell (GnomeVFSMethod       *method,
   465 	 GnomeVFSMethodHandle *method_handle,
   466 	 GnomeVFSFileSize   *offset_return)
   467 {
   468 	MythtvHandle *myth_handle = NULL;
   469     
   470      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   471      
   472     myth_handle = (MythtvHandle *) method_handle;
   473     *offset_return = myth_handle->offset;
   474 
   475     return GNOME_VFS_OK;
   476 }
   477 
   478 static GnomeVFSResult
   479 do_truncate_handle (GnomeVFSMethod *method,
   480 		    GnomeVFSMethodHandle *method_handle,
   481 		    GnomeVFSFileSize where,
   482 		    GnomeVFSContext *context)
   483 {
   484     return GNOME_VFS_ERROR_READ_ONLY;
   485 }
   486 
   487 static GnomeVFSResult
   488 do_open_directory (GnomeVFSMethod 	    *method,
   489 		   GnomeVFSMethodHandle    **method_handle,
   490 		   GnomeVFSURI 		    *uri,
   491 		   GnomeVFSFileInfoOptions   options,
   492 		   GnomeVFSContext 	    *context) 
   493 {
   494     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   495 }
   496 
   497 static GnomeVFSResult
   498 do_close_directory (GnomeVFSMethod 	 *method,
   499 		    GnomeVFSMethodHandle *method_handle,
   500 		    GnomeVFSContext 	 *context) 
   501 {
   502     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   503 }
   504 
   505 static GnomeVFSResult
   506 do_read_directory (GnomeVFSMethod 	*method,
   507        		   GnomeVFSMethodHandle *method_handle,
   508        		   GnomeVFSFileInfo 	*file_info,
   509 		   GnomeVFSContext 	*context)
   510 {
   511     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   512 }
   513 
   514 
   515 static GnomeVFSResult
   516 do_get_file_info (GnomeVFSMethod * method,
   517 		  GnomeVFSURI * uri,
   518 		  GnomeVFSFileInfo * file_info,
   519 		  GnomeVFSFileInfoOptions options,
   520 		  GnomeVFSContext * context)
   521 {
   522     return myth_get_file_info (NULL, uri, file_info);
   523 }
   524 
   525 static GnomeVFSResult
   526 do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   527             			      GnomeVFSMethodHandle 	*method_handle,
   528 			                  GnomeVFSFileInfo 		*file_info,
   529             			      GnomeVFSFileInfoOptions    options,
   530 			                  GnomeVFSContext 		*context)
   531 {
   532 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   533 
   534     return myth_get_file_info (myth_handle, NULL, file_info);
   535 }
   536 
   537 static gboolean
   538 do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   539 {
   540 	return FALSE;
   541 }
   542 
   543 static GnomeVFSResult
   544 do_make_directory (GnomeVFSMethod  *method, 
   545 		            GnomeVFSURI     *uri,
   546                     guint 	    perm, 
   547 		            GnomeVFSContext *context) 
   548 {
   549     return GNOME_VFS_ERROR_READ_ONLY;
   550 }
   551 
   552 static GnomeVFSResult 
   553 do_remove_directory (GnomeVFSMethod  *method, 
   554 		             GnomeVFSURI     *uri, 
   555 		             GnomeVFSContext *context) 
   556 {
   557     return GNOME_VFS_ERROR_READ_ONLY;
   558 }
   559 
   560 static GnomeVFSResult
   561 do_move (GnomeVFSMethod  *method,
   562 	 GnomeVFSURI 	 *old_uri,
   563 	 GnomeVFSURI 	 *new_uri,
   564 	 gboolean         force_replace,
   565 	 GnomeVFSContext *context)
   566 {
   567     return GNOME_VFS_ERROR_READ_ONLY;
   568 }
   569 
   570 static GnomeVFSResult 
   571 do_unlink (GnomeVFSMethod  *method,
   572 	   GnomeVFSURI 	   *uri,
   573 	   GnomeVFSContext *context)
   574 {
   575     return GNOME_VFS_ERROR_READ_ONLY;
   576 }
   577 
   578 static GnomeVFSResult 
   579 do_check_same_fs (GnomeVFSMethod  *method,
   580 		  GnomeVFSURI 	  *a,
   581 		  GnomeVFSURI 	  *b,
   582 		  gboolean 	  *same_fs_return,
   583 		  GnomeVFSContext *context)
   584 {
   585     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   586 }
   587 
   588 static GnomeVFSResult
   589 do_set_file_info (GnomeVFSMethod 		*method,
   590 		  GnomeVFSURI 			*uri,
   591 		  const GnomeVFSFileInfo 	*info,
   592 		  GnomeVFSSetFileInfoMask 	 mask,
   593 		  GnomeVFSContext 		*context)
   594 {
   595     return GNOME_VFS_ERROR_READ_ONLY;
   596 }
   597 
   598 static GnomeVFSResult
   599 do_truncate (GnomeVFSMethod *method,
   600 	     GnomeVFSURI *uri,
   601 	     GnomeVFSFileSize where,
   602 	     GnomeVFSContext *context)
   603 {
   604     return GNOME_VFS_ERROR_READ_ONLY;
   605 }
   606 
   607 static GnomeVFSResult
   608 do_find_directory (GnomeVFSMethod *method,
   609 		   GnomeVFSURI *near_uri,
   610 		   GnomeVFSFindDirectoryKind kind,
   611 		   GnomeVFSURI **result_uri,
   612 		   gboolean create_if_needed,
   613 		   gboolean find_if_needed,
   614 		   guint permissions,
   615 		   GnomeVFSContext *context)
   616 {
   617 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   618 }
   619 
   620 static GnomeVFSResult
   621 do_create_symbolic_link (GnomeVFSMethod *method,
   622 			 GnomeVFSURI *uri,
   623 			 const char *target_reference,
   624 			 GnomeVFSContext *context)
   625 {
   626     return GNOME_VFS_ERROR_READ_ONLY;
   627 }
   628 
   629 static GnomeVFSResult
   630 do_monitor_add (GnomeVFSMethod *method,
   631 		GnomeVFSMethodHandle **method_handle_return,
   632 		GnomeVFSURI *uri,
   633 		GnomeVFSMonitorType monitor_type)
   634 {
   635 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   636 }
   637 
   638 static GnomeVFSResult
   639 do_monitor_cancel (GnomeVFSMethod *method,
   640 		   GnomeVFSMethodHandle *method_handle)
   641 {
   642 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   643 }
   644 
   645 static GnomeVFSResult
   646 do_file_control (GnomeVFSMethod *method,
   647 		 GnomeVFSMethodHandle *method_handle,
   648 		 const char *operation,
   649 		 gpointer operation_data,
   650 		 GnomeVFSContext *context)
   651 {
   652 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   653 }
   654 
   655 static GnomeVFSMethod method = {
   656 	sizeof (GnomeVFSMethod),
   657 	do_open, 
   658 	do_create,
   659 	do_close,
   660 	do_read, 
   661 	do_write,
   662 	do_seek,
   663 	do_tell,
   664 	do_truncate_handle, 
   665 	do_open_directory,
   666 	do_close_directory,
   667 	do_read_directory,
   668 	do_get_file_info,
   669 	do_get_file_info_from_handle,
   670 	do_is_local, 
   671 	do_make_directory, 
   672 	do_remove_directory,
   673 	do_move,
   674 	do_unlink,
   675 	do_check_same_fs,
   676 	do_set_file_info,
   677 	do_truncate, 
   678 	do_find_directory, 
   679 	do_create_symbolic_link,  
   680 	do_monitor_add,  
   681 	do_monitor_cancel,  
   682 	do_file_control 	
   683 };
   684 
   685 
   686 GnomeVFSMethod *
   687 vfs_module_init (const char *method_name, const char *args)
   688 {
   689 	return &method;
   690 }
   691 
   692 void
   693 vfs_module_shutdown (GnomeVFSMethod * method)
   694 {
   695 }