Revision: 1646
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1646&view=rev
Author:   nadvornik
Date:     2009-04-13 14:39:50 +0000 (Mon, 13 Apr 2009)

Log Message:
-----------
show color management status on statusbar

Modified Paths:
--------------
    trunk/src/color-man.c
    trunk/src/color-man.h
    trunk/src/image.c
    trunk/src/image.h
    trunk/src/layout.c
    trunk/src/layout_image.c
    trunk/src/layout_image.h
    trunk/src/typedefs.h

Modified: trunk/src/color-man.c
===================================================================
--- trunk/src/color-man.c       2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/color-man.c       2009-04-13 14:39:50 UTC (rev 1646)
@@ -412,6 +412,41 @@
                                  screen_type, screen_file, screen_data, 
screen_data_len);
 }
 
+static gchar *color_man_get_profile_name(ColorManProfileType type, cmsHPROFILE 
profile)
+{
+       switch (type)
+               {
+               case COLOR_PROFILE_SRGB:
+                       return g_strdup(_("sRGB"));
+               case COLOR_PROFILE_ADOBERGB:
+                       return g_strdup(_("Adobe RGB compatible"));
+                       break;
+               case COLOR_PROFILE_MEM:
+               case COLOR_PROFILE_FILE:
+                       if (profile)
+                               {
+                               return g_strdup(cmsTakeProductName(profile));
+                               }
+                       return g_strdup(_("Custom profile"));
+                       break;
+               case COLOR_PROFILE_NONE:
+               default:
+                       return g_strdup("");
+               }
+}
+
+gboolean color_man_get_status(ColorMan *cm, gchar **image_profile, gchar 
**screen_profile)
+{
+       ColorManCache *cc;
+       if (!cm) return FALSE;
+
+       cc = cm->profile;
+       
+       if (image_profile) *image_profile = 
color_man_get_profile_name(cc->profile_in_type, cc->profile_in);
+       if (screen_profile) *screen_profile = 
color_man_get_profile_name(cc->profile_out_type, cc->profile_out);
+       return TRUE;
+}
+
 void color_man_free(ColorMan *cm)
 {
        if (!cm) return;
@@ -471,5 +506,10 @@
        /* no op */
 }
 
+gboolean color_man_get_status(ColorMan *cm, gchar **image_profile, gchar 
**screen_profile)
+{
+       return FALSE;
+}
+
 #endif /* define HAVE_LCMS */
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */

Modified: trunk/src/color-man.h
===================================================================
--- trunk/src/color-man.h       2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/color-man.h       2009-04-13 14:39:50 UTC (rev 1646)
@@ -63,5 +63,7 @@
 
 void color_man_start_bg(ColorMan *cm, ColorManDoneFunc don_func, gpointer 
done_data);
 
+gboolean color_man_get_status(ColorMan *cm, gchar **image_profile, gchar 
**screen_profile);
+
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */

Modified: trunk/src/image.c
===================================================================
--- trunk/src/image.c   2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/image.c   2009-04-13 14:39:50 UTC (rev 1646)
@@ -1480,11 +1480,15 @@
        return imd->color_profile_enable;
 }
 
-gint image_color_profile_get_from_image(ImageWindow *imd)
+gboolean image_color_profile_get_status(ImageWindow *imd, gchar 
**image_profile, gchar **screen_profile)
 {
-       if (!imd) return COLOR_PROFILE_NONE;
+       ColorMan *cm;
+       if (!imd) return FALSE;
+       
+       cm = imd->cm;
+       if (!cm) return FALSE;
+       return color_man_get_status(cm, image_profile, screen_profile);
 
-       return imd->color_profile_from_image;
 }
 
 void image_set_delay_flip(ImageWindow *imd, gboolean delay)

Modified: trunk/src/image.h
===================================================================
--- trunk/src/image.h   2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/image.h   2009-04-13 14:39:50 UTC (rev 1646)
@@ -110,7 +110,7 @@
                             gboolean *use_image);
 void image_color_profile_set_use(ImageWindow *imd, gboolean enable);
 gboolean image_color_profile_get_use(ImageWindow *imd);
-gint image_color_profile_get_from_image(ImageWindow *imd);
+gboolean image_color_profile_get_status(ImageWindow *imd, gchar 
**image_profile, gchar **screen_profile);
 
 /* set delayed page flipping */
 void image_set_delay_flip(ImageWindow *imd, gint delay);

Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c  2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/layout.c  2009-04-13 14:39:50 UTC (rev 1646)
@@ -391,31 +391,21 @@
        return button;
 }
 
-#if 0
 static GtkWidget *layout_color_button(LayoutWindow *lw)
 {
        GtkWidget *button;
        GtkWidget *image;
-       gboolean enable;
 
        button = gtk_button_new();
        image = gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, 
GTK_ICON_SIZE_MENU);
        gtk_container_add(GTK_CONTAINER(button), image);
        gtk_widget_show(image);
-       g_signal_connect(G_OBJECT(button), "clicked",
-                        G_CALLBACK(layout_color_button_press_cb), lw);
        gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
 
