Commits

Anonymous committed d905744

only enable TortoiseHg in explorer windows

  • Participants
  • Parent commits 3b70378

Comments (0)

Files changed (2)

tortoise/contextmenu.py

 import win32con
 import win32gui
 import win32gui_struct
+import win32api
 import _winreg
 
 S_OK = 0
         if uFlags & shellcon.CMF_DEFAULTONLY:
             return 0
 
+        # only support Overlays In Explorer
+        print "QueryContextMenu: checking if in explorer"
+        modname = win32api.GetModuleFileName(win32api.GetModuleHandle(None))
+        print "modname = %s" % modname
+        if not modname.endswith("\\explorer.exe"):
+            print "QueryContextMenu: not in explorer"
+            return 0 
+
         # As we are a context menu handler, we can ignore verbs.
         self._handlers = {}
         commands = self._get_commands()

tortoise/iconoverlay.py

         ]
 
     def GetOverlayInfo(self):
-        icon = os.path.join(os.path.dirname(__file__), "..", "icons", "status", self.icon)
+        import win32api
+
+        # only support Overlays In Explorer
+        print "GetOverlayInfo: checking if in explorer"
+        modname = win32api.GetModuleFileName(win32api.GetModuleHandle(None))
+        print "modname = %s" % modname
+        if not modname.endswith("\\explorer.exe"):
+            print "GetOverlayInfo: not in explorer"
+            return ("", 0, 0) 
+ 
+        icon = os.path.join(os.path.dirname(__file__), "..", "icons",
+                            "status", self.icon)
         return (icon, 0, shellcon.ISIOI_ICONFILE)
 
     def GetPriority(self):