[gnumeric] fix crash on accept menu



commit 12194c2f8ba5deac9ff06f52dbc848609fe9a03e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Aug 4 15:25:18 2011 -0600

    fix crash on accept menu
    
    2011-08-04 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/wbc-gtk.c (cb_accept_input_menu): check that we are editing

 ChangeLog     |    4 ++++
 src/wbc-gtk.c |   27 ++++++++++++++++-----------
 2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 72230b2..620d770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/wbc-gtk.c (cb_accept_input_menu): check that we are editing
+
 2011-08-04  Jean Brefort  <jean brefort normalesup org>
 
 	* src/graph.c (gnm_go_data_scalar_get_markup),
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 7f08d9f..8539d12 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2119,8 +2119,7 @@ static void
 cb_accept_input_menu (GtkMenuToolButton *button, WBCGtk *wbcg)
 {
 	GtkWidget *menu = gtk_menu_tool_button_get_menu (button);
-	GList     *l, *children
-		= gtk_container_get_children (GTK_CONTAINER (menu));
+	GList     *l, *children = gtk_container_get_children (GTK_CONTAINER (menu));
 
 	struct AcceptInputMenu {
 		gchar const *text;
@@ -2160,11 +2159,14 @@ cb_accept_input_menu (GtkMenuToolButton *button, WBCGtk *wbcg)
 						(G_OBJECT (item), "activate",
 						 G_CALLBACK (it->function),
 						 wbcg);
-				if (it->sensitive)
-					gtk_widget_set_sensitive
-						(item, (it->sensitive) (wbcg));
-				else
-					gtk_widget_set_sensitive (item, TRUE);
+				if (wbcg->editing_sheet) {
+					if (it->sensitive)
+						gtk_widget_set_sensitive
+							(item, (it->sensitive) (wbcg));
+					else
+						gtk_widget_set_sensitive (item, TRUE);
+				} else 
+					gtk_widget_set_sensitive (item, FALSE);
 			} else
 				item = gtk_separator_menu_item_new ();
 			gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -2175,13 +2177,16 @@ cb_accept_input_menu (GtkMenuToolButton *button, WBCGtk *wbcg)
 		     ui < G_N_ELEMENTS (accept_input_actions) && l != NULL;
 		     ui++, l = l->next) {
 			it = accept_input_actions + ui;
-			if (it->sensitive)
-				gtk_widget_set_sensitive
-					(GTK_WIDGET (l->data),
-					 (it->sensitive) (wbcg));
+			if (wbcg->editing_sheet) {
+				if (it->sensitive)
+					gtk_widget_set_sensitive
+						(GTK_WIDGET (l->data),
+						 (it->sensitive) (wbcg));
 				else
 					gtk_widget_set_sensitive
 						(GTK_WIDGET (l->data), TRUE);
+			} else 
+					gtk_widget_set_sensitive (l->data, FALSE);
 		}
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]