Example #1
0
static void
cdisplay_lcms_profile_get_info (cmsHPROFILE   profile,
                                gchar       **name,
                                gchar       **info)
{
  if (profile)
    {
      *name = gimp_lcms_profile_get_description (profile);
      if (! *name)
        *name = gimp_lcms_profile_get_model (profile);

      if (! *name)
        {
          /* a color profile without a name */
          *name = g_strdup (_("(unnamed profile)"));
        }

      *info = gimp_lcms_profile_get_summary (profile);
    }
  else
    {
      *name = g_strdup (_("None"));
      *info = NULL;
    }
}
Example #2
0
File: lcms.c Project: K-Sonoda/gimp
static GimpPDBStatusType
lcms_icc_info (GimpColorConfig *config,
               gint32           image,
               gchar          **name,
               gchar          **desc,
               gchar          **info)
{
  cmsHPROFILE  profile;
  GError      *error = NULL;

  g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), GIMP_PDB_CALLING_ERROR);
  g_return_val_if_fail (image != -1, GIMP_PDB_CALLING_ERROR);

  profile = lcms_image_get_profile (config, image, &error);

  if (error)
    {
      g_message ("%s", error->message);
      g_clear_error (&error);
    }

  if (! profile)
    profile = gimp_lcms_create_srgb_profile ();

  if (name) *name = gimp_lcms_profile_get_model (profile);
  if (desc) *desc = gimp_lcms_profile_get_description (profile);
  if (info) *info = gimp_lcms_profile_get_summary (profile);

  cmsCloseProfile (profile);

  return GIMP_PDB_SUCCESS;
}
Example #3
0
File: lcms.c Project: K-Sonoda/gimp
static GimpPDBStatusType
lcms_icc_file_info (GFile   *file,
                    gchar  **name,
                    gchar  **desc,
                    gchar  **info,
                    GError **error)
{
  cmsHPROFILE profile;

  profile = gimp_lcms_profile_open_from_file (file, error);

  if (! profile)
    return GIMP_PDB_EXECUTION_ERROR;

  *name = gimp_lcms_profile_get_model (profile);
  *desc = gimp_lcms_profile_get_description (profile);
  *info = gimp_lcms_profile_get_summary (profile);

  cmsCloseProfile (profile);

  return GIMP_PDB_SUCCESS;
}
Example #4
0
void
gimp_color_profile_view_set_profile (GimpColorProfileView *view,
                                     GimpColorProfile      profile)
{
  GtkTextBuffer *buffer;
  GtkTextIter    iter;
  gchar         *label;
  gchar         *summary;

  g_return_if_fail (GIMP_IS_COLOR_PROFILE_VIEW (view));

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

  gtk_text_buffer_set_text (buffer, "", 0);

  view->priv->profile = profile;

  if (! profile)
    return;

  gtk_text_buffer_get_start_iter (buffer, &iter);

  label   = gimp_lcms_profile_get_label (profile);
  summary = gimp_lcms_profile_get_summary (profile);

  if (label && strlen (label))
    {
      gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
                                                label, -1,
                                                "strong", NULL);
      gtk_text_buffer_insert (buffer, &iter, "\n", 1);
    }

  if (summary)
    gtk_text_buffer_insert (buffer, &iter, summary, -1);

  g_free (label);
  g_free (summary);
}