Exemplo n.º 1
0
static void
handle_method_call (GDBusConnection *connection,
		    const char *sender,
		    const char *object_path,
		    const char *interface_name,
		    const char *method_name,
		    GVariant *parameters,
		    GDBusMethodInvocation *invocation,
		    ServiceData *svc)
{
	rb_debug ("handling metadata service message: %s.%s", interface_name, method_name);
	if (g_strcmp0 (method_name, "ping") == 0) {
		rb_metadata_dbus_ping (parameters, invocation, svc);
	} else if (g_strcmp0 (method_name, "load") == 0) {
		rb_metadata_dbus_load (parameters, invocation, svc);
	} else if (g_strcmp0 (method_name, "getSaveableTypes") == 0) {
		rb_metadata_dbus_get_saveable_types (parameters, invocation, svc);
	} else if (g_strcmp0 (method_name, "save") == 0) {
		rb_metadata_dbus_save (parameters, invocation, svc);
	}
	svc->last_active = time (NULL);
}
static DBusHandlerResult
_handle_message (DBusConnection *connection, DBusMessage *message, void *data)
{
	ServiceData *svc = (ServiceData *)data;
	DBusHandlerResult result;
	rb_debug ("handling metadata service message: %s", dbus_message_get_member (message));

	if (dbus_message_is_method_call (message, RB_METADATA_DBUS_INTERFACE, "load")) {
		result = rb_metadata_dbus_load (connection, message, svc);
	} else if (dbus_message_is_method_call (message, RB_METADATA_DBUS_INTERFACE, "getSaveableTypes")) {
		result = rb_metadata_dbus_get_saveable_types (connection, message, svc);
	} else if (dbus_message_is_method_call (message, RB_METADATA_DBUS_INTERFACE, "save")) {
		result = rb_metadata_dbus_save (connection, message, svc);
	} else if (dbus_message_is_method_call (message, RB_METADATA_DBUS_INTERFACE, "ping")) {
		result = rb_metadata_dbus_ping (connection, message, svc);
	} else {
		result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
	}

	svc->last_active = time (NULL);
	return result;
}