Revision: 1868
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1868&view=rev
Author:   Sikon
Date:     2007-12-28 12:17:18 -0800 (Fri, 28 Dec 2007)

Log Message:
-----------
More work on new prefs dialog, implemented encoding dialog

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog
    gtkpod/trunk/data/gtkpod.glade
    gtkpod/trunk/src/charset.c
    gtkpod/trunk/src/charset.h
    gtkpod/trunk/src/prefsdlg.c

Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog      2007-12-28 17:37:53 UTC (rev 1867)
+++ gtkpod/trunk/ChangeLog      2007-12-28 20:17:18 UTC (rev 1868)
@@ -1,9 +1,19 @@
 2007-12-28 Matvey Kozhev <sikon at users.sourceforge.net>
 
-  * data/gtkpod.glade
+  * data/gtkpod.glade:
   
     Fixed sort window crash related to absence of tooltips. Marked
        "Dummy - do not delete" as not translatable.
+       
+  * src/charset.c:
+  * src/charset.h:
+  
+    Implemented charset_init_combo_box as a drop-in replacement
+       for charset_init_combo
+       
+  * src/prefsdlg.c:
+  
+    Encoding dialog
 
 2007-12-27 P.G. Richardson <phantom_sf at users.sourceforge.net>
 

Modified: gtkpod/trunk/data/gtkpod.glade
===================================================================
--- gtkpod/trunk/data/gtkpod.glade      2007-12-28 17:37:53 UTC (rev 1867)
+++ gtkpod/trunk/data/gtkpod.glade      2007-12-28 20:17:18 UTC (rev 1868)
@@ -13521,7 +13521,10 @@
                                 <property name="visible">True</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <placeholder/>
+                                  <widget class="GtkLabel" id="label21">
+                                    <property name="visible">True</property>
+                                    <property 
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                  </widget>
                                 </child>
                                 <child>
                                   <widget class="GtkButton" id="column_add">
@@ -13550,7 +13553,13 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <placeholder/>
+                                  <widget class="GtkLabel" id="label23">
+                                    <property name="visible">True</property>
+                                    <property 
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">3</property>
+                                  </packing>
                                 </child>
                               </widget>
                               <packing>
@@ -13579,6 +13588,68 @@
                   </packing>
                 </child>
                 <child>
+                  <widget class="GtkFrame" id="frame15">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">GTK_SHADOW_NONE</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment29">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <widget class="GtkHBox" id="hbox214">
+                            <property name="visible">True</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <widget class="GtkColorButton" 
id="coverart_display_bg_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="response_id">0</property>
+                                <property name="title" 
translatable="yes">Choose a Different Colour for the CoverArt Display 
Background</property>
+                                <signal name="color_set" 
handler="on_coverart_dialog_bg_color_set"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label472">
+                                <property name="visible">True</property>
+                                <property name="label" 
translatable="yes">Background color</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label18">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" 
translatable="yes">&lt;b&gt;Cover Art Display&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
                   <widget class="GtkFrame" id="frame11">
                     <property name="visible">True</property>
                     <property name="label_xalign">0</property>
@@ -13661,7 +13732,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -13707,7 +13778,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">3</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
               </widget>
@@ -13825,11 +13896,11 @@
                                 <child>
                                   <widget class="GtkButton" id="button6">
                                     <property name="visible">True</property>
-                                    <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
                                     <property name="label" 
translatable="yes">Encoding...</property>
                                     <property 
name="use_underline">True</property>
                                     <property name="response_id">0</property>
+                                    <signal name="clicked" 
handler="open_encoding_dialog"/>
                                   </widget>
                                   <packing>
                                     <property name="position">1</property>
@@ -14126,7 +14197,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkButton" id="button7">
+                                  <widget class="GtkButton" 
id="customize_tags">
                                     <property name="visible">True</property>
                                     <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
@@ -14172,96 +14243,96 @@
                                 <child>
                                   <widget class="GtkTable" id="table1">
                                     <property name="visible">True</property>
-                                    <property name="n_rows">3</property>
-                                    <property name="n_columns">2</property>
+                                    <property name="n_rows">2</property>
+                                    <property name="n_columns">3</property>
                                     <property 
name="column_spacing">12</property>
                                     <property name="row_spacing">6</property>
                                     <child>
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <widget class="GtkCheckButton" 
id="tag_genre">
+                                      <widget class="GtkCheckButton" 
id="tag_artist">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">Genre</property>
+                                        <property name="label" 
translatable="yes">Artist</property>
                                         <property 
