[Rawstudio-commit] r2051 - trunk/src
Anders Brander
anders at brander.dk
Mon Sep 29 02:47:06 CEST 2008
Author: abrander
Date: 2008-09-29 02:47:06 +0200 (Mon, 29 Sep 2008)
New Revision: 2051
Modified:
trunk/src/rawstudio.c
trunk/src/rawstudio.h
trunk/src/rs-external-editor.c
Log:
Moved rs_has_gimp() to rs-external-editor.c.
Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c 2008-09-29 00:27:13 UTC (rev 2050)
+++ trunk/src/rawstudio.c 2008-09-29 00:47:06 UTC (rev 2051)
@@ -648,82 +648,6 @@
#undef TEST_FILE_ACCESS
}
-gboolean
-rs_has_gimp(gint major, gint minor, gint micro) {
- FILE *fp;
- char line[128];
- int _major, _minor, _micro;
- gboolean retval = FALSE;
-
- fp = popen("gimp -v","r");
- fgets( line, sizeof line, fp);
- pclose(fp);
-
-#if GLIB_CHECK_VERSION(2,14,0)
- GRegex *regex;
- gchar **tokens;
-
- regex = g_regex_new(".*([0-9])\x2E([0-9]+)\x2E([0-9]+).*", 0, 0, NULL);
- tokens = g_regex_split(regex, line, 0);
- g_regex_unref(regex);
-
- if (tokens[1])
- _major = atoi(tokens[1]);
- else
- {
- g_strfreev(tokens);
- return FALSE;
- }
-
- if (_major > major) {
- retval = TRUE;
- } else if (_major == major) {
-
- if (tokens[2])
- _minor = atoi(tokens[2]);
- else
- {
- g_strfreev(tokens);
- return FALSE;
- }
-
- if (_minor > minor) {
- retval = TRUE;
- } else if (_minor == minor) {
-
- if (tokens[3])
- _micro = atoi(tokens[3]);
- else
- {
- g_strfreev(tokens);
- return FALSE;
- }
-
- if (_micro >= micro) {
- retval = TRUE;
- }
- }
- }
- g_strfreev(tokens);
-#else
- sscanf(line,"GNU Image Manipulation Program version %d.%d.%d", &_major, &_minor, &_micro);
-
- if (_major > major) {
- retval = TRUE;
- } else if (_major == major) {
- if (_minor > minor) {
- retval = TRUE;
- } else if (_minor == minor) {
- if (_micro >= micro) {
- retval = TRUE;
- }
- }
- }
-#endif
-
- return retval;
-}
-
/**
* This is a very simple regression test for Rawstudio. Filenames will be read
* from "testimages" in the current directory, one filename per line, and a
Modified: trunk/src/rawstudio.h
===================================================================
--- trunk/src/rawstudio.h 2008-09-29 00:27:13 UTC (rev 2050)
+++ trunk/src/rawstudio.h 2008-09-29 00:47:06 UTC (rev 2051)
@@ -187,7 +187,6 @@
void rs_set_snapshot(RS_BLOB *rs, gint snapshot);
void rs_white_black_point(RS_BLOB *rs);
void rs_apply_settings_from_double(RS_SETTINGS *rss, RS_SETTINGS_DOUBLE *rsd, gint mask);
-gboolean rs_has_gimp(gint major, gint minor, gint micro);
/* Contains a list of supported filetypes */
extern RS_FILETYPE *filetypes;
Modified: trunk/src/rs-external-editor.c
===================================================================
--- trunk/src/rs-external-editor.c 2008-09-29 00:27:13 UTC (rev 2050)
+++ trunk/src/rs-external-editor.c 2008-09-29 00:47:06 UTC (rev 2051)
@@ -26,6 +26,8 @@
#include "rawstudio.h"
#include "rs-photo.h"
+static gboolean rs_has_gimp(gint major, gint minor, gint micro);
+
#define EXPORT_TO_GIMP_TIMEOUT_SECONDS 30
gboolean
@@ -79,3 +81,79 @@
else
return FALSE;
}
+
+static gboolean
+rs_has_gimp(gint major, gint minor, gint micro) {
+ FILE *fp;
+ char line[128];
+ int _major, _minor, _micro;
+ gboolean retval = FALSE;
+
+ fp = popen("gimp -v","r");
+ fgets( line, sizeof line, fp);
+ pclose(fp);
+
+#if GLIB_CHECK_VERSION(2,14,0)
+ GRegex *regex;
+ gchar **tokens;
+
+ regex = g_regex_new(".*([0-9])\x2E([0-9]+)\x2E([0-9]+).*", 0, 0, NULL);
+ tokens = g_regex_split(regex, line, 0);
+ g_regex_unref(regex);
+
+ if (tokens[1])
+ _major = atoi(tokens[1]);
+ else
+ {
+ g_strfreev(tokens);
+ return FALSE;
+ }
+
+ if (_major > major) {
+ retval = TRUE;
+ } else if (_major == major) {
+
+ if (tokens[2])
+ _minor = atoi(tokens[2]);
+ else
+ {
+ g_strfreev(tokens);
+ return FALSE;
+ }
+
+ if (_minor > minor) {
+ retval = TRUE;
+ } else if (_minor == minor) {
+
+ if (tokens[3])
+ _micro = atoi(tokens[3]);
+ else
+ {
+ g_strfreev(tokens);
+ return FALSE;
+ }
+
+ if (_micro >= micro) {
+ retval = TRUE;
+ }
+ }
+ }
+ g_strfreev(tokens);
+#else
+ sscanf(line,"GNU Image Manipulation Program version %d.%d.%d", &_major, &_minor, &_micro);
+
+ if (_major > major) {
+ retval = TRUE;
+ } else if (_major == major) {
+ if (_minor > minor) {
+ retval = TRUE;
+ } else if (_minor == minor) {
+ if (_micro >= micro) {
+ retval = TRUE;
+ }
+ }
+ }
+#endif
+
+ return retval;
+}
More information about the Rawstudio-commit
mailing list