diff src/layout.c @ 1590:69f7270b3b27

improved color management button: - now cms menu alway can specify whether use profile from file or not. - current color profile is shown in the tool tip on cms button.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 03 May 2009 02:21:27 +0900
parents 05909b952b06
children fee96b7345e8
line wrap: on
line diff
--- a/src/layout.c	Fri May 01 15:50:26 2009 +0900
+++ b/src/layout.c	Sun May 03 02:21:27 2009 +0900
@@ -500,10 +500,10 @@
 
 	menu_item_add_divider(menu);
 
-	item = menu_item_add_check(menu, _("Use profile from _image"), use_image,
-			    G_CALLBACK(layout_color_menu_use_image_cb), lw);
-	gtk_widget_set_sensitive(item, image_profile == COLOR_PROFILE_MEM || (image_profile > COLOR_PROFILE_NONE && image_profile < COLOR_PROFILE_FILE));
-
+	item = menu_item_add_check(menu, _("Use profile from image if available"),
+                               use_image,
+                               G_CALLBACK(layout_color_menu_use_image_cb), lw);
+	gtk_widget_set_sensitive(item, TRUE);
 	for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++)
 		{
 		const gchar *label;
@@ -730,11 +730,13 @@
 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);
-	
+
 	if (!n)
 		{
 		gtk_label_set_text(GTK_LABEL(lw->info_zoom), "");
@@ -765,19 +767,36 @@
 		else
 			{
 			gint width, height;
-	
+
 			image_get_image_size(lw->image, &width, &height);
 			text = g_strdup_printf(_("( %d x %d ) %s bytes"),
 					       width, height, b);
 			}
 
 		g_signal_emit_by_name (lw->image->pr, "update-pixel");
-		
+
 		g_free(b);
-		
+
 		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)