#include "window.h"
#include "player.h"
#include "playlist.h"
+#include "settings.h"
XtAppContext ui_motif_get_app(void);
Display* ui_motif_get_display(void);
ui_menuitem(.label = "Exit");
}
ui_menu("Playback") {
- ui_menu_toggleitem(.label = "Repeat", .varname = "repeat");
- ui_menu_toggleitem(.label = "Repeat List", .varname = "repeatlist");
- ui_menu_toggleitem(.label = "Random Playback", .varname = "random");
- ui_menu_toggleitem(.label = "Autoplay Folder", .varname = "autoplay");
+ ui_menu_toggleitem(.label = "Repeat", .varname = "repeat", .onchange = ActionPlayRepeat);
+ ui_menu_toggleitem(.label = "Repeat List", .varname = "repeatlist", .onchange = ActionPlayRepeatList);
+ ui_menu_toggleitem(.label = "Random Playback", .varname = "random", .onchange = ActionPlayRandomCB);
+ ui_menu_toggleitem(.label = "Autoplay Folder", .varname = "autoplay", .onchange = ActionPlayRandomCB);
ui_menuseparator();
ui_menuitem(.label = "Previous");
ui_menuitem(.label = "Next");
void AppSetPlayerWindow(Window w) {
app_player_window = w;
}
+
+
+
+void ActionPlayRepeat(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->playlist.playback = event->intval ? PLAYBACK_REPEAT : PLAYBACK_STOP;
+ ui_set(win->_playbackRepeatList, 0);
+ ui_set(win->_playbackAutoPlay, 0);
+ ui_set(win->_playbackRandom, 0);
+
+ XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playAutoPlayButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playRandom, XmNset, 0, NULL); // TODO: remove
+}
+
+void ActionPlayRepeatList(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->playlist.playback = event->intval ? PLAYBACK_REPEAT_LIST : PLAYBACK_STOP;
+ ui_set(win->_playbackRepeat, 0);
+ ui_set(win->_playbackRandom, 0);
+ ui_set(win->_playbackAutoPlay, 0);
+
+ XtVaSetValues(win->playRepeatTrackButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playAutoPlayButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playRandom, XmNset, 0, NULL); // TODO: remove
+}
+
+void ActionPlayAutoPlayCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->playlist.playback = event->intval ? PLAYBACK_AUTOPLAY : PLAYBACK_STOP;
+ ui_set(win->_playbackRepeat, 0);
+ ui_set(win->_playbackRepeatList, 0);
+ ui_set(win->_playbackRandom, 0);
+
+ XtVaSetValues(win->playRepeatTrackButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playRandom, XmNset, 0, NULL); // TODO: remove
+}
+
+void ActionPlayRandomCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->playlist.playback = event->intval ? PLAYBACK_RANDOM : PLAYBACK_STOP;
+ ui_set(win->_playbackRepeat, 0);
+ ui_set(win->_playbackRepeatList, 0);
+ ui_set(win->_playbackAutoPlay, 0);
+
+ XtVaSetValues(win->playRepeatTrackButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playRepeatListButton, XmNset, 0, NULL); // TODO: remove
+ XtVaSetValues(win->playAutoPlayButton, XmNset, 0, NULL); // TODO: remove
+}
+
+void ActionPlayPreviousCB(UiEvent *event, void *userdata) {
+ MainWindow *win = event->window;
+ PlayListPlayPrev(win);
+}
+
+void ActionPlayNextCB(UiEvent *event, void *userdata) {
+ MainWindow *win = event->window;
+ PlayListPlayNext(win, true);
+}
+
+void ActionViewFullscreenCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ if(win->fullscreen) {
+ WindowFullscreen(win, FALSE);
+ } else {
+ WindowFullscreen(win, TRUE);
+ }
+}
+
+void ActionViewSidebarCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->sidebarvisible = event->intval;
+ WindowShowSidebar(win, event->intval);
+}
+
+void ActionViewAdjustWindowSizeCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+ win->adjustWindowSize = event->intval;
+}
+
+void ActionPrefSingleInstanceCB(UiEvent *event, void *userdata) {
+ if(event->set) {
+ return;
+ }
+ MainWindow *win = event->window;
+
+ win->singleInstance = event->intval;
+
+ Display *dp = ui_motif_get_display();
+
+ if(!win->singleInstance) {
+ ShutdownInstanceSocket(dp);
+ return;
+ }
+
+ Bool disable_item = False;
+ if(CreateSingleInstanceSocket(dp, &disable_item)) {
+ // TODO: err
+ disable_item = True;
+ }
+ if(disable_item) {
+ win->singleInstance = 0;
+ //XmToggleButtonGadgetSetState(w, False, False);
+ ui_set(win->_singleInstance, 0);
+ }
+}