Re: [Easytag-mailing] disc number



Hi,

why don't make it more identical to the track numbering, i.e. make it easy for the user to set the disc number to '1/3'? This is how i did it. I didn't add support for anything else than mp3/id3, though, because i am not sure ape/flac/ogg support it that way.

iTunes handles the disc '1/3' fine as well, so i would prefer to do it this way :)

what do you think?


andre'
diff -wurN -X dontdiff orig/easytag-1.99.3/src/easytag.c easytag-1.99.3/src/easytag.c
--- orig/easytag-1.99.3/src/easytag.c	2005-01-20 22:10:26.000000000 +0100
+++ easytag-1.99.3/src/easytag.c	2005-02-11 00:49:09.000000000 +0100
@@ -592,11 +592,42 @@
     Separator = gtk_vseparator_new();
     gtk_table_attach(GTK_TABLE(Table),Separator,3,4,3,4,GTK_FILL,GTK_FILL,2,2);
 
+    /* Disc */
+    DiscLabel = gtk_label_new(_("Disc #:"));
+    gtk_table_attach(GTK_TABLE(Table),DiscLabel,5,6,3,4,GTK_FILL,GTK_FILL,0,0);
+    gtk_misc_set_alignment(GTK_MISC(DiscLabel),1,0.5);
+
+    DiscEntry = gtk_entry_new();
+    gtk_table_attach_defaults(GTK_TABLE(Table),DiscEntry,6,7,3,4);
+    gtk_widget_set_size_request(DiscEntry,30,-1);
+    g_signal_connect(G_OBJECT(GTK_ENTRY(DiscEntry)),"insert_text",
+                G_CALLBACK(Insert_Only_Digit),NULL);
+
+    Label = gtk_label_new("/");
+    gtk_table_attach(GTK_TABLE(Table),Label,7,8,3,4,GTK_FILL,GTK_FILL,0,0);
+    gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
+
+    DiscTotalEntry = gtk_entry_new();
+    gtk_table_attach_defaults(GTK_TABLE(Table),DiscTotalEntry,9,10,3,4);
+    gtk_widget_set_size_request(DiscTotalEntry,30,-1);
+    g_signal_connect(G_OBJECT(GTK_ENTRY(DiscTotalEntry)),"insert_text",
+        G_CALLBACK(Insert_Only_Digit),NULL);
+
+    DiscMButton = gtk_button_new();
+    gtk_widget_set_size_request(DiscMButton,MButtonSize,MButtonSize);
+    gtk_table_attach(GTK_TABLE(Table),DiscMButton,10,11,3,4,0,0,0,0);
+    g_signal_connect(G_OBJECT(DiscMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
+    gtk_tooltips_set_tip(Tips,DiscMButton,_("Tag selected files with this number of discs"),NULL);
+
+    g_object_set_data(G_OBJECT(DiscEntry),"MButtonName",DiscMButton);
+    g_object_set_data(G_OBJECT(DiscTotalEntry),"MButtonName",DiscMButton);
+    g_signal_connect(G_OBJECT(DiscEntry),"key_press_event",G_CALLBACK(Tag_Area_Entry_Key_Press),NULL);
+    g_signal_connect(G_OBJECT(DiscTotalEntry),"key_press_event", G_CALLBACK(Tag_Area_Entry_Key_Press),NULL);
 
     /* Track */
     TrackMButtonSequence = gtk_button_new();
     gtk_widget_set_size_request(TrackMButtonSequence,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),TrackMButtonSequence,4,5,3,4,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),TrackMButtonSequence,4,5,4,5,0,0,0,0);
     g_signal_connect(G_OBJECT(TrackMButtonSequence),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,TrackMButtonSequence,_("Number selected tracks sequentially. "
                                                      "Starts at 01 in each subdirectory."), NULL);
@@ -608,7 +639,7 @@
     GTK_WIDGET_UNSET_FLAGS(TrackMButtonSequence,GTK_CAN_FOCUS);
 
     TrackLabel = gtk_label_new(_("Track #:"));
-    gtk_table_attach(GTK_TABLE(Table),TrackLabel,5,6,3,4,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),TrackLabel,5,6,4,5,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(TrackLabel),1,0.5);
 
     if (TrackEntryComboModel != NULL)
@@ -617,19 +648,19 @@
         TrackEntryComboModel = gtk_list_store_new(MISC_COMBO_COUNT, G_TYPE_STRING);
 
     TrackEntryCombo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(TrackEntryComboModel), MISC_COMBO_TEXT);
-    gtk_table_attach_defaults(GTK_TABLE(Table),TrackEntryCombo,6,7,3,4);
+    gtk_table_attach_defaults(GTK_TABLE(Table),TrackEntryCombo,6,7,4,5);
 
     gtk_widget_set_size_request(TrackEntryCombo,47,-1);
     g_signal_connect(G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)),"insert_text",
                 G_CALLBACK(Insert_Only_Digit),NULL);
 
     Label = gtk_label_new("/");
