summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-17 10:59:43 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-17 11:17:48 -0800
commitd0d4bbece7e0a304a3e1f1fcea3608f3d741e8fa (patch)
tree3b2588afc37b40b49c5173921f8c871bb1024479
parent91d6d12416086e08f97dece728ec9a6d08554230 (diff)
downloadsubsurface-d0d4bbece7e0a304a3e1f1fcea3608f3d741e8fa.tar.gz
Hack Makefile, gtk-gui.c and divelist.c to allow building w/o osm-gps-map
While we are waiting for an autotools generated Makefile, this should allow people to build that don't have osm-gps-map. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--Makefile9
-rw-r--r--divelist.c6
-rw-r--r--gtk-gui.c10
3 files changed, 18 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d866a5c0d..e49006391 100644
--- a/Makefile
+++ b/Makefile
@@ -91,6 +91,11 @@ GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
CFLAGS += $(shell $(XSLCONFIG) --cflags)
OSMGPSMAPFLAGS += $(shell $(PKGCONFIG) --cflags osmgpsmap)
+LIBOSMGPSMAP += $(shell $(PKGCONFIG) --libs osmgpsmap 2> /dev/null)
+ifneq ($(strip $(LIBOSMGPSMAP)),)
+ GPSOBJ = gps.o
+ CFLAGS += -DHAVE_OSM_GPS_MAP
+endif
LIBZIP = $(shell $(PKGCONFIG) --libs libzip 2> /dev/null)
ifneq ($(strip $(LIBZIP)),)
@@ -126,7 +131,7 @@ ifneq ($(strip $(LIBXSLT)),)
endif
endif
-LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm -lssl -lcrypto -losmgpsmap
+LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm -lssl -lcrypto $(LIBOSMGPSMAP)
MSGLANGS=$(notdir $(wildcard po/*po))
MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.mo))
@@ -134,7 +139,7 @@ MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.m
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o deco.o planner.o \
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
gtk-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
- gps.o $(OSSUPPORT).o $(RESFILE)
+ $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
$(NAME): $(OBJS) $(MSGOBJS)
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
diff --git a/divelist.c b/divelist.c
index 3705c62ad..554fb8869 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1659,10 +1659,12 @@ void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive)
}
}
+#if HAVE_OSM_GPS_MAP
static void show_gps_location_cb(GtkWidget *menuitem, struct dive *dive)
{
show_gps_location(dive);
}
+#endif
static void expand_all_cb(GtkWidget *menuitem, GtkTreeView *tree_view)
{
@@ -2475,14 +2477,14 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
-
+#if HAVE_OSM_GPS_MAP
/* Only offer to show on map if it has a location. */
if (dive_has_location(dive)) {
menuitem = gtk_menu_item_new_with_label(_("Show in map"));
g_signal_connect(menuitem, "activate", G_CALLBACK(show_gps_location_cb), dive);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
-
+#endif
/* only offer trip editing options when we are displaying the tree model */
if (dive_list.model == dive_list.treemodel) {
int depth = gtk_tree_path_get_depth(path);
diff --git a/gtk-gui.c b/gtk-gui.c
index d21fac585..304dea344 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1062,7 +1062,9 @@ static GtkActionEntry menu_items[] = {
{ "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences..."), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, N_("Renumber..."), NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "YearlyStats", NULL, N_("Yearly Statistics"), NULL, NULL, G_CALLBACK(show_yearly_stats) },
+#if HAVE_OSM_GPS_MAP
{ "DivesLocations", NULL, N_("Dives Locations"), CTRLCHAR "M", NULL, G_CALLBACK(show_gps_locations) },
+#endif
{ "SelectEvents", NULL, N_("Select Events..."), NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "Quit", GTK_STOCK_QUIT, N_("Quit"), CTRLCHAR "Q", NULL, G_CALLBACK(quit) },
{ "About", GTK_STOCK_ABOUT, N_("About Subsurface"), NULL, NULL, G_CALLBACK(about_dialog) },
@@ -1108,9 +1110,11 @@ static const gchar* ui_string = " \
<menuitem name=\"Renumber\" action=\"Renumber\" /> \
<menuitem name=\"Autogroup\" action=\"Autogroup\" /> \
<menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \
- <menuitem name=\"YearlyStats\" action=\"YearlyStats\" /> \
- <menuitem name=\"DivesLocations\" action=\"DivesLocations\" /> \
- <menu name=\"View\" action=\"ViewMenuAction\"> \
+ <menuitem name=\"YearlyStats\" action=\"YearlyStats\" /> "
+#if HAVE_OSM_GPS_MAP
+ "<menuitem name=\"DivesLocations\" action=\"DivesLocations\" /> "
+#endif
+ "<menu name=\"View\" action=\"ViewMenuAction\"> \
<menuitem name=\"List\" action=\"ViewList\" /> \
<menuitem name=\"Profile\" action=\"ViewProfile\" /> \
<menuitem name=\"Info\" action=\"ViewInfo\" /> \