gnumeric r16904 - in trunk: . src/dialogs



Author: guelzow
Date: Mon Oct 20 02:31:54 2008
New Revision: 16904
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16904&view=rev

Log:
2008-10-19  Andreas J. Guelzow <aguelzow pyrshep ca>

	* sheet-order.glade: redesigned for instant-apply
	* dialog-sheet-order.c (SheetManager): new fields
	(cb_color_changed_fore): apply immediately
	(cb_color_changed_back): apply immediately
	(cb_toggled_lock): apply immediately
	(cb_toggled_direction): apply immediately
	(cb_toggled_visible): apply immediately
	(cb_add_clicked): apply immediately
	(cb_delete_clicked): apply immediately
	(cb_selection_changed): handle changed buttons
	(create_sheet_list): new
	(set_sheet_info_at_iter): new
	(populate_sheet_list): split out create_sheet_list and
	  set_sheet_info_at_iter
	(cb_append_clicked): new
	(verify_validity): remove unused flags and reduce to checking 
	  names
	(cb_apply_names_clicked): new
	(cb_ok_clicked): deleted
	(cb_sheet_order_destroy): adjust for changed fields
	(dialog_sheet_order_update_sheet_order): ditto
	(cb_sheet_order_changed): we always want to update the dialog
	(dialog_sheet_order_changed): new
	(cb_dialog_order_changed): new
	(dialog_sheet_order_changed_idle_handler): we need to use this
	  idle handler to wait for the liststore to be completed. The
	  signal arrives too early
	(cb_dialog_order_changed_by_insertion): new
	(dialog_sheet_order): handle new buttons




Modified:
   trunk/NEWS
   trunk/src/dialogs/ChangeLog
   trunk/src/dialogs/dialog-sheet-order.c
   trunk/src/dialogs/sheet-order.glade

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Oct 20 02:31:54 2008
@@ -1,5 +1,8 @@
 Gnumeric 1.9.4
 
+Andreas:
+	* Change sheet manage dialog into an instant-apply dialog	
+
 Jody:
 	* Display top-left when selecting a rel ref to a merged region.
 

Modified: trunk/src/dialogs/dialog-sheet-order.c
==============================================================================
--- trunk/src/dialogs/dialog-sheet-order.c	(original)
+++ trunk/src/dialogs/dialog-sheet-order.c	Mon Oct 20 02:31:54 2008
@@ -65,9 +65,13 @@
 	GtkWidget *up_btn;
 	GtkWidget *down_btn;
 	GtkWidget *add_btn;
+	GtkWidget *append_btn;
 	GtkWidget *duplicate_btn;
 	GtkWidget *delete_btn;
-	GtkWidget *ok_btn;
+	GtkWidget *apply_names_btn;
+	GtkWidget *sort_asc_btn;
+	GtkWidget *sort_desc_btn;
+	GtkWidget *undo_btn;
 	GtkWidget *cancel_btn;
 	GtkWidget *ccombo_back;
 	GtkWidget *ccombo_fore;
@@ -81,9 +85,10 @@
 	GdkPixbuf *image_visible;
 
 	gboolean initial_colors_set;
-	GSList *old_order;
 
 	gulong sheet_order_changed_listener;
+	gulong model_selection_changed_listener;
+	gulong model_row_insertion_listener;
 } SheetManager;
 
 enum {
@@ -94,8 +99,6 @@
 	SHEET_NAME,
 	SHEET_NEW_NAME,
 	SHEET_POINTER,
-	IS_EDITABLE_COLUMN,
-	IS_DELETED,
 	BACKGROUND_COLOUR,
 	FOREGROUND_COLOUR,
 	SHEET_DIRECTION,
@@ -125,6 +128,14 @@
 	gtk_tree_path_free (path);
 }
 
+static gboolean
+color_equal (const GdkColor *color_a, const GnmColor *color_gb)
+{
+	if (color_gb == NULL)
+		return color_a == NULL;
+	return color_a && gdk_color_equal (color_a, &color_gb->gdk_color);
+}
+
 static void
 cb_color_changed_fore (G_GNUC_UNUSED GOComboColor *go_combo_color,
 		       GOColor color, G_GNUC_UNUSED gboolean custom,
@@ -134,13 +145,40 @@
 {
 	GtkTreeIter sel_iter;
 	GtkTreeSelection  *selection = gtk_tree_view_get_selection (state->sheet_list);
-	GdkColor tmp;
 
-	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter))
+	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
+		GdkColor gdk_color;
+		GdkColor *p_gdk_color;
+		GnmColor *gnm_color;
+		Sheet *this_sheet;
+		WorkbookControl *wbc;
+		Workbook *wb;
+		WorkbookSheetState *old_state;
+	
+		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &sel_iter,
+				    SHEET_POINTER, &this_sheet,
+				    -1);
+		
+		p_gdk_color = (color == 0) ? NULL : go_color_to_gdk (color, &gdk_color);
+
+		if (color_equal (p_gdk_color, this_sheet->tab_text_color))
+			return;
+
 		gtk_list_store_set (state->model, &sel_iter,
-				    FOREGROUND_COLOUR,
-				    (color == 0) ? NULL : go_color_to_gdk (color, &tmp),
+				    FOREGROUND_COLOUR, p_gdk_color,
 				    -1);
+		gnm_color = (color == 0) ? NULL : style_color_new_gdk (&gdk_color);
+
+		wbc = WORKBOOK_CONTROL (state->wbcg);
+		wb = wb_control_get_workbook (wbc);
+		old_state = workbook_sheet_state_new (wb);
+		g_object_set (this_sheet,
+			      "tab-foreground", gnm_color,
+			      NULL);
+		style_color_unref (gnm_color);
+
+		cmd_reorganize_sheets (wbc, old_state, this_sheet);
+	}
 }
 
 static void
@@ -152,13 +190,40 @@
 {
 	GtkTreeIter sel_iter;
 	GtkTreeSelection  *selection = gtk_tree_view_get_selection (state->sheet_list);
-	GdkColor tmp;
 
-	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter))
+	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
+		GdkColor gdk_color;
+		GdkColor *p_gdk_color;
+		GnmColor *gnm_color;
+		Sheet *this_sheet;
+		WorkbookControl *wbc;
+		Workbook *wb;
+		WorkbookSheetState *old_state;
+	
+		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &sel_iter,
+				    SHEET_POINTER, &this_sheet,
+				    -1);
+		
+		p_gdk_color = (color == 0) ? NULL : go_color_to_gdk (color, &gdk_color);
+
+		if (color_equal (p_gdk_color, this_sheet->tab_color))
+			return;
+
 		gtk_list_store_set (state->model, &sel_iter,
-				    BACKGROUND_COLOUR,
-				    (color == 0) ? NULL : go_color_to_gdk (color, &tmp),
+				    BACKGROUND_COLOUR, p_gdk_color,
 				    -1);
