From f658e5f68673d851b92367001ee8e3d5428b6a76 Mon Sep 17 00:00:00 2001 From: Oguz Kagan EREN Date: Sat, 28 Mar 2026 12:32:52 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20remove=20dead=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/application.rs | 111 --------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 src/application.rs diff --git a/src/application.rs b/src/application.rs deleted file mode 100644 index 57aa1ab4..00000000 --- a/src/application.rs +++ /dev/null @@ -1,111 +0,0 @@ -use crate::config::{APP_ID, PKGDATADIR, VERSION}; -use crate::widgets::MainWindow; - -use std::path::Path; - -use gtk::gio; -use gtk::glib::{self, clone, WeakRef}; -use gtk::prelude::*; -use gtk::subclass::prelude::*; -use once_cell::sync::OnceCell; -/* -mod imp { - use super::*; - - #[derive(Debug, Default)] - pub struct Application { - pub window: OnceCell>, - } - - #[glib::object_subclass] - impl ObjectSubclass for Application { - type Type = super::Application; - - const NAME: &'static str = "CachyOSHello"; - } - - impl ObjectImpl for Application {} - - impl ApplicationImpl for Application { - fn activate(&self, app: &Self::Type) { - if let Some(window) = self.window.get() { - let window = window.upgrade().unwrap(); - window.show(); - window.present(); - return; - } - - let window = MainWindow::new(app); - self.window.set(window.downgrade()).expect("Window already set."); - - app.main_window().present(); - } - - fn startup(&self, app: &Self::Type) { - self.parent_startup(app); - gtk::Window::set_default_icon_name(APP_ID); - } - } - - impl GtkApplicationImpl for Application {} -} - -glib::wrapper! { - pub struct Application(ObjectSubclass) - @extends gio::Application, gtk::Application, - @implements gio::ActionMap, gio::ActionGroup; -} - -impl Application { - pub fn new() -> Self { - glib::Object::new(&[ - ("application-id", &Some(APP_ID)), - ("flags", &gio::ApplicationFlags::empty()), - ]) - .expect("Failed to create Application.") - } - - fn private(&self) -> &imp::Application { - imp::Application::from_instance(self) - } - - fn show_about_dialog(&self) { - let dialog = gtk::AboutDialog::builder() - .transient_for(&self.main_window()) - .modal(true) - .program_name(&gettext("Kooha")) - .comments(&gettext("Elegantly record your screen")) - .version(VERSION) - .logo_icon_name(APP_ID) - .authors(vec![ - "Dave Patrick".into(), - "".into(), - "Mathiascode".into(), - "Felix Weilbach".into(), - ]) - // Translators: Replace "translator-credits" with your names. Put a comma between. - .translator_credits(&gettext("translator-credits")) - .copyright(&gettext("Copyright 2021 Dave Patrick")) - .license_type(gtk::License::Gpl30) - .website("https://github.com/SeaDve/Kooha") - .website_label(&gettext("GitHub")) - .build(); - - dialog.show(); - } - - pub fn main_window(&self) -> MainWindow { - let imp = self.private(); - imp.window.get().unwrap().upgrade().unwrap() - } - - pub fn run(&self) { - ApplicationExtManual::run(self); - } -} - -impl Default for Application { - fn default() -> Self { - gio::Application::default().unwrap().downcast().unwrap() - } -}*/ From 39b8a2fa739097a007bdc51414d83c3cb36440be Mon Sep 17 00:00:00 2001 From: Oguz Kagan EREN Date: Sat, 28 Mar 2026 12:44:57 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20use=20and=5Fthen=20to=20prev?= =?UTF-8?q?ent=20panic.=20(when=20response=20return=20200=20but=20not=20?= =?UTF-8?q?=20return=20json)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/installer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer.rs b/src/installer.rs index b2cb8b7b..17bc2b72 100644 --- a/src/installer.rs +++ b/src/installer.rs @@ -38,7 +38,7 @@ fn outdated_version_check(ui: &GUI, message: String) -> bool { } // silently continue in case of server error - let versions = response.map(|x| x.json::().unwrap()); + let versions = response.and_then(|x| x.json::()); if let Err(vers_err) = versions { error!("Failed to fetch versions.json: {vers_err}"); return true;