当前位置: 首页>>代码示例>>C++>>正文


C++ GET_PRIVATE函数代码示例

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


在下文中一共展示了GET_PRIVATE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: enum_files_cb

static void
enum_files_cb (GObject *obj, GAsyncResult *result, gpointer data)
{
	RBAndroidSource *source = RB_ANDROID_SOURCE (data);
	RBAndroidSourcePrivate *priv = GET_PRIVATE(source);
	GFileEnumerator *e = G_FILE_ENUMERATOR (obj);
	GError *error = NULL;
	GFileInfo *info;
	GList *files;
	GList *l;

	files = g_file_enumerator_next_files_finish (e, result, &error);
	if (error != NULL) {
		rb_debug ("error listing files: %s", error->message);
		music_dirs_done (source);
		return;
	}

	if (files == NULL) {
		priv->scanned++;
		g_object_unref (e);
		find_music_dirs (source);
		return;
	}

	for (l = files; l != NULL; l = l->next) {
		guint32 filetype;
		info = (GFileInfo *)l->data;

		filetype = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
		if (filetype == G_FILE_TYPE_DIRECTORY) {
			GFile *dir;
			if (priv->scanned == 0) {

				rb_debug ("got storage container %s", g_file_info_get_name (info));
				dir = g_file_get_child (g_file_enumerator_get_container (e), g_file_info_get_name (info));
				g_queue_push_tail (&priv->to_scan, dir);
			} else if (g_ascii_strcasecmp (g_file_info_get_name (info), "music") == 0) {
				GFile *storage;
				char *uri;

				storage = g_file_enumerator_get_container (e);
				dir = g_file_get_child (storage, g_file_info_get_name (info));
				uri = g_file_get_uri (dir);
				rb_debug ("music dir found at %s", uri);

				/* keep the container around for space/capacity calculation */
				priv->storage = g_list_append (priv->storage, dir);

				rhythmdb_import_job_add_uri (priv->import_job, uri);
				g_free (uri);
			}
		}

		g_object_unref (info);
	}

	g_list_free (files);

	g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (obj), 64, G_PRIORITY_DEFAULT, priv->cancel, enum_files_cb, source);
}
开发者ID:arnaudlecam,项目名称:rhythmbox,代码行数:61,代码来源:rb-android-source.c

示例2: as_icon_set_height

/**
 * as_icon_set_height:
 * @icon: a #AsIcon instance.
 * @height: the height in pixels.
 *
 * Sets the icon height.
 *
 * Since: 0.3.1
 **/
void
as_icon_set_height (AsIcon *icon, guint height)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	priv->height = height;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:15,代码来源:as-icon.c

示例3: as_icon_node_parse

/**
 * as_icon_node_parse:
 * @icon: a #AsIcon instance.
 * @node: a #GNode.
 * @ctx: a #AsNodeContext.
 * @error: A #GError or %NULL.
 *
 * Populates the object from a DOM node.
 *
 * Returns: %TRUE for success
 *
 * Since: 0.3.1
 **/
gboolean
as_icon_node_parse (AsIcon *icon, GNode *node,
		    AsNodeContext *ctx, GError **error)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	const gchar *tmp;
	guint size;
	gboolean prepend_size = TRUE;

	tmp = as_node_get_attribute (node, "type");
	as_icon_set_kind (icon, as_icon_kind_from_string (tmp));
	switch (priv->kind) {
	case AS_ICON_KIND_EMBEDDED:
		if (!as_icon_node_parse_embedded (icon, node, error))
			return FALSE;
		break;
	default:

		/* preserve the URL for remote icons */
		tmp = as_node_get_data (node);
		if (tmp == NULL) {
			g_set_error (error,
				     AS_ICON_ERROR,
				     AS_ICON_ERROR_FAILED,
				     "no data for icon of type %s",
				     as_icon_kind_to_string (priv->kind));
			return FALSE;
		}
		if (priv->kind == AS_ICON_KIND_REMOTE)
			as_icon_set_url (icon, tmp);
		else if (priv->kind == AS_ICON_KIND_LOCAL)
			as_icon_set_filename (icon, tmp);

		/* store the name without any prefix */
		if (g_strstr_len (tmp, -1, "/") == NULL) {
			as_icon_set_name (icon, tmp);
		} else {
			g_autofree gchar *basename = NULL;
			basename = g_path_get_basename (tmp);
			as_icon_set_name (icon, basename);
		}

		/* width is optional, assume 64px if missing */
		size = as_node_get_attribute_as_uint (node, "width");
		if (size == G_MAXUINT) {
			size = 64;
			prepend_size = FALSE;
		}
		priv->width = size;

		/* height is optional, assume 64px if missing */
		size = as_node_get_attribute_as_uint (node, "height");
		if (size == G_MAXUINT) {
			size = 64;
			prepend_size = FALSE;
		}
		priv->height = size;

		/* only use the size if the metadata has width and height */
		if (prepend_size) {
			g_free (priv->prefix_private);
			priv->prefix_private = g_strdup_printf ("%s/%ux%u",
								priv->prefix,
								priv->width,
								priv->height);
		}
		break;
	}

	return TRUE;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:84,代码来源:as-icon.c