-    gtk_table_attach(GTK_TABLE(Table),Label,7,8,3,4,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),Label,7,8,4,5,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
 
     TrackMButtonNbrFiles = gtk_button_new();
     gtk_widget_set_size_request(TrackMButtonNbrFiles,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),TrackMButtonNbrFiles,8,9,3,4,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),TrackMButtonNbrFiles,8,9,4,5,0,0,0,0);
     g_signal_connect(G_OBJECT(TrackMButtonNbrFiles),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,TrackMButtonNbrFiles,_("Set the number of files, in the same directory of the displayed file, to the selected tracks."), NULL);
     // Pixmap into TrackMButtonNbrFiles button
@@ -640,14 +671,14 @@
     GTK_WIDGET_UNSET_FLAGS(TrackMButtonNbrFiles,GTK_CAN_FOCUS);
 
     TrackTotalEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),TrackTotalEntry,9,10,3,4);
+    gtk_table_attach_defaults(GTK_TABLE(Table),TrackTotalEntry,9,10,4,5);
     gtk_widget_set_size_request(TrackTotalEntry,30,-1);
     g_signal_connect(G_OBJECT(GTK_ENTRY(TrackTotalEntry)),"insert_text",
         G_CALLBACK(Insert_Only_Digit),NULL);
 
     TrackMButton = gtk_button_new();
     gtk_widget_set_size_request(TrackMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),TrackMButton,10,11,3,4,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),TrackMButton,10,11,4,5,0,0,0,0);
     g_signal_connect(G_OBJECT(TrackMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,TrackMButton,_("Tag selected files with this number of tracks"),NULL);
 
@@ -658,7 +689,7 @@
 
     /* Genre */
     GenreLabel = gtk_label_new(_("Genre:"));
-    gtk_table_attach(GTK_TABLE(Table),GenreLabel,0,1,4,5,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),GenreLabel,0,1,5,6,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(GenreLabel),1,0.5);
 
     if (GenreComboModel != NULL)
@@ -673,12 +704,12 @@
     gtk_entry_completion_set_text_column(completion, 0);
     gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(GenreComboModel), MISC_COMBO_TEXT, Combo_Alphabetic_Sort, NULL, NULL);
     gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(GenreComboModel), MISC_COMBO_TEXT, GTK_SORT_ASCENDING);
-    gtk_table_attach_defaults(GTK_TABLE(Table),GenreCombo,1,10,4,5);
+    gtk_table_attach_defaults(GTK_TABLE(Table),GenreCombo,1,10,5,6);
     Load_Genres_List_To_UI();
 
     GenreMButton = gtk_button_new();
     gtk_widget_set_size_request(GenreMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),GenreMButton,10,11,4,5,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),GenreMButton,10,11,5,6,0,0,0,0);
     g_signal_connect(G_OBJECT(GenreMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,GenreMButton,_("Tag selected files with this genre"),NULL);
 
@@ -688,15 +719,15 @@
 
     /* Comment */
     CommentLabel = gtk_label_new(_("Comment:"));
-    gtk_table_attach(GTK_TABLE(Table),CommentLabel,0,1,5,6,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),CommentLabel,0,1,6,7,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(CommentLabel),1,0.5);
 
     CommentEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),CommentEntry,1,10,5,6);
+    gtk_table_attach_defaults(GTK_TABLE(Table),CommentEntry,1,10,6,7);
 
     // Use of a text view instead of an entry...
     //ScrollWindow = gtk_scrolled_window_new(NULL,NULL);
-    //gtk_table_attach_defaults(GTK_TABLE(Table),ScrollWindow,1,10,5,6);
+    //gtk_table_attach_defaults(GTK_TABLE(Table),ScrollWindow,1,10,6,7);
     //gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
     //gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ScrollWindow), GTK_SHADOW_IN);
     //gtk_widget_set_size_request(ScrollWindow,-1,52); // Display ~3 lines...
@@ -707,7 +738,7 @@
 
     CommentMButton = gtk_button_new();
     gtk_widget_set_size_request(CommentMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),CommentMButton,10,11,5,6,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),CommentMButton,10,11,6,7,0,0,0,0);
     g_signal_connect(G_OBJECT(CommentMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,CommentMButton,_("Tag selected files with this comment"),NULL);
 
@@ -721,15 +752,15 @@
 
     /* Composer (name of the composers) */
     ComposerLabel = gtk_label_new(_("Composer:"));
-    gtk_table_attach(GTK_TABLE(Table),ComposerLabel,0,1,6,7,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),ComposerLabel,0,1,7,8,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(ComposerLabel),1,0.5);
 
     ComposerEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),ComposerEntry,1,10,6,7);
+    gtk_table_attach_defaults(GTK_TABLE(Table),ComposerEntry,1,10,7,8);
 
     ComposerMButton = gtk_button_new();
     gtk_widget_set_size_request(ComposerMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),ComposerMButton,10,11,6,7,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),ComposerMButton,10,11,7,8,0,0,0,0);
     g_signal_connect(G_OBJECT(ComposerMButton),"clicked", G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,ComposerMButton,_("Tag selected files with this composer"),NULL);
 