+		gnm_color = (color == 0) ? NULL : style_color_new_gdk (&gdk_color);
+
+		wbc = WORKBOOK_CONTROL (state->wbcg);
+		wb = wb_control_get_workbook (wbc);
+		old_state = workbook_sheet_state_new (wb);
+		g_object_set (this_sheet,
+			      "tab-background", gnm_color,
+			      NULL);
+		style_color_unref (gnm_color);
+
+		cmd_reorganize_sheets (wbc, old_state, this_sheet);
+	}
 }
 
 /**
@@ -171,12 +236,10 @@
 {
 	GtkTreeIter  it, iter;
 	Sheet *sheet;
-	gboolean is_deleted;
 	gboolean has_iter;
 	GdkColor *fore, *back;
 	GtkTreeSelection *selection = gtk_tree_view_get_selection (state->sheet_list);
 
-	gtk_widget_set_sensitive (state->add_btn, TRUE);
 	gtk_widget_set_sensitive (state->duplicate_btn, FALSE);
 
 	if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
@@ -185,11 +248,11 @@
 		gtk_widget_set_sensitive (state->delete_btn, FALSE);
 		gtk_widget_set_sensitive (state->ccombo_back, FALSE);
 		gtk_widget_set_sensitive (state->ccombo_fore, FALSE);
+		gtk_widget_set_sensitive (state->add_btn, FALSE);
 		return;
 	}
 
 	gtk_tree_model_get (GTK_TREE_MODEL (state->model), &iter,
-			    IS_DELETED, &is_deleted,
 			    SHEET_POINTER, &sheet,
 			    BACKGROUND_COLOUR, &back,
 			    FOREGROUND_COLOUR, &fore,
@@ -207,9 +270,7 @@
 	gtk_widget_set_sensitive (state->ccombo_back, TRUE);
 	gtk_widget_set_sensitive (state->ccombo_fore, TRUE);
 	gtk_widget_set_sensitive (state->delete_btn, TRUE);
-	gtk_button_set_label (GTK_BUTTON (state->delete_btn),
-                              is_deleted ? GTK_STOCK_UNDELETE : GTK_STOCK_DELETE);
-	gtk_button_set_alignment (GTK_BUTTON (state->delete_btn), 0., .5);
+	gtk_widget_set_sensitive (state->add_btn, TRUE);
 
 	has_iter = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (state->model), &iter);
 	g_return_if_fail (has_iter);
@@ -236,12 +297,19 @@
 	GtkTreeModel *model = GTK_TREE_MODEL (state->model);
 	GtkTreeIter iter;
 	GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
-	gboolean value;
+	gboolean is_locked;
+	Sheet *this_sheet;
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
 
 	if (gtk_tree_model_get_iter (model, &iter, path)) {
-		gtk_tree_model_get (model, &iter, SHEET_LOCKED, &value, -1);
+		gtk_tree_model_get (model, &iter, 
+				    SHEET_LOCKED, &is_locked, 
+				    SHEET_POINTER, &this_sheet,
+				    -1);
 
-		if (value) {
+		if (is_locked) {
 			gtk_list_store_set 
 				(GTK_LIST_STORE (model), &iter, SHEET_LOCKED,
 				 FALSE, SHEET_LOCK_IMAGE, 
@@ -256,6 +324,12 @@
 		g_warning ("Did not get a valid iterator");
 	}
 	gtk_tree_path_free (path);
+
+	old_state = workbook_sheet_state_new (wb);
+	g_object_set (this_sheet,
+		      "protected", !is_locked,
+		      NULL);
+	cmd_reorganize_sheets (wbc, old_state, this_sheet);
 }
 
 static void
@@ -266,21 +340,34 @@
 	GtkTreeModel *model = GTK_TREE_MODEL (state->model);
 	GtkTreePath  *path  = gtk_tree_path_new_from_string (path_string);
 	GtkTreeIter iter;
-	gboolean value;
+	gboolean is_rtl;
+	Sheet *this_sheet;
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
 
 	if (gtk_tree_model_get_iter (model, &iter, path)) {
-		gtk_tree_model_get (model, &iter, SHEET_DIRECTION, &value, -1);
+		gtk_tree_model_get (model, &iter, 
+				    SHEET_DIRECTION, &is_rtl, 
+				    SHEET_POINTER, &this_sheet,
+				    -1);
 		gtk_list_store_set 
 			(GTK_LIST_STORE (model), &iter,
-			 SHEET_DIRECTION,	!value,
+			 SHEET_DIRECTION,	!is_rtl,
 			 SHEET_DIRECTION_IMAGE,	
-			 value ? state->image_ltr : state->image_rtl,
+			 is_rtl ? state->image_ltr : state->image_rtl,
 			 -1);
 	} else {
 		g_warning ("Did not get a valid iterator");
 	}
 
 	gtk_tree_path_free (path);
+
+	old_state = workbook_sheet_state_new (wb);
+	g_object_set (this_sheet,
+		      "text-is-rtl", !is_rtl,
+		      NULL);
+	cmd_reorganize_sheets (wbc, old_state, this_sheet);
 }
 
 static void
@@ -292,12 +379,21 @@
 	GtkTreeModel *model = GTK_TREE_MODEL (state->model);
 	GtkTreeIter iter;
 	GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
-	gboolean value;
+	gboolean is_visible;
+	Sheet *this_sheet;
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
+
+	/* FIXME: _("At least one sheet must remain visible!") */
 
 	if (gtk_tree_model_get_iter (model, &iter, path)) {
-		gtk_tree_model_get (model, &iter, SHEET_VISIBLE, &value, -1);
+		gtk_tree_model_get (model, &iter, 
+				    SHEET_VISIBLE, &is_visible, 
+				    SHEET_POINTER, &this_sheet,
+				    -1);
 		
-		if (value) {
+		if (is_visible) {
 			gtk_list_store_set (GTK_LIST_STORE (model), &iter,
 					    SHEET_VISIBLE, FALSE,
 					    SHEET_VISIBLE_IMAGE, NULL,
@@ -314,22 +410,24 @@
 		g_warning ("Did not get a valid iterator");
 	}
 	gtk_tree_path_free (path);
+
+	old_state = workbook_sheet_state_new (wb);
+	g_object_set (this_sheet,
+		      "visibility", 
+		      !is_visible ? GNM_SHEET_VISIBILITY_VISIBLE 
+		      : GNM_SHEET_VISIBILITY_HIDDEN,
+		      NULL);
+
+	cmd_reorganize_sheets (wbc, old_state, this_sheet);
 }
 
-/* Add all of the sheets to the sheet_list */
 static void
-populate_sheet_list (SheetManager *state)
+create_sheet_list (SheetManager *state)
 {
 	GtkTreeViewColumn *column;
 	GtkTreeSelection  *selection;
-	GtkTreeIter iter;
 	GtkWidget *scrolled = glade_xml_get_widget (state->gui, "scrolled");
-	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
-	Workbook *wb = wb_control_get_workbook (wbc);
-	Sheet *cur_sheet = wb_control_cur_sheet (wbc);
-	int i, n = workbook_sheet_count (wb);
 	GtkCellRenderer *renderer;
-	GtkTreePath *sel_path = NULL;
 
 	state->model = gtk_list_store_new (NUM_COLMNS,
 					   G_TYPE_BOOLEAN,
@@ -339,8 +437,6 @@
 					   G_TYPE_STRING,
 					   G_TYPE_STRING,
 					   G_TYPE_POINTER,
-					   G_TYPE_BOOLEAN,
-					   G_TYPE_BOOLEAN,
 					   GDK_TYPE_COLOR,
 					   GDK_TYPE_COLOR,
 					   G_TYPE_BOOLEAN,
@@ -349,45 +445,6 @@
 					   (GTK_TREE_MODEL (state->model)));
 	selection = gtk_tree_view_get_selection (state->sheet_list);
 	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
-	for (i = 0 ; i < n ; i++) {
-		Sheet *sheet = workbook_sheet_by_index (wb, i);
-		GdkColor *color = NULL;
-		GdkColor *text_color = NULL;
-
-		if (sheet->tab_color)
-			color = &sheet->tab_color->gdk_color;
-		if (sheet->tab_text_color)
-			text_color = &sheet->tab_text_color->gdk_color;
-
-		gtk_list_store_append (state->model, &iter);
-		gtk_list_store_set (state->model, &iter,
-				    SHEET_LOCKED, sheet->is_protected,
-				    SHEET_LOCK_IMAGE, (sheet->is_protected
-						       ? state->image_padlock
-						       : state->image_padlock_no),
-				    SHEET_VISIBLE, (sheet->visibility == GNM_SHEET_VISIBILITY_VISIBLE),
-				    SHEET_VISIBLE_IMAGE, (sheet->visibility == GNM_SHEET_VISIBILITY_VISIBLE
-							  ? state->image_visible
-							  : NULL),
-				    SHEET_NAME, sheet->name_unquoted,
-				    SHEET_NEW_NAME, "",
-				    SHEET_POINTER, sheet,
-				    IS_EDITABLE_COLUMN,	TRUE,
-				    IS_DELETED,	FALSE,
-				    BACKGROUND_COLOUR, color,
-				    FOREGROUND_COLOUR, text_color,
-				    SHEET_DIRECTION, sheet->text_is_rtl,
-				    SHEET_DIRECTION_IMAGE, (sheet->text_is_rtl
-							    ? state->image_rtl
-							    : state->image_ltr),
-				    -1);
-		if (sheet == cur_sheet)
-			sel_path = gtk_tree_model_get_path (GTK_TREE_MODEL (state->model),
-							    &iter);
-		state->old_order = g_slist_prepend (state->old_order, sheet);
-	}
-
-	state->old_order = g_slist_reverse (state->old_order);
 
 	renderer = gnumeric_cell_renderer_toggle_new ();
 	g_signal_connect (G_OBJECT (renderer),
@@ -430,18 +487,19 @@
 	column = gtk_tree_view_column_new_with_attributes (_("Current Name"),
 					      gnumeric_cell_renderer_text_new (),
 					      "text", SHEET_NAME,
-					      "strikethrough", IS_DELETED,
 					      "background_gdk",BACKGROUND_COLOUR,
 					      "foreground_gdk",FOREGROUND_COLOUR,
 					      NULL);
 	gtk_tree_view_append_column (state->sheet_list, column);
 
 	renderer = gnumeric_cell_renderer_text_new ();
+	g_object_set (G_OBJECT (renderer),
+		      "editable", TRUE,
+		      "editable-set", TRUE,
+		      NULL);
 	column = gtk_tree_view_column_new_with_attributes (_("New Name"),
 					      renderer,
 					      "text", SHEET_NEW_NAME,
-					      "editable", IS_EDITABLE_COLUMN,
-					      "strikethrough", IS_DELETED,
 					      "background_gdk",BACKGROUND_COLOUR,
 					      "foreground_gdk",FOREGROUND_COLOUR,
 					      NULL);
@@ -452,17 +510,90 @@
 	gtk_tree_view_set_reorderable (state->sheet_list, TRUE);
 
 	/* Init the buttons & selection */
-	cb_selection_changed (NULL, state);
-	g_signal_connect (selection,
-		"changed",
-		G_CALLBACK (cb_selection_changed), state);
+	state->model_selection_changed_listener = 
+		g_signal_connect (selection,
+				  "changed",
+				  G_CALLBACK (cb_selection_changed), state);
+
+	gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (state->sheet_list));
+}
+
+static void
+set_sheet_info_at_iter (SheetManager *state, GtkTreeIter *iter, Sheet *sheet)
+{
+	GdkColor *color = NULL;
+	GdkColor *text_color = NULL;
+
+	if (sheet->tab_color)
+		color = &sheet->tab_color->gdk_color;
+	if (sheet->tab_text_color)
+		text_color = &sheet->tab_text_color->gdk_color;
+
+	gtk_list_store_set (state->model, iter,
+			    SHEET_LOCKED, sheet->is_protected,
+			    SHEET_LOCK_IMAGE, (sheet->is_protected
+					       ? state->image_padlock
+					       : state->image_padlock_no),
+			    SHEET_VISIBLE, (sheet->visibility == GNM_SHEET_VISIBILITY_VISIBLE),
+			    SHEET_VISIBLE_IMAGE, (sheet->visibility == GNM_SHEET_VISIBILITY_VISIBLE
+						  ? state->image_visible
+						  : NULL),
+			    SHEET_NAME, sheet->name_unquoted,
+			    SHEET_NEW_NAME, "",
+			    SHEET_POINTER, sheet,
+			    BACKGROUND_COLOUR, color,
+			    FOREGROUND_COLOUR, text_color,
+			    SHEET_DIRECTION, sheet->text_is_rtl,
+			    SHEET_DIRECTION_IMAGE, (sheet->text_is_rtl
+						    ? state->image_rtl
+						    : state->image_ltr),
+			    -1);
+	
+
+}
+
+/* Add all of the sheets to the sheet_list */
+static void
+populate_sheet_list (SheetManager *state)
+{
+	GtkTreeSelection  *selection;
+	GtkTreeIter iter;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
+	Sheet *cur_sheet = wb_control_cur_sheet (wbc);
+	int i, n = workbook_sheet_count (wb);
+	GtkTreePath *sel_path = NULL;
+
+	selection = gtk_tree_view_get_selection (state->sheet_list);
+
+	g_signal_handler_block (selection, state->model_selection_changed_listener);
+	if (state->model_row_insertion_listener)
+		g_signal_handler_block (state->model, state->model_row_insertion_listener);
+
+	gtk_list_store_clear (state->model);
+
+	for (i = 0 ; i < n ; i++) {
+		Sheet *sheet = workbook_sheet_by_index (wb, i);
+
+		gtk_list_store_append (state->model, &iter);
+		set_sheet_info_at_iter (state, &iter, sheet);
+
+		if (sheet == cur_sheet)
+			sel_path = gtk_tree_model_get_path (GTK_TREE_MODEL (state->model),
+							    &iter);
+	}
 
 	if (sel_path) {
 		gtk_tree_selection_select_path (selection, sel_path);
 		gtk_tree_path_free (sel_path);
 	}
 
-	gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (state->sheet_list));
+	if (state->model_row_insertion_listener)
+		g_signal_handler_unblock (state->model, state->model_row_insertion_listener);
+	g_signal_handler_unblock (selection, state->model_selection_changed_listener);	
+
+	/* Init the buttons & selection */
+	cb_selection_changed (NULL, state);
 }
 
 static void
@@ -500,62 +631,73 @@
 static void
 cb_add_clicked (G_GNUC_UNUSED GtkWidget *ignore, SheetManager *state)
 {
-	GtkTreeIter iter;
-	GtkTreeIter sel_iter;
-	GtkTreeIter this_iter;
+	GtkTreeIter sel_iter, iter;
 	GtkTreeSelection  *selection = gtk_tree_view_get_selection (state->sheet_list);
-	int i = 0;
-	char *name;
+	int index = -1;
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
+	Sheet *sheet;
+
+	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
+		Sheet *this_sheet;
+
+		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &sel_iter, 
+				    SHEET_POINTER, &this_sheet,
+				    -1);
+		index = this_sheet->index_in_wb;
+	}
+
+	g_signal_handler_block (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
+
+	old_state = workbook_sheet_state_new (wb);
+	workbook_sheet_add (wb, index);
+	cmd_reorganize_sheets (wbc, old_state, NULL);
+
+	g_signal_handler_unblock (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
 
-	if (!gtk_tree_selection_get_selected (selection, NULL, &sel_iter))
+	g_signal_handler_block (state->model, state->model_row_insertion_listener);
+	if (index == -1) {
+		sheet = workbook_sheet_by_index (wb, workbook_sheet_count (wb) - 1);
 		gtk_list_store_append (state->model, &iter);
-	else
+	} else {
+		sheet = workbook_sheet_by_index (wb, index);
 		gtk_list_store_insert_before (state->model, &iter, &sel_iter);
+	}
+	g_signal_handler_unblock (state->model, state->model_row_insertion_listener);
 
-	/* We can't use workbook_sheet_get_free_name since that would give us the same */
-	/* name for multiple adds */
+	set_sheet_info_at_iter (state, &iter, sheet);
+	
+}
 
-	name = g_new (char, strlen (_("Sheet%d")) + 12);
-	for ( ; ++i ; ){
-		int n = 0;
-		gboolean match = FALSE;
-		sprintf (name, _("Sheet%d"), i);
-		while (gtk_tree_model_iter_nth_child  (GTK_TREE_MODEL (state->model),
-						       &this_iter, NULL, n)) {
-			char *old_name, *new_name;
-
-			gtk_tree_model_get (GTK_TREE_MODEL (state->model), &this_iter,
-					    SHEET_NAME, &old_name,
-					    SHEET_NEW_NAME, &new_name,
-					    -1);
-			n++;
-			match = (new_name != NULL && !strcmp (name, new_name)) ||
-				(old_name != NULL && !strcmp (name, old_name));
-			g_free (old_name);
-			g_free (new_name);
-			if (match)
-				break;
-		}
-		if (!match)
-			break;
-	}
-	gtk_list_store_set (state->model, &iter,
-			    SHEET_LOCKED, FALSE,
-			    SHEET_LOCK_IMAGE, state->image_padlock_no,
-			    SHEET_VISIBLE, TRUE,
-			    SHEET_VISIBLE_IMAGE, state->image_visible,
-			    SHEET_NAME, "",
-			    SHEET_NEW_NAME, name,
-			    SHEET_POINTER, NULL,
-			    IS_EDITABLE_COLUMN,	TRUE,
-			    IS_DELETED,	FALSE,
-			    BACKGROUND_COLOUR, NULL,
-			    FOREGROUND_COLOUR, NULL,
-			    SHEET_DIRECTION, FALSE,
-			    SHEET_DIRECTION_IMAGE, state->image_ltr,
-			    -1);
-	gtk_tree_selection_select_iter (selection, &iter);
-	g_free (name);
+static void
+cb_append_clicked (G_GNUC_UNUSED GtkWidget *ignore, SheetManager *state)
+{
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
+	GtkTreeIter iter;
+	Sheet *sheet;
+
+	g_signal_handler_block (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
+
+	old_state = workbook_sheet_state_new (wb);
+	workbook_sheet_add (wb, -1);
+	cmd_reorganize_sheets (wbc, old_state, NULL);
+
+	g_signal_handler_unblock (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
+
+	sheet = workbook_sheet_by_index (wb, workbook_sheet_count (wb) - 1);
+	
+	g_signal_handler_block (state->model, state->model_row_insertion_listener);
+	gtk_list_store_append (state->model, &iter);
+	g_signal_handler_unblock (state->model, state->model_row_insertion_listener);
+	
+	set_sheet_info_at_iter (state, &iter, sheet);
 }
 
 static void
@@ -573,28 +715,25 @@
 	GtkTreeIter sel_iter;
 	GtkTreeSelection  *selection = gtk_tree_view_get_selection (state->sheet_list);
 	Sheet *sheet;
-	gboolean is_deleted;
+	WorkbookSheetState *old_state;
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
 
 	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
 		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &sel_iter,
 				    SHEET_POINTER, &sheet,
-				    IS_DELETED, &is_deleted,
 				    -1);
-		if (is_deleted) {
-			gtk_list_store_set (state->model, &sel_iter,
-					    IS_DELETED,	FALSE,
-					    IS_EDITABLE_COLUMN, TRUE,
-					    -1);
-		} else {
-			if (sheet == NULL) {
-				gtk_list_store_remove (state->model, &sel_iter);
-			} else {
-				gtk_list_store_set (state->model, &sel_iter,
-						    IS_DELETED,	TRUE,
-						    IS_EDITABLE_COLUMN, FALSE,
-						    -1);
-			}
-		}
+		gtk_list_store_remove (state->model, &sel_iter);
+		g_signal_handler_block (G_OBJECT (wb),
+					state->sheet_order_changed_listener);
+		
+		old_state = workbook_sheet_state_new (wb);
+		workbook_sheet_delete (sheet);
+		cmd_reorganize_sheets (wbc, old_state, NULL);
+
+		g_signal_handler_unblock (G_OBJECT (wb),
+					  state->sheet_order_changed_listener);
+		
 		cb_selection_changed (NULL, state);
 	}
 }