示例4: as_icon_get_kind

/**
 * as_icon_get_kind:
 * @icon: a #AsIcon instance.
 *
 * Gets the icon kind.
 *
 * Returns: the #AsIconKind
 *
 * Since: 0.3.1
 **/
AsIconKind
as_icon_get_kind (AsIcon *icon)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	return priv->kind;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:16,代码来源:as-icon.c

示例5: as_icon_get_data

/**
 * as_icon_get_data:
 * @icon: a #AsIcon instance.
 *
 * Gets the icon data if set.
 *
 * Returns: (transfer none): the #GBytes, or %NULL
 *
 * Since: 0.3.1
 **/
GBytes *
as_icon_get_data (AsIcon *icon)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	return priv->data;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:16,代码来源:as-icon.c

示例6: as_icon_get_url

/**
 * as_icon_get_url:
 * @icon: a #AsIcon instance.
 *
 * Gets the full qualified URL for the icon, usually pointing at some mirror.
 * NOTE: This is only set for icons of type %AS_ICON_KIND_REMOTE
 *
 * Returns: the fully qualified URL
 *
 * Since: 0.3.2
 **/
const gchar *
as_icon_get_url (AsIcon *icon)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	return priv->url;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:17,代码来源:as-icon.c

示例7: as_icon_get_width

/**
 * as_icon_get_width:
 * @icon: a #AsIcon instance.
 *
 * Gets the icon width.
 *
 * Returns: width in pixels
 *
 * Since: 0.3.1
 **/
