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