summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-14 11:20:31 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-14 11:20:31 +0200
commit1799c4c34174ea36a60ba957f4399e70b1d79425 (patch)
treef2f96de15560049700360b4e81a1873ff576fedb /plugins
parent94b5dfbdb2663c3cf6cdc263be7c0ee17a8b7296 (diff)
gtkui: fixed playlist state on resume
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/widgets.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c
index 51953922..8146c43f 100644
--- a/plugins/gtkui/widgets.c
+++ b/plugins/gtkui/widgets.c
@@ -1461,7 +1461,7 @@ refresh_cb (gpointer data) {
}
static gboolean
-tabbed_playlistswitch_cb (gpointer p) {
+playlistswitch_cb (gpointer p) {
w_playlist_t *tp = (w_playlist_t *)p;
int curr = deadbeef->plt_get_curr_idx ();
char conf[100];
@@ -1469,8 +1469,10 @@ tabbed_playlistswitch_cb (gpointer p) {
int scroll = deadbeef->conf_get_int (conf, 0);
snprintf (conf, sizeof (conf), "playlist.cursor.%d", curr);
int cursor = deadbeef->conf_get_int (conf, -1);
- ddb_tabstrip_refresh (((w_tabbed_playlist_t *)tp)->tabstrip);
deadbeef->pl_set_cursor (PL_MAIN, cursor);
+ if (!strcmp (tp->base.type, "tabbed_playlist")) {
+ ddb_tabstrip_refresh (((w_tabbed_playlist_t *)tp)->tabstrip);
+ }
if (cursor != -1) {
DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (cursor, PL_MAIN);
if (it) {
@@ -1484,29 +1486,6 @@ tabbed_playlistswitch_cb (gpointer p) {
return FALSE;
}
-static gboolean
-playlistswitch_cb (gpointer data) {
- w_playlist_t *p = (w_playlist_t *)data;
- int curr = deadbeef->plt_get_curr_idx ();
- char conf[100];
- snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr);
- int scroll = deadbeef->conf_get_int (conf, 0);
- snprintf (conf, sizeof (conf), "playlist.cursor.%d", curr);
- int cursor = deadbeef->conf_get_int (conf, -1);
- deadbeef->pl_set_cursor (PL_MAIN, cursor);
- if (cursor != -1) {
- DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (cursor, PL_MAIN);
- if (it) {
- deadbeef->pl_set_selected (it, 1);
- deadbeef->pl_item_unref (it);
- }
- }
-
- ddb_listview_refresh (DDB_LISTVIEW (p->list), DDB_LIST_CHANGED | DDB_REFRESH_LIST | DDB_REFRESH_VSCROLL);
- ddb_listview_set_vscroll (DDB_LISTVIEW (p->list), scroll);
- return FALSE;
-}
-
struct fromto_t {
ddb_gtkui_widget_t *w;
DB_playItem_t *from;
@@ -1676,7 +1655,7 @@ w_tabbed_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, ui
g_idle_add (tabbed_refresh_cb, w);
break;
case DB_EV_PLAYLISTSWITCHED:
- g_idle_add (tabbed_playlistswitch_cb, w);
+ g_idle_add (playlistswitch_cb, w);
break;
case DB_EV_TRACKFOCUSCURRENT:
g_idle_add (tabbed_trackfocus_cb, w);
@@ -1770,6 +1749,8 @@ static void
w_playlist_init (ddb_gtkui_widget_t *base) {
w_playlist_t *w = (w_playlist_t *)base;
ddb_listview_show_header (w->list, !w->hideheaders);
+
+ g_idle_add (playlistswitch_cb, w);
}
static void