[easytag/wip/application-window: 97/105] Move ID3 preferences page to GtkBuilder



commit 1f84b2d392f4c3a9bf372ec2f3e7bbe59ef38e8a
Author: David King <amigadave amigadave com>
Date:   Sat Aug 16 14:26:00 2014 +0100

    Move ID3 preferences page to GtkBuilder

 data/preferences_dialog.ui |  354 ++++++++++++++++++++++++++++++++++++++++++++
 src/preferences_dialog.c   |  281 ++++++-----------------------------
 2 files changed, 401 insertions(+), 234 deletions(-)
---
diff --git a/data/preferences_dialog.ui b/data/preferences_dialog.ui
index e7a55c4..245a9c9 100644
--- a/data/preferences_dialog.ui
+++ b/data/preferences_dialog.ui
@@ -491,6 +491,360 @@
             </object>
         </child>
     </object>
+    <object class="GtkGrid" id="id3_tags_grid">
+        <property name="border-width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="row-spacing">6</property>
+        <property name="visible">True</property>
+        <child>
+            <object class="GtkLabel" id="id3_tags_label">
+                <attributes>
+                    <attribute name="weight" value="bold"/>
+                </attributes>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">General</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="id3_strip_check">
+                <property name="label" translatable="yes">Strip ID3 tags if all ID3 tags are empty</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to remove the ID3 tag from the 
audio file if all the individual tag fields are empty</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkBox" id="id3_read_encoding_box">
+                <property name="margin-left">12</property>
+                <property name="spacing">12</property>
+                <property name="visible">True</property>
+                <child>
+                    <object class="GtkCheckButton" id="id3_read_encoding_check">
+                        <property name="label" translatable="yes">Non-standard encoding for reading ID3 
tags:</property>
+                        <property name="tooltip-text" translatable="yes">Whether to use a non-standard 
character encoding when reading ID3 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                </child>
+                <child>
+                    <object class="GtkComboBoxText" id="id3_read_encoding_combo">
+                        <property name="tooltip-text" translatable="yes">Choose the character set to be used 
when reading ID3v1 and ID3v2 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                </child>
+            </object>
+        </child>
+        <child>
+            <object class="GtkLabel" id="id3_v2_label">
+                <attributes>
+                    <attribute name="weight" value="bold"/>
+                </attributes>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">ID3v2</property>
+                <property name="margin-top">12</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkGrid" id="id3_v2_encoding_grid">
+                <property name="column-spacing">12</property>
+                <property name="margin-left">12</property>
+                <property name="row-spacing">6</property>
+                <property name="visible">True</property>
+                <child>
+                    <object class="GtkCheckButton" id="id3_v2_check">
+                        <property name="label" translatable="yes">Write ID3v2 tag</property>
+                        <property name="tooltip-text" translatable="yes">Whether to write ID3v2 tags when 
writing ID3 tags into audio files</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkLabel" id="id3_v2_version_label">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Version:</property>
+                        <property name="margin-left">12</property>
+                        <property name="tooltip-text" translatable="yes">Whether to write ID3v2 tags when 
writing ID3 tags into audio files</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkComboBoxText" id="id3_v2_version_combo">
+                        <items>
+                            <item id="id3v2.3">ID3v2.3</item>
+                            <item id="id3v2.4">ID3v2.4</item>
+                        </items>
+                        <property name="tooltip-text" translatable="yes">Select the ID3v2 tag version to 
write:
+• ID3v2.3 is written using id3lib,
+• ID3v2.4 is written using libid3tag (recommended)</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkLabel" id="id3_v2_encoding_label">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Character encoding:</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkRadioButton" id="id3_v2_unicode_radio">
+                        <property name="label" translatable="yes">Unicode</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkComboBoxText" id="id3_v2_unicode_encoding_combo">
+                        <items>
+                            <item id="utf-8">UTF-8</item>
+                            <item id="utf-16">UTF-16</item>
+                        </items>
+                        <property name="tooltip-text" translatable="yes">Choose the Unicode character 
encoding to be used when writing ID3v2 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkRadioButton" id="id3_v2_other_radio">
+                        <property name="group">id3_v2_unicode_radio</property>
+                        <property name="label" translatable="yes">Other</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkComboBoxText" id="id3_v2_override_encoding_combo">
+                        <property name="tooltip-text" translatable="yes">Override the standard Unicode 
character encoding to be used when writing ID3v2 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkLabel" id="id3_v2_iconv_label">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">When encoding conversion fails:</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkBox" id="id3_v2_iconv_box">
+                        <property name="spacing">12</property>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v2_none_radio">
+                                <property name="label" translatable="yes">Report error</property>
+                                <property name="name">none</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it isn't changed. But note that an error 
message will be displayed for information</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v2_transliterate_radio">
+                                <property name="group">id3_v1_none_radio</property>
+                                <property name="label" translatable="yes">Transliterate</property>
+                                <property name="name">transliterate</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it can be approximated through one or 
several similar-looking characters</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v2_ignore_radio">
+                                <property name="group">id3_v1_none_radio</property>
+                                <property name="label" translatable="yes">Discard</property>
+                                <property name="name">ignore</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it will be silently discarded</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                    </object>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">2</property>
+                    </packing>
+                </child>
+            </object>
+        </child>
+        <child>
+            <object class="GtkGrid" id="id3_v2_check_grid">
+                <property name="column-spacing">12</property>
+                <property name="margin-left">12</property>
+                <property name="row-spacing">6</property>
+                <property name="visible">True</property>
+                <child>
+                    <object class="GtkCheckButton" id="id3_v2_convert_check">
+                        <property name="label" translatable="yes">Automatically convert old ID3v2 tag 
versions</property>
+                        <property name="tooltip-text" translatable="yes">Whether to convert ID3 tags written 
against old version of the specification, such as ID3v2.2, to newer ones, such as ID3v2.3 or 
ID3v2.4</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkCheckButton" id="id3_v2_crc32_check">
+                        <property name="label" translatable="yes">Use CRC32</property>
+                        <property name="tooltip-text" translatable="yes">Whether to embed a CRC-32 checksum 
of the audio file data in ID3v2 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkCheckButton" id="id3_v2_compression_check">
+                        <property name="label" translatable="yes">Compress data in ID3v2 tags</property>
+                        <property name="tooltip-text" translatable="yes">Whether to compress data in ID3v2 
tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkCheckButton" id="id3_v2_genre_check">
+                        <property name="label" translatable="yes">Use text-only genre in ID3v2 
tags</property>
+                        <property name="tooltip-text" translatable="yes">Whether to use only a string, and 
not the integer-base ID3v1 genre field, when writing a genre field to ID3v2 tags</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+            </object>
+        </child>
+        <child>
+            <object class="GtkLabel" id="id3_v1_label">
+                <attributes>
+                    <attribute name="weight" value="bold"/>
+                </attributes>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">ID3v1</property>
+                <property name="margin-top">12</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="id3_v1_check">
+                <property name="label" translatable="yes">Write ID3v1 tag</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to write ID3v1 tags when writing 
ID3 tags into audio files</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkGrid" id="id3_v1_encoding_grid">
+                <property name="column-spacing">12</property>
+                <property name="margin-left">12</property>
+                <property name="row-spacing">6</property>
+                <property name="visible">True</property>
+                <child>
+                    <object class="GtkLabel" id="id3_v1_encoding_label">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Character encoding:</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkComboBoxText" id="id3_v1_encoding_combo">
+                        <property name="tooltip-text" translatable="yes">Choose the character set to be used 
when writing ID3v1 tag</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkLabel" id="id3_v1_iconv_label">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">When encoding conversion fails:</property>
+                        <property name="visible">True</property>
+                    </object>
+                    <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                    </packing>
+                </child>
+                <child>
+                    <object class="GtkBox" id="id3_v1_iconv_box">
+                        <property name="spacing">12</property>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v1_none_radio">
+                                <property name="label" translatable="yes">Report error</property>
+                                <property name="name">none</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it isn't changed. But note that an error 
message will be displayed for information</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v1_transliterate_radio">
+                                <property name="group">id3_v1_none_radio</property>
+                                <property name="label" translatable="yes">Transliterate</property>
+                                <property name="name">transliterate</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it can be approximated through one or 
several similar-looking characters</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                        <child>
+                            <object class="GtkRadioButton" id="id3_v1_ignore_radio">
+                                <property name="group">id3_v1_none_radio</property>
+                                <property name="label" translatable="yes">Discard</property>
+                                <property name="name">ignore</property>
+                                <property name="tooltip-text" translatable="yes">With this option, when a 
character cannot be represented in the target character encoding, it will be silently discarded</property>
+                                <property name="visible">True</property>
+                            </object>
+                        </child>
+                    </object>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">2</property>
+                    </packing>
+                </child>
+            </object>
+        </child>
+    </object>
     <object class="GtkGrid" id="scanner_grid">
         <property name="border-width">12</property>
         <property name="orientation">vertical</property>
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 4e5ac17..0d606c1 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -54,10 +54,10 @@ struct _EtPreferencesDialogPrivate
     GtkListStore *default_path_model;
     GtkListStore *file_player_model;
 