@@ -606,91 +745,44 @@
 	    gtk_widget_destroy (GTK_WIDGET (state->dialog));
 }
 
-static gboolean
-color_equal (const GdkColor *color_a, const GnmColor *color_gb)
-{
-	if (color_gb == NULL)
-		return color_a == NULL;
-	return color_a && gdk_color_equal (color_a, &color_gb->gdk_color);
-}
-
 static char *
 verify_validity (SheetManager *state, gboolean *pchanged)
 {
 	char *result = NULL;
-	gboolean has_visible = FALSE;
 	gboolean changed = FALSE;
 	GHashTable *names = g_hash_table_new_full (g_str_hash, g_str_equal,
 						   (GDestroyNotify)g_free, NULL);
 	GtkTreeIter this_iter;
-	gint n = 0, i = 0;
+	gint n = 0;
 
 	while (result == NULL &&
 	       gtk_tree_model_iter_nth_child  (GTK_TREE_MODEL (state->model),
 					       &this_iter, NULL, n)) {
-		gboolean is_deleted, is_locked, is_visible, is_rtl;
 		Sheet *this_sheet;
-		char *old_name, *new_name;
-		GdkColor *back, *fore;
+		char *old_name, *new_name, *new_name2;
 
 		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &this_iter,
-				    SHEET_LOCKED, &is_locked,
-				    SHEET_VISIBLE, &is_visible,
 				    SHEET_POINTER, &this_sheet,
 				    SHEET_NAME, &old_name,
 				    SHEET_NEW_NAME, &new_name,
-				    IS_DELETED, &is_deleted,
-				    BACKGROUND_COLOUR, &back,
-				    FOREGROUND_COLOUR, &fore,
-				    SHEET_DIRECTION, &is_rtl,
 				    -1);
 
-		if (is_deleted)
-			changed = TRUE;
-		else {
-			if (!this_sheet && *new_name == 0)
-				result = g_strdup (_("New sheets must be given a name."));
-			else {
-				char *new_name2 =
-					g_utf8_casefold (*new_name != 0 ? new_name : old_name, -1);
-				if (g_hash_table_lookup (names, new_name2)) {
-					result = g_strdup_printf (_("There is more than one sheet named \"%s\""),
-								  new_name);
-					g_free (new_name2);
-				} else
-					g_hash_table_insert (names, new_name2, new_name2);
-			}
-
-			if (is_visible) has_visible = TRUE;
-
-			if (this_sheet) {
-				if (is_locked != this_sheet->is_protected ||
-				    is_visible != sheet_is_visible (this_sheet) ||
-				    (*new_name && strcmp (old_name, new_name)) ||
-				    !color_equal (fore, this_sheet->tab_text_color) ||
-				    !color_equal (back, this_sheet->tab_color) ||
-				    is_rtl != this_sheet->text_is_rtl ||
-				    this_sheet->index_in_wb != i)
-					changed = TRUE;
-			} else {
-				/* A new sheet.  */
+		new_name2 = g_utf8_casefold (*new_name != 0 ? new_name : old_name, -1);
+		if (g_hash_table_lookup (names, new_name2)) {
+			result = g_strdup_printf (_("There is more than one sheet named \"%s\""),
+						  new_name);
+			g_free (new_name2);
+		} else
+			g_hash_table_insert (names, new_name2, new_name2);
+		
+		if (*new_name && strcmp (old_name, new_name))
 				changed = TRUE;
-			}
-
-			/* FIXME: What about deeply hidden sheets?  */
-			i++;
-		}
-
+		
 		g_free (old_name);
 		g_free (new_name);
-		if (fore) gdk_color_free (fore);
-		if (back) gdk_color_free (back);
 		n++;
 	}
 
