| 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/::assetsrust-analyzer cargo gnome-robots 50.0.0 assets/::Assetsrust-analyzer cargo gnome-robots 50.0.0 assets/Assets#; |
| 21 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::gamerust-analyzer cargo gnome-robots 50.0.0 game/::{Gamerust-analyzer cargo gnome-robots 50.0.0 game/Game#, PlayerCommandrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#, Staterust-analyzer cargo gnome-robots 50.0.0 game/State#}; |
| 22 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::game_arearust-analyzer cargo gnome-robots 50.0.0 game_area/::GameArearust-analyzer cargo gnome-robots 50.0.0 game_area/GameArea#; |
| 23 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::game_configrust-analyzer cargo gnome-robots 50.0.0 game_config/::GameConfigsrust-analyzer cargo gnome-robots 50.0.0 game_config/GameConfigs#; |
| 24 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::propertiesrust-analyzer cargo gnome-robots 50.0.0 properties/::Propertiesrust-analyzer cargo gnome-robots 50.0.0 properties/Properties#; |
| 25 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::scoresrust-analyzer cargo gnome-robots 50.0.0 scores/::scoresrust-analyzer cargo gnome-robots 50.0.0 scores/scores/::{Categoryrust-analyzer cargo gnome-robots 50.0.0 scores/scores/Category#, show_scoresrust-analyzer cargo gnome-robots 50.0.0 scores/scores/show_scores().}; |
| 26 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::window_sizerust-analyzer cargo gnome-robots 50.0.0 window_size/::remember_window_sizerust-analyzer cargo gnome-robots 50.0.0 window_size/remember_window_size().; |
| 27 | 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/::*}; |
| 28 | use gettextrsrust-analyzer cargo gettext-rs 0.7.7 crate/::gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().; |
| 29 | use gtkrust-analyzer cargo gtk4 0.11.1 crate/::{giorust-analyzer cargo gio 0.22.2 crate/, glibrust-analyzer cargo glib 0.22.3 crate/}; |
| 30 | use randrust-analyzer cargo rand 0.10.0 crate/::rngrust-analyzer cargo rand 0.10.0 rng/; |
| 31 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 32 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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#; |
| 33 | |
| 34 | mod imprust-analyzer cargo gnome-robots 50.0.0 window/imp/ { |
| 35 | use superrust-analyzer cargo gnome-robots 50.0.0 window/::*; |
| 36 | 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#; |
| 37 | |
| 38 | pub struct RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# { |
| 39 | pub window_titlerust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#window_title.: adwrust-analyzer cargo libadwaita 0.9.1 crate/::WindowTitlerust-analyzer cargo libadwaita 0.9.1 auto/window_title/WindowTitle#, |
| 40 | pub safe_teleports_labelrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#safe_teleports_label.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#, |
| 41 | pub game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<GameArearust-analyzer cargo gnome-robots 50.0.0 game_area/GameArea#>, |
| 42 | pub settingsrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#settings.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<giorust-analyzer cargo gio 0.22.2 crate/::Settingsrust-analyzer cargo gio 0.22.2 auto/settings/Settings#>, |
| 43 | } |
| 44 | |
| 45 | #[glibrust-analyzer cargo glib 0.22.3 crate/::object_subclassrust-analyzer cargo glib-macros 0.22.2 object_subclass:] |
| 46 | impl ObjectSubclassrust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# { |
| 47 | const NAMErust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]NAME.: &'static str = "RobotsWindow"; |
| 48 | type Typerust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]Type# = superrust-analyzer cargo gnome-robots 50.0.0 window/::RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#; |
| 49 | type ParentTyperust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]ParentType# = adwrust-analyzer cargo libadwaita 0.9.1 crate/::ApplicationWindowrust-analyzer cargo libadwaita 0.9.1 auto/application_window/ApplicationWindow#; |
| 50 | |
| 51 | fn newrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]new().() -> Selfrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass] { |
| 52 | Selfrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass] { |
| 53 | window_titlerust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#window_title.: adwrust-analyzer cargo libadwaita 0.9.1 crate/::WindowTitlerust-analyzer cargo libadwaita 0.9.1 auto/window_title/WindowTitle#::builderrust-analyzer cargo libadwaita 0.9.1 auto/window_title/impl#[WindowTitle]builder().().titlerust-analyzer cargo libadwaita 0.9.1 auto/window_title/impl#[WindowTitleBuilder]title().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Robots")).buildrust-analyzer cargo libadwaita 0.9.1 auto/window_title/impl#[WindowTitleBuilder]build().(), |
| 54 | safe_teleports_labelrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#safe_teleports_label.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#::builderrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[Label]builder().().use_markuprust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]use_markup().(true).buildrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]build().(), |
| 55 | game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area.: 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().(), |
| 56 | settingsrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#settings.: 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().(), |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | fn class_initrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]class_init().(klass: &mut Selfrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow][ObjectSubclass]::Classrust-analyzer cargo glib 0.22.3 subclass/types/ObjectSubclass#Class#) { |
| 61 | klass.install_actionrust-analyzer cargo gtk4 0.11.1 subclass/widget/WidgetClassExt#install_action().("win.random-teleport", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |obj, _, _| { |
| 62 | obj.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().random_teleport_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]random_teleport_cb().(); |
| 63 | }); |
| 64 | klass.install_actionrust-analyzer cargo gtk4 0.11.1 subclass/widget/WidgetClassExt#install_action().("win.safe-teleport", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |obj, _, _| { |
| 65 | obj.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().safe_teleport_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]safe_teleport_cb().(); |
| 66 | }); |
| 67 | klass.install_actionrust-analyzer cargo gtk4 0.11.1 subclass/widget/WidgetClassExt#install_action().("win.wait", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |obj, _, _| { |
| 68 | obj.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().wait_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]wait_cb().(); |
| 69 | }); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | impl ObjectImplrust-analyzer cargo glib 0.22.3 subclass/object/ObjectImpl# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# {} |
| 74 | impl WidgetImplrust-analyzer cargo gtk4 0.11.1 subclass/widget/WidgetImpl# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# {} |
| 75 | impl WindowImplrust-analyzer cargo gtk4 0.11.1 subclass/window/WindowImpl# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# {} |
| 76 | impl ApplicationWindowImplrust-analyzer cargo gtk4 0.11.1 subclass/application_window/ApplicationWindowImpl# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# {} |
| 77 | impl AdwApplicationWindowImplrust-analyzer cargo libadwaita 0.9.1 subclass/application_window/AdwApplicationWindowImpl# for RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# {} |
| 78 | |
| 79 | impl RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow# { |
| 80 | fn random_teleport_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]random_teleport_cb().(&self) { |
| 81 | self.game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area. |
| 82 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get().() |
| 83 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 84 | .player_commandrust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]player_command().(PlayerCommandrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#::RandomTeleportrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#RandomTeleport#); |
| 85 | } |
| 86 | |
| 87 | fn safe_teleport_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]safe_teleport_cb().(&self) { |
| 88 | self.game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area. |
| 89 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get().() |
| 90 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 91 | .player_commandrust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]player_command().(PlayerCommandrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#::SafeTeleportrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#SafeTeleport#); |
| 92 | } |
| 93 | |
| 94 | fn wait_cbrust-analyzer cargo gnome-robots 50.0.0 window/imp/impl#[RobotsWindow]wait_cb().(&self) { |
| 95 | self.game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area. |
| 96 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get().() |
| 97 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 98 | .player_commandrust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]player_command().(PlayerCommandrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#::Waitrust-analyzer cargo gnome-robots 50.0.0 game/PlayerCommand#Wait#); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | pub fn button_boxrust-analyzer cargo gnome-robots 50.0.0 window/imp/button_box().(safe_teleports_label: >krust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#) -> gtkrust-analyzer cargo gtk4 0.11.1 crate/::Boxrust-analyzer cargo gtk4 0.11.1 auto/box_/Box# { |
| 103 | let hbox = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Boxrust-analyzer cargo gtk4 0.11.1 auto/box_/Box#::builderrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[Box]builder().() |
| 104 | .orientationrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]orientation().(gtkrust-analyzer cargo gtk4 0.11.1 crate/::Orientationrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#::Horizontalrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#Horizontal#) |
| 105 | .spacingrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]spacing().(10) |
| 106 | .buildrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]build().(); |
| 107 | let size_group = gtkrust-analyzer cargo gtk4 0.11.1 crate/::SizeGrouprust-analyzer cargo gtk4 0.11.1 auto/size_group/SizeGroup#::newrust-analyzer cargo gtk4 0.11.1 auto/size_group/impl#[SizeGroup]new().(gtkrust-analyzer cargo gtk4 0.11.1 crate/::SizeGroupModerust-analyzer cargo gtk4 0.11.1 auto/enums/SizeGroupMode#::Bothrust-analyzer cargo gtk4 0.11.1 auto/enums/SizeGroupMode#Both#); |
| 108 | |
| 109 | { |
| 110 | let label = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#::builderrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[Label]builder().() |
| 111 | .labelrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]label().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Teleport _Randomly")) |
| 112 | .use_underlinerust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]use_underline().(true) |
| 113 | .margin_toprust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]margin_top().(15) |
| 114 | .margin_bottomrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]margin_bottom().(15) |
| 115 | .buildrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]build().(); |
| 116 | let button = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Buttonrust-analyzer cargo gtk4 0.11.1 auto/button/Button#::builderrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[Button]builder().() |
| 117 | .action_namerust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]action_name().("win.random-teleport") |
| 118 | .childrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]child().(&label) |
| 119 | .hexpandrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]hexpand().(true) |
| 120 | .buildrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]build().(); |
| 121 | size_group.add_widgetrust-analyzer cargo gtk4 0.11.1 auto/size_group/impl#[SizeGroup]add_widget().(&button); |
| 122 | hbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&button); |
| 123 | } |
| 124 | |
| 125 | { |
| 126 | let vbox = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Boxrust-analyzer cargo gtk4 0.11.1 auto/box_/Box#::builderrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[Box]builder().() |
| 127 | .orientationrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]orientation().(gtkrust-analyzer cargo gtk4 0.11.1 crate/::Orientationrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#::Verticalrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#Vertical#) |
| 128 | .margin_toprust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]margin_top().(15) |
| 129 | .margin_bottomrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]margin_bottom().(15) |
| 130 | .buildrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]build().(); |
| 131 | let label = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#::builderrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[Label]builder().() |
| 132 | .labelrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]label().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Teleport _Safely")) |
| 133 | .use_underlinerust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]use_underline().(true) |
| 134 | .buildrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]build().(); |
| 135 | vbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&label); |
| 136 | vbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(safe_teleports_label); |
| 137 | let button = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Buttonrust-analyzer cargo gtk4 0.11.1 auto/button/Button#::builderrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[Button]builder().() |
| 138 | .action_namerust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]action_name().("win.safe-teleport") |
| 139 | .childrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]child().(&vbox) |
| 140 | .hexpandrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]hexpand().(true) |
| 141 | .buildrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]build().(); |
| 142 | size_group.add_widgetrust-analyzer cargo gtk4 0.11.1 auto/size_group/impl#[SizeGroup]add_widget().(&button); |
| 143 | hbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&button); |
| 144 | } |
| 145 | |
| 146 | { |
| 147 | let label = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Labelrust-analyzer cargo gtk4 0.11.1 auto/label/Label#::builderrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[Label]builder().() |
| 148 | .labelrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]label().(gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_Wait for Robots")) |
| 149 | .use_underlinerust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]use_underline().(true) |
| 150 | .margin_toprust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]margin_top().(15) |
| 151 | .margin_bottomrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]margin_bottom().(15) |
| 152 | .buildrust-analyzer cargo gtk4 0.11.1 auto/label/impl#[LabelBuilder]build().(); |
| 153 | let button = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Buttonrust-analyzer cargo gtk4 0.11.1 auto/button/Button#::builderrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[Button]builder().() |
| 154 | .action_namerust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]action_name().("win.wait") |
| 155 | .childrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]child().(&label) |
| 156 | .hexpandrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]hexpand().(true) |
| 157 | .buildrust-analyzer cargo gtk4 0.11.1 auto/button/impl#[ButtonBuilder]build().(); |
| 158 | size_group.add_widgetrust-analyzer cargo gtk4 0.11.1 auto/size_group/impl#[SizeGroup]add_widget().(&button); |
| 159 | hbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&button); |
| 160 | } |
| 161 | |
| 162 | hbox |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | glibrust-analyzer cargo glib 0.22.3 crate/::wrapperrust-analyzer cargo glib 0.22.3 wrapper/wrapper!! { |
| 167 | pub struct RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow#(ObjectSubclass<imprust-analyzer cargo gnome-robots 50.0.0 window/imp/::RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#>) |
| 168 | @extends adwrust-analyzer cargo libadwaita 0.9.1 crate/::ApplicationWindowrust-analyzer cargo libadwaita 0.9.1 auto/application_window/ApplicationWindow#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::ApplicationWindowrust-analyzer cargo gtk4 0.11.1 auto/application_window/ApplicationWindow#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Windowrust-analyzer cargo gtk4 0.11.1 auto/window/Window#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Widgetrust-analyzer cargo gtk4 0.11.1 auto/widget/Widget#, |
| 169 | @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#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Accessiblerust-analyzer cargo gtk4 0.11.1 auto/accessible/Accessible#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Buildablerust-analyzer cargo gtk4 0.11.1 auto/buildable/Buildable#, |
| 170 | gtkrust-analyzer cargo gtk4 0.11.1 crate/::ConstraintTargetrust-analyzer cargo gtk4 0.11.1 auto/constraint_target/ConstraintTarget#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Nativerust-analyzer cargo gtk4 0.11.1 auto/native/Native#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::Rootrust-analyzer cargo gtk4 0.11.1 auto/root/Root#, gtkrust-analyzer cargo gtk4 0.11.1 crate/::ShortcutManagerrust-analyzer cargo gtk4 0.11.1 auto/shortcut_manager/ShortcutManager#; |
| 171 | } |
| 172 | |
| 173 | impl RobotsWindowrust-analyzer cargo gnome-robots 50.0.0 window/RobotsWindow# { |
| 174 | pub fn newrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]new().( |
| 175 | application: &impl IsArust-analyzer cargo glib 0.22.3 object/IsA#<gtkrust-analyzer cargo gtk4 0.11.1 crate/::Applicationrust-analyzer cargo gtk4 0.11.1 auto/application/Application#>, |
| 176 | settings: &giorust-analyzer cargo gio 0.22.2 crate/::Settingsrust-analyzer cargo gio 0.22.2 auto/settings/Settings#, |
| 177 | game_configs: GameConfigsrust-analyzer cargo gnome-robots 50.0.0 game_config/GameConfigs#, |
| 178 | assets: &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#>, |
| 179 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow], Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#>> { |
| 180 | let this: Selfrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow] = 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().() |
| 181 | .propertyrust-analyzer cargo glib 0.22.3 object/impl#[`ObjectBuilder<'a, O>`]property().("application", application) |
| 182 | .buildrust-analyzer cargo glib 0.22.3 object/impl#[`ObjectBuilder<'a, O>`]build().(); |
| 183 | |
| 184 | remember_window_sizerust-analyzer cargo gnome-robots 50.0.0 window_size/remember_window_size().(this.upcast_refrust-analyzer cargo glib 0.22.3 object/Cast#upcast_ref().(), settings); |
| 185 | this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().settingsrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#settings..setrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]set().(settings.clonerust-analyzer cargo gio 0.22.2 auto/settings/impl#[Settings][Clone]clone().()).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().(); |
| 186 | |
| 187 | let vbox = gtkrust-analyzer cargo gtk4 0.11.1 crate/::Boxrust-analyzer cargo gtk4 0.11.1 auto/box_/Box#::builderrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[Box]builder().() |
| 188 | .orientationrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]orientation().(gtkrust-analyzer cargo gtk4 0.11.1 crate/::Orientationrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#::Verticalrust-analyzer cargo gtk4 0.11.1 auto/enums/Orientation#Vertical#) |
| 189 | .buildrust-analyzer cargo gtk4 0.11.1 auto/box_/impl#[BoxBuilder]build().(); |
| 190 | this.set_contentrust-analyzer cargo libadwaita 0.9.1 auto/application_window/AdwApplicationWindowExt#set_content().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&vbox)); |
| 191 | |
| 192 | let headerbar = adwrust-analyzer cargo libadwaita 0.9.1 crate/::HeaderBarrust-analyzer cargo libadwaita 0.9.1 auto/header_bar/HeaderBar#::builderrust-analyzer cargo libadwaita 0.9.1 auto/header_bar/impl#[HeaderBar]builder().() |
| 193 | .title_widgetrust-analyzer cargo libadwaita 0.9.1 auto/header_bar/impl#[HeaderBarBuilder]title_widget().(&this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().window_titlerust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#window_title.) |
| 194 | .buildrust-analyzer cargo libadwaita 0.9.1 auto/header_bar/impl#[HeaderBarBuilder]build().(); |
| 195 | vbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&headerbar); |
| 196 | |
| 197 | let appmenu = giorust-analyzer cargo gio 0.22.2 crate/::Menurust-analyzer cargo gio 0.22.2 auto/menu/Menu#::newrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]new().(); |
| 198 | appmenu.append_sectionrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_section().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &{ |
| 199 | let section = giorust-analyzer cargo gio 0.22.2 crate/::Menurust-analyzer cargo gio 0.22.2 auto/menu/Menu#::newrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]new().(); |
| 200 | section.append_itemrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_item().(&giorust-analyzer cargo gio 0.22.2 crate/::MenuItemrust-analyzer cargo gio 0.22.2 auto/menu_item/MenuItem#::newrust-analyzer cargo gio 0.22.2 auto/menu_item/impl#[MenuItem]new().( |
| 201 | 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")), |
| 202 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("app.new-game"), |
| 203 | )); |
| 204 | section.append_itemrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_item().(&giorust-analyzer cargo gio 0.22.2 crate/::MenuItemrust-analyzer cargo gio 0.22.2 auto/menu_item/MenuItem#::newrust-analyzer cargo gio 0.22.2 auto/menu_item/impl#[MenuItem]new().( |
| 205 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_Scores")), |
| 206 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("app.scores"), |
| 207 | )); |
| 208 | section |
| 209 | }); |
| 210 | appmenu.append_sectionrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_section().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &{ |
| 211 | let section = giorust-analyzer cargo gio 0.22.2 crate/::Menurust-analyzer cargo gio 0.22.2 auto/menu/Menu#::newrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]new().(); |
| 212 | section.append_itemrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_item().(&giorust-analyzer cargo gio 0.22.2 crate/::MenuItemrust-analyzer cargo gio 0.22.2 auto/menu_item/MenuItem#::newrust-analyzer cargo gio 0.22.2 auto/menu_item/impl#[MenuItem]new().( |
| 213 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_Preferences")), |
| 214 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("app.preferences"), |
| 215 | )); |
| 216 | section.append_itemrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_item().(&giorust-analyzer cargo gio 0.22.2 crate/::MenuItemrust-analyzer cargo gio 0.22.2 auto/menu_item/MenuItem#::newrust-analyzer cargo gio 0.22.2 auto/menu_item/impl#[MenuItem]new().( |
| 217 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_Help")), |
| 218 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("app.help"), |
| 219 | )); |
| 220 | section.append_itemrust-analyzer cargo gio 0.22.2 auto/menu/impl#[Menu]append_item().(&giorust-analyzer cargo gio 0.22.2 crate/::MenuItemrust-analyzer cargo gio 0.22.2 auto/menu_item/MenuItem#::newrust-analyzer cargo gio 0.22.2 auto/menu_item/impl#[MenuItem]new().( |
| 221 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("_About Robots")), |
| 222 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("app.about"), |
| 223 | )); |
| 224 | section |
| 225 | }); |
| 226 | |
| 227 | let menu_button = gtkrust-analyzer cargo gtk4 0.11.1 crate/::MenuButtonrust-analyzer cargo gtk4 0.11.1 auto/menu_button/MenuButton#::builderrust-analyzer cargo gtk4 0.11.1 auto/menu_button/impl#[MenuButton]builder().() |
| 228 | .icon_namerust-analyzer cargo gtk4 0.11.1 auto/menu_button/impl#[MenuButtonBuilder]icon_name().("open-menu-symbolic") |
| 229 | .menu_modelrust-analyzer cargo gtk4 0.11.1 auto/menu_button/impl#[MenuButtonBuilder]menu_model().(&appmenu) |
| 230 | .buildrust-analyzer cargo gtk4 0.11.1 auto/menu_button/impl#[MenuButtonBuilder]build().(); |
| 231 | headerbar.pack_endrust-analyzer cargo libadwaita 0.9.1 auto/header_bar/impl#[HeaderBar]pack_end().(&menu_button); |
| 232 | |
| 233 | let game = Gamerust-analyzer cargo gnome-robots 50.0.0 game/Game#::newrust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]new().(game_configs.best_matchrust-analyzer cargo gnome-robots 50.0.0 game_config/impl#[GameConfigs]best_match().(&settings.selected_configrust-analyzer cargo gnome-robots 50.0.0 properties/impl#[`gio::Settings`][Properties]selected_config().()), rngrust-analyzer cargo rand 0.10.0 rngs/thread/rng().()); |
| 234 | game.start_new_gamerust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]start_new_game().(); |
| 235 | |
| 236 | let game_area = GameArearust-analyzer cargo gnome-robots 50.0.0 game_area/GameArea#::newrust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]new().(game_configs, assets, settings)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 237 | game_area.connect_updatedrust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]connect_updated().(glibrust-analyzer cargo glib 0.22.3 crate/::clonerust-analyzer cargo glib-macros 0.22.2 clone!!( |
| 238 | #[weak] |
| 239 | this, |
| 240 | move |ga| this.update_game_statusrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]update_game_status().(ga.gamerust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]game().().as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) |
| 241 | )); |
| 242 | |
| 243 | let gridframe = gtkrust-analyzer cargo gtk4 0.11.1 crate/::AspectFramerust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/AspectFrame#::builderrust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrame]builder().() |
| 244 | .ratiorust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrameBuilder]ratio().((game.widthrust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]width().() as f32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().(game.heightrust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]height().() as f32)) |
| 245 | .hexpandrust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrameBuilder]hexpand().(true) |
| 246 | .vexpandrust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrameBuilder]vexpand().(true) |
| 247 | .childrust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrameBuilder]child().(&game_area) |
| 248 | .buildrust-analyzer cargo gtk4 0.11.1 auto/aspect_frame/impl#[AspectFrameBuilder]build().(); |
| 249 | |
| 250 | game_area.set_gamerust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]set_game().(game); |
| 251 | this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area..setrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]set().(game_area).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().(); |
| 252 | |
| 253 | let toolbar_view = adwrust-analyzer cargo libadwaita 0.9.1 crate/::ToolbarViewrust-analyzer cargo libadwaita 0.9.1 auto/toolbar_view/ToolbarView#::builderrust-analyzer cargo libadwaita 0.9.1 auto/toolbar_view/impl#[ToolbarView]builder().().contentrust-analyzer cargo libadwaita 0.9.1 auto/toolbar_view/impl#[ToolbarViewBuilder]content().(&gridframe).buildrust-analyzer cargo libadwaita 0.9.1 auto/toolbar_view/impl#[ToolbarViewBuilder]build().(); |
| 254 | |
| 255 | let action_bar = gtkrust-analyzer cargo gtk4 0.11.1 crate/::ActionBarrust-analyzer cargo gtk4 0.11.1 auto/action_bar/ActionBar#::builderrust-analyzer cargo gtk4 0.11.1 auto/action_bar/impl#[ActionBar]builder().().buildrust-analyzer cargo gtk4 0.11.1 auto/action_bar/impl#[ActionBarBuilder]build().(); |
| 256 | action_bar.set_center_widgetrust-analyzer cargo gtk4 0.11.1 auto/action_bar/impl#[ActionBar]set_center_widget().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&imprust-analyzer cargo gnome-robots 50.0.0 window/imp/::button_boxrust-analyzer cargo gnome-robots 50.0.0 window/imp/button_box().(&this.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().safe_teleports_labelrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#safe_teleports_label.))); |
| 257 | toolbar_view.add_bottom_barrust-analyzer cargo libadwaita 0.9.1 auto/toolbar_view/impl#[ToolbarView]add_bottom_bar().(&action_bar); |
| 258 | |
| 259 | vbox.appendrust-analyzer cargo gtk4 0.11.1 auto/box_/BoxExt#append().(&toolbar_view); |
| 260 | |
| 261 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(this) |
| 262 | } |
| 263 | |
| 264 | fn update_game_statusrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]update_game_status().(&self, game: &Gamerust-analyzer cargo gnome-robots 50.0.0 game/Game#) { |
| 265 | let status = game.statusrust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]status().(); |
| 266 | |
| 267 | self.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().window_titlerust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#window_title..set_subtitlerust-analyzer cargo libadwaita 0.9.1 auto/window_title/impl#[WindowTitle]set_subtitle().( |
| 268 | &gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("Level: {level}\tScore: {score}") |
| 269 | .replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().("{level}", &status.current_levelrust-analyzer cargo gnome-robots 50.0.0 game/Status#current_level..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 270 | .replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().("{score}", &status.scorerust-analyzer cargo gnome-robots 50.0.0 game/Status#score..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 271 | ); |
| 272 | |
| 273 | let remaining_teleports_text = |
| 274 | gettextrust-analyzer cargo gettext-rs 0.7.7 gettext().("(Remaining: %d)").replacenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replacen().("%d", &status.safe_teleportsrust-analyzer cargo gnome-robots 50.0.0 game/Status#safe_teleports..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), 1); |
| 275 | self.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().() |
| 276 | .safe_teleports_labelrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#safe_teleports_label. |
| 277 | .set_markuprust-analyzer cargo gtk4 0.11.1 auto/label/impl#[Label]set_markup().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("<small>{}</small>", remaining_teleports_text)); |
| 278 | |
| 279 | let is_playing = game.staterust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]state().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Staterust-analyzer cargo gnome-robots 50.0.0 game/State#::Completerust-analyzer cargo gnome-robots 50.0.0 game/State#Complete# && game.staterust-analyzer cargo gnome-robots 50.0.0 game/impl#[Game]state().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Staterust-analyzer cargo gnome-robots 50.0.0 game/State#::Deadrust-analyzer cargo gnome-robots 50.0.0 game/State#Dead#; |
| 280 | self.enable_actionrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]enable_action().("random-teleport", is_playing); |
| 281 | self.enable_actionrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]enable_action().("safe-teleport", is_playing && status.safe_teleportsrust-analyzer cargo gnome-robots 50.0.0 game/Status#safe_teleports. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().0); |
| 282 | self.enable_actionrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]enable_action().("wait", is_playing); |
| 283 | } |
| 284 | |
| 285 | fn enable_actionrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]enable_action().(&self, action_name: &str, enabled: bool) { |
| 286 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(action) = self |
| 287 | .lookup_actionrust-analyzer cargo gio 0.22.2 auto/action_map/ActionMapExt#lookup_action().(action_name) |
| 288 | .and_downcastrust-analyzer cargo glib 0.22.3 object/impl#[`Option<I>`][CastNone]and_downcast().::<giorust-analyzer cargo gio 0.22.2 crate/::SimpleActionrust-analyzer cargo gio 0.22.2 auto/simple_action/SimpleAction#>() |
| 289 | { |
| 290 | action.set_enabledrust-analyzer cargo gio 0.22.2 auto/simple_action/impl#[SimpleAction]set_enabled().(enabled); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | pub fn focus_gamerust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]focus_game().(&self) { |
| 295 | self.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area..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().().grab_focusrust-analyzer cargo gtk4 0.11.1 auto/widget/WidgetExt#grab_focus().(); |
| 296 | } |
| 297 | |
| 298 | pub fn start_new_gamerust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]start_new_game().(&self) { |
| 299 | self.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().game_arearust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#game_area..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().().start_new_gamerust-analyzer cargo gnome-robots 50.0.0 game_area/impl#[GameArea]start_new_game().(); |
| 300 | } |
| 301 | |
| 302 | pub fn show_highscoresrust-analyzer cargo gnome-robots 50.0.0 window/impl#[RobotsWindow]show_highscores().(&self) { |
| 303 | let settings = self.imprust-analyzer cargo glib 0.22.3 subclass/types/impl#[T][ObjectSubclassIsExt]imp().().settingsrust-analyzer cargo gnome-robots 50.0.0 window/imp/RobotsWindow#settings..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().(); |
| 304 | |
| 305 | let category = Categoryrust-analyzer cargo gnome-robots 50.0.0 scores/scores/Category# { |
| 306 | keyrust-analyzer cargo gnome-robots 50.0.0 scores/scores/Category#key.: settings.selected_configrust-analyzer cargo gnome-robots 50.0.0 properties/impl#[`gio::Settings`][Properties]selected_config().(), |
| 307 | safetyrust-analyzer cargo gnome-robots 50.0.0 scores/scores/Category#safety.: settings.move_safetyrust-analyzer cargo gnome-robots 50.0.0 properties/Properties#move_safety().(), |
| 308 | }; |
| 309 | |
| 310 | show_scoresrust-analyzer cargo gnome-robots 50.0.0 scores/scores/show_scores().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&category), self); |
| 311 | } |
| 312 | } |