-    GtkWidget *LabelAdditionalId3v1IconvOptions;
+    GtkWidget *id3_v1_encoding_grid;
+
     GtkWidget *LabelAdditionalId3v2IconvOptions;
     GtkWidget *LabelId3v2Charset;
-    GtkWidget *LabelId3v1Charset;
     GtkWidget *LabelId3v2Version;
     GtkWidget *FileWritingId3v2VersionCombo;
     GtkWidget *FileWritingId3v2UseUnicodeCharacterSet;
@@ -218,7 +218,7 @@ create_preferences_dialog (EtPreferencesDialog *self)
     GtkWidget *Frame;
     GtkWidget *Table;
     GtkWidget *VBox, *vbox;
-    GtkWidget *hbox, *id3v1v2hbox;
+    GtkWidget *hbox;
     GtkWidget *LoadOnStartup;
     GtkWidget *BrowseSubdir;
     GtkWidget *OpenSelectedBrowserNode;
@@ -579,114 +579,59 @@ create_preferences_dialog (EtPreferencesDialog *self)
     /*
      * ID3 Tag Settings
      */
-    Label = gtk_label_new (_("ID3 Tag Settings"));
-    VBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    Label = gtk_label_new (_("ID3 Tags"));
+    VBox = GTK_WIDGET (gtk_builder_get_object (builder, "id3_tags_grid"));
 #ifdef ENABLE_MP3
     gtk_notebook_append_page (GTK_NOTEBOOK (priv->options_notebook), VBox, Label);
 #endif
