Commits

Peter Ruibal committed a3f5c54

synch: Preserve 'do fetch' state across synch sessions

Comments (0)

Files changed (1)

         
     def _pull_menu(self):
         menu = gtk.Menu()
-           
-        self._pull_fetch = gtk.CheckMenuItem("Do fetch")
-        menu.append(self._pull_fetch)
-        self._pull_update = gtk.CheckMenuItem("Update to new tip")
-        menu.append(self._pull_update)
+
+        # define menu items
+        self._pull_default = gtk.RadioMenuItem(None, "Default Pull")
+        self._pull_update  = gtk.RadioMenuItem(self._pull_default, "Update to new tip")
+        self._pull_fetch   = gtk.RadioMenuItem(self._pull_default, "Do fetch")
+        self._pull_menu_items = [
+            self._pull_default, 
+            self._pull_update,
+            self._pull_fetch,
+        ]
+        
+        # add them to the menu
+        for item in self._pull_menu_items:
+            menu.append(item)
         
         # restore states from previous session
-        st = self._settings.get_value('_pull_update_state', False)
-        self._pull_update.set_active(st)
+        st = self._settings.get_value('_pull_default_state', 0)
+        self._pull_menu_items[st].set_active(True)
         
         menu.show_all()
         return menu
             gtk.main_quit()
         
     def _save_settings(self):
-        self._settings.set_value('_pull_update_state',
-                self._pull_update.get_active())
+        pullstate = 0
+        for i in xrange(0, len(self._pull_menu_items)):
+            if self._pull_menu_items[i].get_active(): pullstate = i
+        self._settings.set_value('_pull_default_state', pullstate) 
         self._settings.write()
 
     def _delete(self, widget, event):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.