[Rawstudio-commit] r2041 - trunk/src
Anders Brander
anders at brander.dk
Mon Sep 29 01:49:24 CEST 2008
Author: abrander
Date: 2008-09-29 01:49:24 +0200 (Mon, 29 Sep 2008)
New Revision: 2041
Modified:
trunk/src/conf_interface.h
trunk/src/rawstudio.c
trunk/src/rawstudio.h
trunk/src/rs-store.c
trunk/src/rs-utils.c
trunk/src/rs-utils.h
Log:
Moved rs_dotdir_get() to rs-utils.c.
Modified: trunk/src/conf_interface.h
===================================================================
--- trunk/src/conf_interface.h 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/conf_interface.h 2008-09-28 23:49:24 UTC (rev 2041)
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "rawstudio.h" /* RS_FILETYPE */
+
#define CONF_LWD "last_working_directory"
#define CONF_PREBGCOLOR "preview_background_color"
#define CONF_HISTHEIGHT "histogram_height"
Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/rawstudio.c 2008-09-28 23:49:24 UTC (rev 2041)
@@ -549,45 +549,6 @@
return(rs);
}
-gchar *
-rs_dotdir_get(const gchar *filename)
-{
- gchar *ret;
- gchar *directory;
- GString *dotdir;
- gboolean dotdir_is_local = FALSE;
- rs_conf_get_boolean(CONF_CACHEDIR_IS_LOCAL, &dotdir_is_local);
-
- directory = g_path_get_dirname(filename);
- if (dotdir_is_local)
- {
- dotdir = g_string_new(g_get_home_dir());
- dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
- dotdir = g_string_append(dotdir, DOTDIR);
- dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
- dotdir = g_string_append(dotdir, directory);
- }
- else
- {
- dotdir = g_string_new(directory);
- dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
- dotdir = g_string_append(dotdir, DOTDIR);
- }
-
- if (!g_file_test(dotdir->str, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
- {
- if (g_mkdir_with_parents(dotdir->str, 0700) != 0)
- ret = NULL;
- else
- ret = dotdir->str;
- }
- else
- ret = dotdir->str;
- g_free(directory);
- g_string_free(dotdir, FALSE);
- return (ret);
-}
-
void
rs_gdk_load_meta(const gchar *src, RSMetadata *metadata)
{
Modified: trunk/src/rawstudio.h
===================================================================
--- trunk/src/rawstudio.h 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/rawstudio.h 2008-09-28 23:49:24 UTC (rev 2041)
@@ -231,7 +231,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_dotdir_get(const gchar *filename);
void rs_white_black_point(RS_BLOB *rs);
void rs_render_pixel_to_srgb(RS_BLOB *rs, gint x, gint y, guchar *dest);
void rs_apply_settings_from_double(RS_SETTINGS *rss, RS_SETTINGS_DOUBLE *rsd, gint mask);
Modified: trunk/src/rs-store.c
===================================================================
--- trunk/src/rs-store.c 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/rs-store.c 2008-09-28 23:49:24 UTC (rev 2041)
@@ -36,6 +36,7 @@
#include "rs-photo.h"
#include "rs-metadata.h"
#include "rs-filetypes.h"
+#include "rs-utils.h"
/* How many different icon views do we have (tabs) */
#define NUM_VIEWS 6
Modified: trunk/src/rs-utils.c
===================================================================
--- trunk/src/rs-utils.c 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/rs-utils.c 2008-09-28 23:49:24 UTC (rev 2041)
@@ -20,6 +20,7 @@
#define _XOPEN_SOURCE /* strptime() */
#include <glib.h>
#include <time.h>
+#include "conf_interface.h"
/**
* A version of atof() that isn't locale specific
@@ -187,3 +188,47 @@
return dir;
}
+
+/**
+ * Return a cache directory for filename
+ * @param filename A complete path to a photo
+ * @return A directory to hold the cache. This is guarenteed to exist
+ */
+gchar *
+rs_dotdir_get(const gchar *filename)
+{
+ gchar *ret;
+ gchar *directory;
+ GString *dotdir;
+ gboolean dotdir_is_local = FALSE;
+ rs_conf_get_boolean(CONF_CACHEDIR_IS_LOCAL, &dotdir_is_local);
+
+ directory = g_path_get_dirname(filename);
+ if (dotdir_is_local)
+ {
+ dotdir = g_string_new(g_get_home_dir());
+ dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
+ dotdir = g_string_append(dotdir, DOTDIR);
+ dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
+ dotdir = g_string_append(dotdir, directory);
+ }
+ else
+ {
+ dotdir = g_string_new(directory);
+ dotdir = g_string_append(dotdir, G_DIR_SEPARATOR_S);
+ dotdir = g_string_append(dotdir, DOTDIR);
+ }
+
+ if (!g_file_test(dotdir->str, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ {
+ if (g_mkdir_with_parents(dotdir->str, 0700) != 0)
+ ret = NULL;
+ else
+ ret = dotdir->str;
+ }
+ else
+ ret = dotdir->str;
+ g_free(directory);
+ g_string_free(dotdir, FALSE);
+ return (ret);
+}
Modified: trunk/src/rs-utils.h
===================================================================
--- trunk/src/rs-utils.h 2008-09-28 23:45:06 UTC (rev 2040)
+++ trunk/src/rs-utils.h 2008-09-28 23:49:24 UTC (rev 2041)
@@ -74,4 +74,12 @@
extern const gchar *
rs_confdir_get();
+/**
+ * Return a cache directory for filename
+ * @param filename A complete path to a photo
+ * @return A directory to hold the cache. This is guarenteed to exist
+ */
+extern gchar *
+rs_dotdir_get(const gchar *filename);
+
#endif /* RS_UTILS_H */
More information about the Rawstudio-commit
mailing list