[meld] preferences: Update text encoding setting, and remove its UI



commit 2a2136b8d859da5f97d8bd9c40d6bd3c49cc4507
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 30 06:54:55 2013 +1000

    preferences: Update text encoding setting, and remove its UI
    
    People really shouldn't be using this as it is. In the near future
    there will be a file selector with encoding selection, and that should
    fix almost all cases. For the rest, this preference isn't hard to
    change via dconf.

 data/org.gnome.meld.gschema.xml |    8 +++
 data/ui/preferences.ui          |  125 ---------------------------------------
 meld/filediff.py                |    2 +-
 meld/preferences.py             |    7 --
 4 files changed, 9 insertions(+), 133 deletions(-)
---
diff --git a/data/org.gnome.meld.gschema.xml b/data/org.gnome.meld.gschema.xml
index 53b8136..7aca413 100644
--- a/data/org.gnome.meld.gschema.xml
+++ b/data/org.gnome.meld.gschema.xml
@@ -25,6 +25,14 @@
       </key>
 
 
+      <!-- File loading settings -->
+      <key name="detect-encodings" type="as">
+          <default>["utf8"]</default>
+          <summary>Automatically detected text encodings</summary>
+          <description>These text encodings will be automatically used (in order) to try to decode loaded 
text files.</description>
+      </key>
+
+
       <!-- Settings corresponding directly to GtkSourceView properties -->
       <key name="indent-width" type="i">
           <default>8</default>
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index 5e68322..5f5aa32 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -1227,131 +1227,6 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkVBox" id="encoding_tab">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">12</property>
-                <property name="spacing">12</property>
-                <child>
-                  <object class="GtkVBox" id="vbox39">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel" id="label52">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Loading</property>
-                        <property name="use_markup">True</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkHBox" id="hbox29">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkLabel" id="label53">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xpad">12</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkVBox" id="vbox40">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkVBox" id="vbox41">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkLabel" id="label55">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
-                                    <property name="xpad">4</property>
-                                    <property name="ypad">4</property>
-                                    <property name="label" translatable="yes">When loading, try these codecs 
in order. (e.g. utf8, iso8859)</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkEntry" id="entry_text_codecs">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="text">utf8 iso8859</property>
-                                    <signal name="activate" handler="on_entry_text_codecs_activate" 
swapped="no"/>
-                                    <signal name="focus-out-event" handler="on_entry_text_codecs_activate" 
swapped="no"/>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">5</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="encoding_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Encoding</property>
-              </object>
-              <packing>
-                <property name="position">5</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">True</property>
diff --git a/meld/filediff.py b/meld/filediff.py
index 50d3ffa..5a2521c 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1103,7 +1103,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self._disconnect_buffer_handlers()
         self.linediffer.clear()
         self.queue_draw()
-        try_codecs = self.prefs.text_codecs.split() or ['utf_8', 'utf_16']
+        try_codecs = list(settings.get_value('detect-encodings'))
         yield _("[%s] Opening files") % self.label_text
         tasks = []
 
diff --git a/meld/preferences.py b/meld/preferences.py
index 536dc6f..435a22c 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -219,8 +219,6 @@ class PreferencesDialog(gnomeglade.Component):
         self.textfilter = FilterList("text-filters", filters.FilterEntry.REGEX)
         self.text_filters_tab.pack_start(self.textfilter.widget, True, True, 0)
         self.checkbutton_ignore_blank_lines.set_active( self.prefs.ignore_blank_lines )
-        # encoding
-        self.entry_text_codecs.set_text( self.prefs.text_codecs )
 
         columnlist = ColumnList("folder-columns")
         self.column_list_vbox.pack_start(columnlist.widget, True, True, 0)
@@ -259,10 +257,6 @@ class PreferencesDialog(gnomeglade.Component):
     def on_checkbutton_ignore_blank_lines_toggled(self, check):
         self.prefs.ignore_blank_lines = check.get_active()
 
-    def on_entry_text_codecs_activate(self, entry, *args):
-        # Called on "activate" and "focus-out-event"
-        self.prefs.text_codecs = entry.props.text
-
     def on_combo_file_order_changed(self, combo):
         file_order = combo.get_model()[combo.get_active_iter()][0]
         self.prefs.vc_left_is_local = True if file_order else False
@@ -276,7 +270,6 @@ class MeldPreferences(prefs.Preferences):
         "window_size_x": prefs.Value(prefs.INT, 600),
         "window_size_y": prefs.Value(prefs.INT, 600),
         "edit_wrap_lines" : prefs.Value(prefs.INT, 0),
-        "text_codecs": prefs.Value(prefs.STRING, "utf8 latin1"),
         "vc_console_visible": prefs.Value(prefs.BOOL, 0),
         "ignore_blank_lines" : prefs.Value(prefs.BOOL, False),
         "vc_left_is_local": prefs.Value(prefs.BOOL, False),


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