~ubuntu-branches/ubuntu/oneiric/rhythmbox/oneiric

« back to all changes in this revision

Viewing changes to iradio/rb-station-properties-dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-06-26 19:06:10 UTC
  • mto: (2.1.1 lenny) (1.1.37 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20060626190610-08x8lgvvfs0gr619
Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *
17
17
 *  You should have received a copy of the GNU General Public License
18
18
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
20
20
 *
21
21
 */
22
22
 
317
317
        char *tmp;
318
318
 
319
319
        if (dialog->priv->current_entry) {
320
 
                name = rb_refstring_get (dialog->priv->current_entry->title);
 
320
                name = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
321
321
                tmp = g_strdup_printf (_("%s Properties"), name);
322
322
                gtk_window_set_title (GTK_WINDOW (dialog), tmp);
323
323
                g_free (tmp);
329
329
static void
330
330
rb_station_properties_dialog_update_title_entry (RBStationPropertiesDialog *dialog)
331
331
{
332
 
        gtk_entry_set_text (GTK_ENTRY (dialog->priv->title),
333
 
                            rb_refstring_get (dialog->priv->current_entry->title));
 
332
        const char *title;
 
333
 
 
334
        title = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_TITLE);
 
335
        gtk_entry_set_text (GTK_ENTRY (dialog->priv->title),title);
334
336
}
335
337
 
336
338
static void
337
339
rb_station_properties_dialog_update_genre (RBStationPropertiesDialog *dialog)
338
340
{
339
 
        gtk_entry_set_text (GTK_ENTRY (dialog->priv->genre),
340
 
                            rb_refstring_get (dialog->priv->current_entry->genre));
 
341
        const char *genre;
 
342
 
 
343
        genre = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_GENRE);
 
344
        gtk_entry_set_text (GTK_ENTRY (dialog->priv->genre), genre);
341
345
}
342
346
 
343
347
static void
344
348
rb_station_properties_dialog_update_location (RBStationPropertiesDialog *dialog)
345
349
{
 
350
        const char *location;
346
351
        char *unescaped;
347
 
        unescaped = gnome_vfs_unescape_string_for_display (dialog->priv->current_entry->location);
 
352
 
 
353
        location = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LOCATION);
 
354
        unescaped = gnome_vfs_unescape_string_for_display (location);
348
355
        gtk_entry_set_text (GTK_ENTRY (dialog->priv->location), unescaped);
349
356
        g_free (unescaped);
350
357
}
384
391
        long int count = 0;
385
392
 
386
393
        if (dialog->priv->current_entry)
387
 
                count = dialog->priv->current_entry->play_count;
 
394
                count = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_PLAY_COUNT);
388
395
 
389
396
        text = g_strdup_printf ("%ld", count);
390
397
        gtk_label_set_text (GTK_LABEL (dialog->priv->playcount), text);
398
405
        char *text;
399
406
 
400
407
        if (dialog->priv->current_entry)
401
 
                val = dialog->priv->current_entry->bitrate;
 
408
                val = rhythmdb_entry_get_ulong (dialog->priv->current_entry, RHYTHMDB_PROP_BITRATE);
402
409
 
403
410
        if (val == 0)
404
411
                text = g_strdup (_("Unknown"));
415
422
        const char *last_played = _("Never");
416
423
 
417
424
        if (dialog->priv->current_entry)
418
 
                last_played = rb_refstring_get (dialog->priv->current_entry->last_played_str);
 
425
                last_played = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_LAST_PLAYED_STR);
419
426
        gtk_label_set (GTK_LABEL (dialog->priv->lastplayed), last_played);
420
427
}
421
428
 
426
433
        g_return_if_fail (RB_IS_STATION_PROPERTIES_DIALOG (dialog));
427
434
 
428
435
        if (dialog->priv->current_entry)
429
 
                rating = dialog->priv->current_entry->rating;
 
436
                rating = rhythmdb_entry_get_double (dialog->priv->current_entry, RHYTHMDB_PROP_RATING);
430
437
        
431
438
        g_object_set (G_OBJECT (dialog->priv->rating), "rating", rating, NULL);
432
439
}
434
441
static void
435
442
rb_station_properties_dialog_update_playback_error (RBStationPropertiesDialog *dialog)
436
443
{
 
444
        const char *error;
 
445
        
437
446
        g_return_if_fail (RB_IS_STATION_PROPERTIES_DIALOG (dialog));
438
447
 
439
 
        if (dialog->priv->current_entry && dialog->priv->current_entry->playback_error) {
440
 
                gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error),
441
 
                                    dialog->priv->current_entry->playback_error);
 
448
        error = rhythmdb_entry_get_string (dialog->priv->current_entry, RHYTHMDB_PROP_PLAYBACK_ERROR);
 
449
        if (dialog->priv->current_entry && error) {
 
450
                gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error), error);
442
451
                gtk_widget_show (dialog->priv->playback_error_box);
443
452
        } else {
444
453
                gtk_label_set_text (GTK_LABEL (dialog->priv->playback_error), "");
449
458
static void
450
459
rb_station_properties_dialog_sync_entries (RBStationPropertiesDialog *dialog)
451
460
{
452
 
        const char *title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
453
 
        const char *genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
454
 
        const char *location = gtk_entry_get_text (GTK_ENTRY (dialog->priv->location));
 
461
        const char *title;
 
462
        const char *genre;
 
463
        const char *location;
 
464
        const char *string;
455
465
        GValue val = {0,};
456
466
        gboolean changed = FALSE;
457
467
        RhythmDBEntry *entry = dialog->priv->current_entry;
458
468
 
459
 
        if (strcmp (title, rb_refstring_get (entry->title))) {
 
469
        title = gtk_entry_get_text (GTK_ENTRY (dialog->priv->title));
 
470
        genre = gtk_entry_get_text (GTK_ENTRY (dialog->priv->genre));
 
471
        location = gtk_entry_get_text (GTK_ENTRY (dialog->priv->location));
 
472
 
 
473
        string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
 
474
        if (strcmp (title, string)) {
460
475
                g_value_init (&val, G_TYPE_STRING);
461
476
                g_value_set_string (&val, title);
462
477
                rhythmdb_entry_set (dialog->priv->db, entry, 
466
481
                changed = TRUE;
467
482
        }
468
483
 
469
 
        if (strcmp (genre, rb_refstring_get (entry->genre))) {
 
484
        string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_GENRE);
 
485
        if (strcmp (genre, string)) {
470
486
                g_value_init (&val, G_TYPE_STRING);
471
487
                g_value_set_string (&val, genre);
472
488
                rhythmdb_entry_set (dialog->priv->db, entry, 
475
491
                changed = TRUE;
476
492
        }
477
493
 
478
 
        if (strcmp (location, entry->location)) {
 
494
        string = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
 
495
        if (strcmp (location, string)) {
479
496
                g_value_init (&val, G_TYPE_STRING);
480
497
                g_value_set_string (&val, location);
481
498
                rhythmdb_entry_set (dialog->priv->db, entry,