@@ -740,15 +771,15 @@
 
     /* Original Artist / Performer */
     OrigArtistLabel = gtk_label_new(_("Orig. Artist:"));
-    gtk_table_attach(GTK_TABLE(Table),OrigArtistLabel,0,1,7,8,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),OrigArtistLabel,0,1,8,9,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(OrigArtistLabel),1,0.5);
 
     OrigArtistEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),OrigArtistEntry,1,10,7,8);
+    gtk_table_attach_defaults(GTK_TABLE(Table),OrigArtistEntry,1,10,8,9);
 
     OrigArtistMButton = gtk_button_new();
     gtk_widget_set_size_request(OrigArtistMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),OrigArtistMButton,10,11,7,8,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),OrigArtistMButton,10,11,8,9,0,0,0,0);
     g_signal_connect(G_OBJECT(OrigArtistMButton),"clicked", G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,OrigArtistMButton,_("Tag selected files with this original artist"),NULL);
 
@@ -759,15 +790,15 @@
 
     /* Copyright */
     CopyrightLabel = gtk_label_new(_("Copyright:"));
-    gtk_table_attach(GTK_TABLE(Table),CopyrightLabel,0,1,8,9,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),CopyrightLabel,0,1,9,10,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(CopyrightLabel),1,0.5);
 
     CopyrightEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),CopyrightEntry,1,10,8,9);
+    gtk_table_attach_defaults(GTK_TABLE(Table),CopyrightEntry,1,10,9,10);
 
     CopyrightMButton = gtk_button_new();
     gtk_widget_set_size_request(CopyrightMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),CopyrightMButton,10,11,8,9,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),CopyrightMButton,10,11,9,10,0,0,0,0);
     g_signal_connect(G_OBJECT(CopyrightMButton),"clicked", G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,CopyrightMButton,_("Tag selected files with this copyright"),NULL);
 
@@ -778,15 +809,15 @@
 
     /* URL */
     URLLabel = gtk_label_new(_("URL:"));
-    gtk_table_attach(GTK_TABLE(Table),URLLabel,0,1,9,10,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),URLLabel,0,1,10,11,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(URLLabel),1,0.5);
 
     URLEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),URLEntry,1,10,9,10);
+    gtk_table_attach_defaults(GTK_TABLE(Table),URLEntry,1,10,10,11);
 
     URLMButton = gtk_button_new();
     gtk_widget_set_size_request(URLMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),URLMButton,10,11,9,10,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),URLMButton,10,11,10,11,0,0,0,0);
     g_signal_connect(G_OBJECT(URLMButton),"clicked", G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,URLMButton,_("Tag selected files with this URL"),NULL);
 
@@ -797,15 +828,15 @@
 
     /* Encoded by */
     EncodedByLabel = gtk_label_new(_("Encoded by:"));
-    gtk_table_attach(GTK_TABLE(Table),EncodedByLabel,0,1,10,11,GTK_FILL,GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(Table),EncodedByLabel,0,1,11,12,GTK_FILL,GTK_FILL,0,0);
     gtk_misc_set_alignment(GTK_MISC(EncodedByLabel),1,0.5);
 
     EncodedByEntry = gtk_entry_new();
-    gtk_table_attach_defaults(GTK_TABLE(Table),EncodedByEntry,1,10,10,11);
+    gtk_table_attach_defaults(GTK_TABLE(Table),EncodedByEntry,1,10,11,12);
 
     EncodedByMButton = gtk_button_new();
     gtk_widget_set_size_request(EncodedByMButton,MButtonSize,MButtonSize);
-    gtk_table_attach(GTK_TABLE(Table),EncodedByMButton,10,11,10,11,0,0,0,0);
+    gtk_table_attach(GTK_TABLE(Table),EncodedByMButton,10,11,11,12,0,0,0,0);
     g_signal_connect(G_OBJECT(EncodedByMButton),"clicked", G_CALLBACK(Mini_Button_Clicked),NULL);
     gtk_tooltips_set_tip(Tips,EncodedByMButton,_("Tag selected files with this encoder name"),NULL);
 
