[Rawstudio-commit] r2040 - trunk/src

Anders Brander anders at brander.dk
Mon Sep 29 01:45:07 CEST 2008


Author: abrander
Date: 2008-09-29 01:45:06 +0200 (Mon, 29 Sep 2008)
New Revision: 2040

Modified:
   trunk/src/toolbox.c
Log:
Ported curve_context_callback_save() and curve_context_callback_open() to rs_confdir_get().

Modified: trunk/src/toolbox.c
===================================================================
--- trunk/src/toolbox.c	2008-09-28 23:34:19 UTC (rev 2039)
+++ trunk/src/toolbox.c	2008-09-28 23:45:06 UTC (rev 2040)
@@ -32,6 +32,7 @@
 #include "rs-preview-widget.h"
 #include "rs-histogram.h"
 #include "rs-photo.h"
+#include "rs-utils.h"
 
 /* used for gui_adj_reset_callback() */
 struct cb_carrier {
@@ -228,7 +229,7 @@
 {
 	RSCurveWidget *curve = RS_CURVE_WIDGET(user_data);
 	GtkWidget *fc;
-	GString *dir;
+	gchar *dir;
 
 	fc = gtk_file_chooser_dialog_new (_("Export File"), NULL,
 		GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -240,14 +241,10 @@
 #endif
 
 	/* Set default directory */
-	dir = g_string_new(g_get_home_dir());
-	g_string_append(dir, G_DIR_SEPARATOR_S);
-	g_string_append(dir, DOTDIR);
-	g_string_append(dir, G_DIR_SEPARATOR_S);
-	g_string_append(dir, "curves");
-	g_mkdir_with_parents(dir->str, 00755);
-	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), dir->str);
-	g_string_free(dir, TRUE);
+	dir = g_build_filename(rs_confdir_get(), "curves", NULL);
+	g_mkdir_with_parents(dir, 00755);
+	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), dir);
+	g_free(dir);
 
 	if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT)
 	{
@@ -276,7 +273,7 @@
 {
 	RSCurveWidget *curve = RS_CURVE_WIDGET(user_data);
 	GtkWidget *fc;
-	GString *dir;
+	gchar *dir;
 
 	fc = gtk_file_chooser_dialog_new (_("Open curve ..."), NULL,
 		GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -285,14 +282,10 @@
 	gtk_dialog_set_default_response(GTK_DIALOG(fc), GTK_RESPONSE_ACCEPT);
 
 	/* Set default directory */
-	dir = g_string_new(g_get_home_dir());
-	g_string_append(dir, G_DIR_SEPARATOR_S);
-	g_string_append(dir, DOTDIR);
-	g_string_append(dir, G_DIR_SEPARATOR_S);
-	g_string_append(dir, "curves");
-	g_mkdir_with_parents(dir->str, 00755);
-	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), dir->str);
-	g_string_free(dir, TRUE);
+	dir = g_build_filename(rs_confdir_get(), "curves", NULL);
+	g_mkdir_with_parents(dir, 00755);
+	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (fc), dir);
+	g_free(dir);
 
 	if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT)
 	{




More information about the Rawstudio-commit mailing list