gedit r6687 - in branches/win32: . gedit



Author: icq
Date: Mon Dec 22 21:30:54 2008
New Revision: 6687
URL: http://svn.gnome.org/viewvc/gedit?rev=6687&view=rev

Log:
2008-12-22  Ignacio Casal Quinteiro  <nacho resa gmail com>

        * gedit/gedit-utils.c:
        * gedit/gedit-utils.h:
        * gedit/gedit-app.c:
        * gedit/gedit-dirs.c:
        * gedit/gedit-prefs-manager-app.c:
        * gedit/gedit-dirs.h:
        * gedit/gedit-style-scheme-manager.c:
        * gedit/gedit-plugins-engine.c:
        * gedit/Makefile.am:
        Added gedit-dirs.[ch] to manage the dir cross platform funcs.



Added:
   branches/win32/gedit/gedit-dirs.c   (contents, props changed)
   branches/win32/gedit/gedit-dirs.h   (contents, props changed)
Modified:
   branches/win32/ChangeLog
   branches/win32/gedit/Makefile.am
   branches/win32/gedit/gedit-app.c
   branches/win32/gedit/gedit-plugins-engine.c
   branches/win32/gedit/gedit-prefs-manager-app.c
   branches/win32/gedit/gedit-style-scheme-manager.c
   branches/win32/gedit/gedit-utils.c
   branches/win32/gedit/gedit-utils.h

Modified: branches/win32/gedit/Makefile.am
==============================================================================
--- branches/win32/gedit/Makefile.am	(original)
+++ branches/win32/gedit/Makefile.am	Mon Dec 22 21:30:54 2008
@@ -13,6 +13,7 @@
 	$(WARN_CFLAGS)							\
 	$(DISABLE_DEPRECATED_CFLAGS)					\
 	-DDATADIR=\""$(datadir)"\"					\
+	-DLIBDIR=\""$(libdir)"\"					\
 	-DGEDIT_DATADIR=\""$(datadir)/gedit-2"\"			\
 	-DGEDIT_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"		\
 	-DGEDIT_UIDIR=\""$(datadir)/gedit-2/ui/"\"			\
@@ -76,7 +77,8 @@
 	gedit-prefs-manager-private.h	\
 	sexy-icon-entry.h		\
 	gedittextregion.h		\
-	gedit-session.h
+	gedit-session.h			\
+	gedit-dirs.h
 
 INST_H_FILES =				\
 	gedit-app.h			\
@@ -130,6 +132,7 @@
 	gedit-commands-view.c		\
 	gedit-convert.c			\
 	gedit-debug.c			\
+	gedit-dirs.c			\
 	gedit-document.c 		\
 	gedit-document-loader.c		\
 	gedit-gio-document-loader.c	\

Modified: branches/win32/gedit/gedit-app.c
==============================================================================
--- branches/win32/gedit/gedit-app.c	(original)
+++ branches/win32/gedit/gedit-app.c	Mon Dec 22 21:30:54 2008
@@ -44,6 +44,7 @@
 #include "gedit-debug.h"
 #include "gedit-utils.h"
 #include "gedit-enum-types.h"
+#include "gedit-dirs.h"
 
 
 #define GEDIT_PAGE_SETUP_FILE		"gedit-page-setup"