@@ -818,7 +849,9 @@
     g_signal_connect_swapped(G_OBJECT(TitleEntry),      "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(ArtistEntry));
     g_signal_connect_swapped(G_OBJECT(ArtistEntry),     "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(AlbumEntry));
     g_signal_connect_swapped(G_OBJECT(AlbumEntry),      "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(YearEntry));
-    g_signal_connect_swapped(G_OBJECT(YearEntry),       "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)));
+    g_signal_connect_swapped(G_OBJECT(YearEntry),       "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(DiscEntry));
+    g_signal_connect_swapped(G_OBJECT(DiscEntry),       "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(DiscTotalEntry));
+    g_signal_connect_swapped(G_OBJECT(DiscTotalEntry),  "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)));
     g_signal_connect_swapped(G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)),"activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(TrackTotalEntry));
     g_signal_connect_swapped(G_OBJECT(TrackTotalEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(GTK_BIN(GenreCombo)->child));
     g_signal_connect_swapped(G_OBJECT(GTK_BIN(GenreCombo)->child),"activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(CommentEntry));
@@ -1062,6 +1095,39 @@
         else
             msg = g_strdup(_("Removed year from selected files."));
     }
+    else if (object==G_OBJECT(DiscMButton))
+    {
+        /* Used for Disc and Total Disc values */
+        string_to_set = gtk_editable_get_chars(GTK_EDITABLE(DiscEntry),0,-1);
+        string_to_set1 = gtk_editable_get_chars(GTK_EDITABLE(DiscTotalEntry),0,-1);
+        while (selfilelist)
+        {
+            etfile = Browser_List_Get_ETFile_From_Path(selfilelist->data);
+            FileTag = ET_File_Tag_Item_New();
+            ET_Copy_File_Tag_Item(etfile,FileTag);
+
+            ET_Set_Field_File_Tag_Item(&FileTag->disc,string_to_set);
+            ET_Set_Field_File_Tag_Item(&FileTag->disc_total,string_to_set1);
+            ET_Manage_Changes_Of_File_Data(etfile,NULL,FileTag);
+
+            if (!selfilelist->next) break;
+            selfilelist = g_list_next(selfilelist);
+        }
+
+        if ( string_to_set && g_utf8_strlen(string_to_set, -1) > 0 ) //&& atoi(string_to_set)>0 )
+        {
+            if ( string_to_set1 != NULL && g_utf8_strlen(string_to_set1, -1)>0 ) //&& atoi(string_to_set1)>0 )
+            {
+                msg = g_strdup_printf(_("Selected files tagged with disc like '%s/%s'."),string_to_set,string_to_set1);
+            }else
+            {
+                msg = g_strdup_printf(_("Selected files tagged with disc like '%s'."), string_to_set);
+            }
+        }else
+        {
+            msg = g_strdup(_("Removed disc number from selected files."));
+        }
+    }
     else if (object==G_OBJECT(TrackMButton))
     {
         /* Used of Track and Total Track values */
@@ -3122,6 +3188,8 @@
     gtk_widget_set_sensitive(GTK_WIDGET(ArtistEntry),           activate);
     gtk_widget_set_sensitive(GTK_WIDGET(AlbumEntry),            activate);
     gtk_widget_set_sensitive(GTK_WIDGET(YearEntry),             activate);
+    gtk_widget_set_sensitive(GTK_WIDGET(DiscEntry),             activate);
+    gtk_widget_set_sensitive(GTK_WIDGET(DiscTotalEntry),        activate);
     gtk_widget_set_sensitive(GTK_WIDGET(TrackEntryCombo),       activate);
     gtk_widget_set_sensitive(GTK_WIDGET(TrackTotalEntry),       activate);
     gtk_widget_set_sensitive(GTK_WIDGET(CommentEntry),          activate);
@@ -3132,6 +3200,7 @@
     gtk_widget_set_sensitive(GTK_WIDGET(ArtistMButton),         activate);
     gtk_widget_set_sensitive(GTK_WIDGET(AlbumMButton),          activate);
     gtk_widget_set_sensitive(GTK_WIDGET(YearMButton),           activate);
+    gtk_widget_set_sensitive(GTK_WIDGET(DiscMButton),           activate);
     gtk_widget_set_sensitive(GTK_WIDGET(TrackMButton),          activate);
     gtk_widget_set_sensitive(GTK_WIDGET(TrackMButtonSequence),  activate);
     gtk_widget_set_sensitive(GTK_WIDGET(TrackMButtonNbrFiles),  activate);
@@ -3191,6 +3260,10 @@
             if (!WRITE_ID3V2_TAG)
             {
                 // Hide specifics ID3v2 fields if not activated!
+                gtk_widget_hide(GTK_WIDGET(DiscLabel));
+                gtk_widget_hide(GTK_WIDGET(DiscEntry));
+                gtk_widget_hide(GTK_WIDGET(DiscTotalEntry));
+                gtk_widget_hide(GTK_WIDGET(DiscMButton));
                 gtk_widget_hide(GTK_WIDGET(ComposerLabel));
                 gtk_widget_hide(GTK_WIDGET(ComposerEntry));
                 gtk_widget_hide(GTK_WIDGET(ComposerMButton));
@@ -3215,6 +3288,10 @@
                 gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
             }else
             {
+                gtk_widget_show(GTK_WIDGET(DiscLabel));
+                gtk_widget_show(GTK_WIDGET(DiscEntry));
+                gtk_widget_show(GTK_WIDGET(DiscTotalEntry));
+                gtk_widget_show(GTK_WIDGET(DiscMButton));
                 gtk_widget_show(GTK_WIDGET(ComposerLabel));
                 gtk_widget_show(GTK_WIDGET(ComposerEntry));
                 gtk_widget_show(GTK_WIDGET(ComposerMButton));
@@ -3257,6 +3334,10 @@
             gtk_widget_show(GTK_WIDGET(EncodedByLabel));
             gtk_widget_show(GTK_WIDGET(EncodedByEntry));
             gtk_widget_show(GTK_WIDGET(EncodedByMButton));
+            gtk_widget_hide(GTK_WIDGET(DiscLabel));
+            gtk_widget_hide(GTK_WIDGET(DiscEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscTotalEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscMButton));
             gtk_widget_hide(GTK_WIDGET(PictureLabel));
             gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
             gtk_widget_hide(GTK_WIDGET(PictureMButton));
@@ -3284,6 +3365,10 @@
             gtk_widget_show(GTK_WIDGET(EncodedByLabel));
             gtk_widget_show(GTK_WIDGET(EncodedByEntry));
             gtk_widget_show(GTK_WIDGET(EncodedByMButton));
+            gtk_widget_hide(GTK_WIDGET(DiscLabel));
+            gtk_widget_hide(GTK_WIDGET(DiscEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscTotalEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscMButton));
             gtk_widget_hide(GTK_WIDGET(PictureLabel));
             gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
             gtk_widget_hide(GTK_WIDGET(PictureMButton));
@@ -3310,6 +3395,10 @@
             gtk_widget_show(GTK_WIDGET(EncodedByLabel));
             gtk_widget_show(GTK_WIDGET(EncodedByEntry));
             gtk_widget_show(GTK_WIDGET(EncodedByMButton));
+            gtk_widget_hide(GTK_WIDGET(DiscLabel));
+            gtk_widget_hide(GTK_WIDGET(DiscEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscTotalEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscMButton));
             gtk_widget_hide(GTK_WIDGET(PictureLabel));
             gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
             gtk_widget_hide(GTK_WIDGET(PictureMButton));
@@ -3321,6 +3410,10 @@
         
         case UNKNOWN_TAG:
         default:
+            gtk_widget_hide(GTK_WIDGET(DiscLabel));
+            gtk_widget_hide(GTK_WIDGET(DiscEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscTotalEntry));
+            gtk_widget_hide(GTK_WIDGET(DiscMButton));
             gtk_widget_hide(GTK_WIDGET(ComposerLabel));
             gtk_widget_hide(GTK_WIDGET(ComposerEntry));
             gtk_widget_hide(GTK_WIDGET(ComposerMButton));
@@ -3361,6 +3454,8 @@
     gtk_entry_set_text(GTK_ENTRY(ArtistEntry),                      "");
     gtk_entry_set_text(GTK_ENTRY(AlbumEntry),                       "");
     gtk_entry_set_text(GTK_ENTRY(YearEntry),                        "");
+    gtk_entry_set_text(GTK_ENTRY(DiscEntry),                        "");
+    gtk_entry_set_text(GTK_ENTRY(DiscTotalEntry),                   "");
     gtk_entry_set_text(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child),  "");
     gtk_entry_set_text(GTK_ENTRY(TrackTotalEntry),                  "");
     gtk_entry_set_text(GTK_ENTRY(GTK_BIN(GenreCombo)->child),       "");
diff -wurN -X dontdiff orig/easytag-1.99.3/src/easytag.h easytag-1.99.3/src/easytag.h
--- orig/easytag-1.99.3/src/easytag.h	2004-11-26 00:45:22.000000000 +0100
+++ easytag-1.99.3/src/easytag.h	2005-02-10 23:57:31.000000000 +0100
@@ -88,6 +88,8 @@
 GtkWidget    *ArtistEntry;
 GtkWidget    *AlbumEntry;
 GtkWidget    *YearEntry;
+GtkWidget    *DiscEntry;
+GtkWidget    *DiscTotalEntry;
 GtkWidget    *TrackEntryCombo;
 GtkListStore *TrackEntryComboModel;
 GtkWidget    *TrackTotalEntry;
@@ -107,6 +109,7 @@
 GtkWidget    *ArtistLabel;
 GtkWidget    *AlbumLabel;
 GtkWidget    *YearLabel;
+GtkWidget    *DiscLabel;
 GtkWidget    *TrackLabel;
 GtkWidget    *GenreLabel;
 GtkWidget    *CommentLabel;
@@ -121,6 +124,7 @@
 GtkWidget    *ArtistMButton;
 GtkWidget    *AlbumMButton;
 GtkWidget    *YearMButton;
+GtkWidget    *DiscMButton;
 GtkWidget    *TrackMButton;
 GtkWidget    *TrackMButtonSequence;
 GtkWidget    *TrackMButtonNbrFiles;
diff -wurN -X dontdiff orig/easytag-1.99.3/src/et_core.c easytag-1.99.3/src/et_core.c
--- orig/easytag-1.99.3/src/et_core.c	2004-11-29 22:32:56.000000000 +0100
+++ easytag-1.99.3/src/et_core.c	2005-02-11 00:19:07.000000000 +0100
@@ -341,6 +341,8 @@
         FileTag->title       = NULL;
         FileTag->artist      = NULL;
         FileTag->album       = NULL;
+        FileTag->disc        = NULL;
+        FileTag->disc_total  = NULL;
         FileTag->track       = NULL;
         FileTag->track_total = NULL;
         FileTag->year        = NULL;
@@ -2002,6 +2004,8 @@
     g_free(FileTag->artist);
     g_free(FileTag->album);
     g_free(FileTag->year);
+    g_free(FileTag->disc);
+    g_free(FileTag->disc_total);
     g_free(FileTag->track);
     g_free(FileTag->track_total);
     g_free(FileTag->genre);
@@ -2170,6 +2174,24 @@
         FileTag->year = NULL;
     }
 
+    if (FileTagCur->disc)
+    {
+        FileTag->disc = g_strdup(FileTagCur->disc);
+    }else
+    {
+        g_free(FileTag->disc);
+        FileTag->disc = NULL;
+    }
+
+    if (FileTagCur->disc_total)
+    {
+        FileTag->disc_total = g_strdup(FileTagCur->disc_total);
+    }else
+    {
+        g_free(FileTag->disc_total);
+        FileTag->disc_total = NULL;
+    }
+
     if (FileTagCur->track)
     {
         FileTag->track = g_strdup(FileTagCur->track);
@@ -2565,6 +2587,18 @@
     else
         gtk_entry_set_text(GTK_ENTRY(YearEntry),"");
 
+    /* Show disc */
+    if (FileTag && FileTag->disc)
+        gtk_entry_set_text(GTK_ENTRY(DiscEntry),FileTag->disc);
+    else
+        gtk_entry_set_text(GTK_ENTRY(DiscEntry),"");
+
+    /* Show number of discs in this set */
+    if (FileTag && FileTag->disc_total)
+        gtk_entry_set_text(GTK_ENTRY(DiscTotalEntry),FileTag->disc_total);
+    else
+        gtk_entry_set_text(GTK_ENTRY(DiscTotalEntry),"");
+
     /* Show track */
     if (FileTag && FileTag->track)
         gtk_entry_set_text(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child),FileTag->track);
@@ -2956,6 +2990,41 @@
         g_free(buffer);
     }
 
+    /* Disc */
+    buffer = g_strdup(gtk_entry_get_text(GTK_ENTRY(DiscEntry)));
+    Strip_String(buffer);
+
+    if ( g_utf8_strlen(buffer, -1) > 0  )
+    {
+        if (NUMBER_TRACK_FORMATED) {
+            FileTag->disc = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(buffer));
+            g_free(buffer);
+        } else
+            FileTag->disc = buffer;
+    } else
+    {
+        FileTag->disc = NULL;
+        g_free(buffer);
+    }
+
+    /* Disc Total */
+    buffer = g_strdup(gtk_entry_get_text(GTK_ENTRY(DiscTotalEntry)));
+    Strip_String(buffer);
+
+    if ( g_utf8_strlen(buffer, -1) > 0  )
+    {
+        if (NUMBER_TRACK_FORMATED)
+        {
+            FileTag->disc_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(buffer));
+            g_free(buffer);
+        } else
+            FileTag->disc_total = buffer;
+    } else
+    {
+        FileTag->disc_total = NULL;
+        g_free(buffer);
+    }
+
     /* Track */
     buffer = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)));
     Strip_String(buffer);
@@ -3163,6 +3232,40 @@
     Strip_String(FileTag->year);
 
 
+    /* Disc */
+    if ( FileTagCur->disc && g_utf8_strlen(FileTagCur->disc, -1)>0 )
+    {
+        gchar *tmp_str;
+
+        if (NUMBER_TRACK_FORMATED)
+            FileTag->disc = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(FileTagCur->disc));
+        else
+            FileTag->disc = g_strdup(FileTagCur->disc);
+        // This field must contain only digits
+        tmp_str = FileTag->disc;
+        while (isdigit(*tmp_str)) tmp_str++;
+            *tmp_str = 0;
+    } else
+    {
+        FileTag->disc = NULL;
+    }
+    Strip_String(FileTag->disc);
+
+
+    /* Disc Total */
+    if ( FileTagCur->disc_total && g_utf8_strlen(FileTagCur->disc_total, -1)>0 )
+    {
+        if (NUMBER_TRACK_FORMATED)
+            FileTag->disc_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(FileTagCur->disc_total));
+        else
+            FileTag->disc_total = g_strdup(FileTagCur->disc_total);
+    } else
+    {
+        FileTag->disc_total = NULL;
+    }
+    Strip_String(FileTag->disc_total);
+
+
     /* Track */
     if ( FileTagCur->track && g_utf8_strlen(FileTagCur->track, -1)>0 )
     {
@@ -3531,6 +3634,16 @@
     if (!FileTag1->year &&  FileTag2->year && g_utf8_strlen(FileTag2->year, -1)>0 ) return TRUE;
     if ( FileTag1->year &&  FileTag2->year && g_utf8_collate(FileTag1->year,FileTag2->year)!=0 ) return TRUE;
 
+    /* Disc */
+    if ( FileTag1->disc && !FileTag2->disc && g_utf8_strlen(FileTag1->disc, -1)>0 ) return TRUE;
+    if (!FileTag1->disc &&  FileTag2->disc && g_utf8_strlen(FileTag2->disc, -1)>0 ) return TRUE;
+    if ( FileTag1->disc &&  FileTag2->disc && g_utf8_collate(FileTag1->disc,FileTag2->disc)!=0 ) return TRUE;
+
+    /* Disc Total */
+    if ( FileTag1->disc_total && !FileTag2->disc_total && g_utf8_strlen(FileTag1->disc_total, -1)>0 ) return TRUE;
+    if (!FileTag1->disc_total &&  FileTag2->disc_total && g_utf8_strlen(FileTag2->disc_total, -1)>0 ) return TRUE;
+    if ( FileTag1->disc_total &&  FileTag2->disc_total && g_utf8_collate(FileTag1->disc_total,FileTag2->disc_total)!=0 ) return TRUE;
+
     /* Track */
     if ( FileTag1->track && !FileTag2->track && g_utf8_strlen(FileTag1->track, -1)>0 ) return TRUE;
     if (!FileTag1->track &&  FileTag2->track && g_utf8_strlen(FileTag2->track, -1)>0 ) return TRUE;
@@ -4233,6 +4346,8 @@
             g_print("|    |-> artist      : '%s'\n",((File_Tag *)filetaglist->data)->artist);
             g_print("|    |-> album       : '%s'\n",((File_Tag *)filetaglist->data)->album);
             g_print("|    |-> year        : '%s'\n",((File_Tag *)filetaglist->data)->year);
+            g_print("|    |-> disc        : '%s'\n",((File_Tag *)filetaglist->data)->disc);
+            g_print("|    |-> disc_total  : '%s'\n",((File_Tag *)filetaglist->data)->disc_total);
             g_print("|    |-> track       : '%s'\n",((File_Tag *)filetaglist->data)->track);
             g_print("|    |-> track_total : '%s'\n",((File_Tag *)filetaglist->data)->track_total);
             g_print("|    |-> genre       : '%s'\n",((File_Tag *)filetaglist->data)->genre);
diff -wurN -X dontdiff orig/easytag-1.99.3/src/et_core.h easytag-1.99.3/src/et_core.h
--- orig/easytag-1.99.3/src/et_core.h	2005-01-13 22:39:05.000000000 +0100
+++ easytag-1.99.3/src/et_core.h	2005-02-10 16:16:15.000000000 +0100
@@ -174,6 +174,8 @@
     gchar *year;           /* Year of track */
     gchar *track;          /* Position of track in the album */
     gchar *track_total;    /* The number of tracks for the album (ex: 12/20) */
+    gchar *disc;           /* disc in this set */
+    gchar *disc_total;     /* The number of discs in this set (ex: 1/3) */
     gchar *genre;          /* Genre of song */
     gchar *comment;        /* Comment */
     gchar *composer;       /* Composer */
diff -wurN -X dontdiff orig/easytag-1.99.3/src/id3_tag.c easytag-1.99.3/src/id3_tag.c
--- orig/easytag-1.99.3/src/id3_tag.c	2004-12-29 23:47:34.000000000 +0100
+++ easytag-1.99.3/src/id3_tag.c	2005-02-11 00:58:28.000000000 +0100
@@ -153,7 +153,7 @@
         if ( (id3_field = ID3Frame_GetField(id3_frame,ID3FN_TEXT)) )
         {
             //testing:check encoding
-            //id3_field_encoding = ID3Frame_GetField(id3_frame,ID3FN_TEXTENC);
+            //ID3Field *id3_field_encoding = ID3Frame_GetField(id3_frame,ID3FN_TEXTENC);
             //g_print(">>> Encoding '%d'\n",ID3Field_GetINT(id3_field_encoding));
 
             // FIX ME : 'ID3FrameInfo_NumFields' would be better...
@@ -307,6 +307,88 @@
     }
 
 
+    /********************************
+     * Disc and Total Disc (TPOS) *
+     ********************************/
+    if ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_PARTINSET)) )
+    {
+        if ( (id3_field = ID3Frame_GetField(id3_frame,ID3FN_TEXT)) )
+        {
+            if ( (num_chars=ID3Field_GetASCII_1(id3_field,string,ID3V2_MAX_STRING_LEN,field_num)) > 0
+                 && string != NULL )
+            {
+                if (USE_CHARACTER_SET_TRANSLATION)
+                {
+                    string1 = convert_string(string, FILE_CHARACTER_SET, "utf-8");
+                    string2 = strchr(string1,'/');
+                    if (NUMBER_TRACK_FORMATED)
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string2+1)); // Just to have numbers like this : '01', '05', '12', ...
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1)); // Just to have numbers like this : '01', '05', '12', ...
+                    }else
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup(string2+1);
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup(string1);
+                    }
+                    g_free(string1);
+                }else if (USE_ISO_8859_1_CHARACTER_SET_TRANSLATION)
+                {
+                    string1 = convert_string(string, "iso-8859-1", "utf-8");
+                    string2 = strchr(string1,'/');
+                    if (NUMBER_TRACK_FORMATED)
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string2+1)); // Just to have numbers like this : '01', '05', '12', ...
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1)); // Just to have numbers like this : '01', '05', '12', ...
+                    }else
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup(string2+1);
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup(string1);
+                    }
+                    g_free(string1);
+                }else
+                {
+                    string1 = convert_to_utf8(string);
+                    string2 = strchr(string,'/');
+                    if (NUMBER_TRACK_FORMATED)
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string2+1)); // Just to have numbers like this : '01', '05', '12', ...
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1)); // Just to have numbers like this : '01', '05', '12', ...
+                    }else
+                    {
+                        if (string2)
+                        {
+                            FileTag->disc_total = g_strdup(string2+1);
+                            *string2 = '\0';
+                        }
+                        FileTag->disc = g_strdup(string1);
+                        g_free(string1);
+                    }
+                }
+            }
+        }
+    }
+
+
     /****************
      * Genre (TCON) *
      ****************/
