summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hal-common.c3
-rw-r--r--src/hal-common.h2
-rw-r--r--src/ipod-device.c17
3 files changed, 15 insertions, 7 deletions
diff --git a/src/hal-common.c b/src/hal-common.c
index 23dca80..6b36d6f 100644
--- a/src/hal-common.c
+++ b/src/hal-common.c
@@ -62,6 +62,9 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+static GMainContext *ipod_device_global_main_context = NULL;
dbus_bool_t
hal_mainloop_integration(LibHalContext *ctx, DBusError *error)
diff --git a/src/hal-common.h b/src/hal-common.h
index a4e8909..db525fa 100644
--- a/src/hal-common.h
+++ b/src/hal-common.h
@@ -68,8 +68,6 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
-static GMainContext *ipod_device_global_main_context = NULL;
-
dbus_bool_t hal_mainloop_integration(LibHalContext *ctx, DBusError *error);
void ipod_device_set_global_main_context(GMainContext *ctx);
diff --git a/src/ipod-device.c b/src/ipod-device.c
index 124a585..c085265 100644
--- a/src/ipod-device.c
+++ b/src/ipod-device.c
@@ -555,7 +555,7 @@ ipod_device_set_property(GObject *object, guint prop_id,
} else {
str = volumes[0];
}
-#if HAVE_LIBHAL
+#ifdef HAVE_LIBHAL
g_free_if_not_null(device->priv->hal_volume_id);
device->priv->hal_volume_id = g_strdup(str);
#else
@@ -848,7 +848,7 @@ ipod_device_finalize(GObject *object)
LibHalContext *
ipod_device_hal_initialize()
{
-#if HAVE_LIBHAL
+#ifdef HAVE_LIBHAL
LibHalContext *hal_context;
DBusError error;
DBusConnection *dbus_connection;
@@ -1205,7 +1205,7 @@ ipod_device_restore_reboot_preferences(IpodDevice *device)
gboolean
ipod_device_detect_volume_info(IpodDevice *device)
{
-#if HAVE_LIBHAL
+#ifdef HAVE_LIBHAL
LibHalContext *hal_context;
gchar **volumes;
gchar *hd_mount_point, *hd_device_path;
@@ -1434,7 +1434,7 @@ ipod_device_has_open_fd(IpodDevice *device)
return FALSE;
}
-#if HAVE_LIBHAL
+#ifdef HAVE_LIBHAL
/* modded from g-v-m */
static int
ipod_device_run_command(IpodDevice *device, const char *command,
@@ -1513,6 +1513,13 @@ ipod_device_new(const gchar *hal_volume_id)
IpodDevice *device = g_object_new(TYPE_IPOD_DEVICE,
"hal-volume-id", hal_volume_id, NULL);
+ if (device == NULL) {
+ /* This can happen if one forgot to call g_type_init before
+ * calling ipod_device_new
+ */
+ return NULL;
+ }
+
if(!device->priv->is_ipod) {
g_object_unref(device);
return NULL;
@@ -1532,7 +1539,7 @@ ipod_device_rescan_disk(IpodDevice *device)
guint
ipod_device_eject(IpodDevice *device, GError **error_out)
{
-#if HAVE_LIBHAL
+#ifdef HAVE_LIBHAL
gint exit_status;
GError *error = NULL;