From ac3792a26a917e6a45ba117d7276391001fd66da Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 13 Mar 2008 15:51:17 +0200 Subject: [PATCH] Add basic gtkglext init. Hal init success changes. --- src/mapper.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/mapper.c b/src/mapper.c index 409c460..306d813 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -58,6 +58,12 @@ #include #endif +#ifdef WITH_GL +#include +#include +#include +#endif + #include "mapper.h" #include "hildon-mapper.h" #include "utils.h" @@ -259,22 +265,24 @@ if (strcmp(name, "ButtonPressed")==0 && strcmp(detail, "phone")==0) } static gboolean -mapper_hal_init(void) +mapper_hal_init(DBusConnection *dbc) { DBusError error; +g_return_if_fail(dbc); + dbus_error_init(&error); ctx=libhal_ctx_new(); -g_assert(ctx); +g_return_if_fail(ctx); + +libhal_ctx_set_dbus_connection(ctx, dbc); -g_assert(dbus_conn); -libhal_ctx_set_dbus_connection(ctx, dbus_conn); -g_debug("HAL: init"); -if (!libhal_ctx_init(ctx, &error)) +if (!libhal_ctx_init(ctx, &error)) { + g_warning("HAL Init failed"); 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); @@ -396,9 +404,9 @@ switch (mis) { case MAPPER_INIT_MISC: /* 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); + g_warning("Failed to open connection to D-Bus: %s.\n", error->message); popup_error(NULL, "Failed to connect to D-Bus."); - error = NULL; + error=NULL; } /* XXX: Move this */ @@ -406,7 +414,7 @@ switch (mis) { osso_hw_set_event_cb(_osso, NULL, osso_cb_hw_state, NULL); #endif #ifdef WITH_HAL - mapper_hal_init(); + mapper_hal_init(dbus_conn); #endif mis=MAPPER_INIT_UI; @@ -444,7 +452,8 @@ return ret; gint main(gint argc, gchar * argv[]) { -/* Initialize localization. */ +dbus_conn=NULL; + setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); @@ -457,6 +466,11 @@ g_set_application_name("Mapper"); gst_init(&argc, &argv); #endif gtk_init(&argc, &argv); +#if defined (WITH_GL) +if (!gtk_gl_init_check(&argc, &argv)) { + g_warning("OpenGL init failed"); +} +#endif if (mapper_osso_init()!=0) return 1; if (mapper_osso_cb_init()!=0) -- 2.39.5