Commit 7e7fc3ec authored by Darin Adler's avatar Darin Adler
Browse files

Change format to make popt "pop" out more.

	* HACKING: Change format to make popt "pop" out more.

	* libnautilus-extensions/nautilus-entry.h:
	* src/file-manager/fm-properties-window.c: (create_basic_page):
	* src/nautilus-bookmarks-window.c: (on_text_field_focus_in_event),
	(on_window_delete_event):
	* src/nautilus-location-bar.c: (nautilus_location_bar_enable_undo):
	* src/nautilus-location-bar.h:
	* src/nautilus-window-menus.c: (edit_menu_undo_callback),
	(bookmarks_menu_add_bookmark_callback),
	(bookmarks_menu_edit_bookmarks_callback),
	(get_or_create_bookmarks_window), (nautilus_bookmarks_exiting),
	(edit_bookmarks), (nautilus_window_initialize_menus),
	(update_undo_menu_item):
	* src/ntl-app.c: (nautilus_app_init), (nautilus_app_destroy):
	* libnautilus-extensions/nautilus-icon-container.c:
	(nautilus_icon_container_start_renaming_selected_item):
	* libnautilus-extensions/nautilus-entry.c:
	(nautilus_entry_key_press), (nautilus_entry_enable_undo):
	* libnautilus/nautilus-undo-manager.c:
	(nautilus_undo_manager_begin_transaction),
	(nautilus_undo_manager_unregister_object),
	(prune_undo_manager_list), (nautilus_get_undo_manager),
	(nautilus_attach_undo_manager), (nautilus_share_undo_manager):
	* libnautilus/nautilus-undo-manager.h:
	* src/ntl-window-private.h:
	* src/ntl-window.c: (nautilus_window_constructed),
	(nautilus_window_real_set_content_view),
	(nautilus_window_get_undo_manager):
	* src/ntl-window.h:
	Got rid of the undo manager parameter for the enable_undo
	operation.
	Eliminated code that sets up the undo manager except for the top
	widgets. We only need it attached to windows and to the top widget
	in each component.
	Change callers to get the undo manager in a few simple ways
	instead of calling gtk_object_get_data directly. Added some calls
	to attach the undo manager to an arbitrary object.

	* libnautilus/nautilus-undo.idl: Added comments to the IDL and
	also added the Undo::Context class.

	* libnautilus/nautilus-view-component.idl: Removed the dependency
	on the undo IDL and the undo_manager attribute.

	* src/nautilus-bookmarks-window.h:
	* src/nautilus-bookmarks-window.c: (create_bookmarks_window):
	Changed interface to take object to inherit the undo manager from
	instead of the undo manager itself. Got rid of unnecesary undo
	manager setting.
	(nautilus_bookmarks_window_save_geometry): Also changed interface
	to use GtkWindow instead of GtkWidget.