@@ -518,6 +600,7 @@
     gboolean has_artist      = 1;
     gboolean has_album       = 1;
     gboolean has_year        = 1;
+    gboolean has_disc        = 1;
     gboolean has_track       = 1;
     gboolean has_genre       = 1;
     gboolean has_comment     = 1;
@@ -648,6 +731,32 @@
 
 
     /*************************
+     * Disc and Total Disc *
+     *************************/
+    while ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_PARTINSET)) )
+        ID3Tag_RemoveFrame(id3_tag,id3_frame);
+    if (FileTag->disc && g_utf8_strlen(FileTag->disc, -1) > 0)
+    {
+        id3_frame = ID3Frame_NewID(ID3FID_PARTINSET);
+        ID3Tag_AttachFrame(id3_tag,id3_frame);
+
+        if ((id3_field = ID3Frame_GetField(id3_frame,ID3FN_TEXT)))
+        {
+            if ( FileTag->disc_total && g_utf8_strlen(FileTag->disc_total, -1) > 0)
+                string1 = g_strconcat(FileTag->disc,"/",FileTag->disc_total,NULL);
+            else
+                string1 = g_strdup(FileTag->disc);
+
+            HANDLE_TRANSLATION_SAVE(string, string1, id3_field);
+            g_free(string1);
+        }
+    } else
+    {
+        has_disc = 0;
+    }
+
+
+    /*************************
      * Track and Total Track *
      *************************/
     while ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_TRACKNUM)) )
