Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.1.9, and 1.1.9.1

stable cmenu: config option for menu behavior outside repositories

Makes the behavior introduced by 117befc5cb56 (hide the context
menu outside repositories) configurable.

Refs #1698

Changeset 1320387a151d

Parent b5c83a98e9f6

by Wagner Bruna

Changes to 2 files · Browse files at 1320387a151d Showing diff from parent b5c83a98e9f6 Diff from another changeset...

 
108
109
110
 
 
 
 
 
 
 
 
 
 
 
 
111
112
113
 
194
195
196
 
 
 
197
198
199
 
258
259
260
 
261
262
263
 
273
274
275
 
 
276
277
278
 
300
301
302
 
303
304
305
 
325
326
327
 
328
329
330
 
341
342
343
 
344
345
346
 
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
206
207
208
209
210
211
212
213
214
 
273
274
275
276
277
278
279
 
289
290
291
292
293
294
295
296
 
318
319
320
321
322
323
324
 
344
345
346
347
348
349
350
 
361
362
363
364
365
366
367
@@ -108,6 +108,18 @@
  subbutton.connect('clicked', self.sub_clicked)   mbbox.add(subbutton)   + # menu behavior group + mbframe = gtk.Frame(_('Menu Behavior')) + mbframe.set_border_width(2) + cmenuvbox.pack_start(mbframe, True, True, 2) + + mbbox = gtk.VBox() + mbframe.add(mbbox) + hbox = gtk.HBox() + mbbox.pack_start(hbox, False, False, 2) + self.hide_context_menu = gtk.CheckButton(_('Hide context menu outside repositories')) + hbox.pack_start(self.hide_context_menu, False, False, 2) +   # Icons page   iconsframe = self.add_page(notebook, _('Icons'))   iconsvbox = gtk.VBox() @@ -194,6 +206,9 @@
  # Tooltips   tips = gtklib.Tooltips()   + tooltip = _('Do not show menu items on unversioned folders' + ' (use shift + click to override)') + tips.set_tip(self.hide_context_menu, tooltip)   tooltip = _('Show overlay icons in Mercurial repositories')   tips.set_tip(self.ovenable, tooltip)   self.ovenable.connect('toggled', self.ovenable_toggled) @@ -258,6 +273,7 @@
  return frame     def load_shell_configs(self): + hide_context_menu = False   overlayenable = True   localdisks = False   promoteditems = 'commit' @@ -273,6 +289,8 @@
  from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx   hkey = OpenKey(HKEY_CURRENT_USER, r'Software\TortoiseHg')   t = ('1', 'True') + try: hide_context_menu = QueryValueEx(hkey, 'HideMenuOutsideRepo')[0] in t + except EnvironmentError: pass   try: overlayenable = QueryValueEx(hkey, 'EnableOverlays')[0] in t   except EnvironmentError: pass   try: localdisks = QueryValueEx(hkey, 'LocalDisksOnly')[0] in t @@ -300,6 +318,7 @@
  except (ImportError, WindowsError):   pass   + self.hide_context_menu.set_active(hide_context_menu)   self.ovenable.set_active(overlayenable)   self.lclonly.set_active(localdisks)   self.lclonly.set_sensitive(overlayenable) @@ -325,6 +344,7 @@
  self.topmmodel.set_sort_column_id(1, gtk.SORT_ASCENDING)     def store_shell_configs(self): + hide_context_menu = self.hide_context_menu.get_active() and '1' or '0'   overlayenable = self.ovenable.get_active() and '1' or '0'   localdisks = self.lclonly.get_active() and '1' or '0'   show_taskbaricon = self.show_taskbaricon.get_active() and '1' or '0' @@ -341,6 +361,7 @@
  try:   from _winreg import HKEY_CURRENT_USER, CreateKey, SetValueEx, REG_SZ, REG_DWORD   hkey = CreateKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") + SetValueEx(hkey, 'HideMenuOutsideRepo', 0, REG_SZ, hide_context_menu)   SetValueEx(hkey, 'EnableOverlays', 0, REG_SZ, overlayenable)   SetValueEx(hkey, 'LocalDisksOnly', 0, REG_SZ, localdisks)   SetValueEx(hkey, 'ShowTaskbarIcon', 0, REG_SZ, show_taskbaricon)
 
472
473
474
475
476
 
 
 
 
 
 
477
478
479
 
472
473
474
 
 
475
476
477
478
479
480
481
482
483
@@ -472,8 +472,12 @@
  /* shift key is not down */   if (!isHgrepo)   { - /* We are not inside a repo -> don't show thg menu entries */ - return S_OK; + std::string cval; + if (GetRegistryConfig("HideMenuOutsideRepo", cval) != 0 && cval == "1") + { + /* We are not inside a repo -> don't show thg menu entries */ + return S_OK; + }   }   }