Commits

Erik Grinaker  committed f4e8220

window position is stored on exit

  • Participants
  • Parent commits 784a991

Comments (0)

Files changed (5)

 
 	* fixed some bugs introduced during development
 
+	* the window position is stored on quit
+
 2004-08-07  Erik Grinaker <erikg@codepoet.no>
 
 	* minor code cleanups
 
 New features:
 - added a preference for autosaving data on change
-- window geometry is stored on quit
 - added import/export of .netrc files
 - added import/export of GNOME Password Manager (gpass) files
 - replaced the import/export druids with normal file selectors
+- window size and position is stored on quit
 - default type when adding entries is Generic
 - vertical scrollbar only displayed when needed
 - most dialogs can be closed by pressing Escape

File gnome/revelation.schemas

 		</schema>
 
 		<schema>
+			<key>/schemas/apps/revelation/view/window-position-x</key>
+			<applyto>/apps/revelation/view/window-position-x</applyto>
+			<owner>revelation</owner>
+			<type>int</type>
+			<default>0</default>
+
+			<locale name="C">
+				<short>Initial horizontal window position</short>
+				<long>
+					The initial horizontal position of the main
+					window, in pixels.
+				</long>
+			</locale>
+		</schema>
+
+		<schema>
+			<key>/schemas/apps/revelation/view/window-position-y</key>
+			<applyto>/apps/revelation/view/window-position-y</applyto>
+			<owner>revelation</owner>
+			<type>int</type>
+			<default>0</default>
+
+			<locale name="C">
+				<short>Initial vertical window position</short>
+				<long>
+					The initial vertical position of the main
+					window, in pixels.
+				</long>
+			</locale>
+		</schema>
+
+		<schema>
 			<key>/schemas/apps/revelation/view/window-width</key>
 			<applyto>/apps/revelation/view/window-width</applyto>
 			<owner>revelation</owner>

File src/lib/data.py

 		"Checks if the configuration is available"
 
 		try:
-			self.get("view/window-width")
 			self.get("file/autoload_file")
 			self.get("file/autosave")
+			self.get("view/window-position-y")
+			self.get("view/window-width")
 
 		except ConfigError:
 			return gtk.FALSE

File src/revelation

 		"Sets the initial application state"
 
 		self.set_default_size(self.config.get("view/window-width"), self.config.get("view/window-height"))
+		self.move(self.config.get("view/window-position-x"), self.config.get("view/window-position-y"))
 		self.connect("delete_event", lambda w,d: gtk.TRUE ^ self.quit())
 
 		self.tree.select(None)
 		width, height = self.get_size()
 		self.config.set("view/window-width", width)
 		self.config.set("view/window-height", height)
+
+		x, y = self.get_position()
+		self.config.set("view/window-position-x", x)
+		self.config.set("view/window-position-y", y)
+
 		self.config.set("view/pane-position", self.hpaned.get_position())
 
 		gtk.mainquit()