summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-06 23:34:12 +0200
committerStefano Karapetsas <[email protected]>2012-09-06 23:34:12 +0200
commit278df62878f2981dea980c5f48e791e047b9d5f1 (patch)
tree3a3bcc3a2360d9fd16adc44821b2343085247858 /libcaja-private
parentf426641aacea9d5f7683be776536bc6301c7baef (diff)
downloadcaja-278df62878f2981dea980c5f48e791e047b9d5f1.tar.bz2
caja-278df62878f2981dea980c5f48e791e047b9d5f1.tar.xz
remove old undo code
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/Makefile.am9
-rw-r--r--libcaja-private/caja-entry.c3
-rw-r--r--libcaja-private/caja-undo-manager.c320
-rw-r--r--libcaja-private/caja-undo-manager.h82
-rw-r--r--libcaja-private/caja-undo-private.h36
-rw-r--r--libcaja-private/caja-undo-signal-handlers.c345
-rw-r--r--libcaja-private/caja-undo-signal-handlers.h37
-rw-r--r--libcaja-private/caja-undo-transaction.c343
-rw-r--r--libcaja-private/caja-undo-transaction.h80
-rw-r--r--libcaja-private/caja-undo.c218
-rw-r--r--libcaja-private/caja-undo.h77
11 files changed, 0 insertions, 1550 deletions
diff --git a/libcaja-private/Makefile.am b/libcaja-private/Makefile.am
index da22bd94..6d1c343d 100644
--- a/libcaja-private/Makefile.am
+++ b/libcaja-private/Makefile.am
@@ -180,15 +180,6 @@ libcaja_private_la_SOURCES = \
caja-tree-view-drag-dest.h \
caja-ui-utilities.c \
caja-ui-utilities.h \
- caja-undo-manager.c \
- caja-undo-manager.h \
- caja-undo-private.h \
- caja-undo-signal-handlers.c \
- caja-undo-signal-handlers.h \
- caja-undo-transaction.c \
- caja-undo-transaction.h \
- caja-undo.c \
- caja-undo.h \
caja-users-groups-cache.c \
caja-users-groups-cache.h \
caja-vfs-directory.c \
diff --git a/libcaja-private/caja-entry.c b/libcaja-private/caja-entry.c
index 5e34c84e..31b590c3 100644
--- a/libcaja-private/caja-entry.c
+++ b/libcaja-private/caja-entry.c
@@ -29,7 +29,6 @@
#include <string.h>
#include "caja-global-preferences.h"
-#include "caja-undo-signal-handlers.h"
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <gdk/gdkkeysyms.h>
@@ -69,8 +68,6 @@ caja_entry_init (CajaEntry *entry)
entry->details = g_new0 (CajaEntryDetails, 1);
entry->details->user_edit = TRUE;
-
- caja_undo_set_up_caja_entry_for_undo (entry);
}
GtkWidget *
diff --git a/libcaja-private/caja-undo-manager.c b/libcaja-private/caja-undo-manager.c
deleted file mode 100644
index 8f999dd0..00000000
--- a/libcaja-private/caja-undo-manager.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* CajaUndoManager - Undo/Redo transaction manager.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <config.h>
-#include <libcaja-private/caja-undo-manager.h>
-#include <libcaja-private/caja-undo-transaction.h>
-
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-gtk-extensions.h>
-#include <gtk/gtk.h>
-#include "caja-undo-private.h"
-
-struct CajaUndoManagerDetails
-{
- CajaUndoTransaction *transaction;
-
- /* These are used to tell undo from redo. */
- gboolean current_transaction_is_redo;
- gboolean new_transaction_is_redo;
-
- /* These are used only so that we can complain if we get more
- * than one transaction inside undo.
- */
- gboolean undo_in_progress;
- int num_transactions_during_undo;
-};
-
-enum
-{
- CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL];
-
-typedef struct
-{
-#ifdef UIH
- MateComponentUIHandler *handler;
-#endif /* UIH */
- char *path;
- char *no_undo_menu_item_label;
- char *no_undo_menu_item_hint;
-} UndoMenuHandlerConnection;
-
-G_DEFINE_TYPE (CajaUndoManager,
- caja_undo_manager,
- G_TYPE_OBJECT)
-
-static void
-release_transaction (CajaUndoManager *manager)
-{
- CajaUndoTransaction *transaction;
-
- transaction = manager->details->transaction;
- manager->details->transaction = NULL;
- if (transaction != NULL)
- {
- g_object_unref (transaction);
- }
-}
-
-void
-caja_undo_manager_append (CajaUndoManager *manager,
- CajaUndoTransaction *transaction)
-{
- CajaUndoTransaction *duplicate_transaction;
-
- /* Check, complain, and ignore the passed-in transaction if we
- * get more than one within a single undo operation. The single
- * transaction we get during the undo operation is supposed to
- * be the one for redoing the undo (or re-undoing the redo).
- */
- if (manager->details->undo_in_progress)
- {
- manager->details->num_transactions_during_undo += 1;
- g_return_if_fail (manager->details->num_transactions_during_undo == 1);
- }
-
- g_return_if_fail (transaction != NULL);
-
- /* Keep a copy of this transaction (dump the old one). */
- duplicate_transaction = g_object_ref (transaction);
- release_transaction (manager);
- manager->details->transaction = duplicate_transaction;
- manager->details->current_transaction_is_redo =
- manager->details->new_transaction_is_redo;
-
- /* Fire off signal indicating that the undo state has changed. */
- g_signal_emit (manager, signals[CHANGED], 0);
-}
-
-void
-caja_undo_manager_forget (CajaUndoManager *manager,
- CajaUndoTransaction *transaction)
-{
- /* Nothing to forget unless the item we are passed is the
- * transaction we are currently holding.
- */
- if (transaction != manager->details->transaction)
- {
- return;
- }
-
- /* Get rid of the transaction we are holding on to. */
- release_transaction (manager);
-
- /* Fire off signal indicating that the undo state has changed. */
- g_signal_emit (manager, signals[CHANGED], 0);
-}
-
-CajaUndoManager *
-caja_undo_manager_new (void)
-{
- return CAJA_UNDO_MANAGER (g_object_new (caja_undo_manager_get_type (), NULL));
-}
-
-static void
-caja_undo_manager_init (CajaUndoManager *manager)
-{
- manager->details = g_new0 (CajaUndoManagerDetails, 1);
-}
-
-void
-caja_undo_manager_undo (CajaUndoManager *manager)
-{
- CajaUndoTransaction *transaction;
-
- g_return_if_fail (CAJA_IS_UNDO_MANAGER (manager));
-
- transaction = manager->details->transaction;
- manager->details->transaction = NULL;
- if (transaction != NULL)
- {
- /* Perform the undo. New transactions that come in
- * during an undo are redo transactions. New
- * transactions that come in during a redo are undo
- * transactions. Transactions that come in outside
- * are always undo and never redo.
- */
- manager->details->new_transaction_is_redo =
- !manager->details->current_transaction_is_redo;
- manager->details->undo_in_progress = TRUE;
- manager->details->num_transactions_during_undo = 0;
- caja_undo_transaction_undo (transaction);
- manager->details->undo_in_progress = FALSE;
- manager->details->new_transaction_is_redo = FALSE;
-
- /* Let go of the transaction. */
- g_object_unref (transaction);
-
- /* Fire off signal indicating the undo state has changed. */
- g_signal_emit (manager, signals[CHANGED], 0);
- }
-}
-
-static void
-finalize (GObject *object)
-{
- CajaUndoManager *manager;
-
- manager = CAJA_UNDO_MANAGER (object);
-
- release_transaction (manager);
-
- g_free (manager->details);
-
- if (G_OBJECT_CLASS (caja_undo_manager_parent_class)->finalize)
- {
- (* G_OBJECT_CLASS (caja_undo_manager_parent_class)->finalize) (object);
- }
-}
-
-void
-caja_undo_manager_attach (CajaUndoManager *manager, GObject *target)
-{
- g_return_if_fail (CAJA_IS_UNDO_MANAGER (manager));
- g_return_if_fail (G_IS_OBJECT (target));
-
- caja_undo_attach_undo_manager (G_OBJECT (target), manager);
-}
-
-#ifdef UIH
-static void
-update_undo_menu_item (CajaUndoManager *manager,
- UndoMenuHandlerConnection *connection)
-{
- CORBA_Environment ev;
- Caja_Undo_MenuItem *menu_item;
-
- g_assert (CAJA_IS_UNDO_MANAGER (manager));
- g_assert (connection != NULL);
- g_assert (MATECOMPONENT_IS_UI_HANDLER (connection->handler));
- g_assert (connection->path != NULL);
- g_assert (connection->no_undo_menu_item_label != NULL);
- g_assert (connection->no_undo_menu_item_hint != NULL);
-
- CORBA_exception_init (&ev);
-
- if (CORBA_Object_is_nil (manager->details->transaction, &ev))
- {
- menu_item = NULL;
- }
- else
- {
- if (manager->details->current_transaction_is_redo)
- {
- menu_item = Caja_Undo_Transaction__get_redo_menu_item
- (manager->details->transaction, &ev);
- }
- else
- {
- menu_item = Caja_Undo_Transaction__get_undo_menu_item
- (manager->details->transaction, &ev);
- }
- }
-
- matecomponent_ui_handler_menu_set_sensitivity
- (connection->handler, connection->path,
- menu_item != NULL);
- matecomponent_ui_handler_menu_set_label
- (connection->handler, connection->path,
- menu_item == NULL
- ? connection->no_undo_menu_item_label
- : menu_item->label);
- matecomponent_ui_handler_menu_set_hint
- (connection->handler, connection->path,
- menu_item == NULL
- ? connection->no_undo_menu_item_hint
- : menu_item->hint);
-
- CORBA_free (menu_item);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-undo_menu_handler_connection_free (UndoMenuHandlerConnection *connection)
-{
- g_assert (connection != NULL);
- g_assert (MATECOMPONENT_IS_UI_HANDLER (connection->handler));
- g_assert (connection->path != NULL);
- g_assert (connection->no_undo_menu_item_label != NULL);
- g_assert (connection->no_undo_menu_item_hint != NULL);
-
- g_free (connection->path);
- g_free (connection->no_undo_menu_item_label);
- g_free (connection->no_undo_menu_item_hint);
- g_free (connection);
-}
-
-static void
-undo_menu_handler_connection_free_cover (gpointer data)
-{
- undo_menu_handler_connection_free (data);
-}
-
-void
-caja_undo_manager_set_up_matecomponent_ui_handler_undo_item (CajaUndoManager *manager,
- MateComponentUIHandler *handler,
- const char *path,
- const char *no_undo_menu_item_label,
- const char *no_undo_menu_item_hint)
-{
- UndoMenuHandlerConnection *connection;
-
- connection = g_new (UndoMenuHandlerConnection, 1);
- connection->handler = handler;
- connection->path = g_strdup (path);
- connection->no_undo_menu_item_label = g_strdup (no_undo_menu_item_label);
- connection->no_undo_menu_item_hint = g_strdup (no_undo_menu_item_hint);
-
- /* Set initial state of menu item. */
- update_undo_menu_item (manager, connection);
-
- /* Update it again whenever the changed signal is emitted. */
- eel_gtk_signal_connect_full_while_alive
- (GTK_OBJECT (manager), "changed",
- G_CALLBACK (update_undo_menu_item), NULL,
- connection, undo_menu_handler_connection_free_cover,
- FALSE, FALSE,
- GTK_OBJECT (handler));
-}
-#endif /* UIH */
-
-static void
-caja_undo_manager_class_init (CajaUndoManagerClass *class)
-{
- G_OBJECT_CLASS (class)->finalize = finalize;
-
- signals[CHANGED] = g_signal_new
- ("changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CajaUndoManagerClass,
- changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
diff --git a/libcaja-private/caja-undo-manager.h b/libcaja-private/caja-undo-manager.h
deleted file mode 100644
index e6541325..00000000
--- a/libcaja-private/caja-undo-manager.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* CajaUndoManager - Manages undo and redo transactions.
- * This is the public interface used by the application.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAJA_UNDO_MANAGER_H
-#define CAJA_UNDO_MANAGER_H
-
-#include <libcaja-private/caja-undo.h>
-
-#define CAJA_TYPE_UNDO_MANAGER caja_undo_manager_get_type()
-#define CAJA_UNDO_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_UNDO_MANAGER, CajaUndoManager))
-#define CAJA_UNDO_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_UNDO_MANAGER, CajaUndoManagerClass))
-#define CAJA_IS_UNDO_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_UNDO_MANAGER))
-#define CAJA_IS_UNDO_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_UNDO_MANAGER))
-#define CAJA_UNDO_MANAGER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_UNDO_MANAGER, CajaUndoManagerClass))
-
-typedef struct CajaUndoManagerDetails CajaUndoManagerDetails;
-
-typedef struct
-{
- GObject parent;
- CajaUndoManagerDetails *details;
-} CajaUndoManager;
-
-typedef struct
-{
- GObjectClass parent_slot;
- void (* changed) (GObject *object, gpointer data);
-} CajaUndoManagerClass;
-
-GType caja_undo_manager_get_type (void);
-CajaUndoManager *caja_undo_manager_new (void);
-
-/* Undo operations. */
-void caja_undo_manager_undo (CajaUndoManager *undo_manager);
-
-#ifdef UIH
-/* Connect the manager to a particular menu item. */
-void caja_undo_manager_set_up_matecomponent_ui_handler_undo_item (CajaUndoManager *manager,
- MateComponentUIHandler *handler,
- const char *path,
- const char *no_undo_menu_item_label,
- const char *no_undo_menu_item_hint);
-
-#endif
-
-/* Attach the undo manager to a Gtk object so that object and the widgets inside it can participate in undo. */
-void caja_undo_manager_attach (CajaUndoManager *manager,
- GObject *object);
-
-void caja_undo_manager_append (CajaUndoManager *manager,
- CajaUndoTransaction *transaction);
-void caja_undo_manager_forget (CajaUndoManager *manager,
- CajaUndoTransaction *transaction);
-
-#endif /* CAJA_UNDO_MANAGER_H */
diff --git a/libcaja-private/caja-undo-private.h b/libcaja-private/caja-undo-private.h
deleted file mode 100644
index c5efbb7c..00000000
--- a/libcaja-private/caja-undo-private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* xxx
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAJA_UNDO_PRIVATE_H
-#define CAJA_UNDO_PRIVATE_H
-
-#include <libcaja-private/caja-undo.h>
-#include <libcaja-private/caja-undo-manager.h>
-#include <glib-object.h>
-
-CajaUndoManager * caja_undo_get_undo_manager (GObject *attached_object);
-void caja_undo_attach_undo_manager (GObject *object,
- CajaUndoManager *manager);
-
-#endif /* CAJA_UNDO_PRIVATE_H */
diff --git a/libcaja-private/caja-undo-signal-handlers.c b/libcaja-private/caja-undo-signal-handlers.c
deleted file mode 100644
index f1dfba3c..00000000
--- a/libcaja-private/caja-undo-signal-handlers.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* Signal handlers to enable undo in Gtk Widgets.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include <glib/gi18n.h>
-#include <libcaja-private/caja-undo.h>
-
-#include <eel/eel-gtk-macros.h>
-#include <string.h>
-
-#include "caja-undo-signal-handlers.h"
-
-
-typedef struct
-{
- char *undo_text;
- gint position;
- guint selection_start;
- guint selection_end;
-} EditableUndoData;
-
-typedef struct
-{
- gboolean undo_registered;
-} EditableUndoObjectData;
-
-
-static void restore_editable_from_undo_snapshot_callback (GObject *target,
- gpointer callback_data);
-static void editable_register_edit_undo (GtkEditable *editable);
-static void free_editable_object_data (gpointer data);
-
-/* caja_undo_set_up_caja_entry_for_undo
- *
- * Functions and callback methods to handle undo
- * in a CajaEntry
- */
-
-static void
-caja_entry_user_changed_callback (CajaEntry *entry)
-{
- /* Register undo transaction */
- editable_register_edit_undo (GTK_EDITABLE (entry));
-}
-
-void
-caja_undo_set_up_caja_entry_for_undo (CajaEntry *entry)
-{
- EditableUndoObjectData *data;
-
- if (!CAJA_IS_ENTRY (entry) )
- {
- return;
- }
-
- data = g_new(EditableUndoObjectData, 1);
- data->undo_registered = FALSE;
- g_object_set_data_full (G_OBJECT (entry), "undo_registered",
- data, free_editable_object_data);
-
- /* Connect to entry signals */
- g_signal_connect (entry, "user_changed",
- G_CALLBACK (caja_entry_user_changed_callback),
- NULL);
-}
-
-void
-caja_undo_tear_down_caja_entry_for_undo (CajaEntry *entry)
-{
- if (!CAJA_IS_ENTRY (entry) )
- {
- return;
- }
-
- /* Disconnect from entry signals */
- g_signal_handlers_disconnect_by_func
- (entry, G_CALLBACK (caja_entry_user_changed_callback), NULL);
-
-}
-
-/* caja_undo_set_up_caja_entry_for_undo
- *
- * Functions and callback methods to handle undo
- * in a CajaEntry
- */
-
-static void
-free_editable_undo_data (gpointer data)
-{
- EditableUndoData *undo_data;
-
- undo_data = (EditableUndoData *) data;
-
- g_free (undo_data->undo_text);
- g_free (undo_data);
-}
-
-static void
-free_editable_object_data (gpointer data)
-{
- g_free (data);
-}
-
-
-static void
-editable_insert_text_callback (GtkEditable *editable)
-{
- /* Register undo transaction */
- editable_register_edit_undo (editable);
-}
-
-static void
-editable_delete_text_callback (GtkEditable *editable)
-{
- /* Register undo transaction */
- editable_register_edit_undo (editable);
-}
-
-static void
-editable_register_edit_undo (GtkEditable *editable)
-{
- EditableUndoData *undo_data;
- EditableUndoObjectData *undo_info;
- gpointer data;
-
- if (!GTK_IS_EDITABLE (editable) )
- {
- return;
- }
-
- /* Check our undo registered flag */
- data = g_object_get_data (G_OBJECT (editable), "undo_registered");
- if (data == NULL)
- {
- g_warning ("Undo data is NULL");
- return;
- }
-
- undo_info = (EditableUndoObjectData *)data;
- if (undo_info->undo_registered)
- {
- return;
- }
-
- undo_data = g_new0 (EditableUndoData, 1);
- undo_data->undo_text = gtk_editable_get_chars (editable, 0, -1);
- undo_data->position = gtk_editable_get_position (editable);
- gtk_editable_get_selection_bounds (editable,
- &undo_data->selection_start,
- &undo_data->selection_end);
-
- caja_undo_register
- (G_OBJECT (editable),
- restore_editable_from_undo_snapshot_callback,
- undo_data,
- (GDestroyNotify) free_editable_undo_data,
- _("Edit"),
- _("Undo Edit"),
- _("Undo the edit"),
- _("Redo Edit"),
- _("Redo the edit"));
-
- undo_info->undo_registered = TRUE;
-}
-
-void
-caja_undo_set_up_editable_for_undo (GtkEditable *editable)
-{
- EditableUndoObjectData *data;
-
- if (!GTK_IS_EDITABLE (editable) )
- {
- return;
- }
-
- /* Connect to editable signals */
- g_signal_connect (editable, "insert_text",
- G_CALLBACK (editable_insert_text_callback), NULL);
- g_signal_connect (editable, "delete_text",
- G_CALLBACK (editable_delete_text_callback), NULL);
-
-
- data = g_new (EditableUndoObjectData, 1);
- data->undo_registered = FALSE;
- g_object_set_data_full (G_OBJECT (editable), "undo_registered",
- data, free_editable_object_data);
-}
-
-void
-caja_undo_tear_down_editable_for_undo (GtkEditable *editable)
-{
- if (!GTK_IS_EDITABLE (editable) )
- {
- return;
- }
-
- /* Disconnect from entry signals */
- g_signal_handlers_disconnect_by_func
- (editable, G_CALLBACK (editable_insert_text_callback), NULL);
- g_signal_handlers_disconnect_by_func
- (editable, G_CALLBACK (editable_delete_text_callback), NULL);
-}
-
-/* restore_editable_from_undo_snapshot_callback
- *
- * Restore edited text.
- */
-static void
-restore_editable_from_undo_snapshot_callback (GObject *target, gpointer callback_data)
-{
- GtkEditable *editable;
- GtkWindow *window;
- EditableUndoData *undo_data;
- EditableUndoObjectData *data;
- gint position;
-
- editable = GTK_EDITABLE (target);
- undo_data = (EditableUndoData *) callback_data;
-
- /* Check our undo registered flag */
- data = g_object_get_data (target, "undo_registered");
- if (data == NULL)
- {
- g_warning ("Undo regisetred flag not found");
- return;
- }
-
- /* Reset the registered flag so we get a new item for future editing. */
- data->undo_registered = FALSE;
-
- /* Register a new undo transaction for redo. */
- editable_register_edit_undo (editable);
-
- /* Restore the text. */
- position = 0;
- gtk_editable_delete_text (editable, 0, -1);
- gtk_editable_insert_text (editable, undo_data->undo_text,
- strlen (undo_data->undo_text), &position);
-
- /* Set focus to widget */
- window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target)));
- gtk_window_set_focus (window, GTK_WIDGET (editable));
-
- /* We have to do this call, because the previous call selects all text */
- gtk_editable_select_region (editable, 0, 0);
-
- /* Restore selection */
- gtk_editable_select_region (editable, undo_data->selection_start,
- undo_data->selection_end);
-
- /* Set the i-beam to the saved position */
- gtk_editable_set_position (editable, undo_data->position);
-
- /* Reset the registered flag so we get a new item for future editing. */
- data->undo_registered = FALSE;
-}
-
-
-/* editable_set_undo_key
- *
- * Allow the use of ctrl-z from within widget.
- */
-
-/* Undo is disabled until we have a better implementation.
- * Both here and in caja-shell-ui.xml.
- */
-
-/* FIXME bugzilla.gnome.org 43515: Undo doesn't work */
-#ifdef UNDO_ENABLED
-
-static gboolean
-editable_key_press_event (GtkEditable *editable, GdkEventKey *event, gpointer user_data)
-{
- switch (event->keyval)
- {
- /* Undo */
- case 'z':
- if ((event->state & GDK_CONTROL_MASK) != 0)
- {
- caja_undo (GTK_OBJECT (editable));
- return TRUE;
- }
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-#endif
-
-/* editable_set_undo_key
- *
- * Allow the use of ctrl-z from within widget. This should only be
- * set if there is no menu bar to use to undo the widget.
- */
-
-void
-caja_undo_editable_set_undo_key (GtkEditable *editable, gboolean value)
-{
- /* FIXME bugzilla.gnome.org 43515: Undo doesn't work */
-#ifdef UNDO_ENABLED
- if (value)
- {
- /* Connect to entry signals */
- g_signal_connect (editable, "key_press_event",
- G_CALLBACK (editable_key_press_event), NULL);
- }
- else
- {
- /* FIXME bugzilla.gnome.org 45092: Warns if the handler
- * is not already connected. We could use object data
- * to prevent that little problem.
- */
- g_signal_disconnect_by_func (editable,
- G_CALLBACK (editable_key_press_event), NULL);
- }
-#endif
-}
diff --git a/libcaja-private/caja-undo-signal-handlers.h b/libcaja-private/caja-undo-signal-handlers.h
deleted file mode 100644
index 47cd4f67..00000000
--- a/libcaja-private/caja-undo-signal-handlers.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* Signal handlers to enable undo in Gtk Widgets.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAJA_UNDO_SIGNAL_HANDLERS_H
-#define CAJA_UNDO_SIGNAL_HANDLERS_H
-
-#include <libcaja-private/caja-entry.h>
-
-void caja_undo_set_up_caja_entry_for_undo (CajaEntry *entry);
-void caja_undo_tear_down_caja_entry_for_undo (CajaEntry *entry);
-void caja_undo_set_up_editable_for_undo (GtkEditable *editable);
-void caja_undo_tear_down_editable_for_undo (GtkEditable *editable);
-void caja_undo_editable_set_undo_key (GtkEditable *editable,
- gboolean value);
-
-#endif /* CAJA_UNDO_SIGNAL_HANDLERS_H */
diff --git a/libcaja-private/caja-undo-transaction.c b/libcaja-private/caja-undo-transaction.c
deleted file mode 100644
index ad34bd93..00000000
--- a/libcaja-private/caja-undo-transaction.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* CajaUndoTransaction - An object for an undoable transaction.
- * Used internally by undo machinery.
- * Not public.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <config.h>
-#include <libcaja-private/caja-undo.h>
-#include <libcaja-private/caja-undo-manager.h>
-#include <libcaja-private/caja-undo-transaction.h>
-
-#include "caja-undo-private.h"
-#include <gtk/gtk.h>
-
-#define CAJA_UNDO_TRANSACTION_LIST_DATA "Caja undo transaction list"
-
-/* undo atoms */
-static void undo_atom_list_free (GList *list);
-static void undo_atom_list_undo_and_free (GList *list);
-
-G_DEFINE_TYPE (CajaUndoTransaction, caja_undo_transaction,
- G_TYPE_OBJECT);
-
-#ifdef UIH
-static Caja_Undo_MenuItem *
-impl_Caja_Undo_Transaction__get_undo_menu_item (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- CajaUndoTransaction *transaction;
- Caja_Undo_MenuItem *item;
-
- transaction = CAJA_UNDO_TRANSACTION (matecomponent_object_from_servant (servant));
-
- item = Caja_Undo_MenuItem__alloc ();
- item->label = CORBA_string_dup (transaction->undo_menu_item_label);
- item->hint = CORBA_string_dup (transaction->undo_menu_item_hint);
-
- return item;
-}
-
-static Caja_Undo_MenuItem *
-impl_Caja_Undo_Transaction__get_redo_menu_item (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- CajaUndoTransaction *transaction;
- Caja_Undo_MenuItem *item;
-
- transaction = CAJA_UNDO_TRANSACTION (matecomponent_object_from_servant (servant));
-
- item = Caja_Undo_MenuItem__alloc ();
- item->label = CORBA_string_dup (transaction->redo_menu_item_label);
- item->hint = CORBA_string_dup (transaction->redo_menu_item_hint);
-
- return item;
-}
-
-static CORBA_char *
-impl_Caja_Undo_Transaction__get_operation_name (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- CajaUndoTransaction *transaction;
-
- transaction = CAJA_UNDO_TRANSACTION (matecomponent_object_from_servant (servant));
- return CORBA_string_dup (transaction->operation_name);
-}
-#endif
-
-
-CajaUndoTransaction *
-caja_undo_transaction_new (const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint)
-{
- CajaUndoTransaction *transaction;
-
- transaction = CAJA_UNDO_TRANSACTION (g_object_new (caja_undo_transaction_get_type (), NULL));
-
- transaction->operation_name = g_strdup (operation_name);
- transaction->undo_menu_item_label = g_strdup (undo_menu_item_label);
- transaction->undo_menu_item_hint = g_strdup (undo_menu_item_hint);
- transaction->redo_menu_item_label = g_strdup (redo_menu_item_label);
- transaction->redo_menu_item_hint = g_strdup (redo_menu_item_hint);
-
- return transaction;
-}
-
-static void
-caja_undo_transaction_init (CajaUndoTransaction *transaction)
-{
-}
-
-static void
-remove_transaction_from_object (gpointer list_data, gpointer callback_data)
-{
- CajaUndoAtom *atom;
- CajaUndoTransaction *transaction;
- GList *list;
-
- g_assert (list_data != NULL);
- atom = list_data;
- transaction = CAJA_UNDO_TRANSACTION (callback_data);
-
- /* Remove the transaction from the list on the atom. */
- list = g_object_get_data (atom->target, CAJA_UNDO_TRANSACTION_LIST_DATA);
-
- if (list != NULL)
- {
- list = g_list_remove (list, transaction);
- g_object_set_data (atom->target, CAJA_UNDO_TRANSACTION_LIST_DATA, list);
- }
-}
-
-static void
-remove_transaction_from_atom_targets (CajaUndoTransaction *transaction)
-{
-
- g_list_foreach (transaction->atom_list,
- remove_transaction_from_object,
- transaction);
-}
-
-static void
-caja_undo_transaction_finalize (GObject *object)
-{
- CajaUndoTransaction *transaction;
-
- transaction = CAJA_UNDO_TRANSACTION (object);
-
- remove_transaction_from_atom_targets (transaction);
- undo_atom_list_free (transaction->atom_list);
-
- g_free (transaction->operation_name);
- g_free (transaction->undo_menu_item_label);
- g_free (transaction->undo_menu_item_hint);
- g_free (transaction->redo_menu_item_label);
- g_free (transaction->redo_menu_item_hint);
-
- if (transaction->owner != NULL)
- {
- g_object_unref (transaction->owner);
- }
-
- G_OBJECT_CLASS (caja_undo_transaction_parent_class)->finalize (object);
-}
-
-void
-caja_undo_transaction_add_atom (CajaUndoTransaction *transaction,
- const CajaUndoAtom *atom)
-{
- GList *list;
-
- g_return_if_fail (CAJA_IS_UNDO_TRANSACTION (transaction));
- g_return_if_fail (atom != NULL);
- g_return_if_fail (GTK_IS_OBJECT (atom->target));
-
- /* Add the atom to the atom list in the transaction. */
- transaction->atom_list = g_list_append
- (transaction->atom_list, g_memdup (atom, sizeof (*atom)));
-
- /* Add the transaction to the list on the atoms target object. */
- list = g_object_get_data (atom->target, CAJA_UNDO_TRANSACTION_LIST_DATA);
- if (g_list_find (list, transaction) != NULL)
- {
- return;
- }
-
- /* If it's not already on that atom, this object is new. */
- list = g_list_prepend (list, transaction);
- g_object_set_data (atom->target, CAJA_UNDO_TRANSACTION_LIST_DATA, list);
-
- /* Connect a signal handler to the atom so it will unregister
- * itself when it's destroyed.
- */
- g_signal_connect (atom->target, "destroy",
- G_CALLBACK (caja_undo_transaction_unregister_object),
- NULL);
-}
-
-void
-caja_undo_transaction_undo (CajaUndoTransaction *transaction)
-{
- g_return_if_fail (CAJA_IS_UNDO_TRANSACTION (transaction));
-
- remove_transaction_from_atom_targets (transaction);
- undo_atom_list_undo_and_free (transaction->atom_list);
-
- transaction->atom_list = NULL;
-}
-
-void
-caja_undo_transaction_add_to_undo_manager (CajaUndoTransaction *transaction,
- CajaUndoManager *manager)
-{
- g_return_if_fail (CAJA_IS_UNDO_TRANSACTION (transaction));
- g_return_if_fail (transaction->owner == NULL);
-
- if (manager != NULL)
- {
- caja_undo_manager_append (manager, transaction);
- transaction->owner = g_object_ref (manager);
- }
-}
-
-static void
-remove_atoms (CajaUndoTransaction *transaction,
- GObject *object)
-{
- GList *p, *next;
- CajaUndoAtom *atom;
-
- g_assert (CAJA_IS_UNDO_TRANSACTION (transaction));
- g_assert (G_IS_OBJECT (object));
-
- /* Destroy any atoms for this object. */
- for (p = transaction->atom_list; p != NULL; p = next)
- {
- atom = p->data;
- next = p->next;
-
- if (atom->target == object)
- {
- transaction->atom_list = g_list_remove_link
- (transaction->atom_list, p);
- undo_atom_list_free (p);
- }
- }
-
- /* If all the atoms are gone, forget this transaction.
- * This may end up freeing the transaction.
- */
- if (transaction->atom_list == NULL)
- {
- caja_undo_manager_forget (
- transaction->owner, transaction);
- }
-}
-
-static void
-remove_atoms_cover (gpointer list_data, gpointer callback_data)
-{
- if (CAJA_IS_UNDO_TRANSACTION (list_data))
- {
- remove_atoms (CAJA_UNDO_TRANSACTION (list_data), G_OBJECT (callback_data));
- }
-}
-
-void
-caja_undo_transaction_unregister_object (GObject *object)
-{
- GList *list;
-
- g_return_if_fail (G_IS_OBJECT (object));
-
- /* Remove atoms from each transaction on the list. */
- list = g_object_get_data (object, CAJA_UNDO_TRANSACTION_LIST_DATA);
- if (list != NULL)
- {
- g_list_foreach (list, remove_atoms_cover, object);
- g_list_free (list);
- g_object_set_data (object, CAJA_UNDO_TRANSACTION_LIST_DATA, NULL);
- }
-}
-
-static void
-undo_atom_free (CajaUndoAtom *atom)
-{
- /* Call the destroy-notify function if it's present. */
- if (atom->callback_data_destroy_notify != NULL)
- {
- (* atom->callback_data_destroy_notify) (atom->callback_data);
- }
-
- /* Free the atom storage. */
- g_free (atom);
-}
-
-static void
-undo_atom_undo_and_free (CajaUndoAtom *atom)
-{
- /* Call the function that does the actual undo. */
- (* atom->callback) (atom->target, atom->callback_data);
-
- /* Get rid of the atom now that it's spent. */
- undo_atom_free (atom);
-}
-
-static void
-undo_atom_free_cover (gpointer atom, gpointer callback_data)
-{
- g_assert (atom != NULL);
- g_assert (callback_data == NULL);
- undo_atom_free (atom);
-}
-
-static void
-undo_atom_undo_and_free_cover (gpointer atom, gpointer callback_data)
-{
- g_assert (atom != NULL);
- g_assert (callback_data == NULL);
- undo_atom_undo_and_free (atom);
-}
-
-static void
-undo_atom_list_free (GList *list)
-{
- g_list_foreach (list, undo_atom_free_cover, NULL);
- g_list_free (list);
-}
-
-static void
-undo_atom_list_undo_and_free (GList *list)
-{
- g_list_foreach (list, undo_atom_undo_and_free_cover, NULL);
- g_list_free (list);
-}
-
-static void
-caja_undo_transaction_class_init (CajaUndoTransactionClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = caja_undo_transaction_finalize;
-}
diff --git a/libcaja-private/caja-undo-transaction.h b/libcaja-private/caja-undo-transaction.h
deleted file mode 100644
index 0d9d8cd6..00000000
--- a/libcaja-private/caja-undo-transaction.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* CajaUndoTransaction - An object for an undoable transaction.
- * Used internally by undo machinery.
- * Not public.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAJA_UNDO_TRANSACTION_H
-#define CAJA_UNDO_TRANSACTION_H
-
-#include <libcaja-private/caja-undo.h>
-
-#define CAJA_TYPE_UNDO_TRANSACTION caja_undo_transaction_get_type()
-#define CAJA_UNDO_TRANSACTION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_UNDO_TRANSACTION, CajaUndoTransaction))
-#define CAJA_UNDO_TRANSACTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_UNDO_TRANSACTION, CajaUndoTransactionClass))
-#define CAJA_IS_UNDO_TRANSACTION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_UNDO_TRANSACTION))
-#define CAJA_IS_UNDO_TRANSACTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_UNDO_TRANSACTION))
-#define CAJA_UNDO_TRANSACTION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_UNDO_TRANSACTION, CajaUndoTransactionClass))
-
-/* The typedef for CajaUndoTransaction is in caja-undo.h
- to avoid circular deps */
-typedef struct _CajaUndoTransactionClass CajaUndoTransactionClass;
-
-struct _CajaUndoTransaction
-{
- GObject parent_slot;
-
- char *operation_name;
- char *undo_menu_item_label;
- char *undo_menu_item_hint;
- char *redo_menu_item_label;
- char *redo_menu_item_hint;
- GList *atom_list;
-
- CajaUndoManager *owner;
-};
-
-struct _CajaUndoTransactionClass
-{
- GObjectClass parent_slot;
-};
-
-GType caja_undo_transaction_get_type (void);
-CajaUndoTransaction *caja_undo_transaction_new (const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint);
-void caja_undo_transaction_add_atom (CajaUndoTransaction *transaction,
- const CajaUndoAtom *atom);
-void caja_undo_transaction_add_to_undo_manager (CajaUndoTransaction *transaction,
- CajaUndoManager *manager);
-void caja_undo_transaction_unregister_object (GObject *atom_target);
-void caja_undo_transaction_undo (CajaUndoTransaction *transaction);
-
-#endif /* CAJA_UNDO_TRANSACTION_H */
diff --git a/libcaja-private/caja-undo.c b/libcaja-private/caja-undo.c
deleted file mode 100644
index ba946a0a..00000000
--- a/libcaja-private/caja-undo.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* caja-undo.c - public interface for objects that implement
- * undoable actions -- works across components
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Darin Adler <[email protected]>
- */
-
-#include <config.h>
-#include "caja-undo.h"
-
-#include "caja-undo-private.h"
-#include "caja-undo-transaction.h"
-#include <gtk/gtk.h>
-
-#define CAJA_UNDO_MANAGER_DATA "Caja undo manager"
-
-/* Register a simple undo action by calling caja_undo_register_full. */
-void
-caja_undo_register (GObject *target,
- CajaUndoCallback callback,
- gpointer callback_data,
- GDestroyNotify callback_data_destroy_notify,
- const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint)
-{
- CajaUndoAtom atom;
- GList single_atom_list;
-
- g_return_if_fail (G_IS_OBJECT (target));
- g_return_if_fail (callback != NULL);
-
- /* Make an atom. */
- atom.target = target;
- atom.callback = callback;
- atom.callback_data = callback_data;
- atom.callback_data_destroy_notify = callback_data_destroy_notify;
-
- /* Make a single-atom list. */
- single_atom_list.data = &atom;
- single_atom_list.next = NULL;
- single_atom_list.prev = NULL;
-
- /* Call the full version of the registration function,
- * using the undo target as the place to search for the
- * undo manager.
- */
- caja_undo_register_full (&single_atom_list,
- target,
- operation_name,
- undo_menu_item_label,
- undo_menu_item_hint,
- redo_menu_item_label,
- redo_menu_item_hint);
-}
-
-/* Register an undo action. */
-void
-caja_undo_register_full (GList *atoms,
- GObject *undo_manager_search_start_object,
- const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint)
-{
- CajaUndoTransaction *transaction;
- GList *p;
-
- g_return_if_fail (atoms != NULL);
- g_return_if_fail (G_IS_OBJECT (undo_manager_search_start_object));
-
- /* Create an undo transaction */
- transaction = caja_undo_transaction_new (operation_name,
- undo_menu_item_label,
- undo_menu_item_hint,
- redo_menu_item_label,
- redo_menu_item_hint);
- for (p = atoms; p != NULL; p = p->next)
- {
- caja_undo_transaction_add_atom (transaction, p->data);
- }
- caja_undo_transaction_add_to_undo_manager
- (transaction,
- caja_undo_get_undo_manager (undo_manager_search_start_object));
-
- /* Now we are done with the transaction.
- * If the undo manager is holding it, then this will not destroy it.
- */
- g_object_unref (transaction);
-}
-
-/* Cover for forgetting about all undo relating to a particular target. */
-void
-caja_undo_unregister (GObject *target)
-{
- /* Perhaps this should also unregister all children if called on a
- * GtkContainer? That might be handy.
- */
- caja_undo_transaction_unregister_object (target);
-}
-
-void
-caja_undo (GObject *undo_manager_search_start_object)
-{
- CajaUndoManager *manager;
-
- g_return_if_fail (G_IS_OBJECT (undo_manager_search_start_object));
-
- manager = caja_undo_get_undo_manager (undo_manager_search_start_object);
- if (manager != NULL)
- {
- caja_undo_manager_undo (manager);
- }
-}
-
-CajaUndoManager *
-caja_undo_get_undo_manager (GObject *start_object)
-{
- CajaUndoManager *manager;
- GtkWidget *parent;
- GtkWindow *transient_parent;
-
- if (start_object == NULL)
- {
- return NULL;
- }
-
- g_return_val_if_fail (G_IS_OBJECT (start_object), NULL);
-
- /* Check for an undo manager right here. */
- manager = g_object_get_data (start_object, CAJA_UNDO_MANAGER_DATA);
- if (manager != NULL)
- {
- return manager;
- }
-
- /* Check for undo manager up the parent chain. */
- if (GTK_IS_WIDGET (start_object))
- {
- parent = gtk_widget_get_parent (GTK_WIDGET (start_object));
- if (parent != NULL)
- {
- manager = caja_undo_get_undo_manager (G_OBJECT (parent));
- if (manager != NULL)
- {
- return manager;
- }
- }
-
- /* Check for undo manager in our window's parent. */
- if (GTK_IS_WINDOW (start_object))
- {
- transient_parent = gtk_window_get_transient_for (GTK_WINDOW (start_object));
- if (transient_parent != NULL)
- {
- manager = caja_undo_get_undo_manager (G_OBJECT (transient_parent));
- if (manager != NULL)
- {
- return manager;
- }
- }
- }
- }
-
- /* Found nothing. I can live with that. */
- return NULL;
-}
-
-void
-caja_undo_attach_undo_manager (GObject *object,
- CajaUndoManager *manager)
-{
- g_return_if_fail (G_IS_OBJECT (object));
-
- if (manager == NULL)
- {
- g_object_set_data (object, CAJA_UNDO_MANAGER_DATA, NULL);
- }
- else
- {
- g_object_ref (manager);
- g_object_set_data_full
- (object, CAJA_UNDO_MANAGER_DATA,
- manager, g_object_unref);
- }
-}
-
-/* Copy a reference to the undo manager fromone object to another. */
-void
-caja_undo_share_undo_manager (GObject *destination_object,
- GObject *source_object)
-{
- CajaUndoManager *manager;
-
- manager = caja_undo_get_undo_manager (source_object);
- caja_undo_attach_undo_manager (destination_object, manager);
-}
diff --git a/libcaja-private/caja-undo.h b/libcaja-private/caja-undo.h
deleted file mode 100644
index f68335e1..00000000
--- a/libcaja-private/caja-undo.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* caja-undo.h - public interface for objects that implement
- * undoable actions -- works across components
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Darin Adler <[email protected]>
- */
-
-#ifndef CAJA_UNDO_H
-#define CAJA_UNDO_H
-
-#include <glib-object.h>
-
-typedef struct _CajaUndoTransaction CajaUndoTransaction;
-
-
-/* The basic undoable operation. */
-typedef void (* CajaUndoCallback) (GObject *target, gpointer callback_data);
-
-/* Recipe for undo of a bit of work on an object.
- * Create these atoms when you want to register more
- * than one as a single undoable operation.
- */
-typedef struct
-{
- GObject *target;
- CajaUndoCallback callback;
- gpointer callback_data;
- GDestroyNotify callback_data_destroy_notify;
-} CajaUndoAtom;
-
-/* Registering something that can be undone. */
-void caja_undo_register (GObject *target,
- CajaUndoCallback callback,
- gpointer callback_data,
- GDestroyNotify callback_data_destroy_notify,
- const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint);
-void caja_undo_register_full (GList *atoms,
- GObject *undo_manager_search_start_object,
- const char *operation_name,
- const char *undo_menu_item_label,
- const char *undo_menu_item_hint,
- const char *redo_menu_item_label,
- const char *redo_menu_item_hint);
-void caja_undo_unregister (GObject *target);
-
-/* Performing an undo explicitly. Only for use by objects "out in the field".
- * The menu bar itself uses a richer API in the undo manager.
- */
-void caja_undo (GObject *undo_manager_search_start_object);
-
-/* Connecting an undo manager. */
-void caja_undo_share_undo_manager (GObject *destination_object,
- GObject *source_object);
-
-#endif /* CAJA_UNDO_H */