gtk+ r21381 - in trunk: . gdk-pixbuf gtk



Author: tml
Date: Sat Sep 13 19:31:29 2008
New Revision: 21381
URL: http://svn.gnome.org/viewvc/gtk+?rev=21381&view=rev

Log:
2008-09-13  Tor Lillqvist  <tml novell com>

	* gdk-pixbuf/gdk-pixbuf-io.c
	* gtk/gtkmain.c: Don't use the deprectated
	g_win32_get_package_installation_directory() and
	g_win32_get_package_installation_subdirectory() functions. 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.



Modified:
   trunk/ChangeLog
   trunk/gdk-pixbuf/ChangeLog
   trunk/gdk-pixbuf/gdk-pixbuf-io.c
   trunk/gtk/gtkmain.c

Modified: trunk/gdk-pixbuf/gdk-pixbuf-io.c
==============================================================================
--- trunk/gdk-pixbuf/gdk-pixbuf-io.c	(original)
+++ trunk/gdk-pixbuf/gdk-pixbuf-io.c	Sat Sep 13 19:31:29 2008
@@ -228,8 +228,23 @@
   
 #ifdef G_OS_WIN32
 
-/* DllMain function needed to tuck away the gdk-pixbuf DLL name */
-G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
+/* DllMain function needed to tuck away the gdk-pixbuf DLL handle */
+
+static HMODULE gdk_pixbuf_dll;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+	 DWORD     fdwReason,
+	 LPVOID    lpvReserved)
+{
+	switch (fdwReason) {
+	case DLL_PROCESS_ATTACH:
+		gdk_pixbuf_dll = (HMODULE) hinstDLL;
+		break;
+	}
+
+  return TRUE;
+}
 
 static char *
 get_toplevel (void)
@@ -237,8 +252,7 @@
   static char *toplevel = NULL;
 
   if (toplevel == NULL)
-    toplevel = g_win32_get_package_installation_subdirectory
-      (NULL, dll_name, "");
+	  toplevel = g_win32_get_package_installation_directory_of_module (gdk_pixbuf_dll);
 
   return toplevel;
 }
@@ -249,8 +263,7 @@
   static char *sysconfdir = NULL;
 
   if (sysconfdir == NULL)
-    sysconfdir = g_win32_get_package_installation_subdirectory
-      (NULL, dll_name, "etc");
+	  sysconfdir = g_build_filename (get_toplevel (), "etc", NULL);
 
   return sysconfdir;
 }

Modified: trunk/gtk/gtkmain.c
==============================================================================
--- trunk/gtk/gtkmain.c	(original)
+++ trunk/gtk/gtkmain.c	Sat Sep 13 19:31:29 2008
@@ -68,7 +68,22 @@
 
 #ifdef G_OS_WIN32
 
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
+static HMODULE gtk_dll;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+	 DWORD     fdwReason,
+	 LPVOID    lpvReserved)
+{
+  switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+      gtk_dll = (HMODULE) hinstDLL;
+      break;
+    }
+
+  return TRUE;
+}
 
 /* This here before inclusion of gtkprivate.h so that it sees the
  * original GTK_LOCALEDIR definition. Yeah, this is a bit sucky.
@@ -80,7 +95,7 @@
   if (gtk_localedir == NULL)
     {
       const gchar *p;
-      gchar *temp;
+      gchar *root, *temp;
       
       /* GTK_LOCALEDIR ends in either /lib/locale or
        * /share/locale. Scan for that slash.
@@ -91,8 +106,9 @@
       while (*--p != '/')
 	;
 
-      temp = g_win32_get_package_installation_subdirectory
-        (NULL, dll_name, p);
+      root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      temp = g_build_filename (root, p, NULL);
+      g_free (root);
 
       /* gtk_localedir is passed to bindtextdomain() which isn't
        * UTF-8-aware.
@@ -307,8 +323,11 @@
 {
   static char *gtk_datadir = NULL;
   if (gtk_datadir == NULL)
-    gtk_datadir = g_win32_get_package_installation_subdirectory
-      (NULL, dll_name, "share");
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gtk_datadir = g_build_filename (root, "share", NULL);
+      g_free (root);
+    }
 
   return gtk_datadir;
 }
@@ -318,8 +337,11 @@
 {
   static char *gtk_libdir = NULL;
   if (gtk_libdir == NULL)
-    gtk_libdir = g_win32_get_package_installation_subdirectory
-      (NULL, dll_name, "lib");
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gtk_libdir = g_build_filename (root, "lib", NULL);
+      g_free (root);
+    }
 
   return gtk_libdir;
 }
@@ -329,8 +351,11 @@
 {
   static char *gtk_sysconfdir = NULL;
   if (gtk_sysconfdir == NULL)
-    gtk_sysconfdir = g_win32_get_package_installation_subdirectory
-      (NULL, dll_name, "etc");
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gtk_sysconfdir = g_build_filename (root, "etc", NULL);
+      g_free (root);
+    }
 
   return gtk_sysconfdir;
 }
@@ -340,8 +365,7 @@
 {
   static char *gtk_data_prefix = NULL;
   if (gtk_data_prefix == NULL)
-    gtk_data_prefix = g_win32_get_package_installation_directory
-      (NULL, dll_name);
+    gtk_data_prefix = g_win32_get_package_installation_directory_of_module (gtk_dll);
 
   return gtk_data_prefix;
 }



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