poi_edit_dialog(ACTION_EDIT_POI, p);
return TRUE;
}
+
+/***/
+
+gboolean
+headphone_button_cb(gpointer data)
+{
+gint hb_action=0;
+switch (hb_action) {
+case 1:
+#if 0
+ /* XXX: Add code to add generic POI */
+ hildon_banner_show_information(_window, NULL, _("POI Added"));
+#endif
+break;
+case 0:
+default:
+ path_insert_mark_text(&_track, g_strdup("Mark"));
+ hildon_banner_show_information(_window, NULL, _("Mark added"));
+break;
+}
+return FALSE;
+}
#include <math.h>
#include <errno.h>
#include <sys/wait.h>
+#include <glib.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#ifdef WITH_GST
#include <libintl.h>
#include <locale.h>
+#ifdef WITH_HAL
+#include <libhal.h>
+#endif
+
#ifdef WITH_HILDON_DBUS_BT
#include <bt-dbus.h>
#endif
static GtkWidget *init_progress;
static GtkWidget *init_dialog;
+#ifdef WITH_HAL
+LibHalContext *ctx;
+#endif
+
/**
* Initialize arrays
*/
return 0;
}
+#ifdef WITH_HAL
+static void
+hal_condition_cb(LibHalContext *ctx, const char *udi, const char *name, const char *detail)
+{
+g_debug("HAL: [%s]->[%s:%s]", udi, name, detail);
+if (strcmp(name, "ButtonPressed")==0 && strcmp(detail, "phone")==0)
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE, headphone_button_cb, NULL,NULL);
+}
+
+static gboolean
+mapper_hal_init(void)
+{
+DBusError error;
+
+dbus_error_init(&error);
+
+ctx=libhal_ctx_new();
+g_assert(ctx);
+
+g_assert(dbus_conn);
+libhal_ctx_set_dbus_connection(ctx, dbus_conn);
+g_debug("HAL: init");
+if (!libhal_ctx_init(ctx, &error))
+ return FALSE;
+
+g_debug("HAL: setting cb");
+libhal_ctx_set_device_condition(ctx, hal_condition_cb);
+libhal_device_add_property_watch(ctx, "/org/freedesktop/Hal/devices/platform_retu_headset_logicaldev_input",NULL);
+
+return TRUE;
+}
+#endif
+
static gint
mapper_osso_cb_init(void)
{
/* Initialize D-Bus system connection. */
if (NULL == (dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error))) {
g_printerr("Failed to open connection to D-Bus: %s.\n", error->message);
- popup_error(_window, "Failed to connect to D-Bus.");
+ popup_error(NULL, "Failed to connect to D-Bus.");
error = NULL;
}
/* XXX: Move this */
- #ifdef WITH_OSSO
+#ifdef WITH_OSSO
osso_hw_set_event_cb(_osso, NULL, osso_cb_hw_state, NULL);
- #endif
+#endif
+#ifdef WITH_HAL
+ mapper_hal_init();
+#endif
mis=MAPPER_INIT_UI;
p=0.9;