summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2013-08-11 22:42:00 +0200
committerGravatar waker <wakeroid@gmail.com>2013-08-11 22:42:00 +0200
commit83203d9c07810479a8be1c2d69ac90356de9458f (patch)
treeba43c6b114b24456b09cb7865bdbd8ae8ba1b02a
parent0e8455b9a41602485909e5178e3ab352514f8a3e (diff)
gtkui: handle selection changes in all playlist widgets
-rw-r--r--deadbeef.h2
-rw-r--r--plugins/gtkui/ddblistview.c28
-rw-r--r--plugins/gtkui/ddblistview.h2
-rw-r--r--plugins/gtkui/mainplaylist.c4
-rw-r--r--plugins/gtkui/search.c4
-rw-r--r--plugins/gtkui/widgets.c4
6 files changed, 22 insertions, 22 deletions
diff --git a/deadbeef.h b/deadbeef.h
index 06119a4c..e85b1dac 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -273,7 +273,7 @@ enum {
DB_EV_DSPCHAINCHANGED = 21, // emitted when any parameter of the main dsp chain has been changed
// new in 1.5
- DB_EV_SELCHANGED = 22, // selection changed in playlist p1 iter p2
+ DB_EV_SELCHANGED = 22, // selection changed in playlist p1 iter p2, ctx should be a pointer to playlist viewer instance, which caused the change, or NULL
DB_EV_PLUGINSLOADED = 23, // after all plugins have been loaded and connected
// -----------------
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index c1ec9bcd..25190423 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -1334,7 +1334,7 @@ ddb_listview_select_single (DdbListview *ps, int sel) {
deadbeef->pl_unlock ();
ddb_listview_refresh (ps, DDB_REFRESH_LIST);
- ps->binding->selection_changed (NULL, -1); // that means "selection changed a lot, redraw everything"
+ ps->binding->selection_changed (ps, NULL, -1); // that means "selection changed a lot, redraw everything"
ps->area_selection_start = sel;
ps->area_selection_end = sel;
}
@@ -1352,7 +1352,7 @@ ddb_listview_click_selection (DdbListview *ps, int ex, int ey, DdbListviewGroup
if (ps->binding->is_selected (it)) {
ps->binding->select (it, 0);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
DdbListviewIter next = ps->binding->next (it);
ps->binding->unref (it);
@@ -1372,7 +1372,7 @@ ddb_listview_click_selection (DdbListview *ps, int ex, int ey, DdbListviewGroup
if (!ps->binding->is_selected (it)) {
ps->binding->select (it, 1);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
cnt--;
}
@@ -1380,7 +1380,7 @@ ddb_listview_click_selection (DdbListview *ps, int ex, int ey, DdbListviewGroup
if (ps->binding->is_selected (it)) {
ps->binding->select (it, 0);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
DdbListviewIter next = ps->binding->next (it);
@@ -1491,7 +1491,7 @@ ddb_listview_list_mouse1_pressed (DdbListview *ps, int state, int ex, int ey, Gd
if (it) {
ps->binding->select (it, 1 - ps->binding->is_selected (it));
ddb_listview_draw_row (ps, sel, it);
- ps->binding->selection_changed (it, sel);
+ ps->binding->selection_changed (ps, it, sel);
UNREF (it);
}
}
@@ -1521,14 +1521,14 @@ ddb_listview_list_mouse1_pressed (DdbListview *ps, int state, int ex, int ey, Gd
if (!ps->binding->is_selected (it)) {
ps->binding->select (it, 1);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
else {
if (ps->binding->is_selected (it)) {
ps->binding->select (it, 0);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
DdbListviewIter next = PL_NEXT (it);
@@ -1568,7 +1568,7 @@ ddb_listview_list_mouse1_released (DdbListview *ps, int state, int ex, int ey, d
if (ps->binding->is_selected (it)) {
ps->binding->select (it, 0);
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
it = PL_NEXT (it);
}
idx++;
@@ -1760,7 +1760,7 @@ ddb_listview_list_mousemove (DdbListview *ps, GdkEventMotion *ev, int ex, int ey
nchanged++;
if (nchanged < NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
}
@@ -1769,7 +1769,7 @@ ddb_listview_list_mousemove (DdbListview *ps, GdkEventMotion *ev, int ex, int ey
nchanged++;
if (nchanged < NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
DdbListviewIter next = PL_NEXT(it);
@@ -1779,7 +1779,7 @@ ddb_listview_list_mousemove (DdbListview *ps, GdkEventMotion *ev, int ex, int ey
UNREF (it);
if (nchanged >= NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_refresh (ps, DDB_REFRESH_LIST);
- ps->binding->selection_changed (it, -1); // that means "selection changed a lot, redraw everything"
+ ps->binding->selection_changed (ps, it, -1); // that means "selection changed a lot, redraw everything"
}
ps->area_selection_start = start;
ps->area_selection_end = end;
@@ -1968,7 +1968,7 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) {
ps->binding->select (it, 1);
if (nchanged < NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
else if (ps->binding->is_selected (it))
@@ -1976,7 +1976,7 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) {
ps->binding->select (it, 0);
if (nchanged < NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_draw_row (ps, idx, it);
- ps->binding->selection_changed (it, idx);
+ ps->binding->selection_changed (ps, it, idx);
}
}
DdbListviewIter next = PL_NEXT(it);
@@ -1986,7 +1986,7 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) {
UNREF (it);
if (nchanged >= NUM_CHANGED_ROWS_BEFORE_FULL_REDRAW) {
ddb_listview_refresh (ps, DDB_REFRESH_LIST);
- ps->binding->selection_changed (it, -1); // that means "selection changed a lot, redraw everything"
+ ps->binding->selection_changed (ps, it, -1); // that means "selection changed a lot, redraw everything"
}
}
}
diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h
index f2ead8ce..a98ee969 100644
--- a/plugins/gtkui/ddblistview.h
+++ b/plugins/gtkui/ddblistview.h
@@ -79,7 +79,7 @@ typedef struct {
void (*list_context_menu) (DdbListview *listview, DdbListviewIter iter, int idx);
void (*header_context_menu) (DdbListview *listview, int col);
void (*handle_doubleclick) (DdbListview *listview, DdbListviewIter iter, int idx);
- void (*selection_changed) (DdbListviewIter it, int idx);
+ void (*selection_changed) (DdbListview *listview, DdbListviewIter it, int idx);
void (*delete_selected) (void);
void (*columns_changed) (DdbListview *listview);
void (*column_size_changed) (DdbListview *listview, int col);
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index f1b829da..3dfb8005 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -153,7 +153,7 @@ void main_handle_doubleclick (DdbListview *listview, DdbListviewIter iter, int i
deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, idx, 0);
}
-void main_selection_changed (DdbListviewIter it, int idx) {
+void main_selection_changed (DdbListview *ps, DdbListviewIter it, int idx) {
DdbListview *search = DDB_LISTVIEW (lookup_widget (searchwin, "searchlist"));
if (idx == -1) {
ddb_listview_refresh (search, DDB_REFRESH_LIST);
@@ -161,7 +161,7 @@ void main_selection_changed (DdbListviewIter it, int idx) {
else {
ddb_listview_draw_row (search, search_get_idx ((DB_playItem_t *)it), it);
}
- deadbeef->sendmessage (DB_EV_SELCHANGED, 0, deadbeef->plt_get_curr_idx (), PL_MAIN);
+ deadbeef->sendmessage (DB_EV_SELCHANGED, (uintptr_t)ps, deadbeef->plt_get_curr_idx (), PL_MAIN);
}
void main_draw_group_title (DdbListview *listview, cairo_t *drawable, DdbListviewIter it, int x, int y, int width, int height) {
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
index e5afd8f2..d79060ee 100644
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -341,8 +341,8 @@ void search_handle_doubleclick (DdbListview *listview, DdbListviewIter iter, int
deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, deadbeef->pl_get_idx_of ((DB_playItem_t *)iter), 0);
}
-void search_selection_changed (DdbListviewIter it, int idx) {
- deadbeef->sendmessage (DB_EV_SELCHANGED, 0, 0, 0);
+void search_selection_changed (DdbListview *ps, DdbListviewIter it, int idx) {
+ deadbeef->sendmessage (DB_EV_SELCHANGED, (uintptr_t)ps, -1, -1);
}
void
diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c
index 22ddab88..37e85b50 100644
--- a/plugins/gtkui/widgets.c
+++ b/plugins/gtkui/widgets.c
@@ -1642,7 +1642,7 @@ w_tabbed_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, ui
g_idle_add (tabbed_trackfocus_cb, w);
break;
case DB_EV_SELCHANGED:
- if (p2 == PL_SEARCH && p1 == deadbeef->plt_get_curr_idx ()) {
+ if (ctx != (uintptr_t)tp->list) {
g_idle_add (refresh_cb, tp->list);
}
break;
@@ -1695,7 +1695,7 @@ w_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t
g_idle_add (trackfocus_cb, w);
break;
case DB_EV_SELCHANGED:
- if (p2 == PL_SEARCH && p1 == deadbeef->plt_get_curr_idx ()) {
+ if (ctx != (uintptr_t)p->list) {
g_idle_add (refresh_cb, p->list);
}
break;