+directory remove
[captive.git] / src / client / libcaptive-gnomevfs / gnome-vfs-method.c
index bffc67a..f39e45d 100644 (file)
@@ -159,6 +159,37 @@ CaptiveDirectoryObject *captive_directory_object;
 }
 
 
+static GnomeVFSResult captive_gnomevfs_remove_directory(GnomeVFSMethod *method,
+               GnomeVFSURI *uri,GnomeVFSContext *context)
+{
+GnomeVFSResult errvfsresult;
+CaptiveDirectoryObject *captive_directory_object;
+
+       g_return_val_if_fail(method==&GnomeVFSMethod_static,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+       errvfsresult=captive_gnomevfs_uri_parent_init(uri);
+       g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
+
+       G_LOCK(libcaptive);
+       errvfsresult=captive_directory_new_open(
+                       &captive_directory_object,      /* captive_directory_object_return */
+                       uri->text);     /* pathname */
+       G_UNLOCK(libcaptive);
+       if (errvfsresult!=GNOME_VFS_OK)
+               return errvfsresult;
+
+       G_LOCK(libcaptive);
+       errvfsresult=captive_directory_remove(captive_directory_object);
+       G_UNLOCK(libcaptive);
+
+       G_LOCK(libcaptive);
+       g_object_unref(captive_directory_object);
+       G_UNLOCK(libcaptive);
+
+       return errvfsresult;
+}
+
+
 static GnomeVFSResult captive_gnomevfs_open(GnomeVFSMethod *method,
                GnomeVFSMethodHandle **method_handle_return,GnomeVFSURI *uri,GnomeVFSOpenMode mode,GnomeVFSContext *context)
 {
@@ -338,19 +369,20 @@ GnomeVFSMethod *captive_gnomevfs_method_init(const gchar *fs_path)
        G_LOCK(GnomeVFSMethod_static);
        CAPTIVE_MEMZERO(&GnomeVFSMethod_static);
        GnomeVFSMethod_static.method_table_size=sizeof(GnomeVFSMethod_static);
-       GnomeVFSMethod_static.open_directory =captive_gnomevfs_open_directory;
-       GnomeVFSMethod_static.close_directory=captive_gnomevfs_close_directory;
-       GnomeVFSMethod_static.read_directory =captive_gnomevfs_read_directory;
-       GnomeVFSMethod_static.make_directory =captive_gnomevfs_make_directory;
-       GnomeVFSMethod_static.open           =captive_gnomevfs_open;    /* mandatory */
-       GnomeVFSMethod_static.close          =captive_gnomevfs_close;
-       GnomeVFSMethod_static.read           =captive_gnomevfs_read;
-       GnomeVFSMethod_static.write          =captive_gnomevfs_write;
-       GnomeVFSMethod_static.seek           =captive_gnomevfs_seek;
-       GnomeVFSMethod_static.tell           =captive_gnomevfs_tell;
-       GnomeVFSMethod_static.create         =captive_gnomevfs_create;  /* mandatory */
-       GnomeVFSMethod_static.is_local       =captive_gnomevfs_is_local;        /* mandatory */
-       GnomeVFSMethod_static.get_file_info  =captive_gnomevfs_get_file_info;   /* mandatory */
+       GnomeVFSMethod_static.open_directory  =captive_gnomevfs_open_directory;
+       GnomeVFSMethod_static.close_directory =captive_gnomevfs_close_directory;
+       GnomeVFSMethod_static.read_directory  =captive_gnomevfs_read_directory;
+       GnomeVFSMethod_static.make_directory  =captive_gnomevfs_make_directory;
+       GnomeVFSMethod_static.remove_directory=captive_gnomevfs_remove_directory;
+       GnomeVFSMethod_static.open            =captive_gnomevfs_open;   /* mandatory */
+       GnomeVFSMethod_static.close           =captive_gnomevfs_close;
+       GnomeVFSMethod_static.read            =captive_gnomevfs_read;
+       GnomeVFSMethod_static.write           =captive_gnomevfs_write;
+       GnomeVFSMethod_static.seek            =captive_gnomevfs_seek;
+       GnomeVFSMethod_static.tell            =captive_gnomevfs_tell;
+       GnomeVFSMethod_static.create          =captive_gnomevfs_create; /* mandatory */
+       GnomeVFSMethod_static.is_local        =captive_gnomevfs_is_local;       /* mandatory */
+       GnomeVFSMethod_static.get_file_info   =captive_gnomevfs_get_file_info;  /* mandatory */
        G_UNLOCK(GnomeVFSMethod_static);
 
        return &GnomeVFSMethod_static;