From bc8cd7d47ae53a02d5d9b5fd2136553c8074cc58 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 2 Aug 2007 12:32:05 +0300 Subject: [PATCH] Hildon can be on the desktop so start to separate hildon/osso --- configure.ac | 18 ++++++++++++------ src/config.h.in | 3 +++ src/mapper.c | 34 +++++++++++++++++----------------- src/settings-gui.c | 4 +++- src/ui-common.c | 8 +++++--- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 8c8641b..50c51b9 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AC_SUBST(GLIBGTK_LIBS) AC_SUBST(GLIBGTK_CFLAGS) dnl Ckeck for hildon-libs -PKG_CHECK_MODULES(HILDON, hildon-libs libosso, HAVE_HILDON=yes, HAVE_HILDON=no) +PKG_CHECK_MODULES(HILDON, hildon-libs, HAVE_HILDON=yes, HAVE_HILDON=no) if test "x$HAVE_HILDON" = "xyes"; then AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface]) @@ -51,22 +51,28 @@ else AC_MSG_RESULT(no) fi -AM_CONDITIONAL(WITH_HILDON, test "x$HAVE_HILDON" = "xyes") - dnl make HILDON_CFLAGS and HILDON_LIBS available if test "x$HAVE_HILDON" = "xyes"; then AC_SUBST(HILDON_CFLAGS) AC_SUBST(HILDON_LIBS) - PKG_CHECK_MODULES(OSSO, libosso >= 1 libossohelp osso-ic) - AC_SUBST(OSSO_LIBS) - AC_SUBST(OSSO_CFLAGS) + PKG_CHECK_MODULES(OSSO, libosso >= 1 libossohelp osso-ic, HAVE_OSSO=yes, HAVE_OSSO=no) + if test "x$HAVE_OSSO" = "xyes"; then + AC_DEFINE(WITH_OSSO, 1, [build with Nokia osso]) + AC_SUBST(OSSO_LIBS) + AC_SUBST(OSSO_CFLAGS) + else + AC_MSG_RESULT(no) + fi PKG_CHECK_MODULES(HILDON, hildon-libs >= 0.9.50 hildon-fm) AC_SUBST(HILDON_LIBS) AC_SUBST(HILDON_CFLAGS) fi +AM_CONDITIONAL(WITH_HILDON, test "x$HAVE_HILDON" = "xyes") +AM_CONDITIONAL(WITH_OSSO, test "x$HAVE_OSSO" = "xyes") + PKG_CHECK_MODULES(BLUEZ, bluez) AC_SUBST(BLUEZ_LIBS) AC_SUBST(BLUEZ_CFLAGS) diff --git a/src/config.h.in b/src/config.h.in index b4ebfbc..69b4b16 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -101,3 +101,6 @@ /* build with gpsd */ #undef WITH_LIBGPS + +/* build with Nokia osso */ +#undef WITH_OSSO diff --git a/src/mapper.c b/src/mapper.c index 816e1c7..258bea0 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -45,12 +45,15 @@ #include #include -#ifdef WITH_HILDON +#ifdef WITH_OSSO #include #include #include #include #include +#include "maemo-osso.h" +#endif +#ifdef WITH_HILDON #include #include #include @@ -61,7 +64,6 @@ #include #include #include -#include "maemo-osso.h" #endif #include @@ -192,25 +194,19 @@ void mapper_destroy(void) g_tree_destroy(_pui_tree); /* Finish up all downloads. */ - while (CURLM_CALL_MULTI_PERFORM - == curl_multi_perform(_curl_multi, &num_transfers) - || num_transfers) { + while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(_curl_multi, &num_transfers) || num_transfers) { + /* XXX: should inform the user why it's taking so damn long... */ } /* Close all finished files. */ while ((msg = curl_multi_info_read(_curl_multi, &num_msgs))) { if (msg->msg == CURLMSG_DONE) { /* This is a map download. */ - ProgressUpdateInfo *pui = - g_hash_table_lookup(_pui_by_easy, - msg->easy_handle); - g_queue_push_head(_curl_easy_queue, - msg->easy_handle); - g_hash_table_remove(_pui_by_easy, - msg->easy_handle); + ProgressUpdateInfo *pui = g_hash_table_lookup(_pui_by_easy, msg->easy_handle); + g_queue_push_head(_curl_easy_queue, msg->easy_handle); + g_hash_table_remove(_pui_by_easy, msg->easy_handle); fclose(pui->file); - curl_multi_remove_handle(_curl_multi, - msg->easy_handle); + curl_multi_remove_handle(_curl_multi, msg->easy_handle); } } @@ -235,7 +231,7 @@ _conn_state = RCVR_OFF; gint mapper_osso_init(void) { -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Initialize _osso. */ _osso = osso_initialize("org.tal.mapper", VERSION, TRUE, NULL); if (!_osso) { @@ -248,7 +244,7 @@ return 0; gint mapper_osso_cb_init(void) { -#ifdef WITH_HILDON +#ifdef WITH_OSSO if (OSSO_OK != osso_rpc_set_default_cb_f(_osso, dbus_cb_default, NULL)) { g_printerr("osso_rpc_set_default_cb_f failed.\n"); return 1; @@ -279,8 +275,10 @@ gint main(gint argc, gchar * argv[]) g_thread_init(NULL); g_type_init(); +#ifdef WITH_OSSO if (mapper_osso_init()!=0) return 1; +#endif set_var_defaults(); gst_init(&argc, &argv); gtk_init(&argc, &argv); @@ -290,11 +288,13 @@ gint main(gint argc, gchar * argv[]) timezone_init(); gpx_init(); mapper_init(argc, argv); +#ifdef WITH_OSSO if (mapper_osso_cb_init()!=0) return 1; +#endif gtk_main(); mapper_destroy(); -#ifdef WITH_HILDON +#ifdef WITH_OSSO osso_deinitialize(_osso); #endif vprintf("%s(): return\n", __PRETTY_FUNCTION__); diff --git a/src/settings-gui.c b/src/settings-gui.c index f821bcd..77bfdeb 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -22,9 +22,11 @@ #include #include -#ifdef WITH_HILDON +#ifdef WITH_OSSO #include #include +#endif +#ifdef WITH_HILDON #include #include #include diff --git a/src/ui-common.c b/src/ui-common.c index a26b31d..0961077 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -22,12 +22,16 @@ #include #include -#ifdef WITH_HILDON +#ifdef WITH_OSSO #include #include #include #include #include +#include "maemo-osso.h" +#include "iap.h" +#endif +#ifdef WITH_HILDON #include #include #include @@ -38,8 +42,6 @@ #include #include #include -#include "iap.h" -#include "maemo-osso.h" #endif #include "utils.h" -- 2.39.5