本文整理汇总了C++中G_DBUS_PROXY函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_PROXY函数的具体用法?C++ G_DBUS_PROXY怎么用?C++ G_DBUS_PROXY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DBUS_PROXY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fcitx_input_method_set_imlist
/**
* fcitx_input_method_set_imlist:
* @im: A #FcitxInputMethod
* @array: (element-type FcitxIMItem) (transfer none): A #FcitxIMItem List
*
* Set Fcitx all im list
**/
FCITX_EXPORT_API
void
fcitx_input_method_set_imlist(FcitxInputMethod *im, GPtrArray* array)
{
GVariantBuilder builder;
g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sssb)"));
g_ptr_array_foreach(array, _fcitx_im_item_foreach_cb, &builder);
GVariant* value = g_variant_builder_end(&builder);
GError* error = NULL;
GVariant* result = g_dbus_connection_call_sync(g_dbus_proxy_get_connection(G_DBUS_PROXY(im)),
g_dbus_proxy_get_name(G_DBUS_PROXY(im)),
FCITX_IM_DBUS_PATH,
"org.freedesktop.DBus.Properties",
"Set",
g_variant_new("(ssv)", FCITX_IM_DBUS_INTERFACE, "IMList", value),
G_VARIANT_TYPE_UNIT,
G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */
NULL,
&error);
if (error) {
g_warning("%s", error->message);
g_error_free(error);
}
g_variant_unref(result);
}
开发者ID:HenryHu,项目名称:fcitx,代码行数:35,代码来源:fcitxinputmethod.c
示例2: handle_prepare_print
static gboolean
handle_prepare_print (XdpPrint *object,
GDBusMethodInvocation *invocation,
const gchar *arg_parent_window,
const gchar *arg_title,
GVariant *arg_settings,
GVariant *arg_page_setup,
GVariant *arg_options)
{
Request *request = request_from_invocation (invocation);
const char *app_id = xdp_app_info_get_id (request->app_info);
g_autoptr(GError) error = NULL;
g_autoptr(XdpImplRequest) impl_request = NULL;
GVariantBuilder opt_builder;
if (xdp_impl_lockdown_get_disable_printing (lockdown))
{
g_debug ("Printing disabled");
g_dbus_method_invocation_return_error (invocation,
XDG_DESKTOP_PORTAL_ERROR,
XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED,
"Printing disabled");
return TRUE;
}
REQUEST_AUTOLOCK (request);
impl_request = xdp_impl_request_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (impl)),
G_DBUS_PROXY_FLAGS_NONE,
g_dbus_proxy_get_name (G_DBUS_PROXY (impl)),
request->id,
NULL, &error);
if (!impl_request)
{
g_dbus_method_invocation_return_gerror (invocation, error);
return TRUE;
}
request_set_impl_request (request, impl_request);
request_export (request, g_dbus_method_invocation_get_connection (invocation));
g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
xdp_filter_options (arg_options, &opt_builder,
prepare_print_options, G_N_ELEMENTS (prepare_print_options));
xdp_impl_print_call_prepare_print (impl,
request->id,
app_id,
arg_parent_window,
arg_title,
arg_settings,
arg_page_setup,
g_variant_builder_end (&opt_builder),
NULL,
prepare_print_done,
g_object_ref (request));
xdp_print_complete_prepare_print (object, invocation, request->id);
return TRUE;
}
开发者ID:grulja,项目名称:xdg-desktop-portal,代码行数:60,代码来源:print.c
示例3: _parent_init_async_cb
static void
_parent_init_async_cb (GObject *obj,
GAsyncResult *res,
gpointer user_data)
{
InitData *data;
data = (InitData*)user_data;
/* start our own initialization */
g_dbus_proxy_call (G_DBUS_PROXY (obj),
"GetProperties",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
data->cancellable,
_get_properties_cb,
data);
g_dbus_proxy_call (G_DBUS_PROXY (obj),
"GetServices",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
data->cancellable,
_get_services_cb,
data);
g_signal_connect (obj, "notify::g-name-owner",
G_CALLBACK (_name_owner_notify_cb), NULL);
}
开发者ID:Guacamayo,项目名称:guacamayo-cli,代码行数:31,代码来源:mtn-connman.c
示例4: mtn_connman_initable_init_sync
static gboolean
mtn_connman_initable_init_sync (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
GInitableIface *iface_class, *parent_iface_class;
GVariant *var, *value;
GVariantIter *iter;
char *key;
MtnConnman *connman;
connman = MTN_CONNMAN (initable);
/* Chain up the old method */
iface_class = G_INITABLE_GET_IFACE (initable);
parent_iface_class = g_type_interface_peek_parent (iface_class);
if (!parent_iface_class->init (initable, cancellable, error)) {
return FALSE;
}
g_signal_connect (connman, "notify::g-name-owner",
G_CALLBACK (_name_owner_notify_cb), NULL);
var = g_dbus_proxy_call_sync (G_DBUS_PROXY (connman),
"GetProperties",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
error);
if (!var) {
return FALSE;
}
g_variant_get (var, "(a{sv})", &iter);
while (g_variant_iter_next (iter, "{sv}", &key, &value)) {
g_hash_table_insert (connman->priv->properties,
key, value);
}
g_variant_iter_free (iter);
g_variant_unref (var);
var = g_dbus_proxy_call_sync (G_DBUS_PROXY (connman),
"GetServices",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
error);
if (!var) {
return FALSE;
}
connman->priv->services = var;
return TRUE;
}
开发者ID:Guacamayo,项目名称:guacamayo-cli,代码行数:57,代码来源:mtn-connman.c
示例5: add_interface
static void
add_interface (JsonBuilder *builder,
GDBusInterface *interface,
GVariant *changed_properties)
{
gchar *s;
json_builder_set_member_name (builder, g_dbus_proxy_get_interface_name (G_DBUS_PROXY (interface)));
json_builder_begin_object (builder);
if (changed_properties == NULL)
{
gchar **properties;
guint n;
properties = g_dbus_proxy_get_cached_property_names (G_DBUS_PROXY (interface));
for (n = 0; properties != NULL && properties[n] != NULL; n++)
{
const gchar *property_name = properties[n];
GVariant *value;
value = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (interface), property_name);
if (value != NULL)
{
s = g_strconcat ("dbus_prop_", property_name, NULL);
json_builder_set_member_name (builder, s);
g_free (s);
_json_builder_add_gvariant (builder, value);
g_variant_unref (value);
}
}
g_strfreev (properties);
if (properties == NULL)
{
json_builder_set_member_name (builder, "HackEmpty");
json_builder_add_string_value (builder, "HackEmpty");
}
}
else
{
GVariantIter iter;
const gchar *property_name;
GVariant *value;
g_variant_iter_init (&iter, changed_properties);
while (g_variant_iter_next (&iter, "{&sv}", &property_name, &value))
{
s = g_strconcat ("dbus_prop_", property_name, NULL);
json_builder_set_member_name (builder, property_name);
g_free (s);
_json_builder_add_gvariant (builder, value);
g_variant_unref (value);
}
}
json_builder_end_object (builder);
}
开发者ID:adrianobalani,项目名称:cockpit,代码行数:56,代码来源:cockpitdbusjson1.c
示例6: fcitx_input_method_get_imlist_nofree
/**
* fcitx_input_method_get_imlist_nofree: (rename-to fcitx_input_method_get_imlist)
* @im: A #FcitxInputMethod
*
* Get Fcitx all im list
*
* Returns: (transfer full) (element-type FcitxIMItem): A #FcitxIMItem List
*
* Rename to: fcitx_input_method_get_imlist
**/
FCITX_EXPORT_API
GPtrArray*
fcitx_input_method_get_imlist_nofree(FcitxInputMethod* im)
{
GPtrArray *array = NULL;
GVariant* value;
GVariantIter *iter;
gchar *name, *unique_name, *langcode;
gboolean enable;
value = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(im), "IMList");
if (value == NULL) {
GError* error = NULL;
GVariant* result = g_dbus_connection_call_sync(g_dbus_proxy_get_connection(G_DBUS_PROXY(im)),
g_dbus_proxy_get_name(G_DBUS_PROXY(im)),
FCITX_IM_DBUS_PATH,
"org.freedesktop.DBus.Properties",
"Get",
g_variant_new("(ss)", FCITX_IM_DBUS_INTERFACE, "IMList"),
G_VARIANT_TYPE("(v)"),
G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */
NULL,
&error);
if (error) {
g_warning("%s", error->message);
g_error_free(error);
} else if (result) {
g_variant_get(result, "(v)", &value);
g_variant_unref(result);
}
}
if (value) {
array = g_ptr_array_new();
g_variant_get(value, "a(sssb)", &iter);
while (g_variant_iter_next(iter, "(sssb)", &name, &unique_name, &langcode, &enable, NULL)) {
FcitxIMItem *item = g_slice_new(FcitxIMItem);
item->name = name;
item->unique_name = unique_name;
item->langcode = langcode;
item->enable = enable;
g_ptr_array_add(array, item);
}
g_variant_iter_free(iter);
g_variant_unref(value);
}
return array;
}
开发者ID:HenryHu,项目名称:fcitx,代码行数:62,代码来源:fcitxinputmethod.c
示例7: handle_save_file
static gboolean
handle_save_file (XdpFileChooser *object,
GDBusMethodInvocation *invocation,
const gchar *arg_parent_window,
const gchar *arg_title,
GVariant *arg_options)
{
Request *request = request_from_invocation (invocation);
const char *app_id = request->app_id;
g_autoptr(GError) error = NULL;
XdpImplRequest *impl_request;
GVariantBuilder options;
REQUEST_AUTOLOCK (request);
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
xdp_filter_options (arg_options, &options,
save_file_options, G_N_ELEMENTS (save_file_options));
impl_request = xdp_impl_request_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (impl)),
G_DBUS_PROXY_FLAGS_NONE,
g_dbus_proxy_get_name (G_DBUS_PROXY (impl)),
request->id,
NULL, &error);
if (!impl_request)
{
g_dbus_method_invocation_return_gerror (invocation, error);
return TRUE;
}
g_object_set_data (G_OBJECT (request), "for-save", GINT_TO_POINTER (TRUE));
request_set_impl_request (request, impl_request);
request_export (request, g_dbus_method_invocation_get_connection (invocation));
xdp_impl_file_chooser_call_save_file (impl,
request->id,
app_id,
arg_parent_window,
arg_title,
g_variant_builder_end (&options),
NULL,
save_file_done,
g_object_ref (request));
xdp_file_chooser_complete_open_file (object, invocation, request->id);
return TRUE;
}
开发者ID:amigadave,项目名称:xdg-desktop-portal,代码行数:49,代码来源:file-chooser.c
示例8: handle_empty_device
static gboolean
handle_empty_device (CockpitStorageVolumeGroup *object,
GDBusMethodInvocation *invocation,
const gchar *arg_objpath)
{
StorageVolumeGroup *group = STORAGE_VOLUME_GROUP(object);
GError *error = NULL;
const gchar *block_path = "/";
if (!auth_check_sender_role (invocation, COCKPIT_ROLE_STORAGE_ADMIN))
return TRUE;
StorageProvider *provider = storage_object_get_provider (group->object);
Daemon *daemon = storage_provider_get_daemon (provider);
GDBusObjectManagerServer *object_manager_server = daemon_get_object_manager (daemon);
GDBusObjectManager *object_manager = G_DBUS_OBJECT_MANAGER (object_manager_server);
StorageObject *block_object =
STORAGE_OBJECT (g_dbus_object_manager_get_object (object_manager, arg_objpath));
UDisksBlock *udisks_block = storage_object_get_udisks_block (block_object);
if (udisks_block)
block_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (udisks_block));
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (group->lvm_volume_group),
G_MAXINT);
if (!lvm_volume_group_call_empty_device_sync (group->lvm_volume_group,
block_path,
null_asv (),
NULL,
&error))
{
g_dbus_error_strip_remote_error (error);
g_dbus_method_invocation_return_error (invocation,
COCKPIT_ERROR,
COCKPIT_ERROR_FAILED,
"%s", error->message);
g_error_free (error);
}
else
cockpit_storage_volume_group_complete_empty_device (object, invocation);
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (group->lvm_volume_group),
-1);
return TRUE;
}
开发者ID:githubber,项目名称:cockpit,代码行数:48,代码来源:storagevolumegroup.c
示例9: storage_block_get_object_path
const gchar *
storage_block_get_object_path (StorageBlock *self)
{
g_return_val_if_fail (STORAGE_IS_BLOCK (self), NULL);
g_return_val_if_fail (self->real_block != NULL, NULL);
return g_dbus_proxy_get_object_path (G_DBUS_PROXY (self->real_block));
}
开发者ID:mvollmer,项目名称:storaged,代码行数:7,代码来源:block.c
示例10: on_udisks_object_added
static void
on_udisks_object_added (GDBusObjectManager *manager,
GDBusObject *object,
gpointer user_data)
{
FormatData *data = user_data;
if (data->invocation == NULL)
return;
UDisksObject *udisks_object = UDISKS_OBJECT (object);
UDisksJob *udisks_job = udisks_object_peek_job (udisks_object);
if (udisks_job)
{
const gchar *us = g_dbus_proxy_get_object_path (G_DBUS_PROXY (data->block));
const gchar *const *them = udisks_job_get_objects (udisks_job);
for (int i = 0; them[i]; i++)
{
if (strcmp (them[i], us) == 0)
{
g_dbus_method_invocation_return_value (data->invocation, g_variant_new ("()"));
g_clear_object (&data->invocation);
break;
}
}
}
}
开发者ID:humanux,项目名称:cockpit,代码行数:27,代码来源:storageblock.c
示例11: inhibit_done
static void
inhibit_done (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GDBusProxy *sd_proxy = G_DBUS_PROXY (source);
NMSleepMonitor *self = user_data;
GError *error = NULL;
GVariant *res;
GUnixFDList *fd_list;
res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, result, &error);
if (!res) {
g_dbus_error_strip_remote_error (error);
nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", error->message);
g_error_free (error);
} else {
if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1)
nm_log_warn (LOGD_SUSPEND, "Didn't get a single fd back");
self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL);
nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", self->inhibit_fd);
g_object_unref (fd_list);
g_variant_unref (res);
}
}
开发者ID:gunchleoc,项目名称:NetworkManager,代码行数:27,代码来源:nm-sleep-monitor-systemd.c
示例12: on_list_units_done
static void
on_list_units_done (GObject *object,
GAsyncResult *res,
gpointer user_data)
{
ListServicesData *data = user_data;
GError *error = NULL;
data->units = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error);
if (error)
{
end_invocation_take_gerror (data->invocation, error);
g_free (data);
return;
}
g_dbus_proxy_call (data->services->systemd,
"ListUnitFiles",
NULL,
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
NULL,
on_list_files_done,
data);
}
开发者ID:imace,项目名称:cockpit,代码行数:25,代码来源:services.c
示例13: _set_property_cb
static void
_set_property_cb (GObject *object,
GAsyncResult *res,
gpointer user_data)
{
char *key;
GVariant *var;
GError *error;
key = (char *)user_data;
error = NULL;
var = g_dbus_proxy_call_finish (G_DBUS_PROXY (object),
res,
&error);
if (var) {
g_variant_unref (var);
} else if (error) {
g_warning ("Connman Manager.SetProperty() for '%s' failed: %s",
key, error->message);
/* TODO: call a error handler method */
g_error_free (error);
}
g_free (key);
}
开发者ID:Guacamayo,项目名称:guacamayo-cli,代码行数:27,代码来源:mtn-connman.c
示例14: fcitx_kbd_set_default_layout
/**
* fcitx_kbd_set_default_layout:
* @kbd: A #FcitxKbd
* @layout: layout
* @variant: variant
*
* Set a layout binding with the state when there is no input method
**/
FCITX_EXPORT_API
void fcitx_kbd_set_default_layout(FcitxKbd *kbd, const gchar *layout,
const gchar *variant) {
g_dbus_proxy_call(G_DBUS_PROXY(kbd), "SetDefaultLayout",
g_variant_new("(ss)", layout, variant),
G_DBUS_CALL_FLAGS_NO_AUTO_START, 0, NULL, NULL, NULL);
}
开发者ID:amosbird,项目名称:fcitx,代码行数:15,代码来源:fcitxkbd.c
示例15: on_get_user_id_ready
static void
on_get_user_id_ready (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GTask *task = G_TASK (user_data);
gpointer *info = g_task_get_source_object (task);
GClueClientInfoPrivate *priv = GCLUE_CLIENT_INFO (info)->priv;
GError *error = NULL;
GVariant *results = NULL;
results = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
res,
&error);
if (results == NULL) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
g_assert (g_variant_n_children (results) > 0);
g_variant_get_child (results, 0, "u", &priv->user_id);
g_variant_unref (results);
g_dbus_proxy_call (priv->dbus_proxy,
"GetConnectionUnixProcessID",
g_variant_new ("(s)", priv->bus_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
g_task_get_cancellable (task),
on_get_pid_ready,
task);
}
开发者ID:zeenix,项目名称:Geoclue,代码行数:34,代码来源:gclue-client-info.c
示例16: _secret_prompt_instance
SecretPrompt *
_secret_prompt_instance (SecretService *service,
const gchar *prompt_path)
{
GDBusProxy *proxy;
SecretPrompt *prompt;
GError *error = NULL;
g_return_val_if_fail (SECRET_IS_SERVICE (service), NULL);
g_return_val_if_fail (prompt_path != NULL, NULL);
proxy = G_DBUS_PROXY (service);
prompt = g_initable_new (SECRET_TYPE_PROMPT, NULL, &error,
"g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
"g-interface-info", _secret_gen_prompt_interface_info (),
"g-name", g_dbus_proxy_get_name (proxy),
"g-connection", g_dbus_proxy_get_connection (proxy),
"g-object-path", prompt_path,
"g-interface-name", SECRET_PROMPT_INTERFACE,
NULL);
if (error != NULL) {
g_warning ("couldn't create SecretPrompt object: %s", error->message);
g_clear_error (&error);
return NULL;
}
return prompt;
}
开发者ID:Arkhont,项目名称:libsecret,代码行数:29,代码来源:secret-prompt.c
示例17: on_prompt_dismissed
static void
on_prompt_dismissed (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
SecretPrompt *self = SECRET_PROMPT (source);
GError *error = NULL;
GVariant *retval;
retval = g_dbus_proxy_call_finish (G_DBUS_PROXY (self), result, &error);
if (retval)
g_variant_unref (retval);
if (closure->vanished)
g_clear_error (&error);
if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD))
g_clear_error (&error);
if (error != NULL) {
g_simple_async_result_take_error (res, error);
perform_prompt_complete (res, TRUE);
}
g_object_unref (res);
}
开发者ID:Arkhont,项目名称:libsecret,代码行数:27,代码来源:secret-prompt.c
示例18: on_prompt_prompted
static void
on_prompt_prompted (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
PerformClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
SecretPrompt *self = SECRET_PROMPT (source);
GError *error = NULL;
GVariant *retval;
retval = g_dbus_proxy_call_finish (G_DBUS_PROXY (self), result, &error);
if (retval)
g_variant_unref (retval);
if (closure->vanished)
g_clear_error (&error);
if (error != NULL) {
g_simple_async_result_take_error (res, error);
perform_prompt_complete (res, TRUE);
} else {
closure->prompting = TRUE;
g_atomic_int_set (&self->pv->prompted, 1);
/* And now we wait for the signal */
}
g_object_unref (res);
}
开发者ID:Arkhont,项目名称:libsecret,代码行数:31,代码来源:secret-prompt.c
示例19: get_capabilities_callback
static void get_capabilities_callback(GObject* source, GAsyncResult* res, gpointer user_data UNUSED)
{
char** caps;
GVariant* result;
result = g_dbus_proxy_call_finish(G_DBUS_PROXY(source), res, NULL);
if (result == NULL || !g_variant_is_of_type(result, G_VARIANT_TYPE("(as)")))
{
if (result != NULL)
{
g_variant_unref(result);
}
return;
}
g_variant_get(result, "(^a&s)", &caps);
for (int i = 0; caps[i] != NULL; i++)
{
if (g_strcmp0(caps[i], "actions") == 0)
{
server_supports_actions = TRUE;
break;
}
}
g_free(caps);
g_variant_unref(result);
}
开发者ID:Mikayex,项目名称:transmission,代码行数:31,代码来源:notify.c
示例20: fcitx_input_method_get_current_state
/**
* fcitx_input_method_get_current_state:
* @im: A #FcitxInputMethod
*
* Get current state
*
* Returns: current state, -1 for error
**/
FCITX_EXPORT_API
gint fcitx_input_method_get_current_state(FcitxInputMethod* im)
{
GError* error = NULL;
GVariant* variant = g_dbus_proxy_call_sync(G_DBUS_PROXY(im),
"GetCurrentState",
NULL,
G_DBUS_CALL_FLAGS_NO_AUTO_START,
-1,
NULL,
&error
);
gint result = -1;
if (error) {
g_warning("%s", error->message);
g_error_free(error);
} else if (variant) {
g_variant_get(variant, "(i)", &result);
g_variant_unref(variant);
}
return result;
}
开发者ID:HenryHu,项目名称:fcitx,代码行数:33,代码来源:fcitxinputmethod.c
注:本文中的G_DBUS_PROXY函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论