summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-05 22:47:47 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-05 22:47:47 +0200
commit56a3f6c5eb7e31825ad731f19e8c8d431dbc640f (patch)
treeab322a2e200f35acb8b0792e07a92587e6aa15b2
parent5efe52afdea1fd6ffb2fd763023e3bca84c29a54 (diff)
added option to ignore archive files when adding folders
-rw-r--r--playlist.c33
-rw-r--r--plugins/gtkui/callbacks.c8
-rw-r--r--plugins/gtkui/callbacks.h8
-rw-r--r--plugins/gtkui/deadbeef.glade24
-rw-r--r--plugins/gtkui/interface.c11
-rw-r--r--plugins/gtkui/prefwin.c11
6 files changed, 78 insertions, 17 deletions
diff --git a/playlist.c b/playlist.c
index d1ced41c..f2086cf4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1357,6 +1357,9 @@ pl_insert_pls (playItem_t *after, const char *fname, int *pabort, int (*cb)(play
return after;
}
+static int follow_symlinks = 0;
+static int ignore_archives = 0;
+
playItem_t *
pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data);
@@ -1369,20 +1372,22 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
}
// check if that is supported container format
- DB_vfs_t **vfsplugs = plug_get_vfs_list ();
- for (int i = 0; vfsplugs[i]; i++) {
- if (vfsplugs[i]->is_container) {
- trace ("%s cont test\n", fname);
- if (vfsplugs[i]->is_container (fname)) {
- playItem_t *it = pl_insert_dir_int (vfsplugs[i], after, fname, pabort, cb, user_data);
- if (it) {
- return it;
+ if (!ignore_archives) {
+ DB_vfs_t **vfsplugs = plug_get_vfs_list ();
+ for (int i = 0; vfsplugs[i]; i++) {
+ if (vfsplugs[i]->is_container) {
+ trace ("%s cont test\n", fname);
+ if (vfsplugs[i]->is_container (fname)) {
+ trace ("inserting %s via vfs %s\n", fname, vfsplugs[i]->plugin.id);
+ playItem_t *it = pl_insert_dir_int (vfsplugs[i], after, fname, pabort, cb, user_data);
+ if (it) {
+ return it;
+ }
}
}
}
}
-
// detect decoder
const char *eol = strrchr (fname, '.');
if (!eol) {
@@ -1515,8 +1520,6 @@ static int dirent_alphasort (const struct dirent **a, const struct dirent **b) {
return strcmp ((*a)->d_name, (*b)->d_name);
}
-static int follow_symlinks = 0;
-
playItem_t *
pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) {
if (!strncmp (dirname, "file://", 7)) {
@@ -1581,7 +1584,13 @@ pl_insert_dir_int (DB_vfs_t *vfs, playItem_t *after, const char *dirname, int *p
playItem_t *
pl_insert_dir (playItem_t *after, const char *dirname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) {
follow_symlinks = conf_get_int ("add_folders_follow_symlinks", 0);
- return pl_insert_dir_int (NULL, after, dirname, pabort, cb, user_data);
+ ignore_archives = conf_get_int ("ignore_archives", 1);
+
+ playItem_t *ret = pl_insert_dir_int (NULL, after, dirname, pabort, cb, user_data);
+
+ ignore_archives = 0;
+
+ return ret;
}
int
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 71cf1bca..3c775f16 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -217,13 +217,18 @@ on_add_folders_activate (GtkMenuItem *menuitem,
{
GtkWidget *dlg = gtk_file_chooser_dialog_new (_("Add folder(s) to playlist..."), GTK_WINDOW (mainwin), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
+ GtkWidget *box = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (box);
+
GtkWidget *check = gtk_check_button_new_with_mnemonic (_("Follow symlinks"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), deadbeef->conf_get_int ("add_folders_follow_symlinks", 0));
g_signal_connect ((gpointer) check, "toggled",
G_CALLBACK (on_follow_symlinks_toggled),
NULL);
gtk_widget_show (check);
- gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dlg), check);
+ gtk_box_pack_start (GTK_BOX (box), check, FALSE, FALSE, 0);
+
+ gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dlg), box);
set_file_filter (dlg, NULL);
@@ -1178,4 +1183,3 @@ create_plugin_weblink (gchar *widget_name, gchar *string1, gchar *string2,
gtk_widget_set_sensitive (link, FALSE);
return link;
}
-
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h
index be6c50a7..4f15d342 100644
--- a/plugins/gtkui/callbacks.h
+++ b/plugins/gtkui/callbacks.h
@@ -1119,3 +1119,11 @@ on_seekbar_fps_value_changed (GtkRange *range,
void
on_gui_fps_value_changed (GtkRange *range,
gpointer user_data);
+
+void
+on_add_from_archives_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data);
+
+void
+on_ignore_archives_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data);
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index 54383415..c943a006 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -2823,6 +2823,26 @@ Album</property>
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="ignore_archives">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Don't add from archives when adding folders</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_ignore_archives_toggled" last_modification_time="Tue, 05 Apr 2011 20:41:18 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="tab_expand">False</property>
@@ -3309,8 +3329,8 @@ Album</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index d9c182e0..af8f1f28 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -1665,6 +1665,7 @@ create_prefwin (void)
GtkWidget *cli_add_to_playlist;
GtkWidget *cli_playlist_name;
GtkWidget *resume_last_session;
+ GtkWidget *ignore_archives;
GtkWidget *label39;
GtkWidget *vbox29;
GtkWidget *hbox80;
@@ -1897,6 +1898,10 @@ create_prefwin (void)
gtk_widget_show (resume_last_session);
gtk_box_pack_start (GTK_BOX (vbox8), resume_last_session, FALSE, FALSE, 0);
+ ignore_archives = gtk_check_button_new_with_mnemonic (_("Don't add from archives when adding folders"));
+ gtk_widget_show (ignore_archives);
+ gtk_box_pack_start (GTK_BOX (vbox8), ignore_archives, FALSE, FALSE, 0);
+
label39 = gtk_label_new (_("Playback"));
gtk_widget_show (label39);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label39);
@@ -2004,7 +2009,7 @@ create_prefwin (void)
hbox102 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox102);
- gtk_box_pack_start (GTK_BOX (vbox9), hbox102, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox9), hbox102, FALSE, FALSE, 0);
label129 = gtk_label_new (_("Interface refresh rate (times per second):"));
gtk_widget_show (label129);
@@ -2508,6 +2513,9 @@ create_prefwin (void)
g_signal_connect ((gpointer) resume_last_session, "toggled",
G_CALLBACK (on_resume_last_session_toggled),
NULL);
+ g_signal_connect ((gpointer) ignore_archives, "toggled",
+ G_CALLBACK (on_ignore_archives_toggled),
+ NULL);
g_signal_connect ((gpointer) dsp_add, "clicked",
G_CALLBACK (on_dsp_add_clicked),
NULL);
@@ -2664,6 +2672,7 @@ create_prefwin (void)
GLADE_HOOKUP_OBJECT (prefwin, cli_add_to_playlist, "cli_add_to_playlist");
GLADE_HOOKUP_OBJECT (prefwin, cli_playlist_name, "cli_playlist_name");
GLADE_HOOKUP_OBJECT (prefwin, resume_last_session, "resume_last_session");
+ GLADE_HOOKUP_OBJECT (prefwin, ignore_archives, "ignore_archives");
GLADE_HOOKUP_OBJECT (prefwin, label39, "label39");
GLADE_HOOKUP_OBJECT (prefwin, vbox29, "vbox29");
GLADE_HOOKUP_OBJECT (prefwin, hbox80, "hbox80");
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index faa7544d..9883fc96 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -521,9 +521,12 @@ on_preferences_activate (GtkMenuItem *menuitem,
// auto-rename playlist from folder name
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "auto_name_playlist_from_folder")), deadbeef->conf_get_int ("gtkui.name_playlist_from_folder", 0));
+ // refresh rate
int val = deadbeef->conf_get_int ("gtkui.refresh_rate", 10);
gtk_range_set_value (GTK_RANGE (lookup_widget (w, "gui_fps")), val);
+ // add from archives
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "ignore_archives")), deadbeef->conf_get_int ("ignore_archives", 1));
// titlebar text
gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_playing")), deadbeef->conf_get_str_fast ("gtkui.titlebar_playing", "%a - %t - DeaDBeeF-%V"));
gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "titlebar_format_stopped")), deadbeef->conf_get_str_fast ("gtkui.titlebar_stopped", "DeaDBeeF-%V"));
@@ -1325,3 +1328,11 @@ on_gui_fps_value_changed (GtkRange *range,
gtkui_setup_gui_refresh ();
}
+void
+on_ignore_archives_toggled (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+
+ deadbeef->conf_set_int ("ignore_archives", gtk_toggle_button_get_active (togglebutton));
+}
+