static GtkWidget * lcms_icc_combo_box_new (GimpColorConfig *config, const gchar *filename) { GtkWidget *combo; GtkWidget *dialog; gchar *history; gchar *label; gchar *name; const gchar *rgb_filename = NULL; cmsHPROFILE profile = NULL; dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile")); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (dialog, history); g_free (history); if (config->rgb_profile) { GError *error = NULL; profile = gimp_lcms_profile_open_from_file (config->rgb_profile, &error); if (! profile) { g_message ("%s", error->message); g_clear_error (&error); } else if (! gimp_lcms_profile_is_rgb (profile)) { g_message (_("Color profile '%s' is not for RGB color space."), gimp_filename_to_utf8 (config->rgb_profile)); cmsCloseProfile (profile); profile = NULL; } else { rgb_filename = config->rgb_profile; } } if (! profile) profile = gimp_lcms_create_srgb_profile (); name = gimp_lcms_profile_get_label (profile); label = g_strdup_printf (_("RGB workspace (%s)"), name); g_free (name); cmsCloseProfile (profile); gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo), rgb_filename, label); g_free (label); gimp_color_profile_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo), filename, NULL); return combo; }
static GtkWidget * lcms_icc_combo_box_new (GimpColorConfig *config, const gchar *filename) { GtkWidget *combo; GtkWidget *dialog; gchar *history; gchar *label; gchar *name; cmsHPROFILE profile; dialog = lcms_icc_file_chooser_dialog_new (); history = gimp_personal_rc_file ("profilerc"); combo = gimp_color_profile_combo_box_new (dialog, history); g_free (history); g_signal_connect (dialog, "response", G_CALLBACK (lcms_icc_file_chooser_dialog_response), combo); if (config->rgb_profile) profile = lcms_load_profile (config->rgb_profile, NULL); else profile = cmsCreate_sRGBProfile (); name = lcms_icc_profile_get_desc (profile); if (! name) name = lcms_icc_profile_get_name (profile); cmsCloseProfile (profile); label = g_strdup_printf (_("RGB workspace (%s)"), name); g_free (name); gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo), config->rgb_profile, label); g_free (label); if (filename) lcms_icc_combo_box_set_active (GIMP_COLOR_PROFILE_COMBO_BOX (combo), filename); else gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); return combo; }