| 1 | /* |
| 2 | * Copyright 2020-2024 Andrey Kutejko <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * For more details see the file COPYING. |
| 18 | */ |
| 19 | |
| 20 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::configrust-analyzer cargo gnome-robots 50.0.0 config/::VERSION; |
| 21 | use adwrust-analyzer cargo libadwaita 0.9.1 crate/::{preluderust-analyzer cargo libadwaita 0.9.1 prelude/::*, subclassrust-analyzer cargo libadwaita 0.9.1 subclass/::preluderust-analyzer cargo libadwaita 0.9.1 subclass/prelude/::*}; |
| 22 | use gettextrsrust-analyzer cargo gettext-rs 0.7.7 crate/::gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().; |
| 23 | use gtkrust-analyzer cargo gtk4 0.11.1 crate/::{gdkrust-analyzer cargo gdk4 0.11.1 crate/, giorust-analyzer cargo gio 0.22.2 crate/, glibrust-analyzer cargo glib 0.22.3 crate/}; |
| 24 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 25 | |
| 26 | mod imprust-analyzer cargo gnome-robots 50.0.0 application/imp/ { |
| 27 | use superrust-analyzer cargo gnome-robots 50.0.0 application/::*; |
| 28 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::{ |
| 29 | assetsrust-analyzer cargo gnome-robots 50.0.0 assets/::{Assetsrust-analyzer cargo gnome-robots 50.0.0 assets/Assets#, DirectoryAssetsrust-analyzer cargo gnome-robots 50.0.0 assets/DirectoryAssets#}, |
| 30 | configrust-analyzer cargo gnome-robots 50.0.0 config/::DATA_DIRECTORY, |
| 31 | game_configrust-analyzer cargo gnome-robots 50.0.0 game_config/::GameConfigsrust-analyzer cargo gnome-robots 50.0.0 game_config/GameConfigs#, |
| 32 | properties_dialogrust-analyzer cargo gnome-robots 50.0.0 properties_dialog/::show_preferencesrust-analyzer cargo gnome-robots 50.0.0 properties_dialog/show_preferences()., |
| 33 | windowrust-analyzer cargo gnome-robots 50.0.0 window/::RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#, |
| 34 | }; |
| 35 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#, rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/::Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#}; |
| 36 | |
| 37 | pub struct RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# { |
| 38 | settingsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#settings.: giorust-analyzer cargo gio 0.22.2 crate/::Settingsrust-analyzer cargo gio 0.22.2 auto/settings/Settings#, |
| 39 | game_configsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#game_configs.: GameConfigsrust-analyzer cargo gnome-robots 50.0.0 game_config/GameConfigs#, |
| 40 | assetsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#assets.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#<dyn Assetsrust-analyzer cargo gnome-robots 50.0.0 assets/Assets#>>, |
| 41 | } |
| 42 | |
| 43 | #[glibrust-analyzer cargo glib 0.22.3 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 44 | impl ObjectSubclassrust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# { |
| 45 | const NAMErust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass]NAME.: &'static str = "RobotsApplication"; |
| 46 | type Typerust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass]Type# = superrust-analyzer cargo gnome-robots 50.0.0 application/::RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/RobotsApplication#; |
| 47 | type ParentTyperust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass]ParentType# = adwrust-analyzer cargo libadwaita 0.9.1 crate/::Applicationrust-analyzer cargo libadwaita 0.9.1 auto/application/Application#; |
| 48 | |
| 49 | fn newrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass]new().() -> Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass] { |
| 50 | Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ObjectSubclass] { |
| 51 | settingsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#settings.: giorust-analyzer cargo gio 0.22.2 crate/::Settingsrust-analyzer cargo gio 0.22.2 auto/settings/Settings#::newrust-analyzer cargo gio 0.22.2 auto/settings/impl#[Settings]new().("org.gnome.Robots"), |
| 52 | game_configsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#game_configs.: GameConfigsrust-analyzer cargo gnome-robots 50.0.0 game_config/GameConfigs#::newrust-analyzer cargo gnome-robots 50.0.0 game_config/impl#[GameConfigs]new().(), |
| 53 | assetsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#assets.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`][Default]default().(), |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | impl ObjectImplrust-analyzer cargo glib 0.22.3 subclass/object/ObjectImpl# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# {} |
| 59 | |
| 60 | impl ApplicationImplrust-analyzer cargo gio 0.22.2 subclass/application/ApplicationImpl# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# { |
| 61 | fn startuprust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]startup().(&self) { |
| 62 | self.parent_startuprust-analyzer cargo gio 0.22.2 subclass/application/ApplicationImplExt#parent_startup().(); |
| 63 | |
| 64 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(display) = gdkrust-analyzer cargo gdk4 0.11.1 crate/::Displayrust-analyzer cargo gdk4 0.11.1 auto/display/Display#::defaultrust-analyzer cargo gdk4 0.11.1 auto/display/impl#[Display]default().() { |
| 65 | gtkrust-analyzer cargo gtk4 0.11.1 crate/::IconThemerust-analyzer cargo gtk4 0.11.1 auto/icon_theme/IconTheme#::for_displayrust-analyzer cargo gtk4 0.11.1 auto/icon_theme/impl#[IconTheme]for_display().(&display) |
| 66 | .add_search_pathrust-analyzer cargo gtk4 0.11.1 auto/icon_theme/impl#[IconTheme]add_search_path().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(DATA_DIRECTORY).joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("icons")); |
| 67 | } else { |
| 68 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("No default display found"); |
| 69 | } |
| 70 | |
| 71 | glibrust-analyzer cargo glib 0.22.3 crate/::set_application_namerust-analyzer cargo glib 0.22.3 auto/functions/set_application_name().(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Robots")); |
| 72 | gtkrust-analyzer cargo gtk4 0.11.1 crate/::Windowrust-analyzer cargo gtk4 0.11.1 auto/window/Window#::set_default_icon_namerust-analyzer cargo gtk4 0.11.1 auto/window/impl#[Window]set_default_icon_name().("org.gnome.Robots"); |
| 73 | |
| 74 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().add_action_entriesrust-analyzer cargo gio 0.22.2 action_map/ActionMapExtManual#add_action_entries().([ |
| 75 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("new-game") |
| 76 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().new_game_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]new_game_cb().()) |
| 77 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 78 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("preferences") |
| 79 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().preferences_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]preferences_cb().()) |
| 80 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 81 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("scores") |
| 82 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().scores_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]scores_cb().()) |
| 83 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 84 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("help") |
| 85 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().help_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]help_cb().()) |
| 86 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 87 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("about") |
| 88 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().about_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]about_cb().()) |
| 89 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 90 | giorust-analyzer cargo gio 0.22.2 crate/::ActionEntryrust-analyzer cargo gio 0.22.2 action_entry/ActionEntry#::builderrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntry<O>`]builder().("quit") |
| 91 | .activaterust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]activate().(|this: &Selfrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]::Typerust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Type#, _, _| this.quitrust-analyzer cargo gio 0.22.2 auto/application/ApplicationExt#quit().()) |
| 92 | .buildrust-analyzer cargo gio 0.22.2 action_entry/impl#[`ActionEntryBuilder<O>`]build().(), |
| 93 | ]); |
| 94 | |
| 95 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().() |
| 96 | .set_accels_for_actionrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#set_accels_for_action().("app.new-game", &["<Primary>n"]); |
| 97 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().set_accels_for_actionrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#set_accels_for_action().("app.help", &["F1"]); |
| 98 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().() |
| 99 | .set_accels_for_actionrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#set_accels_for_action().("app.quit", &["<Primary>q"]); |
| 100 | |
| 101 | match DirectoryAssetsrust-analyzer cargo gnome-robots 50.0.0 assets/DirectoryAssets#::from_directoryrust-analyzer cargo gnome-robots 50.0.0 assets/impl#[DirectoryAssets]from_directory().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(DATA_DIRECTORY)) { |
| 102 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(assets) => { |
| 103 | self.assetsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#assets..setrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]set().(Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(assets)).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 104 | } |
| 105 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => { |
| 106 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("CRITICAL: Failed to load game assets: {}", e); |
| 107 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().quitrust-analyzer cargo gio 0.22.2 auto/application/ApplicationExt#quit().(); |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | fn activaterust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]activate().(&self) { |
| 113 | self.parent_activaterust-analyzer cargo gio 0.22.2 subclass/application/ApplicationImplExt#parent_activate().(); |
| 114 | |
| 115 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(window) = self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().and_downcastrust-analyzer cargo glib 0.22.3 object/impl#[`Option<I>`][CastNone]and_downcast().::<RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#>() { |
| 116 | window.presentrust-analyzer cargo gtk4 0.11.1 auto/window/GtkWindowExt#present().(); |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | match RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#::newrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]new().( |
| 121 | &*rust-analyzer cargo glib 0.22.3 object/impl#[`BorrowedObject<'_, T>`][Deref]deref().self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().(), |
| 122 | &self.settingsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#settings., |
| 123 | self.game_configsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#game_configs..clonerust-analyzer cargo gnome-robots 50.0.0 game_config/impl#[GameConfigs][Clone]clone().(), |
| 124 | self.assetsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#assets..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 125 | ) { |
| 126 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(window) => { |
| 127 | window.presentrust-analyzer cargo gtk4 0.11.1 auto/window/GtkWindowExt#present().(); |
| 128 | window.focus_gamerust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]focus_game().(); |
| 129 | } |
| 130 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => { |
| 131 | eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("CRITICAL: {}", e); |
| 132 | // TODO message box |
| 133 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().quitrust-analyzer cargo gio 0.22.2 auto/application/ApplicationExt#quit().(); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | impl GtkApplicationImplrust-analyzer cargo gtk4 0.11.1 subclass/application/GtkApplicationImpl# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# {} |
| 140 | impl AdwApplicationImplrust-analyzer cargo libadwaita 0.9.1 subclass/application/AdwApplicationImpl# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# {} |
| 141 | |
| 142 | impl RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication# { |
| 143 | fn new_game_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]new_game_cb().(&self) { |
| 144 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(window) = self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().and_downcastrust-analyzer cargo glib 0.22.3 object/impl#[`Option<I>`][CastNone]and_downcast().::<RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#>() { |
| 145 | let dialog = adwrust-analyzer cargo libadwaita 0.9.1 crate/::AlertDialogrust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialog#::newrust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/impl#[AlertDialog]new().( |
| 146 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("New Game")), |
| 147 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().( |
| 148 | "Are you sure you want to discard the current game?", |
| 149 | )), |
| 150 | ); |
| 151 | |
| 152 | dialog.add_responserust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialogExt#add_response().("cancel", &gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Keep _Playing")); |
| 153 | dialog.add_responserust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialogExt#add_response().("new", &gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_New Game")); |
| 154 | dialog.set_response_appearancerust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialogExt#set_response_appearance().("new", adwrust-analyzer cargo libadwaita 0.9.1 crate/::ResponseAppearancerust-analyzer cargo libadwaita 0.9.1 auto/enums/ResponseAppearance#::Destructiverust-analyzer cargo libadwaita 0.9.1 auto/enums/ResponseAppearance#Destructive#); |
| 155 | |
| 156 | dialog.set_default_responserust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialogExt#set_default_response().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("new")); |
| 157 | dialog.set_close_responserust-analyzer cargo libadwaita 0.9.1 auto/alert_dialog/AlertDialogExt#set_close_response().("cancel"); |
| 158 | |
| 159 | dialog.chooserust-analyzer cargo libadwaita 0.9.1 alert_dialog/AlertDialogExtManual#choose().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&window.clonerust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow][Clone]clone().()), giorust-analyzer cargo gio 0.22.2 crate/::Cancellablerust-analyzer cargo gio 0.22.2 auto/cancellable/Cancellable#::NONErust-analyzer cargo gio 0.22.2 auto/cancellable/impl#[Cancellable]NONE., move |ret| { |
| 160 | if ret rust-analyzer cargo glib 0.22.3 gstring/impl#[GString][`PartialEq<&str>`]eq().==rust-analyzer cargo glib 0.22.3 gstring/impl#[GString][`PartialEq<&str>`]eq(). rust-analyzer cargo glib 0.22.3 gstring/impl#[GString][`PartialEq<&str>`]eq()."new" { |
| 161 | window.start_new_gamerust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]start_new_game().(); |
| 162 | } |
| 163 | }); |
| 164 | } else { |
| 165 | self.activaterust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication][ApplicationImpl]activate().(); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | fn preferences_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]preferences_cb().(&self) { |
| 170 | show_preferencesrust-analyzer cargo gnome-robots 50.0.0 properties_dialog/show_preferences().( |
| 171 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 172 | &self.game_configsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#game_configs., |
| 173 | &self.assetsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#assets..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().themesrust-analyzer cargo gnome-robots 50.0.0 assets/Assets#themes().(), |
| 174 | &self.settingsrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#settings., |
| 175 | ); |
| 176 | } |
| 177 | |
| 178 | fn scores_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]scores_cb().(&self) { |
| 179 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(window) = self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().and_downcastrust-analyzer cargo glib 0.22.3 object/impl#[`Option<I>`][CastNone]and_downcast().::<RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#>() { |
| 180 | window.show_highscoresrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]show_highscores().(); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | fn help_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]help_cb().(&self) { |
| 185 | let launcher = gtkrust-analyzer cargo gtk4 0.11.1 crate/::UriLauncherrust-analyzer cargo gtk4 0.11.1 auto/uri_launcher/UriLauncher#::newrust-analyzer cargo gtk4 0.11.1 auto/uri_launcher/impl#[UriLauncher]new().("help:gnome-robots"); |
| 186 | launcher.launchrust-analyzer cargo gtk4 0.11.1 auto/uri_launcher/impl#[UriLauncher]launch().( |
| 187 | self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 188 | giorust-analyzer cargo gio 0.22.2 crate/::Cancellablerust-analyzer cargo gio 0.22.2 auto/cancellable/Cancellable#::NONErust-analyzer cargo gio 0.22.2 auto/cancellable/impl#[Cancellable]NONE., |
| 189 | |_| {}, |
| 190 | ); |
| 191 | } |
| 192 | |
| 193 | fn about_cbrust-analyzer cargo gnome-robots 50.0.0 application/imp/impl#[RobotsApplication]about_cb().(&self) { |
| 194 | adwrust-analyzer cargo libadwaita 0.9.1 crate/::AboutDialogrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/AboutDialog#::builderrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialog]builder().() |
| 195 | .application_iconrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]application_icon().("org.gnome.Robots") |
| 196 | .application_namerust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]application_name().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Robots")) |
| 197 | .versionrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]version().(VERSION) |
| 198 | .copyrightrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]copyright().("Copyright © 1998–2008 Mark Rae\nCopyright © 2014–2016 Michael Catanzaro\nCopyright © 2020-2025 Andrey Kutejko") |
| 199 | .license_typerust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]license_type().(gtkrust-analyzer cargo gtk4 0.11.1 crate/::Licenserust-analyzer cargo gtk4 0.11.1 auto/enums/License#::Gpl30rust-analyzer cargo gtk4 0.11.1 auto/enums/License#Gpl30#) |
| 200 | .commentsrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]comments().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Based on classic BSD Robots")) |
| 201 | .developersrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]developers().([ |
| 202 | "Mark Rae <[email protected]>", |
| 203 | "Andrey Kutejko <[email protected]>" |
| 204 | ]) |
| 205 | .artistsrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]artists().([ |
| 206 | "Kirstie Opstad <[email protected]>", |
| 207 | "Rasoul M.P. Aghdam (player death sound)" |
| 208 | ]) |
| 209 | .documentersrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]documenters().([ |
| 210 | "Aruna Sankaranarayanan" |
| 211 | ]) |
| 212 | .translator_creditsrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]translator_credits().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("translator-credits")) |
| 213 | .websiterust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]website().("https://gitlab.gnome.org/GNOME/gnome-robots") |
| 214 | .buildrust-analyzer cargo libadwaita 0.9.1 auto/about_dialog/impl#[AboutDialogBuilder]build().() |
| 215 | .presentrust-analyzer cargo libadwaita 0.9.1 auto/dialog/AdwDialogExt#present().(self.objrust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassExt]obj().().active_windowrust-analyzer cargo gtk4 0.11.1 auto/application/GtkApplicationExt#active_window().().as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | glibrust-analyzer cargo glib 0.22.3 crate/::wrapperrust-analyzer cargo glib 0.22.3 wrapper/wrapper!! { |
| 221 | pub struct RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/RobotsApplication#(ObjectSubclass<imprust-analyzer cargo gnome-robots 50.0.0 application/imp/::RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/imp/RobotsApplication#>) |
| 222 | @extends adwrust-analyzer cargo libadwaita 0.9.1 crate/::Applicationrust-analyzer cargo libadwaita 0.9.1 auto/application/Application#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Applicationrust-analyzer cargo gtk4 0.11.1 auto/application/Application#, giorust-analyzer cargo gio 0.22.2 crate/::Applicationrust-analyzer cargo gio 0.22.2 auto/application/Application#, |
| 223 | @implements giorust-analyzer cargo gio 0.22.2 crate/::ActionGrouprust-analyzer cargo gio 0.22.2 auto/action_group/ActionGroup#, giorust-analyzer cargo gio 0.22.2 crate/::ActionMaprust-analyzer cargo gio 0.22.2 auto/action_map/ActionMap#; |
| 224 | } |
| 225 | |
| 226 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for RobotsApplicationrust-analyzer cargo gnome-robots 50.0.0 application/RobotsApplication# { |
| 227 | fn defaultrust-analyzer cargo gnome-robots 50.0.0 application/impl#[RobotsApplication][Default]default().() -> Selfrust-analyzer cargo gnome-robots 50.0.0 application/impl#[RobotsApplication][Default] { |
| 228 | glibrust-analyzer cargo glib 0.22.3 crate/::Objectrust-analyzer cargo glib 0.22.3 object/Object#::builderrust-analyzer cargo glib 0.22.3 object/impl#[Object]builder().() |
| 229 | .propertyrust-analyzer cargo glib 0.22.3 object/impl#[`ObjectBuilder<'a, O>`]property().("application-id", "org.gnome.Robots") |
| 230 | .propertyrust-analyzer cargo glib 0.22.3 object/impl#[`ObjectBuilder<'a, O>`]property().("flags", giorust-analyzer cargo gio 0.22.2 crate/::ApplicationFlagsrust-analyzer cargo gio 0.22.2 auto/flags/ApplicationFlags#::defaultrust-analyzer cargo gio 0.22.2 flags/impl#[ApplicationFlags][Default]default().()) |
| 231 | .buildrust-analyzer cargo glib 0.22.3 object/impl#[`ObjectBuilder<'a, O>`]build().() |
| 232 | } |
| 233 | } |