diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-14 12:08:19 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-14 12:08:19 +0200 |
commit | 9b2786d392c7dd0ef1c86c70bf47c02cdafefe77 (patch) | |
tree | 240755ac64d4a79a79a4129492656d5c40a83582 /plugins/gtkui | |
parent | 718c8cb8d796353565033231e1bd5f8f55e29f05 (diff) |
made shift-jis detector optional and configurable
Diffstat (limited to 'plugins/gtkui')
-rw-r--r-- | plugins/gtkui/callbacks.h | 4 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 20 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 9 | ||||
-rw-r--r-- | plugins/gtkui/prefwin.c | 12 |
4 files changed, 45 insertions, 0 deletions
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index 23745f0f..cd5d35fb 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -1301,3 +1301,7 @@ gboolean on_mainwin_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data); + +void +on_enable_shift_jis_recoding_toggled (GtkToggleButton *togglebutton, + gpointer user_data); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 967b97b3..f4bb6c8e 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -3242,6 +3242,26 @@ Album</property> </child> <child> + <widget class="GtkCheckButton" id="enable_shift_jis_recoding"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable Japanese SHIFT-JIS detection and recoding</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_enable_shift_jis_recoding_toggled" last_modification_time="Sat, 14 Jun 2014 10:01:09 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkCheckButton" id="enable_cp1251_recoding"> <property name="visible">True</property> <property name="can_focus">True</property> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index d75ff742..3f70035a 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -1539,6 +1539,7 @@ create_prefwin (void) GtkWidget *vbox9; GtkWidget *pref_close_send_to_tray; GtkWidget *hide_tray_icon; + GtkWidget *enable_shift_jis_recoding; GtkWidget *enable_cp1251_recoding; GtkWidget *enable_cp936_recoding; GtkWidget *hbox102; @@ -1943,6 +1944,10 @@ create_prefwin (void) gtk_widget_show (hide_tray_icon); gtk_box_pack_start (GTK_BOX (vbox9), hide_tray_icon, FALSE, FALSE, 0); + enable_shift_jis_recoding = gtk_check_button_new_with_mnemonic (_("Enable Japanese SHIFT-JIS detection and recoding")); + gtk_widget_show (enable_shift_jis_recoding); + gtk_box_pack_start (GTK_BOX (vbox9), enable_shift_jis_recoding, FALSE, FALSE, 0); + enable_cp1251_recoding = gtk_check_button_new_with_mnemonic (_("Enable Russian CP1251 detection and recoding")); gtk_widget_show (enable_cp1251_recoding); gtk_box_pack_start (GTK_BOX (vbox9), enable_cp1251_recoding, FALSE, FALSE, 0); @@ -2700,6 +2705,9 @@ create_prefwin (void) g_signal_connect ((gpointer) hide_tray_icon, "toggled", G_CALLBACK (on_hide_tray_icon_toggled), NULL); + g_signal_connect ((gpointer) enable_shift_jis_recoding, "toggled", + G_CALLBACK (on_enable_shift_jis_recoding_toggled), + NULL); g_signal_connect ((gpointer) enable_cp1251_recoding, "toggled", G_CALLBACK (on_enable_cp1251_recoding_toggled), NULL); @@ -2904,6 +2912,7 @@ create_prefwin (void) GLADE_HOOKUP_OBJECT (prefwin, vbox9, "vbox9"); GLADE_HOOKUP_OBJECT (prefwin, pref_close_send_to_tray, "pref_close_send_to_tray"); GLADE_HOOKUP_OBJECT (prefwin, hide_tray_icon, "hide_tray_icon"); + GLADE_HOOKUP_OBJECT (prefwin, enable_shift_jis_recoding, "enable_shift_jis_recoding"); GLADE_HOOKUP_OBJECT (prefwin, enable_cp1251_recoding, "enable_cp1251_recoding"); GLADE_HOOKUP_OBJECT (prefwin, enable_cp936_recoding, "enable_cp936_recoding"); GLADE_HOOKUP_OBJECT (prefwin, hbox102, "hbox102"); diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index 970dc42b..ed05525a 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -231,6 +231,9 @@ gtkui_run_preferences_dlg (void) { // resume last session gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "resume_last_session")), deadbeef->conf_get_int ("resume_last_session", 0)); + // enable shift-jis recoding + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "enable_shift_jis_recoding")), deadbeef->conf_get_int ("junk.enable_shift_jis_detection", 0)); + // enable cp1251 recoding gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "enable_cp1251_recoding")), deadbeef->conf_get_int ("junk.enable_cp1251_detection", 1)); @@ -924,6 +927,15 @@ on_resume_last_session_toggled (GtkToggleButton *togglebutton, } void +on_enable_shift_jis_recoding_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + int active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)); + deadbeef->conf_set_int ("junk.enable_shift_jis_detection", active); + deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); +} + +void on_enable_cp1251_recoding_toggled (GtkToggleButton *togglebutton, gpointer user_data) { |