mirror of https://github.com/GNOME/gimp.git
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:
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>
|
||||
|
||||
* app/dialogs/preferences-dialog.c
|
||||
|
|
|
@ -976,16 +976,18 @@ prefs_profile_combo_dialog_response (GimpProfileChooserDialog *dialog,
|
|||
{
|
||||
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 (uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -996,15 +998,13 @@ static void
|
|||
prefs_profile_combo_changed (GimpColorProfileComboBox *combo,
|
||||
GObject *config)
|
||||
{
|
||||
gchar *uri = gimp_color_profile_combo_box_get_active (combo);
|
||||
gchar *filename = uri ? g_filename_from_uri (uri, NULL, NULL) : NULL;
|
||||
gchar *filename = gimp_color_profile_combo_box_get_active (combo);
|
||||
|
||||
g_object_set (config,
|
||||
g_object_get_data (G_OBJECT (combo), "property-name"), filename,
|
||||
NULL);
|
||||
|
||||
g_free (filename);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
@ -1017,7 +1017,6 @@ prefs_profile_combo_box_new (Gimp *gimp,
|
|||
GtkWidget *dialog = gimp_profile_chooser_dialog_new (gimp, label);
|
||||
GtkWidget *combo;
|
||||
gchar *filename;
|
||||
gchar *uri = 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),
|
||||
"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),
|
||||
uri, NULL);
|
||||
g_free (uri);
|
||||
filename, NULL);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (prefs_profile_combo_dialog_response),
|
||||
|
|
|
@ -238,11 +238,11 @@ gimp_profile_chooser_dialog_new (Gimp *gimp,
|
|||
|
||||
gchar *
|
||||
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);
|
||||
|
||||
if (uri && dialog->uri && strcmp (uri, dialog->uri) == 0)
|
||||
if (filename && dialog->filename && strcmp (filename, dialog->filename) == 0)
|
||||
return g_strdup (dialog->desc);
|
||||
|
||||
return NULL;
|
||||
|
@ -253,8 +253,8 @@ gimp_profile_chooser_dialog_update_preview (GimpProfileChooserDialog *dialog)
|
|||
{
|
||||
gtk_text_buffer_set_text (dialog->buffer, "", 0);
|
||||
|
||||
g_free (dialog->uri);
|
||||
dialog->uri = NULL;
|
||||
g_free (dialog->filename);
|
||||
dialog->filename = NULL;
|
||||
|
||||
g_free (dialog->desc);
|
||||
dialog->desc = NULL;
|
||||
|
@ -303,14 +303,9 @@ gimp_profile_view_new (GtkTextBuffer *buffer)
|
|||
static gboolean
|
||||
gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *filename;
|
||||
gchar *filename;
|
||||
|
||||
uri = gtk_file_chooser_get_preview_uri (GTK_FILE_CHOOSER (dialog));
|
||||
if (! uri)
|
||||
return FALSE;
|
||||
|
||||
filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
filename = gtk_file_chooser_get_preview_filename (GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
if (filename)
|
||||
{
|
||||
|
@ -350,8 +345,8 @@ gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
|||
name = NULL;
|
||||
}
|
||||
|
||||
dialog->uri = uri;
|
||||
uri = NULL;
|
||||
dialog->filename = filename;
|
||||
filename = NULL;
|
||||
|
||||
g_free (name);
|
||||
g_free (desc);
|
||||
|
@ -361,7 +356,5 @@ gimp_profile_view_query (GimpProfileChooserDialog *dialog)
|
|||
g_free (filename);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ struct _GimpProfileChooserDialog
|
|||
Gimp *gimp;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
gchar *uri;
|
||||
gchar *filename;
|
||||
gchar *desc;
|
||||
|
||||
guint idle_id;
|
||||
|
|
|
@ -59,7 +59,7 @@ GimpColorProfileComboBox
|
|||
</para>
|
||||
|
||||
@combo:
|
||||
@uri:
|
||||
@filename:
|
||||
@label:
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ GimpColorProfileComboBox
|
|||
</para>
|
||||
|
||||
@combo:
|
||||
@uri:
|
||||
@filename:
|
||||
@label:
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ GimpColorProfileStore
|
|||
</para>
|
||||
|
||||
@store:
|
||||
@uri:
|
||||
@filename:
|
||||
@label:
|
||||
|
||||
|
||||
|
|
|
@ -291,37 +291,38 @@ gimp_color_profile_combo_box_new_with_model (GtkWidget *dialog,
|
|||
/**
|
||||
* gimp_color_profile_combo_box_add:
|
||||
* @combo:
|
||||
* @uri:
|
||||
* @filename:
|
||||
* @label:
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
|
||||
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));
|
||||
|
||||
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:
|
||||
* @combo:
|
||||
* @uri:
|
||||
* @filename:
|
||||
* @label:
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label)
|
||||
{
|
||||
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));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *filename;
|
||||
gint type;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
||||
GIMP_COLOR_PROFILE_STORE_URI, &uri,
|
||||
GIMP_COLOR_PROFILE_STORE_FILENAME, &filename,
|
||||
-1);
|
||||
|
||||
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
||||
return uri;
|
||||
return filename;
|
||||
|
||||
g_free (uri);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -64,10 +64,10 @@ GtkWidget * gimp_color_profile_combo_box_new_with_model (GtkWidget *dialog,
|
|||
GtkTreeModel *model);
|
||||
|
||||
void gimp_color_profile_combo_box_add (GimpColorProfileComboBox *combo,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label);
|
||||
void gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label);
|
||||
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_LABEL,
|
||||
GIMP_COLOR_PROFILE_STORE_URI,
|
||||
GIMP_COLOR_PROFILE_STORE_FILENAME,
|
||||
GIMP_COLOR_PROFILE_STORE_INDEX
|
||||
} GimpColorProfileStoreColumns;
|
||||
|
||||
|
||||
G_GNUC_INTERNAL gboolean _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label,
|
||||
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,
|
||||
GtkTreeIter *iter,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label,
|
||||
gint index);
|
||||
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_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 */
|
||||
};
|
||||
|
||||
|
@ -237,23 +237,23 @@ gimp_color_profile_store_new (const gchar *history)
|
|||
/**
|
||||
* gimp_color_profile_store_add:
|
||||
* @store:
|
||||
* @filename:
|
||||
* @label:
|
||||
* @uri:
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_color_profile_store_add (GimpColorProfileStore *store,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label)
|
||||
{
|
||||
GtkTreeIter separator;
|
||||
GtkTreeIter iter;
|
||||
|
||||
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");
|
||||
|
||||
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,
|
||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
||||
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_INDEX, -1,
|
||||
-1);
|
||||
|
@ -271,7 +271,7 @@ gimp_color_profile_store_add (GimpColorProfileStore *store,
|
|||
/**
|
||||
* _gimp_color_profile_store_history_add:
|
||||
* @store:
|
||||
* @uri:
|
||||
* @filename:
|
||||
* @label:
|
||||
* @iter:
|
||||
*
|
||||
|
@ -281,7 +281,7 @@ gimp_color_profile_store_add (GimpColorProfileStore *store,
|
|||
**/
|
||||
gboolean
|
||||
_gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||
{
|
||||
gint type;
|
||||
gint index;
|
||||
gchar *this_uri;
|
||||
gchar *this;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE, &type,
|
||||
|
@ -313,13 +313,13 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||
if (index > max)
|
||||
max = index;
|
||||
|
||||
/* check if we found an URI match */
|
||||
/* check if we found a filename match */
|
||||
gtk_tree_model_get (model, iter,
|
||||
GIMP_COLOR_PROFILE_STORE_URI, &this_uri,
|
||||
GIMP_COLOR_PROFILE_STORE_FILENAME, &this,
|
||||
-1);
|
||||
|
||||
if ((this_uri && uri && strcmp (uri, this_uri) == 0) ||
|
||||
(! this_uri && ! uri))
|
||||
if ((this && filename && strcmp (filename, this) == 0) ||
|
||||
(! this && ! filename))
|
||||
{
|
||||
/* update the label */
|
||||
if (label && *label)
|
||||
|
@ -327,30 +327,28 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||
GIMP_COLOR_PROFILE_STORE_LABEL, label,
|
||||
-1);
|
||||
|
||||
g_free (this_uri);
|
||||
g_free (this);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! uri)
|
||||
if (! filename)
|
||||
return FALSE;
|
||||
|
||||
if (label && *label)
|
||||
{
|
||||
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
||||
uri, label,
|
||||
filename, label,
|
||||
++max);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
gchar *basename = g_filename_display_basename (filename);
|
||||
|
||||
iter_valid = gimp_color_profile_store_history_insert (store, iter,
|
||||
uri, basename,
|
||||
filename, basename,
|
||||
++max);
|
||||
g_free (basename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
return iter_valid;
|
||||
|
@ -359,7 +357,7 @@ _gimp_color_profile_store_history_add (GimpColorProfileStore *store,
|
|||
static gboolean
|
||||
gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
||||
GtkTreeIter *iter,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label,
|
||||
gint index)
|
||||
{
|
||||
|
@ -367,7 +365,7 @@ gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
|||
GtkTreeIter sibling;
|
||||
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 (index > -1, FALSE);
|
||||
|
||||
|
@ -416,7 +414,7 @@ gimp_color_profile_store_history_insert (GimpColorProfileStore *store,
|
|||
gtk_list_store_set (GTK_LIST_STORE (store), iter,
|
||||
GIMP_COLOR_PROFILE_STORE_ITEM_TYPE,
|
||||
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_INDEX, index,
|
||||
-1);
|
||||
|
@ -508,8 +506,13 @@ gimp_color_profile_store_load_profile (GimpColorProfileStore *store,
|
|||
if (gimp_scanner_parse_string (scanner, &label) &&
|
||||
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 (uri);
|
||||
|
||||
|
@ -606,22 +609,29 @@ gimp_color_profile_store_save (GimpColorProfileStore *store,
|
|||
if (type == GIMP_COLOR_PROFILE_STORE_ITEM_FILE)
|
||||
{
|
||||
gchar *label;
|
||||
gchar *uri;
|
||||
gchar *filename;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
GIMP_COLOR_PROFILE_STORE_LABEL, &label,
|
||||
GIMP_COLOR_PROFILE_STORE_URI, &uri,
|
||||
GIMP_COLOR_PROFILE_STORE_LABEL, &label,
|
||||
GIMP_COLOR_PROFILE_STORE_FILENAME, &filename,
|
||||
-1);
|
||||
|
||||
if (uri && label)
|
||||
if (filename && label)
|
||||
{
|
||||
gimp_config_writer_open (writer, "color-profile");
|
||||
gimp_config_writer_string (writer, label);
|
||||
gimp_config_writer_string (writer, uri);
|
||||
gimp_config_writer_close (writer);
|
||||
gchar *uri = g_filename_to_uri (filename, NULL, NULL);
|
||||
|
||||
if (uri)
|
||||
{
|
||||
gimp_config_writer_open (writer, "color-profile");
|
||||
gimp_config_writer_string (writer, label);
|
||||
gimp_config_writer_string (writer, uri);
|
||||
gimp_config_writer_close (writer);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
g_free (filename);
|
||||
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);
|
||||
|
||||
void gimp_color_profile_store_add (GimpColorProfileStore *store,
|
||||
const gchar *uri,
|
||||
const gchar *filename,
|
||||
const gchar *label);
|
||||
|
||||
|
||||
|
|
|
@ -1162,27 +1162,25 @@ lcms_icc_apply_dialog (gint32 image,
|
|||
|
||||
static void
|
||||
lcms_icc_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||
const gchar *uri)
|
||||
const gchar *filename)
|
||||
{
|
||||
cmsHPROFILE profile;
|
||||
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
gchar *name = NULL;
|
||||
cmsHPROFILE profile = NULL;
|
||||
gchar *label = NULL;
|
||||
|
||||
profile = lcms_load_profile (filename, NULL);
|
||||
if (filename)
|
||||
profile = lcms_load_profile (filename, NULL);
|
||||
|
||||
if (profile)
|
||||
{
|
||||
name = lcms_icc_profile_get_desc (profile);
|
||||
if (! name)
|
||||
name = lcms_icc_profile_get_name (profile);
|
||||
label = lcms_icc_profile_get_desc (profile);
|
||||
if (! label)
|
||||
label = lcms_icc_profile_get_name (profile);
|
||||
|
||||
cmsCloseProfile (profile);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
|
||||
gimp_color_profile_combo_box_set_active (combo, uri, name);
|
||||
g_free (name);
|
||||
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1192,12 +1190,13 @@ lcms_icc_file_chooser_dialog_response (GtkFileChooser *dialog,
|
|||
{
|
||||
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);
|
||||
g_free (uri);
|
||||
lcms_icc_combo_box_set_active (combo, filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1260,6 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
|
|||
gchar *history;
|
||||
gchar *label;
|
||||
gchar *name;
|
||||
gchar *uri;
|
||||
cmsHPROFILE profile;
|
||||
|
||||
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);
|
||||
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),
|
||||
uri, label);
|
||||
g_free (uri);
|
||||
config->rgb_profile, label);
|
||||
g_free (label);
|
||||
|
||||
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),
|
||||
uri);
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
lcms_icc_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
||||
filename);
|
||||
else
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
}
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
|
||||
return combo;
|
||||
}
|
||||
|
@ -1405,17 +1387,14 @@ lcms_dialog (GimpColorConfig *config,
|
|||
|
||||
if (run)
|
||||
{
|
||||
cmsHPROFILE dest_profile;
|
||||
gchar *filename = NULL;
|
||||
gchar *uri;
|
||||
GimpColorProfileComboBox *box = GIMP_COLOR_PROFILE_COMBO_BOX (combo);
|
||||
gchar *filename;
|
||||
cmsHPROFILE dest_profile;
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue