Example #1
0
static void open_cb (void * entry)
{
    const char * text = gtk_entry_get_text ((GtkEntry *) entry);
    bool_t open = GPOINTER_TO_INT (g_object_get_data ((GObject *) entry, "open"));

    if (open)
        aud_drct_pl_open (text);
    else
        aud_drct_pl_add (text, -1);

    aud_history_add (text);
}
Example #2
0
static void response_cb (GtkWidget * dialog, int response)
{
    if (response == GTK_RESPONSE_ACCEPT)
    {
        GtkWidget * entry = g_object_get_data ((GObject *) dialog, "entry");
        const char * text = gtk_entry_get_text ((GtkEntry *) entry);
        bool_t open = GPOINTER_TO_INT (g_object_get_data ((GObject *) dialog, "open"));

        if (open)
            aud_drct_pl_open (text);
        else
            aud_drct_pl_add (text, -1);

        aud_history_add (text);
    }

    gtk_widget_destroy (dialog);
}
static void cd_play (void) {aud_drct_pl_open ("cdda://"); }
Example #4
0
/* the main alarm thread */
static gboolean alarm_timeout (void * unused)
{
    struct tm *currtime;
    time_t timenow;
    guint today;

    AUDDBG("Getting time\n");
    timenow = time(NULL);
    currtime = localtime(&timenow);
    today = currtime->tm_wday;
    AUDDBG("Today is %d\n", today);

    /* already went off? */
    if (timenow < play_start + 60)
        return TRUE;

    if(alarm_conf.day[today].flags & ALARM_OFF)
        return TRUE;
    else
    {
        /* set the alarm_h and alarm_m for today, if not default */
        if(!(alarm_conf.day[today].flags & ALARM_DEFAULT))
        {
            alarm_h = alarm_conf.day[today].hour;
            alarm_m = alarm_conf.day[today].min;
        }
        else
        {
            alarm_h = alarm_conf.default_hour;
            alarm_m = alarm_conf.default_min;
        }
    }

    AUDDBG("Alarm time is %d:%d (def: %d:%d)\n", alarm_h, alarm_m,
    alarm_conf.default_hour, alarm_conf.default_min);

    AUDDBG("Checking time (%d:%d)\n", currtime->tm_hour, currtime->tm_min);
    if((currtime->tm_hour != alarm_h) || (currtime->tm_min != alarm_m))
        return TRUE;

    if(cmd_on == TRUE)
    {
        char * cmdstr = aud_get_str ("alarm", "cmdstr");
        AUDDBG("Executing %s, cmd_on is true\n", cmdstr);
        if(system(cmdstr) == -1)
            AUDDBG("Executing %s failed\n",cmdstr);
        str_unref (cmdstr);
    }

    bool_t started = FALSE;

    char * playlist = aud_get_str ("alarm", "playlist");
    if (playlist[0])
    {
        aud_drct_pl_open (playlist);
        started = TRUE;
    }
    str_unref (playlist);

    if(fading)
    {
        fader fade_vols;

        AUDDBG("Fading is true\n");
        aud_drct_set_volume_main(quietvol);

        /* start playing */
        play_start = time(NULL);

        if (! started)
            aud_drct_play ();

        /* fade volume */
        fade_vols.start = quietvol;
        fade_vols.end = volume;

        //alarm_fade(quietvol, volume);
        alarm_thread_create(alarm_fade, &fade_vols, 0);
    }
    else
    {
        /* no fading */

        /* set volume */
        aud_drct_set_volume_main(volume);

        /* start playing */
        play_start = time(NULL);
        aud_drct_play();
    }

    if(alarm_conf.reminder_on == TRUE)
    {
        char * reminder_msg = aud_get_str ("alarm", "reminder_msg");
        GtkWidget *reminder_dialog;
        AUDDBG("Showing reminder '%s'\n", reminder_msg);

        reminder_dialog = (GtkWidget*) create_reminder_dialog(reminder_msg);
        gtk_widget_show_all(reminder_dialog);
        str_unref (reminder_msg);
    }

    /* bring up the wakeup call dialog if stop_on is set TRUE, this
     * has been moved to after making Audacious play so that it doesnt
     * get in the way for people with manual window placement turned on
     *
     * this means that the dialog doesnt get shown until the volume has
     * finished fading though !, so thats something else to fix
     */
    if(stop_on == TRUE)
    {
        alarm_dialog = create_alarm_dialog();

        AUDDBG("now starting stop thread\n");
        stop = alarm_thread_create(alarm_stop_thread, NULL, 0);
        AUDDBG("Created wakeup dialog and started stop thread\n");
    }

    return TRUE;
}