mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
a6a23a708e
I encountered along the way, and did the first cut at a state machine for NautilusViewFrame based on Maciej's design that can mostly replace the super-complicated one for NautilusWindow. * README: We no longer can use the ORBit that comes with HC1.2 with cvs HEAD, since warnings have been fixed in the code generated by the newer ORBit, so fix that line in the README. * libnautilus-extensions/nautilus-directory.c: (nautilus_directory_new): Use the new nautilus_uri_is_trash function to avoid hard-coding incorrect checks for "trash:". (nautilus_directory_copy_move_metadata_key): Make simple fix for empty metadata. This code gets replaced soon anyway. * libnautilus-extensions/nautilus-drag.c: (nautilus_drag_can_accept_item): Simplify code to get rid of illegal sync. I/O. It's OK to assume all NautilusLink objects point to directories for now, and if we make a change to do something fancier later, we have to do it with async. (nautilus_drag_default_drop_action_for_icons): Use the new nautilus_uri_is_trash function to avoid hard-coding incorrect checks for "trash:". * libnautilus-extensions/nautilus-drag.h: Fixed a typo. * libnautilus-extensions/nautilus-file-operations.c: (get_link_name): Fix unintialized variable warning in a simple way that avoids adding too much code. (get_duplicate_name): Fix unintialized variable warning in a simple way that avoids adding too much code. (nautilus_file_operations_copy_move): Use the new nautilus_uri_is_trash function to avoid hard-coding incorrect checks for "trash:". * libnautilus-extensions/nautilus-file-utilities.h: * libnautilus-extensions/nautilus-file-utilities.c: (nautilus_uri_is_trash): Add new function to avoid hard-coding incorrect checks for "trash:". (nautilus_make_uri_canonical), Use nautilus_uri_is_trash. * libnautilus-extensions/nautilus-icon-container.h: * libnautilus-extensions/nautilus-icon-container.c: Remove nautilus_icon_container_trash_link_is_in_selection for 3 reasons. It doesn't belong in NautilusIconContainer, the use of it in drag code was incorrectly looking at the destination directory's selection, and it used sync. I/O. * libnautilus-extensions/nautilus-icon-dnd.c: (selection_includes_trash), (nautilus_icon_container_receive_dropped_icons): Changed code to actually check selection -- the old code would check the selection in the target window. Unfortunately this still uses sync. I/O, but that's now covered by bug 3020. * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_icon_factory_get_icon_for_file): Change to use new "local" API for links to make it clear that it uses sync. I/O and only works on local files. * libnautilus-extensions/nautilus-link.h: * libnautilus-extensions/nautilus-link.c: (get_tag), (get_link_type): Added functions to handle tags internally as part of getting rid of tag string values from the API. (nautilus_link_local_create): Changed name to local to emphasize this takes a path not a URI and uses sync. I/O. (local_set_root_property): Share code among the set functions. Before there were a lot of copies of the same code. Also made sure that it does no rewrite of the file if called to set a property to the same value it already has. (nautilus_link_local_set_icon), (nautilus_link_local_set_link_uri), (nautilus_link_local_set_type): Changed name to local to emphasize these take a path not a URI and use sync. I/O. Reimplement by calling local_set_root_property. (nautilus_link_local_get_additional_text): Change name to local and make it take a path instead of a URI to make it clear it uses sync. I/O and doesn't work on remote URIs. (nautilus_link_local_get_image_uri): Change name to local and make it take a path instead of a URI to make it clear it uses sync. I/O and doesn't work on remote URIs. (nautilus_link_local_get_link_uri): Change name to local and make it take a path instead of a URI to make it clear it uses sync. I/O and doesn't work on remote URIs. (nautilus_link_local_get_link_type): Change return value to be the NautilusLinkType enum instead of the type tag string to make the interface cleaner. Also changed name to local to make it clear that it takes a path instead of a URI and uses sync. I/O. (nautilus_link_local_is_volume_link), (nautilus_link_local_is_home_link), (nautilus_link_local_is_trash_link): Changed all three of these to take advantage of the new simpler get_link_type, and changed name to local to make it clear that they take a path instead of a URI and use sync. I/O. * src/file-manager/fm-desktop-icon-view.c: (create_mount_link): Use call by new "local" name. (trash_link_is_selection): Call new "local" function, which now requires a path rather than a URI. (fm_desktop_icon_view_trash_state_changed_callback): Use call by new "local" name. (volume_unmounted_callback): Fix bug where the unmounted callback was using a path as a URI without converting. (find_and_update_home_link): Use call by new "local" name. (place_home_directory): Use call by new "local" name. (find_and_rename_trash_link): Use call by new "local" name. (create_or_rename_trash): Use call by new "local" name. (remove_old_mount_links): Use call by new "local" name. (get_sort_category): Use new get_link_type call and a case statement instead of the old one and a list of string compares. * src/file-manager/fm-directory-view.c: (fm_directory_trash_link_in_selection): Wrote a new version of this function. This is similar to what was in NautilusIconContainer, but the one in there didn't belong there, and didn't really work for other callers. Also, the one in there didn't work at all for the list view case. This new function works for either icon or list view. It still has the limitation that it won't recognize a trash link if it's not local. * src/file-manager/fm-icon-view.c: (get_icon_drop_target_uri_callback): Fix to use new local calls, but still does sync. I/O. Bug 3020 reported about that. (get_icon_text_callback): Changed to use new local calls. Still a problem that it works only locally and uses sync. I/O. Bug 2531 was already reported about that. * src/file-manager/fm-properties-window.c: (get_and_ref_file_to_display): Changed to use new local calls and the simpler link type interface. * src/nautilus-view-frame-private.h: Moved some private declarations here since they are for objects used in one file and declared in another. * src/nautilus-view-frame.h: * src/nautilus-view-frame.c: (nautilus_view_frame_destroy_client): Destroy the "check if view is gone" timeout here; makes more sense than the way it was managed before. (nautilus_view_frame_destroy): Don't destroy the timeout here any more. Also, label was moved into details. (nautilus_view_frame_handle_client_gone): Renamed from handle_client_destroy_2. (view_frame_wait), (view_frame_underway), (view_frame_wait_is_over), (view_frame_loaded), (view_frame_failed): Added functions to implement view frame state machine transitions. (check_if_view_is_gone): Moved code to check if view is gone here; it's now activated automatically without requiring an explicit call to turn it on, since all callers were turning it on at load_client time. (nautilus_view_frame_load_client): Add state management. Moved the code to turn on the object check timeout here. (nautilus_view_frame_load_location): Add state management. (nautilus_view_frame_open_location): Add state management. (nautilus_view_frame_open_location_in_new_window): Add state management. (nautilus_view_frame_open_in_new_window_and_select): Add state management. (nautilus_view_frame_report_location_change): Add state management. (nautilus_view_frame_report_selection_change): Add state management. (nautilus_view_frame_report_status): Add state management. (nautilus_view_frame_report_load_underway): Add state management. (nautilus_view_frame_report_load_progress): Add state management. (nautilus_view_frame_report_load_complete): Add state management. (nautilus_view_frame_report_load_failed): Add state management. (nautilus_view_frame_set_title): Add state management. (nautilus_view_frame_zoom_level_changed): Add state management., (nautilus_view_frame_get_label), (nautilus_view_frame_set_label): Moved label into details structure. * src/nautilus-window-manage-views.c: (nautilus_window_load_sidebar_panel): Fixed code structure a bit (fixes bug 2463) and got rid of call to old nautilus_view_frame_set_active_errors function, which is no longer needed. (nautilus_window_load_content_view): Got rid of call to old nautilus_view_frame_set_active_errors function, which is no longer needed. * src/nautilus-window.c: (window_update_sidebar_panels_from_preferences): Got rid of call to old nautilus_view_frame_set_active_errors function, which is no longer needed.
115 lines
4.3 KiB
C
115 lines
4.3 KiB
C
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
|
|
|
|
nautilus-link.h: xml-based link files that control their appearance
|
|
and behavior.
|
|
|
|
Copyright (C) 2000 Eazel, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program 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
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public
|
|
License along with this program; if not, write to the
|
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
Authors: Andy Hertzfeld <andy@eazel.com>
|
|
*/
|
|
|
|
#ifndef NAUTILUS_LINK_H
|
|
#define NAUTILUS_LINK_H
|
|
|
|
#include "nautilus-file.h"
|
|
|
|
/* Link types */
|
|
typedef enum {
|
|
NAUTILUS_LINK_GENERIC,
|
|
NAUTILUS_LINK_TRASH,
|
|
NAUTILUS_LINK_MOUNT,
|
|
NAUTILUS_LINK_HOME
|
|
} NautilusLinkType;
|
|
|
|
/* Create a new link file. Takes a path, works locally, and uses sync. I/O.
|
|
* Returns TRUE if it succeeds, FALSE if it fails.
|
|
*/
|
|
gboolean nautilus_link_local_create (const char *directory_path,
|
|
const char *name,
|
|
const char *image,
|
|
const char *target_uri,
|
|
NautilusLinkType type);
|
|
|
|
/* Change the icon of an existing link file. Takes a path, works
|
|
* locally, and uses sync. I/O. Returns TRUE if it succeeds, FALSE if
|
|
* it fails. Does not check and see if it is a link file.
|
|
*/
|
|
gboolean nautilus_link_local_set_icon (const char *path,
|
|
const char *icon_name);
|
|
|
|
/* Specify the type of link that is represented
|
|
* Takes a path, works locally, and uses sync. I/O.
|
|
* Returns TRUE if it succeeds, FALSE if
|
|
* it fails. Does not check and see if it is a link file.
|
|
*/
|
|
gboolean nautilus_link_local_set_type (const char *path,
|
|
NautilusLinkType type);
|
|
|
|
/* Specify the link uri of link that is represented
|
|
* Takes a path, works locally, and uses sync. I/O.
|
|
* Returns TRUE if it succeeds, FALSE if
|
|
* it fails. Does not check and see if it is a link file.
|
|
*/
|
|
gboolean nautilus_link_local_set_link_uri (const char *path,
|
|
const char *uri);
|
|
|
|
/* Returns additional text to display under the name, NULL if
|
|
* none. Despite the fact that it takes a URI parameter, works only if
|
|
* the file is local and does sync. I/O.
|
|
*/
|
|
char * nautilus_link_local_get_additional_text (const char *path);
|
|
|
|
/* Returns the image associated with a link file. Despite the fact
|
|
* that it takes a URI parameter, works only if the file is local and
|
|
* does sync. I/O on the link, although it does async. on the image
|
|
* and caches if the image is remote.
|
|
*/
|
|
char * nautilus_link_local_get_image_uri (const char *path);
|
|
|
|
/* Returns the link type of a link file.
|
|
* Works only if the file is local and does sync. I/O
|
|
*/
|
|
NautilusLinkType nautilus_link_local_get_link_type (const char *path);
|
|
|
|
|
|
/* Returns if a link is a mount link.
|
|
* Works only if the file is local and does sync. I/O
|
|
*/
|
|
gboolean nautilus_link_local_is_volume_link (const char *path);
|
|
|
|
/* Returns if a link is a home link.
|
|
* Works only if the file is local and does sync. I/O
|
|
*/
|
|
gboolean nautilus_link_local_is_home_link (const char *path);
|
|
|
|
/* Returns if a link is a trash link.
|
|
* Works only if the file is local and does sync. I/O
|
|
*/
|
|
gboolean nautilus_link_local_is_trash_link (const char *path);
|
|
|
|
|
|
/* Returns the link uri associated with a link file. The first version
|
|
* works only if the file is local and does sync. I/O, despite the
|
|
* fact that it takes a URI parameter. The second version takes the
|
|
* contents of a file already in memory.
|
|
*/
|
|
char * nautilus_link_local_get_link_uri (const char *path);
|
|
char * nautilus_link_get_link_uri_given_file_contents (const char *link_file_contents,
|
|
int link_file_size);
|
|
|
|
#endif /* NAUTILUS_LINK_H */
|