-#ifdef HAVE_LCMS
-       enable = (lw->image) ? lw->image->color_profile_enable : FALSE;
-#else
-       enable = FALSE;
-#endif
-       gtk_widget_set_sensitive(image, enable);
+       gtk_widget_set_sensitive(GTK_BIN(button)->child, FALSE);
 
        return button;
 }
-#endif
 /*
  *-----------------------------------------------------------------------------
  * write button
@@ -560,7 +550,9 @@
 void layout_status_update_image(LayoutWindow *lw)
 {
        guint64 n;
-
+       gchar *image_profile;
+       gchar *screen_profile;
+       
        if (!layout_valid(&lw) || !lw->image) return;
 
        n = layout_list_count(lw, NULL);
@@ -608,6 +600,23 @@
                gtk_label_set_text(GTK_LABEL(lw->info_details), text);
                g_free(text);
                }
+       
+       if (layout_image_color_profile_get_status(lw, &image_profile, 
&screen_profile))
+               {
+               gchar *buf;
+               gtk_widget_set_sensitive(GTK_BIN(lw->info_color)->child, TRUE);
+               buf = g_strdup_printf(_("Image profile: %s\nScreen profile: 
%s"), image_profile, screen_profile);
+               /* FIXME: not sure if a tooltip is the best form of 
presentation */
+               gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_color), buf);
+               g_free(image_profile);
+               g_free(screen_profile);
+               g_free(buf);
+               }
+       else
+               {
+               gtk_widget_set_sensitive(GTK_BIN(lw->info_color)->child, FALSE);
+               gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_color), NULL);
+               }
 }
 
 void layout_status_update_all(LayoutWindow *lw)
@@ -679,9 +688,13 @@
        gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0);
        gtk_widget_show(lw->info_sort);
 
+       lw->info_color = layout_color_button(lw);
+       gtk_widget_show(lw->info_color);
+
        lw->info_write = layout_write_button(lw);
        gtk_widget_show(lw->info_write);
 
+       if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_color, 
FALSE, FALSE, 0);
        if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_write, 
FALSE, FALSE, 0);
 
        lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, 
(!small_format));
@@ -697,6 +710,7 @@
                hbox = lw->info_box;
                }
        lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
+       if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_color, 
FALSE, FALSE, 0);
        if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_write, 
FALSE, FALSE, 0);
        lw->info_pixel = layout_status_label(NULL, hbox, FALSE, 
PIXEL_LABEL_WIDTH, TRUE);
        if (lw->options.info_pixel_hidden) 
gtk_widget_hide(gtk_widget_get_parent(lw->info_pixel));
@@ -1628,6 +1642,7 @@
        lw->info_box = NULL;
        lw->info_progress_bar = NULL;
        lw->info_sort = NULL;
+       lw->info_color = NULL;
        lw->info_status = NULL;
        lw->info_details = NULL;
        lw->info_pixel = NULL;

Modified: trunk/src/layout_image.c
===================================================================
--- trunk/src/layout_image.c    2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/layout_image.c    2009-04-13 14:39:50 UTC (rev 1646)
@@ -1081,14 +1081,6 @@
        if (!layout_valid(&lw)) return;
 
        image_color_profile_set_use(lw->image, enable);
-
-//     if (lw->info_color)
-//             {
-#ifndef HAVE_LCMS
-//             enable = FALSE;
-#endif
-//             gtk_widget_set_sensitive(GTK_BIN(lw->info_color)->child, 
enable);
-//             }
 }
 
 gboolean layout_image_color_profile_get_use(LayoutWindow *lw)
@@ -1098,11 +1090,11 @@
        return image_color_profile_get_use(lw->image);
 }
 
-gint layout_image_color_profile_get_from_image(LayoutWindow *lw)
+gboolean layout_image_color_profile_get_status(LayoutWindow *lw, gchar 
**image_profile, gchar **screen_profile)
 {
-       if (!layout_valid(&lw)) return COLOR_PROFILE_NONE;
+       if (!layout_valid(&lw)) return FALSE;
 
-       return image_color_profile_get_from_image(lw->image);
+       return image_color_profile_get_status(lw->image, image_profile, 
screen_profile);
 }
 
 /*

Modified: trunk/src/layout_image.h
===================================================================
--- trunk/src/layout_image.h    2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/layout_image.h    2009-04-13 14:39:50 UTC (rev 1646)
@@ -36,7 +36,7 @@
                                    gboolean *use_image);
 void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable);
 gboolean layout_image_color_profile_get_use(LayoutWindow *lw);
-gint layout_image_color_profile_get_from_image(LayoutWindow *lw);
+gboolean layout_image_color_profile_get_status(LayoutWindow *lw, gchar 
**image_profile, gchar **screen_profile);
 
 
 const gchar *layout_image_get_path(LayoutWindow *lw);

Modified: trunk/src/typedefs.h
===================================================================
--- trunk/src/typedefs.h        2009-04-13 10:55:49 UTC (rev 1645)
+++ trunk/src/typedefs.h        2009-04-13 14:39:50 UTC (rev 1646)
@@ -627,6 +627,7 @@
        GtkWidget *info_box;
        GtkWidget *info_progress_bar;
        GtkWidget *info_sort;
+       GtkWidget *info_color;
        GtkWidget *info_status;
        GtkWidget *info_details;
        GtkWidget *info_zoom;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to