Index: vcview.py
===================================================================
--- vcview.py	(révision 1217)
+++ vcview.py	(copie de travail)
@@ -18,6 +18,7 @@
 import shutil
 import gtk
 import os
+import sys
 from gettext import gettext as _
 import re
 
@@ -157,6 +158,11 @@
         column.set_attributes(renpix, pixbuf=self.model.column_index(tree.COL_ICON, 0))
         column.set_attributes(rentext, markup=self.model.column_index(tree.COL_TEXT, 0))
         self.treeview.append_column(column)
+        self.vc_ordering = {
+               "old": vc.default_plugin_order,
+               "gui": self.choose_vc,
+               "static": self.static_plugin_order,
+               }
 
         def addCol(name, num):
             column = gtk.TreeViewColumn(name)
@@ -215,11 +221,33 @@
         d.destroy()
         return vcs[indexMap[cb.get_active_text()]]
   
+    def static_plugin_order(self, vcs):
+        """Allow VC plugin names or commands, case insensitive. Pick first match."""
+        def key(x):
+            retCMD = self.prefs.multivc_static.upper().find(x.CMD.upper())
+            if retCMD == -1:
+                retCMD = sys.maxint
+            retNAME = self.prefs.multivc_static.upper().find(x.NAME.upper())
+            if retNAME == -1:
+                retNAME = sys.maxint
+            return min(retCMD, retNAME)
+        
+        return min(vcs, key=key)
+
     def set_location(self, location):
         self.model.clear()
         self.location = location = os.path.abspath(location or ".")
         self.fileentry.gtk_entry.set_text(location)
-        self.vc = vc.Vc(location, self.choose_vc)
+        try:
+            self.vc = vc.Vc(location, self.vc_ordering[self.prefs.multivc_type])
+        except:
+            self.vc = vc.Vc(location, vc.default_plugin_order)
+            msg = _("Selected the '%s' version control system\n\n" %
+                    self.vc.NAME +
+                    "You should adjust the 'Multiple version control " +
+                    "system' option in preferences")
+            misc.run_dialog(msg, parent=self, messagetype=gtk.MESSAGE_ERROR)
+
         it = self.model.add_entries( None, [location] )
         self.treeview.grab_focus()
         self.treeview.get_selection().select_iter(it)
Index: glade2/meldapp.glade
===================================================================
--- glade2/meldapp.glade	(révision 1217)
+++ glade2/meldapp.glade	(copie de travail)
@@ -1298,6 +1298,142 @@
                     <property name="tab_fill">False</property>
                   </packing>
                 </child>
+	            <child>
+	              <widget class="GtkVBox" id="vcview_tab">
+	                <property name="visible">True</property>
+	                <property name="border_width">12</property>
+	                <property name="spacing">12</property>
+	                <child>
+	                  <widget class="GtkVBox" id="vbox3">
+	                    <property name="visible">True</property>
+	                    <property name="spacing">6</property>
+	                    <child>
+	                      <widget class="GtkLabel" id="label3">
+	                        <property name="visible">True</property>
+	                        <property name="xalign">0</property>
+	                        <property name="label" translatable="yes">&lt;b&gt;Multiple version control system&lt;/b&gt;</property>
+	                        <property name="use_markup">True</property>
+	                      </widget>
+	                      <packing>
+	                        <property name="expand">False</property>
+	                        <property name="fill">False</property>
+	                      </packing>
+	                    </child>
+	                    <child>
+	                      <widget class="GtkHBox" id="hbox4">
+	                        <property name="visible">True</property>
+	                        <child>
+	                          <widget class="GtkLabel" id="label4">
+	                            <property name="visible">True</property>
+	                          </widget>
+	                          <packing>
+	                            <property name="expand">False</property>
+	                            <property name="fill">False</property>
+	                            <property name="padding">12</property>
+	                          </packing>
+	                        </child>
+	                        <child>
+	                          <widget class="GtkVBox" id="vbox4">
+	                            <property name="visible">True</property>
+	                            <child>
+	                              <widget class="GtkRadioButton" id="radiobutton_multivc0">
+	                                <property name="visible">True</property>
+	                                <property name="can_focus">True</property>
+	                                <property name="label" translatable="yes">Automatic guess (old behavior)</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_radiobutton_multivc_toggled"/>
+	                              </widget>
+	                              <packing>
+	                                <property name="expand">False</property>
+	                                <property name="fill">False</property>
+	                              </packing>
+	                            </child>
+	                            <child>
+	                              <widget class="GtkRadioButton" id="radiobutton_multivc1">
+	                                <property name="visible">True</property>
+	                                <property name="can_focus">True</property>
+	                                <property name="label" translatable="yes">Ask user</property>
+	                                <property name="response_id">0</property>
+	                                <property name="active">False</property>
+	                                <property name="draw_indicator">True</property>
+	                                <property name="group">radiobutton_multivc0</property>
+                                    <signal name="toggled" handler="on_radiobutton_multivc_toggled"/>
+	                              </widget>
+	                              <packing>
+	                                <property name="position">1</property>
+	                              </packing>
+	                            </child>
+	                            <child>
+	                              <widget class="GtkHBox" id="hbox6">
+	                                <property name="visible">True</property>
+	                                <child>
+	                                  <widget class="GtkRadioButton" id="radiobutton_multivc2">
+	                                    <property name="visible">True</property>
+	                                    <property name="can_focus">True</property>
+	                                    <property name="label" translatable="yes">First match in </property>
+	                                    <property name="use_underline">True</property>
+	                                    <property name="response_id">0</property>
+                                        <property name="active">False</property>
+	                                    <property name="draw_indicator">True</property>
+	                                    <property name="group">radiobutton_multivc0</property>
+                                        <signal name="toggled" handler="on_radiobutton_multivc_toggled"/>
+	                                  </widget>
+	                                  <packing>
+	                                    <property name="expand">False</property>
+	                                    <property name="fill">False</property>
+	                                  </packing>
+	                                </child>
+	                                <child>
+	                                  <widget class="GtkEntry" id="entry_multivc_static">
+	                                    <property name="visible">True</property>
+	                                    <property name="can_focus">True</property>
+	                                    <property name="text" translatable="yes">git hg darcs mtn bzr tla svn cvs</property>
+	                                  </widget>
+	                                  <packing>
+	                                    <property name="position">1</property>
+	                                  </packing>
+	                                </child>
+	                              </widget>
+	                              <packing>
+	                                <property name="expand">False</property>
+	                                <property name="fill">False</property>
+	                                <property name="position">2</property>
+	                              </packing>
+	                            </child>
+	                          </widget>
+	                          <packing>
+	                            <property name="position">1</property>
+	                          </packing>
+	                        </child>
+	                      </widget>
+	                      <packing>
+	                        <property name="position">1</property>
+	                      </packing>
+	                    </child>
+	                  </widget>
+	                  <packing>
+	                    <property name="expand">False</property>
+	                  </packing>
+	                </child>
+	              </widget>
+	              <packing>
+	                <property name="position">5</property>
+	              </packing>
+	            </child>
+	            <child>
+	              <widget class="GtkLabel" id="vcview_label">
+	                <property name="visible">True</property>
+	                <property name="label" translatable="yes">Version Control</property>
+	              </widget>
+	              <packing>
+	                <property name="type">tab</property>
+	                <property name="position">5</property>
+	                <property name="tab_fill">False</property>
+	              </packing>
+	            </child>
               </widget>
           <packing>
             <property name="position">1</property>