name="use_underline">True</property>
                                         <property 
name="response_id">0</property>
                                         <property 
name="draw_indicator">True</property>
                                         <signal name="toggled" 
handler="on_tag_checkbox_toggled"/>
                                       </widget>
                                       <packing>
-                                        <property 
name="left_attach">1</property>
-                                        <property 
name="right_attach">2</property>
                                         <property 
name="top_attach">1</property>
                                         <property 
name="bottom_attach">2</property>
-                                        <property name="x_options"></property>
+                                        <property 
name="x_options">GTK_FILL</property>
                                         <property name="y_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkCheckButton" 
id="tag_composer">
+                                      <widget class="GtkCheckButton" 
id="tag_title">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">Composer</property>
+                                        <property name="label" 
translatable="yes">Title</property>
                                         <property 
name="use_underline">True</property>
                                         <property 
name="response_id">0</property>
+                                        <property name="active">True</property>
                                         <property 
name="draw_indicator">True</property>
                                         <signal name="toggled" 
handler="on_tag_checkbox_toggled"/>
                                       </widget>
                                       <packing>
-                                        <property 
name="left_attach">1</property>
-                                        <property 
name="right_attach">2</property>
-                                        <property name="x_options"></property>
+                                        <property 
name="x_options">GTK_FILL</property>
                                         <property name="y_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkCheckButton" 
id="tag_album">
+                                      <widget class="GtkCheckButton" 
id="tag_genre">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">Album</property>
+                                        <property name="label" 
translatable="yes">Genre</property>
                                         <property 
name="use_underline">True</property>
                                         <property 
name="response_id">0</property>
                                         <property 
name="draw_indicator">True</property>
                                         <signal name="toggled" 
handler="on_tag_checkbox_toggled"/>
                                       </widget>
                                       <packing>
-                                        <property 
name="top_attach">2</property>
-                                        <property 
name="bottom_attach">3</property>
-                                        <property name="x_options"></property>
+                                        <property 
name="left_attach">2</property>
+                                        <property 
name="right_attach">3</property>
+                                        <property 
name="x_options">GTK_FILL</property>
                                         <property name="y_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkCheckButton" 
id="tag_artist">
+                                      <widget class="GtkCheckButton" 
id="tag_composer">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">Artist</property>
+                                        <property name="label" 
translatable="yes">Composer</property>
                                         <property 
name="use_underline">True</property>
                                         <property 
name="response_id">0</property>
                                         <property 
name="draw_indicator">True</property>
                                         <signal name="toggled" 
handler="on_tag_checkbox_toggled"/>
                                       </widget>
                                       <packing>
+                                        <property 
name="left_attach">1</property>
+                                        <property 
name="right_attach">2</property>
                                         <property 
name="top_attach">1</property>
                                         <property 
name="bottom_attach">2</property>
-                                        <property name="x_options"></property>
+                                        <property 
name="x_options">GTK_FILL</property>
                                         <property name="y_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkCheckButton" 
id="tag_title">
+                                      <widget class="GtkCheckButton" 
id="tag_album">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">Title</property>
+                                        <property name="label" 
translatable="yes">Album</property>
                                         <property 
name="use_underline">True</property>
                                         <property 
name="response_id">0</property>
-                                        <property name="active">True</property>
                                         <property 
name="draw_indicator">True</property>
                                         <signal name="toggled" 
handler="on_tag_checkbox_toggled"/>
                                       </widget>
                                       <packing>
-                                        <property name="x_options"></property>
+                                        <property 
name="left_attach">1</property>
+                                        <property 
name="right_attach">2</property>
+                                        <property 
name="x_options">GTK_FILL</property>
                                         <property name="y_options"></property>
                                       </packing>
                                     </child>
@@ -14315,7 +14386,7 @@
                                   <widget class="GtkCheckButton" 
id="write_tags">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="label" 
translatable="yes">Write tags to disk when modified in gtkpod</property>
+                                    <property name="label" 
translatable="yes">Write tags to disk when edited</property>
                                     <property 
name="use_underline">True</property>
                                     <property name="response_id">0</property>
                                     <property name="active">True</property>
@@ -14328,13 +14399,14 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkButton" id="button9">
+                                  <widget class="GtkButton" id="tag_encoding">
                                     <property name="visible">True</property>
                                     <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
                                     <property name="label" 
