anjuta r4061 - in trunk: . global-tags libanjuta plugins/editor plugins/macro plugins/project-wizard plugins/symbol-browser plugins/symbol-db plugins/tools plugins/valgrind src
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4061 - in trunk: . global-tags libanjuta plugins/editor plugins/macro plugins/project-wizard plugins/symbol-browser plugins/symbol-db plugins/tools plugins/valgrind src
- Date: Sun, 6 Jul 2008 15:26:39 +0000 (UTC)
Author: jhs
Date: Sun Jul 6 15:26:39 2008
New Revision: 4061
URL: http://svn.gnome.org/viewvc/anjuta?rev=4061&view=rev
Log:
2008-07-06 Johannes Schmid <jhs gnome org>
Patch from Arun Chaganty
* global-tags/create_global_tags.sh.in:
* libanjuta/anjuta-ui.c (anjuta_ui_get_accel_file):
* libanjuta/anjuta-ui.h:
* libanjuta/anjuta-utils.c (anjuta_util_create_dir):
* libanjuta/anjuta-utils.h:
* plugins/editor/style-editor.c (apply_styles):
* plugins/editor/text_editor.c (text_editor_get_props):
* plugins/macro/macro-db.c (get_user_macro_path):
* plugins/project-wizard/druid.c (npw_druid_fill_selection_page):
* plugins/symbol-browser/an_symbol_prefs.c (update_system_tags),
(update_system_tags_only_add), (create_store),
(on_create_tags_clicked), (on_add_tags_clicked),
(on_remove_tags_clicked), (on_update_global_clicked),
(symbol_browser_load_global_tags):
* plugins/symbol-browser/plugin.c (project_root_added):
* plugins/symbol-db/plugin.c (symbol_db_activate):
* plugins/tools/editor.c (on_editor_script_toggle),
(on_editor_response):
* plugins/tools/fileop.c (atp_anjuta_tools_load),
(atp_anjuta_tools_save):
* plugins/tools/plugin.h:
* plugins/tools/variable.c (atp_variable_get_editor_variable):
* plugins/valgrind/vggeneralprefs.c (vg_general_prefs_init):
* plugins/valgrind/vgrule-list.c (vg_rule_list_add_rule):
* src/anjuta.c (anjuta_new):
(with some warning fixes)
#518594 â Get rid of .anjuta and follow fd.o specifications
Modified:
trunk/ChangeLog
trunk/global-tags/create_global_tags.sh.in
trunk/libanjuta/anjuta-ui.c
trunk/libanjuta/anjuta-ui.h
trunk/libanjuta/anjuta-utils.c
trunk/libanjuta/anjuta-utils.h
trunk/plugins/editor/style-editor.c
trunk/plugins/editor/text_editor.c
trunk/plugins/macro/macro-db.c
trunk/plugins/project-wizard/druid.c
trunk/plugins/symbol-browser/an_symbol_prefs.c
trunk/plugins/symbol-browser/plugin.c
trunk/plugins/symbol-db/plugin.c
trunk/plugins/tools/editor.c
trunk/plugins/tools/fileop.c
trunk/plugins/tools/plugin.h
trunk/plugins/tools/variable.c
trunk/plugins/valgrind/vggeneralprefs.c
trunk/plugins/valgrind/vgrule-list.c
trunk/src/anjuta.c
Modified: trunk/global-tags/create_global_tags.sh.in
==============================================================================
--- trunk/global-tags/create_global_tags.sh.in (original)
+++ trunk/global-tags/create_global_tags.sh.in Sun Jul 6 15:26:39 2008
@@ -57,7 +57,7 @@
echo "Generating System tags..."
-mkdir -p "$HOME/.anjuta/tags"
+mkdir -p "$XDG_CACHE_HOME/anjuta/tags/"
# pkg-config libraries
PKG_CONFIG=`which pkg-config 2>/dev/null`
@@ -92,11 +92,11 @@
# echo $PKG_CFLAGS
package=`basename "$pkg_file" '.pc'`
# if [ ! -e $BASEDIR/tags/$package.anjutatags.gz ] ; then
- echo "Creating tags file: $HOME/.anjuta/tags/$package.anjutatags.gz ..."
- anjuta_tags "$HOME/.anjuta/tags/$package.anjutatags" $PKG_CFLAGS > /dev/null
+ echo "Creating tags file: $XDG_CACHE_HOME/anjuta/tags/$package.anjutatags.gz ..."
+ anjuta_tags "$XDG_CACHE_HOME/anjuta/tags/$package.anjutatags" $PKG_CFLAGS > /dev/null
# fi
done
done
echo "Done"
- echo "This is just a timestamp" > $HOME/.anjuta/system-tags.cache
+ echo "This is just a timestamp" > $XDG_CACHE_HOME/anjuta/system-tags.cache
fi
Modified: trunk/libanjuta/anjuta-ui.c
==============================================================================
--- trunk/libanjuta/anjuta-ui.c (original)
+++ trunk/libanjuta/anjuta-ui.c Sun Jul 6 15:26:39 2008
@@ -951,17 +951,7 @@
static gchar *
anjuta_ui_get_accel_file (void)
{
- gchar *anjuta_dir = NULL;
- gchar *filename = NULL;
-
- anjuta_dir = anjuta_util_get_user_config_dir ();
-
- if (anjuta_dir != NULL)
- filename = g_build_filename (anjuta_dir, "anjuta-accels", NULL);
-
- g_free (anjuta_dir);
-
- return filename;
+ return anjuta_util_get_user_config_file_path ("anjuta-accels", NULL);
}
void
@@ -989,3 +979,4 @@
g_free (filename);
}
}
+
Modified: trunk/libanjuta/anjuta-ui.h
==============================================================================
--- trunk/libanjuta/anjuta-ui.h (original)
+++ trunk/libanjuta/anjuta-ui.h Sun Jul 6 15:26:39 2008
@@ -34,6 +34,7 @@
*/
#include <gtk/gtkaccelgroup.h>
#include <gtk/gtkuimanager.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
Modified: trunk/libanjuta/anjuta-utils.c
==============================================================================
--- trunk/libanjuta/anjuta-utils.c (original)
+++ trunk/libanjuta/anjuta-utils.c Sun Jul 6 15:26:39 2008
@@ -793,12 +793,34 @@
}
gboolean
-anjuta_util_create_dir (const gchar * d)
+anjuta_util_create_dir (const gchar* path)
{
- if (g_file_test (d, G_FILE_TEST_IS_DIR))
- return TRUE;
- if (mkdir (d, 0755))
+ GFile *dir = g_file_new_for_path (path);
+ GError *err = NULL;
+
+ if (g_file_query_exists (dir, NULL))
+ {
+ GFileInfo *info = g_file_query_info (dir,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+ {
+ g_message ("Warning: %s is a file. \n \
+ It is trying to be treated as a directory.",g_file_get_path (dir));
+ g_object_unref (dir);
+ return FALSE;
+ }
+ g_object_unref (info);
+ }
+ else if (!g_file_make_directory (dir, NULL, &err))
+ {
+ g_warning ("Error directory:\n %s", err->message);
+ g_object_unref (dir);
return FALSE;
+ }
+ g_object_unref (dir);
+
return TRUE;
}
@@ -1026,6 +1048,7 @@
return buffer;
}
+/* FIXME: Use gio instead */
/* Diff the text contained in uri with text. Return true if files
differ, FALSE if they are identical.
FIXME: Find a better algorithm, this seems ineffective */
@@ -1478,35 +1501,6 @@
g_free (command);
}
-/**
- * anjuta_utils_get_user_config_dir:
- *
- * Returns a base directory in which to store user-specific application
- * configuration information such as user preferences and settings.
- *
- * Return value: a new allocated string with the user config directory.
- */
-gchar *
-anjuta_util_get_user_config_dir ()
-{
- gchar *folder;
-
- folder = g_build_filename (g_get_user_config_dir (), "anjuta", NULL);
-
- if (!g_file_test (folder, G_FILE_TEST_IS_DIR))
- {
- if (g_mkdir (folder, 755) == -1)
- {
- g_warning ("There was an error creating the Anjuta config directory");
- g_free (folder);
-
- return NULL;
- }
- }
-
- return folder;
-}
-
/* The following functions are taken from gedit */
/* Note that this function replace home dir with ~ */
@@ -1625,3 +1619,162 @@
return g_string_free (truncated, FALSE);
}
+/*
+ * Functions to implement XDG Base Directory Specification
+ * http://standards.freedesktop.org/basedir-spec/latest/index.html
+ * Use this to save any config/cache/data files
+ *
+ */
+
+static gchar*
+anjuta_util_construct_pathv (const gchar* str, va_list str_list)
+{
+ GPtrArray *str_arr;
+ const gchar* tmp_str;
+ gchar* path;
+
+ str_arr = g_ptr_array_new();
+ g_ptr_array_add (str_arr, (gpointer) str);
+
+ /* Extract elements from va_list */
+ if (str != NULL)
+ {
+ while ((tmp_str = va_arg (str_list, const gchar*)) != NULL)
+ {
+ g_ptr_array_add (str_arr, tmp_str);
+ }
+ va_end (str_list);
+ }
+
+ /* Terminate the list */
+ g_ptr_array_add (str_arr, (gpointer) NULL);
+
+ path = g_build_filenamev ((gchar*) str_arr->pdata);
+ g_ptr_array_free (str_arr, TRUE);
+
+ return path;
+}
+
+static GFile*
+anjuta_util_get_user_cache_filev (const gchar* path, va_list list)
+{
+ gchar *uri_str, *base_path, *dir;
+ GFile *uri;
+ const gchar anjuta_prefix[] = "anjuta";
+ base_path = g_build_filename (g_get_user_cache_dir(), anjuta_prefix, path, NULL);
+
+ uri_str = anjuta_util_construct_pathv (base_path, list);
+ g_free (base_path);
+
+ uri = g_file_new_for_path (uri_str);
+ dir = g_path_get_dirname (uri_str);
+ g_free(uri_str);
+ if (!anjuta_util_create_dir (dir)) return NULL;
+
+ return uri;
+}
+
+GFile*
+anjuta_util_get_user_cache_file (const gchar* path, ...)
+{
+ va_list list;
+ va_start (list, path);
+ return anjuta_util_get_user_cache_filev (path, list);
+}
+
+static GFile*
+anjuta_util_get_user_config_filev (const gchar* path, va_list list)
+{
+ gchar *uri_str, *base_path, *dir;
+ GFile *uri;
+ const gchar anjuta_prefix[] = "anjuta";
+ base_path = g_build_filename (g_get_user_config_dir(), anjuta_prefix, path, NULL);
+
+ uri_str = anjuta_util_construct_pathv (base_path, list);
+ g_free (base_path);
+
+ uri = g_file_new_for_path (uri_str);
+ dir = g_path_get_dirname (uri_str);
+ g_free(uri_str);
+ if (!anjuta_util_create_dir (dir)) return NULL;
+
+ return uri;
+}
+
+GFile*
+anjuta_util_get_user_config_file (const gchar* path, ...)
+{
+ va_list list;
+ va_start (list, path);
+ return anjuta_util_get_user_config_filev (path, list);
+}
+
+static GFile*
+anjuta_util_get_user_data_filev (const gchar* path, va_list list)
+{
+ gchar *uri_str, *base_path, *dir;
+ GFile *uri;
+ const gchar anjuta_prefix[] = "anjuta";
+ base_path = g_build_filename (g_get_user_data_dir(), anjuta_prefix, path, NULL);
+
+ uri_str = anjuta_util_construct_pathv (base_path, list);
+ g_free (base_path);
+
+ uri = g_file_new_for_path (uri_str);
+ dir = g_path_get_dirname (uri_str);
+ g_free(uri_str);
+ if (!anjuta_util_create_dir (dir)) return NULL;
+
+ return uri;
+}
+
+GFile*
+anjuta_util_get_user_data_file (const gchar* path, ...)
+{
+ va_list list;
+ va_start (list, path);
+ return anjuta_util_get_user_data_filev (path, list);
+}
+
+gchar*
+anjuta_util_get_user_cache_file_path (const gchar* path, ...)
+{
+ va_list list;
+ GFile *file;
+ gchar *file_path;
+ va_start (list, path);
+ file = anjuta_util_get_user_cache_filev (path, list);
+ file_path = g_file_get_path (file);
+ g_object_unref (file);
+
+ return file_path;
+}
+
+gchar*
+anjuta_util_get_user_config_file_path (const gchar* path, ...)
+{
+ va_list list;
+ GFile *file;
+ gchar *file_path;
+ va_start (list, path);
+ file = anjuta_util_get_user_config_filev (path, list);
+ file_path = g_file_get_path (file);
+ g_object_unref (file);
+
+ return file_path;
+}
+
+gchar*
+anjuta_util_get_user_data_file_path (const gchar* path, ...)
+{
+ va_list list;
+ GFile *file;
+ gchar *file_path;;
+ va_start (list, path);
+ file = anjuta_util_get_user_data_filev (path, list);
+ file_path = g_file_get_path (file);
+ g_object_unref (file);
+
+ return file_path;
+}
+
Modified: trunk/libanjuta/anjuta-utils.h
==============================================================================
--- trunk/libanjuta/anjuta-utils.h (original)
+++ trunk/libanjuta/anjuta-utils.h Sun Jul 6 15:26:39 2008
@@ -23,6 +23,7 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <sys/types.h>
+#include <gio/gio.h>
#include <libanjuta/anjuta-preferences.h>
@@ -123,8 +124,13 @@
const gchar *doc_id,
const gchar *file_name);
-gchar *anjuta_util_get_user_config_dir (void);
-
+/* XDG BaseDir specifcation functions */
+GFile* anjuta_util_get_user_data_file (const gchar* path, ...);
+GFile* anjuta_util_get_user_cache_file (const gchar* path, ...);
+GFile* anjuta_util_get_user_config_file (const gchar* path, ...);
+gchar* anjuta_util_get_user_data_file_path (const gchar* path, ...);
+gchar* anjuta_util_get_user_cache_file_path (const gchar* path, ...);
+gchar* anjuta_util_get_user_config_file_path (const gchar* path, ...);
/* Temporarily copied here */
Modified: trunk/plugins/editor/style-editor.c
==============================================================================
--- trunk/plugins/editor/style-editor.c (original)
+++ trunk/plugins/editor/style-editor.c Sun Jul 6 15:26:39 2008
@@ -834,8 +834,7 @@
gchar *filename;
sync_to_props (se);
- filename = g_build_filename (g_get_home_dir (), ".anjuta",
- "editor-style.properties", NULL);
+ filename = anjuta_util_get_user_config_file_path ("scintilla","editor-style.properties",NULL);
ofile = fopen (filename, "w");
if (!ofile) {
DEBUG_PRINT ("Could not open %s for writing", filename);
Modified: trunk/plugins/editor/text_editor.c
==============================================================================
--- trunk/plugins/editor/text_editor.c (original)
+++ trunk/plugins/editor/text_editor.c Sun Jul 6 15:26:39 2008
@@ -1949,16 +1949,13 @@
g_free (propfile);
g_free (propdir);
- propdir = g_build_filename (g_get_home_dir(), ".anjuta" PREF_SUFFIX "/", NULL);
- propfile = g_build_filename (g_get_home_dir(), ".anjuta" PREF_SUFFIX,
- "editor-style.properties", NULL);
+ propdir = anjuta_util_get_user_config_file_path ("scintilla/",NULL);
+ propfile = anjuta_util_get_user_config_file_path ("scintilla","editor-style.properties",NULL);
/* DEBUG_PRINT ("Reading file: %s", propfile); */
/* Create user.properties file, if it doesn't exist */
if (g_file_test (propfile, G_FILE_TEST_EXISTS) == FALSE) {
- gchar* old_propfile = g_build_filename (g_get_home_dir(),
- ".anjuta"PREF_SUFFIX,
- "session.properties", NULL);
+ gchar* old_propfile = anjuta_util_get_user_config_file_path ("scintilla", "session.properties", NULL);
if (g_file_test (old_propfile, G_FILE_TEST_EXISTS) == TRUE)
anjuta_util_copy_file (old_propfile, propfile, FALSE);
g_free (old_propfile);
Modified: trunk/plugins/macro/macro-db.c
==============================================================================
--- trunk/plugins/macro/macro-db.c (original)
+++ trunk/plugins/macro/macro-db.c Sun Jul 6 15:26:39 2008
@@ -22,13 +22,14 @@
#include <libgnomevfs/gnome-vfs.h>
#include <stdlib.h>
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-utils.h>
#define PREDEFINED_MACRO_FILE PACKAGE_DATA_DIR"/macros.xml"
static gchar *
get_user_macro_path ()
{
- return g_strconcat (getenv ("HOME"), "/.anjuta/macros.xml", NULL);
+ return anjuta_util_get_user_data_file_path ("macro.xml", NULL);
}
static gboolean
Modified: trunk/plugins/project-wizard/druid.c
==============================================================================
--- trunk/plugins/project-wizard/druid.c (original)
+++ trunk/plugins/project-wizard/druid.c Sun Jul 6 15:26:39 2008
@@ -35,6 +35,7 @@
#include "autogen.h"
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-utils.h>
#include <libanjuta/interfaces/ianjuta-wizard.h>
#include <gnome.h>
@@ -47,7 +48,9 @@
/*---------------------------------------------------------------------------*/
#define PROJECT_WIZARD_DIRECTORY PACKAGE_DATA_DIR"/project"
-#define LOCAL_PROJECT_WIZARD_DIRECTORY "/.anjuta/project"
+/* Uncomment if you want to keep project wizards in a non-standard dir
+#define LOCAL_PROJECT_WIZARD_DIRECTORY anjuta_utils_data_dir/projects/
+*/
#define PIXMAP_APPWIZ_LOGO PACKAGE_DATA_DIR"/glade/applogo.png"
#define PIXMAP_APPWIZ_WATERMARK PACKAGE_DATA_DIR"/glade/appwizard.png"
@@ -295,7 +298,11 @@
/* Fill list with all project in directory */
ok = npw_header_list_readdir (this->header_list, PROJECT_WIZARD_DIRECTORY);
+#ifdef LOCAL_PROJECT_WIZARD_DIRECTORY
local_dir = g_build_filename (g_get_home_dir(), LOCAL_PROJECT_WIZARD_DIRECTORY, NULL);
+#else
+ local_dir = anjuta_util_get_user_data_file_path ("projects/",NULL);
+#endif
ok = npw_header_list_readdir (this->header_list, local_dir) || ok;
g_free (local_dir);
if (!ok)
Modified: trunk/plugins/symbol-browser/an_symbol_prefs.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol_prefs.c (original)
+++ trunk/plugins/symbol-browser/an_symbol_prefs.c Sun Jul 6 15:26:39 2008
@@ -28,14 +28,15 @@
#include <libgnomevfs/gnome-vfs.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-launcher.h>
+#include <libanjuta/anjuta-utils.h>
#include "an_symbol_prefs.h"
#include "tm_tagmanager.h"
#define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-symbol-browser-plugin.glade"
#define ICON_FILE "anjuta-symbol-browser-plugin-48.png"
-#define LOCAL_TAGS_DIR ".anjuta/tags"
-#define SYSTEM_TAGS_CACHE ".anjuta/system-tags.cache"
+#define LOCAL_TAGS_SUBDIR "tags/"
+#define SYSTEM_TAGS_CACHE "system-tags.cache"
#define SYMBOL_BROWSER_TAGS "symbol.browser.tags"
#define CREATE_GLOBAL_TAGS PACKAGE_DATA_DIR"/scripts/create_global_tags.sh"
@@ -52,7 +53,7 @@
{
gchar *output_file;
- output_file = g_build_filename (g_get_home_dir (), SYSTEM_TAGS_CACHE, NULL);
+ output_file = anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE, NULL);
DEBUG_PRINT ("Recreating system tags cache: %s", output_file);
@@ -73,7 +74,7 @@
GList *tags_files;
gchar *output_file;
- output_file = g_build_filename (g_get_home_dir (), SYSTEM_TAGS_CACHE, NULL);
+ output_file = anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE, NULL);
DEBUG_PRINT ("Recreating system tags cache: %s", output_file);
@@ -170,7 +171,7 @@
store = gtk_list_store_new (N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING,
G_TYPE_STRING);
- local_tags_dir = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, NULL);
+ local_tags_dir = anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR, NULL);
tags_dirs = g_list_prepend (tags_dirs, local_tags_dir);
/* Load the tags files */
@@ -437,10 +438,14 @@
argv = g_new0 (gchar*, argc);
argv[0] = g_strdup ("anjuta-tags");
- tmp = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, name, NULL);
- argv[1] = g_strconcat (tmp, ".anjutatags", NULL);
- g_free (tmp);
-
+
+ {
+ gchar *tmp = NULL;
+ tmp = anjuta_util_get_user_cache_file_path ("tags", name, NULL);
+ argv[1] = g_strconcat (tmp, ".anjutatags", NULL);
+ g_free (tmp);
+ }
+
argc = 2;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
{
@@ -473,13 +478,9 @@
}
/* Create local tags directory */
- tmp = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, NULL);
- if ((pid = fork()) == 0)
- {
- execlp ("mkdir", "mkdir", "-p", tmp, NULL);
- perror ("Could not execute mkdir");
- }
- waitpid (pid, NULL, 0);
+
+ tmp = anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR, NULL);
+
g_free (tmp);
/* Execute anjuta-tags to create tags for the given files */
@@ -538,27 +539,20 @@
gchar *tmp;
pid_t pid;
- /* Create local tags directory */
- tmp = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, NULL);
- if ((pid = fork()) == 0)
- {
- execlp ("mkdir", "mkdir", "-p", tmp, NULL);
- perror ("Could not execute mkdir");
- }
- waitpid (pid, NULL, 0);
- g_free (tmp);
-
uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (fileselection));
node = uris;
while (node)
{
- gchar *dest, *src, *basename;
+ gchar *dest, *src;
src = node->data;
- basename = g_path_get_basename (src);
- dest = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, basename, NULL);
- g_free (basename);
+ {
+ gchar *basename;
+ basename = g_path_get_basename (src);
+ dest = anjuta_util_get_user_cache_file_path ("tags", basename, NULL);
+ g_free (basename);
+ }
/* Copy the tags file in local tags directory */
GnomeVFSURI* source_uri = gnome_vfs_uri_new(src);
@@ -612,8 +606,7 @@
if (tags_filename)
{
gchar *file_path, *path;
- path = g_build_filename (g_get_home_dir(), LOCAL_TAGS_DIR,
- tags_filename, NULL);
+ path = anjuta_util_get_user_cache_file_path ("tags", tags_filename, NULL);
file_path = g_strconcat (path, ".anjutatags.gz", NULL);
if (!g_file_test (file_path, G_FILE_TEST_EXISTS))
@@ -739,13 +732,7 @@
return; /* Already running */
/* Create local tags directory */
- tmp = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, NULL);
- if ((pid = fork()) == 0)
- {
- execlp ("mkdir", "mkdir", "-p", tmp, NULL);
- perror ("Could not execute mkdir");
- }
- waitpid (pid, NULL, 0);
+ tmp = anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR,NULL);
g_free (tmp);
plugin->launcher = anjuta_launcher_new ();
@@ -877,8 +864,7 @@
{
gchar *system_tags_path;
/* Load gloabal tags on gtk idle */
- system_tags_path = g_build_filename (g_get_home_dir(), ".anjuta",
- "system-tags.cache", NULL);
+ system_tags_path = anjuta_util_get_user_cache_file_path (SYSTEM_TAGS_CACHE,NULL);
if (!tm_workspace_load_global_tags (system_tags_path))
{
g_message ("Added idle loop to create global tags");
Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c (original)
+++ trunk/plugins/symbol-browser/plugin.c Sun Jul 6 15:26:39 2008
@@ -22,6 +22,7 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-utils.h>
#include <libanjuta/interfaces/ianjuta-help.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
#include <libanjuta/interfaces/ianjuta-project-manager.h>
@@ -351,7 +352,7 @@
}
}
-#define LOCAL_TAGS_DIR ".anjuta/tags"
+#define LOCAL_TAGS_SUBDIR "tags/"
// add a new project
static void
@@ -402,7 +403,7 @@
"symbol_browser.tags_auto_load"))
{
gchar* pref_symbols = anjuta_preferences_get (sv_plugin->prefs, SYMBOL_BROWSER_TAGS);
- gchar* dirname = g_build_filename (g_get_home_dir (), LOCAL_TAGS_DIR, NULL);
+ gchar* dirname = anjuta_util_get_user_cache_file_path (LOCAL_TAGS_SUBDIR,NULL);
GList* packages = ianjuta_project_manager_get_packages (pm, NULL);
GList* node;
GString* str = g_string_new (pref_symbols);
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Sun Jul 6 15:26:39 2008
@@ -27,6 +27,7 @@
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-utils.h>
#include <libanjuta/interfaces/ianjuta-document-manager.h>
#include <libanjuta/interfaces/ianjuta-symbol-manager.h>
#include <libanjuta/interfaces/ianjuta-project-manager.h>
@@ -56,7 +57,6 @@
#define CTAGS_PATH "/usr/bin/ctags"
#define CHOOSER_WIDGET "preferences_folder:text:/:0:symboldb.root"
-#define LOCAL_ANJUTA_GLOBAL_DB_DIRECTORY "/.anjuta"
#define PROJECT_GLOBALS "/"
@@ -1216,7 +1216,7 @@
symbol_db_activate (AnjutaPlugin *plugin)
{
SymbolDBPlugin *symbol_db;
- gchar *home_anjuta_dir;
+ gchar *anjuta_cache_path;
DEBUG_PRINT ("SymbolDBPlugin: Activating SymbolDBPlugin plugin ...");
@@ -1241,12 +1241,11 @@
/* the globals one too */
symbol_db->sdbe_globals = symbol_db_engine_new ();
/* open it */
- home_anjuta_dir = g_strdup_printf ("%s%s", g_get_home_dir(),
- LOCAL_ANJUTA_GLOBAL_DB_DIRECTORY);
+ anjuta_cache_path = anjuta_util_get_user_cache_file_path (".");
symbol_db_engine_open_db (symbol_db->sdbe_globals,
- home_anjuta_dir,
+ anjuta_cache_path,
PROJECT_GLOBALS);
- g_free (home_anjuta_dir);
+ g_free (anjuta_cache_path);
/* create the object that'll manage the globals population */
symbol_db->sdbs = symbol_db_system_new (symbol_db, symbol_db->sdbe_globals);
Modified: trunk/plugins/tools/editor.c
==============================================================================
--- trunk/plugins/tools/editor.c (original)
+++ trunk/plugins/tools/editor.c Sun Jul 6 15:26:39 2008
@@ -642,9 +642,8 @@
}
name = atp_remove_mnemonic (command);
g_free (command);
- command = g_build_filename (g_get_home_dir(),
- LOCAL_ANJUTA_SCRIPT_DIRECTORY,
- name, NULL);
+
+ command = anjuta_util_get_user_data_file_path ("scripts/", name, NULL);
g_free (name);
/* Find a new file name */
@@ -784,7 +783,9 @@
GFile* file;
/* Check that default script directory exist */
- data = g_build_filename (g_get_home_dir(), LOCAL_ANJUTA_SCRIPT_DIRECTORY, NULL);
+ data = anjuta_util_get_user_data_file_path ("scripts/", NULL);
+
+ // TODO: Replace with g_mkdir_with_parents
make_directory (data);
g_free (data);
Modified: trunk/plugins/tools/fileop.c
==============================================================================
--- trunk/plugins/tools/fileop.c (original)
+++ trunk/plugins/tools/fileop.c Sun Jul 6 15:26:39 2008
@@ -529,7 +529,7 @@
g_free (file_name);
/* Now, user tools */
- file_name = g_build_filename (g_get_home_dir(), LOCAL_ANJUTA_TOOLS_DIRECTORY, TOOLS_FILE, NULL);
+ file_name = anjuta_util_get_user_data_file_path (TOOLS_FILE, NULL);
ok = atp_tool_list_load_from_file (atp_plugin_get_tool_list(plugin), file_name, ATP_TSTORE_LOCAL);
g_free (file_name);
if (!ok)
@@ -697,7 +697,7 @@
gboolean ok;
/* Save local tools */
- file_name = g_build_filename (g_get_home_dir(), LOCAL_ANJUTA_TOOLS_DIRECTORY, TOOLS_FILE, NULL);
+ file_name = anjuta_util_get_user_data_file_path (TOOLS_FILE, NULL);
if (NULL == (f = fopen(file_name, "w")))
{
anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell),_("Unable to open %s for writing"), file_name);
Modified: trunk/plugins/tools/plugin.h
==============================================================================
--- trunk/plugins/tools/plugin.h (original)
+++ trunk/plugins/tools/plugin.h Sun Jul 6 15:26:39 2008
@@ -32,9 +32,7 @@
#define MENU_PLACEHOLDER "/MenuMain/PlaceHolderToolMenus/MenuTools"
#define ANJUTA_TOOLS_DIRECTORY PACKAGE_DATA_DIR"/tools"
-#define LOCAL_ANJUTA_TOOLS_DIRECTORY "/.anjuta"
#define TOOLS_FILE "tools-2.xml"
-#define LOCAL_ANJUTA_SCRIPT_DIRECTORY "/.anjuta/script"
/*---------------------------------------------------------------------------*/
Modified: trunk/plugins/tools/variable.c
==============================================================================
--- trunk/plugins/tools/variable.c (original)
+++ trunk/plugins/tools/variable.c Sun Jul 6 15:26:39 2008
@@ -301,7 +301,6 @@
IAnjutaDocumentManager *docman;
IAnjutaEditor *ed;
gchar* val;
- gchar* uri;
gchar* path;
GFile* file;
GError* err = NULL;
Modified: trunk/plugins/valgrind/vggeneralprefs.c
==============================================================================
--- trunk/plugins/valgrind/vggeneralprefs.c (original)
+++ trunk/plugins/valgrind/vggeneralprefs.c Sun Jul 6 15:26:39 2008
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-utils.h>
#include "vggeneralprefs.h"
@@ -52,7 +53,7 @@
#define RUN_LIBC_FREERES_KEY "/apps/anjuta/valgrind/general/run-libc-freeres"
#define SUPPRESSIONS_KEY "/apps/anjuta/valgrind/general/suppressions"
-#define SUPPRESSIONS_DEFAULT_FILE ".anjuta/valgrind.supp"
+#define SUPPRESSIONS_DEFAULT_FILE "valgrind.supp"
static void vg_general_prefs_class_init (VgGeneralPrefsClass *klass);
static void vg_general_prefs_init (VgGeneralPrefs *prefs);
@@ -258,7 +259,7 @@
if (!(str_file = gconf_client_get_string (gconf, SUPPRESSIONS_KEY, &err)) || err != NULL) {
int fd;
- str_file = g_build_filename (g_get_home_dir (), SUPPRESSIONS_DEFAULT_FILE, NULL);
+ str_file = anjuta_util_get_user_config_file_path(SUPPRESSIONS_DEFAULT_FILE, NULL);
if ((fd = open (str_file, O_WRONLY | O_CREAT, 0666)) == -1) {
g_free (str_file);
str_file = NULL;
Modified: trunk/plugins/valgrind/vgrule-list.c
==============================================================================
--- trunk/plugins/valgrind/vgrule-list.c (original)
+++ trunk/plugins/valgrind/vgrule-list.c Sun Jul 6 15:26:39 2008
@@ -35,6 +35,7 @@
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
+#include <libanjuta/anjuta-utils.h>
#include "vgrule-list.h"
#include "vgmarshal.h"
@@ -692,7 +693,7 @@
gconf = gconf_client_get_default ();
// FIXME: hardcoded path
- list->filename = g_strdup_printf ("%s/.anjuta/valgrind.supp", getenv ("HOME"));
+ list->filename = anjuta_util_get_user_config_file_path ("valgrind.supp", NULL);
gconf_client_set_string (gconf, SUPPRESSIONS_KEY, list->filename, NULL);
g_object_unref (gconf);
}
Modified: trunk/src/anjuta.c
==============================================================================
--- trunk/src/anjuta.c (original)
+++ trunk/src/anjuta.c Sun Jul 6 15:26:39 2008
@@ -32,8 +32,7 @@
#define ANJUTA_REMEMBERED_PLUGINS "anjuta.remembered.plugins"
#define ANJUTA_SESSION_SKIP_LAST "anjuta.session.skip.last"
#define ANJUTA_SESSION_SKIP_LAST_FILES "anjuta.session.skip.last.files"
-#define USER_SESSION_PATH_NEW (g_build_filename (g_get_home_dir (), ".anjuta", \
- "session", NULL))
+#define USER_SESSION_PATH_NEW (anjuta_util_get_user_cache_file_path ("session/", NULL))
#define DEFAULT_PROFILE "file://"PACKAGE_DATA_DIR"/profiles/default.profile"
#define USER_PROFILE_NAME "user"
@@ -337,8 +336,7 @@
/* Load user session profile */
profile_name = g_path_get_basename (DEFAULT_PROFILE);
- session_profile = g_build_filename (g_get_home_dir(), ".anjuta",
- profile_name, NULL);
+ session_profile = anjuta_util_get_user_cache_file_path (profile_name, NULL);
if (g_file_test (session_profile, G_FILE_TEST_EXISTS))
{
anjuta_profile_add_plugins_from_xml (profile, session_profile,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]