gtk2_window_settings 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gtk2_window_settings}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-08-31}
12
+ s.date = %q{2012-09-03}
13
13
  s.description = %q{A class for remembering window-settings using the gtk2-extension for Ruby.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
@@ -53,18 +53,38 @@ class Gtk2_window_settings
53
53
 
54
54
  #Initialize events for the window.
55
55
  @window.signal_connect_after(:size_request, &self.method(:on_window_size_request))
56
- @window.signal_connect("configure-event", &self.method(:on_window_moved))
56
+ @window.signal_connect(:configure_event, &self.method(:on_window_moved))
57
57
  end
58
58
 
59
59
  #Called when the window is resized. Writes the new size to the database.
60
60
  def on_window_size_request(*args)
61
- size = @window.size
62
- @db.update(:Gtk2_window_settings, {:width => size[0], :height => size[1]}, {:id => @id}) if size[0].to_i > 0 and size[1].to_i > 0
61
+ Gtk.timeout_remove(@size_request_timeout) if @size_request_timeout
62
+
63
+ @size_request_timeout = Gtk.timeout_add(500) do
64
+ @size_request_timeout = nil
65
+
66
+ if @window and !@window.destroyed?
67
+ size = @window.size
68
+ @db.update(:Gtk2_window_settings, {:width => size[0], :height => size[1]}, {:id => @id}) if size[0].to_i > 0 and size[1].to_i > 0
69
+ end
70
+
71
+ false
72
+ end
63
73
  end
64
74
 
65
75
  #Called when the window is moved on the screen. Writes the new size to the database.
66
76
  def on_window_moved(*args)
67
- pos = @window.position
68
- @db.update(:Gtk2_window_settings, {:pos_x => pos[0], :pos_y => pos[1], :pos_registered => 1}, {:id => @id}) if pos[0].to_i >= 0 and pos[1].to_i >= 0
77
+ Gtk.timeout_remove(@moved_timeout) if @moved_timeout
78
+
79
+ @moved_timeout = Gtk.timeout_add(500) do
80
+ @moved_timeout = nil
81
+
82
+ if @window and !@window.destroyed?
83
+ pos = @window.position
84
+ @db.update(:Gtk2_window_settings, {:pos_x => pos[0], :pos_y => pos[1], :pos_registered => 1}, {:id => @id}) if pos[0].to_i >= 0 and pos[1].to_i >= 0
85
+ end
86
+
87
+ false
88
+ end
69
89
  end
70
90
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gtk2_window_settings
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-31 00:00:00 +02:00
13
+ date: 2012-09-03 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- hash: 1155678659261391077
118
+ hash: 2803892222156544132
119
119
  segments:
120
120
  - 0
121
121
  version: "0"