mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: remove gimp_color_profile_chooser_dialog_get_desc()
and port its only user (the prefs dialog) to the code all other users of GimpColorProfileChooserDialog use.
This commit is contained in:
parent
b3395d989e
commit
dc8a3e8de5
|
@ -6,6 +6,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/app \
|
||||
-I$(top_srcdir)/app \
|
||||
$(LCMS_CFLAGS) \
|
||||
$(GEGL_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
|
|
@ -19,11 +19,16 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h> /* lcms.h uses the "inline" keyword */
|
||||
|
||||
#include <lcms2.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
|
@ -775,6 +780,29 @@ prefs_table_new (gint rows,
|
|||
return table;
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||
const gchar *filename)
|
||||
{
|
||||
cmsHPROFILE profile = NULL;
|
||||
gchar *label = NULL;
|
||||
|
||||
if (filename)
|
||||
profile = cmsOpenProfileFromFile (filename, "r");
|
||||
|
||||
if (profile)
|
||||
{
|
||||
label = gimp_lcms_profile_get_description (profile);
|
||||
if (! label)
|
||||
label = gimp_lcms_profile_get_model (profile);
|
||||
|
||||
cmsCloseProfile (profile);
|
||||
}
|
||||
|
||||
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_profile_combo_dialog_response (GimpColorProfileChooserDialog *dialog,
|
||||
gint response,
|
||||
|
@ -788,12 +816,9 @@ prefs_profile_combo_dialog_response (GimpColorProfileChooserDialog *dialog,
|
|||
|
||||
if (filename)
|
||||
{
|
||||
gchar *label = gimp_color_profile_chooser_dialog_get_desc (dialog,
|
||||
filename);
|
||||
prefs_profile_combo_box_set_active (combo, filename);
|
||||
|
||||
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
||||
|
||||
g_free (label);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
struct _GimpColorProfileChooserDialogPrivate
|
||||
{
|
||||
GimpColorProfileView *profile_view;
|
||||
gchar *filename;
|
||||
gchar *desc;
|
||||
};
|
||||
|
||||
|
||||
|
@ -155,21 +153,6 @@ gimp_color_profile_chooser_dialog_new (const gchar *title)
|
|||
NULL);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gimp_color_profile_chooser_dialog_get_desc (GimpColorProfileChooserDialog *dialog,
|
||||
const gchar *filename)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE_CHOOSER_DIALOG (dialog), NULL);
|
||||
|
||||
if (filename && dialog->private->filename &&
|
||||
strcmp (filename, dialog->private->filename) == 0)
|
||||
{
|
||||
return g_strdup (dialog->private->desc);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Add shortcut for default ICC profile location */
|
||||
static void
|
||||
gimp_color_profile_chooser_dialog_add_shortcut (GimpColorProfileChooserDialog *dialog)
|
||||
|
@ -206,8 +189,6 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
|
|||
{
|
||||
GimpColorProfile profile;
|
||||
gchar *filename;
|
||||
gchar *desc;
|
||||
gchar *model;
|
||||
GError *error = NULL;
|
||||
|
||||
filename = gtk_file_chooser_get_preview_filename (GTK_FILE_CHOOSER (dialog));
|
||||
|
@ -225,31 +206,13 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
|
|||
gimp_color_profile_view_set_error (dialog->private->profile_view,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
g_free (filename);
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
gimp_color_profile_view_set_profile (dialog->private->profile_view,
|
||||
profile);
|
||||
|
||||
desc = gimp_lcms_profile_get_description (profile);
|
||||
model = gimp_lcms_profile_get_model (profile);
|
||||
|
||||
cmsCloseProfile (profile);
|
||||
|
||||
if (desc && strlen (desc))
|
||||
{
|
||||
dialog->private->desc = desc;
|
||||
desc = NULL;
|
||||
}
|
||||
else if (model && strlen (model))
|
||||
{
|
||||
dialog->private->desc = model;
|
||||
model = NULL;
|
||||
}
|
||||
|
||||
dialog->private->filename = filename;
|
||||
|
||||
g_free (desc);
|
||||
g_free (model);
|
||||
g_free (filename);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,5 @@ GType gimp_color_profile_chooser_dialog_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GtkWidget * gimp_color_profile_chooser_dialog_new (const gchar *title);
|
||||
|
||||
gchar * gimp_color_profile_chooser_dialog_get_desc (GimpColorProfileChooserDialog *dialog,
|
||||
const gchar *filename);
|
||||
|
||||
#endif /* __GIMP_COLOR_PROFILE_CHOOSER_DIALOG_H__ */
|
||||
|
|
|
@ -71,7 +71,6 @@ EXPORTS
|
|||
gimp_color_hex_entry_set_color
|
||||
gimp_color_notebook_get_type
|
||||
gimp_color_notebook_set_has_page
|
||||
gimp_color_profile_chooser_dialog_get_desc
|
||||
gimp_color_profile_chooser_dialog_get_type
|
||||
gimp_color_profile_chooser_dialog_new
|
||||
gimp_color_profile_combo_box_add
|
||||
|
|
Loading…
Reference in New Issue