Changeset f7cd5039ad3f…
Parent 869c08446742…
by
Changes to 2 files · Browse files at f7cd5039ad3f Showing diff from parent 869c08446742 Diff from another changeset...
@@ -92,6 +92,14 @@ self.notebook = notebook
vbox.pack_start(self.notebook, True, True, 2)
+ accelgroup = gtk.AccelGroup()
+ self.add_accel_group(accelgroup)
+ mod = gtklib.get_thg_modifier()
+ key, modifier = gtk.accelerator_parse(mod+'w')
+ notebook.add_accelerator('thg-close', accelgroup, key,
+ modifier, gtk.ACCEL_VISIBLE)
+ notebook.connect('thg-close', self.close_notebook)
+
self.stbar = gtklib.StatusBar()
self.stbar.sttext.set_property('use-markup', True)
vbox.pack_start(self.stbar, False, False, 2)
@@ -204,6 +212,12 @@ iconBox.show()
return button
+ def close_notebook(self, notebook):
+ if notebook.get_n_pages() <= 1:
+ gtklib.thgexit(self)
+ else:
+ self.close_current_page()
+
def add_search_page(self):
frame = gtk.Frame()
frame.set_border_width(10)
@@ -423,7 +437,7 @@ self.curpath = fromutf(model[paths][self.COL_PATH])
self.stbar.set_status_text(toutf(model[paths][self.COL_TOOLTIP]))
- def close_current_page(self, window):
+ def close_current_page(self, window=None):
num = self.notebook.get_current_page()
if num != -1 and self.notebook.get_n_pages():
self.notebook.remove_page(num)
|
@@ -36,6 +36,8 @@ for sig in ('thg-exit', 'thg-close', 'thg-refresh', 'thg-accept'):
gobject.signal_new(sig, gtk.Window,
gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ())
+gobject.signal_new('thg-close', gtk.Notebook,
+ gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ())
gtkmainalive = False
def dispatch(args):
|
Loading...