-    gtk_container_set_border_width (GTK_CONTAINER (VBox), BOX_SPACING);
-
-
-    /* Tag Rules frame */
-    Frame = gtk_frame_new (_("ID3 Tag Rules"));
-    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,FALSE,0);
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),vbox);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
-
-    Table = et_grid_new (3, 2);
-    gtk_box_pack_start(GTK_BOX(vbox),Table,FALSE,FALSE,0);
-    gtk_grid_set_row_spacing (GTK_GRID (Table), BOX_SPACING);
-    gtk_grid_set_column_spacing (GTK_GRID (Table), BOX_SPACING);
 
     /* Strip tag when fields (managed by EasyTAG) are empty */
-    StripTagWhenEmptyFields = gtk_check_button_new_with_label (_("Strip ID3 tags if all ID3 tags are 
empty"));
-    gtk_grid_attach (GTK_GRID (Table), StripTagWhenEmptyFields, 0, 0, 1, 1);
+    StripTagWhenEmptyFields = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                  "id3_strip_check"));
     g_settings_bind (MainSettings, "id3-strip-empty", StripTagWhenEmptyFields,
                      "active", G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (StripTagWhenEmptyFields,
-                                 _("Whether to remove the ID3 tag from the audio file if all the individual 
tag fields are empty"));
 
     /* Convert old ID3v2 tag version */
-    priv->ConvertOldId3v2TagVersion = gtk_check_button_new_with_label (_("Automatically convert old ID3v2 
tag versions"));
-    gtk_grid_attach (GTK_GRID (Table), priv->ConvertOldId3v2TagVersion, 0, 1, 1, 1);
+    priv->ConvertOldId3v2TagVersion = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                          "id3_v2_convert_check"));
     g_settings_bind (MainSettings, "id3v2-convert-old",
                      priv->ConvertOldId3v2TagVersion, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (priv->ConvertOldId3v2TagVersion,
-                                 _("Whether to convert ID3 tags written against old version of the 
specification, such as ID3v2.2, to newer ones, such as ID3v2.3 or ID3v2.4"));
 
     /* Use CRC32 */
-    priv->FileWritingId3v2UseCrc32 = gtk_check_button_new_with_label (_("Use CRC32"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2UseCrc32, 1, 0, 1, 1);
+    priv->FileWritingId3v2UseCrc32 = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                         "id3_v2_crc32_check"));
     g_settings_bind (MainSettings, "id3v2-crc32", priv->FileWritingId3v2UseCrc32,
                      "active", G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2UseCrc32,
-                                 _("Whether to embed a CRC-32 checksum of the audio file data in ID3v2 
tags"));
 
     /* Use Compression */
-    priv->FileWritingId3v2UseCompression = gtk_check_button_new_with_label (_("Compress data in ID3v2 
tags"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2UseCompression, 1, 1, 1,
-                     1);
+    priv->FileWritingId3v2UseCompression = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                               "id3_v2_compression_check"));
     g_settings_bind (MainSettings, "id3v2-compression",
                      priv->FileWritingId3v2UseCompression, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2UseCompression,
-                                 _("Whether to compress data in ID3v2 tags"));
        
     /* Write Genre in text */
-    priv->FileWritingId3v2TextOnlyGenre = gtk_check_button_new_with_label (_("Use text-only genre in ID3v2 
tags"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2TextOnlyGenre, 0, 2, 1,
-                     1);
+    priv->FileWritingId3v2TextOnlyGenre = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                              "id3_v2_genre_check"));
     g_settings_bind (MainSettings, "id3v2-text-only-genre",
                      priv->FileWritingId3v2TextOnlyGenre, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2TextOnlyGenre,
-                                 _("Whether to use only a string, and not the integer-base ID3v1 genre 
field, when writing a genre field to ID3v2 tags"));     
-
-    /* Character Set for writing ID3 tag */
-    Frame = gtk_frame_new (_("Character Set for writing ID3 tags"));
-    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,FALSE,0);
-    id3v1v2hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),id3v1v2hbox);
-    gtk_container_set_border_width (GTK_CONTAINER (id3v1v2hbox), BOX_SPACING);
-
-    // ID3v2 tags
-    Frame = gtk_frame_new (_("ID3v2 tags"));
-    gtk_box_pack_start(GTK_BOX(id3v1v2hbox),Frame,FALSE,FALSE,2);
-
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),vbox);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
-
-    Table = et_grid_new (8, 6);
-    gtk_box_pack_start(GTK_BOX(vbox),Table,FALSE,FALSE,0);
-    gtk_grid_set_row_spacing (GTK_GRID (Table), BOX_SPACING);
-    gtk_grid_set_column_spacing (GTK_GRID (Table), BOX_SPACING);
 
     /* Write ID3v2 tag */
-    FileWritingId3v2WriteTag = gtk_check_button_new_with_label(_("Write ID3v2 tag"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2WriteTag, 0, 0, 5, 1);
+    FileWritingId3v2WriteTag = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                   "id3_v2_check"));
     g_settings_bind (MainSettings, "id3v2-enabled", FileWritingId3v2WriteTag,
                      "active", G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (FileWritingId3v2WriteTag,
-                                 _("Whether to write ID3v2 tags when writing ID3 tags into audio files"));
     g_signal_connect_after (FileWritingId3v2WriteTag, "toggled",
                             G_CALLBACK (Change_Id3_Settings_Toggled), self);
 
 #ifdef ENABLE_ID3LIB
     /* ID3v2 tag version */
-    priv->LabelId3v2Version = gtk_label_new (_("Version:"));
-    gtk_grid_attach (GTK_GRID (Table), priv->LabelId3v2Version, 0, 1, 2, 1);
-    gtk_widget_set_halign (priv->LabelId3v2Version, GTK_ALIGN_START);
-
-    priv->FileWritingId3v2VersionCombo = gtk_combo_box_text_new ();
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2VersionCombo,
-                                 _("Select the ID3v2 tag version to write:\n"
-                                   " - ID3v2.3 is written using id3lib,\n"
-                                   " - ID3v2.4 is written using libid3tag (recommended)."));
-    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->FileWritingId3v2VersionCombo), "ID3v2.4");
-    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->FileWritingId3v2VersionCombo), "ID3v2.3");
+    priv->LabelId3v2Version = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                  "id3_v2_version_label"));
+    priv->FileWritingId3v2VersionCombo = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                             "id3_v2_version_combo"));
     g_settings_bind_with_mapping (MainSettings, "id3v2-version-4",
                                   priv->FileWritingId3v2VersionCombo, "active",
                                   G_SETTINGS_BIND_DEFAULT,
@@ -695,60 +640,33 @@ create_preferences_dialog (EtPreferencesDialog *self)
                                   NULL);
     g_signal_connect_after (priv->FileWritingId3v2VersionCombo, "changed",
                             G_CALLBACK (Change_Id3_Settings_Toggled), self);
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2VersionCombo, 2, 1, 2,
-                     1);
 #endif
 
