Mercurial > audlegacy
comparison audacious/prefswin.c @ 1105:4be4d74db123 trunk
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
author | yaz |
---|---|
date | Sat, 27 May 2006 11:02:08 -0700 |
parents | 00442fab8cc3 |
children | 95365899992e |
comparison
equal
deleted
inserted
replaced
1104:c2fc86e40fba | 1105:4be4d74db123 |
---|---|
1856 db = bmp_cfg_db_open(); | 1856 db = bmp_cfg_db_open(); |
1857 bmp_cfg_db_set_string(db, NULL, "skin", path); | 1857 bmp_cfg_db_set_string(db, NULL, "skin", path); |
1858 bmp_cfg_db_close(db); | 1858 bmp_cfg_db_close(db); |
1859 } | 1859 } |
1860 | 1860 |
1861 } | |
1862 | |
1863 static void | |
1864 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) | |
1865 { | |
1866 ConfigDb *db; | |
1867 gint position; | |
1868 | |
1869 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); | |
1870 cfg.chardet_detector = (char *)chardet_detector_presets[position]; | |
1871 | |
1872 db = bmp_cfg_db_open(); | |
1873 bmp_cfg_db_set_string(db, NULL, "chardet_detector", cfg.chardet_detector); | |
1874 bmp_cfg_db_close(db); | |
1875 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); | |
1876 } | |
1877 | |
1878 static void | |
1879 on_chardet_detector_cbox_realize(GtkComboBox *combobox, gpointer data) | |
1880 { | |
1881 ConfigDb *db; | |
1882 gchar *ret=NULL; | |
1883 guint i=0,index=0; | |
1884 | |
1885 db = bmp_cfg_db_open(); | |
1886 if(bmp_cfg_db_get_string(db, NULL, "chardet_detector", &ret) != FALSE) { | |
1887 for(i=0; i<n_chardet_detector_presets; i++) { | |
1888 gtk_combo_box_append_text(combobox, chardet_detector_presets[i]); | |
1889 if(!strcmp(chardet_detector_presets[i], ret)) { | |
1890 cfg.chardet_detector = (char *)chardet_detector_presets[i]; | |
1891 index = i; | |
1892 } | |
1893 } | |
1894 } | |
1895 #ifdef USE_CHARDET | |
1896 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); | |
1897 gtk_widget_set_sensitive(GTK_WIDGET(data), 1); | |
1898 g_signal_connect(combobox, "changed", | |
1899 G_CALLBACK(on_chardet_detector_cbox_changed), NULL); | |
1900 #else | |
1901 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), -1); | |
1902 gtk_widget_set_sensitive(GTK_WIDGET(combobox), 0); | |
1903 #endif | |
1904 if(ret) | |
1905 g_free(ret); | |
1906 } | |
1907 | |
1908 static void | |
1909 on_chardet_fallback_realize(GtkEntry *entry, gpointer data) | |
1910 { | |
1911 ConfigDb *db; | |
1912 gchar *ret; | |
1913 | |
1914 db = bmp_cfg_db_open(); | |
1915 | |
1916 if (bmp_cfg_db_get_string(db, NULL, "chardet_fallback", &ret) != FALSE) { | |
1917 if(cfg.chardet_fallback) | |
1918 g_free(cfg.chardet_fallback); | |
1919 cfg.chardet_fallback = ret; | |
1920 gtk_entry_set_text(entry, cfg.chardet_fallback); | |
1921 } | |
1922 bmp_cfg_db_close(db); | |
1923 } | |
1924 | |
1925 static void | |
1926 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) | |
1927 { | |
1928 ConfigDb *db; | |
1929 gchar *ret; | |
1930 | |
1931 ret = g_strdup(gtk_entry_get_text(entry)); | |
1932 | |
1933 if(cfg.chardet_fallback) | |
1934 g_free(cfg.chardet_fallback); | |
1935 cfg.chardet_fallback = ret; | |
1936 | |
1937 db = bmp_cfg_db_open(); | |
1938 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); | |
1939 bmp_cfg_db_close(db); | |
1861 } | 1940 } |
1862 | 1941 |
1863 /* FIXME: complete the map */ | 1942 /* FIXME: complete the map */ |
1864 FUNC_MAP_BEGIN(prefswin_func_map) | 1943 FUNC_MAP_BEGIN(prefswin_func_map) |
1865 FUNC_MAP_ENTRY(on_input_plugin_view_realize) | 1944 FUNC_MAP_ENTRY(on_input_plugin_view_realize) |
1920 FUNC_MAP_ENTRY(on_proxy_port_changed) | 1999 FUNC_MAP_ENTRY(on_proxy_port_changed) |
1921 FUNC_MAP_ENTRY(on_proxy_user_realize) | 2000 FUNC_MAP_ENTRY(on_proxy_user_realize) |
1922 FUNC_MAP_ENTRY(on_proxy_user_changed) | 2001 FUNC_MAP_ENTRY(on_proxy_user_changed) |
1923 FUNC_MAP_ENTRY(on_proxy_pass_realize) | 2002 FUNC_MAP_ENTRY(on_proxy_pass_realize) |
1924 FUNC_MAP_ENTRY(on_proxy_pass_changed) | 2003 FUNC_MAP_ENTRY(on_proxy_pass_changed) |
2004 FUNC_MAP_ENTRY(on_chardet_detector_cbox_realize) | |
2005 FUNC_MAP_ENTRY(on_chardet_detector_cbox_changed) | |
2006 FUNC_MAP_ENTRY(on_chardet_fallback_realize) | |
2007 FUNC_MAP_ENTRY(on_chardet_fallback_changed) | |
1925 FUNC_MAP_END | 2008 FUNC_MAP_END |
1926 | 2009 |
1927 void | 2010 void |
1928 create_prefs_window(void) | 2011 create_prefs_window(void) |
1929 { | 2012 { |
2148 show_prefs_window(void) | 2231 show_prefs_window(void) |
2149 { | 2232 { |
2150 prefswin_set_skin_update(TRUE); | 2233 prefswin_set_skin_update(TRUE); |
2151 gtk_widget_show(prefswin); | 2234 gtk_widget_show(prefswin); |
2152 } | 2235 } |
2236 | |
2237 | |
2238 | |
2239 |