• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ G_DBUS_OBJECT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中G_DBUS_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_OBJECT函数的具体用法?C++ G_DBUS_OBJECT怎么用?C++ G_DBUS_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了G_DBUS_OBJECT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:matthewgithub,项目名称:cockpit,代码行数:54,代码来源:storagemanager.c


示例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);
}
开发者ID:abprime,项目名称:gnome-online-accounts,代码行数:48,代码来源:goadaemon.c


示例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);
}
开发者ID:telemaco,项目名称:ModemManager,代码行数:29,代码来源:mm-manager.c


示例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:
  ;
}
开发者ID:dmatveev,项目名称:glib-gio-kqueue-integration,代码行数:32,代码来源:gdbusobjectmanagerserver.c


示例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;
}
开发者ID:cathay4t,项目名称:storaged,代码行数:32,代码来源:udiskslinuxlogicalvolume.c


示例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;
    }
}
开发者ID:matthewgithub,项目名称:cockpit,代码行数:34,代码来源:storagemanager.c


示例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);
    }
}
开发者ID:carriercomm,项目名称:storaged,代码行数:60,代码来源:storagedlinuxvolumegroupobject.c


示例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);
}
开发者ID:adrianobalani,项目名称:cockpit,代码行数:27,代码来源:cockpitdbusjson1.c


示例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);
}
开发者ID:GNOME,项目名称:gnome-initial-setup,代码行数:33,代码来源:gis-account-page-enterprise.c


示例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)));
}
开发者ID:frankzhao,项目名称:storaged,代码行数:7,代码来源:storagedlinuxpartitiontable.c


示例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);
}
开发者ID:GinoM,项目名称:eudisk,代码行数:34,代码来源:udiskslinuxprovider.c


示例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 */
}
开发者ID:frankzhao,项目名称:storaged,代码行数:28,代码来源:storagedlinuxpartitiontable.c


示例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));
}
开发者ID:remotesyssupport,项目名称:cockpit,代码行数:58,代码来源:storagemdraid.c


示例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);
}
开发者ID:mvollmer,项目名称:storaged,代码行数:58,代码来源:daemon.c


示例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);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:17,代码来源:storagedlvm2dbusutil.c


示例16: storaged_object_get_physical_volume

/**
 * storaged_object_get_physical_volume:
 * @object: A #StoragedObject.
 *
 * Gets the #StoragedPhysicalVolume instance for the D-Bus interface <link linkend="gdbus-interface-org-storaged-Storaged-PhysicalVolume.top_of_page">org.storaged.Storaged.PhysicalVolume</link> on @object, if any.
 *
 * Returns: (transfer full): A #StoragedPhysicalVolume that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
 */
StoragedPhysicalVolume *
storaged_object_get_physical_volume (StoragedObject *object)
{
  GDBusInterface *ret;
  ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.storaged.Storaged.PhysicalVolume");
  if (ret == NULL)
    return NULL;
  return STORAGED_PHYSICAL_VOLUME (ret);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:17,代码来源:storagedlvm2dbusutil.c


示例17: storaged_object_get_block_lvm2

/**
 * storaged_object_get_block_lvm2:
 * @object: A #StoragedObject.
 *
 * Gets the #StoragedBlockLVM2 instance for the D-Bus interface <link linkend="gdbus-interface-org-storaged-Storaged-Block-LVM2.top_of_page">org.storaged.Storaged.Block.LVM2</link> on @object, if any.
 *
 * Returns: (transfer full): A #StoragedBlockLVM2 that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
 */
StoragedBlockLVM2 *
storaged_object_get_block_lvm2 (StoragedObject *object)
{
  GDBusInterface *ret;
  ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.storaged.Storaged.Block.LVM2");
  if (ret == NULL)
    return NULL;
  return STORAGED_BLOCK_LVM2 (ret);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:17,代码来源:storagedlvm2dbusutil.c


示例18: storage_daemon_publish

void
storage_daemon_publish (StorageDaemon *self,
                        const gchar *path,
                        gboolean uniquely,
                        gpointer thing)
{
  GDBusInterface *prev;
  GDBusInterfaceInfo *info;
  GDBusObjectSkeleton *object;
  GQuark detail;

  g_return_if_fail (STORAGE_IS_DAEMON (self));
  g_return_if_fail (path != NULL);

  if (G_IS_DBUS_INTERFACE (thing))
    {
      g_debug ("%spublishing iface: %s %s", uniquely ? "uniquely " : "", path,
               g_dbus_interface_get_info(thing)->name);

      object = G_DBUS_OBJECT_SKELETON (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), path));
      if (object != NULL)
        {
          if (uniquely)
            {
              info = g_dbus_interface_get_info (thing);
              prev = g_dbus_object_get_interface (G_DBUS_OBJECT (object), info->name);
              if (prev)
                {
                  g_object_unref (prev);
                  g_object_unref (object);
                  object = NULL;
                }
            }
        }

      if (object == NULL)
          object = g_dbus_object_skeleton_new (path);

      g_dbus_object_skeleton_add_interface (object, thing);
    }
  else
    {
      g_critical ("Unsupported type to publish: %s", G_OBJECT_TYPE_NAME (thing));
      return;
    }

  if (uniquely)
    g_dbus_object_manager_server_export_uniquely (self->object_manager, object);
  else
    g_dbus_object_manager_server_export (self->object_manager, object);

  detail = g_quark_from_static_string (G_OBJECT_TYPE_NAME (thing));
  g_signal_emit (self, signals[PUBLISHED], detail, thing);

  g_object_unref (object);
}
开发者ID:mvollmer,项目名称:storaged,代码行数:56,代码来源:daemon.c


