# HG changeset patch
# User Adrian Buehlmann <adr...@cadifra.com>
# Date 1254607049 -7200
# Node ID 9dcecf4c897507fa4c77cf6af1ec5cf75f05ce54
# Parent  cc169e9c4b14b99cb1213e7e6ecf9558624ef273
histdetails: desensitize up/down buttons

diff --git a/tortoisehg/hgtk/histdetails.py b/tortoisehg/hgtk/histdetails.py
--- a/tortoisehg/hgtk/histdetails.py
+++ b/tortoisehg/hgtk/histdetails.py
@@ -91,11 +91,22 @@ class LogDetailsDialog(gtk.Dialog):
         rightvbox.pack_start(self.up_button, False, False, 2)
         rightvbox.pack_start(self.down_button, False, False, 4)
 
+        self.tv.connect('cursor-changed', lambda tv: self.update_buttons())
+
         self.show_all()
 
     def update_buttons(self):
         self._btn_apply.set_sensitive(self.dirty)
 
+        model, seliter = self.tv.get_selection().get_selected()
+
+        next = model.iter_next(seliter)
+        self.down_button.set_sensitive(next != None)
+
+        firstiter = model.get_iter_first()
+        islast = model.get_path(seliter) != model.get_path(firstiter)
+        self.up_button.set_sensitive(islast)
+
     def up_clicked(self, button):
         model, seliter = self.tv.get_selection().get_selected()
         i = model.get_iter_first()

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to