meld r1160 - trunk



Author: vincele
Date: Mon Feb 23 21:53:13 2009
New Revision: 1160
URL: http://svn.gnome.org/viewvc/meld?rev=1160&view=rev

Log:
Implement a GUI chooser for multiple VC in a single directory


Modified:
   trunk/vcview.py

Modified: trunk/vcview.py
==============================================================================
--- trunk/vcview.py	(original)
+++ trunk/vcview.py	Mon Feb 23 21:53:13 2009
@@ -196,11 +196,34 @@
         if not self.prefs.vc_console_visible:
             self.on_console_view_toggle(self.console_hide_box)
 
+    def choose_vc(self, vcs):
+        """Callback from vc.Vc to choose when there are multiple plugins able to handle one location"""
+        d = gtk.Dialog(_('VC chooser'),
+            self.vcview.parent.parent.parent,
+            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+            (gtk.STOCK_OK, gtk.RESPONSE_OK))
+        
+        indexMap = {}
+        cb = gtk.combo_box_new_text()
+        for i, avc in enumerate(vcs):
+            cb.append_text(avc.NAME)
+            indexMap[avc.NAME] = i
+        cb.set_active(0)
+        lb = gtk.Label(_('Pick one source control plugin'))
+        d.vbox.set_spacing(12)
+        d.vbox.pack_start(lb, True, True, 12)
+        d.vbox.pack_start(cb, False, False)
+        cb.show()
+        lb.show()
+        d.run()
+        d.destroy()
+        return vcs[indexMap[cb.get_active_text()]]
+  
     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.vc = vc.Vc(location, self.choose_vc)
         it = self.model.add_entries( None, [location] )
         self.treeview.grab_focus()
         self.treeview.get_selection().select_iter(it)



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