SF.net SVN: geany:[3654] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 26 20:10:48 UTC 2009


Revision: 3654
          http://geany.svn.sourceforge.net/geany/?rev=3654&view=rev
Author:   eht16
Date:     2009-03-26 20:10:47 +0000 (Thu, 26 Mar 2009)

Log Message:
-----------
Use g_win32_get_package_installation_directory_of_module() on Windows with newer GLib versions instead of deprecated API.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/main.c
    trunk/src/plugins.c
    trunk/src/win32.c
    trunk/src/win32.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-03-25 19:38:14 UTC (rev 3653)
+++ trunk/ChangeLog	2009-03-26 20:10:47 UTC (rev 3654)
@@ -1,3 +1,10 @@
+2009-03-26  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src\main.c, src\plugins.c, src\win32.c, src\win32.h:
+   Use g_win32_get_package_installation_directory_of_module() on Windows
+   with newer GLib versions instead of deprecated API.
+
+
 2009-03-25  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/build.c:

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-03-25 19:38:14 UTC (rev 3653)
+++ trunk/src/main.c	2009-03-26 20:10:47 UTC (rev 3654)
@@ -390,7 +390,7 @@
 #ifdef G_OS_WIN32
 	/* use the installation directory(the one where geany.exe is located) as the base for the
 	 * documentation and data files */
-	gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL);
+	gchar *install_dir = win32_get_installation_dir();
 
 	data_dir = g_strconcat(install_dir, "\\data", NULL); /* e.g. C:\Program Files\geany\data */
 	doc_dir = g_strconcat(install_dir, "\\doc", NULL);
@@ -440,7 +440,7 @@
 #endif
 
 #ifdef G_OS_WIN32
-	gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL);
+	gchar *install_dir = win32_get_installation_dir();
 	/* e.g. C:\Program Files\geany\lib\locale */
 	l_locale_dir = g_strconcat(install_dir, "\\share\\locale", NULL);
 	g_free(install_dir);
@@ -1068,9 +1068,14 @@
 #endif
 
 #ifdef G_OS_WIN32
-	/* On Windows, change the working directory to the Geany installation path to not lock
-	 * the directory of a file passed as command line argument (see bug #2626124). */
-	win32_set_working_directory(g_win32_get_package_installation_directory(NULL, NULL));
+	{
+		gchar *dir;
+		/* On Windows, change the working directory to the Geany installation path to not lock
+		 * the directory of a file passed as command line argument (see bug #2626124). */
+		dir = win32_get_installation_dir();
+		win32_set_working_directory(dir);
+		g_free(dir);
+	}
 #endif
 
 	/*g_timeout_add(0, (GSourceFunc)destroyapp, NULL);*/ /* useful for start time tests*/

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2009-03-25 19:38:14 UTC (rev 3653)
+++ trunk/src/plugins.c	2009-03-26 20:10:47 UTC (rev 3654)
@@ -60,6 +60,7 @@
 #include "toolbar.h"
 #include "stash.h"
 #include "keyfile.h"
+#include "win32.h"
 
 
 #ifdef G_OS_WIN32
@@ -803,10 +804,11 @@
 #ifdef G_OS_WIN32
 static gchar *get_plugin_path()
 {
-	gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL);
+	gchar *install_dir = win32_get_installation_dir();
 	gchar *path;
 
 	path = g_strconcat(install_dir, "\\lib", NULL);
+	g_free(install_dir);
 
 	return path;
 }

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2009-03-25 19:38:14 UTC (rev 3653)
+++ trunk/src/win32.c	2009-03-26 20:10:47 UTC (rev 3654)
@@ -1188,4 +1188,13 @@
 	SetCurrentDirectory(dir);
 }
 
+gchar *win32_get_installation_dir(void)
+{
+#if GLIB_CHECK_VERSION(2, 16, 0)
+	return g_win32_get_package_installation_directory_of_module(NULL);
+#else
+	return g_win32_get_package_installation_directory(NULL, NULL);
 #endif
+}
+
+#endif

Modified: trunk/src/win32.h
===================================================================
--- trunk/src/win32.h	2009-03-25 19:38:14 UTC (rev 3653)
+++ trunk/src/win32.h	2009-03-26 20:10:47 UTC (rev 3654)
@@ -61,4 +61,6 @@
 
 gchar *win32_get_shortcut_target(const gchar *file_name);
 
+gchar *win32_get_installation_dir(void);
+
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list