translatable="yes">Encoding...</property>
                                     <property 
name="use_underline">True</property>
                                     <property name="response_id">0</property>
+                                    <signal name="clicked" 
handler="open_encoding_dialog"/>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -14468,7 +14540,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkButton" id="button11">
+                                  <widget class="GtkButton" 
id="customize_coverart">
                                     <property name="visible">True</property>
                                     <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
@@ -14490,17 +14562,70 @@
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label8">
+                        <property name="visible">True</property>
+                        <property name="label" 
translatable="yes">&lt;b&gt;Cover Art&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkFrame" id="frame16">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">GTK_SHADOW_NONE</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment30">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <widget class="GtkHBox" id="hbox11">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="spacing">12</property>
                             <child>
-                              <widget class="GtkHBox" id="hbox214">
+                              <widget class="GtkLabel" id="label20">
                                 <property name="visible">True</property>
-                                <property name="spacing">12</property>
+                                <property 
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="label" translatable="yes">To 
fill additional information, &lt;i&gt;gtkpod&lt;/i&gt; can use a database 
provided by the &lt;i&gt;mserv&lt;/i&gt; music server. If you do not know what 
&lt;i&gt;mserv&lt;/i&gt; is, leave this alone.</property>
+                                <property name="use_markup">True</property>
+                                <property name="wrap">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkVBox" id="vbox21">
+                                <property name="visible">True</property>
+                                <property 
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <child>
-                                  <widget class="GtkColorButton" 
id="coverart_display_bg_button">
+                                  <widget class="GtkButton" id="button1">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
+                                    <property 
name="receives_default">True</property>
+                                    <property 
name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="label" 
translatable="yes">Settings...</property>
                                     <property name="response_id">0</property>
-                                    <property name="title" 
translatable="yes">Choose a Different Colour for the CoverArt Display 
Background</property>
-                                    <signal name="color_set" 
handler="on_coverart_dialog_bg_color_set"/>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -14508,19 +14633,12 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkLabel" id="label472">
-                                    <property name="visible">True</property>
-                                    <property name="label" 
translatable="yes">Cover art display background color</property>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
+                                  <placeholder/>
                                 </child>
                               </widget>
                               <packing>
-                                <property name="position">2</property>
+                                <property 
name="pack_type">GTK_PACK_END</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                           </widget>
@@ -14528,9 +14646,10 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label8">
+                      <widget class="GtkLabel" id="label19">
                         <property name="visible">True</property>
-                        <property name="label" 
translatable="yes">&lt;b&gt;Cover Art&lt;/b&gt;</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" 
translatable="yes">&lt;b&gt;mserv&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                       </widget>
                       <packing>
@@ -14541,7 +14660,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </widget>
@@ -15015,4 +15134,137 @@
       </widget>
     </child>
   </widget>
+  <widget class="GtkDialog" id="prefs_encoding_dialog">
+    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Encoding Preferences</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox7">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkVBox" id="vbox22">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+            <property name="border_width">7</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkHBox" id="hbox12">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <property name="spacing">12</property>
+                <child>
+                  <widget class="GtkLabel" id="label24">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">Tag and filename 
encoding:</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkComboBox" id="encoding_combo">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <signal name="changed" handler="on_encoding_combo_changed"/>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox13">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <widget class="GtkTextView" id="textview1">
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="editable">False</property>
+                    <property name="wrap_mode">GTK_WRAP_WORD</property>
+                    <property name="text" translatable="yes">Normally, the 
encoding specified above will only be used when importing new tracks, and for 
any operations involving existing tracks, the encoding specified when the file 
was first imported will be used. You can use the options below to override this 
behavior, in case you specified the encoding incorrectly for the first 
import.</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkCheckButton" id="use_encoding_for_update">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Also use this 
encoding when updating or synchronizing tracks</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="on_simple_checkbox_toggled"/>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkCheckButton" id="use_encoding_for_writing">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">Also use this 
encoding when writing tracks</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="on_simple_checkbox_toggled"/>
+              </widget>
+              <packing>
+                <property name="position">4</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area7">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="close_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: gtkpod/trunk/src/charset.c
===================================================================
--- gtkpod/trunk/src/charset.c  2007-12-28 17:37:53 UTC (rev 1867)
+++ gtkpod/trunk/src/charset.c  2007-12-28 20:17:18 UTC (rev 1868)
@@ -145,7 +145,10 @@
 
 /* Sets up the charsets to choose from in the "combo". It presets the
    charset stored in cfg->charset (or "System Charset" if none is set
-   there */
+   there
+
+   DEPRECATED - use charset_init_combo_box with GtkComboBox
+*/
 void charset_init_combo (GtkCombo *combo)
 {
     gchar *current_charset;
@@ -209,7 +212,109 @@
     g_free(current_charset);
 }
 
