libgimpwidgets/gimpcolorprofilecombobox.[ch]
2007-08-14 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpcolorprofilecombobox.[ch] * libgimpwidgets/gimpcolorprofilestore.[ch] * libgimpwidgets/gimpcolorprofilestore-private.h: changed API to deal with filenames instead of URIs. * app/widgets/gimpprofilechooserdialog.[ch]: same here. * app/dialogs/preferences-dialog.c * plug-ins/common/lcms.c: changed accordingly. svn path=/trunk/; revision=23260
This commit is contained in:

committed by
Sven Neumann

parent
4325e2de70
commit
7cdc24d69e
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2007-08-14 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpcolorprofilecombobox.[ch]
|
||||||
|
* libgimpwidgets/gimpcolorprofilestore.[ch]
|
||||||
|
* libgimpwidgets/gimpcolorprofilestore-private.h: changed API to
|
||||||
|
deal with filenames instead of URIs.
|
||||||
|
|
||||||
|
* app/widgets/gimpprofilechooserdialog.[ch]: same here.
|
||||||
|
|
||||||
|
* app/dialogs/preferences-dialog.c
|
||||||
|
* plug-ins/common/lcms.c: changed accordingly.
|
||||||
|
|
||||||
2007-08-14 Sven Neumann <sven@gimp.org>
|
2007-08-14 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/dialogs/preferences-dialog.c
|
* app/dialogs/preferences-dialog.c
|
||||||
|
@ -976,16 +976,18 @@ prefs_profile_combo_dialog_response (GimpProfileChooserDialog *dialog,
|
|||||||
{
|
{
|
||||||
if (response == GTK_RESPONSE_ACCEPT)
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
gchar *uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
|
gchar *filename;
|
||||||
|
|
||||||
if (uri)
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
|
|
||||||
|
if (filename)
|
||||||
{
|
{
|
||||||
gchar *label = gimp_profile_chooser_dialog_get_desc (dialog, uri);
|
gchar *label = gimp_profile_chooser_dialog_get_desc (dialog,
|
||||||
|
filename);
|
||||||
|
|
||||||
gimp_color_profile_combo_box_set_active (combo, uri, label);
|
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
||||||
|
|
||||||
g_free (label);
|
g_free (label);
|
||||||
g_free (uri);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,15 +998,13 @@ static void
|
|||||||
prefs_profile_combo_changed (GimpColorProfileComboBox *combo,
|
prefs_profile_combo_changed (GimpColorProfileComboBox *combo,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
{
|
{
|
||||||
gchar *uri = gimp_color_profile_combo_box_get_active (combo);
|
gchar *filename = gimp_color_profile_combo_box_get_active (combo);
|
||||||
gchar *filename = uri ? g_filename_from_uri (uri, NULL, NULL) : NULL;
|
|
||||||
|
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
g_object_get_data (G_OBJECT (combo), "property-name"), filename,
|
g_object_get_data (G_OBJECT (combo), "property-name"), filename,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
g_free (uri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
@ -1017,7 +1017,6 @@ prefs_profile_combo_box_new (Gimp *gimp,
|
|||||||
GtkWidget *dialog = gimp_profile_chooser_dialog_new (gimp, label);
|
GtkWidget *dialog = gimp_profile_chooser_dialog_new (gimp, label);
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
gchar *uri = NULL;
|
|
||||||
|
|
||||||
g_object_get (config, property_name, &filename, NULL);
|
g_object_get (config, property_name, &filename, NULL);
|
||||||
|
|
||||||
@ -1027,19 +1026,8 @@ prefs_profile_combo_box_new (Gimp *gimp,
|
|||||||
g_object_set_data (G_OBJECT (combo),
|
g_object_set_data (G_OBJECT (combo),
|
||||||
"property-name", (gpointer) property_name);
|
"property-name", (gpointer) property_name);
|
||||||
|
|
||||||
if (filename)
|
|
||||||
{
|
|
||||||
uri = g_filename_to_uri (filename, NULL, NULL);
|
|
||||||
|
|
||||||
if (! uri)
|
|
||||||
g_warning ("couldn't convert filename to URI");
|
|
||||||
|
|
||||||
g_free (filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_color_profile_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
gimp_color_profile_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
||||||
uri, NULL);
|
filename, NULL);
|
||||||
g_free (uri);
|
|
||||||
|
|
||||||
g_signal_connect (dialog, "response",
|
g_signal_connect (dialog, "response",
|
||||||
G_CALLBACK (prefs_profile_combo_dialog_response),
|
G_CALLBACK (prefs_profile_combo_dialog_response),
|
||||||
|
@ -238,11 +238,11 @@ gimp_profile_chooser_dialog_new (Gimp *gimp,
|
|||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
gimp_profile_chooser_dialog_get_desc (GimpProfileChooserDialog *dialog,
|
gimp_profile_chooser_dialog_get_desc (GimpProfileChooserDialog *dialog,
|
||||||
const gchar *uri)
|
const gchar *filename)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_PROFILE_CHOOSER_DIALOG (dialog), NULL);
|
g_return_val_if_fail (GIMP_IS_PROFILE_CHOOSER_DIALOG (dialog), NULL);
|
||||||
|
|
||||||
if (uri && dialog->uri && strcmp (uri, dialog->uri) == 0)
|
if (filename && dialog->filename && strcmp (filename, dialog->filename) == 0)
|
||||||
return g_strdup (dialog->desc);
|
return g_strdup (dialog->desc);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -253,8 +253,8 @@ gimp_profile_chooser_dialog_update_preview (GimpProfileChooserDialog *dialog)
|
|||||||
{
|
{
|
||||||
gtk_text_buffer_set_text (dialog->buffer, "", 0);
|
gtk_text_buffer_set_text (dialog->buffer, "", 0);
|
||||||
|
|
||||||
g_free (dialog->uri);
|
g_free (dialog->filename);
|
||||||
dialog->uri = NULL;
|
dialog->filename = NULL;
|
||||||
|
|
||||||
g_free (dialog->desc);
|
g_free (dialog->desc);
|
||||||
dialog->desc = NULL;
|
dialog->desc = NULL;
|
||||||
@ -303,14 +303,9 @@ gimp_profile_view_new (GtkTextBuffer *buffer)
|
|||||||
static gboolean
|
static gboolean
|
||||||
gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
||||||
{
|
{
|
||||||
gchar *uri;
|
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
|
||||||
uri = gtk_file_chooser_get_preview_uri (GTK_FILE_CHOOSER (dialog));
|
filename = gtk_file_chooser_get_preview_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
if (! uri)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
filename = g_filename_from_uri (uri, NULL, NULL);
|
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
@ -350,8 +345,8 @@ gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
|||||||
name = NULL;
|
name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->uri = uri;
|
dialog->filename = filename;
|
||||||
uri = NULL;
|
filename = NULL;
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
g_free (desc);
|
g_free (desc);
|
||||||
@ -361,7 +356,5 @@ gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
|||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (uri);
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct _GimpProfileChooserDialog
|
|||||||
Gimp *gimp;
|
Gimp *gimp;
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
|
|
||||||
gchar *uri;
|
gchar *filename;
|
||||||
gchar *desc;
|
gchar *desc;
|
||||||
|
|
||||||
guint idle_id;
|
guint idle_id;
|
||||||
|
@ -59,7 +59,7 @@ GimpColorProfileComboBox
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@combo:
|
@combo:
|
||||||
@uri:
|
@filename:
|
||||||
@label:
|
@label:
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ GimpColorProfileComboBox
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@combo:
|
@combo:
|
||||||
@uri:
|
@filename:
|
||||||
@label:
|
@label:
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ GimpColorProfileStore
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@store:
|
@store:
|
||||||
@uri:
|
@filename:
|
||||||
@label:
|
@label:
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,37 +291,38 @@ gimp_color_profile_combo_box_new_with_model (GtkWidget *dialog,
|
|||||||
/**
|
/**
|
||||||
* gimp_color_profile_combo_box_add:
|
* gimp_color_profile_combo_box_add:
|
||||||
* @combo:
|
* @combo:
|
||||||
* @uri:
|
* @filename:
|
||||||
* @label:
|
* @label:
|
||||||
*
|
*
|
||||||
* Since: GIMP 2.4
|
* Since: GIMP 2.4
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label)
|
const gchar *label)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_COLOR_PROFILE_COMBO_BOX (combo));
|
g_return_if_fail (GIMP_IS_COLOR_PROFILE_COMBO_BOX (combo));
|
||||||
g_return_if_fail (label != NULL || uri == NULL);
|
g_return_if_fail (label != NULL || filename == NULL);
|
||||||
|
|
||||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
||||||
|
|
||||||
gimp_color_profile_store_add (GIMP_COLOR_PROFILE_STORE (model), uri, label);
|
gimp_color_profile_store_add (GIMP_COLOR_PROFILE_STORE (model),
|
||||||
|
filename, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_combo_box_set_active:
|
* gimp_color_profile_combo_box_set_active:
|
||||||
* @combo:
|
* @combo:
|
||||||
* @uri:
|
* @filename:
|
||||||
* @label:
|
* @label:
|
||||||
*
|
*
|
||||||
* Since: GIMP 2.4
|
* Since: GIMP 2.4
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label)
|
const gchar *label)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
@ -332,7 +333,7 @@ gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
|||||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
||||||
|
|
||||||
if (_gimp_color_profile_store_history_add (GIMP_COLOR_PROFILE_STORE (model),
|
if (_gimp_color_profile_store_history_add (GIMP_COLOR_PROFILE_STORE (model),
|
||||||
uri, label, &iter))
|
filename, label, &iter))
|
||||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
|
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,18 +355,18 @@ gimp_color_profile_combo_box_get_active (GimpColorProfileComboBox *combo)
|
|||||||
|
|
||||||
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))
|
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))
|
||||||
{
|
{
|
||||||
gchar *uri;
|
gchar *filename;
|
||||||
gint type;
|
gint type;
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI, &uri,
|
GIMP_COLOR_PROFILE_STORE_FILENAME, &filename,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
||||||
return uri;
|
return filename;
|
||||||
|
|
||||||
g_free (uri);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -64,10 +64,10 @@ GtkWidget * gimp_color_profile_combo_box_new_with_model (GtkWidget *dialog,
|
|||||||
GtkTreeModel *model);
|
GtkTreeModel *model);
|
||||||
|
|
||||||
void gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
void gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
void gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
void gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
gchar * gimp_color_profile_combo_box_get_active (GimpColorProfileComboBox *combo);
|
gchar * gimp_color_profile_combo_box_get_active (GimpColorProfileComboBox *combo);
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ typedef enum
|
|||||||
{
|
{
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
||||||
GIMP_COLOR_PROFILE_STORE_LABEL,
|
GIMP_COLOR_PROFILE_STORE_LABEL,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI,
|
GIMP_COLOR_PROFILE_STORE_FILENAME,
|
||||||
GIMP_COLOR_PROFILE_STORE_INDEX
|
GIMP_COLOR_PROFILE_STORE_INDEX
|
||||||
} GimpColorProfileStoreColumns;
|
} GimpColorProfileStoreColumns;
|
||||||
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL gboolean _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
G_GNUC_INTERNAL gboolean _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
GtkTreeIter *iter);
|
GtkTreeIter *iter);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static void gimp_color_profile_store_get_property (GObject
|
|||||||
|
|
||||||
static gboolean gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
static gboolean gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
gint index);
|
gint index);
|
||||||
static void gimp_color_profile_store_get_separator (GimpColorProfileStore *store,
|
static void gimp_color_profile_store_get_separator (GimpColorProfileStore *store,
|
||||||
@ -112,7 +112,7 @@ gimp_color_profile_store_init (GimpColorProfileStore *store)
|
|||||||
{
|
{
|
||||||
G_TYPE_INT, /* GIMP_COLOR_PROFILE_STORE_ITEM_TYPE */
|
G_TYPE_INT, /* GIMP_COLOR_PROFILE_STORE_ITEM_TYPE */
|
||||||
G_TYPE_STRING, /* GIMP_COLOR_PROFILE_STORE_LABEL */
|
G_TYPE_STRING, /* GIMP_COLOR_PROFILE_STORE_LABEL */
|
||||||
G_TYPE_STRING, /* GIMP_COLOR_PROFILE_STORE_URI */
|
G_TYPE_STRING, /* GIMP_COLOR_PROFILE_STORE_FILENAME */
|
||||||
G_TYPE_INT /* GIMP_COLOR_PROFILE_STORE_INDEX */
|
G_TYPE_INT /* GIMP_COLOR_PROFILE_STORE_INDEX */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -237,23 +237,23 @@ gimp_color_profile_store_new (const gchar *history)
|
|||||||
/**
|
/**
|
||||||
* gimp_color_profile_store_add:
|
* gimp_color_profile_store_add:
|
||||||
* @store:
|
* @store:
|
||||||
|
* @filename:
|
||||||
* @label:
|
* @label:
|
||||||
* @uri:
|
|
||||||
*
|
*
|
||||||
* Since: GIMP 2.4
|
* Since: GIMP 2.4
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gimp_color_profile_store_add (GimpColorProfileStore *store,
|
gimp_color_profile_store_add (GimpColorProfileStore *store,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label)
|
const gchar *label)
|
||||||
{
|
{
|
||||||
GtkTreeIter separator;
|
GtkTreeIter separator;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_COLOR_PROFILE_STORE (store));
|
g_return_if_fail (GIMP_IS_COLOR_PROFILE_STORE (store));
|
||||||
g_return_if_fail (label != NULL || uri == NULL);
|
g_return_if_fail (label != NULL || filename == NULL);
|
||||||
|
|
||||||
if (uri == NULL && label == NULL)
|
if (! filename && ! label)
|
||||||
label = Q_("profile|None");
|
label = Q_("profile|None");
|
||||||
|
|
||||||
gimp_color_profile_store_get_separator (store, &separator, TRUE);
|
gimp_color_profile_store_get_separator (store, &separator, TRUE);
|
||||||
@ -262,7 +262,7 @@ gimp_color_profile_store_add (GimpColorProfileStore *store,
|
|||||||
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
|
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_FILE,
|
GIMP_COLOR_PROFILE_STORE_ITEM_FILE,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI, uri,
|
GIMP_COLOR_PROFILE_STORE_FILENAME, filename,
|
||||||
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
||||||
GIMP_COLOR_PROFILE_STORE_INDEX, -1,
|
GIMP_COLOR_PROFILE_STORE_INDEX, -1,
|
||||||
-1);
|
-1);
|
||||||
@ -271,7 +271,7 @@ gimp_color_profile_store_add (GimpColorProfileStore *store,
|
|||||||
/**
|
/**
|
||||||
* _gimp_color_profile_store_history_add:
|
* _gimp_color_profile_store_history_add:
|
||||||
* @store:
|
* @store:
|
||||||
* @uri:
|
* @filename:
|
||||||
* @label:
|
* @label:
|
||||||
* @iter:
|
* @iter:
|
||||||
*
|
*
|
||||||
@ -281,7 +281,7 @@ gimp_color_profile_store_add (GimpColorProfileStore *store,
|
|||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
_gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
_gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
GtkTreeIter *iter)
|
GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
@ -300,7 +300,7 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||||||
{
|
{
|
||||||
gint type;
|
gint type;
|
||||||
gint index;
|
gint index;
|
||||||
gchar *this_uri;
|
gchar *this;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
gtk_tree_model_get (model, iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
||||||
@ -313,13 +313,13 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||||||
if (index > max)
|
if (index > max)
|
||||||
max = index;
|
max = index;
|
||||||
|
|
||||||
/* check if we found an URI match */
|
/* check if we found a filename match */
|
||||||
gtk_tree_model_get (model, iter,
|
gtk_tree_model_get (model, iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI, &this_uri,
|
GIMP_COLOR_PROFILE_STORE_FILENAME, &this,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if ((this_uri && uri && strcmp (uri, this_uri) == 0) ||
|
if ((this && filename && strcmp (filename, this) == 0) ||
|
||||||
(! this_uri && ! uri))
|
(! this && ! filename))
|
||||||
{
|
{
|
||||||
/* update the label */
|
/* update the label */
|
||||||
if (label && *label)
|
if (label && *label)
|
||||||
@ -327,30 +327,28 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||||||
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_free (this_uri);
|
g_free (this);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! uri)
|
if (! filename)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (label && *label)
|
if (label && *label)
|
||||||
{
|
{
|
||||||
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
||||||
uri, label,
|
filename, label,
|
||||||
++max);
|
++max);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
|
||||||
gchar *basename = g_filename_display_basename (filename);
|
gchar *basename = g_filename_display_basename (filename);
|
||||||
|
|
||||||
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
||||||
uri, basename,
|
filename, basename,
|
||||||
++max);
|
++max);
|
||||||
g_free (basename);
|
g_free (basename);
|
||||||
g_free (filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iter_valid;
|
return iter_valid;
|
||||||
@ -359,7 +357,7 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label,
|
const gchar *label,
|
||||||
gint index)
|
gint index)
|
||||||
{
|
{
|
||||||
@ -367,7 +365,7 @@ gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
|||||||
GtkTreeIter sibling;
|
GtkTreeIter sibling;
|
||||||
gboolean iter_valid;
|
gboolean iter_valid;
|
||||||
|
|
||||||
g_return_val_if_fail (uri != NULL, FALSE);
|
g_return_val_if_fail (filename != NULL, FALSE);
|
||||||
g_return_val_if_fail (label != NULL, FALSE);
|
g_return_val_if_fail (label != NULL, FALSE);
|
||||||
g_return_val_if_fail (index > -1, FALSE);
|
g_return_val_if_fail (index > -1, FALSE);
|
||||||
|
|
||||||
@ -416,7 +414,7 @@ gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
|||||||
gtk_list_store_set (GTK_LIST_STORE (store), iter,
|
gtk_list_store_set (GTK_LIST_STORE (store), iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
||||||
GIMP_COLOR_PROFILE_STORE_ITEM_FILE,
|
GIMP_COLOR_PROFILE_STORE_ITEM_FILE,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI, uri,
|
GIMP_COLOR_PROFILE_STORE_FILENAME, filename,
|
||||||
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
||||||
GIMP_COLOR_PROFILE_STORE_INDEX, index,
|
GIMP_COLOR_PROFILE_STORE_INDEX, index,
|
||||||
-1);
|
-1);
|
||||||
@ -508,8 +506,13 @@ gimp_color_profile_store_load_profile (GimpColorProfileStore *store,
|
|||||||
if (gimp_scanner_parse_string (scanner, &label) &&
|
if (gimp_scanner_parse_string (scanner, &label) &&
|
||||||
gimp_scanner_parse_string (scanner, &uri))
|
gimp_scanner_parse_string (scanner, &uri))
|
||||||
{
|
{
|
||||||
gimp_color_profile_store_history_insert (store, &iter, uri, label, index);
|
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
||||||
|
|
||||||
|
if (filename)
|
||||||
|
gimp_color_profile_store_history_insert (store, &iter,
|
||||||
|
filename, label, index);
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
g_free (label);
|
g_free (label);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
|
||||||
@ -606,22 +609,29 @@ gimp_color_profile_store_save (GimpColorProfileStore *store,
|
|||||||
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
||||||
{
|
{
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *uri;
|
gchar *filename;
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
GIMP_COLOR_PROFILE_STORE_LABEL, &label,
|
GIMP_COLOR_PROFILE_STORE_LABEL, &label,
|
||||||
GIMP_COLOR_PROFILE_STORE_URI, &uri,
|
GIMP_COLOR_PROFILE_STORE_FILENAME, &filename,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (uri && label)
|
if (filename && label)
|
||||||
|
{
|
||||||
|
gchar *uri = g_filename_to_uri (filename, NULL, NULL);
|
||||||
|
|
||||||
|
if (uri)
|
||||||
{
|
{
|
||||||
gimp_config_writer_open (writer, "color-profile");
|
gimp_config_writer_open (writer, "color-profile");
|
||||||
gimp_config_writer_string (writer, label);
|
gimp_config_writer_string (writer, label);
|
||||||
gimp_config_writer_string (writer, uri);
|
gimp_config_writer_string (writer, uri);
|
||||||
gimp_config_writer_close (writer);
|
gimp_config_writer_close (writer);
|
||||||
}
|
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
g_free (label);
|
g_free (label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ GType gimp_color_profile_store_get_type (void) G_GNUC_CONST;
|
|||||||
GtkListStore * gimp_color_profile_store_new (const gchar *history);
|
GtkListStore * gimp_color_profile_store_new (const gchar *history);
|
||||||
|
|
||||||
void gimp_color_profile_store_add (GimpColorProfileStore *store,
|
void gimp_color_profile_store_add (GimpColorProfileStore *store,
|
||||||
const gchar *uri,
|
const gchar *filename,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1162,27 +1162,25 @@ lcms_icc_apply_dialog (gint32 image,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
lcms_icc_combo_box_set_active (GimpColorProfileComboBox *combo,
|
lcms_icc_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||||
const gchar *uri)
|
const gchar *filename)
|
||||||
{
|
{
|
||||||
cmsHPROFILE profile;
|
cmsHPROFILE profile = NULL;
|
||||||
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
gchar *label = NULL;
|
||||||
gchar *name = NULL;
|
|
||||||
|
|
||||||
|
if (filename)
|
||||||
profile = lcms_load_profile (filename, NULL);
|
profile = lcms_load_profile (filename, NULL);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
name = lcms_icc_profile_get_desc (profile);
|
label = lcms_icc_profile_get_desc (profile);
|
||||||
if (! name)
|
if (! label)
|
||||||
name = lcms_icc_profile_get_name (profile);
|
label = lcms_icc_profile_get_name (profile);
|
||||||
|
|
||||||
cmsCloseProfile (profile);
|
cmsCloseProfile (profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
||||||
|
g_free (label);
|
||||||
gimp_color_profile_combo_box_set_active (combo, uri, name);
|
|
||||||
g_free (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1192,12 +1190,13 @@ lcms_icc_file_chooser_dialog_response (GtkFileChooser *dialog,
|
|||||||
{
|
{
|
||||||
if (response == GTK_RESPONSE_ACCEPT)
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
gchar *uri = gtk_file_chooser_get_uri (dialog);
|
gchar *filename = gtk_file_chooser_get_filename (dialog);
|
||||||
|
|
||||||
if (uri)
|
if (filename)
|
||||||
{
|
{
|
||||||
lcms_icc_combo_box_set_active (combo, uri);
|
lcms_icc_combo_box_set_active (combo, filename);
|
||||||
g_free (uri);
|
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,7 +1260,6 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
|
|||||||
gchar *history;
|
gchar *history;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *uri;
|
|
||||||
cmsHPROFILE profile;
|
cmsHPROFILE profile;
|
||||||
|
|
||||||
dialog = lcms_icc_file_chooser_dialog_new ();
|
dialog = lcms_icc_file_chooser_dialog_new ();
|
||||||
@ -1289,31 +1287,15 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
|
|||||||
label = g_strdup_printf (_("RGB workspace (%s)"), name);
|
label = g_strdup_printf (_("RGB workspace (%s)"), name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
if (config->rgb_profile)
|
|
||||||
uri = g_filename_to_uri (config->rgb_profile, NULL, NULL);
|
|
||||||
else
|
|
||||||
uri = NULL;
|
|
||||||
|
|
||||||
gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
||||||
uri, label);
|
config->rgb_profile, label);
|
||||||
g_free (uri);
|
|
||||||
g_free (label);
|
g_free (label);
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
|
||||||
gchar *uri = g_filename_to_uri (filename, NULL, NULL);
|
|
||||||
|
|
||||||
if (uri)
|
|
||||||
{
|
|
||||||
lcms_icc_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
lcms_icc_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
||||||
uri);
|
filename);
|
||||||
g_free (uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||||
}
|
|
||||||
|
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
@ -1405,17 +1387,14 @@ lcms_dialog (GimpColorConfig *config,
|
|||||||
|
|
||||||
if (run)
|
if (run)
|
||||||
{
|
{
|
||||||
|
GimpColorProfileComboBox *box = GIMP_COLOR_PROFILE_COMBO_BOX (combo);
|
||||||
|
gchar *filename;
|
||||||
cmsHPROFILE dest_profile;
|
cmsHPROFILE dest_profile;
|
||||||
gchar *filename = NULL;
|
|
||||||
gchar *uri;
|
|
||||||
|
|
||||||
uri = gimp_color_profile_combo_box_get_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo));
|
filename = gimp_color_profile_combo_box_get_active (box);
|
||||||
|
|
||||||
if (uri)
|
if (filename)
|
||||||
{
|
{
|
||||||
filename = g_filename_from_uri (uri, NULL, NULL);
|
|
||||||
g_free (uri);
|
|
||||||
|
|
||||||
dest_profile = lcms_load_profile (filename, NULL);
|
dest_profile = lcms_load_profile (filename, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user