-	if (result == NULL && !has_visible)
-		result = g_strdup (_("At least one sheet must remain visible!"));
-
 	g_hash_table_destroy (names);
 	*pchanged = changed;
 	return result;
@@ -698,16 +790,15 @@
 
 
 static void
-cb_ok_clicked (G_GNUC_UNUSED GtkWidget *ignore, SheetManager *state)
+cb_apply_names_clicked (G_GNUC_UNUSED GtkWidget *ignore, SheetManager *state)
 {
 	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
 	Workbook *wb = wb_control_get_workbook (wbc);
-	Sheet *cur_sheet;
 	char *error;
 	gboolean changed;
 	WorkbookSheetState *old_state;
 	GtkTreeIter this_iter;
-	gint n = 0, i = 0;
+	gint n = 0;
 
 	error = verify_validity (state, &changed);
 	if (error) {
@@ -717,80 +808,42 @@
 		return;
 	}
 
-	if (!changed) {
-		gtk_widget_destroy (GTK_WIDGET (state->dialog));
+	if (!changed)
 		return;
-	}
 
 	/* Stop listening to changes in the sheet order. */
-	g_signal_handler_disconnect (G_OBJECT (wb),
-				     state->sheet_order_changed_listener);
-	state->sheet_order_changed_listener = 0;
+	g_signal_handler_block (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
 
 	old_state = workbook_sheet_state_new (wb);
 	while (gtk_tree_model_iter_nth_child  (GTK_TREE_MODEL (state->model),
 					       &this_iter, NULL, n)) {
-		gboolean is_deleted, is_locked, is_visible, is_rtl;
 		Sheet *this_sheet;
-		char *old_name, *new_name;
-		GdkColor *back, *fore;
+		char *new_name;
 
 		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &this_iter,
-				    SHEET_LOCKED, &is_locked,
-				    SHEET_VISIBLE, &is_visible,
 				    SHEET_POINTER, &this_sheet,
-				    SHEET_NAME, &old_name,
 				    SHEET_NEW_NAME, &new_name,
-				    IS_DELETED, &is_deleted,
-				    BACKGROUND_COLOUR, &back,
-				    FOREGROUND_COLOUR, &fore,
-				    SHEET_DIRECTION, &is_rtl,
 				    -1);
 
-		if (is_deleted)
-			workbook_sheet_delete (this_sheet);
-		else {
-			GnmColor *gnmfore =
-				fore ? style_color_new_gdk (fore) : NULL;
-			GnmColor *gnmback =
-				back ? style_color_new_gdk (back) : NULL;
-
-			if (!this_sheet)
-				this_sheet = workbook_sheet_add (wb, i);
-
+		if (*new_name) {
 			g_object_set (this_sheet,
-				      "protected", is_locked,
-				      "visibility", is_visible ? GNM_SHEET_VISIBILITY_VISIBLE : GNM_SHEET_VISIBILITY_HIDDEN,
-				      "name", *new_name ? new_name : old_name,
-				      "tab-foreground", gnmfore,
-				      "tab-background", gnmback,
-				      "text-is-rtl", is_rtl,				      
+				      "name", new_name,
 				      NULL);
-
-			style_color_unref (gnmfore);
-			style_color_unref (gnmback);
-
-			if (this_sheet->index_in_wb != i)
-				workbook_sheet_move (this_sheet, i - this_sheet->index_in_wb);
-
-			/* FIXME: What about deeply hidden sheets?  */
-			i++;
+			gtk_list_store_set (state->model, &this_iter,
+					    SHEET_NAME, new_name,
+					    SHEET_NEW_NAME, "",
+					    -1);
 		}
-
-		g_free (old_name);
+		
 		g_free (new_name);
-		if (fore) gdk_color_free (fore);
-		if (back) gdk_color_free (back);
 		n++;
 	}
 	
-	cur_sheet  = wb_view_cur_sheet (wb_control_view (wbc));
-	if (!cur_sheet || cur_sheet->index_in_wb == -1)
-		wb_view_sheet_focus (wb_control_view (wbc), 
-				     workbook_sheet_by_index (wb, 0));
-
 	cmd_reorganize_sheets (wbc, old_state, NULL);
-	gtk_widget_destroy (GTK_WIDGET (state->dialog));
+
+	g_signal_handler_unblock (G_OBJECT (wb),
+				  state->sheet_order_changed_listener);
 }
 
 static void
@@ -826,9 +879,6 @@
 	g_object_unref (state->image_ltr);
 	state->image_ltr = NULL;
 
-	g_slist_free (state->old_order);
-	state->old_order = NULL;
-
 	g_free (state);
 }
 
