[gimp/tito: 30/50] Use the gimp user directory to store history and prefs.(Creates new folder 'tito')
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/tito: 30/50] Use the gimp user directory to store history and prefs.(Creates new folder 'tito')
- Date: Sat, 9 Nov 2013 23:20:45 +0000 (UTC)
commit 4daf250e3723d0d655a11e72eb5de2e951c02e27
Author: Srihari Sriraman <srihari c42 in>
Date: Sun Sep 9 00:23:57 2012 +0530
Use the gimp user directory to store history and prefs.(Creates new folder 'tito')
app/dialogs/tito-dialog.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/app/dialogs/tito-dialog.c b/app/dialogs/tito-dialog.c
index 8c88864..e16bd1f 100644
--- a/app/dialogs/tito-dialog.c
+++ b/app/dialogs/tito-dialog.c
@@ -20,6 +20,7 @@
#include <time.h>
#include <ctype.h>
#include <stdlib.h>
+#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
@@ -741,6 +742,28 @@ tito_finalizer(void)
gtk_widget_destroy(tito_dialog);
}
+static void
+initialize_storage (void)
+{
+ gchar *dir_filename = g_build_filename (gimp_directory (), "tito", NULL);
+
+ g_mkdir (dir_filename,
+ S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP |
+ S_IROTH | S_IXOTH);
+
+ history_file_path= g_new(gchar, 1024);
+ strcpy(history_file_path, dir_filename);
+
+ preference_file_path= g_new(gchar,1024);
+ strcpy(preference_file_path, dir_filename);
+
+ strcat(history_file_path,"/history");
+ strcat(preference_file_path,"/preferences");
+
+ g_free (dir_filename);
+}
+
gboolean
tito_initializer(void)
{
@@ -751,14 +774,7 @@ tito_initializer(void)
if(first_time)
{
- history_file_path= g_new(gchar, 1024);
- strcpy(history_file_path, g_get_user_data_dir());
-
- preference_file_path= g_new(gchar,1024);
- strcpy(preference_file_path, g_get_user_config_dir());
-
- strcat(history_file_path,"/history_tito");
- strcat(preference_file_path,"/preferences_tito");
+ initialize_storage();
for(i=0;i<MAX_HISTORY_ACTIONS;i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]