[]Struct gio::Action

pub struct Action(_, _);

Action represents a single named action.

The main interface to an action is that it can be activated with Action::activate. This results in the 'activate' signal being emitted. An activation has a glib::Variant parameter (which may be None). The correct type for the parameter is determined by a static parameter type (which is given at construction time).

An action may optionally have a state, in which case the state may be set with Action::change_state. This call takes a glib::Variant. The correct type for the state is determined by a static state type (which is given at construction time).

The state may have a hint associated with it, specifying its valid range.

Action is merely the interface to the concept of an action, as described above. Various implementations of actions exist, including SimpleAction.

In all cases, the implementing class is responsible for storing the name of the action, the parameter type, the enabled state, the optional state type and the state and emitting the appropriate signals when these change. The implementor is responsible for filtering calls to Action::activate and Action::change_state for type safety and for the state being enabled.

Probably the only useful thing to do with a Action is to put it inside of a SimpleActionGroup.

Implements

ActionExt

Methods

impl Action[src]

pub fn name_is_valid(action_name: &str) -> bool[src]

Checks if action_name is valid.

action_name is valid if it consists only of alphanumeric characters, plus '-' and '.'. The empty string is not a valid action name.

It is an error to call this function with a non-utf8 action_name. action_name must not be None.

action_name

an potential action name

Returns

true if action_name is valid

pub fn parse_detailed_name(
    detailed_name: &str
) -> Result<(GString, Variant), Error>
[src]

Parses a detailed action name into its separate name and target components.

Detailed action names can have three formats.

The first format is used to represent an action name with no target value and consists of just an action name containing no whitespace nor the characters ':', '(' or ')'. For example: "app.action".

The second format is used to represent an action with a target value that is a non-empty string consisting only of alphanumerics, plus '-' and '.'. In that case, the action name and target value are separated by a double colon ("::"). For example: "app.action::target".

The third format is used to represent an action with any type of target value, including strings. The target value follows the action name, surrounded in parens. For example: "app.action(42)". The target value is parsed using glib::Variant::parse. If a tuple-typed value is desired, it must be specified in the same way, resulting in two sets of parens, for example: "app.action((1,2,3))". A string target can be specified this way as well: "app.action('target')". For strings, this third format must be used if * target value is empty or contains characters other than alphanumerics, '-' and '.'.

detailed_name

a detailed action name

action_name

the action name

target_value

the target value, or None for no target

Returns

true if successful, else false with error set

pub fn print_detailed_name(
    action_name: &str,
    target_value: Option<&Variant>
) -> Option<GString>
[src]

Formats a detailed action name from action_name and target_value.

It is an error to call this function with an invalid action name.

This function is the opposite of Action::parse_detailed_name. It will produce a string that can be parsed back to the action_name and target_value by that function.

See that function for the types of strings that will be printed by this function.

action_name

a valid action name

target_value

a glib::Variant target value, or None

Returns

a detailed format string

Trait Implementations

impl<T: ObjectType> PartialOrd<T> for Action

#[must_use] fn lt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use] fn le(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use] fn gt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use] fn ge(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Eq for Action

impl<T: ObjectType> PartialEq<T> for Action

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Ord for Action

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl Clone for Action

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Hash for Action

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Display for Action[src]

impl Debug for Action

impl IsA<Action> for PropertyAction

impl IsA<Action> for SimpleAction

impl StaticType for Action

Auto Trait Implementations

impl Unpin for Action

impl !Sync for Action

impl !Send for Action

impl UnwindSafe for Action

impl RefUnwindSafe for Action

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> Cast for T where
    T: ObjectType, 

fn upcast<T>(self) -> T where
    Self: IsA<T>,
    T: ObjectType, 

Upcasts an object to a superclass or interface T. Read more

fn upcast_ref<T>(&self) -> &T where
    Self: IsA<T>,
    T: ObjectType, 

Upcasts an object to a reference of its superclass or interface T. Read more

fn downcast<T>(self) -> Result<T, Self> where
    Self: CanDowncast<T>,
    T: ObjectType, 

Tries to downcast to a subclass or interface implementor T. Read more

fn downcast_ref<T>(&self) -> Option<&T> where
    Self: CanDowncast<T>,
    T: ObjectType, 

Tries to downcast to a reference of its subclass or interface implementor T. Read more

fn dynamic_cast<T>(self) -> Result<T, Self> where
    T: ObjectType, 

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

fn dynamic_cast_ref<T>(&self) -> Option<&T> where
    T: ObjectType, 

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

unsafe fn unsafe_cast<T>(self) -> T where
    T: ObjectType, 

Casts to T unconditionally. Read more

unsafe fn unsafe_cast_ref<T>(&self) -> &T where
    T: ObjectType, 

Casts to &T unconditionally. Read more

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<T> ToValue for T where
    T: SetValue + ?Sized