Index: meldapp.py
===================================================================
--- meldapp.py	(révision 1217)
+++ meldapp.py	(copie de travail)
@@ -198,6 +198,7 @@
 class PreferencesDialog(gnomeglade.Component):
 
     editor_radio_values = {"internal":0, "gnome":1, "custom":2}
+    multivc_radio_values = {"old": 0, "gui": 1, "static": 2}
 
     def __init__(self, parentapp):
         gnomeglade.Component.__init__(self, paths.share_dir("glade2/meldapp.glade"), "preferencesdialog")
@@ -241,11 +242,25 @@
         self.checkbutton_ignore_blank_lines.set_active( self.prefs.ignore_blank_lines )
         # encoding
         self.entry_text_codecs.set_text( self.prefs.text_codecs )
+        # Version Control
+        self.map_widgets_into_lists(["radiobutton_multivc"])
+        self.radiobutton_multivc[self.multivc_radio_values.get(self.prefs.multivc_type, "old")].set_active(1)
+        self.entry_multivc_static.set_text(self.prefs.multivc_static)
+
     #
     # editor
     #
     def on_fontpicker_font_set(self, picker):
         self.prefs.custom_font = picker.get_font_name()
+    def on_radiobutton_multivc_toggled(self, radio):
+        if radio.get_active():
+            static = radio == self.radiobutton_multivc2
+            self.entry_multivc_static.set_sensitive(static)
+            idx = self.radiobutton_multivc.index(radio)
+            for k,v in self.multivc_radio_values.items():
+                if v == idx:
+                    self.prefs.multivc_type = k
+                    break
     def on_radiobutton_font_toggled(self, radio):
         if radio.get_active():
             custom = radio == self.radiobutton_custom_font
@@ -279,12 +294,13 @@
         self.prefs.ignore_blank_lines = check.get_active()
 
     #
-    # encoding
+    # Save text entries widget contents in preferences
     #
     def on_response(self, dialog, arg):
         if arg==gtk.RESPONSE_CLOSE:
             self.prefs.text_codecs = self.entry_text_codecs.props.text
             self.prefs.edit_command_custom = self.custom_edit_command_entry.props.text
+            self.prefs.multivc_static = self.entry_multivc_static.props.text
         self.widget.destroy()
 
 ################################################################################
@@ -430,7 +446,9 @@
             _("Leading whitespace\t0\t^[ \\t\\r\\f\\v]*\n") + \
             #TRANSLATORS: translate this string ONLY to the first "\t", leave it and the following parts intact
             _("Script comment\t0\t#.*")),
-        "ignore_blank_lines" : prefs.Value(prefs.BOOL, 1)
+        "ignore_blank_lines" : prefs.Value(prefs.BOOL, 1),
+        "multivc_static" : prefs.Value(prefs.STRING, "git hg darcs mtn bzr tla svn cvs"),
+        "multivc_type" : prefs.Value(prefs.STRING, "old"), # old, gui, static
     }
 
     def __init__(self):
