introduce GRemoteActionGroup

This interfaceifies the extra functions that were on GDBusActionGroup
for dealing with platform data.

The two main benefits of doing this:

  - no longer have to do a silly song and dance in GApplication to avoid
    calling GDBusActionGroup API from non-dbus-aware code

  - the interface can be reused by the action group exporter to avoid
    ugly and unbindable hook callbacks

https://bugzilla.gnome.org/show_bug.cgi?id=665737
This commit is contained in:
Ryan Lortie
2011-12-17 00:17:08 -05:00
parent ee9f104432
commit eefd08996f
13 changed files with 304 additions and 149 deletions

View File

@@ -23,6 +23,7 @@
#include "gactiongroup.h"
#include "gactiongroupexporter.h"
#include "gremoteactiongroup.h"
#include "gdbusactiongroup.h"
#include "gapplication.h"
#include "gfile.h"
@@ -86,7 +87,6 @@ static GDBusInterfaceInfo *org_gtk_private_CommandLine;
struct _GApplicationImpl
{
GDBusConnection *session_bus;
GDBusActionGroup *remote_actions;
const gchar *bus_name;
gchar *object_path;
@@ -474,12 +474,12 @@ g_application_impl_destroy (GApplicationImpl *impl)
}
GApplicationImpl *
g_application_impl_register (GApplication *application,
const gchar *appid,
GApplicationFlags flags,
GActionGroup **remote_actions,
GCancellable *cancellable,
GError **error)
g_application_impl_register (GApplication *application,
const gchar *appid,
GApplicationFlags flags,
GRemoteActionGroup **remote_actions,
GCancellable *cancellable,
GError **error)
{
GDBusActionGroup *actions;
GApplicationImpl *impl;
@@ -543,8 +543,7 @@ g_application_impl_register (GApplication *application,
return NULL;
}
*remote_actions = G_ACTION_GROUP (actions);
impl->remote_actions = actions;
*remote_actions = G_REMOTE_ACTION_GROUP (actions);
return impl;
}
@@ -593,24 +592,6 @@ g_application_impl_open (GApplicationImpl *impl,
NULL, 0, -1, NULL, NULL, NULL);
}
void
g_application_impl_activate_action (GApplicationImpl *impl,
const gchar *action_name,
GVariant *parameter,
GVariant *platform_data)
{
g_dbus_action_group_activate_action_full (impl->remote_actions, action_name, parameter, platform_data);
}
void
g_application_impl_change_action_state (GApplicationImpl *impl,
const gchar *action_name,
GVariant *value,
GVariant *platform_data)
{
g_dbus_action_group_change_action_state_full (impl->remote_actions, action_name, value, platform_data);
}
static void
g_application_impl_cmdline_method_call (GDBusConnection *connection,
const gchar *sender,