Code

setting sensibility of "color management icon" depending on icc-color usage
authorJucaBlues <JucaBlues@users.sourceforge.net>
Tue, 11 Aug 2009 04:58:32 +0000 (04:58 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Tue, 11 Aug 2009 04:58:32 +0000 (04:58 +0000)
src/widgets/sp-color-notebook.cpp
src/widgets/sp-color-notebook.h

index 58974131e6986cdf7fd47a8674046d1933e45bcb..44de40115796f95124f17ac78dd87deb9b001234 100644 (file)
@@ -326,21 +326,21 @@ void ColorNotebook::init()
 
        GtkWidget *rgbabox = gtk_hbox_new (FALSE, 0);
        /* Create color management icons */
-        GtkWidget *box_colormanaged = gtk_event_box_new ();
+        _box_colormanaged = gtk_event_box_new ();
         GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
-        gtk_container_add (GTK_CONTAINER (box_colormanaged), colormanaged);
+        gtk_container_add (GTK_CONTAINER (_box_colormanaged), colormanaged);
         GtkTooltips *tooltips_colormanaged = gtk_tooltips_new ();
-        gtk_tooltips_set_tip (tooltips_colormanaged, box_colormanaged, _("Color Managed"), "");
-        //gtk_widget_hide (GTK_WIDGET (box_colormanaged));
-       gtk_box_pack_start(GTK_BOX(rgbabox), box_colormanaged, TRUE, FALSE, 2);
+        gtk_tooltips_set_tip (tooltips_colormanaged, _box_colormanaged, _("Color Managed"), "");
+        gtk_widget_set_sensitive (_box_colormanaged, false);
+       gtk_box_pack_start(GTK_BOX(rgbabox), _box_colormanaged, TRUE, FALSE, 2);
 
-        GtkWidget *box_outofgamut = gtk_event_box_new ();
+        _box_outofgamut = gtk_event_box_new ();
         GtkWidget *outofgamut = gtk_image_new_from_icon_name ("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR);
-        gtk_container_add (GTK_CONTAINER (box_outofgamut), outofgamut);
+        gtk_container_add (GTK_CONTAINER (_box_outofgamut), outofgamut);
         GtkTooltips *tooltips_outofgamut = gtk_tooltips_new ();
-        gtk_tooltips_set_tip (tooltips_outofgamut, box_outofgamut, _("Out of gamut!"), "");
-        //gtk_widget_hide (GTK_WIDGET (box_outofgamut));
-       gtk_box_pack_start(GTK_BOX(rgbabox), box_outofgamut, TRUE, FALSE, 2);        
+        gtk_tooltips_set_tip (tooltips_outofgamut, _box_outofgamut, _("Out of gamut!"), "");
+        gtk_widget_set_sensitive (_box_outofgamut, false);
+       gtk_box_pack_start(GTK_BOX(rgbabox), _box_outofgamut, TRUE, FALSE, 2);        
 
        /* Create RGBA entry and color preview */
        _rgbal = gtk_label_new_with_mnemonic (_("RGBA_:"));
@@ -500,6 +500,9 @@ void ColorNotebook::_rgbaEntryChanged(GtkEntry* entry)
 void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha )
 {
     g_return_if_fail( ( 0.0 <= alpha ) && ( alpha <= 1.0 ) );
+    
+    /* update color management icon*/
+    gtk_widget_set_sensitive (_box_colormanaged, color.icc != NULL);
 
     if ( !_updatingrgba )
     {
index bf6fb1002edd28152a32cd32b18a8b5ed56b5b6d..c9ab297988d5b4c550c70abacffcc11a2a44cf2c 100644 (file)
@@ -61,6 +61,7 @@ protected:
     gulong _entryId;
     GtkWidget *_book;
     GtkWidget *_rgbal, *_rgbae; /* RGBA entry */
+    GtkWidget *_box_outofgamut, *_box_colormanaged;
     GtkWidget *_p; /* Color preview */
     GtkWidget *_btn;
     GtkWidget *_popup;