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:
@ -6,6 +6,7 @@ AM_CPPFLAGS = \
|
|||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
-I$(top_builddir)/app \
|
-I$(top_builddir)/app \
|
||||||
-I$(top_srcdir)/app \
|
-I$(top_srcdir)/app \
|
||||||
|
$(LCMS_CFLAGS) \
|
||||||
$(GEGL_CFLAGS) \
|
$(GEGL_CFLAGS) \
|
||||||
$(GTK_CFLAGS) \
|
$(GTK_CFLAGS) \
|
||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
@ -19,11 +19,16 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib.h> /* lcms.h uses the "inline" keyword */
|
||||||
|
|
||||||
|
#include <lcms2.h>
|
||||||
|
|
||||||
#include <gegl.h>
|
#include <gegl.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimpmath/gimpmath.h"
|
#include "libgimpmath/gimpmath.h"
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
#include "libgimpcolor/gimpcolor.h"
|
||||||
#include "libgimpconfig/gimpconfig.h"
|
#include "libgimpconfig/gimpconfig.h"
|
||||||
#include "libgimpwidgets/gimpwidgets.h"
|
#include "libgimpwidgets/gimpwidgets.h"
|
||||||
|
|
||||||
@ -775,6 +780,29 @@ prefs_table_new (gint rows,
|
|||||||
return table;
|
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
|
static void
|
||||||
prefs_profile_combo_dialog_response (GimpColorProfileChooserDialog *dialog,
|
prefs_profile_combo_dialog_response (GimpColorProfileChooserDialog *dialog,
|
||||||
gint response,
|
gint response,
|
||||||
@ -788,12 +816,9 @@ prefs_profile_combo_dialog_response (GimpColorProfileChooserDialog *dialog,
|
|||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
gchar *label = gimp_color_profile_chooser_dialog_get_desc (dialog,
|
prefs_profile_combo_box_set_active (combo, filename);
|
||||||
filename);
|
|
||||||
|
|
||||||
gimp_color_profile_combo_box_set_active (combo, filename, label);
|
g_free (filename);
|
||||||
|
|
||||||
g_free (label);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
struct _GimpColorProfileChooserDialogPrivate
|
struct _GimpColorProfileChooserDialogPrivate
|
||||||
{
|
{
|
||||||
GimpColorProfileView *profile_view;
|
GimpColorProfileView *profile_view;
|
||||||
gchar *filename;
|
|
||||||
gchar *desc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -155,21 +153,6 @@ gimp_color_profile_chooser_dialog_new (const gchar *title)
|
|||||||
NULL);
|
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 */
|
/* Add shortcut for default ICC profile location */
|
||||||
static void
|
static void
|
||||||
gimp_color_profile_chooser_dialog_add_shortcut (GimpColorProfileChooserDialog *dialog)
|
gimp_color_profile_chooser_dialog_add_shortcut (GimpColorProfileChooserDialog *dialog)
|
||||||
@ -206,8 +189,6 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
|
|||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile profile;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
gchar *desc;
|
|
||||||
gchar *model;
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_preview_filename (GTK_FILE_CHOOSER (dialog));
|
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,
|
gimp_color_profile_view_set_error (dialog->private->profile_view,
|
||||||
error->message);
|
error->message);
|
||||||
g_clear_error (&error);
|
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;
|
gimp_color_profile_view_set_profile (dialog->private->profile_view,
|
||||||
desc = NULL;
|
profile);
|
||||||
}
|
cmsCloseProfile (profile);
|
||||||
else if (model && strlen (model))
|
|
||||||
{
|
|
||||||
dialog->private->desc = model;
|
|
||||||
model = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->private->filename = filename;
|
g_free (filename);
|
||||||
|
|
||||||
g_free (desc);
|
|
||||||
g_free (model);
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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__ */
|
#endif /* __GIMP_COLOR_PROFILE_CHOOSER_DIALOG_H__ */
|
||||||
|
@ -71,7 +71,6 @@ EXPORTS
|
|||||||
gimp_color_hex_entry_set_color
|
gimp_color_hex_entry_set_color
|
||||||
gimp_color_notebook_get_type
|
gimp_color_notebook_get_type
|
||||||
gimp_color_notebook_set_has_page
|
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_get_type
|
||||||
gimp_color_profile_chooser_dialog_new
|
gimp_color_profile_chooser_dialog_new
|
||||||
gimp_color_profile_combo_box_add
|
gimp_color_profile_combo_box_add
|
||||||
|
Reference in New Issue
Block a user