libgnomevfs2-mythtv/modules/mythtv-method.c
author morphbr
Wed Apr 04 16:47:00 2007 +0100 (2007-04-04)
branchtrunk
changeset 496 8f9fe41efa81
parent 461 0683ea324deb
child 502 aa932d8bf85b
permissions -rwxr-xr-x
[svn r501] Changed test client name
     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 
   154     if (myth_handle == NULL) {
   155         gchar *tmp_str1;
   156         gchar *tmp_str2;
   157         
   158         tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
   159         tmp_str2 = gnome_vfs_unescape_string (tmp_str1, "");
   160 
   161         backend_info = gmyth_backend_info_new_with_uri (tmp_str2);
   162         gmyth_uri = gmyth_uri_new_with_value (tmp_str2);
   163         
   164         g_free (tmp_str1);
   165         g_free (tmp_str2);
   166     } else {
   167         backend_info = g_object_ref (myth_handle->backend_info);
   168         gmyth_uri = g_object_ref (myth_handle->gmyth_uri);
   169     }
   170 
   171     info->valid_fields = 0;
   172 	info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | 
   173         GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | 
   174         GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
   175     
   176 	info->type = GNOME_VFS_FILE_TYPE_REGULAR;
   177     
   178 	/* fixme: get from file extension? */
   179 	info->mime_type = g_strdup ("video/x-nuv");
   180 	info->permissions = GNOME_VFS_PERM_USER_READ | 
   181         GNOME_VFS_PERM_OTHER_READ | 
   182         GNOME_VFS_PERM_GROUP_READ;
   183 
   184    
   185 	info->name = g_strdup (gmyth_uri_get_path (gmyth_uri));
   186 
   187     /* file size for remote files */
   188     if (gmyth_uri_is_livetv (gmyth_uri) == FALSE) {
   189         GMythFileTransfer *file_transfer = gmyth_file_transfer_new (backend_info);
   190         
   191         /* Verifies if the file exists */
   192         if (!gmyth_util_file_exists (backend_info, 
   193                     gmyth_uri_get_path (gmyth_uri))) {
   194             g_object_unref (file_transfer);
   195             g_object_unref (backend_info);
   196             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   197             return GNOME_VFS_ERROR_NOT_FOUND;
   198 		}
   199 
   200         if (!gmyth_file_transfer_open (file_transfer, gmyth_uri_get_path (gmyth_uri))) {
   201             g_object_unref (file_transfer);
   202             g_object_unref (backend_info);
   203             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   204             return GNOME_VFS_ERROR_NOT_FOUND;
   205         }
   206 	
   207 		info->size = gmyth_file_transfer_get_filesize (file_transfer);
   208         info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
   209 		g_object_unref (file_transfer);
   210 	}
   211 
   212     g_object_unref (backend_info);
   213     g_object_unref (gmyth_uri);
   214     
   215     return GNOME_VFS_OK;
   216 }
   217 
   218 static GnomeVFSResult
   219 myth_connection_start (MythtvHandle * method_handle)
   220 {
   221     GnomeVFSResult result = GNOME_VFS_OK;
   222 
   223     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   224     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle->backend_info != NULL);
   225 
   226 	/* Connect to the backend */
   227 	if (gmyth_uri_is_livetv (method_handle->gmyth_uri) == TRUE) {
   228 		method_handle->livetv = gmyth_livetv_new (method_handle->backend_info);
   229 		method_handle->channel_name = gmyth_uri_get_channel_name (method_handle->gmyth_uri);
   230         
   231 		if (method_handle->channel_name != NULL) {
   232 		    if (gmyth_livetv_channel_name_setup (method_handle->livetv, 
   233                     method_handle->channel_name) == FALSE) {
   234                 result = GNOME_VFS_ERROR_INVALID_URI;
   235     			goto error;
   236 			}
   237 		} else if (gmyth_livetv_setup (method_handle->livetv) == FALSE) {
   238                 result = GNOME_VFS_ERROR_INVALID_URI;
   239                 goto error;
   240 		}
   241         
   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             goto error;
   272 		}
   273 
   274 		/* sets the Playback monitor connection */
   275 		if (!gmyth_file_transfer_open (method_handle->file_transfer,
   276                   					    gmyth_uri_get_path (method_handle->gmyth_uri))) {
   277 
   278             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   279 		    result = GNOME_VFS_ERROR_NOT_FOUND;
   280             goto error;
   281         }
   282 	} /* if - LiveTV or not? */
   283 
   284 	method_handle->configured = TRUE;    
   285 
   286     if (method_handle->file_transfer == NULL) {
   287         result = GNOME_VFS_ERROR_NOT_OPEN;
   288     }
   289 
   290 error:
   291     
   292     return result; 
   293 }
   294 
   295 static GnomeVFSResult
   296 do_open (GnomeVFSMethod * method,
   297 	 GnomeVFSMethodHandle ** method_handle,
   298 	 GnomeVFSURI * uri,
   299 	 GnomeVFSOpenMode mode, GnomeVFSContext * context)
   300 {
   301 	MythtvHandle *myth_handle = NULL;
   302     GnomeVFSResult result = GNOME_VFS_OK;
   303 
   304 	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   305 	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
   306 
   307 	if (mode & GNOME_VFS_OPEN_WRITE) {
   308 		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   309 	}
   310 
   311     result = myth_handle_new (uri, &myth_handle);
   312     if (result != GNOME_VFS_OK) 
   313         return result;
   314 
   315     result = myth_connection_start (myth_handle);
   316     if (result != GNOME_VFS_OK) {
   317         myth_destroy_handle (myth_handle);
   318         myth_handle = NULL;
   319         return result;
   320     }
   321 
   322     *method_handle = (GnomeVFSMethodHandle *) myth_handle;
   323     
   324     return result;
   325 }
   326 
   327 static GnomeVFSResult
   328 do_create (GnomeVFSMethod	 *method,
   329 	   GnomeVFSMethodHandle **method_handle,
   330 	   GnomeVFSURI 		 *uri,
   331 	   GnomeVFSOpenMode 	  mode,
   332 	   gboolean 		  exclusive,
   333 	   guint 		  perm,
   334 	   GnomeVFSContext 	 *context)
   335 {
   336     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   337 }
   338 
   339 static GnomeVFSResult
   340 do_close (GnomeVFSMethod * method,
   341         GnomeVFSMethodHandle * method_handle, 
   342         GnomeVFSContext * context)
   343 {
   344 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   345 
   346     myth_destroy_handle (myth_handle);
   347     
   348 	return GNOME_VFS_OK;
   349 }
   350 
   351 
   352 static GnomeVFSResult
   353 do_read (GnomeVFSMethod * method,
   354 	 GnomeVFSMethodHandle * method_handle,
   355 	 gpointer buffer,
   356 	 GnomeVFSFileSize num_bytes,
   357 	 GnomeVFSFileSize * bytes_read, 
   358          GnomeVFSContext * context)
   359 {
   360     GnomeVFSResult result;
   361     MythtvHandle *myth_handle;
   362     gint64 total_read = 0;
   363     GByteArray *myth_buffer = g_byte_array_new ();
   364 
   365     _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   366 
   367     myth_handle = (MythtvHandle *) method_handle;
   368     result = GNOME_VFS_OK;
   369 
   370     total_read = gmyth_file_transfer_read (myth_handle->file_transfer,
   371                               		   myth_buffer,
   372                          		   num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri));
   373 
   374 
   375     if (total_read == -1) {
   376         result = GNOME_VFS_ERROR_IO;
   377         total_read = 0;
   378     }
   379 
   380     if (total_read < num_bytes) {
   381         result = GNOME_VFS_ERROR_EOF;
   382     }
   383 
   384     if (total_read > 0) {
   385 	g_memmove (buffer, myth_buffer->data, total_read);
   386         g_byte_array_free (myth_buffer, TRUE);
   387         myth_handle->offset += total_read;
   388     } 
   389     
   390     *bytes_read = (GnomeVFSFileSize) total_read;
   391 
   392 	return result;
   393 }
   394 
   395 static GnomeVFSResult
   396 do_write (GnomeVFSMethod 	*method,
   397 	  GnomeVFSMethodHandle  *method_handle,
   398 	  gconstpointer 	 buffer,
   399 	  GnomeVFSFileSize 	 num_bytes,
   400 	  GnomeVFSFileSize 	*bytes_written,
   401 	  GnomeVFSContext 	*context)
   402 {
   403     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   404 }
   405 
   406 static GnomeVFSResult
   407 do_seek (GnomeVFSMethod	      *method,
   408 	 GnomeVFSMethodHandle *method_handle,
   409 	 GnomeVFSSeekPosition  whence,
   410 	 GnomeVFSFileOffset    offset,
   411 	 GnomeVFSContext      *context)
   412 {
   413 	MythtvHandle *myth_handle;
   414     //guint64 whence_p = 0;
   415     //gint64 new_offset =0;
   416 
   417      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   418 
   419      myth_handle = (MythtvHandle *) method_handle;    
   420     
   421     g_debug ("seek offset%"G_GINT64_FORMAT" whence %d", offset, whence);
   422 
   423     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   424     /*
   425     if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   426     
   427     switch (whence)
   428     {
   429         case GNOME_VFS_SEEK_START:
   430             whence_p = 0;
   431             break;
   432         case GNOME_VFS_SEEK_CURRENT:
   433             whence_p = myth_handle->offset;
   434             break;
   435         case GNOME_VFS_SEEK_END:
   436             return GNOME_VFS_ERROR_NOT_SUPPORTED;
   437     }
   438     
   439     new_offset = gmyth_file_transfer_seek (myth_handle->file_transfer, offset, whence_p);
   440     if (new_offset != 0) {
   441         myth_handle->offset = new_offset;
   442         return GNOME_VFS_OK;
   443     }
   444 
   445     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   446     */
   447 }
   448 
   449 static GnomeVFSResult
   450 do_tell (GnomeVFSMethod       *method,
   451 	 GnomeVFSMethodHandle *method_handle,
   452 	 GnomeVFSFileSize   *offset_return)
   453 {
   454 	MythtvHandle *myth_handle = NULL;
   455     
   456      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   457      
   458     myth_handle = (MythtvHandle *) method_handle;
   459     *offset_return = myth_handle->offset;
   460 
   461     return GNOME_VFS_OK;
   462 }
   463 
   464 static GnomeVFSResult
   465 do_truncate_handle (GnomeVFSMethod *method,
   466 		    GnomeVFSMethodHandle *method_handle,
   467 		    GnomeVFSFileSize where,
   468 		    GnomeVFSContext *context)
   469 {
   470     return GNOME_VFS_ERROR_READ_ONLY;
   471 }
   472 
   473 static GnomeVFSResult
   474 do_open_directory (GnomeVFSMethod 	    *method,
   475 		   GnomeVFSMethodHandle    **method_handle,
   476 		   GnomeVFSURI 		    *uri,
   477 		   GnomeVFSFileInfoOptions   options,
   478 		   GnomeVFSContext 	    *context) 
   479 {
   480     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   481 }
   482 
   483 static GnomeVFSResult
   484 do_close_directory (GnomeVFSMethod 	 *method,
   485 		    GnomeVFSMethodHandle *method_handle,
   486 		    GnomeVFSContext 	 *context) 
   487 {
   488     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   489 }
   490 
   491 static GnomeVFSResult
   492 do_read_directory (GnomeVFSMethod 	*method,
   493        		   GnomeVFSMethodHandle *method_handle,
   494        		   GnomeVFSFileInfo 	*file_info,
   495 		   GnomeVFSContext 	*context)
   496 {
   497     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   498 }
   499 
   500 
   501 static GnomeVFSResult
   502 do_get_file_info (GnomeVFSMethod * method,
   503 		  GnomeVFSURI * uri,
   504 		  GnomeVFSFileInfo * file_info,
   505 		  GnomeVFSFileInfoOptions options,
   506 		  GnomeVFSContext * context)
   507 {
   508     return myth_get_file_info (NULL, uri, file_info);
   509 }
   510 
   511 static GnomeVFSResult
   512 do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   513             			      GnomeVFSMethodHandle 	*method_handle,
   514 			                  GnomeVFSFileInfo 		*file_info,
   515             			      GnomeVFSFileInfoOptions    options,
   516 			                  GnomeVFSContext 		*context)
   517 {
   518 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   519 
   520     return myth_get_file_info (myth_handle, NULL, file_info);
   521 }
   522 
   523 static gboolean
   524 do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   525 {
   526 	return FALSE;
   527 }
   528 
   529 static GnomeVFSResult
   530 do_make_directory (GnomeVFSMethod  *method, 
   531 		            GnomeVFSURI     *uri,
   532                     guint 	    perm, 
   533 		            GnomeVFSContext *context) 
   534 {
   535     return GNOME_VFS_ERROR_READ_ONLY;
   536 }
   537 
   538 static GnomeVFSResult 
   539 do_remove_directory (GnomeVFSMethod  *method, 
   540 		             GnomeVFSURI     *uri, 
   541 		             GnomeVFSContext *context) 
   542 {
   543     return GNOME_VFS_ERROR_READ_ONLY;
   544 }
   545 
   546 static GnomeVFSResult
   547 do_move (GnomeVFSMethod  *method,
   548 	 GnomeVFSURI 	 *old_uri,
   549 	 GnomeVFSURI 	 *new_uri,
   550 	 gboolean         force_replace,
   551 	 GnomeVFSContext *context)
   552 {
   553     return GNOME_VFS_ERROR_READ_ONLY;
   554 }
   555 
   556 static GnomeVFSResult 
   557 do_unlink (GnomeVFSMethod  *method,
   558 	   GnomeVFSURI 	   *uri,
   559 	   GnomeVFSContext *context)
   560 {
   561     return GNOME_VFS_ERROR_READ_ONLY;
   562 }
   563 
   564 static GnomeVFSResult 
   565 do_check_same_fs (GnomeVFSMethod  *method,
   566 		  GnomeVFSURI 	  *a,
   567 		  GnomeVFSURI 	  *b,
   568 		  gboolean 	  *same_fs_return,
   569 		  GnomeVFSContext *context)
   570 {
   571     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   572 }
   573 
   574 static GnomeVFSResult
   575 do_set_file_info (GnomeVFSMethod 		*method,
   576 		  GnomeVFSURI 			*uri,
   577 		  const GnomeVFSFileInfo 	*info,
   578 		  GnomeVFSSetFileInfoMask 	 mask,
   579 		  GnomeVFSContext 		*context)
   580 {
   581     return GNOME_VFS_ERROR_READ_ONLY;
   582 }
   583 
   584 static GnomeVFSResult
   585 do_truncate (GnomeVFSMethod *method,
   586 	     GnomeVFSURI *uri,
   587 	     GnomeVFSFileSize where,
   588 	     GnomeVFSContext *context)
   589 {
   590     return GNOME_VFS_ERROR_READ_ONLY;
   591 }
   592 
   593 static GnomeVFSResult
   594 do_find_directory (GnomeVFSMethod *method,
   595 		   GnomeVFSURI *near_uri,
   596 		   GnomeVFSFindDirectoryKind kind,
   597 		   GnomeVFSURI **result_uri,
   598 		   gboolean create_if_needed,
   599 		   gboolean find_if_needed,
   600 		   guint permissions,
   601 		   GnomeVFSContext *context)
   602 {
   603 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   604 }
   605 
   606 static GnomeVFSResult
   607 do_create_symbolic_link (GnomeVFSMethod *method,
   608 			 GnomeVFSURI *uri,
   609 			 const char *target_reference,
   610 			 GnomeVFSContext *context)
   611 {
   612     return GNOME_VFS_ERROR_READ_ONLY;
   613 }
   614 
   615 static GnomeVFSResult
   616 do_monitor_add (GnomeVFSMethod *method,
   617 		GnomeVFSMethodHandle **method_handle_return,
   618 		GnomeVFSURI *uri,
   619 		GnomeVFSMonitorType monitor_type)
   620 {
   621 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   622 }
   623 
   624 static GnomeVFSResult
   625 do_monitor_cancel (GnomeVFSMethod *method,
   626 		   GnomeVFSMethodHandle *method_handle)
   627 {
   628 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   629 }
   630 
   631 static GnomeVFSResult
   632 do_file_control (GnomeVFSMethod *method,
   633 		 GnomeVFSMethodHandle *method_handle,
   634 		 const char *operation,
   635 		 gpointer operation_data,
   636 		 GnomeVFSContext *context)
   637 {
   638 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   639 }
   640 
   641 static GnomeVFSMethod method = {
   642 	sizeof (GnomeVFSMethod),
   643 	do_open, 
   644 	do_create,
   645 	do_close,
   646 	do_read, 
   647 	do_write,
   648 	do_seek,
   649 	do_tell,
   650 	do_truncate_handle, 
   651 	do_open_directory,
   652 	do_close_directory,
   653 	do_read_directory,
   654 	do_get_file_info,
   655 	do_get_file_info_from_handle,
   656 	do_is_local, 
   657 	do_make_directory, 
   658 	do_remove_directory,
   659 	do_move,
   660 	do_unlink,
   661 	do_check_same_fs,
   662 	do_set_file_info,
   663 	do_truncate, 
   664 	do_find_directory, 
   665 	do_create_symbolic_link,  
   666 	do_monitor_add,  
   667 	do_monitor_cancel,  
   668 	do_file_control 	
   669 };
   670 
   671 
   672 GnomeVFSMethod *
   673 vfs_module_init (const char *method_name, const char *args)
   674 {
   675 	return &method;
   676 }
   677 
   678 void
   679 vfs_module_shutdown (GnomeVFSMethod * method)
   680 {
   681 }