-
     /* Charset */
-    priv->LabelId3v2Charset = gtk_label_new (_("Charset:"));
-    gtk_grid_attach (GTK_GRID (Table), priv->LabelId3v2Charset, 0, 2, 5, 1);
-    gtk_widget_set_halign (priv->LabelId3v2Charset, GTK_ALIGN_START);
-
+    priv->LabelId3v2Charset = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                  "id3_v2_encoding_label"));
     /* Unicode. */
-    priv->FileWritingId3v2UseUnicodeCharacterSet = gtk_radio_button_new_with_label (NULL, _("Unicode "));
+    priv->FileWritingId3v2UseUnicodeCharacterSet = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_unicode_radio"));
     g_settings_bind (MainSettings, "id3v2-enable-unicode",
                      priv->FileWritingId3v2UseUnicodeCharacterSet, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2UseUnicodeCharacterSet,
-                     1, 3, 1, 1);
-
-    priv->FileWritingId3v2UnicodeCharacterSetCombo = gtk_combo_box_text_new ();
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2UnicodeCharacterSetCombo,
-                                 _("Choose the Unicode character set to be used when writing ID3v2 tags"));
-    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->FileWritingId3v2UnicodeCharacterSetCombo),
-                                    "UTF-8");
-    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->FileWritingId3v2UnicodeCharacterSetCombo),
-                                    "UTF-16");
+
+    priv->FileWritingId3v2UnicodeCharacterSetCombo = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_unicode_encoding_combo"));
     g_settings_bind_with_mapping (MainSettings, "id3v2-unicode-charset",
                                   priv->FileWritingId3v2UnicodeCharacterSetCombo,
                                   "active", G_SETTINGS_BIND_DEFAULT,
                                   et_preferences_id3v2_unicode_charset_get,
                                   et_preferences_id3v2_unicode_charset_set,
                                   NULL, NULL);
