diff --git a/hammond-gtk/src/main.rs b/hammond-gtk/src/main.rs index 030c929..9067f1b 100644 --- a/hammond-gtk/src/main.rs +++ b/hammond-gtk/src/main.rs @@ -40,42 +40,35 @@ fn build_ui(app: >k::Application) { // Get the main window let window = gtk::ApplicationWindow::new(app); window.set_default_size(1050, 600); - app.add_window(&window); // Setup the Stack that will magane the switche between podcasts_view and podcast_widget. let stack = podcasts_view::setup_stack(&db); window.add(&stack); - // FIXME: - // GLib-GIO-WARNING **: Your application does not implement g_application_activate() - // and has no handlers connected to the 'activate' signal. It should do one of these. - window.connect_delete_event(|_, _| { - gtk::main_quit(); + window.connect_delete_event(|w, _| { + w.destroy(); Inhibit(false) }); // Get the headerbar let header = headerbar::get_headerbar(&db, &stack); + // TODO: add delay, cause else theres lock contention for the db obj. // utils::refresh_db(db.clone(), stack.clone()); window.set_titlebar(&header); window.show_all(); - gtk::main(); + window.activate(); + app.connect_activate(move |_| ()); } // Copied from: // https://github.com/GuillaumeGomez/process-viewer/blob/ \ // ddcb30d01631c0083710cf486caf04c831d38cb7/src/process_viewer.rs#L367 fn main() { + // TODO: make the the logger a cli -vv option loggerv::init_with_level(LogLevel::Info).unwrap(); hammond_data::init().expect("Hammond Initialazation failed."); - // Not sure if needed. - if gtk::init().is_err() { - info!("Failed to initialize GTK."); - return; - } - let application = gtk::Application::new( "com.gitlab.alatiera.Hammond", gio::ApplicationFlags::empty(), @@ -85,11 +78,5 @@ fn main() { build_ui(app); }); - // Not sure if this will be kept. - let original = ::std::env::args().collect::>(); - let mut tmp = Vec::with_capacity(original.len()); - for i in 0..original.len() { - tmp.push(original[i].as_str()); - } - application.run(&tmp); + application.run(&[]); } diff --git a/hammond-gtk/src/views/podcasts_view.rs b/hammond-gtk/src/views/podcasts_view.rs index 15cc7ab..0de97eb 100644 --- a/hammond-gtk/src/views/podcasts_view.rs +++ b/hammond-gtk/src/views/podcasts_view.rs @@ -84,7 +84,7 @@ fn show_empty_view(stack: >k::Stack) { info!("Empty view."); } -pub fn pop_flowbox_no_store( +pub fn populate_flowbox_no_store( db: &Arc>, stack: >k::Stack, flowbox: >k::FlowBox, @@ -131,7 +131,7 @@ fn setup_podcasts_grid(db: &Arc>, stack: >k::Stack) { let flowbox: gtk::FlowBox = builder.get_object("flowbox").unwrap(); // Populate the flowbox with the Podcasts. // populate_podcasts_flowbox(db, stack, &flowbox); - pop_flowbox_no_store(db, stack, &flowbox); + populate_flowbox_no_store(db, stack, &flowbox); } pub fn setup_stack(db: &Arc>) -> gtk::Stack {