summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-09-22 21:04:56 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-09-22 21:33:55 +0200
commitc23897031cb443b64306ebf4b797b49cc1f6670d (patch)
tree2bfedc72200e9370deddfa5d01953562010767b8
parent989054770be6f99600aeeee5c4cdf783da27edbd (diff)
reset playlist column sort state on playlist switch
-rw-r--r--plugins/gtkui/ddblistview.c9
-rw-r--r--plugins/gtkui/ddblistview.h3
-rw-r--r--plugins/gtkui/ddbtabstrip.c22
-rw-r--r--plugins/gtkui/gtkui.c7
-rw-r--r--plugins/gtkui/gtkui.h3
5 files changed, 29 insertions, 15 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index 93176d18..5f849ed3 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -2885,3 +2885,12 @@ ddb_listview_show_header (DdbListview *listview, int show) {
show ? gtk_widget_show (listview->header) : gtk_widget_hide (listview->header);
}
+void
+ddb_listview_clear_sort (DdbListview *listview) {
+ DdbListviewColumn *c;
+ for (c = listview->columns; c; c = c->next) {
+ c->sort_order = 0;
+ }
+ ddb_listview_header_render (listview);
+ ddb_listview_header_expose (listview, 0, 0, listview->header->allocation.width, listview->header->allocation.height);
+}
diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h
index 30ffa86d..9ffaa5d5 100644
--- a/plugins/gtkui/ddblistview.h
+++ b/plugins/gtkui/ddblistview.h
@@ -247,6 +247,9 @@ ddb_listview_list_drag_end (GtkWidget *widget,
GdkDragContext *drag_context,
gpointer user_data);
+void
+ddb_listview_clear_sort (DdbListview *listview);
+
G_END_DECLS
#endif // __DDBLISTVIEW_H
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index d28efd58..36b80443 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -655,9 +655,7 @@ on_add_new_playlist1_activate (GtkMenuItem *menuitem,
{
int playlist = gtkui_add_new_playlist ();
if (playlist != -1) {
- deadbeef->plt_set_curr (playlist);
- deadbeef->conf_set_int ("playlist.current", playlist);
- gtk_widget_queue_draw (lookup_widget (mainwin, "tabstrip"));
+ gtkui_playlist_set_curr (playlist);
}
}
@@ -792,8 +790,7 @@ tabstrip_scroll_left (DdbTabStrip *ts) {
int tab = deadbeef->plt_get_curr ();
if (tab > 0) {
tab--;
- deadbeef->plt_set_curr (tab);
- deadbeef->conf_set_int ("playlist.current", tab);
+ gtkui_playlist_set_curr (tab);
}
tabstrip_scroll_to_tab (ts, tab);
}
@@ -826,8 +823,7 @@ tabstrip_scroll_right (DdbTabStrip *ts) {
int tab = deadbeef->plt_get_curr ();
if (tab < deadbeef->plt_get_count ()-1) {
tab++;
- deadbeef->plt_set_curr (tab);
- deadbeef->conf_set_int ("playlist.current", tab);
+ gtkui_playlist_set_curr (tab);
}
tabstrip_scroll_to_tab (ts, tab);
}
@@ -875,16 +871,14 @@ on_tabstrip_button_press_event (GtkWidget *widget,
}
}
if (tab_clicked != -1) {
- deadbeef->plt_set_curr (tab_clicked);
- deadbeef->conf_set_int ("playlist.current", tab_clicked);
+ gtkui_playlist_set_curr (tab_clicked);
}
else {
if (event->type == GDK_2BUTTON_PRESS) {
// new tab
int playlist = gtkui_add_new_playlist ();
if (playlist != -1) {
- deadbeef->plt_set_curr (playlist);
- deadbeef->conf_set_int ("playlist.current", playlist);
+ gtkui_playlist_set_curr (playlist);
}
return FALSE;
}
@@ -922,8 +916,7 @@ on_tabstrip_button_press_event (GtkWidget *widget,
// new tab
int playlist = gtkui_add_new_playlist ();
if (playlist != -1) {
- deadbeef->plt_set_curr (playlist);
- deadbeef->conf_set_int ("playlist.current", playlist);
+ gtkui_playlist_set_curr (playlist);
}
return FALSE;
}
@@ -1062,8 +1055,7 @@ on_tabstrip_drag_motion_event (GtkWidget *widget,
int tab = get_tab_under_cursor (DDB_TABSTRIP (widget), x);
int prev = deadbeef->plt_get_curr ();
if (tab != -1 && tab != prev) {
- deadbeef->plt_set_curr (tab);
- deadbeef->conf_set_int ("playlist.current", tab);
+ gtkui_playlist_set_curr (tab);
}
GtkWidget *pl = lookup_widget (mainwin, "playlist");
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index f740bacb..235bba0a 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -519,6 +519,7 @@ playlistswitch_cb (gpointer none) {
deadbeef->pl_item_unref (it);
}
}
+ ddb_listview_clear_sort (listview);
playlist_refresh ();
ddb_listview_set_vscroll (listview, scroll);
search_refresh ();
@@ -1075,6 +1076,12 @@ gtkui_focus_on_playing_track (void) {
}
}
+void
+gtkui_playlist_set_curr (int playlist) {
+ deadbeef->plt_set_curr (playlist);
+ deadbeef->conf_set_int ("playlist.current", playlist);
+}
+
static int
gtkui_start (void) {
// gtk must be running in separate thread
diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h
index c333b322..53db09af 100644
--- a/plugins/gtkui/gtkui.h
+++ b/plugins/gtkui/gtkui.h
@@ -157,4 +157,7 @@ extern int (*gtkui_original_pl_add_file) (const char *fname, int (*cb)(DB_playIt
void
gtkui_focus_on_playing_track (void);
+void
+gtkui_playlist_set_curr (int playlist);
+
#endif