gtk3app 1.5.2 → 2.0.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: 0594b70a901c652f54ed0a8e03408ae2b17abc62
4
- data.tar.gz: e424840cb498db6f18b7e2427121da89a0c1b425
3
+ metadata.gz: b96c4a4281b808faf07dcc1978d5d6177f9733ad
4
+ data.tar.gz: 478aaf93598fdd0eb5db2c928a366643acd43026
5
5
  SHA512:
6
- metadata.gz: 62ec6db624de6b385f74a09879f2fc7e87e4feae28bba0a7a54ffca9b42955748388687e91167cce604219108df9baf2437dc1f941f26cfc8276ef7c8f04d4e5
7
- data.tar.gz: c4de44317c87de54c1e7fe6d4b19275688b10d30803238abc27ca2e5116758ffa4e6394cea0288d2f123a1cadeb1545815a8cf0e5b21deb550dbe3553d386e9c
6
+ metadata.gz: 5f8c3bfde80a51ba6a7c9ab006bce48ed104395610a52932c3fb9c636a76e12694a2bc9e621bba10d92aee7e298ff0d2eb58d7cb6850e1e981b0687f5ca67c50
7
+ data.tar.gz: 1426d13c7d8f755897d933ce28f154efde4745658c24c5325c8aa515091904a8d161f020e191c314827cd4960c39cb52e9bf7d9da8597ad4c80bd42a89374655
data/README.rdoc CHANGED
@@ -6,11 +6,11 @@
6
6
 
7
7
  Gtk3App provides a Gtk3 application stub.
8
8
 
9
- It automatically provides for command line options parsing, user configuration, and minime windows.
9
+ It automatically provides for user configuration, and minime windows.
10
10
 
11
11
  == SYNOPSIS:
12
12
 
13
- Given a module file such as ./my_app.rb, the module is expected to at leat provide MyApp.run(program):
13
+ Given a module file such as ./my_app.rb, the module is expected to at least provide MyApp.run(program):
14
14
 
15
15
  module MyApp
16
16
  def self.run(program)
@@ -20,29 +20,16 @@ Given a module file such as ./my_app.rb, the module is expected to at leat provi
20
20
  window.show_all
21
21
  end
22
22
  end
23
+ Gtk3App.main(MyApp)
23
24
 
24
25
  That's enough to get you going.
