1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Jonathan Matthew <jonathan@d14n.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The Rhythmbox authors hereby grant permission for non-GPL compatible
* GStreamer plugins to be used and distributed together with GStreamer
* and Rhythmbox. This permission is above and beyond the permissions granted
* by the GPL license by which Rhythmbox is covered. If you modify this code
* you may extend this exception to your version of the code, but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include "rhythmdb-entry-type.h"
#include "rhythmdb-metadata-cache.h"
#include "rhythmdb-private.h"
#include <metadata/rb-ext-db-key.h>
#include "rb-util.h"
enum
{
PROP_0,
PROP_DB,
PROP_NAME,
PROP_SAVE_TO_DISK,
PROP_TYPE_DATA_SIZE,
PROP_CATEGORY,
PROP_CACHE_NAME
};
static void rhythmdb_entry_type_class_init (RhythmDBEntryTypeClass *klass);
static void rhythmdb_entry_type_init (RhythmDBEntryType *etype);
struct _RhythmDBEntryTypePrivate
{
RhythmDB *db;
char *name;
gboolean save_to_disk;
guint entry_type_data_size;
RhythmDBEntryCategory category;
char *cache_name;
RhythmDBMetadataCache *cache;
};
G_DEFINE_TYPE (RhythmDBEntryType, rhythmdb_entry_type, G_TYPE_OBJECT)
/**
* SECTION:rhythmdbentrytype
* @short_description: Database entry type base class
*
* This is the base class for database entry type classes, which provide
* some aspects of the behaviour of database entry types. There are different
* entry types for songs, radio streams, podcast feeds and episodes, and so on.
*
* Plugins written in Python or Vala can create new entry types by subclassing
* and overriding any methods required. Plugins written in C can create a new
* instance of the RhythmDBEntryType base class and use its function pointer
* members rather than subclassing.
*/
/**
* rhythmdb_entry_type_get_name:
* @etype: a #RhythmDBEntryType
*
* Returns the name of the entry type
*
* Return value: entry type name
*/
const char *
rhythmdb_entry_type_get_name (RhythmDBEntryType *etype)
{
return etype->priv->name;
}
/**
* rhythmdb_entry_get_playback_uri:
* @entry: a #RhythmDBEntry
*
* Returns an allocated string containing the playback URI for @entry,
* or NULL if the entry cannot be played.
*
* Return value: playback URI or NULL
*/
char *
rhythmdb_entry_get_playback_uri (RhythmDBEntry *entry)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->get_playback_uri) {
return (klass->get_playback_uri) (etype, entry);
} else {
return rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_LOCATION);
}
}
/**
* rhythmdb_entry_update_availability:
* @entry: a #RhythmDBEntry
* @avail: an availability event
*
* Updates @entry to reflect its new availability.
*/
void
rhythmdb_entry_update_availability (RhythmDBEntry *entry, RhythmDBEntryAvailability avail)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->update_availability) {
(klass->update_availability) (etype, entry, avail);
} else {
/* do nothing? */
}
}
/**
* rhythmdb_entry_created:
* @entry: a newly created #RhythmDBEntry
*
* Calls the entry type's post-creation method for @entry.
*/
void
rhythmdb_entry_created (RhythmDBEntry *entry)
{
RhythmDBEntryType *etype;
RhythmDBEntryTypeClass *klass;
etype = rhythmdb_entry_get_entry_type (entry);
klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->entry_created) {
klass->entry_created (etype, entry);
}
}
/**
* rhythmdb_entry_pre_destroy:
* @entry: a #RhythmDBEntry
*
* Calls the entry type's pre-deletion method for @entry.
*/
void
rhythmdb_entry_pre_destroy (RhythmDBEntry *entry)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->destroy_entry) {
klass->destroy_entry (etype, entry);
}
}
/**
* rhythmdb_entry_can_sync_metadata:
* @entry: a #RhythmDBEntry
*
* Calls the entry type's method to check if it can sync metadata for @entry.
* Usually this is only true for entries backed by files, where tag-writing is
* enabled, and the appropriate tag-writing facilities are available.
*
* Return value: %TRUE if the entry can be synced
*/
gboolean
rhythmdb_entry_can_sync_metadata (RhythmDBEntry *entry)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->can_sync_metadata) {
return klass->can_sync_metadata (etype, entry);
} else {
return FALSE;
}
}
/**
* rhythmdb_entry_sync_metadata:
* @entry: a #RhythmDBEntry
* @changes: (element-type RB.RhythmDBEntryChange): a list of #RhythmDBEntryChange structures
* @error: returns error information
*
* Calls the entry type's method to sync metadata changes for @entry.
*/
void
rhythmdb_entry_sync_metadata (RhythmDBEntry *entry, GSList *changes, GError **error)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->sync_metadata) {
klass->sync_metadata (etype, entry, changes, error);
} else {
/* default implementation? */
}
}
/**
* rhythmdb_entry_type_fetch_metadata:
* @etype: a #RhythmDBEntryType
* @uri: uri of the item to fetch
* @metadata: (element-type RhythmDBEntryChange): returns fetched metadata
*
* Fetches metadata for a URI (not an entry yet, at this point) from a cache, if possible.
*
* The @metadata array contains RhythmDBEntryChange items with just the 'new' value set.
*
* Return value: %TRUE if metadata is returned
*/
gboolean
rhythmdb_entry_type_fetch_metadata (RhythmDBEntryType *etype, const char *uri, GArray *metadata)
{
char *key;
gboolean result;
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->uri_to_cache_key == NULL) {
return FALSE;
}
key = klass->uri_to_cache_key (etype, uri);
if (key == NULL)
return FALSE;
result = rhythmdb_metadata_cache_load (etype->priv->cache, key, metadata);
g_free (key);
return result;
}
/**
* rhythmdb_entry_cache_metadata:
* @entry: a #RhythmDBEntry
*
* Stores metadata for @entry in the metadata cache (if any) for its entry type.
*/
void
rhythmdb_entry_cache_metadata (RhythmDBEntry *entry)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
char *key;
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (klass->uri_to_cache_key == NULL) {
return;
}
key = klass->uri_to_cache_key (etype, rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
if (key == NULL)
return;
rhythmdb_metadata_cache_store (etype->priv->cache, key, entry);
}
static RhythmDBPropType default_unknown_properties[] = {
RHYTHMDB_PROP_GENRE,
RHYTHMDB_PROP_ARTIST,
RHYTHMDB_PROP_ALBUM,
RHYTHMDB_PROP_COMPOSER
};
/**
* rhythmdb_entry_apply_cached_metadata:
* @entry: a #RhythmDBEntry
* @metadata: (element-type RhythmDBEntryChange): cached metadata to apply
*
* Applies a set of metadata properties to @entry. The metadata should be in the
* form returned by @rhythmdb_entry_type_fetch_metadata.
*/
void
rhythmdb_entry_apply_cached_metadata (RhythmDBEntry *entry, GArray *metadata)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryChange *fields;
GValue unknown = {0,};
int i;
g_value_init (&unknown, G_TYPE_STRING);
g_value_set_string (&unknown, _("Unknown"));
for (i = 0; i < G_N_ELEMENTS(default_unknown_properties); i++) {
rhythmdb_entry_set_internal (etype->priv->db, entry, TRUE, default_unknown_properties[i], &unknown);
}
g_value_unset (&unknown);
fields = (RhythmDBEntryChange *)metadata->data;
for (i = 0; i < metadata->len; i++) {
rhythmdb_entry_set_internal (etype->priv->db, entry, TRUE, fields[i].prop, &fields[i].new);
}
rhythmdb_commit (etype->priv->db);
}
static gboolean
metadata_key_valid_cb (const char *key, RhythmDBEntryType *etype)
{
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
char *uri;
gboolean result = FALSE; /* or maybe true? */
uri = klass->cache_key_to_uri (etype, key);
if (uri != NULL) {
RhythmDBEntry *entry;
entry = rhythmdb_entry_lookup_by_location (etype->priv->db, uri);
result = (entry != NULL);
}
g_free (uri);
return result;
}
/**
* rhythmdb_entry_type_purge_metadata_cache:
* @etype: a #RhythmDBEntryType
* @prefix: a cache key prefix to scan
* @max_age: maximum age of missing entries to keep
*/
void
rhythmdb_entry_type_purge_metadata_cache (RhythmDBEntryType *etype, const char *prefix, guint64 max_age)
{
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
g_assert (klass->cache_key_to_uri != NULL);
g_assert (etype->priv->cache != NULL);
rhythmdb_metadata_cache_purge (etype->priv->cache,
prefix,
max_age,
(RhythmDBMetadataCacheValidFunc) metadata_key_valid_cb,
etype,
NULL);
}
/**
* rhythmdb_entry_create_ext_db_key:
* @entry: a #RhythmDBEntry
* @prop: the primary #RhythmDBPropType for metadata lookups
*
* Creates a #RBExtDBKey for finding external metadata
* for a given property. This is mostly useful for finding album or
* track related data.
*
* Return value: the new #RBExtDBKey
*/
RBExtDBKey *
rhythmdb_entry_create_ext_db_key (RhythmDBEntry *entry, RhythmDBPropType prop)
{
RhythmDBEntryType *etype = rhythmdb_entry_get_entry_type (entry);
RhythmDBEntryTypeClass *klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
RBExtDBKey *key;
const char *str;
if (klass->create_ext_db_key)
return klass->create_ext_db_key (etype, entry, prop);
switch (prop) {
case RHYTHMDB_PROP_ALBUM:
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
key = rb_ext_db_key_create_lookup ("album", str);
rb_ext_db_key_add_field (key,
"artist",
rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST));
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM_ARTIST);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
rb_ext_db_key_add_field (key, "artist", str);
}
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MUSICBRAINZ_ALBUMID);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
rb_ext_db_key_add_info (key, "musicbrainz-albumid", str);
}
break;
}
/* fall through if there's no album information */
case RHYTHMDB_PROP_TITLE:
key = rb_ext_db_key_create_lookup ("title", rhythmdb_entry_get_string (entry, prop));
/* maybe these should be info? */
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
rb_ext_db_key_add_field (key, "artist", str);
}
str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
rb_ext_db_key_add_field (key, "album", str);
}
break;
case RHYTHMDB_PROP_ARTIST:
/* not really sure what this might be useful for */
key = rb_ext_db_key_create_lookup ("artist", rhythmdb_entry_get_string (entry, prop));
break;
default:
g_assert_not_reached ();
}
rb_ext_db_key_add_info (key, "location", rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
return key;
}
static void
rhythmdb_entry_type_init (RhythmDBEntryType *etype)
{
etype->priv = G_TYPE_INSTANCE_GET_PRIVATE (etype,
RHYTHMDB_TYPE_ENTRY_TYPE,
RhythmDBEntryTypePrivate);
}
static void
impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
RhythmDBEntryType *etype = RHYTHMDB_ENTRY_TYPE (object);
switch (prop_id) {
case PROP_DB:
etype->priv->db = g_value_get_object (value);
break;
case PROP_NAME:
etype->priv->name = g_value_dup_string (value);
break;
case PROP_SAVE_TO_DISK:
etype->priv->save_to_disk = g_value_get_boolean (value);
break;
case PROP_TYPE_DATA_SIZE:
etype->priv->entry_type_data_size = g_value_get_uint (value);
break;
case PROP_CATEGORY:
etype->priv->category = g_value_get_enum (value);
break;
case PROP_CACHE_NAME:
etype->priv->cache_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
RhythmDBEntryType *etype = RHYTHMDB_ENTRY_TYPE (object);
switch (prop_id) {
case PROP_DB:
g_value_set_object (value, etype->priv->db);
break;
case PROP_NAME:
g_value_set_string (value, etype->priv->name);
break;
case PROP_SAVE_TO_DISK:
g_value_set_boolean (value, etype->priv->save_to_disk);
break;
case PROP_TYPE_DATA_SIZE:
g_value_set_uint (value, etype->priv->entry_type_data_size);
break;
case PROP_CATEGORY:
g_value_set_enum (value, etype->priv->category);
break;
case PROP_CACHE_NAME:
g_value_set_string (value, etype->priv->cache_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
impl_constructed (GObject *object)
{
RhythmDBEntryType *etype;
RhythmDBEntryTypeClass *klass;
RB_CHAIN_GOBJECT_METHOD (rhythmdb_entry_type_parent_class, constructed, object);
etype = RHYTHMDB_ENTRY_TYPE (object);
klass = RHYTHMDB_ENTRY_TYPE_GET_CLASS (etype);
if (etype->priv->cache_name) {
g_assert (klass->uri_to_cache_key != NULL);
etype->priv->cache = rhythmdb_metadata_cache_get (etype->priv->db, etype->priv->cache_name);
}
}
static void
impl_dispose (GObject *object)
{
RhythmDBEntryType *etype = RHYTHMDB_ENTRY_TYPE (object);
g_clear_object (&etype->priv->cache);
G_OBJECT_CLASS (rhythmdb_entry_type_parent_class)->dispose (object);
}
static void
impl_finalize (GObject *object)
{
RhythmDBEntryType *etype = RHYTHMDB_ENTRY_TYPE (object);
g_free (etype->priv->name);
g_free (etype->priv->cache_name);
G_OBJECT_CLASS (rhythmdb_entry_type_parent_class)->finalize (object);
}
static void
rhythmdb_entry_type_class_init (RhythmDBEntryTypeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = impl_set_property;
object_class->get_property = impl_get_property;
object_class->constructed = impl_constructed;
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
/**
* RhythmDBEntryType:db:
*
* The #RhythmDB instance.
*/
g_object_class_install_property (object_class,
PROP_DB,
g_param_spec_object ("db",
"RhythmDB",
"RhythmDB instance",
RHYTHMDB_TYPE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* RhythmDBEntryType:name:
*
* Entry type name. This must be unique.
*/
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
"name",
"entry type name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* RhythmDBEntryType:save-to-disk:
*
* If %TRUE, entries of this type should be written to the
* on-disk database.
*/
g_object_class_install_property (object_class,
PROP_SAVE_TO_DISK,
g_param_spec_boolean ("save-to-disk",
"save to disk",
"whether to save this type of entry to disk",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* RhythmDBEntryType:type-data-size:
*
* The size of the type-specific data structure to allocate for each
* entry of this type.
*/
g_object_class_install_property (object_class,
PROP_TYPE_DATA_SIZE,
g_param_spec_uint ("type-data-size",
"type data size",
"size of entry type specific data",
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* RhythmDBEntryType:category:
*
* The #RhythmDBEntryCategory that this entry type fits into.
*/
g_object_class_install_property (object_class,
PROP_CATEGORY,
g_param_spec_enum ("category",
"category",
"RhythmDBEntryCategory for the entry type",
RHYTHMDB_TYPE_ENTRY_CATEGORY,
RHYTHMDB_ENTRY_NORMAL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* RhythmDBEntryType:cache-name:
*
* Metadata cache name. For entry types created by a plugin, should match the plugin name.
* If this is set, the entry type must also implement the uri_to_cache_key method.
*/
g_object_class_install_property (object_class,
PROP_CACHE_NAME,
g_param_spec_string ("cache-name",
"cache name",
"metadata cache name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (klass, sizeof (RhythmDBEntryTypePrivate));
}
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
/**
* RhythmDBEntryCategory:
* @RHYTHMDB_ENTRY_NORMAL: Normal files on disk
* @RHYTHMDB_ENTRY_STREAM: Endless streams (eg shoutcast)
* @RHYTHMDB_ENTRY_CONTAINER: Containers for other entries (eg podcast feeds)
* @RHYTHMDB_ENTRY_VIRTUAL: Things Rhythmbox shouldn't normally deal with
*
* Categories used to group entry types. These are used in a few places to control
* handling of entries.
*/
GType
rhythmdb_entry_category_get_type (void)
{
static GType etype = 0;
if (etype == 0)
{
static const GEnumValue values[] =
{
ENUM_ENTRY (RHYTHMDB_ENTRY_NORMAL, "normal"),
ENUM_ENTRY (RHYTHMDB_ENTRY_STREAM, "stream"),
ENUM_ENTRY (RHYTHMDB_ENTRY_CONTAINER, "container"),
ENUM_ENTRY (RHYTHMDB_ENTRY_VIRTUAL, "virtual"),
{ 0, 0, 0 }
};
etype = g_enum_register_static ("RhythmDBEntryCategory", values);
}
return etype;
}
/**
* RhythmDBEntryAvailability:
* @RHYTHMDB_ENTRY_AVAIL_CHECKED: File was checked and found present
* @RHYTHMDB_ENTRY_AVAIL_MOUNTED: Filesystem holding the file was mounted
* @RHYTHMDB_ENTRY_AVAIL_UNMOUNTED: Filesystem holding the file was unmounted
* @RHYTHMDB_ENTRY_AVAIL_NOT_FOUND: File was checked or played and could not be found
*
* Various events that can result in changes to the entry's availability.
*/
GType
rhythmdb_entry_availability_get_type (void)
{
static GType etype = 0;
if (etype == 0)
{
static const GEnumValue values[] =
{
ENUM_ENTRY (RHYTHMDB_ENTRY_AVAIL_CHECKED, "checked"),
ENUM_ENTRY (RHYTHMDB_ENTRY_AVAIL_MOUNTED, "mounted"),
ENUM_ENTRY (RHYTHMDB_ENTRY_AVAIL_UNMOUNTED, "unmounted"),
ENUM_ENTRY (RHYTHMDB_ENTRY_AVAIL_NOT_FOUND, "not-found"),
{ 0, 0, 0 }
};
etype = g_enum_register_static ("RhythmDBEntryAvailability", values);
}
return etype;
}
|