gboolean ibus_message_get_args (IBusMessage *message, IBusError **error, GType first_arg_type, ...) { gboolean retval; va_list va_args; va_start (va_args, first_arg_type); retval = ibus_message_get_args_valist (message, error, first_arg_type, va_args); va_end (va_args); return retval; }
static gboolean ibus_bus_call (IBusBus *bus, const gchar *name, const gchar *path, const gchar *interface, const gchar *member, GType first_arg_type, ...) { g_assert (IBUS_IS_BUS (bus)); g_assert (name != NULL); g_assert (path != NULL); g_assert (interface != NULL); g_assert (member); IBusMessage *message, *reply; IBusError *error; va_list args; GType type; gboolean retval; IBusBusPrivate *priv; g_return_val_if_fail (ibus_bus_is_connected (bus), FALSE); priv = IBUS_BUS_GET_PRIVATE (bus); message = ibus_message_new_method_call (name, path, interface, member); va_start (args, first_arg_type); ibus_message_append_args_valist (message, first_arg_type, args); va_end (args); reply = ibus_connection_send_with_reply_and_block ( priv->connection, message, -1, &error); ibus_message_unref (message); if (reply == NULL) { g_warning ("%s : %s", error->name, error->message); ibus_error_free (error); return FALSE; } if ((error = ibus_error_new_from_message (reply)) != NULL) { g_warning ("%s : %s", error->name, error->message); ibus_error_free (error); ibus_message_unref (reply); return FALSE; } va_start (args, first_arg_type); type = first_arg_type; while (type != G_TYPE_INVALID) { va_arg (args, gpointer); type = va_arg (args, GType); } type = va_arg (args, GType); if (type != G_TYPE_INVALID) { retval = ibus_message_get_args_valist (reply, &error, type, args); } else { retval = TRUE; } va_end (args); ibus_message_unref (reply); if (!retval) { g_warning ("%s: %s", error->name, error->message); ibus_error_free (error); return FALSE; } return TRUE; }
gboolean ibus_connection_call (IBusConnection *connection, const gchar *name, const gchar *path, const gchar *interface, const gchar *member, IBusError **error, GType first_arg_type, ...) { g_assert (IBUS_IS_CONNECTION (connection)); g_assert (name != NULL); g_assert (path != NULL); g_assert (interface != NULL); g_assert (member != NULL); IBusConnectionPrivate *priv; priv = IBUS_CONNECTION_GET_PRIVATE (connection); g_assert (dbus_connection_get_is_connected (priv->connection)); IBusMessage *message, *reply; IBusError *tmp_error; va_list args; GType type; gboolean retval; message = ibus_message_new_method_call (name, path, interface, member); va_start (args, first_arg_type); ibus_message_append_args_valist (message, first_arg_type, args); va_end (args); reply = ibus_connection_send_with_reply_and_block ( connection, message, -1, error); ibus_message_unref (message); if (reply == NULL) { return FALSE; } if ((tmp_error = ibus_error_new_from_message (reply)) != NULL) { if (error) { *error = tmp_error; } else { ibus_error_free (tmp_error); } ibus_message_unref (reply); return FALSE; } va_start (args, first_arg_type); type = first_arg_type; while (type != G_TYPE_INVALID) { va_arg (args, gpointer); type = va_arg (args, GType); } type = va_arg (args, GType); if (type != G_TYPE_INVALID) { retval = ibus_message_get_args_valist (reply, error, type, args); } else { retval = TRUE; } va_end (args); ibus_message_unref (reply); return retval; }