fn create_actions(&self, application: &gtk::Application) {
        // When activated, show a settings dialog
        let settings = gio::SimpleAction::new("settings", None);
        let weak_application = application.downgrade();
        settings.connect_activate(move |_action, _parameter| {
            let application = upgrade_weak!(weak_application);

            show_settings_dialog(&application);
        });
        application.add_action(&settings);

        // about action: when activated it will show an about dialog
        let about = gio::SimpleAction::new("about", None);
        let weak_application = application.downgrade();
        about.connect_activate(move |_action, _parameter| {
            let application = upgrade_weak!(weak_application);
            show_about_dialog(&application);
        });
        application.add_action(&about);

        // snapshot action: changes state between true/false
        let snapshot =
            gio::SimpleAction::new_stateful("snapshot", None, &SnapshotState::Idle.into());
        let weak_app = self.downgrade();
        snapshot.connect_change_state(move |action, state| {
            let app = upgrade_weak!(weak_app);
            let state = state.as_ref().expect("No state provided");
            app.on_snapshot_state_changed(state.into());

            // Let the action store the new state
            action.set_state(state);
        });
        application.add_action(&snapshot);

        // record action: changes state between true/false
        let record = gio::SimpleAction::new_stateful("record", None, &RecordState::Idle.into());
        let weak_app = self.downgrade();
        record.connect_change_state(move |action, state| {
            let app = upgrade_weak!(weak_app);
            let state = state.as_ref().expect("No state provided");
            app.on_record_state_changed(state.into());

            // Let the action store the new state
            action.set_state(state);
        });
        application.add_action(&record);
    }
// Create our application actions here
//
// These are connected to our buttons and can be triggered by the buttons, as well as remotely
Create our application actions here
These are connected to our buttons and can be triggered by the buttons, as well as remotely
Create our application actions here These are connected to our buttons and can be triggered by the buttons as well as remotely
fn create_actions(&self, application: &gtk::Application) {
        // When activated, show a settings dialog
        let settings = gio::SimpleAction::new("settings", None);
        let weak_application = application.downgrade();
        settings.connect_activate(move |_action, _parameter| {
            let application = upgrade_weak!(weak_application);
            show_settings_dialog(&application);
        });
        application.add_action(&settings);
        // about action: when activated it will show an about dialog
        let about = gio::SimpleAction::new("about", None);
        let weak_application = application.downgrade();
        about.connect_activate(move |_action, _parameter| {
            let application = upgrade_weak!(weak_application);
            show_about_dialog(&application);
        });
        application.add_action(&about);
        // snapshot action: changes state between true/false
        let snapshot =
            gio::SimpleAction::new_stateful("snapshot", None, &SnapshotState::Idle.into());
        let weak_app = self.downgrade();
        snapshot.connect_change_state(move |action, state| {
            let app = upgrade_weak!(weak_app);
            let state = state.as_ref().expect("No state provided");
            app.on_snapshot_state_changed(state.into());
            // Let the action store the new state
            action.set_state(state);
        });
        application.add_action(&snapshot);
        // record action: changes state between true/false
        let record = gio::SimpleAction::new_stateful("record", None, &RecordState::Idle.into());
        let weak_app = self.downgrade();
        record.connect_change_state(move |action, state| {
            let app = upgrade_weak!(weak_app);
            let state = state.as_ref().expect("No state provided");
            app.on_record_state_changed(state.into());
            // Let the action store the new state
            action.set_state(state);
        });
        application.add_action(&record);
    }
fn create_actions ( & self , application : & gtk :: Application ) { // When activated, show a settings dialog let settings = gio :: SimpleAction :: new ( " " , None ) ; let weak_application = application . downgrade ( ) ; settings . connect_activate ( move | _action , _parameter | { let application = upgrade_weak ! ( weak_application ) ; show_settings_dialog ( & application ) ; } ) ; application . add_action ( & settings ) ; // about action: when activated it will show an about dialog let about = gio :: SimpleAction :: new ( " " , None ) ; let weak_application = application . downgrade ( ) ; about . connect_activate ( move | _action , _parameter | { let application = upgrade_weak ! ( weak_application ) ; show_about_dialog ( & application ) ; } ) ; application . add_action ( & about ) ; // snapshot action: changes state between true/false let snapshot = gio :: SimpleAction :: new_stateful ( " " , None , & SnapshotState :: Idle . into ( ) ) ; let weak_app = self . downgrade ( ) ; snapshot . connect_change_state ( move | action , state | { let app = upgrade_weak ! ( weak_app ) ; let state = state . as_ref ( ) . expect ( " " ) ; app . on_snapshot_state_changed ( state . into ( ) ) ; // Let the action store the new state action . set_state ( state ) ; } ) ; application . add_action ( & snapshot ) ; // record action: changes state between true/false let record = gio :: SimpleAction :: new_stateful ( " " , None , & RecordState :: Idle . into ( ) ) ; let weak_app = self . downgrade ( ) ; record . connect_change_state ( move | action , state | { let app = upgrade_weak ! ( weak_app ) ; let state = state . as_ref ( ) . expect ( " " ) ; app . on_record_state_changed ( state . into ( ) ) ; // Let the action store the new state action . set_state ( state ) ; } ) ; application . add_action ( & record ) ; }
Create our application actions here
These are connected to our buttons and can be triggered by the buttons, as well as remotely
Create our application actions here These are connected to our buttons and can be triggered by the buttons as well as remotely
&self
application
&gtk::Application
&self
application
&gtk::Application