summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/Makefile.am2
-rw-r--r--plugins/gtkui/actionhandlers.c6
-rw-r--r--plugins/gtkui/fileman.c36
-rw-r--r--plugins/gtkui/gtkui.c52
-rw-r--r--plugins/gtkui/gtkui.h8
5 files changed, 62 insertions, 42 deletions
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am
index bd8a75c7..5278a483 100644
--- a/plugins/gtkui/Makefile.am
+++ b/plugins/gtkui/Makefile.am
@@ -159,7 +159,7 @@ ddb_gui_GTK2_la_CFLAGS = -std=c99 -I$(GTK_ROOT_216)/include/gtk-2.0 -I$(GTK_ROOT
else
ddb_gui_GTK2_la_LIBADD = $(LDADD) $(GTK2_DEPS_LIBS) $(SM_LIBADD) ../libparser/libparser.a $(GTKGLEXT2_LIBS)
-ddb_gui_GTK2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) $(SM_CFLAGS) $(GTKGLEXT_CFLAGS_GTK2)
+ddb_gui_GTK2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) $(SM_CFLAGS) $(GTKGLEXT_CFLAGS_GTK2) -DDDB_WARN_DEPRECATED=1
endif
endif
diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c
index b60617bf..879f8f09 100644
--- a/plugins/gtkui/actionhandlers.c
+++ b/plugins/gtkui/actionhandlers.c
@@ -400,9 +400,9 @@ action_add_location_handler_cb (void *user_data) {
const char *text = gtk_entry_get_text (entry);
if (text) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- if (!deadbeef->pl_add_files_begin (plt)) {
- deadbeef->plt_add_file (plt, text, NULL, NULL);
- deadbeef->pl_add_files_end ();
+ if (!deadbeef->plt_add_files_begin (plt, 0)) {
+ deadbeef->plt_add_file2 (0, plt, text, NULL, NULL);
+ deadbeef->plt_add_files_end (plt, 0);
playlist_refresh ();
}
if (plt) {
diff --git a/plugins/gtkui/fileman.c b/plugins/gtkui/fileman.c
index 4ed4c827..a62765ac 100644
--- a/plugins/gtkui/fileman.c
+++ b/plugins/gtkui/fileman.c
@@ -8,18 +8,18 @@
#include "progress.h"
#include "support.h"
-void
-gtkpl_add_dir (DdbListview *ps, char *folder) {
- ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- gtkui_original_plt_add_dir (plt, folder, gtkui_add_file_info_cb, NULL);
- deadbeef->plt_unref (plt);
- g_free (folder);
-}
+//void
+//gtkpl_add_dir (DdbListview *ps, char *folder) {
+// ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+// gtkui_original_plt_add_dir (plt, folder, gtkui_add_file_info_cb, NULL);
+// deadbeef->plt_unref (plt);
+// g_free (folder);
+//}
static void
gtkpl_adddir_cb (gpointer data, gpointer userdata) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- gtkui_original_plt_add_dir (plt, data, gtkui_add_file_info_cb, userdata);
+ deadbeef->plt_add_dir2 (0, plt, data, NULL, NULL);
deadbeef->plt_unref (plt);
g_free (data);
}
@@ -28,7 +28,7 @@ void
gtkpl_add_dirs (GSList *lst) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
int empty = 0 == deadbeef->plt_get_item_count (plt, PL_MAIN);
- if (deadbeef->pl_add_files_begin (plt) < 0) {
+ if (deadbeef->plt_add_files_begin (plt, 0) < 0) {
deadbeef->plt_unref (plt);
g_slist_free (lst);
return;
@@ -51,14 +51,14 @@ gtkpl_add_dirs (GSList *lst) {
deadbeef->pl_unlock ();
g_slist_foreach(lst, gtkpl_adddir_cb, NULL);
g_slist_free (lst);
- deadbeef->pl_add_files_end ();
+ deadbeef->plt_add_files_end (plt, 0);
deadbeef->plt_unref (plt);
}
static void
gtkpl_addfile_cb (gpointer data, gpointer userdata) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- gtkui_original_plt_add_file (plt, data, gtkui_add_file_info_cb, userdata);
+ deadbeef->plt_add_file2 (0, plt, data, NULL, 0);
deadbeef->plt_unref (plt);
g_free (data);
}
@@ -66,14 +66,14 @@ gtkpl_addfile_cb (gpointer data, gpointer userdata) {
void
gtkpl_add_files (GSList *lst) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- if (deadbeef->pl_add_files_begin (plt) < 0) {
+ if (deadbeef->plt_add_files_begin (plt, 0) < 0) {
g_slist_free (lst);
deadbeef->plt_unref (plt);
return;
}
g_slist_foreach(lst, gtkpl_addfile_cb, NULL);
g_slist_free (lst);
- deadbeef->pl_add_files_end ();
+ deadbeef->plt_add_files_end (plt, 0);
deadbeef->plt_save_config (plt);
deadbeef->plt_unref (plt);
deadbeef->conf_save ();
@@ -183,7 +183,7 @@ set_dnd_cursor_idle (gpointer data) {
void
gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
- if (deadbeef->pl_add_files_begin (plt) < 0) {
+ if (deadbeef->plt_add_files_begin (plt, 0) < 0) {
free (ptr);
deadbeef->plt_unref (plt);
return;
@@ -209,11 +209,11 @@ gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
//strncpy (fname, p, pe - p);
//fname[pe - p] = 0;
int abort = 0;
- DdbListviewIter inserted = deadbeef->plt_insert_dir (plt, after, fname, &abort, gtkui_add_file_info_cb, NULL);
+ DdbListviewIter inserted = deadbeef->plt_insert_dir2 (0, plt, after, fname, &abort, NULL, NULL);
if (!inserted && !abort) {
- inserted = deadbeef->plt_insert_file (plt, after, fname, &abort, gtkui_add_file_info_cb, NULL);
+ inserted = deadbeef->plt_insert_file2 (0, plt, after, fname, &abort, NULL, NULL);
if (!inserted && !abort) {
- inserted = gtkui_original_plt_load (plt, after, fname, &abort, gtkui_add_file_info_cb, NULL);
+ inserted = deadbeef->plt_load2 (0, plt, after, fname, &abort, NULL, NULL);
}
}
if (inserted) {
@@ -238,7 +238,7 @@ gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) {
}
free (ptr);
- deadbeef->pl_add_files_end ();
+ deadbeef->plt_add_files_end (plt, 0);
deadbeef->plt_save_config (plt);
deadbeef->plt_unref (plt);
g_idle_add (set_dnd_cursor_idle, first);
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 53f45f1f..65c85138 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -82,11 +82,15 @@ GtkWidget *traymenu;
GtkWidget *theme_treeview;
GtkWidget *theme_button;
+int fileadded_listener_id;
+int fileadd_beginend_listener_id;
// overriden API methods
+#if 0
int (*gtkui_original_plt_add_dir) (ddb_playlist_t *plt, const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
int (*gtkui_original_plt_add_file) (ddb_playlist_t *plt, const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
int (*gtkui_original_pl_add_files_begin) (ddb_playlist_t *plt);
void (*gtkui_original_pl_add_files_end) (void);
+#endif
// cached config variables
int gtkui_embolden_current_track;
@@ -912,6 +916,34 @@ gtkui_connect_cb (void *none) {
return FALSE;
}
+int
+gtkui_add_file_info_cb (ddb_fileadd_data_t *data, void *user_data) {
+ if (data->visibility == 0) {
+ if (progress_is_aborted ()) {
+ return -1;
+ }
+ deadbeef->pl_lock ();
+ const char *fname = deadbeef->pl_find_meta (data->track, ":URI");
+ g_idle_add (gtkui_set_progress_text_idle, (gpointer)strdup(fname)); // slowwwww
+ deadbeef->pl_unlock ();
+ }
+ return 0;
+}
+
+void
+gtkui_add_file_begin_cb (ddb_fileadd_data_t *data, void *user_data) {
+ if (data->visibility == 0) {
+ progress_show ();
+ }
+}
+
+void
+gtkui_add_file_end_cb (ddb_fileadd_data_t *data, void *user_data) {
+ if (data->visibility == 0) {
+ progress_hide ();
+ }
+}
+
void
gtkui_thread (void *ctx) {
#ifdef __linux__
@@ -1055,6 +1087,9 @@ gtkui_thread (void *ctx) {
deadbeef->pl_format_title (NULL, -1, str, sizeof (str), -1, fmt);
gtk_window_set_title (GTK_WINDOW (mainwin), str);
+ fileadded_listener_id = deadbeef->listen_file_added (gtkui_add_file_info_cb, NULL);
+ fileadd_beginend_listener_id = deadbeef->listen_file_add_beginend (gtkui_add_file_begin_cb, gtkui_add_file_end_cb, NULL);
+#if 0
// override default file adding APIs to show progress bar
gtkui_original_plt_add_dir = deadbeef->plt_add_dir;
deadbeef->plt_add_dir = gtkui_plt_add_dir;
@@ -1070,6 +1105,7 @@ gtkui_thread (void *ctx) {
gtkui_original_plt_load = deadbeef->plt_load;
deadbeef->plt_load = gtkui_plt_load;
+#endif
supereq_plugin = deadbeef->plug_get_for_id ("supereq");
@@ -1080,6 +1116,8 @@ gtkui_thread (void *ctx) {
gtkui_is_retina = is_retina (mainwin);
#endif
gtk_main ();
+ deadbeef->unlisten_file_added (fileadded_listener_id);
+ deadbeef->unlisten_file_add_beginend (fileadd_beginend_listener_id);
w_free ();
@@ -1117,18 +1155,7 @@ gtkui_set_progress_text_idle (gpointer data) {
return FALSE;
}
-int
-gtkui_add_file_info_cb (DB_playItem_t *it, void *data) {
- if (progress_is_aborted ()) {
- return -1;
- }
- deadbeef->pl_lock ();
- const char *fname = deadbeef->pl_find_meta (it, ":URI");
- g_idle_add (gtkui_set_progress_text_idle, (gpointer)strdup(fname)); // slowwwww
- deadbeef->pl_unlock ();
- return 0;
-}
-
+#if 0
DB_playItem_t * (*gtkui_original_plt_load) (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
int
@@ -1165,6 +1192,7 @@ gtkui_plt_load (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, in
return it;
}
+#endif
void
gtkui_playlist_set_curr (int playlist) {
diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h
index 2d768c40..34e639a4 100644
--- a/plugins/gtkui/gtkui.h
+++ b/plugins/gtkui/gtkui.h
@@ -132,12 +132,6 @@ gtkui_progress_hide_idle (gpointer data);
gboolean
gtkui_set_progress_text_idle (gpointer data);
-int
-gtkui_add_file_info_cb (DB_playItem_t *it, void *data);
-
-extern int (*gtkui_original_plt_add_dir) (ddb_playlist_t *plt, const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
-extern int (*gtkui_original_plt_add_file) (ddb_playlist_t *plt, const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
-
void
gtkui_playlist_set_curr (int playlist);
@@ -153,8 +147,6 @@ gtkui_trackinfochanged (DB_playItem_t *it);
gboolean
redraw_queued_tracks_cb (gpointer plt);
-extern DB_playItem_t * (*gtkui_original_plt_load) (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
-
void
mainwin_toggle_visible (void);