# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1252122143 -32400
# Node ID 5bb414d1e7bda5ccbb46eeb72a2e6e7e500afa16
# Parent  af6783dea990d29938756f997301b31132b1b0d8
thgmq: fix to avoid showing empty context menu

also hide 'goto' command on 'qparent' row.

diff --git a/hggtk/thgmq.py b/hggtk/thgmq.py
--- a/hggtk/thgmq.py
+++ b/hggtk/thgmq.py
@@ -475,7 +475,7 @@
     def row_sep_func(self, model, iter, data=None):
         return model[iter][MQ_INDEX] == INDEX_SEPARATOR;

-    def list_popup_menu(self, list, path):
+    def show_patch_cmenu(self, list, path):
         row = self.model[path]
         if row[MQ_INDEX] == INDEX_SEPARATOR:
             return
@@ -495,7 +495,7 @@
         is_qparent = row[MQ_INDEX] == INDEX_QPARENT
         is_applied = row[MQ_STATUS] == 'A'

-        if is_operable and not is_qtip:
+        if is_operable and not is_qtip and (not is_qparent or has_applied):
             append(_('_goto'), self.goto_activated)
         if has_patch and not is_qparent:
             append(_('_rename'), self.rename_activated)
@@ -506,9 +506,9 @@
             if has_applied and not is_qparent:
                 append(_('f_old'), self.fold_activated)

-        menu.show_all()
-        menu.popup(None, None, None, 0, 0)
-        return True
+        if len(menu.get_children()) > 0:
+            menu.show_all()
+            menu.popup(None, None, None, 0, 0)

     def create_view_menu(self):
         menu = gtk.Menu()
@@ -607,7 +607,7 @@
                 gobject.idle_add(unselect)
         elif event.button == 3:
             if pathinfo:
-                self.list_popup_menu(self.list, pathinfo[0])
+                self.show_patch_cmenu(self.list, pathinfo[0])

     def list_sel_changed(self, list):
         path, focus = list.get_cursor()

Attachment: thg-kuy_rev3841.patch
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to