@@ -132,7 +133,7 @@
 	gchar *config_dir;
 	gchar *accel_file = NULL;
 	
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 	
 	if (config_dir != NULL)
 	{
@@ -180,7 +181,7 @@
 	gchar *config_dir;
 	gchar *setup = NULL;
 	
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 	
 	if (config_dir != NULL)
 	{
@@ -254,7 +255,7 @@
 	gchar *config_dir;
 	gchar *settings = NULL;
 	
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 	
 	if (config_dir != NULL)
 	{

Added: branches/win32/gedit/gedit-dirs.c
==============================================================================
--- (empty file)
+++ branches/win32/gedit/gedit-dirs.c	Mon Dec 22 21:30:54 2008
@@ -0,0 +1,111 @@
+/*
+ * gedit-dirs.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 Ignacio Casal Quinteiro
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, 
+ * Boston, MA 02111-1307, USA. 
+ */
+
+#include "gedit-dirs.h"
+
+gchar *
+gedit_dirs_get_config_dir ()
+{
+#ifndef G_OS_WIN32
+	const gchar *home;
+	
+	home = g_get_home_dir ();
+	
+	if (home != NULL)
+	{
+		return g_build_filename (home,
+					 ".gnome2",
+					 NULL);
+	}
+#else
+	return g_strdup (g_get_user_config_dir ());
+#endif
+	return NULL;
+}
+
+gchar *
+gedit_dirs_get_gedit_data_dir (void)
+{
+	gchar *data_dir;
+
+#ifndef G_OS_WIN32
+	data_dir = g_build_filename (DATADIR,
+				     "gedit-2",
+				     NULL);
+#else
+	gchar *win32_dir;
+	
+	win32_dir = g_win32_get_package_installation_directory_of_module (NULL)
+
+	data_dir = g_build_filename (win32_dir,
+				     "share",
+				     "gedit-2",
+				     NULL);
+	
+	g_free (win32_dir);
+#endif
+
+	return data_dir;
+}
+
+gchar *
+gedit_dirs_get_gedit_lib_dir (void)
+{
+	gchar *lib_dir;
+
+#ifndef G_OS_WIN32
+	lib_dir = g_build_filename (LIBDIR,
+				    "gedit-2",
+				    NULL);
+#else
+	gchar *win32_dir;
+	
+	win32_dir = g_win32_get_package_installation_directory_of_module (NULL)
+
+	lib_dir = g_build_filename (win32_dir,
+				    "lib",
+				    "gedit-2",
+				    NULL);
+	
+	g_free (win32_dir);
+#endif
+
+	return lib_dir;
+}
+
+gchar *
+gedit_dirs_get_ui_file (const gchar *file)
+{
+	gchar *datadir;
+	gchar *ui_file;
+
+	g_return_val_if_fail (file != NULL, NULL);
+	
+	datadir = gedit_dirs_get_gedit_data_dir ();
+	ui_file = g_build_filename (datadir,
+				    "ui",
+				    file,
+				    NULL);
+	g_free (datadir);
+	
+	return ui_file;
+}

Added: branches/win32/gedit/gedit-dirs.h
==============================================================================
--- (empty file)
+++ branches/win32/gedit/gedit-dirs.h	Mon Dec 22 21:30:54 2008
@@ -0,0 +1,41 @@
+/*
+ * gedit-dirs.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 Ignacio Casal Quinteiro
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, 
+ * Boston, MA 02111-1307, USA. 
+ */
+
+
+#ifndef __GEDIT_DIRS_H__
+#define __GEDIT_DIRS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gchar		*gedit_dirs_get_config_dir		(void);
+
+gchar		*gedit_dirs_get_gedit_data_dir		(void);
+
+gchar		*gedit_dirs_get_gedit_lib_dir		(void);
+
+gchar		*gedit_dirs_get_ui_file			(const gchar *file);
+
+G_END_DECLS
+
+#endif /* __GEDIT_DIRS_H__ */

Modified: branches/win32/gedit/gedit-plugins-engine.c
==============================================================================
--- branches/win32/gedit/gedit-plugins-engine.c	(original)
+++ branches/win32/gedit/gedit-plugins-engine.c	Mon Dec 22 21:30:54 2008
@@ -44,7 +44,7 @@
 #include "gedit-app.h"
 #include "gedit-plugin-loader.h"
 #include "gedit-object-module.h"
-#include "gedit-utils.h"
+#include "gedit-dirs.h"
 
 #define GEDIT_PLUGINS_ENGINE_BASE_KEY "/apps/gedit-2/plugins"
 #define GEDIT_PLUGINS_ENGINE_KEY GEDIT_PLUGINS_ENGINE_BASE_KEY "/active-plugins"
@@ -183,7 +183,7 @@
 	int i;
 
 	/* load user's plugins */
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 	
 	if (config_dir != NULL)
 	{

Modified: branches/win32/gedit/gedit-prefs-manager-app.c
==============================================================================
--- branches/win32/gedit/gedit-prefs-manager-app.c	(original)
+++ branches/win32/gedit/gedit-prefs-manager-app.c	Mon Dec 22 21:30:54 2008
@@ -44,7 +44,7 @@
 #include "gedit-window.h"
 #include "gedit-window-private.h"
 #include "gedit-style-scheme-manager.h"
-#include "gedit-utils.h"
+#include "gedit-dirs.h"
 
 static void gedit_prefs_manager_editor_font_changed	(GConfClient *client,
 							 guint        cnxn_id,
@@ -176,7 +176,7 @@
 
 		state_file = g_key_file_new ();
 	
-		config_dir = gedit_utils_get_config_dir ();
+		config_dir = gedit_dirs_get_config_dir ();
 	
 		if (config_dir == NULL)
 		{
@@ -279,7 +279,7 @@
 	state_file = get_gedit_state_file ();
 	g_return_val_if_fail (state_file != NULL, FALSE);
 
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 
 	if (config_dir == NULL)
 	{

Modified: branches/win32/gedit/gedit-style-scheme-manager.c
==============================================================================
--- branches/win32/gedit/gedit-style-scheme-manager.c	(original)
+++ branches/win32/gedit/gedit-style-scheme-manager.c	Mon Dec 22 21:30:54 2008
@@ -36,7 +36,7 @@
 
 #include "gedit-style-scheme-manager.h"
 #include "gedit-prefs-manager.h"
-#include "gedit-utils.h"
+#include "gedit-dirs.h"
 
 static GtkSourceStyleSchemeManager *style_scheme_manager = NULL;
 
@@ -46,7 +46,7 @@
 	gchar *config_dir;
 	gchar *dir = NULL;
 	
-	config_dir = gedit_utils_get_config_dir ();
+	config_dir = gedit_dirs_get_config_dir ();
 	
 	if (config_dir != NULL)
 	{

Modified: branches/win32/gedit/gedit-utils.c
==============================================================================
--- branches/win32/gedit/gedit-utils.c	(original)
+++ branches/win32/gedit/gedit-utils.c	Mon Dec 22 21:30:54 2008
@@ -1428,23 +1428,3 @@
 	
 	return TRUE;
 }
-
-gchar *
-gedit_utils_get_config_dir ()
-{
-#ifndef G_OS_WIN32
-	const gchar *home;
-	
-	home = g_get_home_dir ();
-	
-	if (home != NULL)
-	{
-		return g_build_filename (home,
-					 ".gnome2",
-					 NULL);
-	}
-#else
-	return g_strdup (g_get_user_config_dir ());
-#endif
-	return NULL;
-}

Modified: branches/win32/gedit/gedit-utils.h
==============================================================================
--- branches/win32/gedit/gedit-utils.h	(original)
+++ branches/win32/gedit/gedit-utils.h	Mon Dec 22 21:30:54 2008
@@ -152,8 +152,6 @@
 /* Turns data from a drop into a list of well formatted uris */
 gchar 	       **gedit_utils_drop_get_uris		(GtkSelectionData *selection_data);
 
-gchar 		*gedit_utils_get_config_dir		(void);
-
 G_END_DECLS
 
 #endif /* __GEDIT_UTILS_H__ */



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