libgnomevfs2-mythtv/modules/mythtv-method.c
author renatofilho
Tue Mar 27 21:42:35 2007 +0100 (2007-03-27)
branchtrunk
changeset 464 5ef4452c42cc
parent 460 cde4aad8577a
child 465 997f281ba596
permissions -rwxr-xr-x
[svn r469] bug fix
     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 		g_debug ("[%s] Channel name = %s\n", __FUNCTION__, 
   232                 method_handle->channel_name);
   233         
   234 		if (method_handle->channel_name != NULL) {
   235 		    if (gmyth_livetv_channel_name_setup (method_handle->livetv, 
   236                     method_handle->channel_name) == FALSE) {
   237                 result = GNOME_VFS_ERROR_INVALID_URI;
   238     			goto error;
   239 			}
   240 		} else if (gmyth_livetv_setup (method_handle->livetv) == FALSE) {
   241                 result = GNOME_VFS_ERROR_INVALID_URI;
   242                 goto error;
   243 		}
   244         
   245 
   246     	method_handle->file_transfer = 
   247             gmyth_livetv_create_file_transfer (method_handle->livetv);
   248 
   249         if (method_handle->file_transfer == NULL) {
   250             result = GNOME_VFS_ERROR_INVALID_URI;
   251     		g_debug ("MythTV FileTransfer is NULL!\n");
   252             goto error;
   253         }
   254 
   255 	    if (!gmyth_file_transfer_open (method_handle->file_transfer,
   256                                         method_handle->livetv->uri != NULL ? 
   257                                         gmyth_uri_get_path (method_handle->livetv->uri) :
   258                                         method_handle->livetv->proginfo->pathname->str)) {
   259         
   260             g_debug ("Couldn't open MythTV FileTransfer is NULL!\n");
   261             result = GNOME_VFS_ERROR_NOT_OPEN;
   262             goto error;
   263         }
   264     }
   265     else {
   266         method_handle->file_transfer = 
   267             gmyth_file_transfer_new (method_handle->backend_info);
   268 
   269 		/* Verifies if the file exists */
   270 		if (!gmyth_util_file_exists (method_handle->backend_info, 
   271                     gmyth_uri_get_path (method_handle->gmyth_uri))) {
   272 
   273             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   274             goto error;
   275 		}
   276 
   277 		/* sets the Playback monitor connection */
   278 		if (!gmyth_file_transfer_open (method_handle->file_transfer,
   279                   					    gmyth_uri_get_path (method_handle->gmyth_uri))) {
   280 
   281             g_debug ("NOT FOUND %s/%d", __FUNCTION__, __LINE__);
   282 		    result = GNOME_VFS_ERROR_NOT_FOUND;
   283             goto error;
   284         }
   285 	} /* if - LiveTV or not? */
   286 
   287 	method_handle->configured = TRUE;    
   288 
   289     if (method_handle->file_transfer == NULL) {
   290         result = GNOME_VFS_ERROR_NOT_OPEN;
   291     }
   292 
   293 error:
   294     
   295     return result; 
   296 }
   297 
   298 static GnomeVFSResult
   299 do_open (GnomeVFSMethod * method,
   300 	 GnomeVFSMethodHandle ** method_handle,
   301 	 GnomeVFSURI * uri,
   302 	 GnomeVFSOpenMode mode, GnomeVFSContext * context)
   303 {
   304 	MythtvHandle *myth_handle = NULL;
   305     GnomeVFSResult result = GNOME_VFS_OK;
   306 
   307 	_GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   308 	_GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
   309 
   310 	if (mode & GNOME_VFS_OPEN_WRITE) {
   311 		return GNOME_VFS_ERROR_INVALID_OPEN_MODE;
   312 	}
   313 
   314     result = myth_handle_new (uri, &myth_handle);
   315     if (result != GNOME_VFS_OK) 
   316         return result;
   317 
   318     result = myth_connection_start (myth_handle);
   319     if (result != GNOME_VFS_OK) {
   320         myth_destroy_handle (myth_handle);
   321         myth_handle = NULL;
   322         return result;
   323     }
   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     myth_handle = (MythtvHandle *) method_handle;
   371     result = GNOME_VFS_OK;
   372 
   373     total_read = gmyth_file_transfer_read (myth_handle->file_transfer,
   374                               		   myth_buffer,
   375                          		   num_bytes, gmyth_uri_is_livetv (myth_handle->gmyth_uri));
   376 
   377 
   378     if (total_read == -1) {
   379         result = GNOME_VFS_ERROR_IO;
   380         total_read = 0;
   381     }
   382 
   383     if (total_read < num_bytes) {
   384         result = GNOME_VFS_ERROR_EOF;
   385     }
   386 
   387     if (total_read > 0) {
   388 	g_memmove (buffer, myth_buffer->data, total_read);
   389         g_byte_array_free (myth_buffer, TRUE);
   390         myth_handle->offset += total_read;
   391     } 
   392     
   393     *bytes_read = (GnomeVFSFileSize) total_read;
   394 
   395 	return result;
   396 }
   397 
   398 static GnomeVFSResult
   399 do_write (GnomeVFSMethod 	*method,
   400 	  GnomeVFSMethodHandle  *method_handle,
   401 	  gconstpointer 	 buffer,
   402 	  GnomeVFSFileSize 	 num_bytes,
   403 	  GnomeVFSFileSize 	*bytes_written,
   404 	  GnomeVFSContext 	*context)
   405 {
   406     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   407 }
   408 
   409 static GnomeVFSResult
   410 do_seek (GnomeVFSMethod	      *method,
   411 	 GnomeVFSMethodHandle *method_handle,
   412 	 GnomeVFSSeekPosition  whence,
   413 	 GnomeVFSFileOffset    offset,
   414 	 GnomeVFSContext      *context)
   415 {
   416 	MythtvHandle *myth_handle;
   417     //guint64 whence_p = 0;
   418     //gint64 new_offset =0;
   419 
   420      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   421 
   422      myth_handle = (MythtvHandle *) method_handle;    
   423     
   424     g_debug ("seek offset%"G_GINT64_FORMAT" whence %d", offset, whence);
   425 
   426     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   427     /*
   428     if (gmyth_uri_is_livetv (myth_handle->gmyth_uri))
   429     
   430     switch (whence)
   431     {
   432         case GNOME_VFS_SEEK_START:
   433             whence_p = 0;
   434             break;
   435         case GNOME_VFS_SEEK_CURRENT:
   436             whence_p = myth_handle->offset;
   437             break;
   438         case GNOME_VFS_SEEK_END:
   439             return GNOME_VFS_ERROR_NOT_SUPPORTED;
   440     }
   441     
   442     new_offset = gmyth_file_transfer_seek (myth_handle->file_transfer, offset, whence_p);
   443     if (new_offset != 0) {
   444         myth_handle->offset = new_offset;
   445         return GNOME_VFS_OK;
   446     }
   447 
   448     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   449     */
   450 }
   451 
   452 static GnomeVFSResult
   453 do_tell (GnomeVFSMethod       *method,
   454 	 GnomeVFSMethodHandle *method_handle,
   455 	 GnomeVFSFileSize   *offset_return)
   456 {
   457 	MythtvHandle *myth_handle = NULL;
   458     
   459      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
   460      
   461     myth_handle = (MythtvHandle *) method_handle;
   462     *offset_return = myth_handle->offset;
   463 
   464     return GNOME_VFS_OK;
   465 }
   466 
   467 static GnomeVFSResult
   468 do_truncate_handle (GnomeVFSMethod *method,
   469 		    GnomeVFSMethodHandle *method_handle,
   470 		    GnomeVFSFileSize where,
   471 		    GnomeVFSContext *context)
   472 {
   473     return GNOME_VFS_ERROR_READ_ONLY;
   474 }
   475 
   476 static GnomeVFSResult
   477 do_open_directory (GnomeVFSMethod 	    *method,
   478 		   GnomeVFSMethodHandle    **method_handle,
   479 		   GnomeVFSURI 		    *uri,
   480 		   GnomeVFSFileInfoOptions   options,
   481 		   GnomeVFSContext 	    *context) 
   482 {
   483     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   484 }
   485 
   486 static GnomeVFSResult
   487 do_close_directory (GnomeVFSMethod 	 *method,
   488 		    GnomeVFSMethodHandle *method_handle,
   489 		    GnomeVFSContext 	 *context) 
   490 {
   491     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   492 }
   493 
   494 static GnomeVFSResult
   495 do_read_directory (GnomeVFSMethod 	*method,
   496        		   GnomeVFSMethodHandle *method_handle,
   497        		   GnomeVFSFileInfo 	*file_info,
   498 		   GnomeVFSContext 	*context)
   499 {
   500     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   501 }
   502 
   503 
   504 static GnomeVFSResult
   505 do_get_file_info (GnomeVFSMethod * method,
   506 		  GnomeVFSURI * uri,
   507 		  GnomeVFSFileInfo * file_info,
   508 		  GnomeVFSFileInfoOptions options,
   509 		  GnomeVFSContext * context)
   510 {
   511     return myth_get_file_info (NULL, uri, file_info);
   512 }
   513 
   514 static GnomeVFSResult
   515 do_get_file_info_from_handle (GnomeVFSMethod 		*method,
   516             			      GnomeVFSMethodHandle 	*method_handle,
   517 			                  GnomeVFSFileInfo 		*file_info,
   518             			      GnomeVFSFileInfoOptions    options,
   519 			                  GnomeVFSContext 		*context)
   520 {
   521 	MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
   522 
   523     return myth_get_file_info (myth_handle, NULL, file_info);
   524 }
   525 
   526 static gboolean
   527 do_is_local (GnomeVFSMethod * method, const GnomeVFSURI * uri)
   528 {
   529 	return FALSE;
   530 }
   531 
   532 static GnomeVFSResult
   533 do_make_directory (GnomeVFSMethod  *method, 
   534 		            GnomeVFSURI     *uri,
   535                     guint 	    perm, 
   536 		            GnomeVFSContext *context) 
   537 {
   538     return GNOME_VFS_ERROR_READ_ONLY;
   539 }
   540 
   541 static GnomeVFSResult 
   542 do_remove_directory (GnomeVFSMethod  *method, 
   543 		             GnomeVFSURI     *uri, 
   544 		             GnomeVFSContext *context) 
   545 {
   546     return GNOME_VFS_ERROR_READ_ONLY;
   547 }
   548 
   549 static GnomeVFSResult
   550 do_move (GnomeVFSMethod  *method,
   551 	 GnomeVFSURI 	 *old_uri,
   552 	 GnomeVFSURI 	 *new_uri,
   553 	 gboolean         force_replace,
   554 	 GnomeVFSContext *context)
   555 {
   556     return GNOME_VFS_ERROR_READ_ONLY;
   557 }
   558 
   559 static GnomeVFSResult 
   560 do_unlink (GnomeVFSMethod  *method,
   561 	   GnomeVFSURI 	   *uri,
   562 	   GnomeVFSContext *context)
   563 {
   564     return GNOME_VFS_ERROR_READ_ONLY;
   565 }
   566 
   567 static GnomeVFSResult 
   568 do_check_same_fs (GnomeVFSMethod  *method,
   569 		  GnomeVFSURI 	  *a,
   570 		  GnomeVFSURI 	  *b,
   571 		  gboolean 	  *same_fs_return,
   572 		  GnomeVFSContext *context)
   573 {
   574     return GNOME_VFS_ERROR_NOT_SUPPORTED;
   575 }
   576 
   577 static GnomeVFSResult
   578 do_set_file_info (GnomeVFSMethod 		*method,
   579 		  GnomeVFSURI 			*uri,
   580 		  const GnomeVFSFileInfo 	*info,
   581 		  GnomeVFSSetFileInfoMask 	 mask,
   582 		  GnomeVFSContext 		*context)
   583 {
   584     return GNOME_VFS_ERROR_READ_ONLY;
   585 }
   586 
   587 static GnomeVFSResult
   588 do_truncate (GnomeVFSMethod *method,
   589 	     GnomeVFSURI *uri,
   590 	     GnomeVFSFileSize where,
   591 	     GnomeVFSContext *context)
   592 {
   593     return GNOME_VFS_ERROR_READ_ONLY;
   594 }
   595 
   596 static GnomeVFSResult
   597 do_find_directory (GnomeVFSMethod *method,
   598 		   GnomeVFSURI *near_uri,
   599 		   GnomeVFSFindDirectoryKind kind,
   600 		   GnomeVFSURI **result_uri,
   601 		   gboolean create_if_needed,
   602 		   gboolean find_if_needed,
   603 		   guint permissions,
   604 		   GnomeVFSContext *context)
   605 {
   606 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   607 }
   608 
   609 static GnomeVFSResult
   610 do_create_symbolic_link (GnomeVFSMethod *method,
   611 			 GnomeVFSURI *uri,
   612 			 const char *target_reference,
   613 			 GnomeVFSContext *context)
   614 {
   615     return GNOME_VFS_ERROR_READ_ONLY;
   616 }
   617 
   618 static GnomeVFSResult
   619 do_monitor_add (GnomeVFSMethod *method,
   620 		GnomeVFSMethodHandle **method_handle_return,
   621 		GnomeVFSURI *uri,
   622 		GnomeVFSMonitorType monitor_type)
   623 {
   624 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   625 }
   626 
   627 static GnomeVFSResult
   628 do_monitor_cancel (GnomeVFSMethod *method,
   629 		   GnomeVFSMethodHandle *method_handle)
   630 {
   631 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   632 }
   633 
   634 static GnomeVFSResult
   635 do_file_control (GnomeVFSMethod *method,
   636 		 GnomeVFSMethodHandle *method_handle,
   637 		 const char *operation,
   638 		 gpointer operation_data,
   639 		 GnomeVFSContext *context)
   640 {
   641 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
   642 }
   643 
   644 static GnomeVFSMethod method = {
   645 	sizeof (GnomeVFSMethod),
   646 	do_open, 
   647 	do_create,
   648 	do_close,
   649 	do_read, 
   650 	do_write,
   651 	do_seek,
   652 	do_tell,
   653 	do_truncate_handle, 
   654 	do_open_directory,
   655 	do_close_directory,
   656 	do_read_directory,
   657 	do_get_file_info,
   658 	do_get_file_info_from_handle,
   659 	do_is_local, 
   660 	do_make_directory, 
   661 	do_remove_directory,
   662 	do_move,
   663 	do_unlink,
   664 	do_check_same_fs,
   665 	do_set_file_info,
   666 	do_truncate, 
   667 	do_find_directory, 
   668 	do_create_symbolic_link,  
   669 	do_monitor_add,  
   670 	do_monitor_cancel,  
   671 	do_file_control 	
   672 };
   673 
   674 
   675 GnomeVFSMethod *
   676 vfs_module_init (const char *method_name, const char *args)
   677 {
   678 	return &method;
   679 }
   680 
   681 void
   682 vfs_module_shutdown (GnomeVFSMethod * method)
   683 {
   684 }