@@ -836,8 +886,6 @@
 dialog_sheet_order_update_sheet_order (SheetManager *state)
 {
 	gchar *name, *new_name;
-	gboolean is_deleted;
-	gboolean is_editable;
 	gboolean is_locked;
 	gboolean is_visible;
 	gboolean is_rtl;
@@ -876,15 +924,15 @@
 			SHEET_VISIBLE, &is_visible,
 			SHEET_NAME, &name,
 			SHEET_NEW_NAME, &new_name,
-			IS_EDITABLE_COLUMN, &is_editable,
 			SHEET_POINTER, &sheet_model,
-			IS_DELETED, &is_deleted,
 			BACKGROUND_COLOUR, &back,
 			FOREGROUND_COLOUR, &fore,
 			SHEET_DIRECTION, &is_rtl,
 			-1);
 		gtk_list_store_remove (state->model, &iter);
+		g_signal_handler_block (state->model, state->model_row_insertion_listener);
 		gtk_list_store_insert (state->model, &iter, i);
+		g_signal_handler_unblock (state->model, state->model_row_insertion_listener);
 		gtk_list_store_set (state->model, &iter,
 				    SHEET_LOCKED, is_locked,
 				    SHEET_LOCK_IMAGE, is_locked ?
@@ -894,9 +942,7 @@
 				    state->image_visible : NULL,
 				    SHEET_NAME, name,
 				    SHEET_NEW_NAME, new_name,
-				    IS_EDITABLE_COLUMN, is_editable,
 				    SHEET_POINTER, sheet_model,
-				    IS_DELETED, is_deleted,
 				    BACKGROUND_COLOUR, back,
 				    FOREGROUND_COLOUR, fore,
 				    SHEET_DIRECTION, is_rtl,
@@ -913,80 +959,89 @@
 			gtk_tree_selection_select_iter (sel, &iter);
 	}
 
