diff options
author | Alan Fitton <alan@eth0.org.uk> | 2012-06-21 14:50:40 +0100 |
---|---|---|
committer | Alan Fitton <alan@eth0.org.uk> | 2012-06-21 14:50:40 +0100 |
commit | 0ec76e53cdb0b15da1dd14bb1c53134dc1f3a55b (patch) | |
tree | fc26cf0d4eaaf70d5c89988634c809869d208b67 | |
parent | ccd86becdc2c9311e4faac65aff76f7aa0e68a78 (diff) |
some changes and hacks to get GeoIP on Windows
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/installer.nsi | 19 | ||||
-rw-r--r-- | src/trg-about-window.c | 5 | ||||
-rw-r--r-- | src/trg-peers-model.c | 20 | ||||
-rw-r--r-- | src/util.c | 14 | ||||
-rw-r--r-- | src/util.h | 4 |
7 files changed, 53 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac index f0c1c64..ec9483e 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,9 @@ case "${host_os}" in esac AM_CONDITIONAL([WIN32], test "$WIN32" = "yes") +#if WIN32 +CFLAGS="$CFLAGS -IC:/MinGW/msys/1.0/include" +#endif trglicense='${docdir}-$(PACKAGE_VERSION)/COPYING' AC_SUBST(trglicense) diff --git a/src/Makefile.am b/src/Makefile.am index 4886e3f..0af3859 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -112,7 +112,8 @@ if WIN32 %.o : %.rc windres $^ -o $@ -AM_CFLAGS = -mms-bitfields -mwin32 -mwindows +CFLAGS += -mms-bitfields -mwin32 -mwindows +LDFLAGS += -Wl,--allow-multiple-definition -lws2_32 -lintl transmission_remote_gtk_SOURCES += win32.rc win32-mailslot.c INCLUDES += -O2 else diff --git a/src/installer.nsi b/src/installer.nsi index e81d627..2b9367b 100644 --- a/src/installer.nsi +++ b/src/installer.nsi @@ -62,6 +62,8 @@ Var StartMenuFolder ; English LangString NAME_SecTransmissionRemoteGTK ${LANG_ENGLISH} "Transmission Remote GTK (required)" LangString DESC_SecTransmissionRemoteGTK ${LANG_ENGLISH} "The application." +LangString NAME_GeoIP ${LANG_ENGLISH} "GeoIP database" +LangString DESC_GeoIP ${LANG_ENGLISH} "Shows the country of origin for a peer" LangString NAME_SecGlibGtkEtc ${LANG_ENGLISH} "Glib, GTK, and other dependencies (recommended)." LangString DESC_SecGlibGtkEtc ${LANG_ENGLISH} "If unset, you'll need to install these yourself." LangString NAME_SecDesktopIcon ${LANG_ENGLISH} "Create icon on desktop" @@ -186,6 +188,13 @@ Section $(NAME_SecTransmissionRemoteGTK) SecTransmissionRemoteGTK SectionEnd +Section $(NAME_GeoIP) SecGeoIP + SetOutPath $INSTDIR + + File "..\GeoIP.dat" + File "..\GeoIPv6.dat" +SectionEnd + Section $(NAME_SecGlibGtkEtc) SecGlibGtkEtc SetOutPath $INSTDIR\bin @@ -331,11 +340,6 @@ Section /o $(NAME_SecDesktopIcon) SecDesktopIcon CreateShortCut "$DESKTOP\Transmission Remote GTK.lnk" "$INSTDIR\bin\transmission-remote-gtk.exe" "" "$INSTDIR\bin\transmission-remote-gtk.exe" 0 SectionEnd -;Section "GeoIP Database" SecGeoIPDatabase -; SetOutPath "$INSTDIR" -; File "GeoIP.dat" -;SectionEnd - ;!ifndef PORTABLE ;SubSection $(NAME_SecFiletypeAssociations) SecFiletypeAssociations @@ -384,8 +388,10 @@ Section "Uninstall" ; Remove files and uninstaller Delete "$INSTDIR\COPYING.txt" Delete "$INSTDIR\README.txt" - Delete "$INSTDIR\AUTHORS.txt" + Delete "$INSTDIR\AUTHORS.txt" Delete "$INSTDIR\ChangeLog.txt" + Delete "$INSTDIR\GeoIP.dat" + Delete "$INSTDIR\GeoIPv6.dat" Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\bin\transmission-remote-gtk.exe" Delete "$INSTDIR\bin\freetype6.dll" @@ -592,6 +598,7 @@ SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecTransmissionRemoteGTK} $(DESC_SecTransmissionRemoteGTK) + !insertmacro MUI_DESCRIPTION_TEXT ${SecGeoIP} $(DESC_GeoIP) !insertmacro MUI_DESCRIPTION_TEXT ${SecGlibGtkEtc} $(DESC_SecGlibGtkEtc) !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(DESC_SecDesktopIcon) ; !insertmacro MUI_DESCRIPTION_TEXT ${SecFiletypeAssociations} $(DESC_SecFiletypeAssociations) diff --git a/src/trg-about-window.c b/src/trg-about-window.c index 03dc490..039474d 100644 --- a/src/trg-about-window.c +++ b/src/trg-about-window.c @@ -37,10 +37,7 @@ GtkWidget *trg_about_window_new(GtkWindow * parent) gchar *licenseFile; #ifdef WIN32 - gchar *moddir = - g_win32_get_package_installation_directory_of_module(NULL); - licenseFile = g_build_filename(moddir, "COPYING.TXT", NULL); - g_free(moddir); + licenseFile = trg_win32_support_path("COPYING.TXT"); #else licenseFile = g_strdup(TRGLICENSE); #endif diff --git a/src/trg-peers-model.c b/src/trg-peers-model.c index ad1d021..f812bee 100644 --- a/src/trg-peers-model.c +++ b/src/trg-peers-model.c @@ -246,12 +246,24 @@ static void trg_peers_model_init(TrgPeersModel * self) column_types); #ifdef HAVE_GEOIP - if (g_file_test(TRG_GEOIP_DATABASE, G_FILE_TEST_EXISTS) == TRUE) - priv->geoip = GeoIP_open(TRG_GEOIP_DATABASE, +#ifdef WIN32 + gchar *geoip_db_path = trg_win32_support_path("GeoIP.dat"); + gchar *geoip_v6_db_path = trg_win32_support_path("GeoIP.dat"); +#else + gchar *geoip_db_path = g_strdup(TRG_GEOIP_DATABASE); + gchar *geoip_v6_db_path = g_strdup(TRG_GEOIPV6_DATABASE); +#endif + + if (g_file_test(geoip_db_path, G_FILE_TEST_EXISTS) == TRUE) + priv->geoip = GeoIP_open(geoip_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); - if (g_file_test(TRG_GEOIPV6_DATABASE, G_FILE_TEST_EXISTS) == TRUE) - priv->geoipv6 = GeoIP_open(TRG_GEOIPV6_DATABASE, + + if (g_file_test(geoip_v6_db_path, G_FILE_TEST_EXISTS) == TRUE) + priv->geoipv6 = GeoIP_open(geoip_v6_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); + + g_free(geoip_db_path); + g_free(geoip_v6_db_path); #endif } @@ -19,6 +19,10 @@ /* Many of these functions are taken from the Transmission Project. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <limits.h> #include <stdlib.h> #include <math.h> @@ -608,3 +612,13 @@ GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing) #endif return box; } + +#ifdef WIN32 +gchar *trg_win32_support_path(gchar *file) { + gchar *moddir = + g_win32_get_package_installation_directory_of_module(NULL); + gchar *path = g_build_filename(moddir, file, NULL); + g_free(moddir); + return path; +} +#endif
\ No newline at end of file @@ -98,4 +98,8 @@ gboolean is_minimised_arg(const gchar * arg); GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing); GtkWidget *trg_hbox_new(gboolean homogeneous, gint spacing); +#ifdef WIN32 +gchar *trg_win32_support_path(gchar *file); +#endif + #endif /* UTIL_H_ */ |