Commit 71a5435f authored by Gene Z. Ragan's avatar Gene Z. Ragan Committed by Gene Ragan

More undo framework work. Still incomplete.

2000-05-19  Gene Z. Ragan  <gzr@eazel.com>

	More undo framework work.  Still incomplete.

	* libnautilus-extensions/nautilus-entry.c:
	(nautilus_entry_changed):
	Modified to use new undo manager location API

	* libnautilus-extensions/nautilus-icon-text-item.c:
	(iti_event),
	(restore_from_undo_snapshot_callback):
	Modified to use new undo manager location API

	* libnautilus/nautilus-undo-manager.c:
	* libnautilus/nautilus-undo-manager.h:
	(impl_Nautilus_Undo_Manager__create),
	(impl_Nautilus_Undo_Manager__append),
	(impl_Nautilus_Undo_Manager__forget),
	(nautilus_undo_manager_begin_transaction),
	(nautilus_undo_manager_end_transaction),
	(nautilus_undo_manager_undo), (nautilus_undo_manager_redo),
	(nautilus_undo_manager_add_transaction),
	(nautilus_undo_manager_unregister_object),
	(free_undo_manager_list_data), (prune_undo_manager_list):
	Modified to use new API and Undo::Manager::Transaction

	* libnautilus/nautilus-undo-transaction.c:
	* libnautilus/nautilus-undo-transaction.h:
	(impl_Nautilus_Undo_Transaction__destroy),
	(impl_Nautilus_Undo_Transaction__create),
	(impl_Nautilus_Undo_Transaction__get_undo_description),
	(impl_Nautilus_Undo_Transaction__get_redo_description),
	(impl_Nautilus_Undo_Transaction__get_base_description),
	(impl_Nautilus_Undo_Transaction__undo),
	(nautilus_undo_transaction_new),
	(nautilus_undo_transaction_initialize),
	(nautilus_undo_transaction_destroy),
	(nautilus_undo_transaction_initialize_class),
	(nautilus_undo_transaction_undo),
	(nautilus_undo_transaction_contains_object):
	Added support for new Undo::Manager::Transaction object
