diff options
author | waker <wakeroid@gmail.com> | 2010-12-03 23:14:21 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-12-03 23:14:21 +0100 |
commit | 8dd596f4a57e5eba51a4b7d9e43ba4da8adb3a79 (patch) | |
tree | 1c6375bbed070bd0787041603c883e78bd0069de /plugins/gtkui | |
parent | e8e2944e4b492b194b3c0f7dcfd5026c386fc30f (diff) |
improved Sort By dialog
Diffstat (limited to 'plugins/gtkui')
-rw-r--r-- | plugins/gtkui/callbacks.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 652d223f..80f52542 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -1116,12 +1116,12 @@ on_date1_activate (GtkMenuItem *menuitem, } - void on_custom2_activate (GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *dlg = create_sortbydlg (); + gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK); GtkComboBox *combo = GTK_COMBO_BOX (lookup_widget (dlg, "sortorder")); GtkEntry *entry = GTK_ENTRY (lookup_widget (dlg, "sortfmt")); @@ -1131,18 +1131,32 @@ on_custom2_activate (GtkMenuItem *menuitem, int r = gtk_dialog_run (GTK_DIALOG (dlg)); - int order = gtk_combo_box_get_active (combo); - const char *fmt = gtk_entry_get_text (entry); + if (r == GTK_RESPONSE_OK) { + GtkComboBox *combo = GTK_COMBO_BOX (lookup_widget (dlg, "sortorder")); + GtkEntry *entry = GTK_ENTRY (lookup_widget (dlg, "sortfmt")); + int order = gtk_combo_box_get_active (combo); + const char *fmt = gtk_entry_get_text (entry); + + deadbeef->conf_set_int ("gtkui.sortby_order", order); + deadbeef->conf_set_str ("gtkui.sortby_fmt", fmt); - deadbeef->conf_set_int ("gtkui.sortby_order", order); - deadbeef->conf_set_str ("gtkui.sortby_fmt", fmt); + deadbeef->pl_sort (PL_MAIN, -1, fmt, order == 0 ? 1 : 0); - deadbeef->pl_sort (PL_MAIN, -1, fmt, order == 0 ? 1 : 0); + DdbListview *pl = DDB_LISTVIEW (lookup_widget (mainwin, "playlist")); + ddb_listview_clear_sort (pl); + ddb_listview_refresh (pl, DDB_REFRESH_LIST | DDB_EXPOSE_LIST); + } gtk_widget_destroy (dlg); + dlg = NULL; +} - DdbListview *pl = DDB_LISTVIEW (lookup_widget (mainwin, "playlist")); - ddb_listview_clear_sort (pl); - ddb_listview_refresh (pl, DDB_REFRESH_LIST | DDB_EXPOSE_LIST); + +void +on_sortfmt_activate (GtkEntry *entry, + gpointer user_data) +{ + GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (entry)); + gtk_dialog_response (GTK_DIALOG (toplevel), GTK_RESPONSE_OK); } |