parent 4b5995ac
2000-05-18 Darin Adler <darin@eazel.com>
* HACKING: Change format to make popt "pop" out more.
* libnautilus-extensions/nautilus-entry.h:
* src/file-manager/fm-properties-window.c: (create_basic_page):
* src/nautilus-bookmarks-window.c: (on_text_field_focus_in_event),
(on_window_delete_event):
* src/nautilus-location-bar.c: (nautilus_location_bar_enable_undo):
* src/nautilus-location-bar.h:
* src/nautilus-window-menus.c: (edit_menu_undo_callback),
(bookmarks_menu_add_bookmark_callback),
(bookmarks_menu_edit_bookmarks_callback),
(get_or_create_bookmarks_window), (nautilus_bookmarks_exiting),
(edit_bookmarks), (nautilus_window_initialize_menus),
(update_undo_menu_item):
* src/ntl-app.c: (nautilus_app_init), (nautilus_app_destroy):
* libnautilus-extensions/nautilus-icon-container.c:
(nautilus_icon_container_start_renaming_selected_item):
* libnautilus-extensions/nautilus-entry.c:
(nautilus_entry_key_press), (nautilus_entry_enable_undo):
* libnautilus/nautilus-undo-manager.c:
(nautilus_undo_manager_begin_transaction),
(nautilus_undo_manager_unregister_object),
(prune_undo_manager_list), (nautilus_get_undo_manager),
(nautilus_attach_undo_manager), (nautilus_share_undo_manager):
* libnautilus/nautilus-undo-manager.h:
* src/ntl-window-private.h:
* src/ntl-window.c: (nautilus_window_constructed),
(nautilus_window_real_set_content_view),
(nautilus_window_get_undo_manager):
* src/ntl-window.h:
Got rid of the undo manager parameter for the enable_undo
operation.
Eliminated code that sets up the undo manager except for the top
widgets. We only need it attached to windows and to the top widget
in each component.
Change callers to get the undo manager in a few simple ways
instead of calling gtk_object_get_data directly. Added some calls
to attach the undo manager to an arbitrary object.
* libnautilus/nautilus-undo.idl: Added comments to the IDL and
also added the Undo::Context class.
* libnautilus/nautilus-view-component.idl: Removed the dependency
on the undo IDL and the undo_manager attribute.
* src/nautilus-bookmarks-window.h:
* src/nautilus-bookmarks-window.c: (create_bookmarks_window):
Changed interface to take object to inherit the undo manager from
instead of the undo manager itself. Got rid of unnecesary undo
manager setting.
(nautilus_bookmarks_window_save_geometry): Also changed interface
to use GtkWindow instead of GtkWidget.
2000-05-18 John Sullivan <sullivan@eazel.com>
Added the ability to switch sort order in Icons view. Note
......
......@@ -14,36 +14,37 @@ Specifically, you will need to:
Nautilus currently requires the following modules from GNOME CVS
(built in the given order):
module branch configure options
------ ------ -----------------
glib: glib-1-2
gtk+: gtk-1-2
imlib: HEAD
gnome-xml: LIB_XML_1_X
ORBit: orbit-stable-0-5
gnome-libs: gnome-libs-1-0 --enable-prefer-db1
gnet: HEAD
gnome-http: HEAD
oaf: HEAD
gconf: HEAD
gdk-pixbuf: HEAD --enable-canvas-pixbuf
gnome-print: HEAD
bonobo: HEAD --enable-oaf=yes
gnome-vfs: HEAD --enable-oaf=yes
gtkhtml: HEAD
eog: HEAD --enable-oaf=yes
xpdf: HEAD
module branch configure options
------ ------ -----------------
glib: glib-1-2
gtk+: gtk-1-2
imlib: HEAD
gnome-xml: LIB_XML_1_X
ORBit: orbit-stable-0-5
gnome-libs: gnome-libs-1-0 --enable-prefer-db1
gnet: HEAD
gnome-http: HEAD
oaf: HEAD
gconf: HEAD
gdk-pixbuf: HEAD --enable-canvas-pixbuf
gnome-print: HEAD
bonobo: HEAD --enable-oaf=yes
gnome-vfs: HEAD --enable-oaf=yes
gtkhtml: HEAD
eog: HEAD --enable-oaf=yes
xpdf: HEAD
popt: <need 1.5, but not from GNOME CVS, see below>
Other modules for Red Hat users:
- For other modules, the versions in Red Hat 6.1 will do.
- ORBit requires popt-1.5, which can be fetched from:
- For other modules, the versions in Red Hat 6.1 will do.
- ORBit requires popt-1.5, which can be fetched from:
ftp://ftp.valinux.com/pub/mirrors/redhat/rawhide/i386/RedHat/RPMS/popt-1.5-0.45.i386.rpm
Other modules for Debian users (we haven't tried this ourselves):
Other modules for Debian users (Eazel hackers haven't tried this ourselves):
- You'll need libwww, which can be found at:
- You'll need libwww, which can be found at:
ftp://ftp.internatif.org/pub/debian/UNOFFICIAL/libw3c-libwww5_5.2.8-1_i386.deb
ftp://ftp.internatif.org/pub/debian/UNOFFICIAL/libw3c-libwww-dev_5.2.8-1_i386.deb
......
......@@ -36,6 +36,8 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libnautilus/nautilus-undo-manager.h>
static void nautilus_entry_initialize (NautilusEntry *entry);
static void nautilus_entry_initialize_class (NautilusEntryClass *class);
static void nautilus_entry_destroy (GtkObject *object);
......@@ -120,10 +122,7 @@ nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event)
case 'z':
if (event->state & GDK_CONTROL_MASK && entry->use_undo == TRUE
&& entry->handle_undo_key == TRUE) {
NautilusUndoManager *undo_manager;
undo_manager = gtk_object_get_data ( GTK_OBJECT (entry), NAUTILUS_UNDO_MANAGER_NAME);
g_assert (undo_manager);
nautilus_undo_manager_undo (undo_manager);
nautilus_undo_manager_undo (nautilus_get_undo_manager (GTK_OBJECT (widget)));
return FALSE;
}
break;
......@@ -273,7 +272,7 @@ restore_from_undo_snapshot_callback (NautilusUndoable *undoable)
* Enable undo mechanism in entry item.
*/
void
nautilus_entry_enable_undo (NautilusEntry *entry, NautilusUndoManager *manager, gboolean value)
nautilus_entry_enable_undo (NautilusEntry *entry, gboolean value)
{
g_assert (entry);
g_assert (NAUTILUS_IS_ENTRY (entry));
......@@ -282,12 +281,8 @@ nautilus_entry_enable_undo (NautilusEntry *entry, NautilusUndoManager *manager,
entry->use_undo = value;
if (!entry->undo_registered) {
gtk_object_set_data ( GTK_OBJECT(entry), NAUTILUS_UNDO_MANAGER_NAME, manager);
/* Get copy of entry text */
if (entry->undo_text != NULL) {
g_free (entry->undo_text);
}
g_free (entry->undo_text);
entry->undo_text = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
}
}
......
......@@ -29,7 +29,6 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkentry.h>
#include <libnautilus/nautilus-undo-manager.h>
BEGIN_GNOME_DECLS
......@@ -60,16 +59,14 @@ struct NautilusEntryClass {
GtkEntryClass parent_class;
};
GtkType nautilus_entry_get_type (void);
GtkWidget* nautilus_entry_new (void);
void nautilus_entry_select_all (NautilusEntry *entry);
void nautilus_entry_select_all_at_idle (NautilusEntry *entry);
void nautilus_entry_enable_undo (NautilusEntry *entry,
NautilusUndoManager *manager,
gboolean value);
void nautilus_entry_enable_undo_key (NautilusEntry *entry, gboolean value);
GtkType nautilus_entry_get_type (void);
GtkWidget* nautilus_entry_new (void);
void nautilus_entry_select_all (NautilusEntry *entry);
void nautilus_entry_select_all_at_idle (NautilusEntry *entry);
void nautilus_entry_enable_undo (NautilusEntry *entry,
gboolean value);
void nautilus_entry_enable_undo_key (NautilusEntry *entry,
gboolean value);
END_GNOME_DECLS
......
......@@ -3453,8 +3453,6 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
{
NautilusIconContainerDetails *details;
NautilusIcon *icon;
GtkWidget *toplevel;
NautilusUndoManager *manager;
ArtIRect text_rect;
ArtDRect icon_rect;
GdkFont *font;
......@@ -3489,11 +3487,6 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
nautilus_icon_text_item_get_type (),
NULL));
/* Add undo manager */
toplevel = gtk_widget_get_toplevel ( GTK_WIDGET (container));
manager = gtk_object_get_data ( GTK_OBJECT (toplevel), NAUTILUS_UNDO_MANAGER_NAME);
gtk_object_set_data ( GTK_OBJECT (details->rename_widget), NAUTILUS_UNDO_MANAGER_NAME, manager);
/* Determine widget position widget in container */
font = details->label_font[details->zoom_level];
ppu = GNOME_CANVAS_ITEM (icon->item)->canvas->pixels_per_unit;
......
......@@ -52,7 +52,6 @@ typedef struct {
NautilusUndoManager *gtk_object;
} impl_POA_Nautilus_Undo_Manager;
/* GtkObject */
static void nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *class);
static void nautilus_undo_manager_initialize (NautilusUndoManager *item);
......@@ -214,7 +213,6 @@ nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *klass)
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
/* nautilus_undo_manager_begin_transaction */
NautilusUndoTransactionInProgress *
nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
......@@ -222,9 +220,12 @@ nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
NautilusUndoManager *manager;
NautilusUndoTransactionInProgress *tip;
/* Locate undo manager */
manager = gtk_object_get_data (object, NAUTILUS_UNDO_MANAGER_NAME);
g_return_val_if_fail (manager != NULL, NULL);
/* 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);
/* We aren't handling nested transactions currently */
if (manager->details->transaction_in_progress) {
......@@ -375,11 +376,17 @@ nautilus_undo_manager_unregister_object (GtkObject *object)
GList *list;
int index, length;
success = FALSE;
/* 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.
* Also there's no reason to assume that this object will have the
* right one.
*/
manager = nautilus_get_undo_manager (object);
if (manager == NULL) {
return FALSE;
}
/* Locate undo manager */
manager = gtk_object_get_data (object, NAUTILUS_UNDO_MANAGER_NAME);
g_return_val_if_fail (manager != NULL, success);
success = FALSE;
/* Check undo list */
length = g_list_length (manager->details->undo_list);
......@@ -631,3 +638,89 @@ prune_undo_manager_list (GList *list, gint items)
return list;
}
/* FIXME: This should return a Nautilus_Undo_Manager in the long run.
* And it's more likely that we'll want this in the transaction code
* than in here so it will probably be moved.
*/
NautilusUndoManager *
nautilus_get_undo_manager (GtkObject *start_object)
{
NautilusUndoManager *manager;
GtkWidget *parent;
GtkWindow *transient_parent;
if (start_object == NULL) {
return NULL;
}
g_return_val_if_fail (GTK_IS_OBJECT (start_object), NULL);
/* Check for an undo manager right here. */
manager = gtk_object_get_data (start_object, "Nautilus undo");
if (manager != NULL) {
g_assert (NAUTILUS_IS_UNDO_MANAGER (manager));
return manager;
}
/* Check for undo manager up the parent chain. */
if (GTK_IS_WIDGET (start_object)) {
parent = GTK_WIDGET (start_object)->parent;
if (parent != NULL) {
manager = nautilus_get_undo_manager (GTK_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 (start_object)->transient_parent;
manager = nautilus_get_undo_manager (GTK_OBJECT (transient_parent));
if (manager != NULL) {
return manager;
}
}
}
/* In the case of a canvas item, try the canvas. */
if (GNOME_IS_CANVAS_ITEM (start_object)) {
manager = nautilus_get_undo_manager (GTK_OBJECT (GNOME_CANVAS_ITEM (start_object)->canvas));
if (manager != NULL) {
return manager;
}
}
/* Found nothing. I can live with that. */
return NULL;
}
void
nautilus_attach_undo_manager (GtkObject *object,
NautilusUndoManager *manager)
{
g_return_if_fail (GTK_IS_OBJECT (object));
if (manager == NULL) {
gtk_object_remove_data (object, "Nautilus undo");
}
g_return_if_fail (NAUTILUS_IS_UNDO_MANAGER (manager));
bonobo_object_ref (BONOBO_OBJECT (manager));
gtk_object_set_data_full
(object, "Nautilus undo",
manager, (GtkDestroyNotify) bonobo_object_unref);
}
/* This is useful because nautilus_get_undo_manager will be
* private one day.
*/
void
nautilus_share_undo_manager (GtkObject *destination_object,
GtkObject *source_object)
{
nautilus_attach_undo_manager
(destination_object,
nautilus_get_undo_manager (source_object));
}
......@@ -63,8 +63,6 @@ struct NautilusUndoTransactionInProgress {
};
#define NAUTILUS_UNDO_MANAGER_NAME "NautilusUndoManager"
/* GtkObject */
GtkType nautilus_undo_manager_get_type (void);
NautilusUndoManager *nautilus_undo_manager_new (void);
......@@ -87,9 +85,16 @@ 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,
NautilusUndoManager *manager);
void nautilus_share_undo_manager (GtkObject *destination_object,
GtkObject *source_object);
gboolean nautilus_undo_manager_unregister_object (GtkObject *object);
/* FIXME: This should return a Nautilus_Undo_Manager in the long run.
* And it should not be a public function.
*/
NautilusUndoManager * nautilus_get_undo_manager (GtkObject *start_object);
#endif
......@@ -36,6 +36,8 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libnautilus/nautilus-undo-manager.h>
static void nautilus_entry_initialize (NautilusEntry *entry);
static void nautilus_entry_initialize_class (NautilusEntryClass *class);
static void nautilus_entry_destroy (GtkObject *object);
......@@ -120,10 +122,7 @@ nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event)
case 'z':
if (event->state & GDK_CONTROL_MASK && entry->use_undo == TRUE
&& entry->handle_undo_key == TRUE) {
NautilusUndoManager *undo_manager;
undo_manager = gtk_object_get_data ( GTK_OBJECT (entry), NAUTILUS_UNDO_MANAGER_NAME);
g_assert (undo_manager);
nautilus_undo_manager_undo (undo_manager);
nautilus_undo_manager_undo (nautilus_get_undo_manager (GTK_OBJECT (widget)));
return FALSE;
}
break;
......@@ -273,7 +272,7 @@ restore_from_undo_snapshot_callback (NautilusUndoable *undoable)
* Enable undo mechanism in entry item.
*/
void
nautilus_entry_enable_undo (NautilusEntry *entry, NautilusUndoManager *manager, gboolean value)
nautilus_entry_enable_undo (NautilusEntry *entry, gboolean value)
{
g_assert (entry);
g_assert (NAUTILUS_IS_ENTRY (entry));
......@@ -282,12 +281,8 @@ nautilus_entry_enable_undo (NautilusEntry *entry, NautilusUndoManager *manager,
entry->use_undo = value;
if (!entry->undo_registered) {
gtk_object_set_data ( GTK_OBJECT(entry), NAUTILUS_UNDO_MANAGER_NAME, manager);
/* Get copy of entry text */
if (entry->undo_text != NULL) {
g_free (entry->undo_text);
}
g_free (entry->undo_text);
entry->undo_text = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
}
}
......
......@@ -29,7 +29,6 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkentry.h>
#include <libnautilus/nautilus-undo-manager.h>
BEGIN_GNOME_DECLS
......@@ -60,16 +59,14 @@ struct NautilusEntryClass {
GtkEntryClass parent_class;
};
GtkType nautilus_entry_get_type (void);
GtkWidget* nautilus_entry_new (void);
void nautilus_entry_select_all (NautilusEntry *entry);
void nautilus_entry_select_all_at_idle (NautilusEntry *entry);
void nautilus_entry_enable_undo (NautilusEntry *entry,
NautilusUndoManager *manager,
gboolean value);
void nautilus_entry_enable_undo_key (NautilusEntry *entry, gboolean value);
GtkType nautilus_entry_get_type (void);
GtkWidget* nautilus_entry_new (void);
void nautilus_entry_select_all (NautilusEntry *entry);
void nautilus_entry_select_all_at_idle (NautilusEntry *entry);
void nautilus_entry_enable_undo (NautilusEntry *entry,
gboolean value);
void nautilus_entry_enable_undo_key (NautilusEntry *entry,
gboolean value);
END_GNOME_DECLS
......
......@@ -3453,8 +3453,6 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
{
NautilusIconContainerDetails *details;
NautilusIcon *icon;
GtkWidget *toplevel;
NautilusUndoManager *manager;
ArtIRect text_rect;
ArtDRect icon_rect;
GdkFont *font;
......@@ -3489,11 +3487,6 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
nautilus_icon_text_item_get_type (),
NULL));
/* Add undo manager */
toplevel = gtk_widget_get_toplevel ( GTK_WIDGET (container));
manager = gtk_object_get_data ( GTK_OBJECT (toplevel), NAUTILUS_UNDO_MANAGER_NAME);
gtk_object_set_data ( GTK_OBJECT (details->rename_widget), NAUTILUS_UNDO_MANAGER_NAME, manager);
/* Determine widget position widget in container */
font = details->label_font[details->zoom_level];
ppu = GNOME_CANVAS_ITEM (icon->item)->canvas->pixels_per_unit;
......
......@@ -52,7 +52,6 @@ typedef struct {
NautilusUndoManager *gtk_object;
} impl_POA_Nautilus_Undo_Manager;
/* GtkObject */
static void nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *class);
static void nautilus_undo_manager_initialize (NautilusUndoManager *item);
......@@ -214,7 +213,6 @@ nautilus_undo_manager_initialize_class (NautilusUndoManagerClass *klass)
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
/* nautilus_undo_manager_begin_transaction */
NautilusUndoTransactionInProgress *
nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
......@@ -222,9 +220,12 @@ nautilus_undo_manager_begin_transaction (GtkObject *object, const gchar *name)
NautilusUndoManager *manager;
NautilusUndoTransactionInProgress *tip;
/* Locate undo manager */
manager = gtk_object_get_data (object, NAUTILUS_UNDO_MANAGER_NAME);
g_return_val_if_fail (manager != NULL, NULL);
/* 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);
/* We aren't handling nested transactions currently */
if (manager->details->transaction_in_progress) {
......@@ -375,11 +376,17 @@ nautilus_undo_manager_unregister_object (GtkObject *object)
GList *list;
int index, length;
success = FALSE;
/* 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.
* Also there's no reason to assume that this object will have the
* right one.
*/
manager = nautilus_get_undo_manager (object);
if (manager == NULL) {
return FALSE;
}
/* Locate undo manager */
manager = gtk_object_get_data (object, NAUTILUS_UNDO_MANAGER_NAME);
g_return_val_if_fail (manager != NULL, success);
success = FALSE;
/* Check undo list */
length = g_list_length (manager->details->undo_list);
......@@ -631,3 +638,89 @@ prune_undo_manager_list (GList *list, gint items)
return list;
}
/* FIXME: This should return a Nautilus_Undo_Manager in the long run.
* And it's more likely that we'll want this in the transaction code
* than in here so it will probably be moved.
*/
NautilusUndoManager *
nautilus_get_undo_manager (GtkObject *start_object)
{
NautilusUndoManager *manager;
GtkWidget *parent;
GtkWindow *transient_parent;
if (start_object == NULL) {
return NULL;
}
g_return_val_if_fail (GTK_IS_OBJECT (start_object), NULL);
/* Check for an undo manager right here. */
manager = gtk_object_get_data (start_object, "Nautilus undo");
if (manager != NULL) {
g_assert (NAUTILUS_IS_UNDO_MANAGER (manager));
return manager;
}
/* Check for undo manager up the parent chain. */
if (GTK_IS_WIDGET (start_object)) {
parent = GTK_WIDGET (start_object)->parent;
if (parent != NULL) {
manager = nautilus_get_undo_manager (GTK_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 (start_object)->transient_parent;
manager = nautilus_get_undo_manager (GTK_OBJECT (transient_parent));
if (manager != NULL) {
return manager;
}
}
}
/* In the case of a canvas item, try the canvas. */
if (GNOME_IS_CANVAS_ITEM (start_object)) {
manager = nautilus_get_undo_manager (GTK_OBJECT (GNOME_CANVAS_ITEM (start_object)->canvas));
if (manager != NULL) {
return manager;
}
}
/* Found nothing. I can live with that. */
return NULL;
}
void
nautilus_attach_undo_manager (GtkObject *object,
NautilusUndoManager *manager)
{
g_return_if_fail (GTK_IS_OBJECT (object));
if (manager == NULL) {
gtk_object_remove_data (object, "Nautilus undo");