-	g_slist_free (state->old_order);
-	state->old_order = NULL;
-	for (i = 0; i < n_sheets; i++)
-		state->old_order = g_slist_append (state->old_order,
-					workbook_sheet_by_index (wb, i));
-
 	cb_selection_changed (NULL, state);
 }
 
 static void
 cb_sheet_order_changed (Workbook *wb, SheetManager *state)
 {
-	GtkTreeIter iter;
-	GtkTreeModel *model = GTK_TREE_MODEL (state->model);
-	guint i, n = 0;
-	Sheet *sheet;
+	dialog_sheet_order_update_sheet_order (state);
+}
 
-	/*
-	 * First question: Has the user already changed the order via
-	 * the dialog? If no, we assume that the user wants to see the
-	 * sheet order change reflected in the dialog.
-	 */
-	n = g_slist_length (state->old_order);
-	for (i = 0; i < n; i++) {
-		if (!gtk_tree_model_iter_nth_child (model, &iter, NULL, i))
-			break;
-		gtk_tree_model_get (model, &iter, SHEET_POINTER, &sheet, -1);
-		if (sheet != g_slist_nth_data (state->old_order, i))
-			break;
-	}
-	if (n == i) {
-		dialog_sheet_order_update_sheet_order (state);
-		return;
-	}
 
