From: Kaj-Michael Lang Date: Mon, 6 Aug 2007 09:20:10 +0000 (+0300) Subject: Make it possible to build for different gtk/hildon/osso combinations. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc26c75009c6ae49c5de429670fd06b1bc1e557d;p=mapper Make it possible to build for different gtk/hildon/osso combinations. --- diff --git a/configure.ac b/configure.ac index a1d2e32..d59f418 100644 --- a/configure.ac +++ b/configure.ac @@ -20,11 +20,14 @@ AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(mapper, 1.0.0) +AM_MAINTAINER_MODE AC_PROG_CPP AC_CONFIG_HEADERS(src/config.h) AC_PROG_INSTALL AC_PROG_LIBTOOL +AC_SYS_LARGEFILE +PKG_PROG_PKG_CONFIG dnl Debugging options to enable debug macros DEBUG_FLAGS= @@ -42,15 +45,42 @@ PKG_CHECK_MODULES(GLIBGTK, glib-2.0 gconf-2.0 dbus-glib-1 gtk+-2.0) AC_SUBST(GLIBGTK_LIBS) AC_SUBST(GLIBGTK_CFLAGS) -dnl Ckeck for hildon-libs -PKG_CHECK_MODULES(HILDON, hildon-libs, HAVE_HILDON=yes, HAVE_HILDON=no) +AC_ARG_ENABLE([nokia-770],AS_HELP_STRING([--enable-770],[Build for Nokia 770/N800]), + [enable_770=$enableval], [enable_770=no]) -if test "x$HAVE_HILDON" = "xno"; then - PKG_CHECK_MODULES(HILDON, hildon-1, HAVE_HILDON=yes, HAVE_HILDON=no) +AC_ARG_ENABLE([hildon],AS_HELP_STRING([--enable-hildon],[Build for Hildon]), + [enable_hildon=$enableval], [enable_hildon=no]) + +if test "x$enable_770" = "xno" ; then + WITH_DEVICE_770=no +else + WITH_DEVICE_770=yes + enable_hildon=yes + AC_DEFINE([WITH_DEVICE_770], [1], [With 770/N800 specific code]) fi -if test "x$HAVE_HILDON" = "xyes"; then +if test "x$enable_hildon" = "xyes" ; then + dnl Ckeck for hildon-libs + PKG_CHECK_MODULES(HILDON, hildon-libs, HAVE_HILDON=yes, HAVE_HILDON=no) + + if test "x$HAVE_HILDON" = "xno"; then + PKG_CHECK_MODULES(HILDON, hildon-1, HAVE_HILDON1=yes, HAVE_HILDON1=no) + fi + + if test "x$HAVE_HILDON" = "xyes"; then + AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface]) + else + AC_MSG_RESULT(no) + fi +else + HAVE_HILDON=no + HAVE_HILDON1=no +fi + +if test "x$HAVE_HILDON1" = "xyes"; then AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface]) + AC_DEFINE(WITH_HILDON_NEW, 1, [build with new Hildon libs]) + HAVE_HILDON=yes else AC_MSG_RESULT(no) fi diff --git a/src/audio-record.c b/src/audio-record.c index 3b9a673..6e2a1ea 100644 --- a/src/audio-record.c +++ b/src/audio-record.c @@ -20,6 +20,11 @@ struct { GstElement *filter, } pipeline; +gboolean +audio_bus_cb() +{ +} + gboolean audio_create_record_pipeline(void) { @@ -29,10 +34,16 @@ filter=gst_element_factory_make("wavenc", "filter"); sink=gst_element_factory_make("filesink", "sink"); } +gboolean +audio_create_play_pipelin(void) +{ + +} + void -audio_src_filename(GstElement *src, gchar *file) +audio_file_set_filename(GstElement *e, gchar *file) { -g_object_set(G_OBJECT(src), "location", file, NULL); +g_object_set(G_OBJECT(e), "location", file, NULL); } gboolean diff --git a/src/cb.c b/src/cb.c index 839a092..30b3382 100644 --- a/src/cb.c +++ b/src/cb.c @@ -18,21 +18,7 @@ #include #include -#ifdef WITH_OSSO -#include -#include -#endif -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include "hildon-mapper.h" #include "utils.h" #include "poi.h" @@ -388,7 +374,7 @@ gboolean menu_cb_goto_latlon(GtkAction * action) 1, 2, 1, 2, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); -#ifdef WITH_HILDON +#ifdef WITH_DEVICE_770 g_object_set(G_OBJECT(txt_lat), HILDON_INPUT_MODE_HINT, HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); g_object_set(G_OBJECT(txt_lon), HILDON_INPUT_MODE_HINT, @@ -700,7 +686,7 @@ gboolean menu_cb_help(GtkAction * action) { printf("%s()\n", __PRETTY_FUNCTION__); -#ifdef WITH_HILDON +#ifdef WITH_OSSO ossohelp_show(_osso, HELP_ID_INTRO, 0); #endif @@ -710,7 +696,7 @@ gboolean menu_cb_help(GtkAction * action) gboolean menu_cb_about(GtkAction * action) { -#ifdef WITH_HILDON +#ifdef WITH_OSSO ossohelp_show(_osso, HELP_ID_ABOUT, OSSO_HELP_SHOW_DIALOG); #else gchar *authors[]={ diff --git a/src/config.h.in b/src/config.h.in index 69b4b16..49648ac 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -90,6 +90,9 @@ /* Version number of package */ #undef VERSION +/* With 770/N800 specific code */ +#undef WITH_DEVICE_770 + /* build with Geoclue */ #undef WITH_GEOCLUE @@ -99,8 +102,20 @@ /* build with Maemo/Hildon user interface */ #undef WITH_HILDON +/* build with Hildon filemanager */ +#undef WITH_HILDONFM + +/* build with new Hildon libs */ +#undef WITH_HILDON_NEW + /* build with gpsd */ #undef WITH_LIBGPS /* build with Nokia osso */ #undef WITH_OSSO + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES diff --git a/src/file.c b/src/file.c index 017f13b..987122b 100644 --- a/src/file.c +++ b/src/file.c @@ -4,9 +4,10 @@ #include #include +#include "hildon-mapper.h" + #include "utils.h" #include "mapper-types.h" - #include "settings.h" #include "ui-common.h" #include "hildon-wrappers.h" diff --git a/src/gps-conn.c b/src/gps-conn.c index ad27bf6..300eec0 100644 --- a/src/gps-conn.c +++ b/src/gps-conn.c @@ -14,7 +14,7 @@ #include #ifdef WITH_HILDON -#include +#include #endif static GtkWidget *connect_banner = NULL; diff --git a/src/hildon-mapper.h b/src/hildon-mapper.h new file mode 100644 index 0000000..bc47edd --- /dev/null +++ b/src/hildon-mapper.h @@ -0,0 +1,45 @@ +#ifndef _HILDON_MAPPER_H +#define _HILDON_MAPPER_H + +#include "config.h" + +#ifdef WITH_OSSO +#include +#include +#include +#include +#include +#include "maemo-osso.h" +#endif + +#ifdef WITH_HILDON + +#ifdef WITH_HILDON_NEW +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifdef WITH_HILDON_FM +#include +#endif + +#ifdef WITH_DEVICE_770 +#include +#include +#endif + +#endif +#endif diff --git a/src/hildon-wrappers.c b/src/hildon-wrappers.c index 607cca3..a8f524c 100644 --- a/src/hildon-wrappers.c +++ b/src/hildon-wrappers.c @@ -8,9 +8,7 @@ #include #include "ui-common.h" -#ifndef WITH_HILDON - -static gint _sb_sid=0; +#ifndef WITH_HILDON_FM GtkWidget *hildon_file_chooser_dialog_new(GtkWindow * parent, GtkFileChooserAction action) @@ -34,6 +32,12 @@ if (action == GTK_FILE_CHOOSER_ACTION_SAVE) { return dialog; } +#endif + +#ifndef WITH_HILDON + +static gint _sb_sid=0; + static gboolean status_bar_clear(void) { diff --git a/src/hildon-wrappers.h b/src/hildon-wrappers.h index 0cb6dfc..4dfe679 100644 --- a/src/hildon-wrappers.h +++ b/src/hildon-wrappers.h @@ -20,16 +20,7 @@ #define HILDON_HARDKEY_ESC GDK_Escape #define HILDON_COLOR_BUTTON GTK_COLOR_BUTTON -#define HWK_BUTTON_UP GDK_Up -#define HWK_BUTTON_DOWN GDK_Down -#define HWK_BUTTON_LEFT GDK_Left -#define HWK_BUTTON_RIGHT GDK_Right -#define HWK_BUTTON_SELECT GDK_Return -#define HWK_BUTTON_VIEW GDK_F10 -#define HWK_BUTTON_INCREASE GDK_F6 -#define HWK_BUTTON_DECREASE GDK_F5 -#define HWK_BUTTON_CANCEL GDK_Escape -#define HILDON_COLOR_BUTTON GTK_COLOR_BUTTON +#define HILDON_COLOR_BUTTON GTK_COLOR_BUTTON #define hildon_color_button_new gtk_color_button_new #define hildon_color_button_set_color gtk_color_button_set_color @@ -43,4 +34,16 @@ #endif +#ifndef WITH_DEVICE_770 +#define HWK_BUTTON_UP GDK_Up +#define HWK_BUTTON_DOWN GDK_Down +#define HWK_BUTTON_LEFT GDK_Left +#define HWK_BUTTON_RIGHT GDK_Right +#define HWK_BUTTON_SELECT GDK_Return +#define HWK_BUTTON_VIEW GDK_F10 +#define HWK_BUTTON_INCREASE GDK_F6 +#define HWK_BUTTON_DECREASE GDK_F5 +#define HWK_BUTTON_CANCEL GDK_Escape +#endif + #endif diff --git a/src/maemo-osso.c b/src/maemo-osso.c index ec531ec..c50bf95 100644 --- a/src/maemo-osso.c +++ b/src/maemo-osso.c @@ -9,7 +9,7 @@ #include #include -#ifdef WITH_HILDON +#ifdef WITH_OSSO #include #include diff --git a/src/map-repo.c b/src/map-repo.c index 61dbdc9..2b130f0 100644 --- a/src/map-repo.c +++ b/src/map-repo.c @@ -16,18 +16,7 @@ #include #include -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include "hildon-mapper.h" #include "utils.h" #include "gps.h" @@ -212,8 +201,7 @@ gboolean repoman_dialog_browse(GtkWidget * widget, BrowseInfo * browse_info) GtkWidget *dialog; printf("%s()\n", __PRETTY_FUNCTION__); - dialog = - GTK_WIDGET(hildon_file_chooser_dialog_new + dialog = GTK_WIDGET(hildon_file_chooser_dialog_new (GTK_WINDOW(browse_info->dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)); @@ -620,7 +608,7 @@ gboolean repoman_dialog() GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Enable the help button. */ ossohelp_dialog_help_enable(GTK_DIALOG(rmi.dialog), HELP_ID_REPOMAN, _osso); @@ -1091,7 +1079,7 @@ gboolean menu_cb_mapman(GtkAction * action) GTK_RESPONSE_ACCEPT, NULL); /* Enable the help button. */ -#ifdef WITH_HILDON +#ifdef WITH_OSSO ossohelp_dialog_help_enable(GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN, _osso); #endif @@ -1258,7 +1246,7 @@ gboolean menu_cb_mapman(GtkAction * action) 2, 3, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0); gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lon), 1.f); -#ifdef WITH_HILDON +#ifdef WITH_DEVICE_770 /* Set hildon input hints */ g_object_set(G_OBJECT(mapman_info.txt_topleft_lon), HILDON_INPUT_MODE_HINT, diff --git a/src/map.c b/src/map.c index 0d69ecc..e8f0f1c 100644 --- a/src/map.c +++ b/src/map.c @@ -22,19 +22,7 @@ #include #include -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - +#include "hildon-mapper.h" #include "utils.h" #include "map.h" @@ -517,7 +505,7 @@ gchar *map_construct_url(guint tilex, guint tiley, guint zoom) return ""; } -#ifdef WITH_HILDON +#ifdef WITH_OSSO void con_check_connection(void) { iap_connect(); @@ -564,7 +552,7 @@ void map_initiate_download(guint tilex, guint tiley, guint zoom, gint retries) pui->file = NULL; g_tree_insert(_pui_tree, pui, pui); -#ifdef WITH_HILDON +#ifdef WITH_OSSO if (iap_is_connected() && !_curl_sid) #endif _curl_sid = g_timeout_add(100, (GSourceFunc) curl_download_timeout, NULL); @@ -703,7 +691,7 @@ gboolean map_download_idle_refresh(ProgressUpdateInfo * pui) /* removal automatically calls progress_update_info_free(). */ g_tree_steal(_downloading_tree, pui); g_tree_insert(_pui_tree, pui, pui); -#ifdef WITH_HILDON +#ifdef WITH_OSSO if (iap_is_connected() && !_curl_sid) #endif _curl_sid = g_timeout_add(100, diff --git a/src/mapper.c b/src/mapper.c index 17d46d6..77210ef 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -44,26 +44,11 @@ #include #include #include - -#ifdef WITH_OSSO -#include -#include -#include -#include -#include -#include "maemo-osso.h" -#endif -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#endif - #include #include +#include "hildon-mapper.h" + #include "utils.h" #include "poi.h" #include "route.h" diff --git a/src/poi-gui.c b/src/poi-gui.c index 64d16ec..59a3ed8 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -359,7 +359,7 @@ gboolean category_list() GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Enable the help button. */ ossohelp_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_POICAT, _osso); #endif diff --git a/src/route.c b/src/route.c index 8b1452c..50f9aa9 100644 --- a/src/route.c +++ b/src/route.c @@ -206,7 +206,7 @@ gboolean auto_route_dl_idle() } curl_multi_add_handle(_curl_multi, _autoroute_data.curl_easy); -#ifdef WITH_HILDON +#ifdef WITH_OSSO if (iap_is_connected() && !_curl_sid) #else if (!_curl_sid) @@ -243,7 +243,7 @@ gboolean route_download(gchar * to) GtkEntryCompletion *to_comp; printf("%s()\n", __PRETTY_FUNCTION__); -#ifdef WITH_HILDON +#ifdef WITH_OSSO iap_connect(); #endif @@ -254,7 +254,7 @@ gboolean route_download(gchar * to) GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Enable the help button. */ ossohelp_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_DOWNROUTE, _osso); diff --git a/src/settings-gui.c b/src/settings-gui.c index 339f720..50ef49a 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -22,22 +22,7 @@ #include #include -#ifdef WITH_OSSO -#include -#include -#endif -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include "hildon-mapper.h" #include "utils.h" #include "poi.h" @@ -445,10 +430,11 @@ settings_dialog(void) GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Enable the help button. */ ossohelp_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS, _osso); - +#endif +#ifdef WITH_DEVICE_770 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_buttons = gtk_button_new_with_label(_("Hardware Keys..."))); g_signal_connect(G_OBJECT(btn_buttons), "clicked", G_CALLBACK(settings_dialog_hardkeys), dialog); diff --git a/src/ui-common.c b/src/ui-common.c index 2b61f0b..8091f5a 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -22,27 +22,7 @@ #include #include -#ifdef WITH_OSSO -#include -#include -#include -#include -#include -#include "maemo-osso.h" -#include "iap.h" -#endif -#ifdef WITH_HILDON -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include "hildon-mapper.h" #include "utils.h" #include "poi.h" @@ -219,16 +199,9 @@ gboolean window_present() gtk_window_present(GTK_WINDOW(_window)); -#ifdef WITH_HILDON - confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), - ("It looks like this is your first time running" - " Mapper. Press OK to view the the help pages." - " Otherwise, press Cancel to continue.")); - - if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) - ossohelp_show(_osso, HELP_ID_INTRO, 0); - gtk_widget_destroy(confirm); -#endif + popup_error(_window, _("It looks like this is your first time running " + "Mapper. Press OK to continue.")); + if (settings_dialog()) { popup_error(_window, _("OpenStreetMap.org provides public, free-to-use maps. " @@ -427,10 +400,6 @@ static void menu_init() gtk_menu_append(menu, _menu_close_item = gtk_menu_item_new_with_label(_("Quit"))); /* We need to show menu items. */ - gtk_widget_show_all(GTK_WIDGET(menu)); -#ifndef WITH_HILDON - gtk_widget_show_all(GTK_WIDGET(_menu_bar)); -#endif /* Connect the "Route" signals. */ g_signal_connect(G_OBJECT(_menu_route_open_item), "activate", @@ -579,10 +548,9 @@ static void menu_init() gtk_menu_append(submenu, _cmenu_way_distance_to_item = gtk_menu_item_new_with_label(_("Show Distance to"))); gtk_menu_append(submenu, _cmenu_way_route_to_item - = - gtk_menu_item_new_with_label(_("Download Route to..."))); - gtk_menu_append(submenu, _cmenu_way_delete_item = - gtk_menu_item_new_with_label(_("Delete..."))); + = gtk_menu_item_new_with_label(_("Download Route to..."))); + gtk_menu_append(submenu, _cmenu_way_delete_item + = gtk_menu_item_new_with_label(_("Delete..."))); gtk_menu_append(submenu, gtk_separator_menu_item_new()); gtk_menu_append(submenu, _cmenu_way_add_poi = gtk_menu_item_new_with_label(_("Add POI..."))); gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL); @@ -600,9 +568,7 @@ static void menu_init() gtk_menu_append(submenu, _cmenu_poi_distance_to_item = gtk_menu_item_new_with_label(_("Show Distance to"))); gtk_menu_append(submenu, _cmenu_poi_route_to_item - = - gtk_menu_item_new_with_label(_ - ("Download Route to..."))); + = gtk_menu_item_new_with_label(_("Download Route to..."))); gtk_menu_append(submenu, gtk_separator_menu_item_new()); gtk_menu_append(submenu, _cmenu_poi_add_route = gtk_menu_item_new_with_label(_("Add Route Point"))); @@ -665,8 +631,11 @@ static void menu_init() G_CALLBACK(menu_cb_goto_nearpoi), NULL); gtk_widget_show_all(GTK_WIDGET(menu)); +#ifndef WITH_HILDON + gtk_widget_show_all(GTK_WIDGET(_menu_bar)); +#endif -#ifdef WITH_HILDON +#ifdef WITH_DEVICE_770 gtk_widget_tap_and_hold_setup(_map_widget, GTK_WIDGET(menu), NULL, 0); #else _menu_map = menu; @@ -1047,7 +1016,7 @@ void mapper_init(gint argc, gchar ** argv) | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); -#ifdef WITH_HILDON +#ifdef WITH_OSSO osso_hw_set_event_cb(_osso, NULL, osso_cb_hw_state, NULL); #endif @@ -1183,7 +1152,7 @@ void mapper_init(gint argc, gchar ** argv) /* If we have a route, calculate the next point. */ route_find_nearest_point(); -#ifdef WITH_HILDON +#ifdef WITH_OSSO /* Add D-BUS signal handler for 'status_changed' */ { DBusConnection *dbus_conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); diff --git a/src/ui-maemo.h b/src/ui-maemo.h index 5c88879..7f9a3e5 100644 --- a/src/ui-maemo.h +++ b/src/ui-maemo.h @@ -15,15 +15,16 @@ #define HELP_ID_DOWNROUTE HELP_ID_PREFIX"downroute" #define HELP_ID_POICAT HELP_ID_PREFIX"poicat" +#ifdef WITH_OSSO #include -#include +/** The main OSSO context of the application. */ +osso_context_t *_osso; +#endif +#include /** The main GtkWindow of the application. */ HildonProgram *_program; -/** The main OSSO context of the application. */ -osso_context_t *_osso; - #endif #endif diff --git a/src/utils.h b/src/utils.h index bbac306..0e6d5ca 100644 --- a/src/utils.h +++ b/src/utils.h @@ -83,7 +83,7 @@ #define TILE_SIZE_PIXELS (256) #define TILE_SIZE_P2 (8) -#ifdef WITH_HILDON +#ifdef WITH_DEVICE_770 #define BUF_WIDTH_TILES (4) #define BUF_HEIGHT_TILES (3) #define BUF_WIDTH_PIXELS (1024) @@ -268,7 +268,7 @@ map_render_paths(); \ } -#ifdef WITH_HILDON +#ifdef WITH_OSSO #define KEEP_DISPLAY_ON() { \ /* Note that the flag means keep on ONLY when fullscreen. */ \ if(_always_keep_on || _fullscreen) \