本文整理汇总了C++中G_DBUS_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_OBJECT函数的具体用法?C++ G_DBUS_OBJECT怎么用?C++ G_DBUS_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DBUS_OBJECT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: walk_block_parents
static gboolean
walk_block_parents (UDisksClient *client,
GDBusObjectManager *objman,
UDisksBlock *block,
ObjectWalker *walker,
gpointer user_data,
GError **error)
{
/* Parents are
- of a block that is a logical volume, the logical volume object
- of a clear text device, the encrypted device.
XXX - support the whole tree.
*/
while (block)
{
const gchar *path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (block));
LvmLogicalVolumeBlock *lvm_block =
LVM_LOGICAL_VOLUME_BLOCK (g_dbus_object_manager_get_interface (objman, path,
"com.redhat.lvm2.LogicalVolumeBlock"));
const gchar *logical_volume_path =
(lvm_block ? lvm_logical_volume_block_get_logical_volume (lvm_block) : "/");
const gchar *crypto_path = udisks_block_get_crypto_backing_device (block);
if (g_strcmp0 (logical_volume_path, "/") != 0)
{
gs_unref_object LvmObject *logical_volume_object =
LVM_OBJECT (g_dbus_object_manager_get_object (objman, logical_volume_path));
if (logical_volume_object)
{
if (!walker (client, G_DBUS_OBJECT (logical_volume_object), user_data, error))
return FALSE;
}
block = NULL;
}
else if (g_strcmp0 (crypto_path, "/") != 0)
{
UDisksObject *crypto_object = udisks_client_peek_object (client, crypto_path);
if (crypto_object)
{
if (!walker (client, G_DBUS_OBJECT (crypto_object), user_data, error))
return FALSE;
}
block = udisks_object_peek_block (crypto_object);
}
else
block = NULL;
}
return TRUE;
}
示例2: ensure_credentials_cb
static void
ensure_credentials_cb (GoaProvider *provider,
GAsyncResult *res,
gpointer user_data)
{
EnsureData *data = user_data;
gint expires_in;
GError *error;
error= NULL;
if (!goa_provider_ensure_credentials_finish (provider, &expires_in, res, &error))
{
/* Set AttentionNeeded only if the error is an authorization error */
if (is_authorization_error (error))
{
GoaAccount *account;
account = goa_object_peek_account (data->object);
if (!goa_account_get_attention_needed (account))
{
goa_account_set_attention_needed (account, TRUE);
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account));
g_message ("%s: Setting AttentionNeeded to TRUE because EnsureCredentials() failed with: %s (%s, %d)",
g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)),
error->message, g_quark_to_string (error->domain), error->code);
}
}
g_dbus_method_invocation_return_gerror (data->invocation, error);
g_error_free (error);
}
else
{
GoaAccount *account;
account = goa_object_peek_account (data->object);
/* Clear AttentionNeeded flag if set */
if (goa_account_get_attention_needed (account))
{
goa_account_set_attention_needed (account, FALSE);
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account));
g_message ("%s: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded\n",
g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)));
}
goa_account_complete_ensure_credentials (goa_object_peek_account (data->object),
data->invocation,
expires_in);
}
ensure_data_unref (data);
}
示例3: remove_modem
static void
remove_modem (MMManager *manager,
MMBaseModem *modem)
{
gchar *path;
gchar *device;
device = g_strdup (mm_base_modem_get_device (modem));
path = g_strdup (g_dbus_object_get_object_path (G_DBUS_OBJECT (modem)));
/* If we get DBus object path, modem was exported */
if (path) {
g_dbus_object_manager_server_unexport (manager->priv->object_manager, path);
g_object_set (modem,
MM_BASE_MODEM_CONNECTION, NULL,
NULL);
mm_dbg ("Unexported modem '%s' from path '%s'", device, path);
g_free (path);
} else {
mm_dbg ("Removing modem '%s', which wasn't exported yet", device);
}
/* Run dispose before unref-ing, in order to cleanup the SIM object,
* if any (which also holds a reference to the modem object) */
g_object_run_dispose (G_OBJECT (modem));
g_hash_table_remove (manager->priv->modems, device);
g_free (device);
}
示例4: g_dbus_object_manager_server_emit_interfaces_removed
static void
g_dbus_object_manager_server_emit_interfaces_removed (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 ("as"));
for (n = 0; interfaces[n] != NULL; n++)
g_variant_builder_add (&array_builder, "s", interfaces[n]);
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,
"InterfacesRemoved",
g_variant_new ("(oas)",
object_path,
&array_builder),
&error);
g_assert_no_error (error);
out:
;
}
示例5: wait_for_logical_volume_block_object
static UDisksObject *
wait_for_logical_volume_block_object (UDisksDaemon *daemon,
gpointer user_data)
{
UDisksLinuxLogicalVolumeObject *volume_object = user_data;
const gchar *volume_objpath;
GList *objects, *l;
UDisksObject *ret = NULL;
volume_objpath = g_dbus_object_get_object_path (G_DBUS_OBJECT (volume_object));
objects = udisks_daemon_get_objects (daemon);
for (l = objects; l != NULL; l = l->next)
{
UDisksObject *object = UDISKS_OBJECT (l->data);
UDisksBlockLVM2 *block;
block = udisks_object_peek_block_lvm2 (object);
if (block == NULL)
continue;
if (g_strcmp0 (udisks_block_lvm2_get_logical_volume (block), volume_objpath) == 0)
{
ret = g_object_ref (object);
goto out;
}
}
out:
g_list_free_full (objects, g_object_unref);
return ret;
}
示例6: cleanup_logical_volume_walker
static gboolean
cleanup_logical_volume_walker (GDBusObjectManager *objman,
LvmLogicalVolume *logical_volume,
gpointer user_data,
GError **error)
{
StorageProvider *provider = user_data;
UDisksBlock *block = lvm_util_peek_block_for_logical_volume (storage_provider_get_lvm_object_manager (provider),
storage_provider_get_udisks_client (provider),
logical_volume);
if (block)
{
/* The logical volume is active, let's clean it up by walking
the tree of block devices hanging off of it.
*/
return cleanup_block (provider, block, error);
}
else
{
/* The logical volume is inactive, let's clean it up by removing
the remembered configs from its children.
*/
LvmObject *object = LVM_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (logical_volume)));
GList *remembered_configs = storage_provider_get_and_forget_remembered_configs
(provider, g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
for (GList *l = remembered_configs; l; l = l->next)
{
GVariant *config = l->data;
storage_remove_config (provider, NULL, config);
}
g_list_free_full (remembered_configs, (GDestroyNotify)g_variant_unref);
return TRUE;
}
}
示例7: update_block
static void
update_block (StoragedLinuxBlockObject *block_object,
StoragedLinuxVolumeGroupObject *group_object,
GHashTable *new_lvs,
GHashTable *new_pvs)
{
StoragedBlock *block;
GVariant *pv_info;
block = storaged_object_peek_block (STORAGED_OBJECT (block_object));
if (block == NULL)
return;
// XXX - move this elsewhere?
{
StoragedLinuxDevice *device;
StoragedLinuxLogicalVolumeObject *lv_object;
const gchar *block_vg_name;
const gchar *block_lv_name;
device = storaged_linux_block_object_get_device (block_object);
if (device)
{
block_vg_name = g_udev_device_get_property (device->udev_device, "DM_VG_NAME");
block_lv_name = g_udev_device_get_property (device->udev_device, "DM_LV_NAME");
if (g_strcmp0 (block_vg_name, storaged_linux_volume_group_object_get_name (group_object)) == 0
&& (lv_object = g_hash_table_lookup (new_lvs, block_lv_name)))
{
block_object_update_lvm_iface (block_object, g_dbus_object_get_object_path (G_DBUS_OBJECT (lv_object)));
}
}
}
pv_info = g_hash_table_lookup (new_pvs, storaged_block_get_device (block));
if (!pv_info)
{
const gchar *const *symlinks;
int i;
symlinks = storaged_block_get_symlinks (block);
for (i = 0; symlinks[i]; i++)
{
pv_info = g_hash_table_lookup (new_pvs, symlinks[i]);
if (pv_info)
break;
}
}
if (pv_info)
{
storaged_linux_block_object_update_lvm_pv (block_object, group_object, pv_info);
}
else
{
StoragedPhysicalVolume *pv = storaged_object_peek_physical_volume (STORAGED_OBJECT (block_object));
if (pv && g_strcmp0 (storaged_physical_volume_get_volume_group (pv),
g_dbus_object_get_object_path (G_DBUS_OBJECT (group_object))) == 0)
storaged_linux_block_object_update_lvm_pv (block_object, NULL, NULL);
}
}
示例8: on_interface_proxy_properties_changed
static void
on_interface_proxy_properties_changed (GDBusObjectManager *manager,
GDBusObjectProxy *object_proxy,
GDBusProxy *interface_proxy,
GVariant *changed_properties,
const gchar * const *invalidated_properties,
gpointer user_data)
{
CockpitDBusJson1 *self = user_data;
cleanup_unref_object JsonBuilder *builder = prepare_builder ("interface-properties-changed");
json_builder_begin_object (builder);
json_builder_set_member_name (builder, "objpath");
json_builder_add_string_value (builder, g_dbus_object_get_object_path (G_DBUS_OBJECT (object_proxy)));
json_builder_set_member_name (builder, "iface_name");
json_builder_add_string_value (builder, g_dbus_proxy_get_interface_name (interface_proxy));
/* It's a bit of a waste to send all properties - would be cheaper to just
* send @changed_properties and @invalidated_properties. But this is simpler.
*/
json_builder_set_member_name (builder, "iface");
json_builder_begin_object (builder);
add_interface (builder, G_DBUS_INTERFACE (interface_proxy), changed_properties);
json_builder_end_object (builder);
json_builder_end_object (builder);
write_builder (self, builder);
}
示例9: enterprise_add_realm
static void
enterprise_add_realm (GisAccountPageEnterprise *page,
UmRealmObject *realm)
{
GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
GtkTreeIter iter;
gchar *name;
name = realm_get_name (realm);
/*
* Don't add a second realm if we already have one with this name.
* Sometimes realmd returns two realms for the same name, if it has
* different ways to use that realm. The first one that realmd
* returns is the one it prefers.
*/
if (!model_contains_realm (GTK_TREE_MODEL (priv->realms_model), name)) {
gtk_list_store_append (GTK_LIST_STORE (priv->realms_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (priv->realms_model), &iter,
0, name,
1, realm,
-1);
if (!priv->domain_chosen && um_realm_is_configured (realm))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->domain), &iter);
g_debug ("added realm to drop down: %s %s", name,
g_dbus_object_get_object_path (G_DBUS_OBJECT (realm)));
}
g_free (name);
}
示例10: handle_format_complete
static void
handle_format_complete (gpointer user_data)
{
struct FormatCompleteData *data = user_data;
storaged_partition_table_complete_create_partition
(data->table, data->invocation, g_dbus_object_get_object_path (G_DBUS_OBJECT (data->partition_object)));
}
示例11: housekeeping_all_drives
/* Runs in housekeeping thread - called without lock held */
static void
housekeeping_all_drives (UDisksLinuxProvider *provider,
guint secs_since_last)
{
GList *objects;
GList *l;
G_LOCK (provider_lock);
objects = g_hash_table_get_values (provider->vpd_to_drive);
g_list_foreach (objects, (GFunc) g_object_ref, NULL);
G_UNLOCK (provider_lock);
for (l = objects; l != NULL; l = l->next)
{
UDisksLinuxDriveObject *object = UDISKS_LINUX_DRIVE_OBJECT (l->data);
GError *error;
error = NULL;
if (!udisks_linux_drive_object_housekeeping (object,
secs_since_last,
NULL, /* TODO: cancellable */
&error))
{
udisks_warning ("Error performing housekeeping for drive %s: %s (%s, %d)",
g_dbus_object_get_object_path (G_DBUS_OBJECT (object)),
error->message, g_quark_to_string (error->domain), error->code);
g_error_free (error);
}
}
g_list_foreach (objects, (GFunc) g_object_unref, NULL);
g_list_free (objects);
}
示例12: handle_create_partition
/* runs in thread dedicated to handling @invocation */
static gboolean
handle_create_partition (StoragedPartitionTable *table,
GDBusMethodInvocation *invocation,
guint64 offset,
guint64 size,
const gchar *type,
const gchar *name,
GVariant *options)
{
StoragedObject *partition_object =
storaged_linux_partition_table_handle_create_partition (table,
invocation,
offset,
size,
type,
name,
options);
if (partition_object)
{
storaged_partition_table_complete_create_partition
(table, invocation, g_dbus_object_get_object_path (G_DBUS_OBJECT (partition_object)));
g_object_unref (partition_object);
}
return TRUE; /* returning TRUE means that we handled the method invocation */
}
示例13: storage_mdraid_update
void
storage_mdraid_update (StorageMDRaid *mdraid)
{
UDisksMDRaid *udisks_mdraid = mdraid->udisks_mdraid;
CockpitStorageMDRaid *iface = COCKPIT_STORAGE_MDRAID (mdraid);
StorageProvider *provider = storage_object_get_provider (mdraid->object);
UDisksClient *udisks_client = storage_provider_get_udisks_client (provider);
cockpit_storage_mdraid_set_uuid (iface, udisks_mdraid_get_uuid (udisks_mdraid));
cockpit_storage_mdraid_set_name (iface, udisks_mdraid_get_name (udisks_mdraid));
cockpit_storage_mdraid_set_level (iface, udisks_mdraid_get_level (udisks_mdraid));
cockpit_storage_mdraid_set_num_devices (iface, udisks_mdraid_get_num_devices (udisks_mdraid));
cockpit_storage_mdraid_set_size (iface, udisks_mdraid_get_size (udisks_mdraid));
cockpit_storage_mdraid_set_sync_action (iface, udisks_mdraid_get_sync_action (udisks_mdraid));
cockpit_storage_mdraid_set_sync_completed (iface, udisks_mdraid_get_sync_completed (udisks_mdraid));
cockpit_storage_mdraid_set_sync_rate (iface, udisks_mdraid_get_sync_rate (udisks_mdraid));
cockpit_storage_mdraid_set_sync_remaining_time (iface, udisks_mdraid_get_sync_remaining_time (udisks_mdraid));
cockpit_storage_mdraid_set_degraded (iface, udisks_mdraid_get_degraded (udisks_mdraid));
{
gs_free gchar *loc = g_locale_to_utf8 (udisks_mdraid_get_bitmap_location (udisks_mdraid),
-1, NULL, NULL, NULL);
cockpit_storage_mdraid_set_bitmap_location (iface, loc);
}
cockpit_storage_mdraid_set_chunk_size (iface, udisks_mdraid_get_chunk_size (udisks_mdraid));
GVariantBuilder devices;
g_variant_builder_init (&devices, G_VARIANT_TYPE("a(oiast)"));
GVariantIter iter;
gint disk_slot;
const gchar *disk_block_objpath;
gs_unref_variant GVariant *disk_states = NULL;
guint64 disk_num_errors;
g_variant_iter_init (&iter, udisks_mdraid_get_active_devices (udisks_mdraid));
while (g_variant_iter_next (&iter, "(&[email protected]{sv})",
&disk_block_objpath,
&disk_slot,
&disk_states,
&disk_num_errors,
NULL))
{
UDisksObject *udisks_object;
UDisksBlock *udisks_block;
StorageObject *object;
if ((udisks_object = udisks_client_peek_object (udisks_client, disk_block_objpath))
&& (udisks_block = udisks_object_peek_block (udisks_object))
&& (object = storage_provider_lookup_for_udisks_block (provider, udisks_block)))
{
g_variant_builder_add (&devices, "([email protected])",
g_dbus_object_get_object_path (G_DBUS_OBJECT(object)),
disk_slot,
disk_states,
disk_num_errors);
}
}
cockpit_storage_mdraid_set_active_devices (iface, g_variant_builder_end (&devices));
}
示例14: storage_daemon_unpublish
void
storage_daemon_unpublish (StorageDaemon *self,
const gchar *path,
gpointer thing)
{
GDBusObject *object;
gboolean unexport = FALSE;
GList *interfaces, *l;
g_return_if_fail (STORAGE_IS_DAEMON (self));
g_return_if_fail (path != NULL);
object = g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), path);
if (object == NULL)
return;
path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
if (G_IS_DBUS_INTERFACE (thing))
{
g_debug ("unpublishing interface: %s %s", path,
g_dbus_interface_get_info(thing)->name);
unexport = TRUE;
interfaces = g_dbus_object_get_interfaces (object);
for (l = interfaces; l != NULL; l = g_list_next (l))
{
if (G_DBUS_INTERFACE (l->data) != G_DBUS_INTERFACE (thing))
unexport = FALSE;
}
g_list_free_full (interfaces, g_object_unref);
/*
* HACK: GDBusObjectManagerServer is broken ... and sends InterfaceRemoved
* too many times, if you remove all interfaces manually, and then unexport
* a GDBusObject. So only do it here if we're not unexporting the object.
*/
if (!unexport)
g_dbus_object_skeleton_remove_interface (G_DBUS_OBJECT_SKELETON (object), thing);
else
g_debug ("(unpublishing object, too)");
}
else if (thing == NULL)
{
unexport = TRUE;
}
else
{
g_critical ("Unsupported type to unpublish: %s", G_OBJECT_TYPE_NAME (thing));
}
if (unexport)
g_dbus_object_manager_server_unexport (self->object_manager, path);
g_object_unref (object);
}
示例15: storaged_object_get_volume_group
/**
* storaged_object_get_volume_group:
* @object: A #StoragedObject.
*
* Gets the #StoragedVolumeGroup instance for the D-Bus interface <link linkend="gdbus-interface-org-storaged-Storaged-VolumeGroup.top_of_page">org.storaged.Storaged.VolumeGroup</link> on @object, if any.
*
* Returns: (transfer full): A #StoragedVolumeGroup that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
*/
StoragedVolumeGroup *
storaged_object_get_volume_group (StoragedObject *object)
{
GDBusInterface *ret;
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.storaged.Storaged.VolumeGroup");
if (ret == NULL)
return NULL;
return STORAGED_VOLUME_GROUP (ret);
}