-    gtk_grid_attach (GTK_GRID (Table),
-                     priv->FileWritingId3v2UnicodeCharacterSetCombo, 2, 3, 2,
-                     1);
     g_signal_connect_after (priv->FileWritingId3v2UseUnicodeCharacterSet, "toggled",
                             G_CALLBACK (Change_Id3_Settings_Toggled), self);
 
     /* Non-Unicode. */
-    priv->FileWritingId3v2UseNoUnicodeCharacterSet = gtk_radio_button_new_with_label(
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(priv->FileWritingId3v2UseUnicodeCharacterSet)),
-        _("Other"));
-    gtk_grid_attach (GTK_GRID (Table),
-                     priv->FileWritingId3v2UseNoUnicodeCharacterSet, 1, 4, 1, 1);
-
-    priv->FileWritingId3v2NoUnicodeCharacterSetCombo = gtk_combo_box_text_new();
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2NoUnicodeCharacterSetCombo,
-                                 _("Override the typical Unicode character set to be used when writing ID3v2 
tags"));
-
+    priv->FileWritingId3v2NoUnicodeCharacterSetCombo = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_override_encoding_combo"));
     Charset_Populate_Combobox (GTK_COMBO_BOX (priv->FileWritingId3v2NoUnicodeCharacterSetCombo), 
                                g_settings_get_enum (MainSettings,
                                                     "id3v2-no-unicode-charset"));
-    gtk_grid_attach (GTK_GRID (Table),
-                     priv->FileWritingId3v2NoUnicodeCharacterSetCombo, 2, 4, 3,
-                     1);
+    priv->FileWritingId3v2UseNoUnicodeCharacterSet = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_other_radio"));
     g_signal_connect_after (priv->FileWritingId3v2UseNoUnicodeCharacterSet,
                             "toggled",
                             G_CALLBACK (Change_Id3_Settings_Toggled), self);
@@ -759,38 +677,11 @@ create_preferences_dialog (EtPreferencesDialog *self)
                                   GSIZE_TO_POINTER (ET_TYPE_CHARSET), NULL);
     
     /* ID3v2 Additional iconv() options. */
