本文整理汇总了C++中GET_PRIVATE函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_PRIVATE函数的具体用法?C++ GET_PRIVATE怎么用?C++ GET_PRIVATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_PRIVATE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: as_require_get_compare
/**
* as_require_get_compare:
* @require: a #AsRequire instance.
*
* Gets the require version comparison type.
*
* Returns: the #AsRequireKind
*
* Since: 0.6.7
**/
AsRequireCompare
as_require_get_compare (AsRequire *require)
{
AsRequirePrivate *priv = GET_PRIVATE (require);
return priv->compare;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:16,代码来源:as-require.c
示例17: fwupd_remote_load_from_filename
/**
* fwupd_remote_load_from_filename:
* @self: A #FwupdRemote
* @filename: A filename
* @cancellable: the #GCancellable, or %NULL
* @error: the #GError, or %NULL
*
* Sets up the remote ready for use. Most other methods call this
* for you, and do you only need to call this if you are just watching
* the self.
*
* Returns: %TRUE for success
*
* Since: 0.9.3
**/
gboolean
fwupd_remote_load_from_filename (FwupdRemote *self,
const gchar *filename,
GCancellable *cancellable,
GError **error)
{
FwupdRemotePrivate *priv = GET_PRIVATE (self);
const gchar *group = "fwupd Remote";
g_autofree gchar *firmware_base_uri = NULL;
g_autofree gchar *id = NULL;
g_autofree gchar *keyring_kind = NULL;
g_autofree gchar *metadata_uri = NULL;
g_autofree gchar *order_after = NULL;
g_autofree gchar *order_before = NULL;
g_autofree gchar *report_uri = NULL;
g_autoptr(GKeyFile) kf = NULL;
g_return_val_if_fail (FWUPD_IS_REMOTE (self), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* set ID */
id = g_path_get_basename (filename);
fwupd_remote_set_id (self, id);
/* load file */
kf = g_key_file_new ();
if (!g_key_file_load_from_file (kf, filename, G_KEY_FILE_NONE, error))
return FALSE;
/* get verification type, falling back to GPG */
keyring_kind = g_key_file_get_string (kf, group, "Keyring", NULL);
if (keyring_kind == NULL) {
priv->keyring_kind = FWUPD_KEYRING_KIND_GPG;
} else {
priv->keyring_kind = fwupd_keyring_kind_from_string (keyring_kind);
if (priv->keyring_kind == FWUPD_KEYRING_KIND_UNKNOWN) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"Failed to parse type '%s'",
keyring_kind);
return FALSE;
}
}
/* all remotes need a URI, even if it's file:// to the cache */
metadata_uri = g_key_file_get_string (kf, group, "MetadataURI", error);
if (metadata_uri == NULL)
return FALSE;
if (g_str_has_prefix (metadata_uri, "file://")) {
const gchar *filename_cache = metadata_uri;
if (g_str_has_prefix (filename_cache, "file://"))
filename_cache += 7;
fwupd_remote_set_filename_cache (self, filename_cache);
if (g_file_test (filename_cache, G_FILE_TEST_IS_DIR))
priv->kind = FWUPD_REMOTE_KIND_DIRECTORY;
else
priv->kind = FWUPD_REMOTE_KIND_LOCAL;
} else if (g_str_has_prefix (metadata_uri, "http://") ||
g_str_has_prefix (metadata_uri, "https://")) {
priv->kind = FWUPD_REMOTE_KIND_DOWNLOAD;
} else {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"Failed to parse MetadataURI type '%s'",
metadata_uri);
return FALSE;
}
/* extract data */
priv->enabled = g_key_file_get_boolean (kf, group, "Enabled", NULL);
priv->approval_required = g_key_file_get_boolean (kf, group, "ApprovalRequired", NULL);
priv->title = g_key_file_get_string (kf, group, "Title", NULL);
/* reporting is optional */
report_uri = g_key_file_get_string (kf, group, "ReportURI", NULL);
if (report_uri != NULL && report_uri[0] != '\0')
fwupd_remote_set_report_uri (self, report_uri);
/* DOWNLOAD-type remotes */
if (priv->kind == FWUPD_REMOTE_KIND_DOWNLOAD) {
g_autofree gchar *filename_cache = NULL;
//.........这里部分代码省略.........
开发者ID:vathpela,项目名称:fwupd,代码行数:101,代码来源:fwupd-remote.c
示例18: as_require_set_compare
/**
* as_require_set_compare:
* @require: a #AsRequire instance.
* @compare: the #AsRequireKind, e.g. %AS_REQUIRE_KIND_ID.
*
* Sets the require version comparison type.
*
* Since: 0.6.7
**/
void
as_require_set_compare (AsRequire *require, AsRequireCompare compare)
{
AsRequirePrivate *priv = GET_PRIVATE (require);
priv->compare = compare;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:15,代码来源:as-require.c
示例19: as_icon_get_filename
/**
* as_icon_get_filename:
* @icon: a #AsIcon instance.
*
* Gets the absolute path on disk of the icon.
* NOTE: This is only set for icons of type %AS_ICON_KIND_LOCAL
*
* Returns: the absolute filename on disk
*
* Since: 0.3.2
**/
const gchar *
as_icon_get_filename (AsIcon *icon)
{
AsIconPrivate *priv = GET_PRIVATE (icon);
return priv->filename;
}
开发者ID:fedora-copr,项目名称:appstream-glib,代码行数:17,代码来源:as-icon.c
示例20: as_require_version_compare
/**
* as_require_version_compare:
* @require: a #AsRequire instance.
* @version: a version number, e.g. `0.1.3`
* @error: A #GError or %NULL
*
* Compares the version number of the requirement with a predicate.
*
* Returns: %TRUE if the predicate was true
*
* Since: 0.6.7
**/
gboolean
as_require_version_compare (AsRequire *require,
const gchar *version,
GError **error)
{
AsRequirePrivate *priv = GET_PRIVATE (require);
gboolean ret = FALSE;
gint rc = 0;
switch (priv->compare) {
case AS_REQUIRE_COMPARE_EQ:
rc = as_utils_vercmp (version, priv->version);
ret = rc == 0;
break;
case AS_REQUIRE_COMPARE_NE:
rc = as_utils_vercmp (version, priv->version);
ret = rc != 0;
break;
case AS_REQUIRE_COMPARE_LT:
rc = as_utils_vercmp (version, priv->version);
ret = rc < 0;
break;
case AS_REQUIRE_COMPARE_GT:
rc = as_utils_vercmp (version, priv->version);
ret = rc > 0;
break;
case AS_REQUIRE_COMPARE_LE:
rc = as_utils_vercmp (version, priv->version);
ret = rc <= 0;
break;
case AS_REQUIRE_COMPARE_GE:
rc = as_utils_vercmp (version, priv->version);
ret = rc >= 0;
break;
case AS_REQUIRE_COMPARE_GLOB:
ret = fnmatch (priv->version, version, 0) == 0;
break;
case AS_REQUIRE_COMPARE_REGEX:
ret = g_regex_match_simple (priv->version, version, 0, 0);
break;
default:
break;
}
/* could not compare */
if (rc == G_MAXINT) {
g_set_error (error,
AS_UTILS_ERROR,
AS_UTILS_ERROR_FAILED,
"failed to compare [%s] and [%s]",
priv->version,
version);
return FALSE;
}
/* set error */
if (!ret && error != NULL) {
g_set_error (error,
AS_UTILS_ERROR,
AS_UTILS_ERROR_FAILED,
"failed predicate [%s %s %s]",
priv->version,
as_require_compare_to_string (priv->compare),
version);
}
return ret;
}
开发者ID:DimStar77,项目名称:appstream-glib,代码行数:79,代码来源:as-require.c
注:本文中的GET_PRIVATE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论