[gthumb] histogram view: set insensitive when there is no histogram to view
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] histogram view: set insensitive when there is no histogram to view
- Date: Wed, 2 Mar 2011 19:02:15 +0000 (UTC)
commit 82ce7463c6cd5474727a2ce8519c4a94e115dc89
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Mar 2 15:09:13 2011 +0100
histogram view: set insensitive when there is no histogram to view
gthumb/gth-histogram-view.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/gthumb/gth-histogram-view.c b/gthumb/gth-histogram-view.c
index de84f9d..1fa1768 100644
--- a/gthumb/gth-histogram-view.c
+++ b/gthumb/gth-histogram-view.c
@@ -445,17 +445,11 @@ histogram_view_expose_event_cb (GtkWidget *widget,
if ((self->priv->histogram == NULL)
|| ((int) self->priv->current_channel > gth_histogram_get_nchannels (self->priv->histogram)))
{
- /* draw an x if the current channel is not available */
-
- gdk_cairo_set_source_color (cr, &style->text[gtk_widget_get_state (widget)]);
- cairo_set_line_width (cr, 1.0);
- cairo_move_to (cr, 0, 0);
- cairo_line_to (cr, allocation.width + 1, allocation.height + 1);
- cairo_move_to (cr, allocation.width + 1, 0);
- cairo_line_to (cr, 0, allocation.height + 1);
- cairo_stroke (cr);
+ gtk_widget_set_sensitive (self->priv->histogram_view, FALSE);
}
else {
+ gtk_widget_set_sensitive (self->priv->histogram_view, TRUE);
+
if ((self->priv->selection_start > 0) || (self->priv->selection_end < 255))
gth_histogram_paint_selection (self, cr, &allocation);
@@ -847,6 +841,21 @@ _gth_histogram_view_update_info (GthHistogramView *self)
int i;
char *s;
+ if ((self->priv->histogram == NULL)
+ || ((int) self->priv->current_channel > gth_histogram_get_nchannels (self->priv->histogram)))
+ {
+ gtk_widget_set_sensitive (GET_WIDGET ("histogram_info"), FALSE);
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("mean_label")), "");
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("std_dev_label")), "");
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("median_label")), "");
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("total_label")), "");
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("selected_label")), "");
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("percentile_label")), "");
+ return;
+ }
+
+ gtk_widget_set_sensitive (GET_WIDGET ("histogram_info"), TRUE);
+
if (gth_histogram_view_get_display_mode (self) == GTH_HISTOGRAM_MODE_ALL_CHANNELS) {
first_channel = GTH_HISTOGRAM_CHANNEL_RED;
last_channel = GTH_HISTOGRAM_CHANNEL_BLUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]