guint
as_icon_get_width (AsIcon *icon)
{
	AsIconPrivate *priv = GET_PRIVATE (icon);
	return priv->width;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:16,代码来源:as-icon.c

示例8: as_require_get_kind

/**
 * as_require_get_kind:
 * @require: a #AsRequire instance.
 *
 * Gets the require kind.
 *
 * Returns: the #AsRequireKind
 *
 * Since: 0.6.7
 **/
AsRequireKind
as_require_get_kind (AsRequire *require)
{
	AsRequirePrivate *priv = GET_PRIVATE (require);
	return priv->kind;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:16,代码来源:as-require.c

示例9: as_require_set_kind

/**
 * as_require_set_kind:
 * @require: a #AsRequire instance.
 * @kind: the #AsRequireKind, e.g. %AS_REQUIRE_KIND_ID.
 *
 * Sets the require kind.
 *
 * Since: 0.6.7
 **/
void
as_require_set_kind (AsRequire *require, AsRequireKind kind)
{
	AsRequirePrivate *priv = GET_PRIVATE (require);
	priv->kind = kind;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:15,代码来源:as-require.c

示例10: as_require_get_version

/**
 * as_require_get_version:
 * @require: a #AsRequire instance.
 *
 * Gets the require version if set.
 *
 * Returns: the version, e.g. "0.1.2"
 *
 * Since: 0.6.7
 **/
const gchar *
as_require_get_version (AsRequire *require)
{
	AsRequirePrivate *priv = GET_PRIVATE (require);
	return priv->version;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:16,代码来源:as-require.c

示例11: as_require_get_value

/**
 * as_require_get_value:
 * @require: a #AsRequire instance.
 *
 * Gets the require value if set.
 *
 * Returns: the value, e.g. "bootloader"
 *
 * Since: 0.6.7
 **/
const gchar *
as_require_get_value (AsRequire *require)
{
	AsRequirePrivate *priv = GET_PRIVATE (require);
	return priv->value;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:16,代码来源:as-require.c

示例12: impl_build_dest_uri

static char *
impl_build_dest_uri (RBTransferTarget *target,
		     RhythmDBEntry *entry,
		     const char *media_type,
		     const char *extension)
{
	RBAndroidSourcePrivate *priv = GET_PRIVATE (target);
	const char *in_artist;
	char *artist, *album, *title;
	gulong track_number, disc_number;
	char *number;
	char *file = NULL;
	char *storage_uri;
	char *uri;
	char *ext;
	GFile *storage = NULL;

	if (extension != NULL) {
		ext = g_strconcat (".", extension, NULL);
	} else {
		ext = g_strdup ("");
	}

	in_artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM_ARTIST);
	if (in_artist[0] == '\0') {
		in_artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
	}
	artist = sanitize_path (in_artist);
	album = sanitize_path (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM));
	title = sanitize_path (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE));

	/* we really do need to fix this so untagged entries actually have NULL rather than
	 * a translated string.
	 */
	if (strcmp (artist, _("Unknown")) == 0 && strcmp (album, _("Unknown")) == 0 &&
	    g_str_has_suffix (rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), title)) {
		/* file isn't tagged, so just use the filename as-is, replacing the extension */
		char *p;

		p = g_utf8_strrchr (title, -1, '.');
		if (p != NULL) {
			*p = '\0';
		}
		file = g_strdup_printf ("%s%s", title, ext);
	}

	if (file == NULL) {
		track_number = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TRACK_NUMBER);
		disc_number = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DISC_NUMBER);
		if (disc_number > 0)
			number = g_strdup_printf ("%.02u.%.02u", (guint)disc_number, (guint)track_number);
		else
			number = g_strdup_printf ("%.02u", (guint)track_number);

		/* artist/album/number - title */
		file = g_strdup_printf (G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s%%20-%%20%s%s",
					artist, album, number, title, ext);
		g_free (number);
	}

	g_free (artist);
	g_free (album);
	g_free (title);
	g_free (ext);

	/* pick storage container to use somehow
	for (l = priv->storage; l != NULL; l = l->next) {
	}
	*/
	if (priv->storage)
		storage = priv->storage->data;

	if (storage == NULL) {
		rb_debug ("couldn't find a container to store anything in");
		g_free (file);
		return NULL;
	}

	storage_uri = g_file_get_uri (storage);
	uri = g_strconcat (storage_uri, file, NULL);
	g_free (file);
	g_free (storage_uri);

	return uri;
}
开发者ID:arnaudlecam,项目名称:rhythmbox,代码行数:85,代码来源:rb-android-source.c

示例13: impl_get_free_space

static guint64
impl_get_free_space (RBMediaPlayerSource *source)
{
	RBAndroidSourcePrivate *priv = GET_PRIVATE(source);
	return priv->storage_free_space;
}
开发者ID:arnaudlecam,项目名称:rhythmbox,代码行数:6,代码来源:rb-android-source.c

示例14: impl_get_capacity

static guint64
impl_get_capacity (RBMediaPlayerSource *source)
{
	RBAndroidSourcePrivate *priv = GET_PRIVATE(source);
	return priv->storage_capacity;
}
开发者ID:arnaudlecam,项目名称:rhythmbox,代码行数:6,代码来源:rb-android-source.c

示例15: fwupd_remote_set_report_uri

static void
fwupd_remote_set_report_uri (FwupdRemote *self, const gchar *report_uri)
{
	FwupdRemotePrivate *priv = GET_PRIVATE (self);
	priv->report_uri = g_strdup (report_uri);
}
开发者ID:vathpela,项目名称:fwupd,代码行数:6,代码来源:fwupd-remote.c


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