+/* Sets up the charsets to choose from in the "combo". It presets the
+   charset stored in cfg->charset (or "System Charset" if none is set
+   there */
+void charset_init_combo_box (GtkComboBox *combo)
+{
+    gchar *current_charset;
+    gchar *description;
+    const CharsetInfo *ci;
+       GtkCellRenderer *renderer;
+       GtkTreeIter use_iter;
+    static GtkListStore *charsets = NULL; /* list with choices -- takes a 
while to
+                                    * initialize, so we only do it once */
+    
+    current_charset = prefs_get_string("charset");
+       
+    if ((current_charset == NULL) || (strlen (current_charset) == 0))
+    {
+               description = g_strdup (_("System Charset"));
+    }
+    else
+    {
+               description = charset_to_description (current_charset);
+    }
+       
+    if (charsets == NULL)
+    { /* set up list with charsets */
+               FILE *fp;
+               GtkTreeIter iter;
 
+               charsets = gtk_list_store_new (1, G_TYPE_STRING);
+               /* now add all the charset descriptions in the list above */
+               
+               gtk_list_store_append (charsets, &iter);
+               gtk_list_store_set (charsets, &iter, 0, _("System Charset"), 
-1);
+
+               for (ci = charset_info; ci->descr; ci++)
+               {
+                       gtk_list_store_append (charsets, &iter);
+                       gtk_list_store_set (charsets, &iter, 0, _(ci->descr), 
-1);
+               }
+               
+               /* let's add all available charsets returned by "iconv -l" */
+               /* The code assumes that "iconv -l" returns a list with the
+                  name of one charset in each line, each valid line being
+                  terminated by "//".  */
+               fp = popen ("iconv -l", "r");
+               
+               if (fp)
+               {
+                       gchar buf[PATH_MAX];
+                       
+                       /* read one line of output at a time */
+                       while (fgets (buf, PATH_MAX, fp))
+                       {
+                               /* only consider lines ending on "//" */
+                               gchar *bufp = g_strrstr (buf, "//\n");
+                               
+                               if (bufp)
+                               {
+                                       /* add everything before "//" to our 
charset list */
+                                       gchar *bufpp = buf;
+                                       *bufp = 0;  /* shorten string */
+                                       
+                                       while ((*bufpp == ' ') || (*bufpp == 
0x09))
+                                               bufpp++; /* skip whitespace */
+                                       
+                                       if (*bufpp)
+                                       {
+                                               gtk_list_store_append 
(charsets, &iter);
+                                               gtk_list_store_set (charsets, 
&iter, 0, g_strdup (bufpp));
+
+                                       }
+                               }
+                       }
+                       
+                       pclose (fp);
+               }
+    }
+    /* set pull down items */
+       renderer = gtk_cell_renderer_text_new ();
+       
+    gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (charsets));
+       gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
+       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
+       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, 
"text", 0);
+       
+       for (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (charsets), 
&use_iter);
+                gtk_list_store_iter_is_valid (charsets, &use_iter);
+                gtk_tree_model_iter_next (GTK_TREE_MODEL (charsets), 
&use_iter))
+       {
+               gchar *cur_desc;
+               gtk_tree_model_get (GTK_TREE_MODEL (charsets), &use_iter, 0, 
&cur_desc, -1);
+               
+               if(!g_utf8_collate(description, cur_desc))
+                       break;
+       }
+
+       gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &use_iter);
+       g_object_unref (renderer);
+    g_free (description);
+    g_free (current_charset);
+}
+
 /* returns the charset name belonging to the description "descr"
  * chosen from the combo. Return "NULL" when it could not be found, or
  * if it is the System Default Charset (locale). You must g_free

Modified: gtkpod/trunk/src/charset.h
===================================================================
--- gtkpod/trunk/src/charset.h  2007-12-28 17:37:53 UTC (rev 1867)
+++ gtkpod/trunk/src/charset.h  2007-12-28 20:17:18 UTC (rev 1868)
@@ -41,6 +41,7 @@
 #define GTKPOD_JAPAN_AUTOMATIC "gtkpod-japan-automatic"
 
 void charset_init_combo (GtkCombo *combo);
+void charset_init_combo_box (GtkComboBox *combo);
 gchar *charset_from_description (gchar *descr);
 gchar *charset_to_description (gchar *charset);
 gchar *charset_to_utf8 (const gchar *str);

Modified: gtkpod/trunk/src/prefsdlg.c
===================================================================
--- gtkpod/trunk/src/prefsdlg.c 2007-12-28 17:37:53 UTC (rev 1867)
+++ gtkpod/trunk/src/prefsdlg.c 2007-12-28 20:17:18 UTC (rev 1868)
@@ -30,6 +30,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include "charset.h"
 #include "misc.h"
 #include "help.h"
 #include "prefs.h"
@@ -74,13 +75,13 @@
        { "update_existing_track", "update_existing", NULL },
        /* Metadata tab */
        { "read_tags", "readtags", NULL },
