+/**
+ * undo_set_undo:
+ *
+ * Change the sensivity of the menuentries undo and redo
+ **/
+static void compose_set_undo(UndoMain *undostruct, gint undo_state,
+ gint redo_state, GtkWidget *changewidget)
+{
+ GtkItemFactory *ifactory;
+
+ g_return_if_fail(changewidget != NULL);
+
+ debug_print("Set_undo. UNDO:%i REDO:%i\n", undo_state, redo_state);
+
+ ifactory = gtk_item_factory_from_widget(changewidget);
+
+ switch (undo_state) {
+ case UNDO_STATE_TRUE:
+ if (!undostruct->undo_state) {
+ debug_print ("Set_undo - Testpoint\n");
+ undostruct->undo_state = TRUE;
+ menu_set_sensitive(ifactory, "/Edit/Undo", TRUE);
+ }
+ break;
+ case UNDO_STATE_FALSE:
+ if (undostruct->undo_state) {
+ undostruct->undo_state = FALSE;
+ menu_set_sensitive(ifactory, "/Edit/Undo", FALSE);
+ }
+ break;
+ case UNDO_STATE_UNCHANGED:
+ break;
+ case UNDO_STATE_REFRESH:
+ menu_set_sensitive(ifactory, "/Edit/Undo",
+ undostruct->undo_state);
+ break;
+ default:
+ g_warning("Undo state not recognized");
+ break;
+ }
+
+ switch (redo_state) {
+ case UNDO_STATE_TRUE:
+ if (!undostruct->redo_state) {
+ undostruct->redo_state = TRUE;
+ menu_set_sensitive(ifactory, "/Edit/Redo", TRUE);
+ }
+ break;
+ case UNDO_STATE_FALSE:
+ if (undostruct->redo_state) {
+ undostruct->redo_state = FALSE;
+ menu_set_sensitive(ifactory, "/Edit/Redo", FALSE);
+ }
+ break;
+ case UNDO_STATE_UNCHANGED:
+ break;
+ case UNDO_STATE_REFRESH:
+ menu_set_sensitive(ifactory, "/Edit/Redo",
+ undostruct->redo_state);
+ break;
+ default:
+ g_warning("Redo state not recognized");
+ break;
+ }
+}
+