Skip to content
Browse files

remembering main windo size

git-svn-id: file:///comboy/svn/onim/trunk@19 ddd93275-964d-42a2-867a-75629c878e58
  • Loading branch information...
1 parent 37f442f commit 79f2973b72839da8203e189f263c72130b6d0b5f @comboy committed
Showing with 17 additions and 3 deletions.
  1. +16 −3 lib/onim/gui.rb
  2. +1 −0 lib/onim/gui/account.rb
View
19 lib/onim/gui.rb
@@ -13,10 +13,16 @@ def initialize(base)
# Load main window
@glade = GladeXML.new(Onim::PATH+'gui/main.glade', nil, 'window_main')
@main = @glade['window_main']
- @main.set_default_size 200,500
- @main.signal_connect("destroy") do |window|
- Gtk.main_quit
+ @main.signal_connect("size-allocate") do |window,blah|
+ @window_size_x = blah.width
+ @window_size_y = blah.height
end
+ @base.config[:main_window_size] ?
+ @main.set_default_size(*@base.config[:main_window_size]) :
+ @main.set_default_size(200,500)
+
+ @main.signal_connect("destroy") { quit }
+ @glade['menuitem_quit'].signal_connect('activate') { quit }
# Load contacts lists and create columns
@contacts = @glade['treeview_contacts']
@@ -166,6 +172,13 @@ def add_item_to_roster(item)
fill_model_values_for_item item, x
end
+
+ def quit
+ debug "saving windows size #{@main.size}"
+ base.config[:main_window_size] = [@window_size_x, @window_size_y]
+ debug "saved as windows size #{@base.config[:main_window_size]}"
+ Gtk.main_quit
+ end
def debug(text)
base.debug("Gui: #{text}")
View
1 lib/onim/gui/account.rb
@@ -16,6 +16,7 @@ def initialize(base,reconnect=false)
base.config[:account_jid] = @glade['entry_jid'].text
base.config[:account_password] = @glade['entry_password'].text
base.connect if reconnect
+ @window.hide
end
@glade['button_cancel'].signal_connect('clicked') do
@window.destroy

0 comments on commit 79f2973

Please sign in to comment.
Something went wrong with that request. Please try again.