-       { "parse_filename_tags", "parsetags", NULL },
+       { "parse_filename_tags", "parsetags", "customize_tags" },
        { "last_resort_tags", NULL, 
"tag_title,tag_artist,tag_album,tag_composer,tag_genre" },
-       { "write_tags", "id3_write", "write_tags_legacy,mass_modify_tags" },
+       { "write_tags", "id3_write", 
"tag_encoding,write_tags_legacy,mass_modify_tags" },
        { "write_tags_legacy", "!id3_write_id3v24", NULL },
        { "mass_modify_tags", "multi_edit", NULL },
        { "read_coverart", "coverart_apic", NULL },
-       { "template_coverart", "coverart_file", NULL },
+       { "template_coverart", "coverart_file", "customize_coverart" },
        /* Feedback tab */
        { "confirm_del_tracks", NULL, 
"confirm_from_ipod,confirm_from_hdd,confirm_from_db" },
        { "confirm_from_ipod", "delete_ipod", NULL },
@@ -530,12 +531,48 @@
 */
 G_MODULE_EXPORT void on_coverart_dialog_bg_color_set (GtkColorButton *widget, 
gpointer user_data)
 {
-       GdkColor colour;
-       gtk_color_button_get_color (widget, &colour);
-       gchar *hexstring;
+       GdkColor color;
+       gtk_color_button_get_color (widget, &color);
+       gchar *hexstring = g_strdup_printf("#%02X%02X%02X",
+                                                                          
color.red >> 8,
+                                                                          
color.green >> 8,
+                                                                          
color.blue >> 8);
        
-       hexstring = g_strdup_printf("#%02X%02X%02X", colour.red >> 8, 
colour.green >> 8, colour.blue >> 8);
        prefs_set_string ("coverart_display_bg_colour", hexstring);
        g_free (hexstring);
        force_update_covers ();
 }
+
+/*
+       glade callback
+*/
+G_MODULE_EXPORT void open_encoding_dialog (GtkButton *sender, gpointer e)
+{
+       GladeXML *xml = gtkpod_xml_new (xml_file, "prefs_encoding_dialog");
+       GtkWidget *dlg = gtkpod_xml_get_widget (xml, "prefs_encoding_dialog");
+       GtkWidget *combo = gtkpod_xml_get_widget (xml, "encoding_combo");
+       
+       init_checkbox (GTK_TOGGLE_BUTTON (gtkpod_xml_get_widget (xml, 
"use_encoding_for_update")),
+                                                                         
"update_charset", NULL);
+
+       init_checkbox (GTK_TOGGLE_BUTTON (gtkpod_xml_get_widget (xml, 
"use_encoding_for_writing")),
+                                                                         
"write_charset", NULL);
+
+       charset_init_combo_box (GTK_COMBO_BOX (combo));
+       glade_xml_signal_autoconnect (xml);
+       gtk_dialog_run (GTK_DIALOG (dlg));
+       gtk_widget_destroy (dlg);
+       g_object_unref (xml);
+}
+
+/*
+       glade callback
+*/
+G_MODULE_EXPORT void on_encoding_combo_changed (GtkComboBox *sender, gpointer 
e)
+{
+       gchar *description = gtk_combo_box_get_active_text (sender);
+       gchar *charset = charset_from_description (description);
+       
+       prefs_set_string ("charset", charset);
+       g_free (charset);
+}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to