Revision: 1419
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1419&view=rev
Author:   zas_
Date:     2009-02-25 20:42:35 +0000 (Wed, 25 Feb 2009)

Log Message:
-----------
Fix up bar pane histogram contextual menu: show current state for channel and 
log mode.

Modified Paths:
--------------
    trunk/src/bar_histogram.c

Modified: trunk/src/bar_histogram.c
===================================================================
--- trunk/src/bar_histogram.c   2009-02-25 19:46:03 UTC (rev 1418)
+++ trunk/src/bar_histogram.c   2009-02-25 20:42:35 UTC (rev 1419)
@@ -153,11 +153,15 @@
        PaneHistogramData *phd;
        gint channel;
 
+       if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) 
return;
+
        phd = submenu_item_get_data(widget);
 
        if (!phd) return;
 
        channel = GPOINTER_TO_INT(data);
+       if (channel == histogram_get_channel(phd->histogram)) return;
+
        histogram_set_channel(phd->histogram, channel);
        bar_pane_histogram_update(phd);
 }
@@ -166,12 +170,16 @@
 {
        PaneHistogramData *phd;
        gint logmode;
+       
+       if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) 
return;
 
        phd = submenu_item_get_data(widget);
 
        if (!phd) return;
 
        logmode = GPOINTER_TO_INT(data);
+       if (logmode == histogram_get_mode(phd->histogram)) return;
+
        histogram_set_mode(phd->histogram, logmode);
        bar_pane_histogram_update(phd);
 }
@@ -179,14 +187,14 @@
 static GtkWidget *bar_pane_histogram_add_radio(GtkWidget *menu, GtkWidget 
*parent,
                                        const gchar *label,
                                        GCallback func, gint value,
-                                       gboolean show_current, gint show_value)
+                                       gboolean show_current, gint 
current_value)
 {
        GtkWidget *item;
 
        if (show_current)
                {
                item = menu_item_add_radio(menu, parent,
-                                          label, (value == show_value),
+                                          label, (value == current_value),
                                           func, GINT_TO_POINTER((gint)value));
                }
        else
@@ -199,7 +207,7 @@
 }
 
 GtkWidget *bar_pane_histogram_add_channels(GtkWidget *menu, GCallback func, 
gpointer data,
-                                          gboolean show_current, gint value)
+                                          gboolean show_current, gint 
current_value)
 {
        GtkWidget *submenu;
        GtkWidget *parent;
@@ -207,11 +215,11 @@
        submenu = gtk_menu_new();
        g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
 
-       parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Red"), func, 
HCHAN_R, show_current, value);
-       bar_pane_histogram_add_radio(submenu, parent, _("_Green"), func, 
HCHAN_G, show_current, value);
-       bar_pane_histogram_add_radio(submenu, parent, _("_Blue"),func, HCHAN_B, 
show_current, value);
-       bar_pane_histogram_add_radio(submenu, parent, _("_RGB"),func, 
HCHAN_RGB, show_current, value);
-       bar_pane_histogram_add_radio(submenu, parent, _("_Value"),func, 
HCHAN_MAX, show_current, value);
+       parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Red"), func, 
HCHAN_R, show_current, current_value);
+       bar_pane_histogram_add_radio(submenu, parent, _("_Green"), func, 
HCHAN_G, show_current, current_value);
+       bar_pane_histogram_add_radio(submenu, parent, _("_Blue"),func, HCHAN_B, 
show_current, current_value);
+       bar_pane_histogram_add_radio(submenu, parent, _("_RGB"),func, 
HCHAN_RGB, show_current, current_value);
+       bar_pane_histogram_add_radio(submenu, parent, _("_Value"),func, 
HCHAN_MAX, show_current, current_value);
 
        if (menu)
                {
@@ -225,7 +233,7 @@
        return submenu;
 }
 GtkWidget *bar_pane_histogram_add_logmode(GtkWidget *menu, GCallback func, 
gpointer data,
-                                          gboolean show_current, gint value)
+                                          gboolean show_current, gint 
current_value)
 {
        GtkWidget *submenu;
        GtkWidget *parent;
@@ -233,8 +241,8 @@
        submenu = gtk_menu_new();
        g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
 
-       parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Linear"), 
func, 0, show_current, value);
-       bar_pane_histogram_add_radio(submenu, parent, _("Lo_garithmical"), 
func, 1, show_current, value);
+       parent = bar_pane_histogram_add_radio(submenu, NULL, _("_Linear"), 
func, 0, show_current, current_value);
+       bar_pane_histogram_add_radio(submenu, parent, _("Lo_garithmical"), 
func, 1, show_current, current_value);
 
        if (menu)
                {
@@ -252,7 +260,7 @@
 static GtkWidget *bar_pane_histogram_menu(PaneHistogramData *phd)
 {
        GtkWidget *menu;
-       static gboolean show_current = FALSE; /* FIXME: TRUE -> buggy behavior 
*/
+       static gboolean show_current = TRUE;
 
        menu = popup_menu_short_lived();
        bar_pane_histogram_add_channels(menu, 
G_CALLBACK(bar_pane_histogram_popup_channels_cb), phd,


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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to