diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2011-09-21 18:08:26 -0400 |
---|---|---|
committer | José Alburquerque <jaalburqu@svn.gnome.org> | 2011-09-21 18:27:28 -0400 |
commit | 27d6d6ec92f4c527d878c56b541ba11e8bc0f8a6 (patch) | |
tree | 79b72426d4d72548b2df90dd6a6cb43f635ab331 /gio | |
parent | dd1b28b0bcb2f40646e6fea636e26149c92e422c (diff) | |
download | glibmm-27d6d6ec92f4c527d878c56b541ba11e8bc0f8a6.tar.gz |
giomm: Add SimpleAction, an implementation of the Action interface.
* gio/src/simpleaction.{ccg,hg}:
* gio/src/filelist.am: Add the sources and include them in the list of
files that should be processed.
* tools/extra_defs_gen/generate_defs_gio.cc: Add G_SIMPLE_ACTION_TYPE
to the list of types for which properties and signals should be
generated.
* gio/src/gio_signals.defs: Regenerate with above to get the
properties and signals of new class.
Diffstat (limited to 'gio')
-rw-r--r-- | gio/src/filelist.am | 1 | ||||
-rw-r--r-- | gio/src/gio_signals.defs | 69 | ||||
-rw-r--r-- | gio/src/simpleaction.ccg | 23 | ||||
-rw-r--r-- | gio/src/simpleaction.hg | 73 |
4 files changed, 164 insertions, 2 deletions
diff --git a/gio/src/filelist.am b/gio/src/filelist.am index 371a0f3a..803f442c 100644 --- a/gio/src/filelist.am +++ b/gio/src/filelist.am @@ -79,6 +79,7 @@ giomm_files_any_hg = \ resolver.hg \ seekable.hg \ settings.hg \ + simpleaction.hg \ socket.hg \ socketaddress.hg \ socketaddressenumerator.hg \ diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index 2f3c2f04..595b5e31 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -89,13 +89,13 @@ ;; From GApplication -(define-signal startup +(define-signal activate (of-object "GApplication") (return-type "void") (when "last") ) -(define-signal activate +(define-signal startup (of-object "GApplication") (return-type "void") (when "last") @@ -818,6 +818,71 @@ ;; From GSimpleAsyncResult +;; From GSimpleAction + +(define-signal activate + (of-object "GSimpleAction") + (return-type "void") + (when "last") + (parameters + '("GVariant*" "p0") + ) +) + +(define-signal change-state + (of-object "GSimpleAction") + (return-type "void") + (when "last") + (parameters + '("GVariant*" "p0") + ) +) + +(define-property name + (of-object "GSimpleAction") + (prop-type "GParamString") + (docs "The name used to invoke the action") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property parameter-type + (of-object "GSimpleAction") + (prop-type "GParamBoxed") + (docs "The type of GVariant passed to activate()") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property enabled + (of-object "GSimpleAction") + (prop-type "GParamBoolean") + (docs "If the action can be activated") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property state-type + (of-object "GSimpleAction") + (prop-type "GParamBoxed") + (docs "The type of the state kept by the action") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property state + (of-object "GSimpleAction") + (prop-type "GParamVariant") + (docs "The state the action is in") + (readable #t) + (writable #f) + (construct-only #f) +) + ;; From GThemedIcon (define-property name diff --git a/gio/src/simpleaction.ccg b/gio/src/simpleaction.ccg new file mode 100644 index 00000000..eaf0b625 --- /dev/null +++ b/gio/src/simpleaction.ccg @@ -0,0 +1,23 @@ +/* Copyright (C) 2011 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gio/gio.h> + +namespace Gio +{ + +}// namespace Gio diff --git a/gio/src/simpleaction.hg b/gio/src/simpleaction.hg new file mode 100644 index 00000000..a67c5244 --- /dev/null +++ b/gio/src/simpleaction.hg @@ -0,0 +1,73 @@ +/* Copyright (C) 2011 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <glibmm/object.h> +#include <giomm/action.h> + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/object_p.h) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GSimpleAction GSimpleAction; +typedef GObjectClass GSimpleActionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Gio +{ + +/** A SimpleAction is the obvious simple implementation of the Action + * interface. This is the easiest way to create an action for purposes of + * adding it to a SimpleActionGroup. + * + * See also Gtk::Action. + * + * @newin{2,30} + */ +class SimpleAction : public Glib::Object, public Action +{ + _CLASS_GOBJECT(SimpleAction, GSimpleAction, G_SIMPLE_ACTION, Glib::Object, GObject) + _IMPLEMENTS_INTERFACE(Action) + _STRUCT_NOT_HIDDEN + +protected: +#m4 _CONVERSION(`const Glib::VariantType&',`const GVariantType*',`$3.gobj()') + + _WRAP_CTOR(SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type), g_simple_action_new) + _WRAP_CTOR(SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type, const Glib::VariantBase& sate), g_simple_action_new_stateful) + +public: + _WRAP_METHOD(void set_enabled(bool enabled), g_simple_action_set_enabled) + _WRAP_METHOD(void set_state(const Glib::VariantBase& value), g_simple_action_set_state) + + /* These properties are already wrapped in the Action interface. + _WRAP_PROPERTY("enabled", bool) + _WRAP_PROPERTY("name", Glib::ustring) + _WRAP_PROPERTY("parameter-type", Glib::VariantType) + _WRAP_PROPERTY("state", Glib::VariantBase) + _WRAP_PROPERTY("state-type", Glib::VariantType) + */ + +/* TODO: Signals are not wrapped because GSimpleAction does not declare a + * standard _GSimpleActionClass structure. +#m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3, true)') + + _WRAP_SIGNAL(void activate(const Glib::VariantBase& parameter), "activate") + _WRAP_SIGNAL(void change_state(const Glib::VariantBase& value), "change-state") +*/ +}; + +} // namespace Gio |