diff Plugins/Input/vorbis/configure.c @ 281:e85198a7f34d trunk

[svn] Vorbis UTF-8 tag conversion patch, via Takuo Kitame <kitame@debian.org>.
author nenolod
date Mon, 12 Dec 2005 23:11:30 -0800
parents fa848bd484d8
children 592ef16386aa
line wrap: on
line diff
--- a/Plugins/Input/vorbis/configure.c	Sat Dec 10 19:12:53 2005 -0800
+++ b/Plugins/Input/vorbis/configure.c	Mon Dec 12 23:11:30 2005 -0800
@@ -36,6 +36,9 @@
     *title_desc;
 static GtkWidget *rg_switch, *rg_clip_switch, *rg_booster_switch,
     *rg_track_gain;
+/* Encoding patch */
+static GtkWidget *title_encoding_hbox, *title_encoding_enabled, *title_encoding, *title_encoding_label;
+/* Encoding patch */
 
 vorbis_config_t vorbis_cfg;
 
@@ -102,7 +105,10 @@
         vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_TRACK;
     else
         vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_ALBUM;
-
+    /* Encoding patch */
+    vorbis_cfg.title_encoding_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled));
+    vorbis_cfg.title_encoding = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_encoding)));
+    /* Encoding patch */
 
     db = bmp_cfg_db_open();
 
@@ -140,6 +146,10 @@
     bmp_cfg_db_set_int(db, "vorbis", "replaygain_mode",
                        vorbis_cfg.replaygain_mode);
     bmp_cfg_db_set_bool(db, "vorbis", "use_booster", vorbis_cfg.use_booster);
+    /* Encoding patch */
+    bmp_cfg_db_set_bool(db, "vorbis", "title_encoding_enabled", vorbis_cfg.title_encoding_enabled);
+    bmp_cfg_db_set_string(db, "vorbis", "title_encoding", vorbis_cfg.title_encoding);
+    /* Encoding patch */
     bmp_cfg_db_close(db);
     gtk_widget_destroy(vorbis_configurewin);
 }
@@ -230,6 +240,17 @@
     gtk_widget_set_sensitive(title_desc, override);
 }
 
+/* Encoding patch */
+static void
+title_encoding_enabled_cb(GtkWidget * w, gpointer data)
+{
+    gboolean encoding_enabled;
+    encoding_enabled =
+        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled));
+    gtk_widget_set_sensitive(title_encoding_hbox, encoding_enabled);
+}
+/* Encoding patch */
+
 static void
 rg_switch_cb(GtkWidget * w, gpointer data)
 {
@@ -468,6 +489,31 @@
     gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
     gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
 
+    /* Encoding patch */
+    title_encoding_enabled =
+        gtk_check_button_new_with_label(_("Convert non-UTF8 Vorbis tags to UTF8"));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_encoding_enabled),
+                                 vorbis_cfg.title_encoding_enabled);
+    g_signal_connect(G_OBJECT(title_encoding_enabled), "clicked",
+                     G_CALLBACK(title_encoding_enabled_cb), NULL);
+    gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_encoding_enabled, FALSE,
+                       FALSE, 0);
+    
+    title_encoding_hbox = gtk_hbox_new(FALSE, 5);
+    gtk_widget_set_sensitive(title_encoding_hbox, vorbis_cfg.title_encoding_enabled);
+    gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_encoding_hbox, FALSE,
+                       FALSE, 0);
+    
+    title_encoding_label = gtk_label_new(_("Vorbis encoding:"));
+    gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding_label, FALSE,
+                       FALSE, 0);
+    
+    title_encoding = gtk_entry_new();
+    gtk_entry_set_text(GTK_ENTRY(title_encoding), vorbis_cfg.title_encoding);
+    gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding, TRUE, TRUE,
+                       0);
+    /* Encoding patch */
+    
     title_tag_override =
         gtk_check_button_new_with_label(_("Override generic titles"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override),