summaryrefslogtreecommitdiffstats
path: root/src/hal-common.c
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2005-10-09 16:27:46 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2005-10-09 16:27:46 +0000
commit5b02248eb39cb1cdd1ca6f7daf0ce34585c4225c (patch)
tree380208d30975c2562189c0f518c48f1db55b3584 /src/hal-common.c
parent1e6147b63567fd2c0f424dda4a05323b21991f03 (diff)
downloadlibgpod-5b02248eb39cb1cdd1ca6f7daf0ce34585c4225c.tar.gz
libgpod-5b02248eb39cb1cdd1ca6f7daf0ce34585c4225c.tar.xz
libgpod-5b02248eb39cb1cdd1ca6f7daf0ce34585c4225c.zip
* bindings/python/gpod.i: applied Kelvin Lawson's patch to query
integers. * src/ipod-device.[ch],hal-common.[ch],Makefile.am: code ported from libipoddevice to retrieve information about the iPod without libhal dependence. * tests/test-ipod-device.c: small script to show how to to query the iPod for information. * tests/Makefile.am: initialize <LIBS> with better default * configure.ac: add dependency for libgobject git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1113 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/hal-common.c')
-rw-r--r--src/hal-common.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/hal-common.c b/src/hal-common.c
new file mode 100644
index 0000000..23dca80
--- /dev/null
+++ b/src/hal-common.c
@@ -0,0 +1,120 @@
+/* Time-stamp: <2005-10-10 01:23:29 jcs>
+|
+| Copyright (C) 2005 Jorg Schuler <jcsjcs at users sourceforge net>
+| Part of the gtkpod project.
+|
+| URL: http://www.gtkpod.org/
+| URL: http://gtkpod.sourceforge.net/
+|
+|
+| The source is taken from libipoddevice, CVS version October 8 2005
+| (http://64.14.94.162/index.php/Libipoddevice).
+|
+| I decided not to make libgpod dependent on libipoddevice because
+| the latter depends on libraries not widely available yet (libhal >=
+| 0.5.2, glib >= 2.8). It is planned to replace these files with a
+| libipoddevice dependence at some later time.
+|
+| The following changes were done:
+|
+| - libhal becomes optional (see #if HAVE_LIBHAL sections)
+| - provide some dummy libhal functions to make libhal-independence
+| of ipod-device.c easier.
+|
+| Because of these changes only a limited amount of functionality is
+| available. See ipod-device.h for summary.
+|
+|
+|
+|
+| $Id$
+*/
+/* ex: set ts=4: */
+/***************************************************************************
+* hal-common.c
+* Copyright (C) 2005 Novell
+* Written by Aaron Bockover <aaron@aaronbock.net>
+****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "hal-common.h"
+
+#if HAVE_LIBHAL
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+dbus_bool_t
+hal_mainloop_integration(LibHalContext *ctx, DBusError *error)
+{
+ DBusConnection *dbus_connection;
+
+ dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, error);
+
+ if(dbus_error_is_set(error))
+ return FALSE;
+
+ dbus_connection_setup_with_g_main(dbus_connection,
+ ipod_device_global_main_context);
+ libhal_ctx_set_dbus_connection(ctx, dbus_connection);
+
+ return TRUE;
+}
+
+void ipod_device_set_global_main_context(GMainContext *ctx)
+{
+ ipod_device_global_main_context = ctx;
+}
+#else
+gchar **libhal_manager_find_device_string_match (LibHalContext *hal_ctx,
+ const gchar *type,
+ const gchar *str,
+ gint *vol_count,
+ void *error)
+{
+/* gchar **volumes = g_new0 (gchar *, 2);
+ volumes[0] = g_strdup (type);*/
+ gchar **volumes = NULL;
+ *vol_count = 0;
+ return volumes;
+}
+void libhal_free_string_array (gchar **volumes)
+{
+/* g_strfreev (volumes);*/
+}
+gboolean libhal_device_property_exists (LibHalContext *hal_ctx,
+ const gchar *vol,
+ const gchar *prop,
+ void *error)
+{
+ return FALSE;
+}
+gboolean libhal_device_get_property_bool (LibHalContext *hal_ctx,
+ const gchar *vol,
+ const gchar *prop,
+ void *error)
+{
+ return FALSE;
+}
+void libhal_ctx_shutdown (LibHalContext *hal_ctx, void *error) {}
+void libhal_ctx_free (LibHalContext *hal_ctx) {}
+#endif