|
Lines 56-63
Link Here
|
| 56 |
|
56 |
|
| 57 |
#ifdef HAVE_HAL |
57 |
#ifdef HAVE_HAL |
| 58 |
LibHalContext *ctx; |
58 |
LibHalContext *ctx; |
| 59 |
#endif |
|
|
| 60 |
#ifdef HAVE_HAL_0_5 |
| 61 |
/* If the disc is a media, have the UDI available here */ |
59 |
/* If the disc is a media, have the UDI available here */ |
| 62 |
char *disc_udi; |
60 |
char *disc_udi; |
| 63 |
#endif |
61 |
#endif |
|
Lines 245-261
Link Here
|
| 245 |
return found; |
243 |
return found; |
| 246 |
} |
244 |
} |
| 247 |
|
245 |
|
| 248 |
#ifdef HAVE_HAL_0_2 |
246 |
#ifdef HAVE_HAL |
| 249 |
static LibHalContext * |
|
|
| 250 |
cd_cache_new_hal_ctx (void) |
| 251 |
{ |
| 252 |
LibHalContext *ctx; |
| 253 |
|
| 254 |
ctx = hal_initialize (NULL, FALSE); |
| 255 |
|
| 256 |
return ctx; |
| 257 |
} |
| 258 |
#elif HAVE_HAL_0_5 |
| 259 |
static LibHalContext * |
247 |
static LibHalContext * |
| 260 |
cd_cache_new_hal_ctx (void) |
248 |
cd_cache_new_hal_ctx (void) |
| 261 |
{ |
249 |
{ |
|
Lines 366-376
Link Here
|
| 366 |
static gboolean |
354 |
static gboolean |
| 367 |
cd_cache_has_medium (CdCache *cache) |
355 |
cd_cache_has_medium (CdCache *cache) |
| 368 |
{ |
356 |
{ |
| 369 |
return FALSE; |
357 |
return TRUE; |
| 370 |
} |
358 |
} |
| 371 |
#endif |
359 |
#endif |
| 372 |
|
360 |
|
| 373 |
#ifdef HAVE_HAL_0_5 |
361 |
#ifdef HAVE_HAL |
| 374 |
static gboolean |
362 |
static gboolean |
| 375 |
cd_cache_has_medium (CdCache *cache) |
363 |
cd_cache_has_medium (CdCache *cache) |
| 376 |
{ |
364 |
{ |
|
Lines 403-408
Link Here
|
| 403 |
if (retval == FALSE) { |
391 |
if (retval == FALSE) { |
| 404 |
dbus_bool_t volume; |
392 |
dbus_bool_t volume; |
| 405 |
|
393 |
|
|
|
394 |
if (libhal_device_property_exists (cache->ctx, |
| 395 |
udi, "volume.is_disc", NULL) == FALSE) { |
| 396 |
g_free (udi); |
| 397 |
return FALSE; |
| 398 |
} |
| 399 |
|
| 406 |
volume = libhal_device_get_property_bool (cache->ctx, |
400 |
volume = libhal_device_get_property_bool (cache->ctx, |
| 407 |
udi, "volume.is_disc", &error); |
401 |
udi, "volume.is_disc", &error); |
| 408 |
if (dbus_error_is_set (&error)) { |
402 |
if (dbus_error_is_set (&error)) { |
|
Lines 423-454
Link Here
|
| 423 |
|
417 |
|
| 424 |
return retval; |
418 |
return retval; |
| 425 |
} |
419 |
} |
| 426 |
#elif HAVE_HAL_0_2 |
|
|
| 427 |
static gboolean |
| 428 |
cd_cache_has_medium (CdCache *cache) |
| 429 |
{ |
| 430 |
char **devices; |
| 431 |
int num_devices; |
| 432 |
char *udi; |
| 433 |
gboolean retval = FALSE; |
| 434 |
|
| 435 |
if (cache->drive == NULL) |
| 436 |
return FALSE; |
| 437 |
|
| 438 |
udi = gnome_vfs_drive_get_hal_udi (cache->drive); |
| 439 |
if (udi == NULL) |
| 440 |
return FALSE; |
| 441 |
|
| 442 |
devices = hal_manager_find_device_string_match (cache->ctx, |
| 443 |
"info.parent", udi, &num_devices); |
| 444 |
if (devices != NULL && num_devices >= 1) |
| 445 |
retval = TRUE; |
| 446 |
|
| 447 |
hal_free_string_array (devices); |
| 448 |
g_free (udi); |
| 449 |
|
| 450 |
return retval; |
| 451 |
} |
| 452 |
#endif |
420 |
#endif |
| 453 |
|
421 |
|
| 454 |
static gboolean |
422 |
static gboolean |
|
Lines 562-579
Link Here
|
| 562 |
|
530 |
|
| 563 |
#ifdef HAVE_HAL |
531 |
#ifdef HAVE_HAL |
| 564 |
if (cache->ctx != NULL) { |
532 |
if (cache->ctx != NULL) { |
| 565 |
#ifdef HAVE_HAL_0_5 |
|
|
| 566 |
DBusConnection *conn; |
533 |
DBusConnection *conn; |
| 567 |
|
534 |
|
| 568 |
conn = libhal_ctx_get_dbus_connection (cache->ctx); |
535 |
conn = libhal_ctx_get_dbus_connection (cache->ctx); |
| 569 |
libhal_ctx_shutdown (cache->ctx, NULL); |
536 |
libhal_ctx_shutdown (cache->ctx, NULL); |
| 570 |
libhal_ctx_free(cache->ctx); |
537 |
libhal_ctx_free(cache->ctx); |
|
|
538 |
/* Close the connection before doing the last unref */ |
| 571 |
dbus_connection_close (conn); |
539 |
dbus_connection_close (conn); |
|
|
540 |
dbus_connection_unref (conn); |
| 572 |
|
541 |
|
| 573 |
g_free (cache->disc_udi); |
542 |
g_free (cache->disc_udi); |
| 574 |
#elif HAVE_HAL_0_2 |
|
|
| 575 |
hal_shutdown (cache->ctx); |
| 576 |
#endif |
| 577 |
} |
543 |
} |
| 578 |
#endif /* HAVE_HAL */ |
544 |
#endif /* HAVE_HAL */ |
| 579 |
|
545 |
|
|
Lines 597-603
Link Here
|
| 597 |
if (!cd_cache_open_device (cache, error)) |
563 |
if (!cd_cache_open_device (cache, error)) |
| 598 |
return MEDIA_TYPE_ERROR; |
564 |
return MEDIA_TYPE_ERROR; |
| 599 |
|
565 |
|
| 600 |
#ifdef HAVE_HAL_0_5 |
566 |
#ifdef HAVE_HAL |
| 601 |
{ |
567 |
{ |
| 602 |
DBusError error; |
568 |
DBusError error; |
| 603 |
dbus_bool_t is_cdda; |
569 |
dbus_bool_t is_cdda; |
|
Lines 700-706
Link Here
|
| 700 |
return MEDIA_TYPE_ERROR; |
666 |
return MEDIA_TYPE_ERROR; |
| 701 |
if (!cache->mountpoint) |
667 |
if (!cache->mountpoint) |
| 702 |
return MEDIA_TYPE_ERROR; |
668 |
return MEDIA_TYPE_ERROR; |
| 703 |
#ifdef HAVE_HAL_0_5 |
669 |
#ifdef HAVE_HAL |
| 704 |
if (cache->is_media != FALSE) { |
670 |
if (cache->is_media != FALSE) { |
| 705 |
DBusError error; |
671 |
DBusError error; |
| 706 |
dbus_bool_t is_vcd; |
672 |
dbus_bool_t is_vcd; |
|
Lines 749-755
Link Here
|
| 749 |
return MEDIA_TYPE_ERROR; |
715 |
return MEDIA_TYPE_ERROR; |
| 750 |
if (!cache->mountpoint) |
716 |
if (!cache->mountpoint) |
| 751 |
return MEDIA_TYPE_ERROR; |
717 |
return MEDIA_TYPE_ERROR; |
| 752 |
#ifdef HAVE_HAL_0_5 |
718 |
#ifdef HAVE_HAL |
| 753 |
if (cache->is_media != FALSE) { |
719 |
if (cache->is_media != FALSE) { |
| 754 |
DBusError error; |
720 |
DBusError error; |
| 755 |
dbus_bool_t is_dvd; |
721 |
dbus_bool_t is_dvd; |
|
Lines 884-889
Link Here
|
| 884 |
return totem_cd_detect_type_with_url (device, NULL, error); |
850 |
return totem_cd_detect_type_with_url (device, NULL, error); |
| 885 |
} |
851 |
} |
| 886 |
|
852 |
|
|
|
853 |
gboolean |
| 854 |
totem_cd_has_medium (const char *device) |
| 855 |
{ |
| 856 |
CdCache *cache; |
| 857 |
gboolean retval = TRUE; |
| 858 |
|
| 859 |
if (!(cache = cd_cache_new (device, NULL))) |
| 860 |
return TRUE; |
| 861 |
|
| 862 |
retval = cd_cache_has_medium (cache); |
| 863 |
cd_cache_free (cache); |
| 864 |
|
| 865 |
return retval; |
| 866 |
} |
| 867 |
|
| 887 |
const char * |
868 |
const char * |
| 888 |
totem_cd_get_human_readable_name (MediaType type) |
869 |
totem_cd_get_human_readable_name (MediaType type) |
| 889 |
{ |
870 |
{ |