25
26
  The three examples in the ./examples[https://github.com/carlosjhr64/gtk3app/tree/master/examples]
26
27
  directory fully explains the rest of what Gtk3App can do for you.
27
28
 
28
- == HELP:
29
-
30
- This is the gtk3app stub.
31
- Usage:
32
- gtk3app [options] appname ...
33
- Options:
34
- -h --help Show this help and exit.
35
- -v --version Show the version and exit.
36
- -q --quiet Set $VERBOSE to nil.
37
- -V --verbose Set $VERBOSE to true.
38
- -d --debug Set $DEBUG to true.
39
- appname The name of the application to be run.
40
-
41
29
  == FEATURES:
42
30
 
43
31
  * Such[https://github.com/carlosjhr64/Such] wrappers.
44
32
  * Rafini[https://github.com/carlosjhr64/rafini] refinements.
45
- * HelpParser[https://github.com/carlosjhr64/help_parser] command line options parsing.
46
33
  * UserSpace[https://github.com/carlosjhr64/user_space] XDG support.
47
34
  * MiniMe, an alternative to the deprecated Gtk::StatusIcon.
48
35
  * Popup Application Menu from window button 3 press event (standard left click on application).
@@ -55,7 +42,7 @@ directory fully explains the rest of what Gtk3App can do for you.
55
42
 
56
43
  (The MIT License)
57
44
 
58
- Copyright (c) 2014
45
+ Copyright (c) 2017
59
46
 
60
47
  Permission is hereby granted, free of charge, to any person obtaining
61
48
  a copy of this software and associated documentation files (the
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.2
1
+ 2.0.0
@@ -15,26 +15,6 @@ module Gtk3App
15
15
  # * Lower case bang! keys have special meaning in Such.
16
16
  # * Note that method keys may have mixed case as the method itself.
17
17
  CONFIG = {
18
- # The command line help in standard form.
19
- Help: <<HELP,
20
-
21
- This is the gtk3app stub.
22
-
23
- Usage:
24
-
25
- gtk3app [options] appname ...
26
-
27
- Options:
28
-
29
- -h --help Show this help and exit.
30
- -v --version Show the version and exit.
31
- -q --quiet Set $VERBOSE to nil.
32
- -V --verbose Set $VERBOSE to true.
33
- -d --debug Set $DEBUG to true.
34
-
35
- appname The name of the application to be run.
36
-
37
- HELP
38
18
 
39
19
  # The command to open with default application
40
20
  Open: 'gnome-open',
@@ -63,20 +43,20 @@ HELP
63
43
 
64
44
  # Fullscreen app-menu item
65
45
  # Application MAY modify :FS for language
66
- FS: ['Full Screen'],
46
+ FS: [label: 'Full Screen'],
67
47
  fs: h0,
68
48
  fs!: [:FS, :fs, 'activate'],
69
49
 
70
50
  # About app-menu item
71
51
  # Application MAY modify :ABOUT for language
72
52
  # Application SHOULD modify :about_dialog
73
- ABOUT: ['About'],
53
+ ABOUT: [label: 'About'],
74
54
  about: h0,
75
55
  about!: [:ABOUT, :about, 'activate'],
76
56
  about_dialog: {
77
57
  set_program_name: 'Gtk3App',
78
58
  set_version: VERSION.semantic(0..1),
79
- set_copyright: '(c) 2014 CarlosJHR64',
59
+ set_copyright: '(c) 2017 CarlosJHR64',
80
60
  set_comments: 'A Gtk3 Application Stub',
81
61
  set_website: 'https://github.com/carlosjhr64/gtk3app',
82
62
  set_website_label: 'See it at GitHub!',
@@ -89,19 +69,19 @@ HELP
89
69
 
90
70
  # Help app-menu item
91
71
  # Application MAY modify :HELP for language
92
- HELP: ['Help'],
72
+ HELP: [label: 'Help'],
93
73
  help: h0,
94
74
  help!: [:HELP, :help, 'activate'],
95
75
 
96
76
  # Minime's app-menu item.
97
77
  # Application MAY modify :MINIME for language.
98
- MINIME: ['Mini-me'],
78
+ MINIME: [label: 'Mini-me'],
99
79
  minime: h0,
100
80
  minime!: [:MINIME, :minime, 'activate'],
101
81
 
102
82
  # Quit app-menu item.
103
83
  # Application MAY modify :QUIT for language.
104
- QUIT: ['Quit'],
84
+ QUIT: [label: 'Quit'],
105
85
  quit: h0,
106
86
  quit!: [:QUIT, :quit, 'activate'],
107
87
 
@@ -23,33 +23,8 @@ module Gtk3App
23
23
  $!.puts 'Application is not using APPDIR, VERSION, or CONFIG.'
24
24
  end
25
25
 
26
- def self.options=(h)
27
- @@options=h
28
- end
29
-
30
- def self.options(mod=nil)
31
- if mod
32
- version, help = mod::VERSION, mod::CONFIG[:Help]
33
- if help
34
- # HelpParser enforces -h and -v for help and version respectively.
35
- # To that we add -V, -q, and -d for verbose, quiet, and debug respectively.
36
- options = HELP_PARSER::HelpParser.new(version, help, {verbose: :V, quiet: :q, debug: :d})
37
- $VERBOSE = (options[:q])? nil : (options[:V])? true : false
38
- $DEBUG = true if options[:d] # Don't get to turn off debug
39
- mod.options = options
40
- end
41
- else
42
- @@options
43
- end
44
- rescue NoMethodError
45
- $!.puts 'Application is not providing options setter.'
46
- rescue NameError
47
- $!.puts 'Application is not using VERSION or CONFIG.'
48
- end
49
-
50
- def self.init(mod=Gtk3App)
26
+ def self.init(mod)
51
27
  Gtk3App.config mod
52
- Gtk3App.options mod
53
28
  if thing = mod::CONFIG[:thing]
54
29
  Such::Thing.configure thing
55
30
  end
@@ -57,32 +32,15 @@ module Gtk3App
57
32
  $!.puts 'Application is not using CONFIG.'
58
33
  end
59
34
 
60
- def self.run(appname)
61
- require appname
62
- app = Object.const_get File.basename(appname, '.rb').camelize
35
+ def self.main(app)
36
+ Gtk3App.init Gtk3App
63
37
  Gtk3App.init app
64
- Program.new app
38
+ @program = Program.new app
65
39
  Gtk.main
66
- end
67
-
68
- def self.main
69
- begin
70
- Gtk3App.init
71
- appname = ARGV.shift
72
- if appname
73
- Gtk3App.run appname
74
- else
75
- puts CONFIG[:Help]
76
- end
77
- rescue HELP_PARSER::UsageException
78
- puts $!.message
79
- exit 0
80
- rescue HELP_PARSER::UsageError
81
- $stderr.puts $!.message
82
- exit 64
83
- rescue StandardError
84
- $!.puts
85
- exit 1
86
- end
40
+ rescue StandardError
41
+ $!.puts
42
+ exit 1
43
+ ensure
44
+ @program.release if @program
87
45
  end
88
46
  end
@@ -23,7 +23,6 @@ module Gtk3App
23
23
 
24
24
  @fs = false
25
25
  @slot = nil
26
-
27
26
  app.run(self)
28
27
  end
29
28
 
@@ -34,6 +33,7 @@ module Gtk3App
34
33
 
35
34
  def about!
36
35
  about = Such::AboutDialog.new :about_dialog
36
+ about.transient_for = @window
37
37
  about.set_logo Widget::MainWindow.icon
38
38
  about.run
39
39
  about.destroy
@@ -43,6 +43,13 @@ module Gtk3App
43
43
  system "#{CONFIG[:Open]} '#{Such::Thing::PARAMETERS[:HelpFile]}'"
44
44
  end
45
45
 
46
+ def release
47
+ if @slot
48
+ Slot.release(@slot)
49
+ @slot = nil
50
+ end
51
+ end
52
+
46
53
  def minime!
47
54
  if @window.visible?
48
55
  @slot = Slot.get
@@ -67,16 +74,15 @@ module Gtk3App
67
74
  @mini.show
68
75
  end
69
76
  else
70
- Slot.release(@slot) if @slot
77
+ release
71
78
  @mini.hide
72
79
  @window.show
73
80
  end
74
81
  end
75
82
 
76
83
  def quit!
77
- Slot.release(@slot) if @slot
84
+ release
78
85
  Gtk.main_quit
79
86
  end
80
-
81
87
  end
82
88
  end
data/lib/gtk3app/slot.rb CHANGED
@@ -11,10 +11,9 @@ module Slot
11
11
  end
12
12
 
13
13
  def self.get
14
- alive = Sys::ProcTable.ps.select{|p|p.cmdline=~/ruby.*\bgtk3app\b/}.map{|p|p.pid.to_s}.is(true)
15
14
  Slot.dbm do |db|
16
15
  Slot.numbers do |slot|
17
- unless alive[db[slot]]
16
+ unless db[slot]
18
17
  db[slot]=$$.to_s
19
18
  return slot.to_i
20
19
  end
@@ -27,5 +26,17 @@ module Slot
27
26
  Slot.dbm{|db|db.delete(slot.to_s)}
28
27
  end
29
28
 
29
+ def self.gc
30
+ Thread.new do
31
+ Slot.dbm do |db|
32
+ Slot.numbers do |slot|
33
+ if pid = db[slot]
34
+ db.delete(slot) unless File.directory?("/proc/#{pid}")
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ Slot.gc
30
41
  end
31
42
  end
@@ -27,14 +27,14 @@ module Widget
27
27
  super(*par)
28
28
  end
29
29
 
30
- def append_menu_item(key)
31
- block_given? ? super : super(key, &@block)
30
+ def append_menu_item(key, &block)
31
+ super(key, &(block || @block))
32
32
  end
33
33
  end
34
34
 
35
35
  class MainWindow < Such::Window
36
36
  def self.set_icon(file)
37
- @@icon = Gdk::Pixbuf.new(file: file)
37
+ @@icon = GdkPixbuf::Pixbuf.new(file: file)
38
38
  end
39
39
 
40
40
  def self.icon
data/lib/gtk3app.rb CHANGED
@@ -1,7 +1,6 @@
1
- # Rogues
2
-
3
- require 'json'
4
- require 'psych'
1
+ module Gtk3App
2
+ VERSION = '2.0.0'
3
+ end
5
4
 
6
5
  # Standard Libraries
7
6
 
@@ -10,10 +9,8 @@ require 'sdbm'
10
9
 
11
10
  # Supporting Gems
12
11
 
13
- require 'help_parser'
14
12
  require 'user_space'
15
13
  require 'rafini'
16
- require 'sys/proctable'
17
14
 
18
15
  # Workhorse Gems
19
16
 
@@ -26,7 +23,6 @@ Such::Things.gtk_widget
26
23
 
27
24
  # Configuration
28
25
 
29
- require 'gtk3app/version.rb'
30
26
  require 'gtk3app/config.rb'
31
27
 
32
28
  # Custom Widgets & Dialogs
metadata CHANGED
@@ -1,115 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk3app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.8.3
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.8'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.8.3
33
- - !ruby/object:Gem::Dependency
34
- name: psych
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2.0'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 2.0.8
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '2.0'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 2.0.8
53
- - !ruby/object:Gem::Dependency
54
- name: gtk3
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.0'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 3.0.7
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.0'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 3.0.7
73
- - !ruby/object:Gem::Dependency
74
- name: help_parser
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '1.2'
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 1.2.0
83
- type: :runtime
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.2'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 1.2.0
93
13
  - !ruby/object:Gem::Dependency
94
14
  name: user_space
95
15
  requirement: !ruby/object:Gem::Requirement
96
16
  requirements:
97
17
  - - "~>"
98
18
  - !ruby/object:Gem::Version
99
- version: '2.0'
19
+ version: '2.1'
100
20
  - - ">="
101
21
  - !ruby/object:Gem::Version
102
- version: 2.0.1
22
+ version: 2.1.0
103
23
  type: :runtime
104
24
  prerelease: false
105
25
  version_requirements: !ruby/object:Gem::Requirement
106
26
  requirements:
107
27
  - - "~>"
108
28
  - !ruby/object:Gem::Version
109
- version: '2.0'
29
+ version: '2.1'
110
30
  - - ">="
111
31
  - !ruby/object:Gem::Version
112
- version: 2.0.1
32
+ version: 2.1.0
113
33
  - !ruby/object:Gem::Dependency
114
34
  name: rafini
115
35
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +39,7 @@ dependencies:
119
39
  version: '1.2'
120
40
  - - ">="
121
41
  - !ruby/object:Gem::Version
122
- version: 1.2.0
42
+ version: 1.2.1
123
43
  type: :runtime
124
44
  prerelease: false
125
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,60 +49,58 @@ dependencies:
129
49
  version: '1.2'
130
50
  - - ">="
131
51
  - !ruby/object:Gem::Version
132
- version: 1.2.0
52
+ version: 1.2.1
133
53
  - !ruby/object:Gem::Dependency
134
- name: sys-proctable
54
+ name: gtk3
135
55
  requirement: !ruby/object:Gem::Requirement
136
56
  requirements:
137
57
  - - "~>"
138
58
  - !ruby/object:Gem::Version
139
- version: '0.9'
59
+ version: '3.1'
140
60
  - - ">="
141
61
  - !ruby/object:Gem::Version
142
- version: 0.9.9
62
+ version: 3.1.8
143
63
  type: :runtime
144
64
  prerelease: false
145
65
  version_requirements: !ruby/object:Gem::Requirement
146
66
  requirements:
147
67
  - - "~>"
148
68
  - !ruby/object:Gem::Version
149
- version: '0.9'
69
+ version: '3.1'
150
70
  - - ">="
151
71
  - !ruby/object:Gem::Version
152
- version: 0.9.9
72
+ version: 3.1.8
153
73
  - !ruby/object:Gem::Dependency
154
74
  name: such
155
75
  requirement: !ruby/object:Gem::Requirement
156
76
  requirements:
157
77
  - - "~>"
158
78
  - !ruby/object:Gem::Version
159
- version: '0.3'
79
+ version: '0.4'
160
80
  - - ">="
161
81
  - !ruby/object:Gem::Version
162
- version: 0.3.0
82
+ version: 0.4.0
163
83
  type: :runtime
164
84
  prerelease: false
165
85
  version_requirements: !ruby/object:Gem::Requirement
166
86
  requirements:
167
87
  - - "~>"
168
88
  - !ruby/object:Gem::Version
169
- version: '0.3'
89
+ version: '0.4'
170
90
  - - ">="
171
91
  - !ruby/object:Gem::Version
172
- version: 0.3.0
92
+ version: 0.4.0
173
93
  description: |
174
- _Gtk3App_ provides a _Gtk3_ application stub.
94
+ Gtk3App provides a Gtk3 application stub.
175
95
 
176
- It automatically provides for command line options parsing, user configuration, and minime windows.
96
+ It automatically provides for user configuration, and minime windows.
177
97
  email: carlosjhr64@gmail.com
178
- executables:
179
- - gtk3app
98
+ executables: []
180
99
  extensions: []
181
100
  extra_rdoc_files:
182
101
  - README.rdoc
183
102
  files:
184
103
  - README.rdoc
185
- - bin/gtk3app
186
104
  - data/VERSION
187
105
  - data/logo.png
188
106
  - data/ruby.png
@@ -192,7 +110,6 @@ files:
192
110
  - lib/gtk3app/gtk3app.rb
193
111
  - lib/gtk3app/program.rb
194
112
  - lib/gtk3app/slot.rb
195
- - lib/gtk3app/version.rb
196
113
  - lib/gtk3app/widget/widgets.rb
197
114
  homepage: https://github.com/carlosjhr64/gtk3app
198
115
  licenses:
@@ -215,11 +132,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
132
  - !ruby/object:Gem::Version
216
133
  version: '0'
217
134
  requirements:
218
- - 'ruby: ruby 2.2.4p230'
219
- - 'system: linux fedora 23'
135
+ - 'ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]'
220
136
  rubyforge_project:
221
- rubygems_version: 2.4.5.1
137
+ rubygems_version: 2.6.11
222
138
  signing_key:
223
139
  specification_version: 4
224
- summary: _Gtk3App_ provides a _Gtk3_ application stub.
140
+ summary: Gtk3App provides a Gtk3 application stub.
225
141
  test_files: []
data/bin/gtk3app DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'gtk3app'
3
- Gtk3App.main
@@ -1,3 +0,0 @@
1
- module Gtk3App
2
- VERSION = '1.5.2'
3
- end