-	/*
-	 * The user has already changed the order via the dialog.
-	 * Let's check if the new sheet order is already reflected
-	 * in the dialog. If yes, things are easy.
-	 */
-	n = workbook_sheet_count (wb);
-	for (i = 0; i < n; i++) {
-		if (!gtk_tree_model_iter_nth_child (model, &iter, NULL, i))
-			break;
-		gtk_tree_model_get (model, &iter, SHEET_POINTER, &sheet, -1);
-		if (sheet != workbook_sheet_by_index (wb, i))
-			break;
-	}
-	if (i == n) {
-		g_slist_free (state->old_order);
-		state->old_order = NULL;
-		for (i = 0; i < n; i++)
-			state->old_order = g_slist_append (state->old_order,
-				workbook_sheet_by_index (wb, i));
-		return;
+
+static void                
+dialog_sheet_order_changed (SheetManager *state)
+{
+	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
+	Workbook *wb = wb_control_get_workbook (wbc);
+	WorkbookSheetState *old_state;
+	GtkTreeIter this_iter;
+	gint n = 0, changes = 0;
+
+	g_signal_handler_block (G_OBJECT (wb),
+				state->sheet_order_changed_listener);
+
+	old_state = workbook_sheet_state_new (wb);
+	while (gtk_tree_model_iter_nth_child  (GTK_TREE_MODEL (state->model),
+					       &this_iter, NULL, n)) {
+		Sheet *this_sheet;
+		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &this_iter,
+				    SHEET_POINTER, &this_sheet,
+				    -1);
+		if (this_sheet->index_in_wb != n) {
+			changes++;
+			workbook_sheet_move (this_sheet, n - this_sheet->index_in_wb);
+		}
+		n++;
 	}
 
-	/*
-	 * The order in the dialog and the new sheet order are totally
-	 * different. Ask the user what to do.
-	 */
-	if (go_gtk_query_yes_no (GTK_WINDOW (state->dialog),
-				 TRUE,
-				 _("The sheet order has changed. Do you want to "
-				   "update the list?")))
-		dialog_sheet_order_update_sheet_order (state);
+	if (changes > 0) 
+		cmd_reorganize_sheets (wbc, old_state, NULL);
+	else 
+		workbook_sheet_state_free (old_state);	
+
+	g_signal_handler_unblock (G_OBJECT (wb),
+				  state->sheet_order_changed_listener);
+}
+
+static void                
+cb_dialog_order_changed (G_GNUC_UNUSED GtkListStore *model,
+			 G_GNUC_UNUSED GtkTreePath  *path,
+			 G_GNUC_UNUSED GtkTreeIter  *iter,
+			 G_GNUC_UNUSED gpointer arg3,
+			 SheetManager *state)
+{
+	dialog_sheet_order_changed (state);
+}
+
+static gboolean
+dialog_sheet_order_changed_idle_handler (SheetManager *state)
+{
+	dialog_sheet_order_changed (state);
+	return FALSE;
 }
 
