comparison src/audacious/ui_fileinfo.c @ 4061:450581e58761

added new tuple field FIELD_BITRATE
author Eugene Zagidullin <e.asphyx@gmail.com>
date Tue, 04 Dec 2007 03:26:29 +0300
parents 91dabb7c78d2
children 0b00f1d21270
comparison
equal deleted inserted replaced
4059:2082537138d0 4061:450581e58761
77 GtkWidget *image_artwork; 77 GtkWidget *image_artwork;
78 78
79 GtkWidget *image_fileicon; 79 GtkWidget *image_fileicon;
80 GtkWidget *label_format_name; 80 GtkWidget *label_format_name;
81 GtkWidget *label_quality; 81 GtkWidget *label_quality;
82 GtkWidget *label_bitrate;
82 GtkWidget *btn_apply; 83 GtkWidget *btn_apply;
83 GtkWidget *label_mini_status; 84 GtkWidget *label_mini_status;
84 85
85 static gchar *current_file = NULL; 86 static gchar *current_file = NULL;
86 static InputPlugin *current_ip = NULL; 87 static InputPlugin *current_ip = NULL;
218 fileinfo_entry_set_text(entry_track, ""); 219 fileinfo_entry_set_text(entry_track, "");
219 fileinfo_entry_set_text(entry_location, ""); 220 fileinfo_entry_set_text(entry_location, "");
220 221
221 fileinfo_label_set_text(label_format_name, NULL); 222 fileinfo_label_set_text(label_format_name, NULL);
222 fileinfo_label_set_text(label_quality, NULL); 223 fileinfo_label_set_text(label_quality, NULL);
224 fileinfo_label_set_text(label_bitrate, NULL);
223 225
224 if (label_mini_status != NULL) { 226 if (label_mini_status != NULL) {
225 gtk_label_set_text(GTK_LABEL(label_mini_status), "<span size=\"small\"></span>"); 227 gtk_label_set_text(GTK_LABEL(label_mini_status), "<span size=\"small\"></span>");
226 gtk_label_set_use_markup(GTK_LABEL(label_mini_status), TRUE); 228 gtk_label_set_use_markup(GTK_LABEL(label_mini_status), TRUE);
227 } 229 }
394 GtkWidget *label_track; 396 GtkWidget *label_track;
395 GtkWidget *label_location; 397 GtkWidget *label_location;
396 GtkWidget *label_general; 398 GtkWidget *label_general;
397 GtkWidget *label_format; 399 GtkWidget *label_format;
398 GtkWidget *label_quality_label; 400 GtkWidget *label_quality_label;
401 GtkWidget *label_bitrate_label;
399 GtkWidget *codec_hbox; 402 GtkWidget *codec_hbox;
400 GtkWidget *codec_table; 403 GtkWidget *codec_table;
401 GtkWidget *table1; 404 GtkWidget *table1;
402 GtkWidget *bbox_close; 405 GtkWidget *bbox_close;
403 GtkWidget *btn_close; 406 GtkWidget *btn_close;
446 gtk_container_add (GTK_CONTAINER(alignment), codec_hbox); 449 gtk_container_add (GTK_CONTAINER(alignment), codec_hbox);
447 450
448 image_fileicon = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_DIALOG); 451 image_fileicon = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_DIALOG);
449 gtk_box_pack_start (GTK_BOX (codec_hbox), image_fileicon, FALSE, FALSE, 0); 452 gtk_box_pack_start (GTK_BOX (codec_hbox), image_fileicon, FALSE, FALSE, 0);
450 453
451 codec_table = gtk_table_new(2, 2, FALSE); 454 codec_table = gtk_table_new(3, 2, FALSE);
452 gtk_table_set_row_spacings (GTK_TABLE(codec_table), 6); 455 gtk_table_set_row_spacings (GTK_TABLE(codec_table), 6);
453 gtk_table_set_col_spacings (GTK_TABLE(codec_table), 12); 456 gtk_table_set_col_spacings (GTK_TABLE(codec_table), 12);
454 gtk_box_pack_start (GTK_BOX (codec_hbox), codec_table, FALSE, FALSE, 0); 457 gtk_box_pack_start (GTK_BOX (codec_hbox), codec_table, FALSE, FALSE, 0);
455 458
456 label_format = gtk_label_new(_("<span size=\"small\">Format:</span>")); 459 label_format = gtk_label_new(_("<span size=\"small\">Format:</span>"));
457 gtk_label_set_use_markup(GTK_LABEL(label_format), TRUE); 460 gtk_label_set_use_markup(GTK_LABEL(label_format), TRUE);
458 gtk_misc_set_alignment(GTK_MISC(label_format), 0, 0.5); 461 gtk_misc_set_alignment(GTK_MISC(label_format), 0, 0.5);
459 label_quality_label = gtk_label_new(_("<span size=\"small\">Quality:</span>")); 462 label_quality_label = gtk_label_new(_("<span size=\"small\">Quality:</span>"));
460 gtk_label_set_use_markup(GTK_LABEL(label_quality_label), TRUE); 463 gtk_label_set_use_markup(GTK_LABEL(label_quality_label), TRUE);
461 gtk_misc_set_alignment(GTK_MISC(label_quality_label), 0, 0.5); 464 gtk_misc_set_alignment(GTK_MISC(label_quality_label), 0, 0.5);
465 label_bitrate_label = gtk_label_new(_("<span size=\"small\">Bitrate:</span>"));
466 gtk_label_set_use_markup(GTK_LABEL(label_bitrate_label), TRUE);
467 gtk_misc_set_alignment(GTK_MISC(label_bitrate_label), 0, 0.5);
462 468
463 label_format_name = gtk_label_new(_("<span size=\"small\">n/a</span>")); 469 label_format_name = gtk_label_new(_("<span size=\"small\">n/a</span>"));
464 gtk_label_set_use_markup(GTK_LABEL(label_format_name), TRUE); 470 gtk_label_set_use_markup(GTK_LABEL(label_format_name), TRUE);
465 gtk_misc_set_alignment(GTK_MISC(label_format_name), 0, 0.5); 471 gtk_misc_set_alignment(GTK_MISC(label_format_name), 0, 0.5);
466 label_quality = gtk_label_new(_("<span size=\"small\">n/a</span>")); 472 label_quality = gtk_label_new(_("<span size=\"small\">n/a</span>"));
467 gtk_label_set_use_markup(GTK_LABEL(label_quality), TRUE); 473 gtk_label_set_use_markup(GTK_LABEL(label_quality), TRUE);
468 gtk_misc_set_alignment(GTK_MISC(label_quality), 0, 0.5); 474 gtk_misc_set_alignment(GTK_MISC(label_quality), 0, 0.5);
475 label_bitrate = gtk_label_new(_("<span size=\"small\">n/a</span>"));
476 gtk_label_set_use_markup(GTK_LABEL(label_bitrate), TRUE);
477 gtk_misc_set_alignment(GTK_MISC(label_bitrate), 0, 0.5);
469 478
470 gtk_table_attach(GTK_TABLE(codec_table), label_format, 0, 1, 0, 1, 479 gtk_table_attach(GTK_TABLE(codec_table), label_format, 0, 1, 0, 1,
471 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 480 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
472 (GtkAttachOptions) (0), 0, 0); 481 (GtkAttachOptions) (0), 0, 0);
473 gtk_table_attach(GTK_TABLE(codec_table), label_format_name, 1, 2, 0, 1, 482 gtk_table_attach(GTK_TABLE(codec_table), label_format_name, 1, 2, 0, 1,
475 (GtkAttachOptions) (0), 0, 0); 484 (GtkAttachOptions) (0), 0, 0);
476 gtk_table_attach(GTK_TABLE(codec_table), label_quality_label, 0, 1, 1, 2, 485 gtk_table_attach(GTK_TABLE(codec_table), label_quality_label, 0, 1, 1, 2,
477 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 486 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
478 (GtkAttachOptions) (0), 0, 0); 487 (GtkAttachOptions) (0), 0, 0);
479 gtk_table_attach(GTK_TABLE(codec_table), label_quality, 1, 2, 1, 2, 488 gtk_table_attach(GTK_TABLE(codec_table), label_quality, 1, 2, 1, 2,
489 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
490 (GtkAttachOptions) (0), 0, 0);
491 gtk_table_attach(GTK_TABLE(codec_table), label_bitrate_label, 0, 1, 2, 3,
492 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
493 (GtkAttachOptions) (0), 0, 0);
494 gtk_table_attach(GTK_TABLE(codec_table), label_bitrate, 1, 2, 2, 3,
480 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 495 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
481 (GtkAttachOptions) (0), 0, 0); 496 (GtkAttachOptions) (0), 0, 0);
482 497
483 label_title = gtk_label_new(_("<span size=\"small\">Title</span>")); 498 label_title = gtk_label_new(_("<span size=\"small\">Title</span>"));
484 gtk_box_pack_start(GTK_BOX(vbox2), label_title, FALSE, FALSE, 0); 499 gtk_box_pack_start(GTK_BOX(vbox2), label_title, FALSE, FALSE, 0);
652 set_entry_int_from_field(entry_track, tuple, FIELD_TRACK_NUMBER, updating_enabled); 667 set_entry_int_from_field(entry_track, tuple, FIELD_TRACK_NUMBER, updating_enabled);
653 668
654 fileinfo_label_set_text(label_format_name, tuple_get_string(tuple, FIELD_CODEC, NULL)); 669 fileinfo_label_set_text(label_format_name, tuple_get_string(tuple, FIELD_CODEC, NULL));
655 fileinfo_label_set_text(label_quality, tuple_get_string(tuple, FIELD_QUALITY, NULL)); 670 fileinfo_label_set_text(label_quality, tuple_get_string(tuple, FIELD_QUALITY, NULL));
656 671
672 if (tuple_get_value_type(tuple, FIELD_BITRATE, NULL) == TUPLE_INT) {
673 tmp = g_strdup_printf(_("%d kb/s"), tuple_get_int(tuple, FIELD_BITRATE, NULL));
674 fileinfo_label_set_text(label_bitrate, tmp);
675 g_free(tmp);
676 } else {
677 fileinfo_label_set_text(label_bitrate, NULL);
678 }
679
657 tmp = (gchar *)tuple_get_string(tuple, FIELD_MIMETYPE, NULL); 680 tmp = (gchar *)tuple_get_string(tuple, FIELD_MIMETYPE, NULL);
658 icon = mime_icon_lookup(48, tmp ? tmp : "audio/x-generic"); 681 icon = mime_icon_lookup(48, tmp ? tmp : "audio/x-generic");
659 if (icon) { 682 if (icon) {
660 if (image_fileicon) gtk_image_set_from_pixbuf (GTK_IMAGE(image_fileicon), icon); 683 if (image_fileicon) gtk_image_set_from_pixbuf (GTK_IMAGE(image_fileicon), icon);
661 g_object_unref(icon); 684 g_object_unref(icon);
669 { 692 {
670 fileinfo_entry_set_image(image_artwork, tmp); 693 fileinfo_entry_set_image(image_artwork, tmp);
671 g_free(tmp); 694 g_free(tmp);
672 } 695 }
673 696
674 /*if(updating_enabled && current_file != NULL && current_ip != NULL && current_ip->update_song_tuple != NULL)
675 gtk_widget_set_sensitive(btn_apply, TRUE);
676 else
677 gtk_widget_set_sensitive(btn_apply, FALSE);*/
678
679 gtk_widget_set_sensitive(btn_apply, FALSE); 697 gtk_widget_set_sensitive(btn_apply, FALSE);
680 698
681 if (label_mini_status != NULL) { 699 if (label_mini_status != NULL) {
682 gtk_label_set_text(GTK_LABEL(label_mini_status), "<span size=\"small\"></span>"); 700 gtk_label_set_text(GTK_LABEL(label_mini_status), "<span size=\"small\"></span>");
683 gtk_label_set_use_markup(GTK_LABEL(label_mini_status), TRUE); 701 gtk_label_set_use_markup(GTK_LABEL(label_mini_status), TRUE);