Mageia Bugzilla – Attachment 7460 Details for
Bug 1450
thoggen, DVD backup/ripping in gtk
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
thoggen-0.7.1-no-hal.patch
thoggen-0.7.1-no-hal.patch (text/plain), 14.61 KB, created by
Sérgio Basto
on 2016-02-15 06:19:57 CET
(
hide
)
Description:
thoggen-0.7.1-no-hal.patch
Filename:
MIME Type:
Creator:
Sérgio Basto
Created:
2016-02-15 06:19:57 CET
Size:
14.61 KB
patch
obsolete
>diff --git a/configure.ac b/configure.ac >index c200ae9..494fc70 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -295,35 +295,16 @@ CPPFLAGS="$SAVED_CPPFLAGS" > > dnl ===== Check for libhal ===== > >-PKG_CHECK_MODULES(HAL, [hal >= $libhal_required],, [ >- AC_MSG_ERROR( >- [ >- Cannot find hal library >= $libhal_required (libhal) >- >- Please check the following: >- >- * Do you have the libhal _development_ package installed? >- (usually called hal-devel, libhal-devel, libhal-dev or similar) >- If >- ls -l /usr/lib/pkgconfig/hal.pc >- reports that the file does not exist, then you are missing >- the development package. If you installed libhal from >- source, this point does not apply to you. >- >- * Do you have libhal installed more than once, e.g. once >- from package and once from source? (if both >- ls /usr/lib/libhal.so >- and >- ls /usr/local/lib/libhal.so >- show results, you need to fix your installation. >- >- * Did you install libhal from source? If yes, you might need to >- point pkg-config to the location of the hal.pc file by >- doing something like >- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig >- and then running ./configure again. >- >- ])]) >+AC_MSG_CHECKING([for HAL]) >+PKG_CHECK_MODULES(HAL, [hal >= $libhal_required],[ >+ AC_MSG_RESULT([yes]) >+ AC_DEFINE([HAVE_HAL], 1, [Defined if we have libhal]) >+ AM_CONDITIONAL(HAVE_HAL, true) >+ ],[ >+ AC_MSG_RESULT([no]) >+ AC_DEFINE([HAVE_HAL], 0, [Defined if we have libhal]) >+ AM_CONDITIONAL(HAVE_HAL, false) >+ ]) > > dnl ===== Check for DBus Glib bindings ===== > >@@ -409,8 +390,9 @@ AC_SUBST([DVDREAD_LIBS]) > > dnl === Do not use deprecated glib/gtk+ functions === > >-GLIB_CFLAGS="-DG_DISABLE_DEPRECATED $GLIB_CFLAGS" >-GTK_CFLAGS="-DG_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED $GTK_CFLAGS" >+dnl FIXME: Remove comment after code updated to newer glib2. >+dnl GLIB_CFLAGS="-DG_DISABLE_DEPRECATED $GLIB_CFLAGS" >+dnl GTK_CFLAGS="-DG_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED $GTK_CFLAGS" > > if test "x$USE_PROFILING" = "xyes"; then > CFLAGS="-pg $CFLAGS" >diff --git a/src/th-device-pool.c b/src/th-device-pool.c >index a21880a..c54945d 100644 >--- a/src/th-device-pool.c >+++ b/src/th-device-pool.c >@@ -33,7 +33,9 @@ > # include "config.h" > #endif > >+#if HAVE_HAL > #include <libhal.h> >+#endif > > #include <dbus/dbus.h> > #include <dbus/dbus-glib-lowlevel.h> >@@ -45,7 +47,9 @@ > struct _ThDevicePoolPrivate > { > DBusConnection *dbus_conn; >+#if HAVE_HAL > LibHalContext *hal_ctx; >+#endif > GList *trackers; > > gulong hal_reconnect_id; >@@ -59,6 +63,7 @@ static void device_pool_finalize (GObject *object); > > static void device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker); > >+#if HAVE_HAL > static gboolean dp_reconnect_to_hal_cb (ThDevicePool *pool); > > static void dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx); >@@ -100,6 +105,7 @@ static void dp_hal_device_condition_cb (LibHalContext *ctx, > const char *udi, > const char *cond_name, > const char *cond_detail); >+#endif > > #endif > >@@ -114,6 +120,7 @@ static GObjectClass *dp_parent_class; /* NULL */ > * > ***************************************************************************/ > >+#if HAVE_HAL > #ifndef USE_NEW_DBUS_HAL_API > static const LibHalFunctions disc_drive_hal_cb_funcs = > { >@@ -126,6 +133,7 @@ static const LibHalFunctions disc_drive_hal_cb_funcs = > dp_hal_device_condition_cb /* device condiiton */ > }; > #endif /* USE_NEW_DBUS_HAL_API */ >+#endif > > /*************************************************************************** > * >@@ -133,11 +141,13 @@ static const LibHalFunctions disc_drive_hal_cb_funcs = > * > ***************************************************************************/ > >+#if HAVE_HAL > static ThDevicePool * > hal_ctx_get_device_pool (LibHalContext *ctx) > { > return TH_DEVICE_POOL (hal_ctx_get_user_data (ctx)); > } >+#endif > > /*************************************************************************** > * >@@ -158,6 +168,7 @@ device_pool_class_init (ThDevicePoolClass *klass) > } > > >+#if HAVE_HAL > /*************************************************************************** > * > * dp_reconnect_set_hal_ctx >@@ -191,6 +202,7 @@ dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx) > } > } > } >+#endif > > /*************************************************************************** > * >@@ -201,10 +213,13 @@ dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx) > static void > device_pool_instance_init (ThDevicePool *pool) > { >+#if HAVE_HAL > LibHalContext *new_hal_ctx; >+#endif > > pool->priv = g_new0 (ThDevicePoolPrivate, 1); > >+#if HAVE_HAL > #ifdef USE_NEW_DBUS_HAL_API > new_hal_ctx = libhal_ctx_new(); > libhal_ctx_set_cache (new_hal_ctx, TRUE); >@@ -254,6 +269,7 @@ device_pool_instance_init (ThDevicePool *pool) > g_timeout_add (1000, (GSourceFunc) dp_reconnect_to_hal_cb, pool); > > } >+#endif > } > > /*************************************************************************** >@@ -275,6 +291,7 @@ device_pool_finalize (GObject *object) > if (pool->priv->hal_reconnect_id > 0) > g_source_remove (pool->priv->hal_reconnect_id); > >+#if HAVE_HAL > if (pool->priv->hal_ctx) > { > #ifndef USE_NEW_DBUS_HAL_API >@@ -286,6 +303,7 @@ device_pool_finalize (GObject *object) > libhal_ctx_free (pool->priv->hal_ctx); > #endif > } >+#endif > > for (l = pool->priv->trackers; l; l = l->next) > g_object_unref (TH_DEVICE_TRACKER (l->data)); >@@ -345,6 +363,7 @@ th_device_pool_new (void) > return (ThDevicePool *) g_object_new (TH_TYPE_DEVICE_POOL, NULL); > } > >+#if HAVE_HAL > /*************************************************************************** > * > * dp_reconnect_to_hal_cb >@@ -648,6 +667,7 @@ device_pool_device_is_volume (ThDevicePool *pool, const gchar *udi) > > return TRUE; > } >+#endif > > /*************************************************************************** > * >@@ -658,6 +678,7 @@ device_pool_device_is_volume (ThDevicePool *pool, const gchar *udi) > static void > device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker) > { >+#if HAVE_HAL > char **devs; > int i, num_devs; > >@@ -691,6 +712,7 @@ device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker) > } > > hal_free_string_array (devs); >+#endif > } > > /*************************************************************************** >@@ -706,7 +728,9 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) > { > g_return_if_fail (TH_IS_DEVICE_POOL (pool)); > g_return_if_fail (TH_IS_DEVICE_TRACKER (tracker)); >+#if HAVE_HAL > g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context != NULL); >+#endif > g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->device_added != NULL); > g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->device_removed != NULL); > >@@ -717,6 +741,7 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) > pool->priv->trackers = g_list_prepend (pool->priv->trackers, tracker); > g_object_ref (tracker); > >+#if HAVE_HAL > /* skip this if we're not connected to the system bus */ > if (pool->priv->hal_ctx) > { >@@ -724,5 +749,5 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) > > device_pool_send_initial_state (pool, tracker); > } >+#endif > } >- >diff --git a/src/th-device-tracker.c b/src/th-device-tracker.c >index de621bc..2fdb594 100644 >--- a/src/th-device-tracker.c >+++ b/src/th-device-tracker.c >@@ -85,6 +85,7 @@ th_device_tracker_base_init (gpointer g_klass) > * > ***************************************************************************/ > >+#if HAVE_HAL > void > th_device_tracker_set_context (ThDeviceTracker *tracker, > LibHalContext *ctx) >@@ -95,6 +96,7 @@ th_device_tracker_set_context (ThDeviceTracker *tracker, > if (TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context != NULL) > TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context (tracker, ctx); > } >+#endif > > /*************************************************************************** > * >diff --git a/src/th-device-tracker.h b/src/th-device-tracker.h >index cfaba32..a6a3554 100644 >--- a/src/th-device-tracker.h >+++ b/src/th-device-tracker.h >@@ -18,7 +18,9 @@ > #ifndef _th_device_tracker_h_included_ > #define _th_device_tracker_h_included_ > >-#include <libhal.h> >+#if HAVE_HAL >+# include <libhal.h> >+#endif > #include <glib-object.h> > > #include <dbus/dbus-glib-lowlevel.h> >@@ -71,7 +73,9 @@ struct _ThDeviceTrackerIface > GTypeInterface g_iface; > > /* vfFuncs */ >+#if HAVE_HAL > void (*set_context) (ThDeviceTracker *tracker, LibHalContext *ctx); >+#endif > > void (*device_added) (ThDeviceTracker *tracker, const gchar *udi); > >@@ -105,8 +109,10 @@ struct _ThDeviceTrackerIface > > GType th_device_tracker_get_type (void) G_GNUC_CONST; > >+#if HAVE_HAL > void th_device_tracker_set_context (ThDeviceTracker *tracker, > LibHalContext *ctx); >+#endif > > void th_device_tracker_device_added (ThDeviceTracker *tracker, > const gchar *udi); >diff --git a/src/th-disc-drive-pool.c b/src/th-disc-drive-pool.c >index 2e35d08..e13c3d7 100644 >--- a/src/th-disc-drive-pool.c >+++ b/src/th-disc-drive-pool.c >@@ -51,7 +51,9 @@ enum > > struct _ThDiscDrivePoolPrivate > { >+#if HAVE_HAL > LibHalContext *hal_ctx; >+#endif > GData *drives; /* maps drive_udi => ThDiscDrive, and disc_udi => ThDiscDrive */ > gulong find_timeout; > }; >@@ -96,8 +98,10 @@ static gboolean disc_drive_pool_no_drives_cb (ThDiscDrivePool *ddpool); > > /* ThDeviceTracker interface */ > >+#if HAVE_HAL > static void disc_pool_set_context (ThDeviceTracker *tracker, > LibHalContext *ctx); >+#endif > > static void disc_pool_device_added (ThDeviceTracker *tracker, > const char *udi); >@@ -267,7 +271,9 @@ disc_drive_pool_finalize (GObject *object) > static void > disc_pool_device_tracker_init (ThDeviceTrackerIface *iface) > { >+#if HAVE_HAL > iface->set_context = disc_pool_set_context; >+#endif > iface->device_added = disc_pool_device_added; > iface->device_removed = disc_pool_device_removed; > iface->new_cap = disc_pool_device_new_cap; >@@ -443,8 +449,10 @@ disc_drive_pool_add_disc_to_drive (ThDiscDrivePool *ddpool, > > g_datalist_set_data (&ddpool->priv->drives, disc_udi, drive); > >+#if HAVE_HAL > if (hal_device_property_exists (ddpool->priv->hal_ctx, disc_udi, "volume.label")) > label = hal_device_get_property_string (ddpool->priv->hal_ctx, disc_udi, "volume.label"); >+#endif > > if (label == NULL) > label = strdup ("(no title)"); >@@ -453,7 +461,9 @@ disc_drive_pool_add_disc_to_drive (ThDiscDrivePool *ddpool, > > g_signal_emit (ddpool, ddp_signals[DISC_CHANGED], 0, drive); > >+#if HAVE_HAL > hal_free_string (label); >+#endif > } > > /*************************************************************************** >@@ -469,6 +479,7 @@ disc_drive_pool_add_disc (ThDiscDrivePool *ddpool, > ThDiscDrive *drive; > gchar *drive_udi; > >+#if HAVE_HAL > if (!hal_device_property_exists (ddpool->priv->hal_ctx, disc_udi, "info.parent")) > return; > >@@ -490,6 +501,9 @@ disc_drive_pool_add_disc (ThDiscDrivePool *ddpool, > } > > hal_free_string (drive_udi); >+#else >+ g_error ("HAL support not available (2)"); >+#endif > } > > /*************************************************************************** >@@ -546,6 +560,7 @@ disc_drive_pool_get_drive_info (ThDiscDrivePool *disc_pool, > gchar **p_product, > gboolean *p_req_polling) > { >+#if HAVE_HAL > LibHalContext *ctx; > gchar *device; > gchar *vendor = NULL; >@@ -595,6 +610,10 @@ disc_drive_pool_get_drive_info (ThDiscDrivePool *disc_pool, > hal_free_string (product); > > return TRUE; >+#else >+ g_error ("HAL support not available (3)"); >+ return FALSE; >+#endif > } > > /*************************************************************************** >@@ -678,6 +697,7 @@ disc_drive_pool_remove_drive (ThDiscDrivePool *ddpool, const gchar *udi) > static gboolean > disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) > { >+#if HAVE_HAL > LibHalContext *ctx; > gboolean is_dvd_rom, is_dvd_foo, is_unknown; > char *disc_type; >@@ -737,6 +757,10 @@ disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) > } > > return FALSE; >+#else >+ g_error ("HAL support not available (4)"); >+ return FALSE; >+#endif > } > > /*************************************************************************** >@@ -748,6 +772,7 @@ disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) > static gboolean > disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) > { >+#if HAVE_HAL > LibHalContext *ctx = disc_pool->priv->hal_ctx; > > if (!hal_device_property_exists (ctx, udi, "storage.cdrom.dvd") >@@ -755,6 +780,10 @@ disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) > return FALSE; > > return TRUE; >+#else >+ g_error ("HAL support not available (5)"); >+ return FALSE; >+#endif > } > > /*************************************************************************** >@@ -763,6 +792,7 @@ disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) > * > ***************************************************************************/ > >+#if HAVE_HAL > static void > disc_pool_set_context (ThDeviceTracker *tracker, LibHalContext *ctx) > { >@@ -770,6 +800,7 @@ disc_pool_set_context (ThDeviceTracker *tracker, LibHalContext *ctx) > * bus is restarted, the context might change */ > TH_DISC_DRIVE_POOL(tracker)->priv->hal_ctx = ctx; > } >+#endif > > /*************************************************************************** > * >@@ -864,6 +895,7 @@ disc_pool_device_prop_mod (ThDeviceTracker *tracker, > gboolean is_removed, > gboolean is_added) > { >+#if HAVE_HAL > ThDiscDrivePool *disc_pool = NULL; > LibHalContext *ctx; > >@@ -889,6 +921,9 @@ disc_pool_device_prop_mod (ThDeviceTracker *tracker, > if (!disc_drive_pool_get_drive_from_udi (disc_pool, udi)) > disc_drive_pool_add_drive (disc_pool, udi); > } >+#else >+ g_error ("HAL support not available (6)"); >+#endif > } > > /***************************************************************************
diff --git a/configure.ac b/configure.ac index c200ae9..494fc70 100644 --- a/configure.ac +++ b/configure.ac @@ -295,35 +295,16 @@ CPPFLAGS="$SAVED_CPPFLAGS" dnl ===== Check for libhal ===== -PKG_CHECK_MODULES(HAL, [hal >= $libhal_required],, [ - AC_MSG_ERROR( - [ - Cannot find hal library >= $libhal_required (libhal) - - Please check the following: - - * Do you have the libhal _development_ package installed? - (usually called hal-devel, libhal-devel, libhal-dev or similar) - If - ls -l /usr/lib/pkgconfig/hal.pc - reports that the file does not exist, then you are missing - the development package. If you installed libhal from - source, this point does not apply to you. - - * Do you have libhal installed more than once, e.g. once - from package and once from source? (if both - ls /usr/lib/libhal.so - and - ls /usr/local/lib/libhal.so - show results, you need to fix your installation. - - * Did you install libhal from source? If yes, you might need to - point pkg-config to the location of the hal.pc file by - doing something like - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - and then running ./configure again. - - ])]) +AC_MSG_CHECKING([for HAL]) +PKG_CHECK_MODULES(HAL, [hal >= $libhal_required],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_HAL], 1, [Defined if we have libhal]) + AM_CONDITIONAL(HAVE_HAL, true) + ],[ + AC_MSG_RESULT([no]) + AC_DEFINE([HAVE_HAL], 0, [Defined if we have libhal]) + AM_CONDITIONAL(HAVE_HAL, false) + ]) dnl ===== Check for DBus Glib bindings ===== @@ -409,8 +390,9 @@ AC_SUBST([DVDREAD_LIBS]) dnl === Do not use deprecated glib/gtk+ functions === -GLIB_CFLAGS="-DG_DISABLE_DEPRECATED $GLIB_CFLAGS" -GTK_CFLAGS="-DG_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED $GTK_CFLAGS" +dnl FIXME: Remove comment after code updated to newer glib2. +dnl GLIB_CFLAGS="-DG_DISABLE_DEPRECATED $GLIB_CFLAGS" +dnl GTK_CFLAGS="-DG_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED $GTK_CFLAGS" if test "x$USE_PROFILING" = "xyes"; then CFLAGS="-pg $CFLAGS" diff --git a/src/th-device-pool.c b/src/th-device-pool.c index a21880a..c54945d 100644 --- a/src/th-device-pool.c +++ b/src/th-device-pool.c @@ -33,7 +33,9 @@ # include "config.h" #endif +#if HAVE_HAL #include <libhal.h> +#endif #include <dbus/dbus.h> #include <dbus/dbus-glib-lowlevel.h> @@ -45,7 +47,9 @@ struct _ThDevicePoolPrivate { DBusConnection *dbus_conn; +#if HAVE_HAL LibHalContext *hal_ctx; +#endif GList *trackers; gulong hal_reconnect_id; @@ -59,6 +63,7 @@ static void device_pool_finalize (GObject *object); static void device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker); +#if HAVE_HAL static gboolean dp_reconnect_to_hal_cb (ThDevicePool *pool); static void dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx); @@ -100,6 +105,7 @@ static void dp_hal_device_condition_cb (LibHalContext *ctx, const char *udi, const char *cond_name, const char *cond_detail); +#endif #endif @@ -114,6 +120,7 @@ static GObjectClass *dp_parent_class; /* NULL */ * ***************************************************************************/ +#if HAVE_HAL #ifndef USE_NEW_DBUS_HAL_API static const LibHalFunctions disc_drive_hal_cb_funcs = { @@ -126,6 +133,7 @@ static const LibHalFunctions disc_drive_hal_cb_funcs = dp_hal_device_condition_cb /* device condiiton */ }; #endif /* USE_NEW_DBUS_HAL_API */ +#endif /*************************************************************************** * @@ -133,11 +141,13 @@ static const LibHalFunctions disc_drive_hal_cb_funcs = * ***************************************************************************/ +#if HAVE_HAL static ThDevicePool * hal_ctx_get_device_pool (LibHalContext *ctx) { return TH_DEVICE_POOL (hal_ctx_get_user_data (ctx)); } +#endif /*************************************************************************** * @@ -158,6 +168,7 @@ device_pool_class_init (ThDevicePoolClass *klass) } +#if HAVE_HAL /*************************************************************************** * * dp_reconnect_set_hal_ctx @@ -191,6 +202,7 @@ dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx) } } } +#endif /*************************************************************************** * @@ -201,10 +213,13 @@ dp_reconnect_set_hal_ctx (ThDevicePool *pool, LibHalContext *ctx) static void device_pool_instance_init (ThDevicePool *pool) { +#if HAVE_HAL LibHalContext *new_hal_ctx; +#endif pool->priv = g_new0 (ThDevicePoolPrivate, 1); +#if HAVE_HAL #ifdef USE_NEW_DBUS_HAL_API new_hal_ctx = libhal_ctx_new(); libhal_ctx_set_cache (new_hal_ctx, TRUE); @@ -254,6 +269,7 @@ device_pool_instance_init (ThDevicePool *pool) g_timeout_add (1000, (GSourceFunc) dp_reconnect_to_hal_cb, pool); } +#endif } /*************************************************************************** @@ -275,6 +291,7 @@ device_pool_finalize (GObject *object) if (pool->priv->hal_reconnect_id > 0) g_source_remove (pool->priv->hal_reconnect_id); +#if HAVE_HAL if (pool->priv->hal_ctx) { #ifndef USE_NEW_DBUS_HAL_API @@ -286,6 +303,7 @@ device_pool_finalize (GObject *object) libhal_ctx_free (pool->priv->hal_ctx); #endif } +#endif for (l = pool->priv->trackers; l; l = l->next) g_object_unref (TH_DEVICE_TRACKER (l->data)); @@ -345,6 +363,7 @@ th_device_pool_new (void) return (ThDevicePool *) g_object_new (TH_TYPE_DEVICE_POOL, NULL); } +#if HAVE_HAL /*************************************************************************** * * dp_reconnect_to_hal_cb @@ -648,6 +667,7 @@ device_pool_device_is_volume (ThDevicePool *pool, const gchar *udi) return TRUE; } +#endif /*************************************************************************** * @@ -658,6 +678,7 @@ device_pool_device_is_volume (ThDevicePool *pool, const gchar *udi) static void device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker) { +#if HAVE_HAL char **devs; int i, num_devs; @@ -691,6 +712,7 @@ device_pool_send_initial_state (ThDevicePool *pool, ThDeviceTracker *tracker) } hal_free_string_array (devs); +#endif } /*************************************************************************** @@ -706,7 +728,9 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) { g_return_if_fail (TH_IS_DEVICE_POOL (pool)); g_return_if_fail (TH_IS_DEVICE_TRACKER (tracker)); +#if HAVE_HAL g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context != NULL); +#endif g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->device_added != NULL); g_return_if_fail (TH_DEVICE_TRACKER_GET_IFACE (tracker)->device_removed != NULL); @@ -717,6 +741,7 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) pool->priv->trackers = g_list_prepend (pool->priv->trackers, tracker); g_object_ref (tracker); +#if HAVE_HAL /* skip this if we're not connected to the system bus */ if (pool->priv->hal_ctx) { @@ -724,5 +749,5 @@ th_device_pool_add_tracker (ThDevicePool *pool, ThDeviceTracker *tracker) device_pool_send_initial_state (pool, tracker); } +#endif } - diff --git a/src/th-device-tracker.c b/src/th-device-tracker.c index de621bc..2fdb594 100644 --- a/src/th-device-tracker.c +++ b/src/th-device-tracker.c @@ -85,6 +85,7 @@ th_device_tracker_base_init (gpointer g_klass) * ***************************************************************************/ +#if HAVE_HAL void th_device_tracker_set_context (ThDeviceTracker *tracker, LibHalContext *ctx) @@ -95,6 +96,7 @@ th_device_tracker_set_context (ThDeviceTracker *tracker, if (TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context != NULL) TH_DEVICE_TRACKER_GET_IFACE (tracker)->set_context (tracker, ctx); } +#endif /*************************************************************************** * diff --git a/src/th-device-tracker.h b/src/th-device-tracker.h index cfaba32..a6a3554 100644 --- a/src/th-device-tracker.h +++ b/src/th-device-tracker.h @@ -18,7 +18,9 @@ #ifndef _th_device_tracker_h_included_ #define _th_device_tracker_h_included_ -#include <libhal.h> +#if HAVE_HAL +# include <libhal.h> +#endif #include <glib-object.h> #include <dbus/dbus-glib-lowlevel.h> @@ -71,7 +73,9 @@ struct _ThDeviceTrackerIface GTypeInterface g_iface; /* vfFuncs */ +#if HAVE_HAL void (*set_context) (ThDeviceTracker *tracker, LibHalContext *ctx); +#endif void (*device_added) (ThDeviceTracker *tracker, const gchar *udi); @@ -105,8 +109,10 @@ struct _ThDeviceTrackerIface GType th_device_tracker_get_type (void) G_GNUC_CONST; +#if HAVE_HAL void th_device_tracker_set_context (ThDeviceTracker *tracker, LibHalContext *ctx); +#endif void th_device_tracker_device_added (ThDeviceTracker *tracker, const gchar *udi); diff --git a/src/th-disc-drive-pool.c b/src/th-disc-drive-pool.c index 2e35d08..e13c3d7 100644 --- a/src/th-disc-drive-pool.c +++ b/src/th-disc-drive-pool.c @@ -51,7 +51,9 @@ enum struct _ThDiscDrivePoolPrivate { +#if HAVE_HAL LibHalContext *hal_ctx; +#endif GData *drives; /* maps drive_udi => ThDiscDrive, and disc_udi => ThDiscDrive */ gulong find_timeout; }; @@ -96,8 +98,10 @@ static gboolean disc_drive_pool_no_drives_cb (ThDiscDrivePool *ddpool); /* ThDeviceTracker interface */ +#if HAVE_HAL static void disc_pool_set_context (ThDeviceTracker *tracker, LibHalContext *ctx); +#endif static void disc_pool_device_added (ThDeviceTracker *tracker, const char *udi); @@ -267,7 +271,9 @@ disc_drive_pool_finalize (GObject *object) static void disc_pool_device_tracker_init (ThDeviceTrackerIface *iface) { +#if HAVE_HAL iface->set_context = disc_pool_set_context; +#endif iface->device_added = disc_pool_device_added; iface->device_removed = disc_pool_device_removed; iface->new_cap = disc_pool_device_new_cap; @@ -443,8 +449,10 @@ disc_drive_pool_add_disc_to_drive (ThDiscDrivePool *ddpool, g_datalist_set_data (&ddpool->priv->drives, disc_udi, drive); +#if HAVE_HAL if (hal_device_property_exists (ddpool->priv->hal_ctx, disc_udi, "volume.label")) label = hal_device_get_property_string (ddpool->priv->hal_ctx, disc_udi, "volume.label"); +#endif if (label == NULL) label = strdup ("(no title)"); @@ -453,7 +461,9 @@ disc_drive_pool_add_disc_to_drive (ThDiscDrivePool *ddpool, g_signal_emit (ddpool, ddp_signals[DISC_CHANGED], 0, drive); +#if HAVE_HAL hal_free_string (label); +#endif } /*************************************************************************** @@ -469,6 +479,7 @@ disc_drive_pool_add_disc (ThDiscDrivePool *ddpool, ThDiscDrive *drive; gchar *drive_udi; +#if HAVE_HAL if (!hal_device_property_exists (ddpool->priv->hal_ctx, disc_udi, "info.parent")) return; @@ -490,6 +501,9 @@ disc_drive_pool_add_disc (ThDiscDrivePool *ddpool, } hal_free_string (drive_udi); +#else + g_error ("HAL support not available (2)"); +#endif } /*************************************************************************** @@ -546,6 +560,7 @@ disc_drive_pool_get_drive_info (ThDiscDrivePool *disc_pool, gchar **p_product, gboolean *p_req_polling) { +#if HAVE_HAL LibHalContext *ctx; gchar *device; gchar *vendor = NULL; @@ -595,6 +610,10 @@ disc_drive_pool_get_drive_info (ThDiscDrivePool *disc_pool, hal_free_string (product); return TRUE; +#else + g_error ("HAL support not available (3)"); + return FALSE; +#endif } /*************************************************************************** @@ -678,6 +697,7 @@ disc_drive_pool_remove_drive (ThDiscDrivePool *ddpool, const gchar *udi) static gboolean disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) { +#if HAVE_HAL LibHalContext *ctx; gboolean is_dvd_rom, is_dvd_foo, is_unknown; char *disc_type; @@ -737,6 +757,10 @@ disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) } return FALSE; +#else + g_error ("HAL support not available (4)"); + return FALSE; +#endif } /*************************************************************************** @@ -748,6 +772,7 @@ disc_pool_device_is_dvd_disc (ThDiscDrivePool *disc_pool, const gchar *udi) static gboolean disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) { +#if HAVE_HAL LibHalContext *ctx = disc_pool->priv->hal_ctx; if (!hal_device_property_exists (ctx, udi, "storage.cdrom.dvd") @@ -755,6 +780,10 @@ disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) return FALSE; return TRUE; +#else + g_error ("HAL support not available (5)"); + return FALSE; +#endif } /*************************************************************************** @@ -763,6 +792,7 @@ disc_pool_device_is_dvd_drive (ThDiscDrivePool *disc_pool, const gchar *udi) * ***************************************************************************/ +#if HAVE_HAL static void disc_pool_set_context (ThDeviceTracker *tracker, LibHalContext *ctx) { @@ -770,6 +800,7 @@ disc_pool_set_context (ThDeviceTracker *tracker, LibHalContext *ctx) * bus is restarted, the context might change */ TH_DISC_DRIVE_POOL(tracker)->priv->hal_ctx = ctx; } +#endif /*************************************************************************** * @@ -864,6 +895,7 @@ disc_pool_device_prop_mod (ThDeviceTracker *tracker, gboolean is_removed, gboolean is_added) { +#if HAVE_HAL ThDiscDrivePool *disc_pool = NULL; LibHalContext *ctx; @@ -889,6 +921,9 @@ disc_pool_device_prop_mod (ThDeviceTracker *tracker, if (!disc_drive_pool_get_drive_from_udi (disc_pool, udi)) disc_drive_pool_add_drive (disc_pool, udi); } +#else + g_error ("HAL support not available (6)"); +#endif } /***************************************************************************
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1450
: 7460