-    priv->LabelAdditionalId3v2IconvOptions = gtk_label_new (_("Additional settings for iconv():"));
-    gtk_grid_attach (GTK_GRID (Table), priv->LabelAdditionalId3v2IconvOptions,
-                     2, 5, 3, 1);
-    gtk_widget_set_halign (priv->LabelAdditionalId3v2IconvOptions,
-                           GTK_ALIGN_START);
-
-    priv->FileWritingId3v2IconvOptionsNo = gtk_radio_button_new_with_label (NULL,
-                                                                            _("No"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsNo, 2, 6, 1,
-                     1);
-    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsNo, "none");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsNo, _("With this option, when "
-        "a character cannot be represented in the target character set, it isn't changed. "
-        "But note that an error message will be displayed for information."));
-    priv->FileWritingId3v2IconvOptionsTranslit = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v2IconvOptionsNo)),
-        _("//TRANSLIT"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsTranslit, 3,
-                     6, 1, 1);
-    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsTranslit,
-                         "transliterate");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsTranslit, _("With this option, when "
-        "a character cannot be represented in the target character set, it can be "
-        "approximated through one or several similarly looking characters."));
-
-    priv->FileWritingId3v2IconvOptionsIgnore = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v2IconvOptionsNo)),
-        _("//IGNORE"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsIgnore, 4,
-                     6, 1, 1);
-    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsIgnore, "ignore");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsIgnore, _("With this option, when "
-        "a character cannot be represented in the target character set, it will "
-        "be silently discarded."));
+    priv->LabelAdditionalId3v2IconvOptions = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_iconv_label"));
+    priv->FileWritingId3v2IconvOptionsNo = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                               "id3_v2_none_radio"));
+    priv->FileWritingId3v2IconvOptionsTranslit = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_transliterate_radio")),
+    priv->FileWritingId3v2IconvOptionsIgnore = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v2_ignore_radio"));
 
     g_settings_bind_with_mapping (MainSettings, "id3v2-encoding-option",
                                   priv->FileWritingId3v2IconvOptionsNo, "active",
@@ -811,40 +702,18 @@ create_preferences_dialog (EtPreferencesDialog *self)
                                   et_settings_enum_radio_set,
                                   priv->FileWritingId3v2IconvOptionsIgnore, NULL);
 
