diff options
author | Darin Adler <darin@src.gnome.org> | 2000-05-18 22:31:58 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-05-18 22:31:58 +0000 |
commit | 7e7fc3ecf236e3a2ae3cb12d02bad11e04e27826 (patch) | |
tree | c0d8d4b1337836a317ae364cae412a8a16291c58 /src/nautilus-bookmarks-window.c | |
parent | 4b5995ac28e8ca8b6b23c1464c077f115b5af734 (diff) | |
download | nautilus-7e7fc3ecf236e3a2ae3cb12d02bad11e04e27826.tar.gz |
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.
Diffstat (limited to 'src/nautilus-bookmarks-window.c')
-rw-r--r-- | src/nautilus-bookmarks-window.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c index bbdf92c2b..0821c4a0c 100644 --- a/src/nautilus-bookmarks-window.c +++ b/src/nautilus-bookmarks-window.c @@ -27,6 +27,8 @@ #include <libnautilus/nautilus-undo-manager.h> #include <libnautilus-extensions/nautilus-entry.h> #include <libnautilus-extensions/nautilus-icon-factory.h> +#include <gnome.h> + /* Static variables to keep track of window state. If there were * more than one bookmark-editing window, these would be struct or @@ -107,8 +109,8 @@ static void repopulate (void); * * Return value: A pointer to the new window. **/ -GtkWidget * -create_bookmarks_window (NautilusBookmarkList *list, NautilusUndoManager *manager) +GtkWindow * +create_bookmarks_window (NautilusBookmarkList *list, GtkObject *undo_manager_source) { GtkWidget *window; GtkWidget *content_area; @@ -123,6 +125,7 @@ create_bookmarks_window (NautilusBookmarkList *list, NautilusUndoManager *manage bookmarks = list; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + nautilus_share_undo_manager (GTK_OBJECT (window), undo_manager_source); gtk_container_set_border_width (GTK_CONTAINER (window), GNOME_PAD); gtk_window_set_title (GTK_WINDOW (window), _("Nautilus: Bookmarks")); gtk_widget_set_usize (window, @@ -191,12 +194,6 @@ create_bookmarks_window (NautilusBookmarkList *list, NautilusUndoManager *manage gtk_widget_show (remove_button); gtk_box_pack_start (GTK_BOX (hbox2), remove_button, TRUE, FALSE, 0); - - /* Add undo manager to widgets */ - g_assert (manager); - gtk_object_set_data ( GTK_OBJECT (name_field), NAUTILUS_UNDO_MANAGER_NAME, manager); - gtk_object_set_data ( GTK_OBJECT (uri_field), NAUTILUS_UNDO_MANAGER_NAME, manager); - /* Wire up all the signals. */ bookmark_list_changed_signalID = gtk_signal_connect (GTK_OBJECT(bookmarks), "contents_changed", @@ -267,7 +264,7 @@ create_bookmarks_window (NautilusBookmarkList *list, NautilusUndoManager *manage /* Fill in list widget with bookmarks, must be after signals are wired up. */ repopulate(); - return window; + return GTK_WINDOW (window); } static const NautilusBookmark * @@ -372,17 +369,16 @@ nautilus_bookmarks_window_restore_geometry (GtkWidget *window) * @window: The bookmarks window whose geometry should be saved. **/ void -nautilus_bookmarks_window_save_geometry (GtkWidget *window) +nautilus_bookmarks_window_save_geometry (GtkWindow *window) { g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks)); /* Don't bother if window is already closed */ - if (GTK_WIDGET_VISIBLE (window)) - { + if (GTK_WIDGET_VISIBLE (window)) { char *geometry_string; - geometry_string = gnome_geometry_string(window->window); + geometry_string = gnome_geometry_string (GTK_WIDGET (window)->window); nautilus_bookmark_list_set_window_geometry (bookmarks, geometry_string); g_free (geometry_string); } @@ -523,15 +519,11 @@ on_text_field_focus_in_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { - NautilusUndoManager *manager; - g_assert (NAUTILUS_IS_ENTRY (widget)); - manager = gtk_object_get_data ( GTK_OBJECT (widget), NAUTILUS_UNDO_MANAGER_NAME); - nautilus_entry_select_all (NAUTILUS_ENTRY (widget)); nautilus_entry_enable_undo_key (NAUTILUS_ENTRY(widget), TRUE); - nautilus_entry_enable_undo(NAUTILUS_ENTRY(widget), manager, TRUE); + nautilus_entry_enable_undo (NAUTILUS_ENTRY(widget), TRUE); return FALSE; } @@ -573,18 +565,18 @@ on_window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { - nautilus_bookmarks_window_save_geometry (widget); + nautilus_bookmarks_window_save_geometry (GTK_WINDOW (widget)); /* Hide but don't destroy */ gtk_widget_hide (widget); /* Disable undo for entry widgets*/ - nautilus_entry_enable_undo(NAUTILUS_ENTRY(name_field), NULL, FALSE); - nautilus_entry_enable_undo(NAUTILUS_ENTRY(uri_field), NULL, FALSE); + nautilus_entry_enable_undo (NAUTILUS_ENTRY (name_field), FALSE); + nautilus_entry_enable_undo (NAUTILUS_ENTRY (uri_field), FALSE); /* Remove object transactions from undo manager */ - nautilus_undo_manager_unregister_object(GTK_OBJECT(name_field)); - nautilus_undo_manager_unregister_object(GTK_OBJECT(uri_field)); + nautilus_undo_manager_unregister_object (GTK_OBJECT (name_field)); + nautilus_undo_manager_unregister_object (GTK_OBJECT (uri_field)); /* Seems odd to restore the geometry just after saving it, * and when the window is hidden, but this insures that |