diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | components/notes/nautilus-notes.c | 13 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-undo-signal-handlers.c | 5 | ||||
-rw-r--r-- | libnautilus-private/nautilus-undo-signal-handlers.c | 5 |
4 files changed, 35 insertions, 7 deletions
@@ -1,3 +1,22 @@ +2000-08-23 Gene Z. Ragan <gzr@eazel.com> + + Fixed bug 2282, Undo menu item initially sensitive, but + nothing to undo. + + * components/notes/nautilus-notes.c: (finish_loading_note), + (notes_load_location), (make_notes_view): + Disconnect the editable object form the undo manager + while location is being changed so an undo transaction + is not registered during inital text loading. + + * libnautilus-extensions/nautilus-undo-signal-handlers.c: + (nautilus_undo_teardown_nautilus_entry_for_undo), + (nautilus_undo_setup_editable_for_undo), + (nautilus_undo_teardown_editable_for_undo): + When a teardown function is called, also unregister the + GtkObject from the undo manager in addtion to signal + disconnection. + 2000-08-23 Darin Adler <darin@eazel.com> * libnautilus-extensions/nautilus-file-utilities.c: diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c index e2cc0fe19..6fd1657d0 100644 --- a/components/notes/nautilus-notes.c +++ b/components/notes/nautilus-notes.c @@ -71,7 +71,9 @@ finish_loading_note (NautilusFile *file, notes_text, strlen (notes_text), &position); - g_free (notes_text); + g_free (notes_text); + + nautilus_undo_setup_editable_for_undo (GTK_EDITABLE (notes->note_text_field)); } static void @@ -116,6 +118,7 @@ notes_load_location (NautilusView *view, Notes *notes) { if (strcmp (notes->uri, location) != 0) { + nautilus_undo_teardown_editable_for_undo (GTK_EDITABLE (notes->note_text_field)); notes_save_metainfo (notes); g_free (notes->uri); notes->uri = g_strdup (location); @@ -165,10 +168,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl notes->view = nautilus_view_new (vbox); gtk_signal_connect (GTK_OBJECT (notes->view), "destroy", do_destroy, notes); - /* Setup up text field for undo */ - nautilus_undo_setup_editable_for_undo (GTK_EDITABLE (notes->note_text_field)); - nautilus_undo_editable_set_undo_key (GTK_EDITABLE (notes->note_text_field), TRUE); - notes_object_count++; /* handle events */ @@ -180,6 +179,10 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl (GTK_EDITABLE (notes->note_text_field), nautilus_view_get_bonobo_control (notes->view)); + /* Setup up text field for undo */ + nautilus_undo_setup_editable_for_undo (GTK_EDITABLE (notes->note_text_field)); + nautilus_undo_editable_set_undo_key (GTK_EDITABLE (notes->note_text_field), TRUE); + return BONOBO_OBJECT (notes->view); } diff --git a/libnautilus-extensions/nautilus-undo-signal-handlers.c b/libnautilus-extensions/nautilus-undo-signal-handlers.c index 352a556bb..3f4cb3dac 100644 --- a/libnautilus-extensions/nautilus-undo-signal-handlers.c +++ b/libnautilus-extensions/nautilus-undo-signal-handlers.c @@ -97,6 +97,8 @@ nautilus_undo_teardown_nautilus_entry_for_undo (NautilusEntry *entry) gtk_signal_disconnect_by_func (GTK_OBJECT (entry), GTK_SIGNAL_FUNC (nautilus_entry_user_changed_callback), NULL); + + nautilus_undo_unregister (GTK_OBJECT (entry)); } /* nautilus_undo_setup_nautilus_entry_for_undo @@ -201,7 +203,7 @@ nautilus_undo_setup_editable_for_undo (GtkEditable *editable) NULL); - data = g_new(EditableUndoObjectData, 1); + data = g_new (EditableUndoObjectData, 1); data->undo_registered = FALSE; gtk_object_set_data_full (GTK_OBJECT (editable), "undo_registered", data, free_editable_object_data); @@ -223,6 +225,7 @@ nautilus_undo_teardown_editable_for_undo (GtkEditable *editable) GTK_SIGNAL_FUNC (editable_delete_text_callback), NULL); + nautilus_undo_unregister (GTK_OBJECT (editable)); } /* restore_editable_from_undo_snapshot_callback diff --git a/libnautilus-private/nautilus-undo-signal-handlers.c b/libnautilus-private/nautilus-undo-signal-handlers.c index 352a556bb..3f4cb3dac 100644 --- a/libnautilus-private/nautilus-undo-signal-handlers.c +++ b/libnautilus-private/nautilus-undo-signal-handlers.c @@ -97,6 +97,8 @@ nautilus_undo_teardown_nautilus_entry_for_undo (NautilusEntry *entry) gtk_signal_disconnect_by_func (GTK_OBJECT (entry), GTK_SIGNAL_FUNC (nautilus_entry_user_changed_callback), NULL); + + nautilus_undo_unregister (GTK_OBJECT (entry)); } /* nautilus_undo_setup_nautilus_entry_for_undo @@ -201,7 +203,7 @@ nautilus_undo_setup_editable_for_undo (GtkEditable *editable) NULL); - data = g_new(EditableUndoObjectData, 1); + data = g_new (EditableUndoObjectData, 1); data->undo_registered = FALSE; gtk_object_set_data_full (GTK_OBJECT (editable), "undo_registered", data, free_editable_object_data); @@ -223,6 +225,7 @@ nautilus_undo_teardown_editable_for_undo (GtkEditable *editable) GTK_SIGNAL_FUNC (editable_delete_text_callback), NULL); + nautilus_undo_unregister (GTK_OBJECT (editable)); } /* restore_editable_from_undo_snapshot_callback |