~ubuntu-branches/ubuntu/wily/pianobar/wily-proposed

« back to all changes in this revision

Viewing changes to src/ui.c

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2012-03-10 04:55:05 UTC
  • mfrom: (1.3.8)
  • Revision ID: package-import@ubuntu.com-20120310045505-cz2aqq552pbjp8o5
Tags: 2012.01.10-1
* New upstream version. (closes: #655744)
* Update debian/watch to point to new download URL.
* Review and update debian/copyright.
* Compy with standards version 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        waith->postData = req->postData;
142
142
        waith->method = WAITRESS_METHOD_POST;
143
143
        waith->url.path = req->urlPath;
 
144
        waith->url.tls = req->secure;
144
145
 
145
146
        return WaitressFetchBuf (waith, &req->responseData);
146
147
}
235
236
/*      Station sorting functions */
236
237
 
237
238
static inline int BarStationQuickmix01Cmp (const void *a, const void *b) {
238
 
        const PianoStation_t *stationA = *((PianoStation_t **) a),
239
 
                        *stationB = *((PianoStation_t **) b);
 
239
        const PianoStation_t *stationA = *((PianoStation_t * const *) a),
 
240
                        *stationB = *((PianoStation_t * const *) b);
240
241
        return stationA->isQuickMix - stationB->isQuickMix;
241
242
}
242
243
 
243
244
/*      sort by station name from a to z, case insensitive
244
245
 */
245
246
static inline int BarStationNameAZCmp (const void *a, const void *b) {
246
 
        const PianoStation_t *stationA = *((PianoStation_t **) a),
247
 
                        *stationB = *((PianoStation_t **) b);
 
247
        const PianoStation_t *stationA = *((PianoStation_t * const *) a),
 
248
                        *stationB = *((PianoStation_t * const *) b);
248
249
        return strcasecmp (stationA->name, stationB->name);
249
250
}
250
251
 
566
567
 
567
568
        /* receive genre stations list if not yet available */
568
569
        if (app->ph.genreStations == NULL) {
569
 
                PianoReturn_t pRet;
570
 
                WaitressReturn_t wRet;
571
 
 
572
570
                BarUiMsg (&app->settings, MSG_INFO, "Receiving genre stations... ");
573
571
                if (!BarUiPianoCall (app, PIANO_REQUEST_GET_GENRE_STATIONS, NULL,
574
572
                                &pRet, &wRet)) {
584
582
                i++;
585
583
                curCat = curCat->next;
586
584
        }
587
 
        /* select category or exit */
588
 
        BarUiMsg (&app->settings, MSG_QUESTION, "Select category: ");
589
 
        if (BarReadlineInt (&i, &app->input) == 0) {
590
 
                return;
591
 
        }
592
 
        curCat = app->ph.genreStations;
593
 
        while (curCat != NULL && i > 0) {
594
 
                curCat = curCat->next;
595
 
                i--;
596
 
        }
 
585
 
 
586
        do {
 
587
                /* select category or exit */
 
588
                BarUiMsg (&app->settings, MSG_QUESTION, "Select category: ");
 
589
                if (BarReadlineInt (&i, &app->input) == 0) {
 
590
                        return;
 
591
                }
 
592
                curCat = app->ph.genreStations;
 
593
                while (curCat != NULL && i > 0) {
 
594
                        curCat = curCat->next;
 
595
                        i--;
 
596
                }
 
597
        } while (curCat == NULL);
597
598
        
598
599
        /* print all available stations */
599
600
        curGenre = curCat->genres;
603
604
                i++;
604
605
                curGenre = curGenre->next;
605
606
        }
606
 
        BarUiMsg (&app->settings, MSG_QUESTION, "Select genre: ");
607
 
        if (BarReadlineInt (&i, &app->input) == 0) {
608
 
                return;
609
 
        }
610
 
        curGenre = curCat->genres;
611
 
        while (curGenre != NULL && i > 0) {
612
 
                curGenre = curGenre->next;
613
 
                i--;
614
 
        }
 
607
 
 
608
        do {
 
609
                BarUiMsg (&app->settings, MSG_QUESTION, "Select genre: ");
 
610
                if (BarReadlineInt (&i, &app->input) == 0) {
 
611
                        return;
 
612
                }
 
613
                curGenre = curCat->genres;
 
614
                while (curGenre != NULL && i > 0) {
 
615
                        curGenre = curGenre->next;
 
616
                        i--;
 
617
                }
 
618
        } while (curGenre == NULL);
 
619
 
615
620
        /* create station */
616
621
        BarUiMsg (&app->settings, MSG_INFO, "Adding shared station \"%s\"... ", curGenre->name);
617
622
        reqData.id = curGenre->musicId;
626
631
 *      @param format characters
627
632
 *      @param replacement for each given format character
628
633
 */
629
 
void BarUiCustomFormat (char *dest, size_t destSize, const char *format,
 
634
static void BarUiCustomFormat (char *dest, size_t destSize, const char *format,
630
635
                const char *formatChars, const char **formatVals) {
631
636
        bool haveFormatChar = false;
632
637