2008-02-29 Cosimo Cecchi <cosimoc@gnome.org>
[nautilus.git] / libnautilus-private / nautilus-undo.h
blobd1ad1355e012cb675ab2be7cea9cf0d8cc0e282d
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 /* nautilus-undo.h - public interface for objects that implement
4 * undoable actions -- works across components
6 * Copyright (C) 2000 Eazel, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
23 * Author: Darin Adler <darin@bentspoon.com>
26 #ifndef NAUTILUS_UNDO_H
27 #define NAUTILUS_UNDO_H
29 #include <glib-object.h>
31 typedef struct _NautilusUndoTransaction NautilusUndoTransaction;
34 /* The basic undoable operation. */
35 typedef void (* NautilusUndoCallback) (GObject *target, gpointer callback_data);
37 /* Recipe for undo of a bit of work on an object.
38 * Create these atoms when you want to register more
39 * than one as a single undoable operation.
41 typedef struct {
42 GObject *target;
43 NautilusUndoCallback callback;
44 gpointer callback_data;
45 GDestroyNotify callback_data_destroy_notify;
46 } NautilusUndoAtom;
48 /* Registering something that can be undone. */
49 void nautilus_undo_register (GObject *target,
50 NautilusUndoCallback callback,
51 gpointer callback_data,
52 GDestroyNotify callback_data_destroy_notify,
53 const char *operation_name,
54 const char *undo_menu_item_label,
55 const char *undo_menu_item_hint,
56 const char *redo_menu_item_label,
57 const char *redo_menu_item_hint);
58 void nautilus_undo_register_full (GList *atoms,
59 GObject *undo_manager_search_start_object,
60 const char *operation_name,
61 const char *undo_menu_item_label,
62 const char *undo_menu_item_hint,
63 const char *redo_menu_item_label,
64 const char *redo_menu_item_hint);
65 void nautilus_undo_unregister (GObject *target);
67 /* Performing an undo explicitly. Only for use by objects "out in the field".
68 * The menu bar itself uses a richer API in the undo manager.
70 void nautilus_undo (GObject *undo_manager_search_start_object);
72 /* Connecting an undo manager. */
73 void nautilus_undo_share_undo_manager (GObject *destination_object,
74 GObject *source_object);
76 #endif /* NAUTILUS_UNDO_H */