X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/1e0a962a8e2d4fac717f2fe73056b28752af0a6b..ad131c2579b5e9fda58e5d76bdb20d5949a711ee:/disobedience/playlists.c diff --git a/disobedience/playlists.c b/disobedience/playlists.c index c4e8e04..50e099f 100644 --- a/disobedience/playlists.c +++ b/disobedience/playlists.c @@ -129,6 +129,8 @@ static gboolean playlist_picker_button(GtkWidget *widget, static gboolean playlist_editor_keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data); +static void playlist_editor_ok(GtkButton *button, gpointer userdata); +static void playlist_editor_help(GtkButton *button, gpointer userdata); /** @brief Playlist editing window */ static GtkWidget *playlist_window; @@ -149,12 +151,12 @@ static const struct queue_column playlist_columns[] = { * - select/deselect all work */ static struct menuitem playlist_menuitems[] = { - { "Track properties", ql_properties_activate, ql_properties_sensitive, 0, 0 }, - { "Play track", ql_play_activate, ql_play_sensitive, 0, 0 }, - { "Play playlist", playlist_playall_activate, playlist_playall_sensitive, 0, 0 }, - { "Remove track from playlist", playlist_remove_activate, playlist_remove_sensitive, 0, 0 }, - { "Select all tracks", ql_selectall_activate, ql_selectall_sensitive, 0, 0 }, - { "Deselect all tracks", ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 }, + { "Track properties", GTK_STOCK_PROPERTIES, ql_properties_activate, ql_properties_sensitive, 0, 0 }, + { "Play track", GTK_STOCK_MEDIA_PLAY, ql_play_activate, ql_play_sensitive, 0, 0 }, + { "Play playlist", NULL, playlist_playall_activate, playlist_playall_sensitive, 0, 0 }, + { "Remove track from playlist", GTK_STOCK_DELETE, playlist_remove_activate, playlist_remove_sensitive, 0, 0 }, + { "Select all tracks", GTK_STOCK_SELECT_ALL, ql_selectall_activate, ql_selectall_sensitive, 0, 0 }, + { "Deselect all tracks", NULL, ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 }, }; static const GtkTargetEntry playlist_targets[] = { @@ -251,7 +253,8 @@ static int playlistcmp(const void *ap, const void *bp) { /* Playlists menu ----------------------------------------------------------- */ static void playlist_menu_playing(void attribute((unused)) *v, - const char *err) { + const char *err, + const char attribute((unused)) *id) { if(err) popup_submsg(playlist_window, GTK_MESSAGE_ERROR, err); } @@ -268,7 +271,7 @@ static void playlist_menu_received_content(void attribute((unused)) *v, return; } for(int n = 0; n < nvec; ++n) - disorder_eclient_play(client, vec[n], playlist_menu_playing, NULL); + disorder_eclient_play(client, playlist_menu_playing, vec[n], NULL); } /** @brief Called to activate a playlist @@ -599,7 +602,7 @@ static void playlist_new_details(char **namep, if(privatep) *privatep = private; if(namep) *namep = name; if(fullnamep) { - if(*sharedp) *fullnamep = *namep; + if(shared) *fullnamep = name; else byte_xasprintf(fullnamep, "%s.%s", config->username, name); } } @@ -878,13 +881,15 @@ static struct button playlist_picker_buttons[] = { GTK_STOCK_ADD, playlist_picker_add, "Create a new playlist", - 0 + 0, + NULL, }, { GTK_STOCK_REMOVE, playlist_picker_delete, "Delete a playlist", - 0 + 0, + NULL, }, }; #define NPLAYLIST_PICKER_BUTTONS (sizeof playlist_picker_buttons / sizeof *playlist_picker_buttons) @@ -991,6 +996,7 @@ static int playlist_picker_remove_sensitive(void *extra) { static struct menuitem playlist_picker_menuitems[] = { { "Select playlist", + NULL, playlist_picker_select_activate, playlist_picker_select_sensitive, 0, @@ -998,6 +1004,7 @@ static struct menuitem playlist_picker_menuitems[] = { }, { "Play playlist", + GTK_STOCK_MEDIA_PLAY, playlist_picker_play_activate, playlist_picker_play_sensitive, 0, @@ -1005,6 +1012,7 @@ static struct menuitem playlist_picker_menuitems[] = { }, { "Remove playlist", + GTK_STOCK_DELETE, playlist_picker_remove_activate, playlist_picker_remove_sensitive, 0, @@ -1048,6 +1056,26 @@ static GtkWidget *playlist_editor_public; static GtkWidget *playlist_editor_private; static int playlist_editor_setting_buttons; +/** @brief Buttons for the playlist window */ +static struct button playlist_editor_buttons[] = { + { + GTK_STOCK_OK, + playlist_editor_ok, + "Close window", + 0, + gtk_box_pack_end, + }, + { + GTK_STOCK_HELP, + playlist_editor_help, + "Go to manual", + 0, + gtk_box_pack_end, + }, +}; + +#define NPLAYLIST_EDITOR_BUTTONS (int)(sizeof playlist_editor_buttons / sizeof *playlist_editor_buttons) + static GtkWidget *playlists_editor_create(void) { assert(ql_playlist.view == NULL); /* better not be set up already */ @@ -1072,6 +1100,9 @@ static GtkWidget *playlists_editor_create(void) { gtk_box_pack_start(GTK_BOX(hbox), playlist_editor_private, FALSE/*expand*/, FALSE/*fill*/, 0); playlist_editor_set_buttons(0,0,0); + create_buttons_box(playlist_editor_buttons, + NPLAYLIST_EDITOR_BUTTONS, + hbox); GtkWidget *vbox = gtk_vbox_new(FALSE, 0); GtkWidget *view = init_queuelike(&ql_playlist); @@ -1222,6 +1253,16 @@ static void playlists_editor_received_tracks(void *v, ql_new_queue(&ql_playlist, newq); } +static void playlist_editor_ok(GtkButton attribute((unused)) *button, + gpointer attribute((unused)) userdata) { + gtk_widget_destroy(playlist_window); +} + +static void playlist_editor_help(GtkButton attribute((unused)) *button, + gpointer attribute((unused)) userdata) { + popup_help("playlists.html"); +} + /* Playlist mutation -------------------------------------------------------- */ /** @brief State structure for guarded playlist modification