Hello list,
currently i'm trying to build a little application with Ruby and Gtk+
(See [1]).
I have such files:
bin/latex_curriculum_vitae:
···
===========================
#!/usr/bin/env ruby
require 'gtk3'
require 'fileutils'
# Require all ruby files in the application folder recursively
application_root_path = File.expand_path(__dir__)
Dir[File.join(application_root_path, '..', 'application', '**',
'*.rb')].each { |file| require file }
# Define the source & target files of the glib-compile-resources
command
resource_xml = File.join(application_root_path, '..', 'resources',
'gresources.xml')
resource_bin = File.join(application_root_path, '..', 'gresource.bin')
# Build the binary
system("glib-compile-resources",
"--target", resource_bin,
"--sourcedir", File.dirname(resource_xml),
resource_xml)
resource = Gio::Resource.load(resource_bin)
Gio::Resources.register(resource)
at_exit do
# Before existing, please remove the binary we produced, thanks.
FileUtils.rm_f(resource_bin)
end
app = LatexCurriculumVitae::Application.new
puts app.run
application/ui/latex_curriculum_vitae/application.rb
module LatexCurriculumVitae
class Application < Gtk::Application
def initialize
super 'net.launchpad.saigkill.latex_curriculum_vitae',
Gio::ApplicationFlags::FLAGS_NONE
signal_connect :activate do |application|
window = Gtk::ApplicationWindow.new(application)
window.present
end
end
end
end
application/ui/latex_curriculum_vitae/application_window.rb
module LatexCurriculumVitae
class ApplicationWindow < Gtk::ApplicationWindow
# LatexCurriculumVitaeApplicationWindow
# Register the class in the GLib world
type_register
class << self
def init
# Set the template from the resources binary
set_template resource:
'/net/launchpad/saigkill/latex_curriculum_vitae/ui/application_window.u
i'
end
end
def initialize(application)
super application: application
set_title 'Latex Curriculum Vitae'
end
end
end
The gresources file on [2] refers just to the application_window.ui on
[3]. It just contains three buttons.
The current result of running the start script is [4]. So i can see,
that the set_title was ignored, and also the refered ui aren't visible.
Is there any problem with my code? Is this the right place to ask or
should i ask on a GNOME/GTK list?
Greetings
Sascha
[1] https://github.com/saigkill/test
[2] https://github.com/saigkill/test/blob/master/resources/gresources.x
ml
[3] https://github.com/saigkill/test/blob/master/resources/ui/applicati
on_window.ui
[4] https://pasteboard.co/Hfv2RzY.png