added a check button to control the "display-profile-from-gdk" option.

2005-06-24  Sven Neumann  <sven@gimp.org>

	* app/dialogs/preferences-dialog.c: added a check button to control
	the "display-profile-from-gdk" option.

	* modules/cdisplay_lcms.c (cdisplay_lcms_get_display_profile):
	fixed use of gdk_property_get(). Return NULL if no display profile
	can be obtained.
This commit is contained in:
Sven Neumann 2005-06-24 09:41:16 +00:00 committed by Sven Neumann
parent 3490c49252
commit 87e8c925bc
3 changed files with 42 additions and 12 deletions

View File

@ -1,3 +1,12 @@
2005-06-24 Sven Neumann <neumann@jpk.com>
* app/dialogs/preferences-dialog.c: added a check button to control
the "display-profile-from-gdk" option.
* modules/cdisplay_lcms.c (cdisplay_lcms_get_display_profile):
fixed use of gdk_property_get(). Return NULL if no display profile
can be obtained.
2005-06-24 Sven Neumann <sven@gimp.org>
Added basic support for the proposed ICC Profiles In X Specification
@ -7,8 +16,7 @@
"display-profile-from-gdk", default to TRUE.
* modules/cdisplay_lcms.c: try to retrieve the display color
profile from the "_ICC_PROFILE" profile on the default screen's
root window.
profile from the "_ICC_PROFILE" property on the default screen.
2005-06-23 Akkana Peck <akkana@shallowsky.com>

View File

@ -2149,7 +2149,7 @@ prefs_dialog_new (Gimp *gimp,
&top_iter,
page_index++);
table = prefs_table_new (7, GTK_CONTAINER (vbox));
table = prefs_table_new (8, GTK_CONTAINER (vbox));
{
static const struct
@ -2171,6 +2171,7 @@ prefs_dialog_new (Gimp *gimp,
};
GObject *color_config;
gint row;
g_object_get (object, "color-management", &color_config, NULL);
@ -2184,16 +2185,34 @@ prefs_dialog_new (Gimp *gimp,
_("_Softproof rendering intent:"),
GTK_TABLE (table), 2, NULL);
for (i = 0; i < G_N_ELEMENTS (profiles); i++)
for (i = 0, row = 3; i < G_N_ELEMENTS (profiles); i++, row++)
{
button =
gimp_prop_file_chooser_button_new (color_config,
profiles[i].property_name,
gettext (profiles[i].fs_label),
GTK_FILE_CHOOSER_ACTION_OPEN);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3 + i,
gimp_table_attach_aligned (GTK_TABLE (table), 0, row,
gettext (profiles[i].label), 0.0, 0.5,
button, 1, FALSE);
#if defined (GDK_WINDOWING_X11)
if (i == 2) /* display profile */
{
button =
gimp_prop_check_button_new (color_config,
"display-profile-from-gdk",
_("Try to obtain the monitor profile "
"from the X server"));
row++;
gtk_table_attach_defaults (GTK_TABLE (table),
button, 0, 2, row, row + 1);
gtk_widget_show (button);
}
#endif
}
g_object_unref (color_config);

View File

@ -344,23 +344,23 @@ static cmsHPROFILE
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
GimpColorConfig *config)
{
#if defined (GDK_WINDOWING_X11)
if (config->display_profile_from_gdk)
{
/* FIXME: need to access the display's screen here */
GdkScreen *screen = gdk_screen_get_default ();
GdkAtom type;
gint format;
gint nitems;
guchar *data;
GdkAtom type = GDK_NONE;
gint format = 0;
gint nitems = 0;
guchar *data = NULL;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (gdk_property_get (gdk_screen_get_root_window (screen),
gdk_atom_intern ("_ICC_PROFILE", FALSE),
GDK_NONE,
0, G_MAXLONG,
FALSE,
&type, &format, &nitems, &data) && nitems)
0, 256 * 1024, FALSE,
&type, &format, &nitems, &data) && nitems > 0)
{
cmsHPROFILE *profile = cmsOpenProfileFromMem (data, nitems);
@ -369,7 +369,10 @@ cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
return profile;
}
}
#endif
if (config->display_profile)
return cmsOpenProfileFromFile (config->display_profile, "r");
return NULL;
}