@@ -939,7 +1048,7 @@
     if ( STRIP_TAG_WHEN_EMPTY_FIELDS
     && !has_title      && !has_artist   && !has_album       && !has_year      && !has_track
     && !has_genre      && !has_composer && !has_orig_artist && !has_copyright && !has_url
-    && !has_encoded_by && !has_picture  && !has_comment )//&& !has_song_len )
+    && !has_encoded_by && !has_picture  && !has_comment  && !has_disc)//&& !has_song_len )
     {
         error_strip_id3v1 = ID3Tag_Strip(id3_tag,ID3TT_ID3V1);
         error_strip_id3v2 = ID3Tag_Strip(id3_tag,ID3TT_ID3V2);
diff -wurN -X dontdiff orig/easytag-1.99.3/src/scan.c easytag-1.99.3/src/scan.c
--- orig/easytag-1.99.3/src/scan.c	2004-11-25 00:14:10.000000000 +0100
+++ easytag-1.99.3/src/scan.c	2005-02-11 01:00:27.000000000 +0100
@@ -1494,6 +1494,10 @@
             return &FileTag->album;
         case 'y':    /* Year */
             return &FileTag->year;
+        case 'd':    /* Disc */
+            return &FileTag->disc;
+        case 'D':    /* Disc Total */
+            return &FileTag->disc_total;
         case 'n':    /* Track */
             return &FileTag->track;
         case 'l':    /* Track Total */
@@ -2014,6 +2018,9 @@
     Label = gtk_label_new(_("%r : copyright"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,0,1,4,5);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
+    Label = gtk_label_new(_("%d : disc"));
+    gtk_table_attach_defaults(GTK_TABLE(Table),Label,0,1,5,6);
+    gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
     Label = gtk_label_new(_("%e : encoded by"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,1,2,0,1);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
@@ -2023,12 +2030,15 @@
     Label = gtk_label_new(_("%i : ignored"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,1,2,2,3);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
-    Label = gtk_label_new(_("%l : number of tracks"));
+    Label = gtk_label_new(_("%D : number of discs"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,1,2,3,4);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
-    Label = gtk_label_new(_("%o : orig. artist"));
+    Label = gtk_label_new(_("%l : number of tracks"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,1,2,4,5);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
+    Label = gtk_label_new(_("%o : orig. artist"));
+    gtk_table_attach_defaults(GTK_TABLE(Table),Label,1,2,5,6);
+    gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
     Label = gtk_label_new(_("%n : track"));
     gtk_table_attach_defaults(GTK_TABLE(Table),Label,2,3,0,1);
     gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]