parent 7fcaf4c2
2000-05-19 Gene Z. Ragan <gzr@eazel.com>
More undo framework work. Still incomplete.
* libnautilus-extensions/nautilus-entry.c:
(nautilus_entry_changed):
Modified to use new undo manager location API
* libnautilus-extensions/nautilus-icon-text-item.c:
(iti_event),
(restore_from_undo_snapshot_callback):
Modified to use new undo manager location API
* libnautilus/nautilus-undo-manager.c:
* libnautilus/nautilus-undo-manager.h:
(impl_Nautilus_Undo_Manager__create),
(impl_Nautilus_Undo_Manager__append),
(impl_Nautilus_Undo_Manager__forget),
(nautilus_undo_manager_begin_transaction),
(nautilus_undo_manager_end_transaction),
(nautilus_undo_manager_undo), (nautilus_undo_manager_redo),
(nautilus_undo_manager_add_transaction),
(nautilus_undo_manager_unregister_object),
(free_undo_manager_list_data), (prune_undo_manager_list):
Modified to use new API and Undo::Manager::Transaction
* libnautilus/nautilus-undo-transaction.c:
* libnautilus/nautilus-undo-transaction.h:
(impl_Nautilus_Undo_Transaction__destroy),
(impl_Nautilus_Undo_Transaction__create),
(impl_Nautilus_Undo_Transaction__get_undo_description),
(impl_Nautilus_Undo_Transaction__get_redo_description),
(impl_Nautilus_Undo_Transaction__get_base_description),
(impl_Nautilus_Undo_Transaction__undo),
(nautilus_undo_transaction_new),
(nautilus_undo_transaction_initialize),
(nautilus_undo_transaction_destroy),
(nautilus_undo_transaction_initialize_class),
(nautilus_undo_transaction_undo),
(nautilus_undo_transaction_contains_object):
Added support for new Undo::Manager::Transaction object
2000-05-19 Ali Abdin <aliabdin@aucegypt.edu>
* components/help/converters/gnome-db2html2/gdb3html.c:
......
......@@ -39,6 +39,8 @@
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-debug.h>
#include <libnautilus/nautilus-clipboard.h>
#include <libnautilus/nautilus-undo-manager.h>
#include <libnautilus/nautilus-undo.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
......@@ -120,6 +122,36 @@ notes_notify_location_change (NautilusViewFrame *view,
notes->uri = g_strdup (loci->requested_uri);
notes_load_metainfo (notes);
}
#if 0
{
CORBA_Environment ev;
Nautilus_Undo_Manager undo_manager;
Nautilus_Undo_Transaction undo_transaction;
NautilusUndoTransaction *transaction;
BonoboObject *view_control;
CORBA_exception_init(&ev);
view_control = nautilus_view_frame_get_bonobo_control (view);
g_assert (view_control);
undo_manager = bonobo_object_query_interface (view_control,
"IDL:Nautilus/Undo/Context:1.0");
g_assert (undo_manager);
transaction = nautilus_undo_transaction_new ("Test");
g_assert (transaction);
undo_transaction = bonobo_object_corba_objref (BONOBO_OBJECT (transaction));
g_assert (undo_transaction);
Nautilus_Undo_Manager_append (undo_manager, undo_transaction, &ev);
CORBA_exception_free(&ev);
}
#endif
}
......
......@@ -39,6 +39,8 @@
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-debug.h>
#include <libnautilus/nautilus-clipboard.h>
#include <libnautilus/nautilus-undo-manager.h>
#include <libnautilus/nautilus-undo.h>
#define NOTES_DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/BBBB"
......@@ -120,6 +122,36 @@ notes_notify_location_change (NautilusViewFrame *view,
notes->uri = g_strdup (loci->requested_uri);
notes_load_metainfo (notes);
}
#if 0
{
CORBA_Environment ev;
Nautilus_Undo_Manager undo_manager;
Nautilus_Undo_Transaction undo_transaction;
NautilusUndoTransaction *transaction;
BonoboObject *view_control;
CORBA_exception_init(&ev);
view_control = nautilus_view_frame_get_bonobo_control (view);
g_assert (view_control);
undo_manager = bonobo_object_query_interface (view_control,
"IDL:Nautilus/Undo/Context:1.0");
g_assert (undo_manager);
transaction = nautilus_undo_transaction_new ("Test");
g_assert (transaction);
undo_transaction = bonobo_object_corba_objref (BONOBO_OBJECT (transaction));
g_assert (undo_transaction);
Nautilus_Undo_Manager_append (undo_manager, undo_transaction, &ev);
CORBA_exception_free(&ev);
}
#endif
}
......
......@@ -190,7 +190,8 @@ static void
nautilus_entry_changed (GtkEditable *editable)
{
NautilusEntry *entry;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
g_assert (GTK_IS_EDITABLE (editable));
g_assert (NAUTILUS_IS_ENTRY (editable));
......@@ -199,10 +200,13 @@ nautilus_entry_changed (GtkEditable *editable)
/* Register undo transaction */
if (!entry->undo_registered && entry->use_undo) {
tip = nautilus_undo_manager_begin_transaction (GTK_OBJECT (entry), _("Edit"));
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(entry), save_undo_snapshot_callback,
manager = nautilus_get_undo_manager (GTK_OBJECT (entry));
g_assert (manager);
transaction = nautilus_undo_manager_begin_transaction (manager, _("Edit"));
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(entry), save_undo_snapshot_callback,
restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
entry->undo_registered = TRUE;
}
......
......@@ -802,9 +802,9 @@ iti_event (GnomeCanvasItem *item, GdkEvent *event)
int idx;
double x, y;
int cx, cy;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
iti = ITI (item);
priv = iti->priv;
......@@ -838,10 +838,11 @@ iti_event (GnomeCanvasItem *item, GdkEvent *event)
if (!priv->undo_registered) {
priv->undo_registered = TRUE;
tip = nautilus_undo_manager_begin_transaction ( GTK_OBJECT(iti), "Rename");
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(iti),
manager = gtk_object_get_data (GTK_OBJECT (iti), NAUTILUS_UNDO_MANAGER_NAME);
transaction = nautilus_undo_manager_begin_transaction ( manager, "Rename");
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(iti),
save_undo_snapshot_callback, restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
}
/* Handle any events that reach us */
......@@ -1370,16 +1371,18 @@ restore_from_undo_snapshot_callback(NautilusUndoable *undoable)
char *undo_text;
NautilusIconTextItem *iti;
ItiPrivate *priv;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
iti = NAUTILUS_ICON_TEXT_ITEM(undoable->undo_target_class);
priv = iti->priv;
/* Register undo transaction */
tip = nautilus_undo_manager_begin_transaction (GTK_OBJECT(iti), _("Rename"));
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(iti),
/* Register undo transaction */
manager = gtk_object_get_data (GTK_OBJECT (iti), NAUTILUS_UNDO_MANAGER_NAME);
transaction = nautilus_undo_manager_begin_transaction (manager, _("Rename"));
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(iti),
save_undo_snapshot_callback, restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
undo_text = g_datalist_get_data(&undoable->undo_data, "undo_text");
if (undo_text != NULL) {
......
......@@ -46,10 +46,10 @@ static guint signals[LAST_SIGNAL];
typedef struct {
POA_Nautilus_Undo_Manager servant;
gpointer bonobo_object;
POA_Nautilus_Undo_Manager servant;
gpointer bonobo_object;
NautilusUndoManager *gtk_object;
NautilusUndoManager *gtk_object;
} impl_POA_Nautilus_Undo_Manager;
/* GtkObject */
......@@ -61,12 +61,12 @@ static GList *free_undo_manager_list_data (GList *list);
static GList *prune_undo_manager_list (GList *list, gint items);
/* CORBA/Bonobo */
static void impl_Nautilus_Undo_Manager__append (impl_POA_Nautilus_Undo_Manager *servant,
const CORBA_char *name,
CORBA_Environment *ev);
static void impl_Nautilus_Undo_Manager__forget (impl_POA_Nautilus_Undo_Manager *servant,
CORBA_Environment *ev);
static void impl_Nautilus_Undo_Manager__append (impl_POA_Nautilus_Undo_Manager *servant,
const Nautilus_Undo_Transaction transaction,
CORBA_Environment *ev);
static void impl_Nautilus_Undo_Manager__forget (impl_POA_Nautilus_Undo_Manager *servant,
const Nautilus_Undo_Transaction transaction,
CORBA_Environment *ev);
NAUTILUS_DEFINE_CLASS_BOILERPLATE(NautilusUndoManager, nautilus_undo_manager, BONOBO_OBJECT_TYPE)
......@@ -108,7 +108,7 @@ impl_Nautilus_Undo_Manager__destroy(BonoboObject *obj, impl_POA_Nautilus_Undo_Ma
}
static Nautilus_Undo_Manager
impl_Nautilus_Undo_Manager__create(NautilusUndoManager *manager, CORBA_Environment * ev)
impl_Nautilus_Undo_Manager__create (NautilusUndoManager *manager, CORBA_Environment * ev)
{
Nautilus_Undo_Manager retval;
impl_POA_Nautilus_Undo_Manager *servant;
......@@ -132,16 +132,25 @@ impl_Nautilus_Undo_Manager__create(NautilusUndoManager *manager, CORBA_Environme
return retval;
}
static void
impl_Nautilus_Undo_Manager__append (impl_POA_Nautilus_Undo_Manager *servant,
const CORBA_char *name,
CORBA_Environment *ev)
{
const Nautilus_Undo_Transaction undo_transaction,
CORBA_Environment *ev)
{
NautilusUndoManager *manager;
g_assert (NAUTILUS_IS_UNDO_MANAGER (servant->gtk_object));
manager = NAUTILUS_UNDO_MANAGER (servant->gtk_object);
Bonobo_Unknown_ref (undo_transaction, ev);
nautilus_undo_manager_add_transaction (manager, undo_transaction);
}
static void
impl_Nautilus_Undo_Manager__forget (impl_POA_Nautilus_Undo_Manager *servant,
CORBA_Environment *ev)
const Nautilus_Undo_Transaction transaction,
CORBA_Environment *ev)
{
}
......@@ -186,7 +195,7 @@ nautilus_undo_manager_initialize (NautilusUndoManager *manager)
}
/* Class initialization function for the NautilusUndoable item. */
/* Class initialization function for the NautilusUndoManager. */
static void
nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *klass)
{
......@@ -214,18 +223,10 @@ nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *klass)
}
/* nautilus_undo_manager_begin_transaction */
NautilusUndoTransactionInProgress *
nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
NautilusUndoTransaction *
nautilus_undo_manager_begin_transaction (NautilusUndoManager *manager, const gchar *name)
{
NautilusUndoManager *manager;
NautilusUndoTransactionInProgress *tip;
/* Locate undo manager. */
/* FIXME: We can't get a pointer to the actual undo manager, so this
* needs to work through the CORBA interface to the undo manager.
*/
manager = nautilus_get_undo_manager (object);
g_assert (manager != NULL);
NautilusUndoTransaction *transaction;
/* We aren't handling nested transactions currently */
if (manager->details->transaction_in_progress) {
......@@ -233,37 +234,40 @@ nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
return NULL;
}
/* Create NautilusUndoTransactionInProgress */
tip = g_new (NautilusUndoTransactionInProgress, 1);
g_assert(tip);
tip->manager = manager;
/* Create new transaction */
tip->transaction = nautilus_undo_transaction_new(name);
transaction = nautilus_undo_transaction_new (name);
tip->manager->details->transaction_in_progress = TRUE;
manager->details->transaction_in_progress = TRUE;
return tip;
return transaction;
}
/* nautilus_undo_manager_end_transaction */
void
nautilus_undo_manager_end_transaction (NautilusUndoTransactionInProgress *tip)
nautilus_undo_manager_end_transaction (NautilusUndoManager *manager, NautilusUndoTransaction *transaction)
{
CORBA_Object undo_transaction;
CORBA_Environment ev;
CORBA_exception_init(&ev);
/* Verify a transaction is in progress */
if (!tip->manager->details->transaction_in_progress) {
if (!manager->details->transaction_in_progress) {
g_warning("NautilusUndoManager has no current transaction. Begin a transaction first.");
return;
}
tip->manager->details->transaction_in_progress = FALSE;
manager->details->transaction_in_progress = FALSE;
/* Commit current transaction to undo list */
nautilus_undo_manager_add_transaction (tip->manager, tip->transaction);
/* Commit current transaction to undo list */
undo_transaction = bonobo_object_corba_objref (BONOBO_OBJECT (transaction));
Bonobo_Unknown_ref (undo_transaction, &ev);
nautilus_undo_manager_add_transaction (manager, undo_transaction);
/* Fire off signal informing that an undo transaction has occurred */
gtk_signal_emit (GTK_OBJECT (tip->manager), signals[UNDO_TRANSACTION_OCCURED]);
gtk_signal_emit (GTK_OBJECT (manager), signals[UNDO_TRANSACTION_OCCURED]);
CORBA_exception_free(&ev);
}
/* nautilus_undo_manager_undo_last_transaction */
......@@ -271,8 +275,11 @@ void
nautilus_undo_manager_undo (NautilusUndoManager *manager)
{
GList *list;
NautilusUndoTransaction *undo_transaction;
CORBA_Object undo_transaction;
CORBA_Environment ev;
CORBA_exception_init(&ev);
/* Verify we have a transaction to be undone */
if (manager->details->undo_list == NULL) {
g_warning("NautilusUndoManager has no transaction to be undone.");
......@@ -283,21 +290,23 @@ nautilus_undo_manager_undo (NautilusUndoManager *manager)
list = g_list_last(manager->details->undo_list);
g_assert(list);
undo_transaction = list->data;
manager->details->undo_list = g_list_remove(manager->details->undo_list, list->data);
manager->details->undo_list = g_list_remove (manager->details->undo_list, list->data);
/* Undo transaction */
nautilus_undo_transaction_undo(undo_transaction);
Nautilus_Undo_Transaction_undo (undo_transaction, &ev);
/* Place transaction into redo list */
if (manager->details->enable_redo) {
/* nautilus_undo_manager_add_redo_transaction (undo_transaction); */
} else {
/* Purge transaction */
nautilus_undo_transaction_destroy(undo_transaction);
bonobo_object_unref (BONOBO_OBJECT (undo_transaction));
}
/* Fire off signal informing that an undo transaction has occurred */
gtk_signal_emit (GTK_OBJECT (manager), signals[UNDO_TRANSACTION_OCCURED]);
CORBA_exception_free(&ev);
}
/* nautilus_undo_manager_redo_last_undone_transaction */
......@@ -305,7 +314,11 @@ void
nautilus_undo_manager_redo (NautilusUndoManager *manager)
{
GList *list;
NautilusUndoTransaction *redo_transaction;
CORBA_Object redo_transaction;
CORBA_Object undo_transaction;
CORBA_Environment ev;
CORBA_exception_init(&ev);
/* Are we allowing redo operations? */
if (manager->details->enable_redo) {
......@@ -320,19 +333,23 @@ nautilus_undo_manager_redo (NautilusUndoManager *manager)
}
/* Pop last transaction off redo list */
list = g_list_last(manager->details->redo_list);
list = g_list_last (manager->details->redo_list);
g_assert(list);
redo_transaction = list->data;
nautilus_undo_transaction_undo(redo_transaction);
Nautilus_Undo_Transaction_undo (redo_transaction, &ev);
/* Place transaction into undo list */
nautilus_undo_manager_add_transaction (manager, redo_transaction);
undo_transaction = bonobo_object_corba_objref (BONOBO_OBJECT (redo_transaction));
Bonobo_Unknown_ref (undo_transaction, &ev);
nautilus_undo_manager_add_transaction (manager, undo_transaction);
CORBA_exception_free(&ev);
}
/* nautilus_undo_manager_add_undo_transaction */
void
nautilus_undo_manager_add_transaction (NautilusUndoManager *manager, NautilusUndoTransaction *transaction)
nautilus_undo_manager_add_transaction (NautilusUndoManager *manager, Nautilus_Undo_Transaction transaction)
{
int length;
......@@ -397,7 +414,7 @@ nautilus_undo_manager_unregister_object (GtkObject *object)
if (nautilus_undo_transaction_contains_object (transaction, object)) {
manager->details->undo_list =
g_list_remove (manager->details->undo_list, transaction);
nautilus_undo_transaction_destroy (transaction);
bonobo_object_unref (BONOBO_OBJECT (transaction));
index--;
success = TRUE;
}
......@@ -413,7 +430,7 @@ nautilus_undo_manager_unregister_object (GtkObject *object)
if (nautilus_undo_transaction_contains_object(transaction, object)) {
manager->details->redo_list =
g_list_remove (manager->details->redo_list, transaction);
nautilus_undo_transaction_destroy(transaction);
bonobo_object_unref (BONOBO_OBJECT (transaction));
index--;
success = TRUE;
}
......@@ -608,7 +625,7 @@ free_undo_manager_list_data (GList *list)
if (list) {
transaction = list->data;
list = g_list_remove (list, transaction);
nautilus_undo_transaction_destroy (transaction);
bonobo_object_unref (BONOBO_OBJECT (transaction));
}
}
......@@ -632,7 +649,7 @@ prune_undo_manager_list (GList *list, gint items)
if (list) {
transaction = list->data;
list = g_list_remove (list, transaction);
nautilus_undo_transaction_destroy (transaction);
bonobo_object_unref (BONOBO_OBJECT (transaction));
}
}
......
......@@ -26,7 +26,6 @@
#define NAUTILUS_UNDO_MANAGER_H
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-persist.h>
#include "nautilus-undo-transaction.h"
#include "nautilus-undo.h"
......@@ -42,40 +41,36 @@
#define NAUTILUS_IS_UNDO_MANAGER_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_UNDO_MANAGER))
#define NAUTILUS_UNDO_MANAGER_NAME "NautilusUndoManager"
typedef struct NautilusUndoManagerClass NautilusUndoManagerClass;
typedef struct NautilusUndoManagerDetails NautilusUndoManagerDetails;
typedef struct NautilusUndoTransactionInProgress NautilusUndoTransactionInProgress;
struct NautilusUndoManager {
BonoboPersist parent;
BonoboObject parent;
NautilusUndoManagerDetails *details;
};
struct NautilusUndoManagerClass {
BonoboPersistClass parent_class;
BonoboObjectClass parent_class;
void (* undo_transaction_occurred) (GtkObject *object, gpointer data);
gpointer servant_init_func, servant_destroy_func, vepv;
};
struct NautilusUndoTransactionInProgress {
NautilusUndoManager *manager;
NautilusUndoTransaction *transaction;
};
/* GtkObject */
GtkType nautilus_undo_manager_get_type (void);
NautilusUndoManager *nautilus_undo_manager_new (void);
/* Prototypes */
NautilusUndoTransactionInProgress *nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name);
void nautilus_undo_manager_end_transaction (NautilusUndoTransactionInProgress *transaction);
NautilusUndoTransaction *nautilus_undo_manager_begin_transaction (NautilusUndoManager *manager, const gchar *name);
void nautilus_undo_manager_end_transaction (NautilusUndoManager *manager, NautilusUndoTransaction *transaction);
void nautilus_undo_manager_undo (NautilusUndoManager *manager);
void nautilus_undo_manager_redo (NautilusUndoManager *manager);
void nautilus_undo_manager_add_transaction (NautilusUndoManager *manager,
NautilusUndoTransaction *transaction);
Nautilus_Undo_Transaction transaction);
gboolean nautilus_undo_manager_can_undo (NautilusUndoManager *manager);
gboolean nautilus_undo_manager_can_redo (NautilusUndoManager *manager);
......@@ -85,6 +80,7 @@ const gchar *nautilus_undo_manager_get_current_redo_transaction_name (Nautilus
void nautilus_undo_manager_enable_redo (NautilusUndoManager *manager, gboolean value);
void nautilus_undo_manager_set_queue_depth (NautilusUndoManager *manager, gint depth);
gboolean nautilus_undo_manager_unregister_object (GtkObject *object);
void nautilus_attach_undo_manager (GtkObject *object,
......
......@@ -190,7 +190,8 @@ static void
nautilus_entry_changed (GtkEditable *editable)
{
NautilusEntry *entry;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
g_assert (GTK_IS_EDITABLE (editable));
g_assert (NAUTILUS_IS_ENTRY (editable));
......@@ -199,10 +200,13 @@ nautilus_entry_changed (GtkEditable *editable)
/* Register undo transaction */
if (!entry->undo_registered && entry->use_undo) {
tip = nautilus_undo_manager_begin_transaction (GTK_OBJECT (entry), _("Edit"));
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(entry), save_undo_snapshot_callback,
manager = nautilus_get_undo_manager (GTK_OBJECT (entry));
g_assert (manager);
transaction = nautilus_undo_manager_begin_transaction (manager, _("Edit"));
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(entry), save_undo_snapshot_callback,
restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
entry->undo_registered = TRUE;
}
......
......@@ -802,9 +802,9 @@ iti_event (GnomeCanvasItem *item, GdkEvent *event)
int idx;
double x, y;
int cx, cy;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
iti = ITI (item);
priv = iti->priv;
......@@ -838,10 +838,11 @@ iti_event (GnomeCanvasItem *item, GdkEvent *event)
if (!priv->undo_registered) {
priv->undo_registered = TRUE;
tip = nautilus_undo_manager_begin_transaction ( GTK_OBJECT(iti), "Rename");
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(iti),
manager = gtk_object_get_data (GTK_OBJECT (iti), NAUTILUS_UNDO_MANAGER_NAME);
transaction = nautilus_undo_manager_begin_transaction ( manager, "Rename");
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(iti),
save_undo_snapshot_callback, restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
}
/* Handle any events that reach us */
......@@ -1370,16 +1371,18 @@ restore_from_undo_snapshot_callback(NautilusUndoable *undoable)
char *undo_text;
NautilusIconTextItem *iti;
ItiPrivate *priv;
NautilusUndoTransactionInProgress *tip;
NautilusUndoTransaction *transaction;
NautilusUndoManager *manager;
iti = NAUTILUS_ICON_TEXT_ITEM(undoable->undo_target_class);
priv = iti->priv;
/* Register undo transaction */
tip = nautilus_undo_manager_begin_transaction (GTK_OBJECT(iti), _("Rename"));
nautilus_undoable_save_undo_snapshot (tip->transaction, GTK_OBJECT(iti),
/* Register undo transaction */
manager = gtk_object_get_data (GTK_OBJECT (iti), NAUTILUS_UNDO_MANAGER_NAME);
transaction = nautilus_undo_manager_begin_transaction (manager, _("Rename"));
nautilus_undoable_save_undo_snapshot (transaction, GTK_OBJECT(iti),
save_undo_snapshot_callback, restore_from_undo_snapshot_callback);
nautilus_undo_manager_end_transaction (tip);
nautilus_undo_manager_end_transaction (manager, transaction);
undo_text = g_datalist_get_data(&undoable->undo_data, "undo_text");
if (undo_text != NULL) {
......
......@@ -46,10 +46,10 @@ static guint signals[LAST_SIGNAL];
typedef struct {
POA_Nautilus_Undo_Manager servant;
gpointer bonobo_object;
POA_Nautilus_Undo_Manager servant;
gpointer bonobo_object;