本文整理汇总了C++中dbus_g_method_return函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_g_method_return函数的具体用法?C++ dbus_g_method_return怎么用?C++ dbus_g_method_return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_g_method_return函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pin_callback
static void pin_callback(GtkWidget *dialog,
gint response, gpointer user_data)
{
input_data *input = user_data;
if (response == GTK_RESPONSE_OK) {
const char *text;
text = gtk_entry_get_text(GTK_ENTRY(input->entry));
if (input->numeric == TRUE) {
guint pin = atoi(text);
dbus_g_method_return(input->context, pin);
} else {
dbus_g_method_return(input->context, text);
}
} else {
GError *error;
error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT,
"Pairing request rejected");
dbus_g_method_return_error(input->context, error);
}
input_free(input);
}
开发者ID:CopyKat,项目名称:mate-bluetooth,代码行数:25,代码来源:agent.c
示例2: _odccm_connection_broker_take_connection
void
_odccm_connection_broker_take_connection (OdccmConnectionBroker *self,
GConn *conn)
{
OdccmConnectionBrokerPrivate *priv = ODCCM_CONNECTION_BROKER_GET_PRIVATE (self);
GRand *rnd;
GIOChannel *chan;
guint uid;
g_assert (priv->conn == NULL);
priv->conn = conn;
rnd = g_rand_new ();
priv->filename = g_strdup_printf ("/tmp/odccm-%08x%08x%08x%08x.sock",
g_rand_int (rnd), g_rand_int (rnd), g_rand_int (rnd), g_rand_int (rnd));
g_rand_free (rnd);
priv->server = gnet_unix_socket_server_new (priv->filename);
_odccm_get_dbus_sender_uid (dbus_g_method_get_sender (priv->ctx), &uid);
chmod (priv->filename, S_IRUSR | S_IWUSR);
chown (priv->filename, uid, -1);
chan = gnet_unix_socket_get_io_channel (priv->server);
g_io_add_watch (chan, G_IO_IN, server_socket_readable_cb, self);
dbus_g_method_return (priv->ctx, priv->filename);
priv->ctx = NULL;
}
开发者ID:guadalinex-archive,项目名称:guadalinex-v4,代码行数:31,代码来源:odccm-connection-broker.c
示例3: up_device_get_statistics
/**
* up_device_get_statistics:
**/
gboolean
up_device_get_statistics (UpDevice *device, const gchar *type, DBusGMethodInvocation *context)
{
GError *error;
GPtrArray *array = NULL;
GPtrArray *complex;
UpStatsItem *item;
GValue *value;
guint i;
g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
g_return_val_if_fail (type != NULL, FALSE);
/* doesn't even try to support this */
if (!device->priv->has_statistics) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device does not support getting stats");
dbus_g_method_return_error (context, error);
goto out;
}
/* get the correct data */
if (g_strcmp0 (type, "charging") == 0)
array = up_history_get_profile_data (device->priv->history, TRUE);
else if (g_strcmp0 (type, "discharging") == 0)
array = up_history_get_profile_data (device->priv->history, FALSE);
/* maybe the device doesn't support histories */
if (array == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device has no statistics");
dbus_g_method_return_error (context, error);
goto out;
}
/* always 101 items of data */
if (array->len != 101) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "statistics invalid as have %i items", array->len);
dbus_g_method_return_error (context, error);
goto out;
}
/* copy data to dbus struct */
complex = g_ptr_array_sized_new (array->len);
for (i=0; i<array->len; i++) {
item = (UpStatsItem *) g_ptr_array_index (array, i);
value = g_new0 (GValue, 1);
g_value_init (value, UP_DBUS_STRUCT_DOUBLE_DOUBLE);
g_value_take_boxed (value, dbus_g_type_specialized_construct (UP_DBUS_STRUCT_DOUBLE_DOUBLE));
dbus_g_type_struct_set (value,
0, up_stats_item_get_value (item),
1, up_stats_item_get_accuracy (item), -1);
g_ptr_array_add (complex, g_value_get_boxed (value));
g_free (value);
}
dbus_g_method_return (context, complex);
out:
if (array != NULL)
g_ptr_array_unref (array);
return TRUE;
}
开发者ID:Kalvados,项目名称:upower,代码行数:63,代码来源:up-device.c
示例4: set_location_sent_cb
static LmHandlerResult
set_location_sent_cb (GabbleConnection *conn,
LmMessage *sent_msg,
LmMessage *reply_msg,
GObject *object,
gpointer user_data)
{
DBusGMethodInvocation *context = user_data;
GError *error = NULL;
error = gabble_message_get_xmpp_error (reply_msg);
if (error == NULL)
{
dbus_g_method_return (context);
}
else
{
GError tp_error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
error->message };
DEBUG ("SetLocation failed: %s", error->message);
dbus_g_method_return_error (context, &tp_error);
g_error_free (error);
}
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
开发者ID:jku,项目名称:telepathy-gabble,代码行数:28,代码来源:conn-location.c
示例5: Services_list
gboolean
Services_list(Matahari *matahari, DBusGMethodInvocation *context)
{
GError* error = NULL;
int i = 0;
GList *services;
char **list;
if (!check_authorization(SERVICES_BUS_NAME ".list", &error, context)) {
dbus_g_method_return_error(context, error);
return FALSE;
}
// Get list of services
services = services_list();
// Convert GList to (char **)
list = g_new(char *, g_list_length(services) + 1);
for (; services != NULL; services = services->next)
list[i++] = strdup(services->data);
list[i] = NULL; // Sentinel
dbus_g_method_return(context, list);
g_strfreev(list);
g_list_free(services);
return TRUE;
}
开发者ID:antoinevg,项目名称:matahari,代码行数:27,代码来源:service-dbus.c
示例6: Resources_list
gboolean
Resources_list(Matahari *matahari, const char *standard, const char *provider,
DBusGMethodInvocation *context)
{
GError* error = NULL;
int i = 0;
gchar **list;
GList *agents = NULL;
if (!check_authorization(RESOURCES_INTERFACE_NAME ".list",
&error, context)) {
dbus_g_method_return_error(context, error);
g_error_free(error);
return FALSE;
}
if (strlen(standard) == 0)
standard = "ocf";
if (strlen(provider) == 0)
provider = "heartbeat";
// Get list of agents
agents = resources_list_agents(standard, provider);
// Convert GList to (char **)
list = g_new(char *, g_list_length(agents) + 1);
for (; agents != NULL; agents = agents->next)
list[i++] = strdup(agents->data);
list[i] = NULL; // Sentinel
dbus_g_method_return(context, list);
g_strfreev(list);
g_list_free_full(agents, free);
return TRUE;
}
开发者ID:russellb,项目名称:matahari,代码行数:35,代码来源:service-dbus.c
示例7: invoke_cb
void invoke_cb(svc_action_t *op)
{
struct invoke_cb_data *cb_data = op->cb_data;
dbus_g_method_return(cb_data->context, op->rc, op->sequence, cb_data->userdata);
free(cb_data->userdata);
free(cb_data);
}
开发者ID:russellb,项目名称:matahari,代码行数:7,代码来源:service-dbus.c
示例8: __bt_progress_callback
static gboolean __bt_progress_callback(DBusGMethodInvocation *context,
DBusGProxy *transfer,
guint64 transferred,
gpointer user_data)
{
int percentage_progress;
gint64 size;
int result = BLUETOOTH_ERROR_NONE;
dbus_g_method_return(context);
retv_if(sending_info == NULL, TRUE);
retv_if(sending_info->transfer_info == NULL, TRUE);
size = sending_info->transfer_info->size;
if (size != 0)
percentage_progress = (int)(((gdouble)transferred /
(gdouble)size) * 100);
else
percentage_progress = 0;
/* Send the event in only error none case */
_bt_send_event(BT_OPP_CLIENT_EVENT,
BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,
DBUS_TYPE_INT32, &result,
DBUS_TYPE_STRING, &sending_info->transfer_info->file_name,
DBUS_TYPE_UINT64, &sending_info->transfer_info->size,
DBUS_TYPE_INT32, &percentage_progress,
DBUS_TYPE_INT32, &sending_info->request_id,
DBUS_TYPE_INVALID);
return TRUE;
}
开发者ID:Tizen-Sunfish,项目名称:bluetooth-frwk,代码行数:34,代码来源:bt-service-opp-client.c
示例9: Resources_list_providers
gboolean
Resources_list_providers(Matahari *matahari, const char *standard,
DBusGMethodInvocation *context)
{
GError* error = NULL;
gchar **list;
int i = 0;
GList *providers;
if (!check_authorization(RESOURCES_INTERFACE_NAME ".list_providers",
&error, context)) {
dbus_g_method_return_error(context, error);
g_error_free(error);
return FALSE;
}
// Get list of providers
providers = resources_list_providers(standard);
// Convert GList to (char **)
list = g_new(char *, g_list_length(providers) + 1);
for (; providers != NULL; providers = providers->next)
list[i++] = strdup(providers->data);
list[i] = NULL; // Sentinel
dbus_g_method_return(context, list);
g_strfreev(list);
g_list_free_full(providers, free);
return TRUE;
}
开发者ID:russellb,项目名称:matahari,代码行数:30,代码来源:service-dbus.c
示例10: ring_text_manager_expunge_messages
void
ring_text_manager_expunge_messages(RingTextManager *self,
char const **messages,
gpointer context)
{
/* XXX/KV: use ring_text_manager_is_connected () */
if (self->priv->status == TP_CONNECTION_STATUS_CONNECTED) {
int i;
ModemSMSService *service = self->priv->sms_service;
GPtrArray *expunged = g_ptr_array_new();
for (i = 0; messages[i]; i++) {
if (modem_sms_request_expunge(service, messages[i], NULL, NULL)) {
g_ptr_array_add(expunged, (gpointer)g_strdup(messages[i]));
}
}
g_ptr_array_add(expunged, NULL);
dbus_g_method_return(context);
rtcom_tp_svc_connection_interface_stored_messages_emit_messages_expunged(
self->priv->connection,
(char const **)expunged->pdata);
g_strfreev((char **)g_ptr_array_free(expunged, FALSE));
}
else {
ring_text_manager_not_connected(context);
}
}
开发者ID:rodrmoya,项目名称:telepathy-ring,代码行数:31,代码来源:ring-text-manager.c
示例11: set_location_sent_cb
static void
set_location_sent_cb (GabbleConnection *conn,
WockyStanza *sent_msg,
WockyStanza *reply_msg,
GObject *object,
gpointer user_data)
{
DBusGMethodInvocation *context = user_data;
GError *error = NULL;
if (!wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL))
{
dbus_g_method_return (context);
}
else
{
GError *tp_error = NULL;
DEBUG ("SetLocation failed: %s", error->message);
gabble_set_tp_error_from_wocky (error, &tp_error);
dbus_g_method_return_error (context, tp_error);
g_error_free (tp_error);
g_error_free (error);
}
}
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:26,代码来源:conn-location.c
示例12: __bt_obex_server_reply_authorize
static int __bt_obex_server_reply_authorize(const guint accept,
const char *filepath,
obex_server_info_t *obex_server_info)
{
DBG("+\n");
if (obex_server_info) {
if (accept == BT_OBEX_AGENT_ACCEPT) {
dbus_g_method_return(obex_server_info->reply_context,
filepath);
} else {
GError *error = NULL;
error = __bt_obex_agent_error(BT_OBEX_AGENT_ERROR_CANCEL,
"CanceledbyUser");
dbus_g_method_return_error(obex_server_info->reply_context,
error);
g_error_free(error);
g_free(obex_server_info->filename);
obex_server_info->filename = NULL;
g_free(obex_server_info->transfer_path);
obex_server_info->transfer_path = NULL;
g_free(obex_server_info->device_name);
obex_server_info->device_name = NULL;
}
}
DBG("-\n");
return BLUETOOTH_ERROR_NONE;
}
开发者ID:tizenorg,项目名称:framework.connectivity.bluetooth-frwk,代码行数:30,代码来源:bluetooth-obex-server-api.c
示例13: Host_list_power_profiles
gboolean
Host_list_power_profiles(Matahari* matahari, DBusGMethodInvocation *context)
{
GError *error = NULL;
GList *list, *plist;
char **profiles;
int i = 0;
if (!check_authorization(HOST_BUS_NAME ".list_power_profiles", &error, context)) {
dbus_g_method_return_error(context, error);
g_error_free(error);
return FALSE;
}
// Get the list of profiles
list = mh_host_list_power_profiles();
// Convert GList * with profiles to array (char **)
profiles = g_new(char *, g_list_length(list) + 1);
for (plist = g_list_first(list);
plist;
plist = g_list_next(plist)) {
profiles[i++] = plist->data;
}
profiles[i] = NULL; // Sentinel
dbus_g_method_return(context, profiles);
g_list_free_full(list, free);
g_free(profiles);
return TRUE;
}
开发者ID:battlemidget,项目名称:deprecated-matahari-bm,代码行数:30,代码来源:host-dbus.c
示例14: _set_time
static gboolean
_set_time (GsdDatetimeMechanism *mechanism,
const struct timeval *tv,
DBusGMethodInvocation *context)
{
GError *error;
if (!_check_polkit_for_action (mechanism, context))
return FALSE;
if (settimeofday (tv, NULL) != 0) {
error = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
GSD_DATETIME_MECHANISM_ERROR_GENERAL,
"Error calling settimeofday({%lld,%lld}): %s",
(gint64) tv->tv_sec, (gint64) tv->tv_usec,
strerror (errno));
dbus_g_method_return_error (context, error);
g_error_free (error);
return FALSE;
}
if (!_sync_hwclock (context))
return FALSE;
dbus_g_method_return (context);
return TRUE;
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:27,代码来源:gsd-datetime-mechanism.c
示例15: do_async_increment
static gboolean
do_async_increment (IncrementData *data)
{
gint32 newx = data->x + 1;
dbus_g_method_return (data->context, newx);
g_free (data);
return FALSE;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:8,代码来源:my-object.c
示例16: async_call_done
static void
async_call_done (MMModem *modem, GError *error, gpointer user_data)
{
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
if (error)
dbus_g_method_return_error (context, error);
else
dbus_g_method_return (context);
}
开发者ID:MasterOfPupets,项目名称:ModemManager,代码行数:10,代码来源:mm-modem-gsm-card.c
示例17: gypsy_server_create
/* IN_args contains that path to the GPS device we wish to open */
static void
gypsy_server_create (GypsyServer *gps,
const char *IN_device_path,
DBusGMethodInvocation *context)
{
GypsyServerPrivate *priv;
GypsyClient *client;
char *path, *device_name, *sender;
GList *list;
priv = GET_PRIVATE (gps);
/* We might be in the termination timeout when we receive a new
create request, so cancel that timeout */
if (priv->terminate_id > 0) {
g_source_remove (priv->terminate_id);
priv->terminate_id = 0;
}
g_debug ("Creating client for %s", IN_device_path);
device_name = g_path_get_basename (IN_device_path);
g_debug ("Device name: %s", device_name);
path = g_strdup_printf ("%s%s", GYPSY_GPS_PATH,
g_strdelimit (device_name, ":", '_'));
g_free (device_name);
client = (GypsyClient *) dbus_g_connection_lookup_g_object (priv->connection, path);
if (client == NULL) {
/* If there isn't already an object registered on that path
create and register it */
client = g_object_new (GYPSY_TYPE_CLIENT,
"device_path", IN_device_path,
NULL);
dbus_g_connection_register_g_object (priv->connection, path,
G_OBJECT (client));
} else {
/* Ref the client so that when one client calls shutdown
we won't destroy another clients object */
g_object_ref (client);
}
g_debug ("Registered client on %s", path);
/* Update the hash of open connnctions */
sender = dbus_g_method_get_sender (context);
list = g_hash_table_lookup (priv->connections, sender);
list = g_list_prepend (list, client);
g_hash_table_insert (priv->connections, sender, list);
priv->client_count++;
dbus_g_method_return (context, path);
g_free (path);
}
开发者ID:ahsparrow,项目名称:gypsy,代码行数:56,代码来源:gypsy-server.c
示例18: check_can_do
static void
check_can_do (GsdDatetimeMechanism *mechanism,
const char *action,
DBusGMethodInvocation *context)
{
const char *sender;
PolkitSubject *subject;
PolkitAuthorizationResult *result;
GError *error;
/* Check that caller is privileged */
sender = dbus_g_method_get_sender (context);
subject = polkit_system_bus_name_new (sender);
error = NULL;
result = polkit_authority_check_authorization_sync (mechanism->priv->auth,
subject,
action,
NULL,
0,
NULL,
&error);
g_object_unref (subject);
if (error) {
dbus_g_method_return_error (context, error);
g_error_free (error);
return;
}
if (polkit_authorization_result_get_is_authorized (result)) {
dbus_g_method_return (context, 2);
}
else if (polkit_authorization_result_get_is_challenge (result)) {
dbus_g_method_return (context, 1);
}
else {
dbus_g_method_return (context, 0);
}
g_object_unref (result);
}
开发者ID:ebroder,项目名称:gnome-settings-daemon,代码行数:42,代码来源:gsd-datetime-mechanism.c
示例19: ring_text_manager_set_storage_status_reply
static void
ring_text_manager_set_storage_status_reply(ModemSMSService *service,
ModemRequest *request,
GError *error,
gpointer context)
{
if (!error)
dbus_g_method_return(context);
else
dbus_g_method_return_error(context, error);
}
开发者ID:rodrmoya,项目名称:telepathy-ring,代码行数:11,代码来源:ring-text-manager.c
示例20: up_device_refresh
/**
* up_device_refresh:
*
* Return %TRUE on success, %FALSE if we failed to refresh or no data
**/
gboolean
up_device_refresh (UpDevice *device, DBusGMethodInvocation *context)
{
gboolean ret;
g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
ret = up_device_refresh_internal (device);
dbus_g_method_return (context);
return ret;
}
开发者ID:Kalvados,项目名称:upower,代码行数:16,代码来源:up-device.c
注:本文中的dbus_g_method_return函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论