-    // ID3v1 tags
-    Frame = gtk_frame_new (_("ID3v1 tags"));
-    gtk_box_pack_start(GTK_BOX(id3v1v2hbox),Frame,FALSE,FALSE,2);
-
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),vbox);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
-
-    Table = et_grid_new (6, 5);
-    gtk_box_pack_start(GTK_BOX(vbox),Table,FALSE,FALSE,0);
-    gtk_grid_set_row_spacing (GTK_GRID (Table), BOX_SPACING);
-    gtk_grid_set_column_spacing (GTK_GRID (Table), BOX_SPACING);
-
-
     /* Write ID3v1 tag */
-    FileWritingId3v1WriteTag = gtk_check_button_new_with_label(_("Write ID3v1.x tag"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v1WriteTag, 0, 0, 4, 1);
+    FileWritingId3v1WriteTag = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                   "id3_v1_check"));
     g_settings_bind (MainSettings, "id3v1-enabled", FileWritingId3v1WriteTag,
                      "active", G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (FileWritingId3v1WriteTag,
-                                 _("Whether to write ID3v1 tags when writing ID3 tags into audio files"));
     g_signal_connect_after (FileWritingId3v1WriteTag, "toggled",
                             G_CALLBACK (Change_Id3_Settings_Toggled), self);
 
+    priv->id3_v1_encoding_grid = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                     "id3_v1_encoding_grid"));
     /* Id3V1 writing character set */
-    priv->LabelId3v1Charset = gtk_label_new (_("Charset:"));
-    gtk_grid_attach (GTK_GRID (Table), priv->LabelId3v1Charset, 0, 1, 4, 1);
-    gtk_widget_set_halign (priv->LabelId3v1Charset, GTK_ALIGN_START);
-
-    priv->FileWritingId3v1CharacterSetCombo = gtk_combo_box_text_new();
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1CharacterSetCombo,
-                     1, 2, 3, 1);
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v1CharacterSetCombo,
-                                 _("Choose the character set to be used when writing ID3v1 tag"));
+    priv->FileWritingId3v1CharacterSetCombo = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v1_encoding_combo"));
     Charset_Populate_Combobox (GTK_COMBO_BOX (priv->FileWritingId3v1CharacterSetCombo),
                                g_settings_get_enum (MainSettings,
                                                     "id3v1-charset"));
@@ -855,38 +724,10 @@ create_preferences_dialog (EtPreferencesDialog *self)
                                   GSIZE_TO_POINTER (ET_TYPE_CHARSET), NULL);
 
     /* ID3V1 Additional iconv() options*/
-    priv->LabelAdditionalId3v1IconvOptions = gtk_label_new (_("Additional settings for iconv():"));
-    gtk_grid_attach (GTK_GRID (Table), priv->LabelAdditionalId3v1IconvOptions,
-                     1, 3, 3, 1);
-    gtk_widget_set_halign (priv->LabelAdditionalId3v1IconvOptions,
-                           GTK_ALIGN_START);
-
-    priv->FileWritingId3v1IconvOptionsNo = gtk_radio_button_new_with_label (NULL,
-                                                                            _("No"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsNo, 1, 4, 1,
-                     1);
-    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsNo, "none");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsNo, _("With this option, when "
-        "a character cannot be represented in the target character set, it isn't changed. "
-        "But note that an error message will be displayed for information."));
-    priv->FileWritingId3v1IconvOptionsTranslit = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v1IconvOptionsNo)),
-        _("//TRANSLIT"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsTranslit, 2,
-                     4, 1, 1);
-    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsTranslit,
-                         "transliterate");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsTranslit,_("With this option, when "
-        "a character cannot be represented in the target character set, it can be "
-        "approximated through one or several similarly looking characters."));
-
-    priv->FileWritingId3v1IconvOptionsIgnore = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v1IconvOptionsNo)),
-        _("//IGNORE"));
-    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsIgnore, 3,
-                     4, 1, 1);
-    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsIgnore, "ignore");
-    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsIgnore, _("With this option, when "
-        "a character cannot be represented in the target character set, it will "
-        "be silently discarded."));
+    priv->FileWritingId3v1IconvOptionsNo = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                               "id3_v1_none_radio"));
+    priv->FileWritingId3v1IconvOptionsTranslit = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v1_transliterate_radio"));
+    priv->FileWritingId3v1IconvOptionsIgnore = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_v1_ignore_radio"));
 
     g_settings_bind_with_mapping (MainSettings, "id3v1-encoding-option",
                                   priv->FileWritingId3v1IconvOptionsNo, "active",
@@ -908,36 +749,14 @@ create_preferences_dialog (EtPreferencesDialog *self)
                                   priv->FileWritingId3v1IconvOptionsIgnore, NULL);
 
     /* Character Set for reading tag */