示例19: storaged_object_peek_logical_volume

/**
 * storaged_object_peek_logical_volume: (skip)
 * @object: A #StoragedObject.
 *
 * Like storaged_object_get_logical_volume() but doesn't increase the reference count on the returned object.
 *
 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
 *
 * Returns: (transfer none): A #StoragedLogicalVolume or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
 */
StoragedLogicalVolume *
storaged_object_peek_logical_volume (StoragedObject *object)
{
  GDBusInterface *ret;
  ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.storaged.Storaged.LogicalVolume");
  if (ret == NULL)
    return NULL;
  g_object_unref (ret);
  return STORAGED_LOGICAL_VOLUME (ret);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:20,代码来源:storagedlvm2dbusutil.c


示例20: print_objects

static void
print_objects (GDBusObjectManager *manager)
{
    GList *objects;
    GList *l;

    g_print ("Object manager at %s\n", g_dbus_object_manager_get_object_path (manager));
    objects = g_dbus_object_manager_get_objects (manager);
    for (l = objects; l != NULL; l = l->next)
    {
        ExampleObject *object = EXAMPLE_OBJECT (l->data);
        GList *interfaces;
        GList *ll;
        g_print (" - Object at %s\n", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));

        interfaces = g_dbus_object_get_interfaces (G_DBUS_OBJECT (object));
        for (ll = interfaces; ll != NULL; ll = ll->next)
        {
            GDBusInterface *interface = G_DBUS_INTERFACE (ll->data);
            g_print ("   - Interface %s\n", g_dbus_interface_get_info (interface)->name);

            /* Note that @interface is really a GDBusProxy instance - and additionally also
             * an ExampleAnimal or ExampleCat instance - either of these can be used to
             * invoke methods on the remote object. For example, the generated function
             *
             *  void example_animal_call_poke_sync (ExampleAnimal  *proxy,
             *                                      gboolean        make_sad,
             *                                      gboolean        make_happy,
             *                                      GCancellable   *cancellable,
             *                                      GError        **error);
             *
             * can be used to call the Poke() D-Bus method on the .Animal interface.
             * Additionally, the generated function
             *
             *  const gchar *example_animal_get_mood (ExampleAnimal *object);
             *
             * can be used to get the value of the :Mood property.
             */
        }
        g_list_free_full (interfaces, g_object_unref);
    }
    g_list_free_full (objects, g_object_unref);
}
开发者ID:xchataqua,项目名称:glib,代码行数:43,代码来源:gdbus-example-objectmanager-client.c



注:本文中的G_DBUS_OBJECT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_DBUS_OBJECT_SKELETON函数代码示例发布时间:2022-05-30
下一篇:
C++ G_DBUS_INTERFACE_SKELETON函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap