gtk3app 3.0.0 → 4.0.210128

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
  SHA256:
3
- metadata.gz: 25f1d4d3cc539cbaa2e1c8961dc053d5d713bee8a32d95fafe9e4f2914fa9cc6
4
- data.tar.gz: 83a1c8e493598daffca2618d0a7ecc10112a8afddab7a709a7f98270c5324105
3
+ metadata.gz: 82fe60ac20bffaf0840a5df94109d2d842b1f409e6349b80a1f7f8e4061c1b91
4
+ data.tar.gz: c7e9504cf4c894c049ecc08da84667746a5c17b372082e113b0ea34b4a00e261
5
5
  SHA512:
6
- metadata.gz: 676586049ff04b8595e856bffc723a12e009a0165f352918da887af9ee772866d6a7d4db53c4dccce30c703dfcf9fd09446c09c44fdf9a81522e19ea14403b32
7
- data.tar.gz: 46ed7d0cd569a66b71f7f8636f5aade898d6da90c3508c27fdcc2a8b00c79737b78adff762fcb975df66bdc912e6d1ce4df73d7db8ed8f5fdb6b4f88d81f0b8e
6
+ metadata.gz: b54f387d4b6b6ca22fe60893bc4055a731261408bf72485f674b62c1a4bd94ea534b9d69bb609cb22494bb903003dd55b48b9d000a9bc6f5189eee79cc7508a1
7
+ data.tar.gz: 271c4fc554b1e00d5601c789751d97127b1ee932dfd67b1c3db72ae193d6f5555394596157153b690fdfa6b416c7913b154f54b26491624369e84731991b428c
data/README.md CHANGED
@@ -1,29 +1,37 @@
1
- # gt3applib
1
+ # Gtk3App
2
+
3
+ * [VERSION 4.0.210128](https://github.com/carlosjhr64/gtk3app/releases)
4
+ * [github](https://www.github.com/carlosjhr64/gtk3app)
5
+ * [rubygems](https://rubygems.org/gems/gtk3app)
6
+
7
+ ![stub](examples/stub.png)
2
8
 
3
9
  ## DESCRIPTION:
4
10
 
5
11
  Gtk3App provides a
6
12
  [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
7
13
  application stub.
8
- It automatically provides for user configuration, application menu, and minime window.
14
+
15
+ The stub provides you with two Expander containers.
16
+ One for a horizontal toolbar.
17
+ The other for your main stage area.
18
+
19
+ ## INSTALL:
20
+
21
+ ```shell
22
+ $ sudo gem install gtk3app
23
+ ```
9
24
 
10
25
  ## SYNOPSIS:
11
26
 
12
- Given a module file such as `~./my_app.rb` providing `MyApp`, the module is expected to at least provide MyApp.run(program):
13
-
14
- module MyApp
15
- def self.run(program)
16
- window = program.window
17
- # develop as you would on a Gtk3::Window object...
18
- # ...probably a good idea to show all your work.
19
- window.show_all
20
- self
21
- end
22
- def self.finalyze
23
- # do any cleanups needed at quit time...
24
- end
25
- end
26
- Gtk3App.main(MyApp)
27
+ ```ruby
28
+ require 'gtk3app'
29
+ # Expander = Such::Expander < Gtk::Expander
30
+ # Gtk3App.run do |Expander container, Expander toolbar, HelpParser options|
31
+ Gtk3App.run do |stage, toolbar, options|
32
+ # add stuff to stage and toolbar
33
+ end
34
+ ```
27
35
 
28
36
  That's enough to get you going.
29
37
  The three examples in the [./examples](https://github.com/carlosjhr64/gtk3app/tree/master/examples)
@@ -31,21 +39,19 @@ directory fully explains the rest of what Gtk3App can do for you.
31
39
 
32
40
  ## FEATURES:
33
41
 
34
- * [Such](https://github.com/carlosjhr64/Such) wrappers.
35
- * [Rafini](https://github.com/carlosjhr64/rafini) refinements.
36
- * [UserSpace](https://github.com/carlosjhr64/user_space) XDG support.
37
- * MiniMe, an alternative to the deprecated Gtk::StatusIcon.
38
- * Popup Application Menu from window button 3 press event (standard left click on application).
39
-
40
- ## INSTALL:
42
+ * xdg directory maintainance via [UserSpace](https://www.github.com/carlosjhr64/user_space)
43
+ * cofiguration via [RBON](https://www.github.com/carlosjhr64/rbon)
44
+ * command line options via [HelpParser](https://www.github.com/carlosjhr64/Ruby-HelpParser)
45
+ * [Such](https://github.com/carlosjhr64/Such) Gtk::Widget wrappers.
46
+ * default application menu
47
+ * minime window
41
48
 
42
- $ sudo gem install gtk3app
43
49
 
44
50
  ## LICENSE:
45
51
 
46
52
  * The MIT License
47
53
 
48
- Copyright (c) 2017
54
+ Copyright (c) 2021 CarlosJHR64
49
55
 
50
56
  Permission is hereby granted, free of charge, to any person obtaining
51
57
  a copy of this software and associated documentation files (the
data/lib/gtk3app.rb CHANGED
@@ -1,29 +1,21 @@
1
- module Gtk3App
2
- VERSION = '3.0.0'
3
- end
4
-
5
- # Standard Libraries
6
- require 'yaml'
7
- require 'sdbm'
8
-
9
1
  # Supporting Gems
2
+ require 'help_parser'
10
3
  require 'user_space'
11
4
  require 'rafini'
5
+ require 'rbon'
12
6
 
13
7
  # Workhorse Gems
14
8
  require 'gtk3'
15
9
  require 'such'
16
- Such::Things.gtk_widget
10
+ Such::Things.in Gtk::Widget
17
11
 
18
- ### Gtk3App ###
19
- # Configuration
20
- require_relative 'gtk3app/config.rb'
21
- # Custom Widgets
22
- require_relative 'gtk3app/widget/widgets.rb'
23
- # Program Flow
24
- require_relative 'gtk3app/slot.rb'
25
- require_relative 'gtk3app/program.rb'
26
- require_relative 'gtk3app/gtk3app.rb'
12
+ # This Gem
13
+ module Gtk3App
14
+ VERSION = '4.0.210128'
27
15
 
16
+ require 'gtk3app/config'
17
+ require 'gtk3app/widgets'
18
+ require 'gtk3app/program'
19
+ end
28
20
  # Requires:
29
21
  #`ruby`
@@ -1,12 +1,14 @@
1
1
  module Gtk3App
2
- using Rafini::String
2
+ using Rafini::String # provides String#semantic
3
+ extend Rafini::Empty # provides s0, a0, and h0.
3
4
 
4
- # The gem's root directory
5
- APPDIR = File.dirname File.dirname __dir__
6
-
7
- a0 = Rafini::Empty::ARRAY
8
- h0 = Rafini::Empty::HASH
9
- s0 = Rafini::Empty::STRING
5
+ HELP = <<~HELP
6
+ Usage:
7
+ #{File.basename $0} [:options+]
8
+ Options:
9
+ --notoggle Minime wont toggle decorated and keep above
10
+ --notdecorated Dont decorate window
11
+ HELP
10
12
 
11
13
  # CONFIG follows the following conventions:
12
14
  # * Strings and numbers are mixed case.
@@ -15,97 +17,90 @@ module Gtk3App
15
17
  # * Lower case bang! keys have special meaning in Such.
16
18
  # * Note that method keys may have mixed case as the method itself.
17
19
  CONFIG = {
20
+ # Application SHOULD modify LOGO to use it's own logo image.
21
+ Logo: "#{UserSpace::XDG['data']}/gtk3app/logo.png",
22
+ # Scale logo to this size.
23
+ LogoSize: 25,
18
24
 
19
25
  # The command to open with default application
20
- Open: 'gnome-open',
21
-
22
- Slots: 13, # The number of minime slots
23
- SlotsDBM: "#{XDG['CACHE']}/gtk3app/slots.sdbm", # slot management database
24
- SLOTS_OFFSET: [0,0], # The offset from the bottom right corner
25
- SlotsScale: 25, # The size of the slots
26
- SlotsOrientation: :horizontal,
27
-
28
- thing: { # The application MAY overwrite some these
29
-
30
- # Main window configuration
31
- WINDOW: a0, # Window.new's parameters
32
- window: h0, # window settings
33
- window!: [:WINDOW,:window],
34
-
35
- # Minime's configuration
36
- # Application SHOULD NOT modify these.
37
- MINI: a0,
38
- mini: {
39
- set_decorated: false,
40
- minime: a0,
41
- },
42
- mini!: [:MINI,:mini],
43
-
44
- # Fullscreen app-menu item
45
- # Application MAY modify :FS for language
46
- FS: [label: 'Full Screen'],
47
- fs: h0,
48
- fs!: [:FS, :fs, 'activate'],
49
-
50
- # About app-menu item
51
- # Application MAY modify :ABOUT for language
52
- # Application SHOULD modify :about_dialog
53
- ABOUT: [label: 'About'],
54
- about: h0,
55
- about!: [:ABOUT, :about, 'activate'],
56
- about_dialog: {
57
- set_program_name: 'Gtk3App',
58
- set_version: VERSION.semantic(0..1),
59
- set_copyright: '(c) 2018 CarlosJHR64',
60
- set_comments: 'A Gtk3 Application Stub',
61
- set_website: 'https://github.com/carlosjhr64/gtk3app',
62
- set_website_label: 'See it at GitHub!',
63
- },
64
- # Application SHOULD modify LOGO to use it's own logo image.
65
- Logo: "#{XDG['DATA']}/gtk3app/logo.png",
66
- # Application SHOULD modify :HelpFile to their own help page.
67
- HelpFile: 'https://github.com/carlosjhr64/gtk3app',
68
- # By convention, I'm using mix case for simple String configurations in here thing.
69
-
70
- # Help app-menu item
71
- # Application MAY modify :HELP for language
72
- HELP: [label: 'Help'],
73
- help: h0,
74
- help!: [:HELP, :help, 'activate'],
75
-
76
- # Minime's app-menu item.
77
- # Application MAY modify :MINIME for language.
78
- MINIME: [label: 'Mini-me'],
79
- minime: h0,
80
- minime!: [:MINIME, :minime, 'activate'],
81
-
82
- # Quit app-menu item.
83
- # Application MAY modify :QUIT for language.
84
- QUIT: [label: 'Quit'],
85
- quit: h0,
86
- quit!: [:QUIT, :quit, 'activate'],
87
-
88
- # The app menu configuration.
89
- # The application MAY ONLY modify app_menu.add_menu_item
90
- # by removing un-wanted app menu items.
91
- # Note that you can reference the item.key,
92
- # see: Gtk3App::Widget::MenuItem < Such::MenuItem
93
- APP_MENU: a0,
94
- app_menu: {
95
- add_menu_item: [:fs!, :about!, :help!, :minime!, :quit!],
96
- },
97
- app_menu!: [:APP_MENU, :app_menu, s0],
98
-
99
- # Minime's app-menu configuration.
100
- # The application SHOULD NOT modify
101
- # (the application will have the opportunity later to modify
102
- # minime's app-menu directly).
103
- MINI_MENU: a0,
104
- mini_menu: {
105
- add_menu_item: [:quit!],
106
- },
107
- mini_menu!: [:MINI_MENU, :mini_menu, s0],
108
-
26
+ Open: 'xdg-open',
27
+
28
+ # Main window configuration
29
+ MAIN: a0, # Window.new's parameters
30
+ main: h0, # window settings
31
+ main!: [:MAIN,:main],
32
+
33
+ # Expander stage configuration
34
+ STAGE: a0,
35
+ stage: {set_expanded:true},
36
+ stage!: [:STAGE, :stage],
37
+
38
+ # Expander toolbar configuration
39
+ TOOLBAR: a0,
40
+ toolbar: {set_expanded:true},
41
+ toolbar!: [:TOOLBAR, :toolbar],
42
+
43
+ # Fullscreen app-menu item
44
+ # Application MAY modify :FS for language
45
+ FS: [label: 'Full Screen'],
46
+ fs: h0,
47
+ fs!: [:FS, :fs, 'activate'],
48
+
49
+ # About app-menu item
50
+ # Application MAY modify :ABOUT for language
51
+ # Application SHOULD modify :about_dialog
52
+ ABOUT: [label: 'About'],
53
+ about: h0,
54
+ about!: [:ABOUT, :about, 'activate'],
55
+ about_dialog: {
56
+ set_program_name: 'Gtk3App',
57
+ set_version: VERSION.semantic(0..1),
58
+ set_copyright: '(c) 2021 CarlosJHR64',
59
+ set_comments: 'A Gtk3 Application Stub',
60
+ set_website: 'https://github.com/carlosjhr64/gtk3app',
61
+ set_website_label: 'See it at GitHub!',
62
+ },
63
+ # Application SHOULD modify :HelpFile to their own help page.
64
+ HelpFile: 'https://github.com/carlosjhr64/gtk3app',
65
+
66
+ # Help app-menu item
67
+ # Application MAY modify :HELP for language
68
+ HELP: [label: 'Help'],
69
+ help: h0,
70
+ help!: [:HELP, :help, 'activate'],
71
+
72
+ # Minime's app-menu item.
73
+ # Application MAY modify :MINIME for language.
74
+ MINIME: [label: 'Minime'],
75
+ minime: h0,
76
+ minime!: [:MINIME, :minime, 'activate'],
77
+
78
+ # Quit app-menu item.
79
+ # Application MAY modify :QUIT for language.
80
+ QUIT: [label: 'Quit'],
81
+ quit: h0,
82
+ quit!: [:QUIT, :quit, 'activate'],
83
+
84
+ # Quit confirmation dialog.
85
+ QUIT_URSURE: a0,
86
+ quit_ursure: {add_label: 'Quit?'},
87
+ quit_ursure!: [:QUIT_URSURE, :quit_ursure],
88
+
89
+ # Quit Exception(raised by finalizer) message
90
+ QUIT_EXCEPTION: a0,
91
+ quit_exception: {set_message_type: :info},
92
+ quit_exception!: [:QUIT_EXCEPTION, :quit_exception],
93
+
94
+ # The app menu configuration.
95
+ # The application MAY ONLY modify app_menu.add_menu_item
96
+ # by removing un-wanted app menu items.
97
+ # Note that you can reference the item.key,
98
+ # see: Gtk3App::Widget::MenuItem < Such::MenuItem
99
+ APP_MENU: a0,
100
+ app_menu: {
101
+ add_menu_item: [ :minime!, :fs!, :help!, :about!, :quit! ],
109
102
  },
103
+ # s0 tells AppMenu not to connect to any signal, otherwise it assumes "clicked".
104
+ app_menu!: [:APP_MENU, :app_menu, s0],
110
105
  }
111
106
  end
@@ -1,90 +1,164 @@
1
1
  module Gtk3App
2
- class Program
3
- using Rafini::Array
2
+ class << self
3
+ # Gtk2App.run(version:String?, help:String?, klass:(Class | Module)?), appdir:String?, appname:String?, config:Hash?)
4
+ def run(**kw)
5
+ kw[:appdir] ||= UserSpace.appdir
6
+ ensure_keywords(kw)
7
+ @options = HelpParser[kw[:version], kw[:help]]
8
+ install(kw)
4
9
 
5
- attr_reader :window, :app_menu, :mini, :mini_menu, :fs, :slot
6
- def initialize(app)
7
- @gui = nil # Initialized
8
- Widget::MainWindow.set_icon Such::Thing::PARAMETERS[:Logo]
10
+ Such::Thing.configure CONFIG
11
+ @main = Such::Window.new :main!, 'delete-event' do quit! end
12
+ @main.set_decorated false if @options.notdecorated
9
13
 
10
- @window = Widget::MainWindow.new(:window!, 'delete-event'){quit!}
14
+ vbox = Such::Box.new @main, [:vertical]
15
+ hbox = Such::Box.new vbox, [:horizontal]
11
16
 
12
- @app_menu = Widget::AppMenu.new(@window, :app_menu!) do |w,*_,s|
13
- self.method(w.key).call if s=='activate'
17
+ size = CONFIG[:LogoSize]
18
+ @pixbuf = GdkPixbuf::Pixbuf.new(file:CONFIG[:Logo]).scale(size,size)
19
+ logo = Gtk3App::EventImage.new hbox, [pixbuf:@pixbuf]
20
+ Gtk3App::AppMenu.new(logo, :app_menu!) do |widget,*e,signal|
21
+ case signal
22
+ when 'activate'
23
+ send widget.key
24
+ when 'button_press_event'
25
+ @logo_press_event.call(e[0].button) if @logo_press_event
14
26
  end
27
+ end
15
28
 
16
- @mini = @mini_menu = nil
17
- if @app_menu.children.which{|item| item.key==:minime!}
18
- @mini = Widget::MainWindow.new(:mini, 'delete-event'){quit!}
19
- @mini_menu = Widget::AppMenu.new(@mini, :mini_menu!) do |w,*_,s|
20
- self.method(w.key).call if s=='activate'
21
- minime! if s=='button_press_event'
22
- end
23
- end
29
+ @stage = Such::Expander.new vbox, :stage!
30
+ @toolbar = Such::Expander.new hbox, :toolbar!
24
31
 
25
- @fs = false
26
- @slot = nil
27
- @gui = app.run(self)
28
- end
32
+ kw[:klass]&.new(@stage, @toolbar, @options) or yield(@stage, @toolbar, @options)
29
33
 
30
- def fs!
31
- @fs ? @window.unfullscreen : @window.fullscreen
32
- @fs = !@fs
33
- end
34
+ @minime = @fs = false
35
+ @main.show_all
36
+ Gtk.main
37
+ end
34
38
 
35
- def about!
36
- about = Such::AboutDialog.new :about_dialog
37
- about.transient_for = @window
38
- about.set_logo Widget::MainWindow.icon
39
- about.run
40
- about.destroy
39
+ def raise_argument_error(kw)
40
+ $stderr.puts 'Expected Signature:'
41
+ $stderr.puts ' Gtk3App.run(version:String?, help:String?, :klass:Class?, appdir:String?, :appname:String? config:Hash?)'
42
+ raise ArgumentError, kw.inspect
43
+ end
44
+
45
+ def ensure_keywords(kw)
46
+ keys = [:version, :help, :klass, :appdir, :appname, :config]
47
+ raise_argument_error(kw) if kw.keys.any?{not keys.include?_1}
48
+ klass = kw[:klass]
49
+
50
+ unless kw[:version]
51
+ if klass and defined? klass::VERSION
52
+ kw[:version] = klass::VERSION
53
+ else
54
+ kw[:version] = (defined? ::VERSION)? ::VERSION : VERSION
55
+ end
41
56
  end
42
57
 
43
- def help!
44
- system "#{CONFIG[:Open]} '#{Such::Thing::PARAMETERS[:HelpFile]}'"
58
+ unless kw[:help]
59
+ if klass and defined? klass::HELP
60
+ kw[:help] = klass::HELP
61
+ else
62
+ kw[:help] = (defined? ::HELP)? ::HELP : HELP
63
+ end
45
64
  end
46
65
 
47
- def release
48
- if @slot
49
- Slot.release(@slot)
50
- @slot = nil
66
+ kw[:appname] ||= klass&.name&.downcase || File.basename($0)
67
+
68
+ unless kw[:config]
69
+ if klass and defined? klass::CONFIG
70
+ kw[:config] = klass::CONFIG
51
71
  end
52
72
  end
73
+ end
53
74
 
54
- def minime!
55
- if @window.visible?
56
- @slot = Slot.get
57
- if @slot
58
- s = CONFIG[:SlotsScale]
59
- x, y = CONFIG[:SLOTS_OFFSET]
60
- w, h = Gdk::Screen.width, Gdk::Screen.height
61
- case CONFIG[:SlotsOrientation]
62
- when :horizontal
63
- @mini.move(w-@slot*s+x, h-s+y)
64
- when :vertical
65
- @mini.move(w-s+x, h-@slot*s+y)
66
- else
67
- if @slot%2==0
68
- @mini.move(w-((@slot+2)/2)*s+x, h-s+y)
69
- else
70
- @mini.move(w-s+x, h-((@slot+1)/2)*s+y)
71
- end
72
- end
73
- @mini.keep_above=true
74
- @window.hide
75
- @mini.show
76
- end
77
- else
78
- release
79
- @mini.hide
80
- @window.show
75
+ def transient(window)
76
+ window.transient_for = @main
77
+ end
78
+
79
+ def logo_press_event(&block)
80
+ @logo_press_event = block
81
+ end
82
+
83
+ def fs!
84
+ @fs ? @main.unfullscreen : @main.fullscreen
85
+ @fs = !@fs
86
+ end
87
+
88
+ def about!
89
+ about = Such::AboutDialog.new :about_dialog
90
+ transient about
91
+ about.set_logo @pixbuf
92
+ about.run
93
+ about.destroy
94
+ end
95
+
96
+ def help!
97
+ system "#{CONFIG[:Open]} '#{CONFIG[:HelpFile]}'"
98
+ end
99
+
100
+ def minime!
101
+ if @minime
102
+ @minime = false
103
+ unless @options.notoggle
104
+ @main.set_decorated true unless @options.notdecorated
105
+ @main.set_keep_above false
106
+ end
107
+ @stage.set_expanded true
108
+ @toolbar.set_expanded true
109
+ else
110
+ @minime = true
111
+ unless @options.notoggle
112
+ @main.set_decorated false unless @options.notdecorated
113
+ @main.set_keep_above true
81
114
  end
115
+ @stage.set_expanded false
116
+ @toolbar.set_expanded false
117
+ @main.resize 1,1
82
118
  end
119
+ end
120
+
121
+ using Rafini::Exception
122
+ def quit!
123
+ ursure = Gtk3App::YesNoDialog.new :quit_ursure!
124
+ transient ursure
125
+ return true unless ursure.ok?
126
+ @finalize.call if @finalize
127
+ Gtk.main_quit
128
+ return false
129
+ rescue # finalize raised exception
130
+ $!.puts
131
+ dialog = Such::MessageDialog.new
132
+ transient dialog
133
+ dialog.set_text $!.message
134
+ dialog.run
135
+ dialog.destroy
136
+ return true
137
+ end
138
+
139
+ def finalize(&block)
140
+ @finalize = block
141
+ end
142
+
83
143
 
84
- def quit!
85
- release
86
- @gui.finalize if @gui.respond_to? :finalize
87
- Gtk.main_quit
144
+ using Rafini::String
145
+ def install(kw)
146
+ stub = UserSpace.new parser:RBON,
147
+ appname:'gtk3app',
148
+ config:"config-#{VERSION.semantic(0..1)}"
149
+ stub.configures CONFIG
150
+
151
+ # :klass and :config flags user wants xdg maintainance.
152
+ # :appname, :appdir, and :version are sanity checks.
153
+ if [:klass,:config,:appname,:appdir,:version].all?{kw[_1]}
154
+ app = UserSpace.new parser:RBON,
155
+ # Will be a subdirectory in gtk3app:
156
+ appname:"gtk3app/#{kw[:appname]}",
157
+ appdir:kw[:appdir],
158
+ config:"config-#{kw[:version].semantic(0..1)}"
159
+ app.configures kw[:config]
88
160
  end
161
+ CONFIG.merge! kw[:config] if kw[:config]
89
162
  end
90
163
  end
164
+ end
@@ -1,6 +1,4 @@
1
1
  module Gtk3App
2
- module Widget
3
-
4
2
  class MenuItem < Such::MenuItem
5
3
  attr_accessor :key
6
4
  end
@@ -19,7 +17,8 @@ module Widget
19
17
  window.add_events(Gdk::EventMask::BUTTON_PRESS_MASK)
20
18
  window.signal_connect('button_press_event') do |w,e|
21
19
  if e.button == 3
22
- self.popup(nil, nil, 3, e.time)
20
+ #self.popup(nil, nil, 3, e.time)
21
+ self.popup_at_pointer #(nil, nil, 3, e.time)
23
22
  else
24
23
  block.call(w,e,'button_press_event')
25
24
  end
@@ -32,25 +31,29 @@ module Widget
32
31
  end
33
32
  end
34
33
 
35
- class MainWindow < Such::Window
36
- def self.set_icon(file)
37
- @@icon = GdkPixbuf::Pixbuf.new(file: file)
34
+ class EventImage < Such::EventBox
35
+ def initialize(container, ...)
36
+ super container
37
+ Such::Image.new(self, ...)
38
38
  end
39
+ end
39
40
 
40
- def self.icon
41
- @@icon
41
+ class YesNoDialog < Such::Dialog
42
+ def initialize(...)
43
+ super(...)
44
+ add_button '_No', Gtk::ResponseType::CANCEL
45
+ add_button '_Yes', Gtk::ResponseType::OK
42
46
  end
43
47
 
44
- def initialize(*par, &block)
45
- super(*par, &block)
46
- self.set_icon MainWindow.icon
48
+ def add_label(text)
49
+ Such::Label.new(child).text = text
47
50
  end
48
51
 
49
- def minime(x=CONFIG[:SlotsScale])
50
- self.set_default_size(x,x)
51
- self.add Gtk::Image.new(pixbuf: MainWindow.icon.scale(x,x)).show
52
+ def ok?
53
+ show_all
54
+ response = run
55
+ destroy
56
+ response == Gtk::ResponseType::OK
52
57
  end
53
58
  end
54
-
55
- end
56
59
  end
metadata CHANGED
@@ -1,17 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk3app
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.210128
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-24 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: help_parser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '7.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 7.0.200907
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '7.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 7.0.200907
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: user_space
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 5.0.210123
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 5.0.210123
53
+ - !ruby/object:Gem::Dependency
54
+ name: rafini
15
55
  requirement: !ruby/object:Gem::Requirement
16
56
  requirements:
17
57
  - - "~>"
@@ -19,7 +59,7 @@ dependencies:
19
59
  version: '3.0'
20
60
  - - ">="
21
61
  - !ruby/object:Gem::Version
22
- version: 3.0.0
62
+ version: 3.0.210112
23
63
  type: :runtime
24
64
  prerelease: false
25
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,85 +69,91 @@ dependencies:
29
69
  version: '3.0'
30
70
  - - ">="
31
71
  - !ruby/object:Gem::Version
32
- version: 3.0.0
72
+ version: 3.0.210112
33
73
  - !ruby/object:Gem::Dependency
34
- name: rafini
74
+ name: rbon
35
75
  requirement: !ruby/object:Gem::Requirement
36
76
  requirements:
37
77
  - - "~>"
38
78
  - !ruby/object:Gem::Version
39
- version: '1.2'
79
+ version: '0.2'
40
80
  - - ">="
41
81
  - !ruby/object:Gem::Version
42
- version: 1.2.1
82
+ version: 0.2.210125
43
83
  type: :runtime
44
84
  prerelease: false
45
85
  version_requirements: !ruby/object:Gem::Requirement
46
86
  requirements:
47
87
  - - "~>"
48
88
  - !ruby/object:Gem::Version
49
- version: '1.2'
89
+ version: '0.2'
50
90
  - - ">="
51
91
  - !ruby/object:Gem::Version
52
- version: 1.2.1
92
+ version: 0.2.210125
53
93
  - !ruby/object:Gem::Dependency
54
94
  name: gtk3
55
95
  requirement: !ruby/object:Gem::Requirement
56
96
  requirements:
57
97
  - - "~>"
58
98
  - !ruby/object:Gem::Version
59
- version: '3.2'
99
+ version: '3.4'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.4.3
60
103
  type: :runtime
61
104
  prerelease: false
62
105
  version_requirements: !ruby/object:Gem::Requirement
63
106
  requirements:
64
107
  - - "~>"
65
108
  - !ruby/object:Gem::Version
66
- version: '3.2'
109
+ version: '3.4'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.4.3
67
113
  - !ruby/object:Gem::Dependency
68
114
  name: such
69
115
  requirement: !ruby/object:Gem::Requirement
70
116
  requirements:
71
117
  - - "~>"
72
118
  - !ruby/object:Gem::Version
73
- version: '0.4'
119
+ version: '1.0'
74
120
  - - ">="
75
121
  - !ruby/object:Gem::Version
76
- version: 0.4.0
122
+ version: 1.0.210117
77
123
  type: :runtime
78
124
  prerelease: false
79
125
  version_requirements: !ruby/object:Gem::Requirement
80
126
  requirements:
81
127
  - - "~>"
82
128
  - !ruby/object:Gem::Version
83
- version: '0.4'
129
+ version: '1.0'
84
130
  - - ">="
85
131
  - !ruby/object:Gem::Version
86
- version: 0.4.0
132
+ version: 1.0.210117
87
133
  description: |
88
- Gtk3App provides a Gtk3 application stub.
134
+ Gtk3App provides a
135
+ [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3)
136
+ application stub.
89
137
 
90
- It automatically provides for user configuration, and minime windows.
138
+ The stub provides you with two Expander containers.
139
+ One for a horizontal toolbar.
140
+ The other for your main stage area.
91
141
  email: carlosjhr64@gmail.com
92
142
  executables: []
93
143
  extensions: []
94
144
  extra_rdoc_files: []
95
145
  files:
96
146
  - README.md
97
- - data/VERSION
98
147
  - data/logo.png
99
- - data/ruby.png
100
148
  - lib/gtk3app.rb
101
149
  - lib/gtk3app/config.rb
102
- - lib/gtk3app/gtk3app.rb
103
150
  - lib/gtk3app/program.rb
104
- - lib/gtk3app/slot.rb
105
- - lib/gtk3app/widget/widgets.rb
151
+ - lib/gtk3app/widgets.rb
106
152
  homepage: https://github.com/carlosjhr64/gtk3app
107
153
  licenses:
108
154
  - MIT
109
155
  metadata: {}
110
- post_install_message:
156
+ post_install_message:
111
157
  rdoc_options: []
112
158
  require_paths:
113
159
  - lib
@@ -122,10 +168,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
168
  - !ruby/object:Gem::Version
123
169
  version: '0'
124
170
  requirements:
125
- - 'ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]'
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
128
- signing_key:
171
+ - 'ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]'
172
+ rubygems_version: 3.2.3
173
+ signing_key:
129
174
  specification_version: 4
130
- summary: Gtk3App provides a Gtk3 application stub.
175
+ summary: Gtk3App provides a [Ruby Gnome Gtk3](https://rubygems.org/gems/gtk3) application
176
+ stub.
131
177
  test_files: []
data/data/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.0.0
data/data/ruby.png DELETED
Binary file
@@ -1,49 +0,0 @@
1
- module Gtk3App
2
- using Rafini::String
3
- using Rafini::Hash
4
- using Rafini::Exception
5
-
6
- def self.config(mod)
7
- # Let's get NameErrors out of the way first
8
- appdir = mod::APPDIR
9
- config = mod::CONFIG
10
- version = mod::VERSION
11
- # Create the directory name for UserSpace.
12
- appname = mod.name.downcase
13
- appname.prepend('gtk3app/') unless mod==Gtk3App
14
- # UserSpace does its thing...
15
- user_space = UserSpace.new(
16
- YAML,
17
- ext: 'yml',
18
- config: "config-#{version.semantic(0..1)}",
19
- appname: appname,
20
- appdir: appdir
21
- )
22
- user_space.install unless user_space.version == version
23
- user_space.configures(config)
24
- rescue NameError
25
- $!.puts 'Application is not using APPDIR, VERSION, or CONFIG.'
26
- end
27
-
28
- def self.init(mod)
29
- Gtk3App.config mod
30
- if thing = mod::CONFIG[:thing]
31
- Such::Thing.configure thing
32
- end
33
- rescue NameError
34
- $!.puts 'Application is not using CONFIG.'
35
- end
36
-
37
- def self.main(app)
38
- @program = nil # initialized
39
- Gtk3App.init Gtk3App
40
- Gtk3App.init app
41
- @program = Program.new app
42
- Gtk.main
43
- rescue StandardError
44
- $!.puts
45
- exit 1
46
- ensure
47
- @program.release if @program
48
- end
49
- end
data/lib/gtk3app/slot.rb DELETED
@@ -1,42 +0,0 @@
1
- module Gtk3App
2
- module Slot
3
- using Rafini::Array
4
-
5
- def self.dbm
6
- SDBM.open(CONFIG[:SlotsDBM]){|db|yield(db)}
7
- end
8
-
9
- def self.numbers
10
- 1.upto(CONFIG[:Slots]){|n|yield(n.to_s)}
11
- end
12
-
13
- def self.get
14
- Slot.dbm do |db|
15
- Slot.numbers do |slot|
16
- unless db[slot]
17
- db[slot]=$$.to_s
18
- return slot.to_i
19
- end
20
- end
21
- end
22
- return nil
23
- end
24
-
25
- def self.release(slot)
26
- Slot.dbm{|db|db.delete(slot.to_s)}
27
- end
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
41
- end
42
- end