[Fwd: Re: [Nautilus-list] [PATCH] more desktop==home fixes]
- From: David Emory Watson <dwatson cs ucr edu>
- To: nautilus-list lists eazel com
- Cc: alexl redhat com
- Subject: [Fwd: Re: [Nautilus-list] [PATCH] more desktop==home fixes]
- Date: Sun, 24 Mar 2002 01:22:32 -0800
--- Begin Message ---
- From: David Emory Watson <dwatson cs ucr edu>
- To: nautilus-list lists eazel com
- Cc: alexl redhat com
- Subject: Re: [Nautilus-list] [PATCH] more desktop==home fixes
- Date: 24 Mar 2002 01:21:23 -0800
This patch is cumulative. Like last time this patch allows for the home
directory link to be deleted when desktop===home. In addition, this
patch re-factors some of the link code so that the behavior of special
links can be controlled from a central location.
Changelog:
* libnautilus-private/nautilus-link.c,
libnautilus-private/nautilus-link.h:
(nautilus_link_local_is_volume_link),
(nautilus_link_local_is_home_link),
(nautilus_link_local_is_trash_link),
(nautilus_link_local_is_special_link): Share code between different link
implementations so that home directory link behavior can be controlled
from one place.
* libnautilus-private/nautilus-link-desktop-file.c,
libnautilus-private/nautilus-link-desktop-file.h:
(nautilus_link_desktop_file_local_is_volume_link),
(nautilus_link_desktop_file_local_is_home_link),
(nautilus_link_desktop_file_local_is_trash_link): Remove.
* libnautilus-private/nautilus-link-historical.h,
libnautilus-private/nautilus-link-historical.c:
(nautilus_link_historical_local_is_volume_link),
(nautilus_link_historical_local_is_home_link),
(nautilus_link_historical_local_is_trash_link): Remove.
* libnautilus-private/nautilus-file-operations.c:
(is_special_link): Use nautilus_link_local_is_special_link.
src/file-manager/fm-directory-view.c:
(is_link_type_special): Remove.
(special_link_in_selection): Use nautilus_link_local_is_special_link.
* src/file-manager/fm-desktop-icon-view.c:
(update_home_link_and_delete_copies): Don't recreate the home directory
link when desktop==home.
--- End Message ---
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.149
diff -p -u -r1.149 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c 1 Mar 2002 22:57:26 -0000 1.149
+++ libnautilus-private/nautilus-file-operations.c 24 Mar 2002 05:09:21 -0000
@@ -982,18 +982,12 @@ is_special_link (const char *uri)
gboolean is_special;
local_path = gnome_vfs_get_local_path_from_uri (uri);
-
- /* FIXME: This should use some API to check if the file is a
- * link. Normally we use the MIME type. As things stand, this
- * will read files and try to parse them as XML, which could
- * result in a lot of output to the console, since the XML
- * parser reports errors directly there.
- */
- is_special = local_path != NULL
- && nautilus_link_local_get_link_type (local_path) != NAUTILUS_LINK_GENERIC;
-
+ if (local_path == NULL) {
+ return FALSE;
+ }
+ is_special = nautilus_link_local_is_special_link (local_path);
g_free (local_path);
-
+
return is_special;
}
Index: libnautilus-private/nautilus-link-desktop-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link-desktop-file.c,v
retrieving revision 1.13
diff -p -u -r1.13 nautilus-link-desktop-file.c
--- libnautilus-private/nautilus-link-desktop-file.c 1 Mar 2002 00:35:04 -0000 1.13
+++ libnautilus-private/nautilus-link-desktop-file.c 24 Mar 2002 05:09:22 -0000
@@ -237,24 +237,6 @@ nautilus_link_desktop_file_local_get_lin
return retval;
}
-gboolean
-nautilus_link_desktop_file_local_is_volume_link (const char *path)
-{
- return (nautilus_link_desktop_file_local_get_link_type (path) == NAUTILUS_LINK_MOUNT);
-}
-
-gboolean
-nautilus_link_desktop_file_local_is_home_link (const char *path)
-{
- return (nautilus_link_desktop_file_local_get_link_type (path) == NAUTILUS_LINK_HOME);
-}
-
-gboolean
-nautilus_link_desktop_file_local_is_trash_link (const char *path)
-{
- return (nautilus_link_desktop_file_local_get_link_type (path) == NAUTILUS_LINK_TRASH);
-}
-
static char *
nautilus_link_desktop_file_get_link_uri_from_desktop (GnomeDesktopItem *desktop_file)
{
Index: libnautilus-private/nautilus-link-desktop-file.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link-desktop-file.h,v
retrieving revision 1.6
diff -p -u -r1.6 nautilus-link-desktop-file.h
--- libnautilus-private/nautilus-link-desktop-file.h 21 Feb 2002 19:26:46 -0000 1.6
+++ libnautilus-private/nautilus-link-desktop-file.h 24 Mar 2002 05:09:23 -0000
@@ -38,9 +38,6 @@ gboolean nautilus_link_desktop_f
char * nautilus_link_desktop_file_local_get_text (const char *path);
char * nautilus_link_desktop_file_local_get_additional_text (const char *path);
NautilusLinkType nautilus_link_desktop_file_local_get_link_type (const char *path);
-gboolean nautilus_link_desktop_file_local_is_volume_link (const char *path);
-gboolean nautilus_link_desktop_file_local_is_home_link (const char *path);
-gboolean nautilus_link_desktop_file_local_is_trash_link (const char *path);
char * nautilus_link_desktop_file_local_get_link_uri (const char *path);
char * nautilus_link_desktop_file_get_link_uri_given_file_contents (const char *uri,
const char *link_file_contents,
Index: libnautilus-private/nautilus-link-historical.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link-historical.c,v
retrieving revision 1.9
diff -p -u -r1.9 nautilus-link-historical.c
--- libnautilus-private/nautilus-link-historical.c 1 Mar 2002 17:26:16 -0000 1.9
+++ libnautilus-private/nautilus-link-historical.c 24 Mar 2002 05:09:23 -0000
@@ -29,10 +29,12 @@
#include "nautilus-directory.h"
#include "nautilus-file-attributes.h"
#include "nautilus-file.h"
-#include "nautilus-metadata.h"
#include "nautilus-file-utilities.h"
+#include "nautilus-global-preferences.h"
+#include "nautilus-metadata.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
+#include <eel/eel-preferences.h>
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
@@ -372,25 +374,6 @@ nautilus_link_historical_get_link_icon_g
property = xml_get_root_property (doc, NAUTILUS_METADATA_KEY_CUSTOM_ICON);
xmlFreeDoc (doc);
return property;
-}
-
-
-gboolean
-nautilus_link_historical_local_is_volume_link (const char *path)
-{
- return nautilus_link_historical_local_get_link_type (path) == NAUTILUS_LINK_MOUNT;
-}
-
-gboolean
-nautilus_link_historical_local_is_home_link (const char *path)
-{
- return nautilus_link_historical_local_get_link_type (path) == NAUTILUS_LINK_HOME;
-}
-
-gboolean
-nautilus_link_historical_local_is_trash_link (const char *path)
-{
- return nautilus_link_historical_local_get_link_type (path) == NAUTILUS_LINK_TRASH;
}
void
Index: libnautilus-private/nautilus-link-historical.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link-historical.h,v
retrieving revision 1.6
diff -p -u -r1.6 nautilus-link-historical.h
--- libnautilus-private/nautilus-link-historical.h 21 Feb 2002 19:26:46 -0000 1.6
+++ libnautilus-private/nautilus-link-historical.h 24 Mar 2002 05:09:23 -0000
@@ -42,9 +42,6 @@ gboolean nautilus_link_historica
const char *uri);
char * nautilus_link_historical_local_get_additional_text (const char *path);
NautilusLinkType nautilus_link_historical_local_get_link_type (const char *path);
-gboolean nautilus_link_historical_local_is_volume_link (const char *path);
-gboolean nautilus_link_historical_local_is_home_link (const char *path);
-gboolean nautilus_link_historical_local_is_trash_link (const char *path);
char * nautilus_link_historical_local_get_link_uri (const char *path);
char * nautilus_link_historical_get_link_uri_given_file_contents (const char *link_file_contents,
int link_file_size);
@@ -54,5 +51,5 @@ char * nautilus_link_historica
void nautilus_link_historical_local_create_from_gnome_entry (GnomeDesktopItem *entry,
const char *dest_path,
const GdkPoint *position);
-
+
#endif /* NAUTILUS_LINK_HISTORICAL_H */
Index: libnautilus-private/nautilus-link.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link.c,v
retrieving revision 1.70
diff -p -u -r1.70 nautilus-link.c
--- libnautilus-private/nautilus-link.c 21 Feb 2002 19:26:46 -0000 1.70
+++ libnautilus-private/nautilus-link.c 24 Mar 2002 05:09:24 -0000
@@ -31,8 +31,9 @@
#include "nautilus-directory.h"
#include "nautilus-file-attributes.h"
#include "nautilus-file.h"
-#include "nautilus-metadata.h"
#include "nautilus-file-utilities.h"
+#include "nautilus-global-preferences.h"
+#include "nautilus-metadata.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
#include <eel/eel-stock-dialogs.h>
@@ -277,40 +278,42 @@ nautilus_link_get_link_icon_given_file_c
gboolean
nautilus_link_local_is_volume_link (const char *path)
{
- switch (get_link_style_for_local_file (path)) {
- case desktop:
- return nautilus_link_desktop_file_local_is_volume_link (path);
- case historical:
- return nautilus_link_historical_local_is_volume_link (path);
- default:
- return FALSE;
- }
+ return (nautilus_link_local_get_link_type (path) == NAUTILUS_LINK_MOUNT);
}
gboolean
nautilus_link_local_is_home_link (const char *path)
{
- switch (get_link_style_for_local_file (path)) {
- case desktop:
- return nautilus_link_desktop_file_local_is_home_link (path);
- case historical:
- return nautilus_link_historical_local_is_home_link (path);
- default:
- return FALSE;
+ if (nautilus_link_local_get_link_type (path) == NAUTILUS_LINK_HOME
+ && !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
+ return TRUE;
}
+
+ return FALSE;
}
gboolean
nautilus_link_local_is_trash_link (const char *path)
{
- switch (get_link_style_for_local_file (path)) {
- case desktop:
- return nautilus_link_desktop_file_local_is_trash_link (path);
- case historical:
- return nautilus_link_historical_local_is_trash_link (path);
- default:
+ return (nautilus_link_local_get_link_type (path) == NAUTILUS_LINK_TRASH);
+}
+
+gboolean
+nautilus_link_local_is_special_link (const char *path)
+{
+ switch (nautilus_link_local_get_link_type (path)) {
+ case NAUTILUS_LINK_HOME:
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
+ return FALSE;
+ }
+ case NAUTILUS_LINK_TRASH:
+ case NAUTILUS_LINK_MOUNT:
+ return TRUE;
+ case NAUTILUS_LINK_GENERIC:
return FALSE;
}
+
+ return FALSE;
}
void
Index: libnautilus-private/nautilus-link.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link.h,v
retrieving revision 1.23
diff -p -u -r1.23 nautilus-link.h
--- libnautilus-private/nautilus-link.h 21 Feb 2002 19:26:47 -0000 1.23
+++ libnautilus-private/nautilus-link.h 24 Mar 2002 05:09:25 -0000
@@ -97,6 +97,11 @@ gboolean nautilus_link_local_is_
*/
gboolean nautilus_link_local_is_trash_link (const char *path);
+/* Returns if a link is a home link (and desktop!=home), volume link, or trash link.
+ * Works only if the file is local and does sync. I/O
+ */
+gboolean nautilus_link_local_is_special_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
Index: src/file-manager/fm-desktop-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-desktop-icon-view.c,v
retrieving revision 1.164
diff -p -u -r1.164 fm-desktop-icon-view.c
--- src/file-manager/fm-desktop-icon-view.c 7 Mar 2002 19:36:16 -0000 1.164
+++ src/file-manager/fm-desktop-icon-view.c 24 Mar 2002 05:09:29 -0000
@@ -879,7 +879,8 @@ update_home_link_and_delete_copies (void
if (!update_link_and_delete_copies (nautilus_link_local_is_home_link,
NULL,
- home_uri)) {
+ home_uri)
+ && !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
nautilus_link_local_create (desktop_directory,
home_link_name,
"desktop-home",
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.521
diff -p -u -r1.521 fm-directory-view.c
--- src/file-manager/fm-directory-view.c 18 Mar 2002 17:21:48 -0000 1.521
+++ src/file-manager/fm-directory-view.c 24 Mar 2002 05:09:43 -0000
@@ -2841,23 +2841,9 @@ fm_directory_link_type_in_selection (FMD
return saw_link;
}
-static gboolean
-is_link_type_special (NautilusLinkType type)
-{
- switch (type) {
- case NAUTILUS_LINK_TRASH:
- case NAUTILUS_LINK_HOME:
- case NAUTILUS_LINK_MOUNT:
- return TRUE;
- case NAUTILUS_LINK_GENERIC:
- return FALSE;
- }
- return FALSE;
-}
-
/* special_link_in_selection
*
- * Return TRUE is one of our special links is the selection.
+ * Return TRUE if one of our special links is in the selection.
* Special links include the following:
* NAUTILUS_LINK_TRASH, NAUTILUS_LINK_HOME, NAUTILUS_LINK_MOUNT
*/
@@ -2885,7 +2871,7 @@ special_link_in_selection (FMDirectoryVi
/* FIXME: This reads the link file every single time. */
saw_link = path != NULL
&& nautilus_file_is_nautilus_link (file)
- && is_link_type_special (nautilus_link_local_get_link_type (path));
+ && nautilus_link_local_is_special_link (path);
g_free (path);
g_free (uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]