Blob Blame History Raw
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2012 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, see <http://www.gnu.org/licenses/>.
 */

#include <glibmm/interface.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(gio/gio.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GRemoteActionGroupInterface GRemoteActionGroupInterface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gio
{


//TODO: Instead derive from ActionGroup, when we can break ABI,
//because the GRemoteActionGroup interface requires the GActionGroup interface.
//LoadableIcon does a similar thing correctly, for instance.


/** RemoteActionGroup - a ActionGroup that interacts with other processes.
 * The RemoteActionGroup interface is implemented by ActionGroup instances that
 * either transmit action invocations to other processes or receive action
 * invocations in the local process from other processes.
 *
 * The interface has variants of the two methods on ActionGroup used to
 * activate actions: Gio::ActionGroup::activate_action() and
 * Gio::ActionGroup::change_action_state(). These variants allow a "platform
 * data" Glib::VariantBase to be specified: a dictionary providing context for
 * the action invocation (for example: timestamps, startup notification IDs,
 * etc).
 *
 * Gio::DBus::ActionGroup implements RemoteActionGroup. This provides a
 * mechanism to send platform data for action invocations over D-Bus.
 *
 * Additionally, Gio::DBus::Connection::export_action_group() will check if the
 * exported ActionGroup implements RemoteActionGroup and use the variants of
 * the calls if available. This provides a mechanism by which to receive
 * platform data for action invocations that arrive by way of D-Bus.
 * @newin{2,32}
 */
class RemoteActionGroup : public Glib::Interface
{
  _CLASS_INTERFACE(RemoteActionGroup, GRemoteActionGroup, G_REMOTE_ACTION_GROUP, GRemoteActionGroupInterface)

public:
  _WRAP_METHOD(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter, const Glib::VariantBase& platform_data), g_remote_action_group_activate_action_full)
  _WRAP_METHOD(void change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value, const Glib::VariantBase& platform_data), g_remote_action_group_change_action_state_full)

#m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3, true)')

  _WRAP_VFUNC(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter, const Glib::VariantBase& platform_data), "activate_action_full")
  _WRAP_VFUNC(void change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value, const Glib::VariantBase& platform_data), "change_action_state_full")
};

} // namespace Gio