2000-04-18 Gene Z. Ragan <gzr@eazel.com>
Added functionality to allow files to be renamed in icov view. This feature is
available by either context click on the icon or selecting a single file and choosing "Rename" form the File menu.
* libnautilus-extensions/nautilus-icon-text-item.c
* libnautilus-extensions/nautilus-icon-text-item.h: New files.
This is an editable icon text item used in the renaming feature.
It is based on GnomeIconTextItem but modified to fix bugs in the
original code and add extended functionality need by nautilus. If
thse changes were rolled into the current GnomeIconTextItem, it would
break gmc.
* libnautilus-extensions/Makefile.am
Modified file so that the two new files listed above would properly
be included in generated makefiles.
* libnautilus-extensions/nautilus-icon-canvas-item.c
Split text class variable into two variables, editable_text and
additonal_text. editable_text refers to attributes that the user can change
via rename in place. additional_text is any other text that the user cannot
edit via the rename in place feature. Added a boolean flag, is_renaming, to
check against during various operations that effect the renaming feature.
Removed ARG_TEXT argument ID and replaced with ARG_EDITABLE_TEXT and
ARG_ADDITIONAL_TEXT.
(nautilus_icon_canvas_item_initialize_class): Function now check for both
ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT. Removed check for ARG_TEXT.
(nautilus_icon_canvas_item_destroy): Both editable_text and
additonal_text are freed.
(nautilus_icon_canvas_item_set_arg): Removed ARG_TEXT and added
handling of ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT.
(nautilus_icon_canvas_item_get_arg): Removed ARG_TEXT and added
handling of ARG_EDITABLE_TEXT and ARG_ADDITIONAL_TEXT.
(draw_or_measure_label_text): Modified function to not draw the label
icon text if we are renaming in place.
(draw_or_measure_label_text): Function now combines editable and additional
text when performing the measuring operation.
(compute_editable_text_rectangle): Added function to compute bounds of
editable text. This is used to determine size and placement of editable
text item when in renaming mode.
(nautilus_icon_canvas_get_text_bounds): Public API to get bounds of
icon label text.
(nautilus_icon_canvas_get_editable_text_bounds): Public API to get bounds of
editable icon label text.
(hit_test_pixbuf): Added check against is_renaming flag.
(nautilus_icon_canvas_get_editable_text): Public API to get editable text string.
(nautilus_icon_canvas_item_set_renaming): Public API to toggle is_renaming flag.
* libnautilus-extensions/nautilus-icon-canvas-item.h
Added public API prototypes to functions described above.
* libnautilus-extensions/nautilus-icon-container.c
Added GET_ICON_EDITABLE_TEXT and GET_ICON_ADDITONAL_TEXT signals.
Removed GET_ICON_TEXT signal. Added ICON_TEXT_CHANGED signal.
(icon_toggle_selected): Renaming mode is now exited when a selection/deselection occurs.
(key_press_event): GDK_Return ends rename mode and attempts to accept modification. GDK_Escpae
ends rename mode and reverts modification to original.
(nautilus_icon_container_initialize_class): icon_text_changed, get_icon_editable_text and
get_icon_additional_text signals are registered.
(editing_started): New function. Called when an edit begins. Inits class member variables
for edit mode.
(editing_stopped): New function. Called when edit ends. Cleans up edit mode.
(nautilus_icon_container_initialize): rename_widget and original_text private variables
are set to NULL.
(icon_toggle_selected): Added call to end_renaming_mode.
(nautilus_icon_container_update_icon): Added emitting of GET_ICON_EDITABLE_TEXT and
GET_ICON_ADDITIONAL_TEXT signals. Updated gnome_canvas_item_set to use new arguments defined
in nautilus-icon-text-item.
(nautilus_icon_container_show_rename_widget): New function. Creates and displays renaming_widget.
Creates cached copy of original editable text for later compare, connects signals and enters
renaming mode.
(end_renaming_mode): New function. Cleans up and end renaiming mode.
(hide_rename_widget): Called by end_renaming_mode to hide and free renaming_widget.
* libnautilus-extensions/nautilus-icon-container.h
Added prototypes for public functions described above.
* libnautilus-extensions/nautilus-icon-private.h
Added boolean for renaming. Added a NautilusIconTextItem variable for the renaiming widget.
* src/file-manager/fm-icon-view.c
Added defines MENU_PATH_RENAME. Added a char * to hold original editable text for a later compare.
Removed get_icon_text_callback and added get_icon_editable_text_callback and
get_icon_additonal_text_callback. These return the editable and additonal text of the icon view.
(rename_icon_callback): Added callback that attempts to rename the NautilusFile the icon view
represents. Action in not taken if there has been no change to the editable text. If the operation
fails, the user is notified.
(fm_icon_view_append_selection_context_menu_items): Added Rename menu item.
(append_bonobo_menu_item): Added Rename menu item and callback.
(update_bonobo_menu_item): Added senesitivity check for the Rename item. It is
enabled only if a single item is selected.
(fm_icon_view_icon_text_changed_callback): Added function to attempt to change the filename
to the new text. Notify user if operation fails.
(get_icon_editable_text_callback): This callback returns the text items that areeditable by
the user using the "Rename" command. In the case of FMIconView, this
would be the attribute with the name "name".
(get_icon_additional_text_callback): This callback returns the text items that are not
editable by the user using the "Rename" command.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_monitor_add), (nautilus_file_monitor_remove):
Added empty implementations for these two routines. Will
fill in with actual code later after talking to Darin.
* src/nautilus-index-title.c:
(nautilus_index_title_set_uri): Monitor file for changes
in directory item count.
(release_file): Remove monitoring of file.
* src/file-manager/fm-properties-window.c:
(name_field_done_editing), (name_field_focus_out),
(name_field_focus_in), (create_properties_window):
Made focusing away from the name field in the Properties
window deselect the text, and focusing in select it.
* README: Made the contents of this file slightly helpful.
* data/mime/nautilus.keys: Added an obscure MIME type that
someone reported running into.
* libnautilus-extensions/nautilus-entry.h,
* libnautilus-extensions/nautilus-entry.c: New files. Define a
subclass of GtkEntry (one-line text editing field) that fixes
bugs and adds convenience functions.
(nautilus_entry_key_press): Override key_press handler to treat
the keypad Enter key the same as the other Enter key (in GtkEntry
it inserts a "/r" into the text).
(nautilus_entry_select_all): Select all text, and move the text
cursor position to the end.
(nautilus_entry_select_all_at_idle): Same, but do it at the next
idle opportunity. Useful since nautilus_entry_select_all won't
work right if called in a key_press signal handler.
* libnautilus-extensions/Makefile.am: Build these two new files.
* src/file-manager/fm-properties-window.c:
(name_field_activate): New function, updates file name and
selects all text.
(create_properties_window): Make name_field be a NautilusEntry.
This fixes half of bug 433 (Enter keys don't work properly in
properties window). Also attach to "activate" signal and update
name change then. This fixes other half of bug 433. Also start
with name field selected & focused. This fixes bug 432 (properties
window should appear with name text selected).
(name_field_update_to_match_file): Only update the displayed text
if the new name coming in is different. This was needed to make
select-all-on-activate work.
(name_field_done_editing): Don't accept empty string as name;
silently revert back to original name.
* src/nautilus-bookmarks-window.c:
(create_bookmarks_window): Change name & uri text fields to
NautilusEntry; this causes keypad Enter key to behave like other
Enter key. Also connect to focus_in and activate signals.
(update_bookmark_from_text): New function, extracted from
on_text_field_focus_out_event.
(on_text_field_focus_out_event): Deselect all text after updating
bookmark.
(on_text_field_focus_in_event): New function, select all text.
(name_or_uri_field_activate): New function, update bookmark and
select all text.
* src/nautilus-location-bar.c:
(nautilus_location_bar_initialize): Use NautilusEntry instead of
GtkEntry. This makes keypad Enter act like other Enter in uri-entry
field.
* src/ntl-window-msgs.c:
(nautilus_window_end_location_change_callback): Make "Nautilus can't
handle this type of file" message mention (human-readable version of)
file type.
fixed problem involving image thumbnails in directories where we
don't have write permissions - in that case, it now makes them
in $HOME/.nautilus/thumbnails instead.
fixed bug where the index panel command buttons were overlapping
metaviews. Fixed by hiding the buttons in nautilus_index_panel_
update_buttons if a meta is selected.
* libnautilus-extensions/nautilus-string.c:
* libnautilus-extensions/nautilus-string.h:
After a chat with Rebecca, named nautilus_str_underscore_escape to
nautilus_str_double_underscores since the latter name more
accurately describes what it does.
(nautilus_str_double_underscores): Changed the function to allow
NULL and return NULL instead of doing g_return_val_if_fail.
(Also reformatted a bit and made a few gratuitous changes.)
* libnautilus-extensions/nautilus-bookmark.c:
* libnautilus-extensions/nautilus-bookmark.h:
(nautilus_bookmark_get_menu_display_name):
Moved the logic about escaping menu characters up one level so
the bookmark class doesn't have to know about it. This removes
the function from NautilusBookmark completely.
* src/nautilus-window-menus.c:
(append_bookmark_to_menu): Fixed a storage leak and moved the
double-underscore escaping in here.
Finished task 174 (Use deferred calculation to compute directory
counts).
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-file-attributes.h:
Added a header file for names of file attributes.
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory.c:
* libnautilus-extensions/nautilus-directory.h:
* libnautilus-extensions/nautilus-file-private.h:
* libnautilus-extensions/nautilus-file.c:
* libnautilus-extensions/nautilus-file.h:
Added background computation of the "directory item count"
attribute. This is serving as a test case for the API for
requesting additional information.
* src/file-manager/fm-directory-view.c:
(display_selection_info): Changed to use the new interface that
can sometimes return "I don't know" for the number of items in
a particular directory.
(stop_load), (done_loading), (display_pending_files),
(fm_directory_view_stop): Fixed a mistake in the old code where
we stopped monitoring once the files were discovered. We need to
keep monitoring.
(finish_loading_uri): Pass in an attribute that we want to monitor:
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT.
2000-04-14 Christopher James Lahey <clahey@helixcode.com>
* src/ntl-window.c (nautilus_window_constructed): Change the
packing of the first pane so that it doesn't autoresize.
* libnautilus-extensions/nautilus-file-utilities.c
(nautilus_user_top_directory): Change this routine to use
gnome_datadir_file to get the share directory. Also, change to
using g_strdup_printf.
libnautilus now only contains the view interfaces needed by nautilus
components.
These are the interfaces defined in nautilus-view-component.idl.
libnautilus-extensions containes the remainder of the stuff.
Also used the cvs repository munging opportunity to do some of the
ntl-* renaming outlined in the RENAIMING file.
obseleted in the version of rpm that ships with 5.2 apparently.
I added a dumb hack to define RPMTAG_FILENAMES to
RPMTAG_OLDFILENAMES which is almost surely the wrong thing to do,
but i really need to have nautilus building while i do the
nautilus view changes. I gave myself a bug to properly address
this soon (472).