Author: abrander
Date: 2010-01-27 15:20:39 +0100 (Wed, 27 Jan 2010)
New Revision: 3091
Added:
branches/rawstudio-ng-color/librawstudio/rs-profile-factory.c
branches/rawstudio-ng-color/librawstudio/rs-profile-factory.h
Removed:
branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c
branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.h
Modified:
branches/rawstudio-ng-color/librawstudio/Makefile.am
branches/rawstudio-ng-color/librawstudio/rawstudio.h
Log:
Renamed RSDcpFactory to RSProfileFactory.
Modified: branches/rawstudio-ng-color/librawstudio/Makefile.am
===================================================================
--- branches/rawstudio-ng-color/librawstudio/Makefile.am 2010-01-27
08:37:28 UTC (rev 3090)
+++ branches/rawstudio-ng-color/librawstudio/Makefile.am 2010-01-27
14:20:39 UTC (rev 3091)
@@ -1,3 +1,5 @@
+AM_CFLAGS = -Wall -Werror -fno-strict-aliasing
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_CFLAGS)
@@ -48,7 +50,7 @@
rs-tiff-ifd-entry.h \
rs-huesat-map.h \
rs-dcp-file.h \
- rs-dcp-factory.h \
+ rs-profile-factory.h \
rs-profile-selector.h \
x86-cpu.h \
md5.h
@@ -93,7 +95,7 @@
rs-tiff-ifd-entry.c rs-tiff-ifd-entry.h \
rs-huesat-map.c rs-huesat-map.h \
rs-dcp-file.c rs-dcp-file.h \
- rs-dcp-factory.c rs-dcp-factory.h \
+ rs-profile-factory.c rs-profile-factory.h rs-profile-factory-model.h \
rs-profile-selector.c rs-profile-selector.h \
rs-stock.c rs-stock.h \
md5.c md5.h
Modified: branches/rawstudio-ng-color/librawstudio/rawstudio.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rawstudio.h 2010-01-27
08:37:28 UTC (rev 3090)
+++ branches/rawstudio-ng-color/librawstudio/rawstudio.h 2010-01-27
14:20:39 UTC (rev 3091)
@@ -68,7 +68,7 @@
#include "rs-tiff.h"
#include "rs-huesat-map.h"
#include "rs-dcp-file.h"
-#include "rs-dcp-factory.h"
+#include "rs-profile-factory.h"
#include "rs-profile-selector.h"
#include "x86-cpu.h"
Deleted: branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c 2010-01-27
08:37:28 UTC (rev 3090)
+++ branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c 2010-01-27
14:20:39 UTC (rev 3091)
@@ -1,134 +0,0 @@
-#include "rs-dcp-file.h"
-#include "rs-dcp-factory.h"
-#include "config.h"
-#include "rs-utils.h"
-
-#define DCP_FACTORY_DEFAULT_SEARCH_PATH PACKAGE_DATA_DIR "/" PACKAGE
"/profiles/"
-
-struct _RSDcpFactory {
- GObject parent;
-
- GList *profiles;
-};
-
-G_DEFINE_TYPE(RSDcpFactory, rs_dcp_factory, G_TYPE_OBJECT)
-
-static void
-rs_dcp_factory_class_init(RSDcpFactoryClass *klass)
-{
-}
-
-static void
-rs_dcp_factory_init(RSDcpFactory *factory)
-{
- factory->profiles = NULL;
-}
-
-static void
-load_profiles(RSDcpFactory *factory, const gchar *path)
-{
- const gchar *basename;
- gchar *filename;
- GDir *dir = g_dir_open(path, 0, NULL);
-
- while((dir != NULL) && (basename = g_dir_read_name(dir)))
- {
- if (basename[0] == '.')
- continue;
-
- filename = g_build_filename(path, basename, NULL);
-
- if (g_file_test(filename, G_FILE_TEST_IS_DIR))
- load_profiles(factory, filename);
-
- else if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)
- && (g_str_has_suffix(basename, ".dcp") ||
g_str_has_suffix(basename, ".DCP")))
- {
- RSDcpFile *dcp = rs_dcp_file_new_from_file(filename);
- const gchar *model = rs_dcp_file_get_model(dcp);
- if (model)
- {
- factory->profiles =
g_list_prepend(factory->profiles, dcp);
- }
- }
-
- g_free(filename);
- }
-
-}
-
-RSDcpFactory *
-rs_dcp_factory_new(const gchar *search_path)
-{
- RSDcpFactory *factory = g_object_new(RS_TYPE_DCP_FACTORY, NULL);
-
- load_profiles(factory, search_path);
-
- return factory;
-}
-
-void
-rs_dcp_factory_append(RSDcpFactory *factory, const gchar *search_path)
-{
- load_profiles(factory, search_path);
-}
-
-RSDcpFactory *
-rs_dcp_factory_new_default(void)
-{
- static RSDcpFactory *factory = NULL;
- GStaticMutex lock = G_STATIC_MUTEX_INIT;
-
- g_static_mutex_lock(&lock);
- if (!factory)
- {
- factory = rs_dcp_factory_new(DCP_FACTORY_DEFAULT_SEARCH_PATH);
-
- gchar *user_profiles = g_strdup_printf("%s/profiles/",
rs_confdir_get());
- rs_dcp_factory_append(factory, user_profiles);
- g_free(user_profiles);
- }
- g_static_mutex_unlock(&lock);
-
- return factory;
-}
-
-GList *
-rs_dcp_factory_get_compatible(RSDcpFactory *factory, const gchar *make, const
gchar *model)
-{
- GList *matches = NULL;
- GList *node;
-
- for (node = g_list_first(factory->profiles) ; node != NULL ; node =
g_list_next(node))
- {
- RSDcpFile *dcp = RS_DCP_FILE(node->data);
-
- if (model && g_str_equal(model, rs_dcp_file_get_model(dcp)))
- matches = g_list_prepend(matches, dcp);
- }
-
- return matches;
-}
-
-RSDcpFile *
-rs_dcp_factory_find_from_id(RSDcpFactory *factory, const gchar *id)
-{
- RSDcpFile *ret = NULL;
- GList *node;
-
- for (node = g_list_first(factory->profiles) ; node != NULL ; node =
g_list_next(node))
- {
- RSDcpFile *dcp = RS_DCP_FILE(node->data);
-
- const gchar *dcp_id = rs_dcp_get_id(dcp);
-
- if (g_str_equal(id, dcp_id))
- {
- if (ret)
- g_warning("WARNING: Duplicate profiles detected
in file: %s, for %s, named:%s.\nUnsing last found profile.",
rs_tiff_get_filename_nopath(RS_TIFF(dcp)), rs_dcp_file_get_model(dcp),
rs_dcp_file_get_name(dcp));
- ret = dcp;
- }
- }
-
- return ret;
-}
Deleted: branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.h 2010-01-27
08:37:28 UTC (rev 3090)
+++ branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.h 2010-01-27
14:20:39 UTC (rev 3091)
@@ -1,40 +0,0 @@
-#ifndef RS_DCP_FACTORY_H
-#define RS_DCP_FACTORY_H
-
-#include <glib-object.h>
-#include "rs-dcp-file.h"
-
-G_BEGIN_DECLS
-
-#define RS_TYPE_DCP_FACTORY rs_dcp_factory_get_type()
-#define RS_DCP_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
RS_TYPE_DCP_FACTORY, RSDcpFactory))
-#define RS_DCP_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
RS_TYPE_DCP_FACTORY, RSDcpFactoryClass))
-#define RS_IS_DCP_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
RS_TYPE_DCP_FACTORY))
-#define RS_IS_DCP_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
RS_TYPE_DCP_FACTORY))
-#define RS_DCP_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
RS_TYPE_DCP_FACTORY, RSDcpFactoryClass))
-
-enum {
- RS_DCP_FACTORY_STORE_MODEL,
- RS_DCP_FACTORY_STORE_DCP,
- RS_DCP_FACTORY_NUM_FIELDS
-};
-
-typedef struct _RSDcpFactory RSDcpFactory;
-
-typedef struct {
- GObjectClass parent_class;
-} RSDcpFactoryClass;
-
-GType rs_dcp_factory_get_type(void);
-
-RSDcpFactory *rs_dcp_factory_new(const gchar *search_path);
-
-RSDcpFactory *rs_dcp_factory_new_default(void);
-
-GList *rs_dcp_factory_get_compatible(RSDcpFactory *factory, const gchar *make,
const gchar *model);
-
-RSDcpFile *rs_dcp_factory_find_from_id(RSDcpFactory *factory, const gchar
*path);
-
-G_END_DECLS
-
-#endif /* RS_DCP_FACTORY_H */
Added: branches/rawstudio-ng-color/librawstudio/rs-profile-factory.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-profile-factory.c
(rev 0)
+++ branches/rawstudio-ng-color/librawstudio/rs-profile-factory.c
2010-01-27 14:20:39 UTC (rev 3091)
@@ -0,0 +1,134 @@
+#include "rs-dcp-file.h"
+#include "rs-profile-factory.h"
+#include "config.h"
+#include "rs-utils.h"
+
+#define PROFILE_FACTORY_DEFAULT_SEARCH_PATH PACKAGE_DATA_DIR "/" PACKAGE
"/profiles/"
+
+struct _RSProfileFactory {
+ GObject parent;
+
+ GList *profiles;
+};
+
+G_DEFINE_TYPE(RSProfileFactory, rs_profile_factory, G_TYPE_OBJECT)
+
+static void
+rs_profile_factory_class_init(RSProfileFactoryClass *klass)
+{
+}
+
+static void
+rs_profile_factory_init(RSProfileFactory *factory)
+{
+ factory->profiles = NULL;
+}
+
+static void
+load_profiles(RSProfileFactory *factory, const gchar *path)
+{
+ const gchar *basename;
+ gchar *filename;
+ GDir *dir = g_dir_open(path, 0, NULL);
+
+ while((dir != NULL) && (basename = g_dir_read_name(dir)))
+ {
+ if (basename[0] == '.')
+ continue;
+
+ filename = g_build_filename(path, basename, NULL);
+
+ if (g_file_test(filename, G_FILE_TEST_IS_DIR))
+ load_profiles(factory, filename);
+
+ else if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)
+ && (g_str_has_suffix(basename, ".dcp") ||
g_str_has_suffix(basename, ".DCP")))
+ {
+ RSDcpFile *profile =
rs_dcp_file_new_from_file(filename);
+ const gchar *model = rs_dcp_file_get_model(profile);
+ if (model)
+ {
+ factory->profiles =
g_list_prepend(factory->profiles, profile);
+ }
+ }
+
+ g_free(filename);
+ }
+
+}
+
+RSProfileFactory *
+rs_profile_factory_new(const gchar *search_path)
+{
+ RSProfileFactory *factory = g_object_new(RS_TYPE_PROFILE_FACTORY, NULL);
+
+ load_profiles(factory, search_path);
+
+ return factory;
+}
+
+void
+rs_profile_factory_append(RSProfileFactory *factory, const gchar *search_path)
+{
+ load_profiles(factory, search_path);
+}
+
+RSProfileFactory *
+rs_profile_factory_new_default(void)
+{
+ static RSProfileFactory *factory = NULL;
+ GStaticMutex lock = G_STATIC_MUTEX_INIT;
+
+ g_static_mutex_lock(&lock);
+ if (!factory)
+ {
+ factory =
rs_profile_factory_new(PROFILE_FACTORY_DEFAULT_SEARCH_PATH);
+
+ gchar *user_profiles = g_strdup_printf("%s/profiles/",
rs_confdir_get());
+ rs_profile_factory_append(factory, user_profiles);
+ g_free(user_profiles);
+ }
+ g_static_mutex_unlock(&lock);
+
+ return factory;
+}
+
+GList *
+rs_profile_factory_get_compatible(RSProfileFactory *factory, const gchar
*make, const gchar *model)
+{
+ GList *matches = NULL;
+ GList *node;
+
+ for (node = g_list_first(factory->profiles) ; node != NULL ; node =
g_list_next(node))
+ {
+ RSDcpFile *profile = RS_DCP_FILE(node->data);
+
+ if (model && g_str_equal(model, rs_dcp_file_get_model(profile)))
+ matches = g_list_prepend(matches, profile);
+ }
+
+ return matches;
+}
+
+RSDcpFile *
+rs_profile_factory_find_from_id(RSProfileFactory *factory, const gchar *id)
+{
+ RSDcpFile *ret = NULL;
+ GList *node;
+
+ for (node = g_list_first(factory->profiles) ; node != NULL ; node =
g_list_next(node))
+ {
+ RSDcpFile *profile = RS_DCP_FILE(node->data);
+
+ const gchar *profile_id = rs_dcp_get_id(profile);
+
+ if (g_str_equal(id, profile_id))
+ {
+ if (ret)
+ g_warning("WARNING: Duplicate profiles detected
in file: %s, for %s, named:%s.\nUnsing last found profile.",
rs_tiff_get_filename_nopath(RS_TIFF(profile)), rs_dcp_file_get_model(profile),
rs_dcp_file_get_name(profile));
+ ret = profile;
+ }
+ }
+
+ return ret;
+}
Added: branches/rawstudio-ng-color/librawstudio/rs-profile-factory.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-profile-factory.h
(rev 0)
+++ branches/rawstudio-ng-color/librawstudio/rs-profile-factory.h
2010-01-27 14:20:39 UTC (rev 3091)
@@ -0,0 +1,40 @@
+#ifndef RS_PROFILE_FACTORY_H
+#define RS_PROFILE_FACTORY_H
+
+#include <glib-object.h>
+#include "rs-dcp-file.h"
+
+G_BEGIN_DECLS
+
+#define RS_TYPE_PROFILE_FACTORY rs_profile_factory_get_type()
+#define RS_PROFILE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
RS_TYPE_PROFILE_FACTORY, RSProfileFactory))
+#define RS_PROFILE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
RS_TYPE_PROFILE_FACTORY, RSProfileFactoryClass))
+#define RS_IS_PROFILE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
RS_TYPE_PROFILE_FACTORY))
+#define RS_IS_PROFILE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
RS_TYPE_PROFILE_FACTORY))
+#define RS_PROFILE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
RS_TYPE_PROFILE_FACTORY, RSProfileFactoryClass))
+
+enum {
+ RS_PROFILE_FACTORY_STORE_MODEL,
+ RS_PROFILE_FACTORY_STORE_PROFILE,
+ RS_PROFILE_FACTORY_NUM_FIELDS
+};
+
+typedef struct _RSProfileFactory RSProfileFactory;
+
+typedef struct {
+ GObjectClass parent_class;
+} RSProfileFactoryClass;
+
+GType rs_profile_factory_get_type(void);
+
+RSProfileFactory *rs_profile_factory_new(const gchar *search_path);
+
+RSProfileFactory *rs_profile_factory_new_default(void);
+
+GList *rs_profile_factory_get_compatible(RSProfileFactory *factory, const
gchar *make, const gchar *model);
+
+RSDcpFile *rs_profile_factory_find_from_id(RSProfileFactory *factory, const
gchar *path);
+
+G_END_DECLS
+
+#endif /* RS_PROFILE_FACTORY_H */
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit