iconify 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f88b781da3aee4c1090ee46c7166adf93139675f
4
- data.tar.gz: 43760935e2287349a47636af6ddf02570c215b08
3
+ metadata.gz: 77f5ba6428215e6714068c04ba0ac9f6112522e2
4
+ data.tar.gz: 86effae2ea2f63f5a2cccb91d6ba13aff88bafb4
5
5
  SHA512:
6
- metadata.gz: 83e04021817c01873593fab8c234e8ccb4fc17e22778e4a4714f6745634465628209c8b535fbc63486d895b5149c74146fe2676f375675724e1bd086f822cec1
7
- data.tar.gz: 995d4728461f71c24570b36f064f98cd2c349da76525bafcbd528bc58c1d7c90c1150b957281c4eb793dd60ea938efef2566255038a761083d240e4b414eb4ce
6
+ metadata.gz: 4c25bc69efd9b485c792ddedcf6b5ac9ff897b3f903959b3f6e42974b631244ad5da1c6c50465f1d18bb082bc0c20e7313dafcf3051f3715e6ccd8b029be559b
7
+ data.tar.gz: 838730d2b89ea8b625b57ce2a3c7fd8fc1ac4329f1f2ade8c4c3a6676b691df62429bda6085cfd23a82271cf38a29dd7691056ffe7fb9bfdb0347972eb89207c
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *~
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "gtk2"
23
- spec.add_dependency "vte"
22
+ spec.add_dependency "gtk3"
23
+ spec.add_dependency "vte3"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.11"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,5 +1,5 @@
1
- require 'gtk2'
2
- require 'vte'
1
+ require 'gtk3'
2
+ require 'vte3'
3
3
 
4
4
  require "iconify/version"
5
5
  require "iconify/program"
@@ -20,14 +20,17 @@ class TerminalWindow < Gtk::Window
20
20
  @argv = argv
21
21
 
22
22
  @terminal = Vte::Terminal.new
23
+ @terminal.font = Pango::FontDescription.new("monospace 14")
24
+ @terminal.set_size_request(@terminal.char_width * 80, @terminal.char_height * 24)
25
+ @terminal.cursor_blink_mode = Vte::CursorBlinkMode::OFF
23
26
 
24
27
  self.title = "iconify - #{argv[0]}"
25
28
 
26
29
  @state = :stopped
27
30
 
28
- vbox = VBox.new
29
- hbox = HButtonBox.new
30
- rerun_button = Button.new("Rerun")
31
+ vbox = Box.new(:vertical)
32
+ hbox = ButtonBox.new(:horizontal)
33
+ rerun_button = Button.new(label: "Rerun")
31
34
  rerun_button.signal_connect('clicked') do
32
35
  self.exec
33
36
  end
@@ -35,7 +38,7 @@ class TerminalWindow < Gtk::Window
35
38
  rerun_button.sensitive = (@state == :stopped)
36
39
  end
37
40
 
38
- kill_button = Button.new("Kill")
41
+ kill_button = Button.new(label: "Kill")
39
42
  kill_button.signal_connect('clicked') do
40
43
  Process.kill("KILL", @pid) if @pid
41
44
  end
@@ -43,15 +46,15 @@ class TerminalWindow < Gtk::Window
43
46
  kill_button.sensitive = (@state == :running)
44
47
  end
45
48
 
46
- quit_button = Button.new("Quit")
49
+ quit_button = Button.new(label: "Quit")
47
50
  quit_button.signal_connect('clicked') do
48
51
  Gtk.main_quit
49
52
  end
50
53
  hbox.pack_start(rerun_button)
51
54
  hbox.pack_start(kill_button)
52
55
  hbox.pack_start(quit_button)
53
- vbox.pack_start(hbox, false)
54
- vbox.pack_start(@terminal)
56
+ vbox.pack_start(hbox, expand: false)
57
+ vbox.pack_start(@terminal, expand: true, fill: true)
55
58
 
56
59
  add vbox
57
60
 
@@ -64,7 +67,7 @@ class TerminalWindow < Gtk::Window
64
67
  end
65
68
 
66
69
  def exec
67
- @pid = @terminal.fork_command(argv: @argv)
70
+ @pid = @terminal.spawn(argv: @argv)
68
71
  @state = :running
69
72
  signal_emit('changed')
70
73
  end
@@ -95,9 +98,11 @@ class CommandStatusIcon < Gtk::StatusIcon
95
98
  end
96
99
 
97
100
  def redraw
98
- pixmap = Gdk::Pixmap.new(nil, 64, 64, 24)
101
+ # pixmap = Gdk::Pixmap.new(nil, 64, 64, 24)
99
102
 
100
- cr = pixmap.create_cairo_context
103
+ image_surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, 64, 64)
104
+
105
+ cr = Cairo::Context.new(image_surface)
101
106
 
102
107
  cr.set_source_rgb(0.8, 0.8, 0.8)
103
108
  cr.set_operator(Cairo::OPERATOR_SOURCE)
@@ -114,8 +119,10 @@ class CommandStatusIcon < Gtk::StatusIcon
114
119
 
115
120
  cr.destroy
116
121
 
117
- buf = Gdk::Pixbuf.from_drawable(nil, pixmap, 0, 0, 64, 64)
122
+ buf = image_surface.to_pixbuf(0, 0, 64, 64)
118
123
  self.pixbuf = buf
124
+
125
+ image_surface.destroy
119
126
  end
120
127
 
121
128
  end
@@ -11,7 +11,7 @@ class Program
11
11
  @terminal_window = TerminalWindow.new(argv)
12
12
  @terminal_window.signal_connect('delete-event') do
13
13
  if @status_icon.embedded?
14
- hide
14
+ @terminal_window.hide
15
15
  else
16
16
  run_dialog("The status icon is not embedded in a notification area. The window cannot be hidden.")
17
17
  end
@@ -22,7 +22,7 @@ class Program
22
22
  @terminal_window.icon = @status_icon.pixbuf
23
23
  end
24
24
  @terminal_window.show_all
25
- Gtk.timeout_add(500) do
25
+ GLib::Timeout.add(500) do
26
26
  if @status_icon.embedded?
27
27
  @terminal_window.hide
28
28
  else
@@ -1,3 +1,3 @@
1
1
  module Iconify
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iconify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoteichi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gtk2
14
+ name: gtk3
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: vte
28
+ name: vte3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="