libgsf r1024 - in trunk: . gsf



Author: jody
Date: Sun Nov 23 18:43:57 2008
New Revision: 1024
URL: http://svn.gnome.org/viewvc/libgsf?rev=1024&view=rev

Log:
2008-11-23  Jody Goldberg <jody gnome org>

	* gsf/gsf-utils.c (DllMain) : glib-2.18 deprecated
	  G_WIN32_DLLMAIN_FOR_DLL_NAME, create a DllMain ourselves to capture
	  the dll handle.
	(gsf_init) : use it here with g_win32_get_package_installation_directory_of_module.

	* configure.in : add MSGs for the preceding bz2 test.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.in
   trunk/gsf/gsf-utils.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Nov 23 18:43:57 2008
@@ -1,5 +1,8 @@
 libgsf 1.14.11
 
+Jody:
+	* win32 build fix for glib-2.18 deprecation.
+
 Morten:
 	* Solaris compilation issue.  [#558253]
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Nov 23 18:43:57 2008
@@ -331,6 +331,8 @@
 
 with_bz2=false
 if test "x$test_bz2" = xtrue ; then
+   AC_MSG_CHECKING([usable libbz2])
+
    dnl AC_CHECK_LIB doesn't work with the Windows port of libbz2 because
    dnl it uses the __stdcall calling convention where the callee cleans
    dnl up the stack.  You have to include <bzlib.h> in order to get the
@@ -359,6 +361,7 @@
    if test "$bz2_ok" = yes; then
 	AC_DEFINE(HAVE_BZ2, 1, [Is bzip2 available and enabled])
 	BZ2_LIBS="-lbz2"
+	AC_MSG_RESULT($bz2_ok)
    else
 	AC_MSG_WARN(*** BZ2 support disabled (BZ2 header or library not found) ***)
    fi

Modified: trunk/gsf/gsf-utils.c
==============================================================================
--- trunk/gsf/gsf-utils.c	(original)
+++ trunk/gsf/gsf-utils.c	Sun Nov 23 18:43:57 2008
@@ -84,11 +84,6 @@
 static void base64_init (void);
 #endif
 
-#ifdef G_OS_WIN32
-#include <windows.h>
-G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
-#endif
-
 #ifdef _GSF_GTYPE_THREADING_FIXED
 typedef GTypeModule      GsfDummyTypeModule;
 typedef GTypeModuleClass GsfDummyTypeModuleClass;
@@ -110,6 +105,19 @@
 static GTypeModule *static_type_module = NULL;
 #endif
 
+#ifdef G_OS_WIN32
+#include <windows.h>
+static HMODULE gsf_dll_hmodule;
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL, DWORD fdwReason, G_GNUC_UNUSED LPVOID lpvReserved)
+{
+	if (fdwReason == DLL_PROCESS_ATTACH) gsf_dll_hmodule = hinstDLL;
+	return TRUE;
+}
+#endif
+
 /**
  * gsf_init :
  *
@@ -118,18 +126,23 @@
 void
 gsf_init (void)
 {
+	static gboolean libgsf_initialized = FALSE;
+	if (libgsf_initialized)
+		return;
+
 #ifdef ENABLE_NLS
 #ifdef G_OS_WIN32
-#undef GNOMELOCALEDIR
-	gchar *prefix = g_win32_get_package_installation_directory (NULL, dll_name);
-	gchar *GNOMELOCALEDIR = g_build_filename (prefix, "lib/locale", NULL);
-	g_free (prefix);
-#endif
-	bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
-#ifdef G_OS_WIN32
-	g_free (GNOMELOCALEDIR);
+	{
+		char *pkg_dir	  = g_win32_get_package_installation_directory_of_module (gsf_dll_hmodule);
+		gchar *locale_dir = g_build_filename (pkg_dir, "lib/locale", NULL);
+		bindtextdomain (GETTEXT_PACKAGE, locale_dir);
+		g_free (locale_dir);
+		g_free (pkg_dir);
+	}
+#else
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 #endif
-	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #endif
 
 	g_type_init ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]