summaryrefslogtreecommitdiff
path: root/plugins/gtkui
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-06 15:52:29 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-06 15:52:29 +0100
commit8add58a26f17c9cbe5aed8367e20e71b158fa5b5 (patch)
treebf1ea5536c9b4d12f2a5c39ea7b7192048bc3026 /plugins/gtkui
parentb99d6d7481dba9eab56c42ea42b4d31070b8be29 (diff)
fixed open file(s) redraw and playback issues
Diffstat (limited to 'plugins/gtkui')
-rw-r--r--plugins/gtkui/fileman.c1
-rw-r--r--plugins/gtkui/gtkplaylist.c18
-rw-r--r--plugins/gtkui/gtkplaylist.h3
3 files changed, 22 insertions, 0 deletions
diff --git a/plugins/gtkui/fileman.c b/plugins/gtkui/fileman.c
index 8b08f466..d181fa1f 100644
--- a/plugins/gtkui/fileman.c
+++ b/plugins/gtkui/fileman.c
@@ -30,6 +30,7 @@ static void
open_files_worker (void *data) {
GSList *lst = (GSList *)data;
gtkpl_add_files (&main_playlist, lst);
+ gtkpl_set_cursor (PL_MAIN, 0);
deadbeef->sendmessage (M_PLAYSONG, 0, 0, 0);
}
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index ff91e809..12f7496c 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -1918,3 +1918,21 @@ gtk_pl_redraw_item_everywhere (DB_playItem_t *it) {
gtkpl_redraw_pl_row (pl, idx, it);
}
}
+
+void
+gtkpl_set_cursor (int iter, int cursor) {
+ gtkplaylist_t *pl = &main_playlist;
+ int minvis = pl->scrollpos;
+ int maxvis = pl->scrollpos + pl->nvisiblerows-1;
+ int prev = deadbeef->pl_get_cursor (PL_MAIN);
+ deadbeef->pl_set_cursor (PL_MAIN, 0);
+ DB_playItem_t *it;
+ if (prev >= minvis && prev <= maxvis) {
+ it = deadbeef->pl_get_for_idx_and_iter (prev, PL_MAIN);
+ gtkpl_redraw_pl_row (pl, prev, it);
+ }
+ if (0 >= minvis && 0 <= maxvis) {
+ it = deadbeef->pl_get_for_idx_and_iter (0, PL_MAIN);
+ gtkpl_redraw_pl_row (pl, 0, it);
+ }
+}
diff --git a/plugins/gtkui/gtkplaylist.h b/plugins/gtkui/gtkplaylist.h
index da5f41b7..5d149c51 100644
--- a/plugins/gtkui/gtkplaylist.h
+++ b/plugins/gtkui/gtkplaylist.h
@@ -250,4 +250,7 @@ gtkpl_current_track_changed (DB_playItem_t *it);
void
gtk_pl_redraw_item_everywhere (DB_playItem_t *it);
+void
+gtkpl_set_cursor (int iter, int cursor);
+
#endif // __GTKPLAYLIST_H