| 2598 | } |
| 2599 | |
| 2600 | static void |
| 2601 | queue_move_item (GtkListBox *lb, GtkListBoxRow *row, |
| 2602 | gint32 dst_index) |
| 2603 | { |
| 2604 | gint32 src_index; |
| 2605 | GhbValue * queue_dict; |
| 2606 | signal_user_data_t *ud = ghb_ud(); |
| 2607 | |
| 2608 | src_index = gtk_list_box_row_get_index(row); |
| 2609 | |
| 2610 | if (src_index < dst_index) |
| 2611 | { |
| 2612 | // The source row is removed before re-inserting it elsewhere |
| 2613 | // in the list. If the source is before the dest, the dest position |
| 2614 | // moves |
| 2615 | dst_index -= 1; |
| 2616 | } |
| 2617 | g_object_ref(G_OBJECT(row)); |
| 2618 | gtk_list_box_remove(lb, GTK_WIDGET(row)); |
| 2619 | gtk_list_box_insert(lb, GTK_WIDGET(row), dst_index); |
| 2620 | g_object_unref(G_OBJECT(row)); |
| 2621 | |
| 2622 | queue_dict = ghb_array_get(ud->queue, src_index); |
| 2623 | ghb_value_incref(queue_dict); |
| 2624 | ghb_array_remove(ud->queue, src_index); |
| 2625 | if (dst_index < 0) |
| 2626 | ghb_array_append(ud->queue, queue_dict); |
| 2627 | else |
| 2628 | ghb_array_insert(ud->queue, dst_index, queue_dict); |
| 2629 | |
| 2630 | // Force refresh of current selection |
| 2631 | gtk_list_box_unselect_row(lb, GTK_LIST_BOX_ROW(row)); |
| 2632 | gtk_list_box_select_row(lb, GTK_LIST_BOX_ROW(row)); |
| 2633 | |
| 2634 | ghb_save_queue(ud->queue); |
| 2635 | } |
| 2636 | |
| 2637 | G_MODULE_EXPORT void |
| 2638 | queue_move_top_action_cb (GSimpleAction *action, GVariant *param, gpointer data) |
no test coverage detected