"Fossies" - the Fresh Open Source Software Archive

Member "glibmm-2.74.0/untracked/gio/giomm/action.h" (19 Sep 2022, 23257 Bytes) of package /linux/misc/glibmm-2.74.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "action.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes reports: 2.73.2_vs_2.74.0 or 2.72.1_vs_2.74.0.

    1 // Generated by gmmproc 2.74.0 -- DO NOT MODIFY!
    2 #ifndef _GIOMM_ACTION_H
    3 #define _GIOMM_ACTION_H
    4 
    5 #include <giommconfig.h>
    6 
    7 
    8 #include <glibmm/ustring.h>
    9 #include <sigc++/sigc++.h>
   10 
   11 /* Copyright (C) 2011 The giomm Development Team
   12  *
   13  * This library is free software; you can redistribute it and/or
   14  * modify it under the terms of the GNU Lesser General Public
   15  * License as published by the Free Software Foundation; either
   16  * version 2.1 of the License, or (at your option) any later version.
   17  *
   18  * This library is distributed in the hope that it will be useful,
   19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21  * Lesser General Public License for more details.
   22  *
   23  * You should have received a copy of the GNU Lesser General Public
   24  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
   25  */
   26 
   27 
   28 #include <glibmm/interface.h>
   29 #include <glibmm/variant.h>
   30 #include <glibmm/varianttype.h>
   31 #include <gio/gio.h>
   32 
   33 
   34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   35 typedef struct _GActionInterface GActionInterface;
   36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
   37 
   38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   39 using GAction = struct _GAction;
   40 using GActionClass = struct _GActionClass;
   41 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
   42 
   43 
   44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   45 namespace Gio
   46 { class GIOMM_API Action_Class; } // namespace Gio
   47 #endif // DOXYGEN_SHOULD_SKIP_THIS
   48 
   49 namespace Gio
   50 {
   51 
   52 /** %Action - An action interface.
   53  * %Action represents a single named action.
   54  *
   55  * The main interface to an action is that it can be activated with activate().
   56  * This results in the signal_activate() signal being emitted. An activation
   57  * may optionally have a parameter, activate(const T_Value& parameter).
   58  * The correct type for the parameter is determined by a static parameter type
   59  * (which is given at construction time).
   60  *
   61  * An action may optionally have a state, in which case the state may be set
   62  * with change_state(). The correct type for the state is determined by a static
   63  * state type (which is given at construction time).
   64  *
   65  * An %Action can have a state, but no parameter, or vice versa. If it has both,
   66  * the parameter type can differ from the state type.
   67  *
   68  * The state may have a hint associated with it, specifying its valid range.
   69  *
   70  * %Action is merely the interface to the concept of an action, as described
   71  * above. Various implementations of actions exist, including SimpleAction.
   72  *
   73  * In all cases, the implementing class is responsible for storing the name of
   74  * the action, the parameter type, the enabled state, the optional state type
   75  * and the state and emitting the appropriate signals when these change. The
   76  * implementor is responsible for filtering calls to activate() and change_state()
   77  * for type safety and for the state being enabled.
   78  *
   79  * Probably the only useful thing to do with an %Action is to put it inside of a
   80  * SimpleActionGroup.
   81  *
   82  * @newin{2,32}
   83  */
   84 
   85 class GIOMM_API Action : public Glib::Interface
   86 {
   87   
   88 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   89 
   90 public:
   91   using CppObjectType = Action;
   92   using CppClassType = Action_Class;
   93   using BaseObjectType = GAction;
   94   using BaseClassType = GActionInterface;
   95 
   96   // noncopyable
   97   Action(const Action&) = delete;
   98   Action& operator=(const Action&) = delete;
   99 
  100 private:
  101   friend class Action_Class;
  102   static CppClassType action_class_;
  103 
  104 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  105 protected:
  106   /**
  107    * You should derive from this class to use it.
  108    */
  109   Action();
  110 
  111 #ifndef DOXYGEN_SHOULD_SKIP_THIS
  112   /** Called by constructors of derived classes. Provide the result of
  113    * the Class init() function to ensure that it is properly
  114    * initialized.
  115    *
  116    * @param interface_class The Class object for the derived type.
  117    */
  118   explicit Action(const Glib::Interface_Class& interface_class);
  119 
  120 public:
  121   // This is public so that C++ wrapper instances can be
  122   // created for C instances of unwrapped types.
  123   // For instance, if an unexpected C type implements the C interface.
  124   explicit Action(GAction* castitem);
  125 
  126 protected:
  127 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  128 
  129 public:
  130 
  131   Action(Action&& src) noexcept;
  132   Action& operator=(Action&& src) noexcept;
  133 
  134   ~Action() noexcept override;
  135 
  136   static void add_interface(GType gtype_implementer);
  137 
  138   /** Get the GType for this class, for use with the underlying GObject type system.
  139    */
  140   static GType get_type()      G_GNUC_CONST;
  141 
  142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
  143   static GType get_base_type() G_GNUC_CONST;
  144 #endif
  145 
  146   ///Provides access to the underlying C GObject.
  147   GAction*       gobj()       { return reinterpret_cast<GAction*>(gobject_); }
  148 
  149   ///Provides access to the underlying C GObject.
  150   const GAction* gobj() const { return reinterpret_cast<GAction*>(gobject_); }
  151 
  152 private:
  153 
  154 
  155 public:
  156   
  157   /** Queries the name of @a action.
  158    * 
  159    * @newin{2,28}
  160    * 
  161    * @return The name of the action.
  162    */
  163   Glib::ustring get_name() const;
  164   
  165   /** Queries the type of the parameter that must be given when activating
  166    *  @a action.
  167    * 
  168    * When activating the action using g_action_activate(), the Variant
  169    * given to that function must be of the type returned by this function.
  170    * 
  171    * In the case that this function returns <tt>nullptr</tt>, you must not give any
  172    * Variant, but <tt>nullptr</tt> instead.
  173    * 
  174    * @newin{2,28}
  175    * 
  176    * @return The parameter type.
  177    */
  178   Glib::VariantType get_parameter_type() const;
  179   
  180   /** Queries the type of the state of @a action.
  181    * 
  182    * If the action is stateful (e.g. created with
  183    * g_simple_action_new_stateful()) then this function returns the
  184    * VariantType of the state.  This is the type of the initial value
  185    * given as the state. All calls to g_action_change_state() must give a
  186    * Variant of this type and g_action_get_state() will return a
  187    * Variant of the same type.
  188    * 
  189    * If the action is not stateful (e.g. created with g_simple_action_new())
  190    * then this function will return <tt>nullptr</tt>. In that case, g_action_get_state()
  191    * will return <tt>nullptr</tt> and you must not call g_action_change_state().
  192    * 
  193    * @newin{2,28}
  194    * 
  195    * @return The state type, if the action is stateful.
  196    */
  197   Glib::VariantType get_state_type() const;
  198 
  199   //TODO: Is there any specific type that can really be used with this? A std::list<>. We must test this.
  200   //  See also ActionGroup:::get_action_state_hint().
  201   /** Requests a hint about the valid range of values for the state of
  202    * the action.
  203    *
  204    * If a null Variant is returned it either means that the action is not stateful
  205    * or that there is no hint about the valid range of values for the
  206    * state of the action.
  207    *
  208    * If a Variant array is returned then each item in the array is a
  209    * possible value for the state.  If a Variant pair (ie: two-tuple) is
  210    * returned then the tuple specifies the inclusive lower and upper bound
  211    * of valid values for the state.
  212    *
  213    * In any case, the information is merely a hint.  It may be possible to
  214    * have a state value outside of the hinted range and setting a value
  215    * within the range may fail.
  216    *
  217    * @param value This will be set to the state range hint.
  218    */
  219   template <typename T_Value>
  220   void get_state_hint(T_Value& value) const;
  221 
  222   
  223   /** Requests a hint about the valid range of values for the state of
  224    *  @a action.
  225    * 
  226    * If <tt>nullptr</tt> is returned it either means that the action is not stateful
  227    * or that there is no hint about the valid range of values for the
  228    * state of the action.
  229    * 
  230    * If a Variant array is returned then each item in the array is a
  231    * possible value for the state.  If a Variant pair (ie: two-tuple) is
  232    * returned then the tuple specifies the inclusive lower and upper bound
  233    * of valid values for the state.
  234    * 
  235    * In any case, the information is merely a hint.  It may be possible to
  236    * have a state value outside of the hinted range and setting a value
  237    * within the range may fail.
  238    * 
  239    * The return value (if non-<tt>nullptr</tt>) should be freed with
  240    * Glib::variant_unref() when it is no longer required.
  241    * 
  242    * @newin{2,28}
  243    * 
  244    * @return The state range hint.
  245    */
  246   Glib::VariantContainerBase get_state_hint_variant() const;
  247 
  248   
  249   /** Checks if @a action is currently enabled.
  250    * 
  251    * An action must be enabled in order to be activated or in order to
  252    * have its state changed from outside callers.
  253    * 
  254    * @newin{2,28}
  255    * 
  256    * @return Whether the action is enabled.
  257    */
  258   bool get_enabled() const;
  259 
  260   /** Request for the state of @a action to be changed to @a value,
  261    * assuming that the action has the expected state type.
  262    *
  263    * See get_state_type().
  264    *
  265    * This call merely requests a change.  The action may refuse to change
  266    * its state or may change its state to something other than @a value.
  267    * See get_state_hint().
  268    *
  269    * @newin{2,38}
  270    *
  271    * @param value The new state.
  272    */
  273   template <typename T_Value>
  274   void change_state(const T_Value& value);
  275 
  276   //This is just here to maintain API compatibility,
  277   //by stopping the compiler from calling the
  278   //regular change_state() with a Variant,
  279   //if the application code previously called change_state(VariantBase).
  280   template <typename T_Value>
  281   void change_state(const Glib::Variant<T_Value>& value);
  282 
  283   
  284   /** Request for the state of @a action to be changed to @a value.
  285    * 
  286    * The action must be stateful and @a value must be of the correct type.
  287    * See g_action_get_state_type().
  288    * 
  289    * This call merely requests a change.  The action may refuse to change
  290    * its state or may change its state to something other than @a value.
  291    * See g_action_get_state_hint().
  292    * 
  293    * If the @a value GVariant is floating, it is consumed.
  294    * 
  295    * @newin{2,30}
  296    * 
  297    * @param value The new state.
  298    */
  299   void change_state_variant(const Glib::VariantBase& value);
  300 
  301   /** Queries the current state of the action.
  302    *
  303    * If the action is not stateful then a null Variant will be returned.  If the
  304    * action is stateful then the type of the return value is the type
  305    * given by get_state_type().
  306    *
  307    * @param value This will be set to the current state of the action.
  308    */
  309   template <typename T_Value>
  310   void get_state(T_Value& value) const;
  311 
  312   
  313   /** Queries the current state of @a action.
  314    * 
  315    * If the action is not stateful then <tt>nullptr</tt> will be returned.  If the
  316    * action is stateful then the type of the return value is the type
  317    * given by g_action_get_state_type().
  318    * 
  319    * The return value (if non-<tt>nullptr</tt>) should be freed with
  320    * Glib::variant_unref() when it is no longer required.
  321    * 
  322    * @newin{2,28}
  323    * 
  324    * @return The current state of the action.
  325    */
  326   Glib::VariantBase get_state_variant() const;
  327 
  328   /** Activates the action without a parameter.
  329    */
  330   void activate();
  331 
  332   /** Activates the action with a parameter.
  333    *
  334    * The @a parameter must be the correct type of parameter for the action (ie:
  335    * the parameter type given at construction time).
  336    *
  337    * @param parameter The parameter to the activation
  338    */
  339   template <typename T_Value>
  340   void activate(const T_Value& parameter);
  341 
  342   //This is just here to maintain API compatibility,
  343   //by stopping the compiler from calling the
  344   //regular activate() with a Variant,
  345   //if the application code previously called activate(VariantBase).
  346   template <typename T_Value>
  347   void activate(const Glib::Variant<T_Value>& parameter);
  348 
  349   
  350   /** Activates the action.
  351    * 
  352    *  @a parameter must be the correct type of parameter for the action (ie:
  353    * the parameter type given at construction time).  If the parameter
  354    * type was <tt>nullptr</tt> then @a parameter must also be <tt>nullptr</tt>.
  355    * 
  356    * If the @a parameter GVariant is floating, it is consumed.
  357    * 
  358    * @newin{2,28}
  359    * 
  360    * @param parameter The parameter to the activation.
  361    */
  362   void activate_variant(const Glib::VariantBase& parameter);
  363 
  364   
  365   /** Checks if @a action_name is valid.
  366    * 
  367    *  @a action_name is valid if it consists only of alphanumeric characters,
  368    * plus '-' and '.'.  The empty string is not a valid action name.
  369    * 
  370    * It is an error to call this function with a non-utf8 @a action_name.
  371    *  @a action_name must not be <tt>nullptr</tt>.
  372    * 
  373    * @newin{2,38}
  374    * 
  375    * @param action_name A potential action name.
  376    * @return <tt>true</tt> if @a action_name is valid.
  377    */
  378   static bool name_is_valid(const Glib::ustring& action_name);
  379 
  380   /** Parses a detailed action name into its separate name and target components.
  381    *
  382    * Detailed action names can have three formats. See parse_detailed_name_variant().
  383    *
  384    * @newin{2,40}
  385    *
  386    * @param detailed_name A detailed action name.
  387    * @param[out] action_name The action name.
  388    * @param[out] target_value The target value.
  389    * @throw Glib::VariantParseError if @a detailed_name has an invalid format or a target of an unexpected type.
  390    */
  391   template <typename T_Value>
  392   static void parse_detailed_name(const Glib::ustring& detailed_name, Glib::ustring& action_name, T_Value& target_value);
  393 
  394   
  395   /** Parses a detailed action name into its separate name and target
  396    * components.
  397    * 
  398    * Detailed action names can have three formats.
  399    * 
  400    * The first format is used to represent an action name with no target
  401    * value and consists of just an action name containing no whitespace
  402    * nor the characters ':', '(' or ')'.  For example: "app.action".
  403    * 
  404    * The second format is used to represent an action with a target value
  405    * that is a non-empty string consisting only of alphanumerics, plus '-'
  406    * and '.'.  In that case, the action name and target value are
  407    * separated by a double colon ("::").  For example:
  408    * "app.action::target".
  409    * 
  410    * The third format is used to represent an action with any type of
  411    * target value, including strings.  The target value follows the action
  412    * name, surrounded in parens.  For example: "app.action(42)".  The
  413    * target value is parsed using Glib::variant_parse().  If a tuple-typed
  414    * value is desired, it must be specified in the same way, resulting in
  415    * two sets of parens, for example: "app.action((1,2,3))".  A string
  416    * target can be specified this way as well: "app.action('target')".
  417    * For strings, this third format must be used if * target value is
  418    * empty or contains characters other than alphanumerics, '-' and '.'.
  419    * 
  420    * @newin{2,38}
  421    * 
  422    * @param detailed_name A detailed action name.
  423    * @param action_name The action name.
  424    * @param target_value The target value, or <tt>nullptr</tt> for no target.
  425    * 
  426    * @throws Glib::VariantParseError
  427    */
  428   static void parse_detailed_name_variant(const Glib::ustring& detailed_name, Glib::ustring& action_name, Glib::VariantBase& target_value);
  429 
  430   /** Formats a detailed action name from the action's action_name and @a target_value.
  431    *
  432    * This function is the opposite of parse_detailed_action_name().
  433    * It will produce a string that can be parsed back to the @a action_name
  434    * and @a target_value by that function.
  435    *
  436    * See that function for the types of strings that will be printed by
  437    * this function.
  438    *
  439    * @param target_value A Variant target value.
  440    * @result A detailed format string.
  441    */
  442   template <typename T_Value>
  443   Glib::ustring print_detailed_name(const T_Value& target_value);
  444 
  445   
  446   /** Formats a detailed action name from @a action_name and @a target_value.
  447    * 
  448    * It is an error to call this function with an invalid action name.
  449    * 
  450    * This function is the opposite of g_action_parse_detailed_name().
  451    * It will produce a string that can be parsed back to the @a action_name
  452    * and @a target_value by that function.
  453    * 
  454    * See that function for the types of strings that will be printed by
  455    * this function.
  456    * 
  457    * @newin{2,38}
  458    * 
  459    * @param action_name A valid action name.
  460    * @param target_value A Variant target value, or <tt>nullptr</tt>.
  461    * @return A detailed format string.
  462    */
  463   static Glib::ustring print_detailed_name_variant(const Glib::ustring& action_name, const Glib::VariantBase& target_value);
  464 
  465   /** If @a action is currently enabled.
  466    * 
  467    * If the action is disabled then calls to g_action_activate() and
  468    * g_action_change_state() have no effect.
  469    * 
  470    * @newin{2,28}
  471    *
  472    * Default value: <tt>true</tt>
  473    *
  474    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
  475    * or receive notification when the value of the property changes.
  476    */
  477   Glib::PropertyProxy_ReadOnly< bool > property_enabled() const;
  478 
  479 
  480   /** The name of the action.  This is mostly meaningful for identifying
  481    * the action once it has been added to a ActionGroup. It is immutable.
  482    * 
  483    * @newin{2,28}
  484    *
  485    * Default value: ""
  486    *
  487    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
  488    * or receive notification when the value of the property changes.
  489    */
  490   Glib::PropertyProxy_ReadOnly< Glib::ustring > property_name() const;
  491 
  492 
  493   /** The type of the parameter that must be given when activating the
  494    * action. This is immutable, and may be <tt>nullptr</tt> if no parameter is needed when
  495    * activating the action.
  496    * 
  497    * @newin{2,28}
  498    *
  499    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
  500    * or receive notification when the value of the property changes.
  501    */
  502   Glib::PropertyProxy_ReadOnly< Glib::VariantType > property_parameter_type() const;
  503 
  504 
  505   /** The state of the action, or <tt>nullptr</tt> if the action is stateless.
  506    * 
  507    * @newin{2,28}
  508    *
  509    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
  510    * or receive notification when the value of the property changes.
  511    */
  512   Glib::PropertyProxy_ReadOnly< Glib::VariantBase > property_state() const;
  513 
  514 
  515   /** The VariantType of the state that the action has, or <tt>nullptr</tt> if the
  516    * action is stateless. This is immutable.
  517    * 
  518    * @newin{2,28}
  519    *
  520    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
  521    * or receive notification when the value of the property changes.
  522    */
  523   Glib::PropertyProxy_ReadOnly< Glib::VariantType > property_state_type() const;
  524 
  525 
  526 protected:
  527  
  528 
  529     virtual Glib::ustring get_name_vfunc() const;
  530 
  531 
  532     virtual Glib::VariantType get_parameter_type_vfunc() const;
  533 
  534     virtual Glib::VariantType get_state_type_vfunc() const;
  535 
  536 
  537     virtual Glib::VariantBase get_state_hint_vfunc() const;
  538 
  539 
  540     virtual bool get_enabled_vfunc() const;
  541 
  542 
  543     virtual Glib::VariantBase get_state_vfunc() const;
  544 
  545 
  546     virtual void change_state_vfunc(const Glib::VariantBase& value);
  547 
  548     virtual void activate_vfunc(const Glib::VariantBase& parameter);
  549 
  550 
  551 public:
  552 
  553 public:
  554   //C++ methods used to invoke GTK+ virtual functions:
  555 
  556 protected:
  557   //GTK+ Virtual Functions (override these to change behaviour):
  558 
  559   //Default Signal Handlers::
  560 
  561 
  562 };
  563 
  564 template <typename T_Value>
  565 void Action::get_state(T_Value& value) const
  566 {
  567   value = T_Value(); //Make sure that it is initialized.
  568 
  569   using type_glib_variant = Glib::Variant<T_Value>;
  570 
  571   g_return_if_fail(
  572     g_variant_type_equal(g_action_get_state_type(const_cast<GAction*>(gobj())), type_glib_variant::variant_type().gobj()));
  573 
  574   const auto variantBase = get_state_variant();
  575   const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
  576   value = variantDerived.get();
  577 }
  578 
  579 template <typename T_Value>
  580 void Action::get_state_hint(T_Value& value) const
  581 {
  582   value = T_Value(); //Make sure that it is initialized.
  583 
  584   using type_glib_variant = Glib::Variant<T_Value>;
  585 
  586   const auto variantBase = get_state_hint_variant();
  587 
  588   // We can't check the type (a range) that will be returned before getting the range hint.
  589   g_return_if_fail(
  590     variantBase.is_of_type(type_glib_variant::variant_type()) );
  591 
  592   const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
  593   value = variantDerived.get();
  594 }
  595 
  596 #ifndef DOXYGEN_SHOULD_SKIP_THIS
  597 // Doxygen 1.8.4 does not understand that this is the static function previously declared.
  598 template <typename T_Value>
  599 //static
  600 void Action::parse_detailed_name(const Glib::ustring& detailed_name, Glib::ustring& action_name, T_Value& target_value)
  601 {
  602   action_name.clear(); //Make sure the output arguments are initialized.
  603   target_value = T_Value();
  604 
  605   using type_glib_variant = Glib::Variant<T_Value>;
  606 
  607   Glib::VariantBase target_value_variantBase;
  608   parse_detailed_name_variant(detailed_name, action_name, target_value_variantBase);
  609 
  610   if (!target_value_variantBase)
  611     throw Glib::VariantParseError(Glib::VariantParseError::TYPE_ERROR,
  612       "Detailed action name '" + detailed_name + "' has no target. Expected a target of type " +
  613       type_glib_variant::variant_type().get_string());
  614 
  615   if (!target_value_variantBase.is_of_type(type_glib_variant::variant_type()))
  616     throw Glib::VariantParseError(Glib::VariantParseError::TYPE_ERROR,
  617       "Detailed action name '" + detailed_name + "' has a target of type " +
  618       target_value_variantBase.get_type_string() + ". Expected " + type_glib_variant::variant_type().get_string());
  619 
  620   const type_glib_variant target_value_variantDerived =
  621     target_value_variantBase.cast_dynamic<type_glib_variant>(target_value_variantBase);
  622   target_value = target_value_variantDerived.get();
  623 }
  624 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  625 
  626 template <typename T_Value>
  627 Glib::ustring Action::print_detailed_name(const T_Value& target_value)
  628 {
  629   using type_glib_variant = Glib::Variant<T_Value>;
  630 
  631   g_return_val_if_fail(
  632     g_variant_type_equal(g_action_get_parameter_type(const_cast<GAction*>(gobj())), type_glib_variant::variant_type().gobj()),
  633     Glib::ustring());
  634   return print_detailed_name_variant(get_name(), type_glib_variant::create(target_value));
  635 }
  636 
  637 template <typename T_Value>
  638 void Action::change_state(const T_Value& value)
  639 {
  640   using type_glib_variant = Glib::Variant<T_Value>;
  641 
  642   g_return_if_fail(
  643     g_variant_type_equal(g_action_get_state_type(const_cast<GAction*>(gobj())), type_glib_variant::variant_type().gobj()));
  644 
  645   change_state_variant(type_glib_variant::create(value));
  646 }
  647 
  648 template <typename T_Value>
  649 void Action::change_state(const Glib::Variant<T_Value>& value)
  650 {
  651   change_state_variant(value);
  652 }
  653 
  654 template <typename T_Value>
  655 void Action::activate(const T_Value& parameter)
  656 {
  657   using type_glib_variant = Glib::Variant<T_Value>;
  658 
  659   g_return_if_fail(
  660     g_variant_type_equal(g_action_get_parameter_type(const_cast<GAction*>(gobj())), type_glib_variant::variant_type().gobj()));
  661 
  662   activate_variant(type_glib_variant::create(parameter));
  663 }
  664 
  665 
  666 template <typename T_Value>
  667 void Action::activate(const Glib::Variant<T_Value>& value)
  668 {
  669   activate_variant(value);
  670 }
  671 
  672 
  673 } // namespace Gio
  674 
  675 
  676 namespace Glib
  677 {
  678   /** A Glib::wrap() method for this object.
  679    *
  680    * @param object The C instance.
  681    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
  682    * @result A C++ instance that wraps this C instance.
  683    *
  684    * @relates Gio::Action
  685    */
  686   GIOMM_API
  687   Glib::RefPtr<Gio::Action> wrap(GAction* object, bool take_copy = false);
  688 
  689 } // namespace Glib
  690 
  691 
  692 #endif /* _GIOMM_ACTION_H */
  693