summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-undo.h
blob: d1ad1355e012cb675ab2be7cea9cf0d8cc0e282d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: Darin Adler <darin@bentspoon.com>
 */

#ifndef NAUTILUS_UNDO_H
#define NAUTILUS_UNDO_H

#include <glib-object.h>

typedef struct _NautilusUndoTransaction NautilusUndoTransaction;


/* The basic undoable operation. */
typedef void (* NautilusUndoCallback) (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;
	NautilusUndoCallback callback;
	gpointer callback_data;
	GDestroyNotify callback_data_destroy_notify;
} NautilusUndoAtom;

/* Registering something that can be undone. */
void nautilus_undo_register              (GObject              *target,
					  NautilusUndoCallback  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 nautilus_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 nautilus_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 nautilus_undo                       (GObject              *undo_manager_search_start_object);

/* Connecting an undo manager. */
void nautilus_undo_share_undo_manager    (GObject              *destination_object,
					  GObject              *source_object);

#endif /* NAUTILUS_UNDO_H */