Hi guys,

This patch saves the history window size and position values to disk and
loads them when the history window is shown. This is my first patch so
any suggestions on how to improve it are welcome :)

Regards,
John
Index: src/history_window.py
===================================================================
--- src/history_window.py	(revision 8065)
+++ src/history_window.py	(working copy)
@@ -135,6 +135,12 @@
 		checkbutton.set_active(log)
 		checkbutton.connect('toggled', self.on_log_history_checkbutton_toggled)
 		
+		gtkgui_helpers.resize_window(self.window,
+			gajim.config.get('historywin-width'),
+			gajim.config.get('historywin-height'))
+		gtkgui_helpers.move_window(self.window,
+			gajim.config.get('historywin-x-position'),
+			gajim.config.get('historywin-y-position'))
 		self.window.show_all()
 
 	def on_history_window_destroy(self, widget):
@@ -399,7 +405,18 @@
 			match_start_mark = self.history_buffer.create_mark('match_start',
 				match_start_iter, True)
 			self.history_textview.tv.scroll_to_mark(match_start_mark, 0, True)
+			
+	def on_history_window_configure_event(self, widget, event):
+		''' save history window size and position '''
+		width, height = self.window.get_size()
+		gajim.config.set('historywin-width', width)
+		gajim.config.set('historywin-height', height)
 
+		x, y = self.window.get_position()
+		gajim.config.set('historywin-x-position', x)
+		gajim.config.set('historywin-y-position', y)
+		gajim.interface.save_config()
+
 	def on_log_history_checkbutton_toggled(self, widget):
 		# log conversation history?
 		oldlog = True
@@ -415,4 +432,3 @@
 		if oldlog != log:
 			gajim.config.set_per('accounts', self.account, 'no_log_for',
 				' '.join(no_log_for))
-
Index: src/common/config.py
===================================================================
--- src/common/config.py	(revision 8065)
+++ src/common/config.py	(working copy)
@@ -120,6 +120,10 @@
 		'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
 		'gc-msgwin-width': [opt_int, 600],
 		'gc-msgwin-height': [opt_int, 440],
+		'historywin-width' : [opt_int, 600],
+		'historywin-height' : [opt_int, 400],
+		'historywin-x-position' : [opt_int, -1],
+		'historywin-y-position' : [opt_int, -1],
 		'single-msg-x-position': [opt_int, 0],
 		'single-msg-y-position': [opt_int, 0],
 		'single-msg-width': [opt_int, 400],
Index: data/glade/history_window.glade
===================================================================
--- data/glade/history_window.glade	(revision 8065)
+++ data/glade/history_window.glade	(working copy)
@@ -8,8 +8,6 @@
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
-  <property name="default_width">650</property>
-  <property name="default_height">350</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="role">history</property>
@@ -19,7 +17,9 @@
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
   <signal name="destroy" handler="on_history_window_destroy" last_modification_time="Tue, 01 Mar 2005 16:30:31 GMT"/>
+  <signal name="configure_event" handler="on_history_window_configure_event" last_modification_time="Tue, 27 Mar 2007 23:27:22 GMT"/>
 
   <child>
     <widget class="GtkVBox" id="vbox">
_______________________________________________
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel

Reply via email to