I get this warning every time I launch a simple GTK application:
GLib-GIO-WARNING **: HH:MM:SS.XXX: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal. It should do one of these.
This is the app full code:
extern crate glib;
extern crate gio;
extern crate gtk;
use gtk::prelude::*;
use gio::prelude::*;
use std::env::args;
fn build_ui(application: >k::Application) {
let builder = gtk::Builder::from_string(include_str!("ui.glade"));
let win: gtk::ApplicationWindow = builder.get_object("application_window").expect("err build win");
win.set_application(Some(application));
win.set_title("Test");
win.set_position(gtk::WindowPosition::Center);
win.show_all();
}
// Init app
fn main() {
if gtk::init().is_err() {
println!("Failed to initialize GTK.");
return;
}
let application = gtk::Application::new(
Some("com.github.gtk-rs.examples.cairotest"),
Default::default(),
)
.expect("Initialization failed...");
application.connect_startup(move |app| {
build_ui(app);
});
application.run(&args().collect::<Vec<_>>());
}
Am I doing something wrong? Is it because of the glade builder? I tried with this method, but it makes things worst: the app still compiles, but the output throw an additional critical error:
GLib-GIO-CRITICAL **: HH:MM:SS.XXX: g_application_activate: assertion 'application->priv->is_registered' failed