iconify 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24ae5aa904680d54548d5a6e969676639da0e3f3
4
- data.tar.gz: 90b5894bda15633dcd1042425f759320321a1093
3
+ metadata.gz: f88b781da3aee4c1090ee46c7166adf93139675f
4
+ data.tar.gz: 43760935e2287349a47636af6ddf02570c215b08
5
5
  SHA512:
6
- metadata.gz: 59da713d6cadb23eba8768da3072cb6ea7ddb45009a5b0a0b429a3190b9fde1ce2e6b9596fa43b40120c0761ad6755a18d4b8faa4c39800417ee414e8d047171
7
- data.tar.gz: c7d2d37fea5c58fa3f643410ec3599f8d9e909afd12a7ec128eb8db40118d9fa0a8e33d2221f6cb822a10c392fa4dd2998d393b41fa3aa9f6fc9863e91aa600c
6
+ metadata.gz: 83e04021817c01873593fab8c234e8ccb4fc17e22778e4a4714f6745634465628209c8b535fbc63486d895b5149c74146fe2676f375675724e1bd086f822cec1
7
+ data.tar.gz: 995d4728461f71c24570b36f064f98cd2c349da76525bafcbd528bc58c1d7c90c1150b957281c4eb793dd60ea938efef2566255038a761083d240e4b414eb4ce
@@ -23,10 +23,6 @@ class TerminalWindow < Gtk::Window
23
23
 
24
24
  self.title = "iconify - #{argv[0]}"
25
25
 
26
- signal_connect('delete-event') do
27
- hide
28
- end
29
-
30
26
  @state = :stopped
31
27
 
32
28
  vbox = VBox.new
@@ -9,15 +9,30 @@ class Program
9
9
  @argv = argv
10
10
  @status_icon = CommandStatusIcon.new(argv[0])
11
11
  @terminal_window = TerminalWindow.new(argv)
12
+ @terminal_window.signal_connect('delete-event') do
13
+ if @status_icon.embedded?
14
+ hide
15
+ else
16
+ run_dialog("The status icon is not embedded in a notification area. The window cannot be hidden.")
17
+ end
18
+ true # do not close
19
+ end
12
20
  @terminal_window.signal_connect('changed') do
13
21
  @status_icon.set_state(@terminal_window.state)
14
22
  @terminal_window.icon = @status_icon.pixbuf
15
23
  end
16
24
  @terminal_window.show_all
17
- @terminal_window.hide
25
+ Gtk.timeout_add(500) do
26
+ if @status_icon.embedded?
27
+ @terminal_window.hide
28
+ else
29
+ run_dialog("Iconify has detected its status icon is not embedded in a notification area. The window cannot be hidden.")
30
+ end
31
+ false # one time
32
+ end
18
33
 
19
34
  @status_icon.signal_connect("activate") do
20
- if @terminal_window.visible?
35
+ if @terminal_window.visible? && @status_icon.embedded?
21
36
  @terminal_window.hide
22
37
  else
23
38
  @terminal_window.show
@@ -25,6 +40,16 @@ class Program
25
40
  end
26
41
  end
27
42
 
43
+ def run_dialog(message)
44
+ dialog = Gtk::MessageDialog.new(@terminal_window,
45
+ Gtk::Dialog::DESTROY_WITH_PARENT,
46
+ Gtk::MessageDialog::QUESTION,
47
+ Gtk::MessageDialog::BUTTONS_CLOSE,
48
+ message)
49
+ dialog.run
50
+ dialog.destroy
51
+ end
52
+
28
53
  def run
29
54
  @terminal_window.exec
30
55
  Gtk.main
@@ -1,3 +1,3 @@
1
1
  module Iconify
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iconify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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-02 00:00:00.000000000 Z
11
+ date: 2016-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk2