[Rawstudio-commit] r2030 - trunk/src
Anders Brander
anders at brander.dk
Mon Sep 29 00:57:40 CEST 2008
Author: abrander
Date: 2008-09-29 00:57:40 +0200 (Mon, 29 Sep 2008)
New Revision: 2030
Modified:
trunk/src/rawstudio.c
trunk/src/rawstudio.h
trunk/src/rs-batch.c
trunk/src/rs-utils.c
trunk/src/rs-utils.h
Log:
Moved rs_confdir_get() to rs-utils.c (and refactored a bit).
Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c 2008-09-24 16:59:20 UTC (rev 2029)
+++ trunk/src/rawstudio.c 2008-09-28 22:57:40 UTC (rev 2030)
@@ -550,25 +550,6 @@
}
gchar *
-rs_confdir_get()
-{
- static gchar *dir = NULL;
-
- if (!dir)
- {
- GString *gs = g_string_new(g_get_home_dir());
- g_string_append(gs, G_DIR_SEPARATOR_S);
- g_string_append(gs, ".rawstudio/");
- dir = gs->str;
- g_string_free(gs, FALSE);
- }
-
- g_mkdir_with_parents(dir, 00755);
-
- return dir;
-}
-
-gchar *
rs_dotdir_get(const gchar *filename)
{
gchar *ret;
Modified: trunk/src/rawstudio.h
===================================================================
--- trunk/src/rawstudio.h 2008-09-24 16:59:20 UTC (rev 2029)
+++ trunk/src/rawstudio.h 2008-09-28 22:57:40 UTC (rev 2030)
@@ -281,7 +281,6 @@
void rs_free(RS_BLOB *rs);
void rs_set_photo(RS_BLOB *rs, RS_PHOTO *photo);
void rs_set_snapshot(RS_BLOB *rs, gint snapshot);
-gchar *rs_confdir_get();
gchar *rs_dotdir_get(const gchar *filename);
gchar *rs_thumb_get_name(const gchar *src);
void rs_white_black_point(RS_BLOB *rs);
Modified: trunk/src/rs-batch.c
===================================================================
--- trunk/src/rs-batch.c 2008-09-24 16:59:20 UTC (rev 2029)
+++ trunk/src/rs-batch.c 2008-09-28 22:57:40 UTC (rev 2030)
@@ -34,6 +34,7 @@
#include "rs-image.h"
#include "rs-photo.h"
#include "rs-metadata.h"
+#include "rs-utils.h"
extern GtkWindow *rawstudio_window;
Modified: trunk/src/rs-utils.c
===================================================================
--- trunk/src/rs-utils.c 2008-09-24 16:59:20 UTC (rev 2029)
+++ trunk/src/rs-utils.c 2008-09-28 22:57:40 UTC (rev 2030)
@@ -163,3 +163,27 @@
return num;
}
+
+/**
+ * Return a path to the current config directory for Rawstudio - this is the
+ * .rawstudio direcotry in home
+ * @return A path to an existing directory
+ */
+const gchar *
+rs_confdir_get()
+{
+ static gchar *dir = NULL;
+ static GStaticMutex lock = G_STATIC_MUTEX_INIT;
+
+ g_static_mutex_lock(&lock);
+ if (!dir)
+ {
+ const gchar *home = g_get_home_dir();
+ dir = g_build_filename(home, ".rawstudio", NULL);
+ }
+
+ g_mkdir_with_parents(dir, 00755);
+ g_static_mutex_unlock(&lock);
+
+ return dir;
+}
Modified: trunk/src/rs-utils.h
===================================================================
--- trunk/src/rs-utils.h 2008-09-24 16:59:20 UTC (rev 2029)
+++ trunk/src/rs-utils.h 2008-09-28 22:57:40 UTC (rev 2030)
@@ -66,4 +66,12 @@
extern gint
rs_get_number_of_processor_cores();
+/**
+ * Return a path to the current config directory for Rawstudio - this is the
+ * .rawstudio direcotry in home
+ * @return A path to an existing directory
+ */
+extern const gchar *
+rs_confdir_get();
+
#endif /* RS_UTILS_H */
More information about the Rawstudio-commit
mailing list