I think the log entry is screwing up cvs. So look at the ChangeLog for

details. Checking in Miguel's patch.
This commit is contained in:
Darin Adler 2001-04-27 00:03:27 +00:00
parent b0c74be6cb
commit 8fde5d4d35
18 changed files with 780 additions and 86 deletions

View file

@ -2787,7 +2787,7 @@ activation_uri_gmc_link_read_callback (GnomeVFSResult result,
}
g_free (file_contents);
activation_uri_read_done (directory, uri);
activation_uri_read_done (directory, uri ? uri + 5 : NULL);
g_free (uri);
nautilus_directory_unref (directory);

View file

@ -40,7 +40,7 @@
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"
#define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755)
#define DESKTOP_DIRECTORY_NAME "desktop"
#define DESKTOP_DIRECTORY_NAME ".gnome-desktop"
#define DEFAULT_DESKTOP_DIRECTORY_MODE (0755)
#define NAUTILUS_USER_MAIN_DIRECTORY_NAME "Nautilus"
@ -137,14 +137,12 @@ nautilus_get_user_directory (void)
char *
nautilus_get_desktop_directory (void)
{
char *desktop_directory, *user_directory;
char *desktop_directory;
if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
desktop_directory = strdup (g_get_home_dir());
desktop_directory = g_strdup (g_get_home_dir());
} else {
user_directory = nautilus_get_user_directory ();
desktop_directory = nautilus_make_path (user_directory, DESKTOP_DIRECTORY_NAME);
g_free (user_directory);
desktop_directory = nautilus_make_path (g_get_home_dir (), DESKTOP_DIRECTORY_NAME);
}
if (!g_file_exists (desktop_directory)) {

View file

@ -30,13 +30,14 @@
#include "nautilus-directory-private.h"
#include "nautilus-file-attributes.h"
#include "nautilus-file-private.h"
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-link.h"
#include "nautilus-metadata.h"
#include "nautilus-trash-directory.h"
#include "nautilus-trash-file.h"
#include "nautilus-vfs-file.h"
#include "nautilus-file-utilities.h"
#include <ctype.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
@ -46,7 +47,9 @@
#include <grp.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-dentry.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-mime-info.h>
#include <libgnome/gnome-mime.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
@ -737,6 +740,10 @@ nautilus_file_can_rename (NautilusFile *file)
return FALSE;
}
if (nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
return FALSE;
}
can_rename = TRUE;
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
@ -941,11 +948,31 @@ nautilus_file_rename (NautilusFile *file,
Operation *op;
GnomeVFSFileInfo *partial_file_info;
GnomeVFSURI *vfs_uri;
char *uri, *path;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
/* FIXME: Rename GMC URLs on the local file system by setting
* their metadata only. This leaves no way to rename them for
* real.
*/
if (nautilus_file_is_gmc_url (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
if (path != NULL) {
gnome_metadata_set (path, "icon-caption", strlen (new_name) + 1, new_name);
g_free (path);
(* callback) (file, GNOME_VFS_OK, callback_data);
nautilus_file_changed (file);
return;
}
}
/* Make return an error for incoming names containing path separators. */
if (strstr (new_name, "/") != NULL) {
(* callback) (file, GNOME_VFS_ERROR_NOT_PERMITTED, callback_data);
@ -1871,6 +1898,76 @@ typedef enum {
SHOW_BACKUP = 1 << 1
} NautilusFileFilterOptions;
static gboolean
is_special_desktop_gmc_file (NautilusFile *file)
{
static char *home_dir;
static int home_dir_len;
char buffer [1024];
char *uri, *path;
int s;
if (!nautilus_file_is_local (file)) {
return FALSE;
}
if (strcmp (file->details->relative_uri, "Trash.gmc") == 0) {
return TRUE;
}
if (nautilus_file_is_symbolic_link (file)) {
/* You would think that
* nautilus_file_get_symbolic_link_target_path would
* be useful here, but you would be wrong. The
* information kept around by NautilusFile is not
* available right now, and I have no clue how to fix
* this. On top of that, inode/device are not stored,
* so it is not possible to see if a link is a symlink
* to the home directory. sigh. -Miguel
*/
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL){
s = readlink (path, buffer, sizeof (buffer)-1);
g_free (path);
} else {
s = -1;
}
g_free (uri);
if (s == -1) {
return FALSE;
}
buffer [s] = 0;
if (home_dir == NULL) {
home_dir = g_strdup (g_get_home_dir ());
home_dir_len = strlen (home_dir);
if (home_dir != NULL && home_dir [home_dir_len-1] == '/') {
home_dir [home_dir_len-1] = 0;
home_dir_len--;
}
}
if (home_dir != NULL) {
if (strcmp (home_dir, buffer) == 0)
return TRUE;
}
}
return FALSE;
}
gboolean
nautilus_file_is_in_desktop (NautilusFile *file)
{
/* This handles visiting other people's desktops, but it can arguably
* be said that this might break and that we should lookup the passwd table.
*/
return strstr (file->details->directory->details->uri, "/.gnome-desktop") != NULL;
}
static gboolean
filter_hidden_and_backup_partition_callback (gpointer data,
gpointer callback_data)
@ -1881,6 +1978,10 @@ filter_hidden_and_backup_partition_callback (gpointer data,
file = NAUTILUS_FILE (data);
options = (NautilusFileFilterOptions) callback_data;
if (nautilus_file_is_in_desktop (file) && is_special_desktop_gmc_file (file)) {
return FALSE;
}
return nautilus_file_should_show (file,
options & SHOW_HIDDEN,
options & SHOW_BACKUP);
@ -1971,10 +2072,32 @@ nautilus_file_set_metadata (NautilusFile *file,
const char *default_metadata,
const char *metadata)
{
char *icon_path;
char *local_path;
char *local_uri;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (key != NULL);
g_return_if_fail (key[0] != '\0');
if (strcmp (key, NAUTILUS_METADATA_KEY_CUSTOM_ICON) == 0) {
if (nautilus_file_is_in_desktop (file)
&& nautilus_file_is_local (file)) {
local_uri = nautilus_file_get_uri (file);
local_path = gnome_vfs_get_local_path_from_uri (local_uri);
icon_path = gnome_vfs_get_local_path_from_uri (metadata);
if (local_path != NULL && icon_path != NULL) {
gnome_metadata_set (local_path, "icon-filename", strlen (icon_path)+1, icon_path);
}
g_free (icon_path);
g_free (local_path);
g_free (local_uri);
}
}
nautilus_directory_set_file_metadata
(file->details->directory,
get_metadata_name (file),
@ -2086,11 +2209,58 @@ char *
nautilus_file_get_name (NautilusFile *file)
{
char *name;
GnomeDesktopEntry *entry;
char *path, *uri;
char *caption;
int size, res;
if (file == NULL) {
return NULL;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
if (nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
name = NULL;
if (path != NULL) {
entry = gnome_desktop_entry_load (path);
if (entry != NULL) {
name = g_strdup (entry->name);
gnome_desktop_entry_free (entry);
}
}
g_free (path);
g_free (uri);
if (name != NULL) {
return name;
}
}
/* Desktop directories contain special "URL" files, handle
* those by using the gnome metadata caption.
*/
if (nautilus_file_is_gmc_url (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL) {
res = gnome_metadata_get (path, "icon-caption", &size, &caption);
} else {
res = -1;
}
g_free (path);
g_free (uri);
if (res == 0 && caption != NULL) {
return caption;
}
}
name = gnome_vfs_unescape_string (file->details->relative_uri, "/");
if (name != NULL) {
return name;
@ -2382,7 +2552,7 @@ nautilus_file_fit_date_as_string (NautilusFile *file,
return date_string;
}
result = (truncate_callback) (date_string, width, measure_context);
result = (* truncate_callback) (date_string, width, measure_context);
g_free (date_string);
return result;
}
@ -4243,6 +4413,22 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
return nautilus_file_is_mime_type (file, "application/x-nautilus-link");
}
/**
* nautilus_file_is_gmc_url
*
* Check if this file is a gmc url
* @file: NautilusFile representing the file in question.
*
* Returns: True if the file is a gmc url
*
**/
gboolean
nautilus_file_is_gmc_url (NautilusFile *file)
{
return strncmp (file->details->relative_uri, "url", 3) == 0
&& nautilus_file_is_in_desktop (file);
}
/**
* nautilus_file_is_directory
*

View file

@ -136,9 +136,11 @@ gboolean nautilus_file_is_symbolic_link (Nautilu
char * nautilus_file_get_symbolic_link_target_path (NautilusFile *file);
gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
gboolean nautilus_file_is_gmc_url (NautilusFile *file);
gboolean nautilus_file_is_executable (NautilusFile *file);
gboolean nautilus_file_is_directory (NautilusFile *file);
gboolean nautilus_file_is_in_trash (NautilusFile *file);
gboolean nautilus_file_is_in_desktop (NautilusFile *file);
GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
guint *count,

View file

@ -47,12 +47,14 @@
#include <eel/eel-scalable-font.h>
#include <eel/eel-smooth-text-layout.h>
#include <eel/eel-string.h>
#include <eel/eel-xml-extensions.h>
#include <eel/eel-vfs-extensions.h>
#include <eel/eel-xml-extensions.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/xmlmemory.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-dentry.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
@ -1379,9 +1381,12 @@ NautilusScalableIcon *
nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifier)
{
char *uri, *file_uri, *file_path, *image_uri, *icon_name, *mime_type, *top_left_text;
char *directory, *desktop_directory, *buf;
gboolean is_local;
int file_size;
int file_size, size, res;
NautilusScalableIcon *scalable_icon;
char *directory_uri;
GnomeDesktopEntry *entry;
if (file == NULL) {
return NULL;
@ -1399,6 +1404,37 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifie
If a thumbnail is required, but does not yet exist, put an entry on the thumbnail queue so we
eventually make one */
if (uri == NULL) {
/* Do we have to check the gnome metadata?
*
* Do this only for the ~/.gnome-desktop directory, as it was
* the only place where GMC used it (since everywhere else we could
* not do it because of the imlib leaks).
*/
desktop_directory = nautilus_get_desktop_directory ();
directory_uri = nautilus_file_get_parent_uri (file);
directory = gnome_vfs_get_local_path_from_uri (directory_uri);
if (directory != NULL && strcmp (directory, desktop_directory) == 0) {
file_path = gnome_vfs_get_local_path_from_uri (file_uri);
if (file_path != NULL) {
res = gnome_metadata_get (file_path, "icon-filename", &size, &buf);
} else {
res = -1;
}
if (res == 0 && buf != NULL) {
uri = gnome_vfs_get_uri_from_local_path (buf);
g_free (buf);
}
g_free (file_path);
file_path = NULL;
}
g_free (directory);
g_free (desktop_directory);
}
/* also, dont make thumbnails for images in the thumbnails directory */
if (uri == NULL) {
mime_type = nautilus_file_get_mime_type (file);
@ -1442,6 +1478,22 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifie
}
}
g_free (file_path);
file_path = NULL;
}
}
if (uri == NULL && nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
file_path = gnome_vfs_get_local_path_from_uri (file_uri);
if (file_path != NULL) {
entry = gnome_desktop_entry_load (file_path);
if (entry != NULL) {
if (entry->icon != NULL) {
uri = gnome_vfs_get_uri_from_local_path (entry->icon);
}
gnome_desktop_entry_free (entry);
}
g_free (file_path);
file_path = NULL;
}
}

View file

@ -113,7 +113,7 @@ char **broken_cdda_interface_h_workaround = strerror_tr;
#endif
#define CHECK_STATUS_INTERVAL 2000
#define CHECK_STATUS_INTERVAL 4000
#define FLOPPY_MOUNT_PATH_PREFIX "/mnt/fd"

View file

@ -2787,7 +2787,7 @@ activation_uri_gmc_link_read_callback (GnomeVFSResult result,
}
g_free (file_contents);
activation_uri_read_done (directory, uri);
activation_uri_read_done (directory, uri ? uri + 5 : NULL);
g_free (uri);
nautilus_directory_unref (directory);

View file

@ -40,7 +40,7 @@
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"
#define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755)
#define DESKTOP_DIRECTORY_NAME "desktop"
#define DESKTOP_DIRECTORY_NAME ".gnome-desktop"
#define DEFAULT_DESKTOP_DIRECTORY_MODE (0755)
#define NAUTILUS_USER_MAIN_DIRECTORY_NAME "Nautilus"
@ -137,14 +137,12 @@ nautilus_get_user_directory (void)
char *
nautilus_get_desktop_directory (void)
{
char *desktop_directory, *user_directory;
char *desktop_directory;
if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
desktop_directory = strdup (g_get_home_dir());
desktop_directory = g_strdup (g_get_home_dir());
} else {
user_directory = nautilus_get_user_directory ();
desktop_directory = nautilus_make_path (user_directory, DESKTOP_DIRECTORY_NAME);
g_free (user_directory);
desktop_directory = nautilus_make_path (g_get_home_dir (), DESKTOP_DIRECTORY_NAME);
}
if (!g_file_exists (desktop_directory)) {

View file

@ -30,13 +30,14 @@
#include "nautilus-directory-private.h"
#include "nautilus-file-attributes.h"
#include "nautilus-file-private.h"
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-link.h"
#include "nautilus-metadata.h"
#include "nautilus-trash-directory.h"
#include "nautilus-trash-file.h"
#include "nautilus-vfs-file.h"
#include "nautilus-file-utilities.h"
#include <ctype.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
@ -46,7 +47,9 @@
#include <grp.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-dentry.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-mime-info.h>
#include <libgnome/gnome-mime.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
@ -737,6 +740,10 @@ nautilus_file_can_rename (NautilusFile *file)
return FALSE;
}
if (nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
return FALSE;
}
can_rename = TRUE;
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
@ -941,11 +948,31 @@ nautilus_file_rename (NautilusFile *file,
Operation *op;
GnomeVFSFileInfo *partial_file_info;
GnomeVFSURI *vfs_uri;
char *uri, *path;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
/* FIXME: Rename GMC URLs on the local file system by setting
* their metadata only. This leaves no way to rename them for
* real.
*/
if (nautilus_file_is_gmc_url (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
g_free (uri);
if (path != NULL) {
gnome_metadata_set (path, "icon-caption", strlen (new_name) + 1, new_name);
g_free (path);
(* callback) (file, GNOME_VFS_OK, callback_data);
nautilus_file_changed (file);
return;
}
}
/* Make return an error for incoming names containing path separators. */
if (strstr (new_name, "/") != NULL) {
(* callback) (file, GNOME_VFS_ERROR_NOT_PERMITTED, callback_data);
@ -1871,6 +1898,76 @@ typedef enum {
SHOW_BACKUP = 1 << 1
} NautilusFileFilterOptions;
static gboolean
is_special_desktop_gmc_file (NautilusFile *file)
{
static char *home_dir;
static int home_dir_len;
char buffer [1024];
char *uri, *path;
int s;
if (!nautilus_file_is_local (file)) {
return FALSE;
}
if (strcmp (file->details->relative_uri, "Trash.gmc") == 0) {
return TRUE;
}
if (nautilus_file_is_symbolic_link (file)) {
/* You would think that
* nautilus_file_get_symbolic_link_target_path would
* be useful here, but you would be wrong. The
* information kept around by NautilusFile is not
* available right now, and I have no clue how to fix
* this. On top of that, inode/device are not stored,
* so it is not possible to see if a link is a symlink
* to the home directory. sigh. -Miguel
*/
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL){
s = readlink (path, buffer, sizeof (buffer)-1);
g_free (path);
} else {
s = -1;
}
g_free (uri);
if (s == -1) {
return FALSE;
}
buffer [s] = 0;
if (home_dir == NULL) {
home_dir = g_strdup (g_get_home_dir ());
home_dir_len = strlen (home_dir);
if (home_dir != NULL && home_dir [home_dir_len-1] == '/') {
home_dir [home_dir_len-1] = 0;
home_dir_len--;
}
}
if (home_dir != NULL) {
if (strcmp (home_dir, buffer) == 0)
return TRUE;
}
}
return FALSE;
}
gboolean
nautilus_file_is_in_desktop (NautilusFile *file)
{
/* This handles visiting other people's desktops, but it can arguably
* be said that this might break and that we should lookup the passwd table.
*/
return strstr (file->details->directory->details->uri, "/.gnome-desktop") != NULL;
}
static gboolean
filter_hidden_and_backup_partition_callback (gpointer data,
gpointer callback_data)
@ -1881,6 +1978,10 @@ filter_hidden_and_backup_partition_callback (gpointer data,
file = NAUTILUS_FILE (data);
options = (NautilusFileFilterOptions) callback_data;
if (nautilus_file_is_in_desktop (file) && is_special_desktop_gmc_file (file)) {
return FALSE;
}
return nautilus_file_should_show (file,
options & SHOW_HIDDEN,
options & SHOW_BACKUP);
@ -1971,10 +2072,32 @@ nautilus_file_set_metadata (NautilusFile *file,
const char *default_metadata,
const char *metadata)
{
char *icon_path;
char *local_path;
char *local_uri;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (key != NULL);
g_return_if_fail (key[0] != '\0');
if (strcmp (key, NAUTILUS_METADATA_KEY_CUSTOM_ICON) == 0) {
if (nautilus_file_is_in_desktop (file)
&& nautilus_file_is_local (file)) {
local_uri = nautilus_file_get_uri (file);
local_path = gnome_vfs_get_local_path_from_uri (local_uri);
icon_path = gnome_vfs_get_local_path_from_uri (metadata);
if (local_path != NULL && icon_path != NULL) {
gnome_metadata_set (local_path, "icon-filename", strlen (icon_path)+1, icon_path);
}
g_free (icon_path);
g_free (local_path);
g_free (local_uri);
}
}
nautilus_directory_set_file_metadata
(file->details->directory,
get_metadata_name (file),
@ -2086,11 +2209,58 @@ char *
nautilus_file_get_name (NautilusFile *file)
{
char *name;
GnomeDesktopEntry *entry;
char *path, *uri;
char *caption;
int size, res;
if (file == NULL) {
return NULL;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
if (nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
name = NULL;
if (path != NULL) {
entry = gnome_desktop_entry_load (path);
if (entry != NULL) {
name = g_strdup (entry->name);
gnome_desktop_entry_free (entry);
}
}
g_free (path);
g_free (uri);
if (name != NULL) {
return name;
}
}
/* Desktop directories contain special "URL" files, handle
* those by using the gnome metadata caption.
*/
if (nautilus_file_is_gmc_url (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL) {
res = gnome_metadata_get (path, "icon-caption", &size, &caption);
} else {
res = -1;
}
g_free (path);
g_free (uri);
if (res == 0 && caption != NULL) {
return caption;
}
}
name = gnome_vfs_unescape_string (file->details->relative_uri, "/");
if (name != NULL) {
return name;
@ -2382,7 +2552,7 @@ nautilus_file_fit_date_as_string (NautilusFile *file,
return date_string;
}
result = (truncate_callback) (date_string, width, measure_context);
result = (* truncate_callback) (date_string, width, measure_context);
g_free (date_string);
return result;
}
@ -4243,6 +4413,22 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
return nautilus_file_is_mime_type (file, "application/x-nautilus-link");
}
/**
* nautilus_file_is_gmc_url
*
* Check if this file is a gmc url
* @file: NautilusFile representing the file in question.
*
* Returns: True if the file is a gmc url
*
**/
gboolean
nautilus_file_is_gmc_url (NautilusFile *file)
{
return strncmp (file->details->relative_uri, "url", 3) == 0
&& nautilus_file_is_in_desktop (file);
}
/**
* nautilus_file_is_directory
*

View file

@ -136,9 +136,11 @@ gboolean nautilus_file_is_symbolic_link (Nautilu
char * nautilus_file_get_symbolic_link_target_path (NautilusFile *file);
gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
gboolean nautilus_file_is_gmc_url (NautilusFile *file);
gboolean nautilus_file_is_executable (NautilusFile *file);
gboolean nautilus_file_is_directory (NautilusFile *file);
gboolean nautilus_file_is_in_trash (NautilusFile *file);
gboolean nautilus_file_is_in_desktop (NautilusFile *file);
GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
guint *count,

View file

@ -47,12 +47,14 @@
#include <eel/eel-scalable-font.h>
#include <eel/eel-smooth-text-layout.h>
#include <eel/eel-string.h>
#include <eel/eel-xml-extensions.h>
#include <eel/eel-vfs-extensions.h>
#include <eel/eel-xml-extensions.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/xmlmemory.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-dentry.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
@ -1379,9 +1381,12 @@ NautilusScalableIcon *
nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifier)
{
char *uri, *file_uri, *file_path, *image_uri, *icon_name, *mime_type, *top_left_text;
char *directory, *desktop_directory, *buf;
gboolean is_local;
int file_size;
int file_size, size, res;
NautilusScalableIcon *scalable_icon;
char *directory_uri;
GnomeDesktopEntry *entry;
if (file == NULL) {
return NULL;
@ -1399,6 +1404,37 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifie
If a thumbnail is required, but does not yet exist, put an entry on the thumbnail queue so we
eventually make one */
if (uri == NULL) {
/* Do we have to check the gnome metadata?
*
* Do this only for the ~/.gnome-desktop directory, as it was
* the only place where GMC used it (since everywhere else we could
* not do it because of the imlib leaks).
*/
desktop_directory = nautilus_get_desktop_directory ();
directory_uri = nautilus_file_get_parent_uri (file);
directory = gnome_vfs_get_local_path_from_uri (directory_uri);
if (directory != NULL && strcmp (directory, desktop_directory) == 0) {
file_path = gnome_vfs_get_local_path_from_uri (file_uri);
if (file_path != NULL) {
res = gnome_metadata_get (file_path, "icon-filename", &size, &buf);
} else {
res = -1;
}
if (res == 0 && buf != NULL) {
uri = gnome_vfs_get_uri_from_local_path (buf);
g_free (buf);
}
g_free (file_path);
file_path = NULL;
}
g_free (directory);
g_free (desktop_directory);
}
/* also, dont make thumbnails for images in the thumbnails directory */
if (uri == NULL) {
mime_type = nautilus_file_get_mime_type (file);
@ -1442,6 +1478,22 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, const char *modifie
}
}
g_free (file_path);
file_path = NULL;
}
}
if (uri == NULL && nautilus_file_is_mime_type (file, "application/x-gnome-app-info")) {
file_path = gnome_vfs_get_local_path_from_uri (file_uri);
if (file_path != NULL) {
entry = gnome_desktop_entry_load (file_path);
if (entry != NULL) {
if (entry->icon != NULL) {
uri = gnome_vfs_get_uri_from_local_path (entry->icon);
}
gnome_desktop_entry_free (entry);
}
g_free (file_path);
file_path = NULL;
}
}

View file

@ -113,7 +113,7 @@ char **broken_cdda_interface_h_workaround = strerror_tr;
#endif
#define CHECK_STATUS_INTERVAL 2000
#define CHECK_STATUS_INTERVAL 4000
#define FLOPPY_MOUNT_PATH_PREFIX "/mnt/fd"

View file

@ -2,7 +2,7 @@
/* fm-desktop-icon-view.c - implementation of icon view for managing the desktop.
Copyright (C) 2000 Eazel, Inc.mou
Copyright (C) 2000, 2001 Eazel, Inc.mou
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@ -21,6 +21,7 @@
Authors: Mike Engber <engber@eazel.com>
Gene Z. Ragan <gzr@eazel.com>
Miguel de Icaza <miguel@ximian.com>
*/
#include <config.h>
@ -28,6 +29,7 @@
#include <X11/Xatom.h>
#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtkmain.h>
#include <ctype.h>
#include <dirent.h>
#include <eel/eel-glib-extensions.h>
@ -54,6 +56,7 @@
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-link.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-monitor.h>
#include <libnautilus-extensions/nautilus-program-choosing.h>
#include <libnautilus-extensions/nautilus-trash-monitor.h>
#include <libnautilus-extensions/nautilus-volume-monitor.h>
@ -73,10 +76,22 @@ static const char untranslated_trash_link_name[] = N_("Trash");
#define DESKTOP_BACKGROUND_POPUP_PATH_DISKS "/popups/background/Before Zoom Items/Volume Items/Disks"
/* Timeout to check the desktop directory for updates */
#define RESCAN_TIMEOUT 4000
static char *desktop_directory;
static time_t desktop_dir_modify_time;
struct FMDesktopIconViewDetails
{
BonoboUIComponent *ui;
GList *mount_black_list;
/* For the desktop rescanning
*/
guint delayed_init_signal;
guint reload_desktop_timeout;
gboolean pending_rescan;
};
typedef struct {
@ -217,6 +232,11 @@ fm_desktop_icon_view_destroy (GtkObject *object)
desktop_icon_view_property_filter,
icon_view);
/* Remove desktop rescan timeout. */
if (icon_view->details->reload_desktop_timeout != 0) {
gtk_timeout_remove (icon_view->details->reload_desktop_timeout);
}
/* Delete all of the link files. */
delete_all_mount_links ();
@ -322,7 +342,7 @@ volume_in_black_list (FMDesktopIconView *icon_view,
static char *
create_unique_volume_name (const char *desktop_path, const NautilusVolume *volume)
create_unique_volume_name (const NautilusVolume *volume)
{
GnomeVFSURI *uri;
char *uri_path, *new_name;
@ -338,7 +358,7 @@ create_unique_volume_name (const char *desktop_path, const NautilusVolume *volum
volume_name = nautilus_volume_monitor_get_volume_name (volume);
uri_path = g_strdup_printf ("%s/%s",desktop_path, volume_name);
uri_path = g_strdup_printf ("%s/%s", desktop_directory, volume_name);
uri = gnome_vfs_uri_new (uri_path);
/* Check for existing filename and create a unique name. */
@ -351,7 +371,7 @@ create_unique_volume_name (const char *desktop_path, const NautilusVolume *volum
g_free (new_name);
new_name = g_strdup_printf ("%s (%d)", volume_name, index);
uri_path = g_strdup_printf ("%s/%s", desktop_path, new_name);
uri_path = g_strdup_printf ("%s/%s", desktop_directory, new_name);
uri = gnome_vfs_uri_new (uri_path);
}
@ -377,7 +397,7 @@ static void
create_mount_link (FMDesktopIconView *icon_view,
const NautilusVolume *volume)
{
char *desktop_path, *target_uri, *volume_name;
char *target_uri, *volume_name;
const char *icon_name;
if (volume_in_black_list (icon_view, volume)) {
@ -429,15 +449,13 @@ create_mount_link (FMDesktopIconView *icon_view,
break;
}
desktop_path = nautilus_get_desktop_directory ();
target_uri = nautilus_volume_monitor_get_target_uri (volume);
volume_name = create_unique_volume_name (desktop_path, volume);
volume_name = create_unique_volume_name (volume);
/* Create link */
nautilus_link_local_create (desktop_path, volume_name, icon_name, target_uri, NULL, NAUTILUS_LINK_MOUNT);
nautilus_link_local_create (desktop_directory, volume_name, icon_name, target_uri, NULL, NAUTILUS_LINK_MOUNT);
g_free (desktop_path);
g_free (target_uri);
g_free (volume_name);
}
@ -461,6 +479,69 @@ home_uri_changed (gpointer callback_data)
update_home_link_and_delete_copies ();
}
static gboolean
do_desktop_rescan (gpointer data)
{
FMDesktopIconView *desktop_icon_view;
struct stat buf;
desktop_icon_view = FM_DESKTOP_ICON_VIEW (data);
if (desktop_icon_view->details->pending_rescan) {
return TRUE;
}
if (stat (desktop_directory, &buf) == -1) {
return TRUE;
}
if (buf.st_ctime == desktop_dir_modify_time) {
return TRUE;
}
desktop_icon_view->details->pending_rescan = TRUE;
nautilus_directory_force_reload (
fm_directory_view_get_model (
FM_DIRECTORY_VIEW (desktop_icon_view)));
return TRUE;
}
static void
done_loading (GtkObject *DirectoryView, FMDesktopIconView *desktop_icon_view)
{
struct stat buf;
desktop_icon_view->details->pending_rescan = FALSE;
if (stat (desktop_directory, &buf) == -1) {
return;
}
desktop_dir_modify_time = buf.st_ctime;
}
/* This function is used because the NautilusDirectory model does not
* exist always in the desktop_icon_view, so we wait until it has been
* instantiated.
*/
static void
delayed_init (FMDesktopIconView *desktop_icon_view)
{
/* Keep track of the load time. */
gtk_signal_connect (GTK_OBJECT (fm_directory_view_get_model
(FM_DIRECTORY_VIEW (desktop_icon_view))),
"done_loading",
GTK_SIGNAL_FUNC (done_loading), desktop_icon_view);
/* Monitor desktop directory. */
desktop_icon_view->details->reload_desktop_timeout =
gtk_timeout_add (RESCAN_TIMEOUT, do_desktop_rescan, desktop_icon_view);
gtk_signal_disconnect (GTK_OBJECT (desktop_icon_view),
desktop_icon_view->details->delayed_init_signal);
desktop_icon_view->details->delayed_init_signal = 0;
}
static void
fm_desktop_icon_view_initialize (FMDesktopIconView *desktop_icon_view)
{
@ -469,11 +550,24 @@ fm_desktop_icon_view_initialize (FMDesktopIconView *desktop_icon_view)
GtkAllocation *allocation;
GtkAdjustment *hadj, *vadj;
if (desktop_directory == NULL) {
desktop_directory = nautilus_get_desktop_directory ();
}
icon_container = get_icon_container (desktop_icon_view);
/* Set up details */
desktop_icon_view->details = g_new0 (FMDesktopIconViewDetails, 1);
/* Do a reload on the desktop if we don't have FAM, a smarter
* way to keep track of the items on the desktop.
*/
if (!nautilus_monitor_active ()) {
desktop_icon_view->details->delayed_init_signal = gtk_signal_connect
(GTK_OBJECT (desktop_icon_view), "begin_loading",
GTK_SIGNAL_FUNC (delayed_init), desktop_icon_view);
}
nautilus_icon_container_set_is_fixed_size (icon_container, TRUE);
/* Set up default mount black list */
@ -698,16 +792,14 @@ fm_desktop_icon_view_trash_state_changed_callback (NautilusTrashMonitor *trash_m
gboolean state,
gpointer callback_data)
{
char *desktop_path, *path;
char *path;
desktop_path = nautilus_get_desktop_directory ();
path = nautilus_make_path (desktop_path, TRASH_LINK_NAME);
path = nautilus_make_path (desktop_directory, TRASH_LINK_NAME);
/* Change the XML file to have a new icon. */
nautilus_link_local_set_icon (path, state ? "trash-empty.png" : "trash-full.png");
g_free (path);
g_free (desktop_path);
}
static void
@ -742,7 +834,7 @@ volume_unmounted_callback (NautilusVolumeMonitor *monitor,
NautilusVolume *volume,
FMDesktopIconView *icon_view)
{
char *link_path, *desktop_path, *volume_name;
char *link_path, *volume_name;
g_assert (volume != NULL);
@ -751,12 +843,10 @@ volume_unmounted_callback (NautilusVolumeMonitor *monitor,
return;
}
desktop_path = nautilus_get_desktop_directory ();
link_path = nautilus_make_path (desktop_path, volume_name);
link_path = nautilus_make_path (desktop_directory, volume_name);
unlink_and_notify (link_path);
g_free (volume_name);
g_free (desktop_path);
g_free (link_path);
}
@ -766,7 +856,7 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
{
const GList *element;
GList *uri_list;
char *desktop_path, *local_path;
char *local_path;
GnomeDesktopEntry *entry;
int index;
GdkPoint point;
@ -778,7 +868,6 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
return;
}
desktop_path = nautilus_get_desktop_directory ();
point.x = x;
point.y = y;
@ -806,7 +895,7 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
if (local_path != NULL) {
entry = gnome_desktop_entry_load (local_path);
if (entry != NULL) {
nautilus_link_local_create_from_gnome_entry (entry, desktop_path, &point);
nautilus_link_local_create_from_gnome_entry (entry, desktop_directory, &point);
gnome_desktop_entry_free (entry);
made_entry_link = TRUE;
}
@ -826,14 +915,13 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
if (linkname != NULL) {
linkname++;
nautilus_link_local_create (desktop_path, linkname, "gnome-http-url.png", uri,
nautilus_link_local_create (desktop_directory, linkname, "gnome-http-url.png", uri,
&point, NAUTILUS_LINK_GENERIC);
}
g_free (stripped_uri);
}
}
g_free (desktop_path);
gnome_uri_list_free_strings (uri_list);
}
@ -854,22 +942,18 @@ update_link_and_delete_copies (gboolean (*is_link_function) (const char *path),
{
DIR *dir;
gboolean found_link;
char *desktop_path;
struct dirent *dir_entry;
char *link_path;
desktop_path = nautilus_get_desktop_directory ();
dir = opendir (desktop_path);
dir = opendir (desktop_directory);
if (dir == NULL) {
g_free (desktop_path);
return FALSE;
}
found_link = FALSE;
while ((dir_entry = readdir (dir)) != NULL) {
link_path = nautilus_make_path (desktop_path, dir_entry->d_name);
link_path = nautilus_make_path (desktop_directory, dir_entry->d_name);
if ((* is_link_function) (link_path)) {
if (!found_link &&
(link_name == NULL || strcmp (dir_entry->d_name, link_name) == 0)) {
@ -884,8 +968,6 @@ update_link_and_delete_copies (gboolean (*is_link_function) (const char *path),
closedir (dir);
g_free (desktop_path);
return found_link;
}
@ -897,9 +979,7 @@ update_link_and_delete_copies (gboolean (*is_link_function) (const char *path),
static void
update_home_link_and_delete_copies (void)
{
char *desktop_path, *home_link_name, *home_uri;
desktop_path = nautilus_get_desktop_directory ();
char *home_link_name, *home_uri;
/* Note to translators: If it's hard to compose a good home
* icon name from the user name, you can use a string without
@ -916,7 +996,7 @@ update_home_link_and_delete_copies (void)
if (!update_link_and_delete_copies (nautilus_link_local_is_home_link,
NULL,
home_uri)) {
nautilus_link_local_create (desktop_path,
nautilus_link_local_create (desktop_directory,
home_link_name,
"temp-home.png",
home_uri,
@ -924,7 +1004,6 @@ update_home_link_and_delete_copies (void)
NAUTILUS_LINK_HOME);
}
g_free (desktop_path);
g_free (home_link_name);
g_free (home_uri);
}
@ -932,7 +1011,6 @@ update_home_link_and_delete_copies (void)
static void
update_trash_link_and_delete_copies (void)
{
char *desktop_path;
/* Check for trash link */
if (update_link_and_delete_copies (nautilus_link_local_is_trash_link,
@ -941,15 +1019,12 @@ update_trash_link_and_delete_copies (void)
return;
}
desktop_path = nautilus_get_desktop_directory ();
nautilus_link_local_create (desktop_path,
nautilus_link_local_create (desktop_directory,
TRASH_LINK_NAME,
"trash-empty.png",
EEL_TRASH_URI,
NULL,
NAUTILUS_LINK_TRASH);
g_free (desktop_path);
/* Make sure link represents current trash state */
fm_desktop_icon_view_trash_state_changed_callback (nautilus_trash_monitor_get (),
nautilus_trash_monitor_is_empty (),

View file

@ -52,6 +52,7 @@
#include <libgnomeui/gnome-geometry.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs-result.h>
@ -4393,6 +4394,7 @@ activate_callback (NautilusFile *file, gpointer callback_data)
FMDirectoryView *view;
char *uri, *command, *executable_path, *quoted_path, *name;
GnomeVFSMimeApplication *application;
GnomeDesktopEntry *entry;
ActivationAction action;
gboolean need_to_continue_monitoring_file_for_activation;
@ -4439,6 +4441,23 @@ activate_callback (NautilusFile *file, gpointer callback_data)
}
}
if (action != ACTIVATION_ACTION_DO_NOTHING
&& strcmp (gnome_vfs_mime_type_from_name_or_default (uri, ""),
"application/x-gnome-app-info") == 0) {
executable_path = gnome_vfs_get_local_path_from_uri (uri);
if (executable_path != NULL) {
entry = gnome_desktop_entry_load (executable_path);
if (entry != NULL) {
gnome_desktop_entry_launch (entry);
}
gnome_desktop_entry_free (entry);
}
g_free (executable_path);
action = ACTIVATION_ACTION_DO_NOTHING;
}
if (action != ACTIVATION_ACTION_DO_NOTHING && file_is_launchable (file)) {
action = ACTIVATION_ACTION_LAUNCH;

View file

@ -44,6 +44,7 @@
#include <gtk/gtkwindow.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-metadata.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@ -269,6 +270,9 @@ get_stored_icon_position_callback (NautilusIconContainer *container,
char *position_string, *scale_string;
gboolean position_good, scale_good;
char *locale;
char *path, *uri;
int res, size;
char *buf;
g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (NAUTILUS_IS_FILE (file));
@ -291,6 +295,27 @@ get_stored_icon_position_callback (NautilusIconContainer *container,
&position->x, &position->y) == 2;
g_free (position_string);
/* If it is the desktop directory, maybe the gnome-libs metadata has information about it */
if (!position_good) {
if (nautilus_file_is_local (file) && nautilus_file_is_in_desktop (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL) {
res = gnome_metadata_get (path, "icon-position", &size, &buf);
if (res == 0) {
if (sscanf (buf, "%d%d", &position->x, &position->y) == 2) {
position_good = TRUE;
}
g_free (buf);
}
}
g_free (path);
g_free (uri);
}
}
/* Get the scale of the icon from the metadata. */
scale_string = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_ICON_SCALE, "1");
@ -1780,6 +1805,8 @@ icon_position_changed_callback (NautilusIconContainer *container,
char *position_string;
char *scale_string, *scale_string_x, *scale_string_y;
char *locale;
char *uri, *path;
char buf [128];
g_assert (FM_IS_ICON_VIEW (icon_view));
g_assert (container == get_icon_container (icon_view));
@ -1814,6 +1841,19 @@ icon_position_changed_callback (NautilusIconContainer *container,
(file, NAUTILUS_METADATA_KEY_ICON_POSITION,
NULL, position_string);
g_free (position_string);
if (nautilus_file_is_local (file) && nautilus_file_is_in_desktop (file)) {
uri = nautilus_file_get_uri (file);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL) {
g_snprintf (buf, sizeof (buf), "%d %d", position->x, position->y);
gnome_metadata_set (path, "icon-position", strlen (buf) + 1, buf);
}
g_free (uri);
g_free (path);
}
}
/* FIXME bugzilla.eazel.com 662:

View file

@ -39,6 +39,7 @@
#include "nautilus-shell.h"
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
#include <dirent.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-string-list.h>
@ -47,6 +48,7 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-metadata.h>
#include <libgnome/gnome-util.h>
#include <libgnomeui/gnome-client.h>
#include <libgnomeui/gnome-messagebox.h>
@ -334,6 +336,84 @@ nautilus_make_uri_list_from_shell_strv (const char * const *strv)
return uri_list;
}
/* Find ~/.gnome-desktop/Trash and rename it to ~/.gnome-desktop/Trash-gmc
* Only if it is a directory
*/
static void
migrate_gmc_trash (void)
{
char *dp, *trash_dir, *dest;
struct stat buf;
dp = nautilus_get_desktop_directory ();
trash_dir = g_strconcat (dp, "/", "Trash", NULL);
dest = g_strconcat (dp, "/", "Trash.gmc", NULL);
if (stat (trash_dir, &buf) == 0 && S_ISDIR (buf.st_mode)) {
rename (trash_dir, dest);
gnome_metadata_rename (trash_dir, dest);
}
g_free (dp);
g_free (trash_dir);
g_free (dest);
}
static void
migrate_old_nautilus_files (void)
{
char *new_desktop_dir, *np;
char *old_desktop_dir, *op;
char *old_desktop_dir_new_name;
struct stat buf;
DIR *dir;
struct dirent *de;
old_desktop_dir = g_strconcat (g_get_home_dir (), "/.nautilus/desktop", NULL);
if (stat (old_desktop_dir, &buf) == -1) {
g_free (old_desktop_dir);
return;
}
if (!S_ISLNK (buf.st_mode)){
dir = opendir (old_desktop_dir);
if (dir == NULL) {
g_free (old_desktop_dir);
return;
}
new_desktop_dir = nautilus_get_desktop_directory ();
while ((de = readdir (dir)) != NULL){
if (de->d_name [0] == '.'){
if (de->d_name [0] == 0)
continue;
if (de->d_name [1] == '.' && de->d_name [2] == 0)
continue;
}
op = g_strconcat (old_desktop_dir, "/", de->d_name, NULL);
np = g_strconcat (new_desktop_dir, "/", de->d_name, NULL);
rename (op, np);
g_free (op);
g_free (np);
}
closedir (dir);
g_free (new_desktop_dir);
}
/* In case we miss something */
old_desktop_dir_new_name = g_strconcat (old_desktop_dir, "-old", NULL);
rename (old_desktop_dir, old_desktop_dir_new_name);
g_free (old_desktop_dir_new_name);
g_free (old_desktop_dir);
}
void
nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
@ -374,6 +454,10 @@ nautilus_application_startup (NautilusApplication *application,
nautilus_first_time_druid_show (application, urls);
return;
}
/* Make the desktop work with gmc and old Nautilus. */
migrate_gmc_trash ();
migrate_old_nautilus_files ();
/* initialize the sound machinery */
nautilus_sound_initialize ();

View file

@ -65,7 +65,9 @@
/* Druid page number enumeration */
enum {
USER_LEVEL_PAGE = 0,
#ifdef TRANSITIONAL_NAUTILUS
GMC_TRANSITION_PAGE,
#endif
OFFER_UPDATE_PAGE,
UPDATE_FEEDBACK_PAGE,
PROXY_CONFIGURATION_PAGE,
@ -135,9 +137,11 @@ static pid_t child_pid;
/* GMC transition tool globals */
static gboolean draw_desktop = TRUE;
#ifdef TRANSITIONAL_NAUTILUS
static gboolean add_to_session = TRUE;
static gboolean transfer_gmc_icons = TRUE;
static GtkWidget *draw_desktop_checkbox_widget;
#endif
static int current_user_level;
@ -145,7 +149,9 @@ static void initiate_file_download (GnomeDruid *druid);
static gboolean set_http_proxy (const char *proxy_url);
static gboolean attempt_http_proxy_autoconfigure (void);
static gboolean check_network_connectivity (void);
#ifdef TRANSITIONAL_NAUTILUS
static gint convert_gmc_desktop_icons (gpointer unused_data);
#endif
static void update_finished_label (void);
static void
@ -245,7 +251,7 @@ druid_finished (GtkWidget *druid_page)
signup_uris[1] = NULL;
}
#ifdef TRANSITIONAL_NAUTILUS
/* Do the GMC to Nautilus Transition */
nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_SHOW_DESKTOP, draw_desktop);
nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_ADD_TO_SESSION, add_to_session);
@ -256,6 +262,7 @@ druid_finished (GtkWidget *druid_page)
*/
gtk_idle_add (convert_gmc_desktop_icons, NULL);
}
#endif
/* Arrange to create default services icon on the desktop. Do this
* at idle time for the same reason as when converting gmc icons
@ -293,11 +300,13 @@ set_up_background (NautilusDruidPageEazel *page, const char *background_color)
static void
update_draw_desktop_checkbox_state (void)
{
#ifdef TRANSITIONAL_NAUTILUS
if (current_user_level == NAUTILUS_USER_LEVEL_NOVICE) {
gtk_widget_hide (draw_desktop_checkbox_widget);
} else {
gtk_widget_show (draw_desktop_checkbox_widget);
}
#endif
}
/* handler for user level buttons changing */
@ -819,13 +828,13 @@ next_proxy_configuration_page_callback (GtkWidget *button, GnomeDruid *druid)
return TRUE;
}
#ifdef TRANSITIONAL_NAUTILUS
static gint
convert_gmc_desktop_icons (gpointer unused_data)
{
const char *home_dir;
char *gmc_desktop_dir,*nautilus_desktop_dir, *link_path;
struct stat st;
char *gmc_desktop_dir, *nautilus_desktop_dir, *link_path;
DIR *dir;
struct dirent *dirent;
GnomeDesktopEntry *gmc_link;
@ -837,17 +846,6 @@ convert_gmc_desktop_icons (gpointer unused_data)
gmc_desktop_dir = g_strdup_printf ("%s/.gnome-desktop", home_dir);
if (stat (gmc_desktop_dir, &st) != 0) {
g_free (gmc_desktop_dir);
return FALSE;
}
if (!S_ISDIR (st.st_mode)) {
g_free (gmc_desktop_dir);
g_message ("Not a dir");
return FALSE;
}
dir = opendir (gmc_desktop_dir);
if (dir == NULL) {
g_free (gmc_desktop_dir);
@ -863,8 +861,6 @@ convert_gmc_desktop_icons (gpointer unused_data)
}
link_path = g_strdup_printf ("%s/%s", gmc_desktop_dir, dirent->d_name);
gmc_link = gnome_desktop_entry_load (link_path);
gmc_link = gnome_desktop_entry_load_unconditional (link_path);
g_free (link_path);
@ -873,7 +869,9 @@ convert_gmc_desktop_icons (gpointer unused_data)
gnome_desktop_entry_free (gmc_link);
}
}
closedir (dir);
g_free (gmc_desktop_dir);
g_free (nautilus_desktop_dir);
@ -941,6 +939,7 @@ set_up_gmc_transition_page (NautilusDruidPageEazel *page)
gtk_widget_show_all (main_box);
}
#endif
/* handle the "back" signal from the finish page to skip the feedback page */
@ -1108,10 +1107,12 @@ nautilus_first_time_druid_show (NautilusApplication *application, const char *ur
/* set up the user level page */
set_page_title (NAUTILUS_DRUID_PAGE_EAZEL (pages[USER_LEVEL_PAGE]), _("Choose Your User Level"));
set_up_user_level_page (NAUTILUS_DRUID_PAGE_EAZEL (pages[USER_LEVEL_PAGE]));
#ifdef TRANSITIONAL_NAUTILUS
/* set up the GMC transition page */
set_page_title (NAUTILUS_DRUID_PAGE_EAZEL (pages[GMC_TRANSITION_PAGE]), _("GMC to Nautilus Transition"));
set_up_gmc_transition_page (NAUTILUS_DRUID_PAGE_EAZEL (pages[GMC_TRANSITION_PAGE]));
#endif
/* set up the update page */
set_page_title (NAUTILUS_DRUID_PAGE_EAZEL (pages[OFFER_UPDATE_PAGE]), _("Checking Your Internet Connection"));

View file

@ -1353,8 +1353,7 @@ nautilus_view_frame_set_label (NautilusViewFrame *view,
/* Activate the underlying control frame whenever the view is mapped.
* This causes the view to merge its menu items, for example. For
* sidebar panels, it might be a little late to merge them at map
* time, especially since we don't unmerge them at unmap time (not
* until destroy time).
* time. What's a better time?
*/
static void
nautilus_view_frame_map (GtkWidget *view_as_widget)