* 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., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Authors: Ryan Lortie <desrt@desrt.ca>
*/
#include "config.h"
-#include "gdbusactiongroup.h"
+#include "gdbusactiongroup-private.h"
+#include "gremoteactiongroup.h"
#include "gdbusconnection.h"
#include "gactiongroup.h"
* SECTION:gdbusactiongroup
* @title: GDBusActionGroup
* @short_description: A D-Bus GActionGroup implementation
- * @see_also: <link linkend="gio-GActionGroup-exporter">GActionGroup exporter</link>
+ * @include: gio/gio.h
+ * @see_also: [GActionGroup exporter][gio-GActionGroup-exporter]
*
* #GDBusActionGroup is an implementation of the #GActionGroup
* interface that can be used as a proxy for an action group
g_slice_free (ActionInfo, info);
}
-ActionInfo *
+static ActionInfo *
action_info_new_from_iter (GVariantIter *iter)
{
const gchar *param_str;
return info;
}
-static void g_dbus_action_group_iface_init (GActionGroupInterface *);
+static void g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface);
+static void g_dbus_action_group_iface_init (GActionGroupInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GDBusActionGroup, g_dbus_action_group, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_dbus_action_group_iface_init))
+ G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_dbus_action_group_iface_init)
+ G_IMPLEMENT_INTERFACE (G_TYPE_REMOTE_ACTION_GROUP, g_dbus_action_group_remote_iface_init))
static void
g_dbus_action_group_changed (GDBusConnection *connection,
g_variant_iter_free (iter);
g_variant_unref (reply);
}
+
+ g_object_unref (group);
}
g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "DescribeAll", NULL,
G_VARIANT_TYPE ("(a{s(bgav)})"), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
- g_dbus_action_group_describe_all_done, group);
+ g_dbus_action_group_describe_all_done, g_object_ref (group));
}
static gchar **
else
{
g_dbus_action_group_async_init (group);
+ group->strict = TRUE;
return FALSE;
}
}
static void
-g_dbus_action_group_change_state (GActionGroup *g_group,
- const gchar *action_name,
- GVariant *value)
+g_dbus_action_group_activate_action_full (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *parameter,
+ GVariant *platform_data)
{
- GDBusActionGroup *group = G_DBUS_ACTION_GROUP (g_group);
-
- /* Don't bother with the checks. The other side will do it again. */
- g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "SetState",
- g_variant_new ("(sva{sv})", action_name, value, NULL),
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
-}
-
-static void
-g_dbus_action_group_activate (GActionGroup *g_group,
- const gchar *action_name,
- GVariant *parameter)
-{
- GDBusActionGroup *group = G_DBUS_ACTION_GROUP (g_group);
+ GDBusActionGroup *group = G_DBUS_ACTION_GROUP (remote);
GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));
g_variant_builder_add (&builder, "v", parameter);
g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "Activate",
- g_variant_new ("(sava{sv})", action_name, &builder, NULL),
+ g_variant_new ("(sav@a{sv})", action_name, &builder, platform_data),
NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
}
static void
+g_dbus_action_group_change_action_state_full (GRemoteActionGroup *remote,
+ const gchar *action_name,
+ GVariant *value,
+ GVariant *platform_data)
+{
+ GDBusActionGroup *group = G_DBUS_ACTION_GROUP (remote);
+
+ g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "SetState",
+ g_variant_new ("(sv@a{sv})", action_name, value, platform_data),
+ NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+}
+
+static void
+g_dbus_action_group_change_state (GActionGroup *group,
+ const gchar *action_name,
+ GVariant *value)
+{
+ g_dbus_action_group_change_action_state_full (G_REMOTE_ACTION_GROUP (group),
+ action_name, value, g_variant_new ("a{sv}", NULL));
+}
+
+static void
+g_dbus_action_group_activate (GActionGroup *group,
+ const gchar *action_name,
+ GVariant *parameter)
+{
+ g_dbus_action_group_activate_action_full (G_REMOTE_ACTION_GROUP (group),
+ action_name, parameter, g_variant_new ("a{sv}", NULL));
+}
+
+static void
g_dbus_action_group_finalize (GObject *object)
{
GDBusActionGroup *group = G_DBUS_ACTION_GROUP (object);
}
static void
+g_dbus_action_group_remote_iface_init (GRemoteActionGroupInterface *iface)
+{
+ iface->activate_action_full = g_dbus_action_group_activate_action_full;
+ iface->change_action_state_full = g_dbus_action_group_change_action_state_full;
+}
+
+static void
g_dbus_action_group_iface_init (GActionGroupInterface *iface)
{
iface->list_actions = g_dbus_action_group_list_actions;
* @bus_name: the bus name which exports the action group
* @object_path: the object path at which the action group is exported
*
- * Obtains a #GDBusAcitonGroup for the action group which is exported at
+ * Obtains a #GDBusActionGroup for the action group which is exported at
* the given @bus_name and @object_path.
*
* The thread default main context is taken at the time of this call.
return group;
}
-G_GNUC_INTERNAL gboolean
+gboolean
g_dbus_action_group_sync (GDBusActionGroup *group,
GCancellable *cancellable,
GError **error)