-    Frame = gtk_frame_new (_("Character Set for reading ID3 tags"));
-    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,FALSE,0);
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),vbox);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
-
-    Table = et_grid_new(4,2);
-    gtk_box_pack_start(GTK_BOX(vbox),Table,FALSE,FALSE,0);
-    //gtk_container_set_border_width(GTK_CONTAINER(Table), 2);
-    /*gtk_grid_set_row_spacing (GTK_GRID (Table), 2);*/
-    gtk_grid_set_column_spacing (GTK_GRID (Table), BOX_SPACING);
-
-    // "File Reading Charset" Check Button + Combo
-    UseNonStandardId3ReadingCharacterSet = gtk_check_button_new_with_label(_(
-        "Non-standard:"));
+    /* "File Reading Charset" Check Button + Combo. */
+    UseNonStandardId3ReadingCharacterSet = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                               "id3_read_encoding_check"));
     g_settings_bind (MainSettings, "id3-override-read-encoding",
                      UseNonStandardId3ReadingCharacterSet, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_grid_attach (GTK_GRID (Table), UseNonStandardId3ReadingCharacterSet, 0,
-                     0, 1, 1);
-    gtk_widget_set_tooltip_text (UseNonStandardId3ReadingCharacterSet,
-                                 _("Whether to use a non-standard character encoding when reading ID3 
tags"));
-
-    priv->FileReadingId3v1v2CharacterSetCombo = gtk_combo_box_text_new();
-    gtk_grid_attach (GTK_GRID (Table),
-                     priv->FileReadingId3v1v2CharacterSetCombo, 2, 0, 1, 1);
-
-    gtk_widget_set_tooltip_text (priv->FileReadingId3v1v2CharacterSetCombo,
-                                 _("Choose the character set to be used when reading ID3v1 and ID3v2 tags"));
 
+    priv->FileReadingId3v1v2CharacterSetCombo = GTK_WIDGET (gtk_builder_get_object (builder, 
"id3_read_encoding_combo"));
     Charset_Populate_Combobox (GTK_COMBO_BOX (priv->FileReadingId3v1v2CharacterSetCombo),
                                g_settings_get_enum (MainSettings,
                                                     "id3v1v2-charset"));
@@ -951,7 +770,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
                      G_SETTINGS_BIND_DEFAULT);
     Change_Id3_Settings_Toggled (NULL, self);
 
-
     /*
      * Scanner
      */
@@ -1383,12 +1201,7 @@ Change_Id3_Settings_Toggled (GtkWidget *blah, EtPreferencesDialog *self)
 
     active = g_settings_get_boolean (MainSettings, "id3v1-enabled");
 
-    gtk_widget_set_sensitive (priv->LabelId3v1Charset, active);
-    gtk_widget_set_sensitive (priv->FileWritingId3v1CharacterSetCombo, active);
-    gtk_widget_set_sensitive (priv->LabelAdditionalId3v1IconvOptions, active);
-    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsNo, active);
-    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsTranslit, active);
-    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsIgnore, active);
+    gtk_widget_set_sensitive (priv->id3_v1_encoding_grid, active);
 }
 
 /*



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