Don't use the deprectated g_win32_get_package_installation_subdirectory().
authorTor Lillqvist <tml@novell.com>
Sat, 13 Sep 2008 19:57:37 +0000 (19:57 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sat, 13 Sep 2008 19:57:37 +0000 (19:57 +0000)
2008-09-13  Tor Lillqvist  <tml@novell.com>

* pango/pango-utils.c: Don't use the deprectated
g_win32_get_package_installation_subdirectory(). Use
g_win32_get_package_installation_directory_of_module()
instead. Also, don't use the deprecated silly
G_WIN32_DLLMAIN_FOR_DLL_NAME() macro, but an explicit minimal
DllMain() that just saves the DLL handle.

svn path=/trunk/; revision=2718

ChangeLog
pango/pango-utils.c

index 40a88c5..8ec7957 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-13  Tor Lillqvist  <tml@novell.com>
+
+       * pango/pango-utils.c: Don't use the deprectated
+       g_win32_get_package_installation_subdirectory(). Use
+       g_win32_get_package_installation_directory_of_module()
+       instead. Also, don't use the deprecated silly
+       G_WIN32_DLLMAIN_FOR_DLL_NAME() macro, but an explicit minimal
+       DllMain() that just saves the DLL handle.
+
 2008-09-11  Behdad Esfahbod  <behdad@gnome.org>
 
        Bug 551865 – Can't change justification of a PangoLayout after first
index f6beaef..fae4e7f 100644 (file)
@@ -657,18 +657,34 @@ pango_config_key_get (const char *key)
 
 #ifdef G_OS_WIN32
 
-/* DllMain function needed to tuck away the DLL name */
+/* DllMain function needed to tuck away the DLL handle */
+
+static HMODULE pango_dll;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+        DWORD     fdwReason,
+        LPVOID    lpvReserved)
+{
+  switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+      pango_dll = (HMODULE) hinstDLL;
+      break;
+    }
+
+  return TRUE;
+}
 
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
 #endif
 
 /**
  * pango_get_sysconf_subdirectory:
  *
  * On Unix, returns the name of the "pango" subdirectory of SYSCONFDIR
- * (which is set at compile time). On Win32, returns a subdirectory of
- * the Pango installation directory (which is deduced at run time from
- * the DLL's location, or stored in the Registry).
+ * (which is set at compile time). On Windows, returns the etc\pango
+ * subdirectory of the Pango installation directory (which is deduced
+ * at run time from the DLL's location).
  *
  * Return value: the Pango sysconf directory. The returned string should
  * not be freed.
@@ -680,9 +696,11 @@ pango_get_sysconf_subdirectory (void)
   static gchar *result = NULL;
 
   if (result == NULL)
-    result = g_win32_get_package_installation_subdirectory
-      (PACKAGE " " VERSION, dll_name, "etc\\pango");
-
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
+      result = g_build_filename (root, "etc\\pango", NULL);
+      g_free (root);
+    }
   return result;
 #else
   return SYSCONFDIR "/pango";
@@ -693,10 +711,9 @@ pango_get_sysconf_subdirectory (void)
  * pango_get_lib_subdirectory:
  *
  * On Unix, returns the name of the "pango" subdirectory of LIBDIR
- * (which is set at compile time). On Win32, returns the Pango
- * installation directory (which is deduced at run time from the DLL's
- * location, or stored in the Registry). The returned string should
- * not be freed.
+ * (which is set at compile time). On Windows, returns the lib\pango
+ * subdirectory of the Pango installation directory (which is deduced
+ * at run time from the DLL's location).
  *
  * Return value: the Pango lib directory. The returned string should
  * not be freed.
@@ -708,9 +725,11 @@ pango_get_lib_subdirectory (void)
   static gchar *result = NULL;
 
   if (result == NULL)
-    result = g_win32_get_package_installation_subdirectory
-      (PACKAGE " " VERSION, dll_name, "lib\\pango");
-
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
+      result = g_build_filename (root, "lib\\pango", NULL);
+      g_free (root);
+    }
   return result;
 #else
   return LIBDIR "/pango";