+
+static void                
+cb_dialog_order_changed_by_insertion (G_GNUC_UNUSED GtkListStore *model,
+			 G_GNUC_UNUSED GtkTreePath  *path,
+			 G_GNUC_UNUSED GtkTreeIter  *iter,
+			 SheetManager *state)
+{
+	g_idle_add_full (G_PRIORITY_HIGH_IDLE, 
+			 (GSourceFunc)dialog_sheet_order_changed_idle_handler, 
+			 state, NULL);
+}
+
+
+
 void
 dialog_sheet_order (WBCGtk *wbcg)
 {
 	SheetManager *state;
 	GladeXML *gui;
-	GtkBox *vbox;
+	GtkTable *table;
 	GOColorGroup *cg;
 	Workbook *wb;
 
@@ -1016,12 +1071,15 @@
 	state->up_btn     = glade_xml_get_widget (gui, "up_button");
 	state->down_btn   = glade_xml_get_widget (gui, "down_button");
 	state->add_btn   = glade_xml_get_widget (gui, "add_button");
+	state->append_btn   = glade_xml_get_widget (gui, "append_button");
 	state->duplicate_btn   = glade_xml_get_widget (gui, "duplicate_button");
 	state->delete_btn   = glade_xml_get_widget (gui, "delete_button");
 
-	state->ok_btn  = glade_xml_get_widget (gui, "ok_button");
+	state->apply_names_btn  = glade_xml_get_widget (gui, "ok_button");
+	state->sort_asc_btn  = glade_xml_get_widget (gui, "sort-asc-button");
+	state->sort_desc_btn  = glade_xml_get_widget (gui, "sort-desc-button");
+	state->undo_btn  = glade_xml_get_widget (gui, "undo-button");	
 	state->cancel_btn  = glade_xml_get_widget (gui, "cancel_button");
-	state->old_order  = NULL;
 	state->initial_colors_set = FALSE;
 	state->image_padlock =  gtk_widget_render_icon (state->dialog,
                                              "Gnumeric_Protection_Yes",
@@ -1048,12 +1106,7 @@
 		"sheet_order_changed", G_CALLBACK (cb_sheet_order_changed),
 		state);
 
-	gtk_button_set_alignment (GTK_BUTTON (state->up_btn),     0., .5);
-	gtk_button_set_alignment (GTK_BUTTON (state->down_btn),   0., .5);
-	gtk_button_set_alignment (GTK_BUTTON (state->add_btn),    0., .5);
-	gtk_button_set_alignment (GTK_BUTTON (state->delete_btn), 0., .5);
-
-	vbox = GTK_BOX (glade_xml_get_widget (gui,"sheet_order_buttons_vbox"));
+	table = GTK_TABLE (glade_xml_get_widget (gui,"sheet_order_buttons_table"));
 	cg = go_color_group_fetch ("back_color_group",
 		wb_control_view (WORKBOOK_CONTROL (wbcg)));
 	state->ccombo_back = go_combo_color_new (
@@ -1061,7 +1114,7 @@
 		_("Default"), 0, cg);
 	go_combo_color_set_instant_apply (
 		GO_COMBO_COLOR (state->ccombo_back), TRUE);
-	gtk_box_pack_start (vbox, state->ccombo_back, FALSE, FALSE, 0);
+	gtk_table_attach (table, state->ccombo_back, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
 	gtk_widget_set_sensitive (state->ccombo_back, FALSE);
 
 	cg = go_color_group_fetch ("fore_color_group",
@@ -1071,27 +1124,37 @@
 		_("Default"), 0, cg);
 	go_combo_color_set_instant_apply (
 		GO_COMBO_COLOR (state->ccombo_fore), TRUE);
-	gtk_box_pack_start (vbox, state->ccombo_fore, FALSE, FALSE, 0);
+	gtk_table_attach (table, state->ccombo_fore, 1, 2, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
 	gtk_widget_set_sensitive (state->ccombo_fore, FALSE);
 
+	create_sheet_list (state);
 	populate_sheet_list (state);
 
 #define CONNECT(o,s,c) g_signal_connect(G_OBJECT(o),s,G_CALLBACK(c),state)
 	CONNECT (state->up_btn, "clicked", cb_up);
 	CONNECT (state->down_btn, "clicked", cb_down);
 	CONNECT (state->add_btn, "clicked", cb_add_clicked);
+	CONNECT (state->append_btn, "clicked", cb_append_clicked);
 	CONNECT (state->duplicate_btn, "clicked", cb_duplicate_clicked);
 	CONNECT (state->delete_btn, "clicked", cb_delete_clicked);
-	CONNECT (state->ok_btn, "clicked", cb_ok_clicked);
+	CONNECT (state->apply_names_btn, "clicked", cb_apply_names_clicked);
 	CONNECT (state->cancel_btn, "clicked", cb_cancel_clicked);
 	CONNECT (state->ccombo_back, "color_changed", cb_color_changed_back);
 	CONNECT (state->ccombo_fore, "color_changed", cb_color_changed_fore);
+	CONNECT (state->model, "rows-reordered", cb_dialog_order_changed);
+	state->model_row_insertion_listener =
+		CONNECT (state->model, "row-inserted", cb_dialog_order_changed_by_insertion);
 #undef CONNECT
 
 	gnumeric_init_help_button (
 		glade_xml_get_widget (state->gui, "help_button"),
 		GNUMERIC_HELP_LINK_SHEET_MANAGER);
 
+	gtk_widget_set_sensitive (state->duplicate_btn, FALSE);
+	gtk_widget_set_sensitive (state->sort_asc_btn, FALSE);
+	gtk_widget_set_sensitive (state->sort_desc_btn, FALSE);
+	gtk_widget_set_sensitive (state->undo_btn, FALSE);
+
 	/* a candidate for merging into attach guru */
 	wbc_gtk_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
 	g_object_set_data_full (G_OBJECT (state->dialog),

Modified: trunk/src/dialogs/sheet-order.glade
==============================================================================
--- trunk/src/dialogs/sheet-order.glade	(original)
+++ trunk/src/dialogs/sheet-order.glade	Mon Oct 20 02:31:54 2008
@@ -1,212 +1,267 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
 <glade-interface>
-
-<widget class="GtkDialog" id="sheet-order-dialog">
-  <property name="border_width">12</property>
-  <property name="title" translatable="yes">Manage Sheets...</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_MOUSE</property>
-  <property name="modal">False</property>
-  <property name="default_width">500</property>
-  <property name="default_height">200</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="has_separator">False</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">6</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area1">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="help_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-help</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="cancel_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="ok_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkHBox" id="hbox1">
-	  <property name="border_width">5</property>
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">6</property>
-
-	  <child>
-	    <widget class="GtkScrolledWindow" id="scrolled">
-	      <property name="width_request">200</property>
-	      <property name="height_request">120</property>
-	      <property name="visible">True</property>
-	      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	      <property name="shadow_type">GTK_SHADOW_NONE</property>
-	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkVBox" id="sheet_order_buttons_vbox">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkButton" id="up_button">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label">gtk-go-up</property>
-		  <property name="use_stock">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkButton" id="down_button">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label">gtk-go-down</property>
-		  <property name="use_stock">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkButton" id="add_button">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label">gtk-add</property>
-		  <property name="use_stock">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkButton" id="duplicate_button">
-		  <property name="height_request">28</property>
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">_Duplicate</property>
-		  <property name="use_underline">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkButton" id="delete_button">
-		  <property name="width_request">90</property>
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label">gtk-undelete</property>
-		  <property name="use_stock">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		  <property name="focus_on_click">True</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	      <property name="pack_type">GTK_PACK_END</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+  <widget class="GtkDialog" id="sheet-order-dialog">
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Manage Sheets...</property>
+    <property name="window_position">GTK_WIN_POS_MOUSE</property>
+    <property name="default_width">500</property>
+    <property name="default_height">200</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <widget class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkScrolledWindow" id="scrolled">
+                <property name="width_request">250</property>
+                <property name="height_request">120</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkTable" id="sheet_order_buttons_table">
+                <property name="visible">True</property>
+                <property name="n_rows">7</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">3</property>
+                <property name="row_spacing">3</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="append_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="label" translatable="yes">A_ppend</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="duplicate_button">
+                    <property name="height_request">28</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label" translatable="yes">Du_plicate</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="delete_button">
+                    <property name="width_request">90</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label">gtk-remove</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="add_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label">_Insert</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="undo-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="label" translatable="yes">gtk-undo</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="ok_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="has_default">True</property>
+                    <property name="label">Apply _Name Changes</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHSeparator" id="hseparator1">
+                    <property name="visible">True</property>
+                  </widget>
+                  <packing>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="sort-desc-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="label" translatable="yes">gtk-sort-descending</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="sort-asc-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="label" translatable="yes">gtk-sort-ascending</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="down_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label">gtk-go-down</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="up_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label">gtk-go-up</property>
+                    <property name="use_stock">True</property>
+                    <property name="xalign">0</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="warning">
+            <property name="visible">True</property>
+          </widget>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="help_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-help</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancel_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>



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