summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-02-01 20:02:30 +0100
committerGravatar waker <wakeroid@gmail.com>2011-02-01 20:02:30 +0100
commit3beb907821ef4788e1daefa756185e7eec317230 (patch)
tree9804c29a962959249cf70a2e70d4932ad1a898df
parent2269a5ac9fb216494fb3477b67a9240beebad779 (diff)
added vfs container support to gtk addfile/folder dialogs
-rw-r--r--deadbeef.h2
-rw-r--r--playlist.c3
-rw-r--r--plugins/gtkui/callbacks.c12
-rw-r--r--plugins/vfs_zip/vfs_zip.c8
4 files changed, 12 insertions, 13 deletions
diff --git a/deadbeef.h b/deadbeef.h
index 3ccb5283..49a37931 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -824,8 +824,6 @@ typedef struct DB_vfs_s {
// capabilities
const char **(*get_schemes) (void); // NULL-terminated list of supported schemes, e.g. {"http://", "ftp://", NULL}; can be NULL
- const char **(*get_container_extensions) (void); // NULL-terminated list of supported container files, e.g. { "zip", NULL }; can be NULL
-
int (*is_streaming) (void); // return 1 if the plugin streaming data over slow connection, e.g. http; plugins will avoid scanning entire files if this is the case
int (*is_container) (const char *fname); // should return 1 if this plugin can parse specified file
diff --git a/playlist.c b/playlist.c
index b5077e5e..051c427c 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1432,16 +1432,13 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
const char **exts = decoders[i]->exts;
for (int e = 0; exts[e]; e++) {
if (!strcasecmp (exts[e], eol)) {
- printf ("ext found: %s, trying to insert...\n", exts[e]);
playItem_t *inserted = (playItem_t *)decoders[i]->insert (DB_PLAYITEM (after), fname);
if (inserted != NULL) {
- printf ("success\n");
if (cb && cb (inserted, user_data) < 0) {
*pabort = 1;
}
return inserted;
}
- printf ("fail\n");
}
}
}
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index b6360652..9c95c29d 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -99,6 +99,18 @@ file_filter_func (const GtkFileFilterInfo *filter_info, gpointer data) {
if (!strcasecmp (p, "m3u")) {
return TRUE;
}
+
+ // test container (vfs) formats
+ DB_vfs_t **vfsplugs = deadbeef->plug_get_vfs_list ();
+ for (int i = 0; vfsplugs[i]; i++) {
+ if (vfsplugs[i]->is_container) {
+ if (vfsplugs[i]->is_container (filter_info->filename)) {
+ return TRUE;
+ }
+ }
+ }
+
+
return FALSE;
}
diff --git a/plugins/vfs_zip/vfs_zip.c b/plugins/vfs_zip/vfs_zip.c
index 1a8e9c48..b1ed2f37 100644
--- a/plugins/vfs_zip/vfs_zip.c
+++ b/plugins/vfs_zip/vfs_zip.c
@@ -41,7 +41,6 @@ typedef struct {
} zip_file_t;
static const char *scheme_names[] = { "zip://", NULL };
-static const char *exts[] = { "zip", NULL };
const char **
vfs_zip_get_schemes (void) {
@@ -53,12 +52,6 @@ vfs_zip_is_streaming (void) {
return 0;
}
-const char **
-vfs_zip_get_container_extensions (void) {
- return exts;
-}
-
-
// fname must have form of zip://full_filepath.zip:full_filepath_in_zip
DB_FILE*
vfs_zip_open (const char *fname) {
@@ -236,7 +229,6 @@ static DB_vfs_t plugin = {
.getlength = vfs_zip_getlength,
.get_schemes = vfs_zip_get_schemes,
.is_streaming = vfs_zip_is_streaming,
- .get_container_extensions = vfs_zip_get_container_extensions,
.is_container = vfs_zip_is_container,
.scandir = vfs_zip_scandir,
};