ocarina/ocarina/notify.cpp

53 lines
1.1 KiB
C++

// Copyright (c) 2012 Bryan Schumaker.
#include <idle.h>
#include "ocarina.h"
static void idle_add()
{
if (libsaria::idle::size() == 1) {
println("Adding idle callback");
g_idle_add(ocarina_idle, NULL);
}
}
void on_notify(notify_t event, void *data)
{
/* TODO: Array of function pointers */
switch (event) {
case IDLE_ADD:
idle_add();
break;
case TRACK_CHANGED:
update_labels((libsaria::Track *)data);
break;
case PATH_ADDED:
case PATH_DELETED:
case PATH_UPDATED:
notify_library(event, (libsaria::library::Path *)data);
break;
case PLAYING:
case PAUSED:
update_buttons(event);
break;
case PAUSE_TYPE:
update_autopause_type((AutoPauseType *)data);
break;
case PAUSE_COUNT:
update_autopause_count((unsigned int *)data);
break;
case PLAYLIST_NEW:
case PLAYLIST_DELETE:
case PLAYLIST_RENUMBER:
case PLAYLIST_CHANGED:
update_tabs(event, (libsaria::Playlist *)data);
break;
case PLAYLIST_ADD:
case PLAYLIST_RM:
case PLAYLIST_UPDATE:
case PLAYLIST_GOTO:
update_playlist(event, (libsaria::PlaylistNotification *)data);
default:
break;
}
}