hotssh r46 - in trunk/hotssh: . hotvte
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: hotssh r46 - in trunk/hotssh: . hotvte
- Date: Mon, 4 Aug 2008 21:15:56 +0000 (UTC)
Author: walters
Date: Mon Aug 4 21:15:56 2008
New Revision: 46
URL: http://svn.gnome.org/viewvc/hotssh?rev=46&view=rev
Log:
Move session file to ~/.hotssh; store username in session data
Modified:
trunk/hotssh/hotvte/vtewindow.py
trunk/hotssh/sshwindow.py
Modified: trunk/hotssh/hotvte/vtewindow.py
==============================================================================
--- trunk/hotssh/hotvte/vtewindow.py (original)
+++ trunk/hotssh/hotvte/vtewindow.py Mon Aug 4 21:15:56 2008
@@ -59,6 +59,7 @@
class VteWindow(gtk.Window):
__gsignals__ = {
+ "window-close" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
"shutdown" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
}
@@ -416,6 +417,11 @@
def queue_save_session(self):
if self.__idle_save_session_id == 0:
self.__idle_save_session_id = gobject.timeout_add(5*1000, self.__idle_save_session)
+
+ def __save_session_now(self):
+ if self.__idle_save_session_id > 0:
+ gobject.source_remove(self.__idle_save_session_id)
+ self.__idle_save_session()
def __idle_save_session(self):
self.__idle_save_session_id = 0
@@ -431,6 +437,7 @@
def __on_win_destroy(self, win):
_logger.debug("got window destroy")
+ self.__save_session_now()
self.__windows.remove(win)
win.get_child().destroy()
if len(self.__windows) == 0:
@@ -521,7 +528,9 @@
pass
def on_shutdown(self, factory):
- self.save_session()
+ # We used to save the session here, but now that is done in
+ # the window shutdown above
+ pass
def save_session(self):
_logger.debug("noop session save")
Modified: trunk/hotssh/sshwindow.py
==============================================================================
--- trunk/hotssh/sshwindow.py (original)
+++ trunk/hotssh/sshwindow.py Mon Aug 4 21:15:56 2008
@@ -1477,7 +1477,8 @@
class SshApp(VteApp):
def __init__(self):
super(SshApp, self).__init__(SshWindow)
- self.__sessionpath = os.path.expanduser('~/.hotwire/hotwire-ssh.session')
+ self.__old_sessionpath = os.path.expanduser('~/.hotwire/hotssh.session')
+ self.__sessionpath = os.path.expanduser('~/.hotssh/hotssh-session.xml')
self.__connhistory = get_history()
self.__local_avahi = SshAvahiMonitor()
@@ -1553,7 +1554,10 @@
try:
f = open(self.__sessionpath)
except:
- return None
+ try:
+ f = open(self.__old_sessionpath)
+ except:
+ return None
doc = xml.dom.minidom.parse(f)
saved_windows = []
current_widget = None
@@ -1564,6 +1568,7 @@
for child in window_child.childNodes:
if not (child.nodeType == child.ELEMENT_NODE and child.nodeName == 'connection'):
continue
+ user = child.getAttribute('user')
host = child.getAttribute('host')
iscurrent = child.getAttribute('current')
options = []
@@ -1574,7 +1579,8 @@
if not (option_elt.nodeType == child.ELEMENT_NODE and options_elt.nodeName == 'option'):
continue
options.append(option.firstChild.nodeValue)
- kwargs = {'userhost': host}
+ userhost = userhost_pair_to_string(user, host)
+ kwargs = {'userhost': userhost}
if len(options) > 0:
kwargs['options'] = options
if iscurrent:
@@ -1587,7 +1593,7 @@
@log_except(_logger)
def save_session(self):
_logger.debug("doing session save")
- tempf_path = tempfile.mktemp('.session.tmp', 'hotwire-session', os.path.dirname(self.__sessionpath))
+ tempf_path = tempfile.mktemp('.xml.tmp', 'hotssh-session', os.path.dirname(self.__sessionpath))
f = open(tempf_path, 'w')
state = []
doc = xml.dom.minidom.getDOMImplementation().createDocument(None, "session", None)
@@ -1601,7 +1607,12 @@
for widget in notebook:
connection = doc.createElement('connection')
window_node.appendChild(connection)
- connection.setAttribute('host', widget.get_host())
+ user = widget.get_user()
+ if user is not None:
+ connection.setAttribute('user', user)
+ host = widget.get_host()
+ if host is not None:
+ connection.setAttribute('host', host)
if current == widget:
connection.setAttribute('current', 'true')
options = widget.get_options()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]