diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-30 22:55:24 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-30 22:55:24 +0100 |
| commit | 016687cc49c811589951ebd064a86bdde1405866 (patch) | |
| tree | c8affce18858467be6adcc4b9816388ba557e0c0 | |
| parent | 01072f4baa7ae333e796800d8a17aa157fe08a4e (diff) | |
| download | tuxcmd-modules-016687cc49c811589951ebd064a86bdde1405866.tar.xz | |
Foundation of VFS capabilities
| -rw-r--r-- | common/tuxcmd-vfs.h | 22 | ||||
| -rw-r--r-- | gvfs/gvfs.c | 25 | ||||
| -rw-r--r-- | libarchive/libarchive.c | 7 | ||||
| -rw-r--r-- | unrar/unrar.c | 12 | ||||
| -rw-r--r-- | zip/zip.cpp | 12 |
5 files changed, 71 insertions, 7 deletions
diff --git a/common/tuxcmd-vfs.h b/common/tuxcmd-vfs.h index 9689db2..2ced1b1 100644 --- a/common/tuxcmd-vfs.h +++ b/common/tuxcmd-vfs.h @@ -34,13 +34,13 @@ typedef int TVFSResult; /* Compatible with gio/GAskPasswordFlags */ typedef enum { - VFS_ASK_PASSWORD_NEED_PASSWORD = 1<<0, - VFS_ASK_PASSWORD_NEED_USERNAME = 1<<1, - VFS_ASK_PASSWORD_NEED_DOMAIN = 1<<2, - VFS_ASK_PASSWORD_SAVING_SUPPORTED = 1<<3, - VFS_ASK_PASSWORD_ANONYMOUS_SUPPORTED = 1<<4, - VFS_ASK_PASSWORD_SAVE_INTERNAL = 1<<14, - VFS_ASK_PASSWORD_ARCHIVE_MODE = 1<<15 + VFS_ASK_PASSWORD_NEED_PASSWORD = 1 << 0, + VFS_ASK_PASSWORD_NEED_USERNAME = 1 << 1, + VFS_ASK_PASSWORD_NEED_DOMAIN = 1 << 2, + VFS_ASK_PASSWORD_SAVING_SUPPORTED = 1 << 3, + VFS_ASK_PASSWORD_ANONYMOUS_SUPPORTED = 1 << 4, + VFS_ASK_PASSWORD_SAVE_INTERNAL = 1 << 14, + VFS_ASK_PASSWORD_ARCHIVE_MODE = 1 << 15 } TVFSAskPasswordFlags; /* Compatible with gio/GPasswordSave */ @@ -50,6 +50,14 @@ typedef enum { VFS_PASSWORD_SAVE_PERMANENTLY } TVFSPasswordSave; +/* Module capability flags */ +typedef enum { + VFS_CAP_HANDLES_MULTIPLE_REQUESTS = 1 << 0, /* Multiple (background) operations; usually unsuitable for archives */ + VFS_CAP_CAN_BROWSE_NETWORK = 1 << 1, /* Can handle network:// URIs, scan network resources */ + VFS_CAP_CAN_CREATE_ARCHIVES = 1 << 2, /* Creating archives from scratch */ + VFS_CAP_ARCHIVE_STREAMING = 1 << 3 /* Streaming archive type, can't handle random requests */ +} TVFSModuleCapabilities; + typedef void (* TVFSLogFunc) (const char *s); typedef void * TVFSFileDes; diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index 91a64c0..f62cfaa 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -120,6 +120,7 @@ g_error_to_TVFSResult (GError *error) } } + static void ask_password_cb (GMountOperation *op, const char *message, @@ -195,6 +196,7 @@ ask_password_cb (GMountOperation *op, g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); } + static void ask_question_cb (GMountOperation *op, const gchar *message, @@ -236,6 +238,7 @@ ask_question_cb (GMountOperation *op, g_mount_operation_reply (op, G_MOUNT_OPERATION_UNHANDLED); } + static void mount_done_cb (GObject *object, GAsyncResult *res, @@ -263,6 +266,7 @@ mount_done_cb (GObject *object, g_main_loop_quit (globs->mount_main_loop); } + static TVFSResult vfs_handle_mount (struct TVFSGlobs *globs, GFile *file) { @@ -288,6 +292,7 @@ vfs_handle_mount (struct TVFSGlobs *globs, GFile *file) return globs->mount_result; } + struct TVFSGlobs * VFSNew (TVFSLogFunc log_func) { @@ -315,6 +320,7 @@ VFSNew (TVFSLogFunc log_func) return globs; } + void VFSSetCallbacks (struct TVFSGlobs *globs, TVFSAskQuestionCallback ask_question_callback, @@ -328,6 +334,7 @@ VFSSetCallbacks (struct TVFSGlobs *globs, globs->callback_data = data; } + void VFSFree (struct TVFSGlobs *globs) { @@ -335,12 +342,14 @@ VFSFree (struct TVFSGlobs *globs) g_free (globs); } + int VFSVersion () { return cVFSVersion; } + struct TVFSInfo * VFSGetInfo () { @@ -354,6 +363,14 @@ VFSGetInfo () return module_info; } + +guint32 +VFSGetCapabilities () +{ + return VFS_CAP_HANDLES_MULTIPLE_REQUESTS | VFS_CAP_CAN_BROWSE_NETWORK; +} + + #if 0 char * VFSGetArchiveExts () @@ -362,6 +379,7 @@ VFSGetArchiveExts () } #endif + char * VFSGetNetworkServices () { @@ -388,6 +406,7 @@ VFSGetNetworkServices () return l; } + TVFSResult VFSOpenURI (struct TVFSGlobs *globs, const char *sURI) { @@ -448,6 +467,7 @@ VFSOpenURI (struct TVFSGlobs *globs, const char *sURI) return cVFS_OK; } + TVFSResult VFSClose (struct TVFSGlobs *globs) { @@ -460,6 +480,7 @@ VFSClose (struct TVFSGlobs *globs) return cVFS_OK; } + static char * get_absolute_path (GFile *file) { @@ -487,6 +508,7 @@ get_absolute_path (GFile *file) return NULL; } + char * VFSGetPath (struct TVFSGlobs *globs) { @@ -498,6 +520,7 @@ VFSGetPath (struct TVFSGlobs *globs) return s; } + char * VFSGetPathURI (struct TVFSGlobs *globs) { @@ -507,6 +530,7 @@ VFSGetPathURI (struct TVFSGlobs *globs) return NULL; } + TVFSResult VFSGetFileSystemInfo (struct TVFSGlobs *globs, const char *APath, gint64 *FSSize, gint64 *FSFree, char **FSLabel) { @@ -543,6 +567,7 @@ VFSGetFileSystemInfo (struct TVFSGlobs *globs, const char *APath, gint64 *FSSize return res; } + /**************************************************************************************************************************************/ /**************************************************************************************************************************************/ diff --git a/libarchive/libarchive.c b/libarchive/libarchive.c index 4337bb1..6c6c59c 100644 --- a/libarchive/libarchive.c +++ b/libarchive/libarchive.c @@ -166,6 +166,13 @@ VFSGetInfo() } +guint32 +VFSGetCapabilities () +{ + return VFS_CAP_CAN_CREATE_ARCHIVES | VFS_CAP_ARCHIVE_STREAMING; +} + + char * VFSGetArchiveExts () { diff --git a/unrar/unrar.c b/unrar/unrar.c index ad02765..1d5a595 100644 --- a/unrar/unrar.c +++ b/unrar/unrar.c @@ -131,6 +131,7 @@ VFSNew (TVFSLogFunc log_func) return globs; } + void VFSSetCallbacks (struct TVFSGlobs *globs, TVFSAskQuestionCallback ask_question_callback, @@ -144,6 +145,7 @@ VFSSetCallbacks (struct TVFSGlobs *globs, globs->callback_data = data; } + void VFSFree (struct TVFSGlobs *globs) { @@ -152,12 +154,14 @@ VFSFree (struct TVFSGlobs *globs) g_free (globs); } + int VFSVersion () { return cVFSVersion; } + struct TVFSInfo * VFSGetInfo () { @@ -174,6 +178,14 @@ VFSGetInfo () return module_info; } + +guint32 +VFSGetCapabilities () +{ + return VFS_CAP_ARCHIVE_STREAMING; +} + + char * VFSGetArchiveExts () { diff --git a/zip/zip.cpp b/zip/zip.cpp index 035b4b2..8e2e1e7 100644 --- a/zip/zip.cpp +++ b/zip/zip.cpp @@ -274,6 +274,7 @@ VFSNew (TVFSLogFunc log_func) return globs; } + void VFSSetCallbacks (struct TVFSGlobs *globs, TVFSAskQuestionCallback ask_question_callback, @@ -287,6 +288,7 @@ VFSSetCallbacks (struct TVFSGlobs *globs, globs->callback_data = data; } + void VFSFree (struct TVFSGlobs *globs) { @@ -295,12 +297,14 @@ VFSFree (struct TVFSGlobs *globs) g_free (globs); } + int VFSVersion () { return cVFSVersion; } + struct TVFSInfo * VFSGetInfo () { @@ -316,6 +320,14 @@ VFSGetInfo () return module_info; } + +guint32 +VFSGetCapabilities () +{ + return VFS_CAP_CAN_CREATE_ARCHIVES; +} + + char * VFSGetArchiveExts () { |
