本文整理汇总了C++中G_VARIANT_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_VARIANT_TYPE函数的具体用法?C++ G_VARIANT_TYPE怎么用?C++ G_VARIANT_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_VARIANT_TYPE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handle_request_session
static gboolean
handle_request_session (FlatpakSessionHelper *object,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&builder, "{[email protected]}", "path",
g_variant_new_variant (g_variant_new_string (monitor_dir)));
if (p11_kit_server_socket_path)
g_variant_builder_add (&builder, "{[email protected]}", "pkcs11-socket",
g_variant_new_variant (g_variant_new_string (p11_kit_server_socket_path)));
flatpak_session_helper_complete_request_session (object, invocation,
g_variant_builder_end (&builder));
return TRUE;
}
开发者ID:alexlarsson,项目名称:flatpak,代码行数:20,代码来源:flatpak-session-helper.c
示例2: iter_get_variant
static gboolean
iter_get_variant (GVariant *variant,
DataType data_type,
gulong attr_type,
GckBuilder *builder)
{
IterGetFunc func = NULL;
gboolean ret;
const GVariantType *sig;
g_assert (variant != NULL);
g_assert (builder != NULL);
switch (data_type) {
case DATA_TYPE_STRING:
func = iter_get_string;
sig = G_VARIANT_TYPE_STRING;
break;
case DATA_TYPE_BOOL:
func = iter_get_bool;
sig = G_VARIANT_TYPE_BOOLEAN;
break;
case DATA_TYPE_TIME:
func = iter_get_time;
sig = G_VARIANT_TYPE_UINT64;
break;
case DATA_TYPE_FIELDS:
func = iter_get_fields;
sig = G_VARIANT_TYPE ("a{ss}");
break;
default:
g_assert (FALSE);
break;
}
ret = g_variant_type_equal (g_variant_get_type (variant), sig);
if (ret == FALSE)
return FALSE;
return (func) (variant, attr_type, builder);
}
开发者ID:Distrotech,项目名称:gnome-keyring,代码行数:41,代码来源:gkd-secret-property.c
示例3: inhibit
static gboolean inhibit (const gchar *app_id,
const gchar *reason,
GsmInhibitorFlag flags)
{
GDBusConnection *bus;
GVariant *ret;
GError *error = NULL;
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (bus == NULL)
{
g_warning ("Failed to connect to session bus: %s", error->message);
g_error_free (error);
return FALSE;
}
ret = g_dbus_connection_call_sync (bus,
"org.gnome.SessionManager",
"/org/gnome/SessionManager",
"org.gnome.SessionManager",
"Inhibit",
g_variant_new ("(susu)",
app_id, 0, reason, flags),
G_VARIANT_TYPE ("(u)"),
0,
G_MAXINT,
NULL,
&error);
if (ret == NULL)
{
g_warning ("Failed to call Inhibit: %s\n", error->message);
g_error_free (error);
return FALSE;
}
g_variant_unref (ret);
return TRUE;
}
开发者ID:gcampax,项目名称:gnome-session,代码行数:41,代码来源:gnome-session-inhibit.c
示例4: request_open_session_aes
static GVariant *
request_open_session_aes (SecretSession *session)
{
gcry_error_t gcry;
gcry_mpi_t base;
unsigned char *buffer;
size_t n_buffer;
GVariant *argument;
g_assert (session->prime == NULL);
g_assert (session->privat == NULL);
g_assert (session->publi == NULL);
egg_libgcrypt_initialize ();
/* Initialize our local parameters and values */
if (!egg_dh_default_params ("ietf-ike-grp-modp-1024",
&session->prime, &base))
g_return_val_if_reached (NULL);
#if 0
g_printerr ("\n lib prime: ");
gcry_mpi_dump (session->prime);
g_printerr ("\n lib base: ");
gcry_mpi_dump (base);
g_printerr ("\n");
#endif
if (!egg_dh_gen_pair (session->prime, base, 0,
&session->publi, &session->privat))
g_return_val_if_reached (NULL);
gcry_mpi_release (base);
gcry = gcry_mpi_aprint (GCRYMPI_FMT_USG, &buffer, &n_buffer, session->publi);
g_return_val_if_fail (gcry == 0, NULL);
argument = g_variant_new_from_data (G_VARIANT_TYPE ("ay"),
buffer, n_buffer, TRUE,
gcry_free, buffer);
return g_variant_new ("(sv)", ALGORITHMS_AES, argument);
}
开发者ID:GNOME,项目名称:libsecret,代码行数:41,代码来源:secret-session.c
示例5: generate_one_delta
static gboolean
generate_one_delta (OstreeRepo *repo,
const char *from,
const char *to,
const char *ref,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariantBuilder) parambuilder = NULL;
g_autoptr(GVariant) params = NULL;
parambuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
/* Fall back for 1 meg files */
g_variant_builder_add (parambuilder, "{sv}",
"min-fallback-size", g_variant_new_uint32 (1));
params = g_variant_ref_sink (g_variant_builder_end (parambuilder));
if (ref == NULL)
ref = "";
if (from == NULL)
g_print (_("Generating delta: %s (%.10s)\n"), ref, to);
else
g_print (_("Generating delta: %s (%.10s-%.10s)\n"), ref, from, to);
if (!ostree_repo_static_delta_generate (repo, OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR,
from, to, NULL,
params,
cancellable, error))
{
if (from == NULL)
g_prefix_error (error, _("Failed to generate delta %s (%.10s): "),
ref, to);
else
g_prefix_error (error, _("Failed to generate delta %s (%.10s-%.10s): "),
ref, from, to);
return FALSE;
}
return TRUE;
}
开发者ID:flatpak,项目名称:flatpak,代码行数:41,代码来源:flatpak-builtins-build-update-repo.c
示例6: handle_get_environment
static gboolean
handle_get_environment (GkdExportedDaemon *skeleton,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
const gchar **env;
gchar **parts;
GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
for (env = gkd_util_get_environment (); *env != NULL; env++) {
parts = g_strsplit (*env, "=", 2);
g_variant_builder_add (&builder, "{ss}", parts[0], parts[1]);
g_strfreev (parts);
}
gkd_exported_daemon_complete_get_environment (skeleton, invocation,
g_variant_builder_end (&builder));
return TRUE;
}
开发者ID:GNOME,项目名称:gnome-keyring,代码行数:21,代码来源:gkd-dbus.c
示例7: web_extension_form_auth_data_message_received_cb
static void
web_extension_form_auth_data_message_received_cb (WebKitUserContentManager *manager,
WebKitJavascriptResult *message,
EphyEmbedShell *shell)
{
guint request_id;
guint64 page_id;
const char *hostname;
const char *username;
GVariant *variant;
gchar *message_str;
message_str = ephy_embed_utils_get_js_result_as_string (message);
variant = g_variant_parse (G_VARIANT_TYPE ("(utss)"), message_str, NULL, NULL, NULL);
g_free (message_str);
g_variant_get (variant, "(ut&s&s)", &request_id, &page_id, &hostname, &username);
g_signal_emit (shell, signals[FORM_AUTH_DATA_SAVE_REQUESTED], 0,
request_id, page_id, hostname, username);
g_variant_unref (variant);
}
开发者ID:Distrotech,项目名称:epiphany,代码行数:21,代码来源:ephy-embed-shell.c
示例8: DLEYNA_LOG_DEBUG
GVariant *dlr_upnp_get_server_ids(dlr_upnp_t *upnp)
{
GVariantBuilder vb;
GHashTableIter iter;
gpointer value;
dlr_device_t *device;
DLEYNA_LOG_DEBUG("Enter");
g_variant_builder_init(&vb, G_VARIANT_TYPE("as"));
g_hash_table_iter_init(&iter, upnp->server_udn_map);
while (g_hash_table_iter_next(&iter, NULL, &value)) {
device = value;
g_variant_builder_add(&vb, "s", device->path);
}
DLEYNA_LOG_DEBUG("Exit");
return g_variant_ref_sink(g_variant_builder_end(&vb));
}
开发者ID:em-,项目名称:dleyna-renderer,代码行数:21,代码来源:upnp.c
示例9: commit_changes
static void
commit_changes (UIData *ui)
{
GtkTreeModel *model = NULL;
GVariantBuilder b;
GtkTreeIter iter;
gboolean valid;
GVariant *v;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (ui->treeview));
valid = gtk_tree_model_get_iter_first (model, &iter);
g_variant_builder_init (&b, G_VARIANT_TYPE ("as"));
while (valid) {
gchar *keyword, *value;
gchar *key;
gtk_tree_model_get (
model, &iter,
CLUE_KEYWORD_COLUMN, &keyword,
CLUE_VALUE_COLUMN, &value,
-1);
/* Check if the keyword and value are not empty */
if ((keyword) && (value) && (g_utf8_strlen (g_strstrip (keyword), -1) > 0)
&& (g_utf8_strlen (g_strstrip (value), -1) > 0)) {
key = g_strdup_printf ("%s=%s", keyword, value);
g_variant_builder_add (&b, "s", key);
}
g_free (keyword);
g_free (value);
valid = gtk_tree_model_iter_next (model, &iter);
}
/* A floating GVariant is returned, which is consumed by the g_settings_set_value() */
v = g_variant_builder_end (&b);
g_settings_set_value (ui->settings, CONF_KEY_TEMPLATE_PLACEHOLDERS, v);
}
开发者ID:alexanderhmw,项目名称:evolution,代码行数:40,代码来源:templates.c
示例10: start_service_by_name
static gboolean
start_service_by_name(void)
{
GError *error = NULL;
GVariant *var;
GDBusConnection *conn;
conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
if (error) {
fprintf(stderr, "Could not get session bus connection: %s\n",
error->message);
g_error_free(error);
return FALSE;
}
var = g_dbus_connection_call_sync(conn,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"StartServiceByName",
g_variant_new("(su)",
"org.lightmediascanner", 0),
G_VARIANT_TYPE("(u)"),
G_DBUS_CALL_FLAGS_NONE,
10000,
NULL,
&error);
g_object_unref(conn);
if (var)
g_variant_unref(var);
if (error) {
fprintf(stderr, "Could not start org.lightmediascanner: %s\n",
error->message);
g_error_free(error);
return FALSE;
}
return TRUE;
}
开发者ID:JanderJLR,项目名称:Media-Manager-lightmediascanner-patched,代码行数:40,代码来源:lightmediascannerctl.c
示例11: g_dbus_object_manager_server_emit_interfaces_added
static void
g_dbus_object_manager_server_emit_interfaces_added (GDBusObjectManagerServer *manager,
RegistrationData *data,
const gchar *const *interfaces)
{
GVariantBuilder array_builder;
GError *error;
guint n;
const gchar *object_path;
if (data->manager->priv->connection == NULL)
goto out;
g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("a{sa{sv}}"));
for (n = 0; interfaces[n] != NULL; n++)
{
GDBusInterfaceSkeleton *iface;
iface = g_hash_table_lookup (data->map_iface_name_to_iface, interfaces[n]);
g_assert (iface != NULL);
g_variant_builder_add_value (&array_builder,
g_variant_new ("{[email protected]{sv}}",
interfaces[n],
g_dbus_interface_skeleton_get_properties (iface)));
}
error = NULL;
object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object));
g_dbus_connection_emit_signal (data->manager->priv->connection,
NULL, /* destination_bus_name */
manager->priv->object_path,
manager_interface_info.name,
"InterfacesAdded",
g_variant_new ("(oa{sa{sv}})",
object_path,
&array_builder),
&error);
g_assert_no_error (error);
out:
;
}
开发者ID:dmatveev,项目名称:glib-gio-kqueue-integration,代码行数:40,代码来源:gdbusobjectmanagerserver.c
示例12: register_display
static gboolean
register_display (State *state,
GCancellable *cancellable)
{
GdmDBusManager *manager = NULL;
GError *error = NULL;
gboolean registered = FALSE;
GVariantBuilder details;
manager = gdm_dbus_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
"org.gnome.DisplayManager",
"/org/gnome/DisplayManager/Manager",
cancellable,
&error);
if (!manager) {
g_debug ("could not contact display manager: %s", error->message);
g_error_free (error);
goto out;
}
g_variant_builder_init (&details, G_VARIANT_TYPE ("a{ss}"));
g_variant_builder_add (&details, "{ss}", "session-type", "x11");
g_variant_builder_add (&details, "{ss}", "x11-display-name", state->display_name);
registered = gdm_dbus_manager_call_register_display_sync (manager,
g_variant_builder_end (&details),
cancellable,
&error);
if (error != NULL) {
g_debug ("Could not register display: %s", error->message);
g_error_free (error);
}
out:
g_clear_object (&manager);
return registered;
}
开发者ID:zhulianhai,项目名称:gdm,代码行数:40,代码来源:gdm-x-session.c
示例13: xfpm_dbus_register_name
gboolean xfpm_dbus_register_name(GDBusConnection *connection, const gchar *name)
{
GError *error = NULL;
guint32 ret = 0;
GVariant *var;
var = g_dbus_connection_call_sync (connection,
"org.freedesktop.DBus", /* bus name */
"/org/freedesktop/DBus", /* object path */
"org.freedesktop.DBus", /* interface name */
"RequestName", /* method name */
g_variant_new ("(su)",
name,
0x4), /* DBUS_NAME_FLAG_DO_NOT_QUEUE */
G_VARIANT_TYPE ("(u)"),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
if (var)
{
g_variant_get (var, "(u)", &ret);
g_variant_unref (var);
}
if ( error )
{
g_warning("Error: %s\n",error->message);
g_error_free(error);
return FALSE;
}
if ( ret == 1 ) /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */
{
return TRUE;
}
return FALSE;
}
开发者ID:EricKoegel,项目名称:xfce4-power-manager,代码行数:40,代码来源:xfpm-dbus.c
示例14: mm_location_gps_raw_get_dictionary
GVariant *
mm_location_gps_raw_get_dictionary (MMLocationGpsRaw *self)
{
GVariantBuilder builder;
/* We do allow NULL */
if (!self)
return NULL;
g_return_val_if_fail (MM_IS_LOCATION_GPS_RAW (self), NULL);
/* If mandatory parameters are not found, return NULL */
if (!self->priv->utc_time ||
self->priv->longitude == MM_LOCATION_LONGITUDE_UNKNOWN ||
self->priv->latitude == MM_LOCATION_LATITUDE_UNKNOWN)
return NULL;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&builder,
"{sv}",
PROPERTY_UTC_TIME,
g_variant_new_string (self->priv->utc_time));
g_variant_builder_add (&builder,
"{sv}",
PROPERTY_LONGITUDE,
g_variant_new_double (self->priv->longitude));
g_variant_builder_add (&builder,
"{sv}",
PROPERTY_LATITUDE,
g_variant_new_double (self->priv->latitude));
/* Altitude is optional */
if (self->priv->altitude != MM_LOCATION_ALTITUDE_UNKNOWN)
g_variant_builder_add (&builder,
"{sv}",
PROPERTY_ALTITUDE,
g_variant_new_double (self->priv->altitude));
return g_variant_ref_sink (g_variant_builder_end (&builder));
}
开发者ID:1Anastaska,项目名称:ModemManager,代码行数:40,代码来源:mm-location-gps-raw.c
示例15: update_realms
/* Reconstruct all data about known realms when the global "Realms"
property changes.
*/
static void
update_realms (Realms *realms)
{
if (realms->n_ready != realms->n_realms)
{
realms->need_realm_update = TRUE;
return;
}
gs_unref_variant GVariant *r = g_dbus_proxy_get_cached_property (realms->realmd, "Realms");
if (r && g_variant_is_of_type (r, G_VARIANT_TYPE("ao")))
{
realm_data_free (realms->n_realms, realms->data);
realms->n_realms = g_variant_n_children (r);
realms->n_ready = 0;
realms->data = g_new0 (RealmData, realms->n_realms);
int i;
for (i = 0; i < realms->n_realms; i++)
{
RealmData *data = realms->data + i;
data->owner = realms;
const gchar *path;
g_variant_get_child (r, i, "&o", &path);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
0,
NULL,
"org.freedesktop.realmd",
path,
"org.freedesktop.realmd.Realm",
NULL,
on_realm_proxy_ready,
data);
}
}
}
开发者ID:pdonlon,项目名称:cockpit,代码行数:43,代码来源:realms.c
示例16: printer_add_real_async
static void
printer_add_real_async (PpNewPrinter *printer)
{
PpNewPrinterPrivate *priv = printer->priv;
GDBusConnection *bus;
GError *error = NULL;
if (!priv->ppd_name && !priv->ppd_file_name)
{
_pp_new_printer_add_async_cb (FALSE, printer);
return;
}
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (!bus)
{
g_warning ("Failed to get system bus: %s", error->message);
g_error_free (error);
_pp_new_printer_add_async_cb (FALSE, printer);
return;
}
g_dbus_connection_call (bus,
MECHANISM_BUS,
"/",
MECHANISM_BUS,
priv->ppd_name ? "PrinterAdd" : "PrinterAddWithPpdFile",
g_variant_new ("(sssss)",
priv->name,
priv->device_uri,
priv->ppd_name ? priv->ppd_name : priv->ppd_file_name,
priv->info ? priv->info : "",
priv->location ? priv->location : ""),
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT,
NULL,
printer_add_real_async_dbus_cb,
printer);
}
开发者ID:koba290,项目名称:cinnamon-control-center,代码行数:40,代码来源:pp-new-printer.c
示例17: check_filters
static gboolean
check_filters (GVariant *value,
GError **error)
{
int i;
if (!check_value_type ("filters", value, G_VARIANT_TYPE ("a(sa(us))"), error))
return FALSE;
for (i = 0; i < g_variant_n_children (value); i++)
{
g_autoptr(GVariant) filter = g_variant_get_child_value (value, i);
if (!check_filter (filter, error))
{
g_prefix_error (error, "invalid filter: ");
return FALSE;
}
}
return TRUE;
}
开发者ID:amigadave,项目名称:xdg-desktop-portal,代码行数:22,代码来源:file-chooser.c
示例18: g_variant_builder_init
void RatingsFilter::UpdateState(float raw_rating)
{
if (!IsValid())
return;
bool new_filtering = raw_rating > 0.0f;
GVariantBuilder b;
g_variant_builder_init(&b, G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(&b, "{sv}", "rating", g_variant_new("d", raw_rating));
IgnoreChanges(true);
dee_model_set_value(model_,iter_,
FilterColumn::RENDERER_STATE,
g_variant_builder_end(&b));
dee_model_set_value(model_, iter_,
FilterColumn::FILTERING,
g_variant_new("b", new_filtering ? TRUE : FALSE));
IgnoreChanges(false);
filtering.EmitChanged(filtering);
}
开发者ID:jonjahren,项目名称:unity,代码行数:22,代码来源:RatingsFilter.cpp
示例19: prv_wl_notify_prop
static void prv_wl_notify_prop(dlr_manager_t *manager,
const gchar *prop_name,
GVariant *prop_val)
{
GVariant *val;
GVariantBuilder array;
g_variant_builder_init(&array, G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(&array, "{sv}", prop_name, prop_val);
val = g_variant_new("([email protected]{sv}as)", DLEYNA_SERVER_INTERFACE_MANAGER,
g_variant_builder_end(&array),
NULL);
(void) dlr_renderer_get_connector()->notify(
manager->connection,
DLEYNA_SERVER_OBJECT,
DLR_INTERFACE_PROPERTIES,
DLR_INTERFACE_PROPERTIES_CHANGED,
val,
NULL);
}
开发者ID:KobaltRo,项目名称:dleyna-renderer,代码行数:22,代码来源:manager.c
示例20: send_property_change
static void
send_property_change (SnappyMP * myobj,
GParamSpec * pspec, GDBusConnection * connection)
{
GVariantBuilder *builder;
GVariantBuilder *invalidated_builder;
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
if (g_strcmp0 (pspec->name, "name") == 0)
g_variant_builder_add (builder,
"{sv}", "Name", g_variant_new_string (myobj->name ? myobj->name : ""));
g_dbus_connection_emit_signal (connection,
NULL,
"org/mpris/MediaPlayer2",
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
g_variant_new ("(sa{sv}as)",
"org.mpris.MediaPlayer2", builder, invalidated_builder), NULL);
}
开发者ID:ylatuya,项目名称:snappy,代码行数:22,代码来源:dlna.c
注:本文中的G_VARIANT_TYPE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论