Example #1
0
static void keybind_prev_handler (const char *keystring, gpointer data)
{
	struct con_win *cwin = data;

	if (pragha_backend_emitted_error (cwin->backend) == FALSE)
		pragha_playback_prev_track(cwin);
}
Example #2
0
static void on_media_player_key_pressed(con_gnome_media_keys *gmk,
                                        const gchar *key)
{
	PraghaBackend *backend;
	PraghaPreferences *preferences;

    PraghaApplication *pragha = gmk->pragha;

	backend = pragha_application_get_backend (pragha);
	preferences = pragha_application_get_preferences (pragha);

    if (pragha_backend_emitted_error (backend))
        return;

    if (g_strcmp0("Play", key) == 0)
        pragha_playback_play_pause_resume(pragha);
    else if (g_strcmp0("Pause", key) == 0)
        pragha_backend_pause (backend);
    else if (g_strcmp0("Stop", key) == 0)
        pragha_playback_stop(pragha);
    else if (g_strcmp0("Previous", key) == 0)
        pragha_playback_prev_track(pragha);
    else if (g_strcmp0("Next", key) == 0)
        pragha_playback_next_track(pragha);
    else if (g_strcmp0("Repeat", key) == 0)
    {
        gboolean repeat = pragha_preferences_get_repeat (preferences);
        pragha_preferences_set_repeat (preferences, !repeat);
    }
    else if (g_strcmp0("Shuffle", key) == 0)
    {
        gboolean shuffle = pragha_preferences_get_shuffle (preferences);
        pragha_preferences_set_shuffle (preferences, !shuffle);
    }

    //XXX missed buttons: "Rewind" and "FastForward"
}