1
1

2001-04-11 Miguel de Icaza <miguel@ximian.com>

* gdesktop.c (should_hide_nautilus_file): New function, used to
	decide if things should be hidden (handles nautilus home key,
	trash key, and .nautilus-metafile.xml for now)

	(desktop_reload_icons): Hook up above function.

	* gdesktop-init.c (migrate): New function to help migrate metadata
	information.

	* gscreen.c (file_list_popup): Changed here too.

	* gdesktop-init.c (gdesktop_links_init): Migrate from Trash to
	Trash.gmc to integrate with Nautilus on the same computer.

	* gcmd.c (create_trash_panel): ditto

	* gpopup2.c (check_trash_func): Rename trash directory to Trash.gmc
Этот коммит содержится в:
Miguel de Icaza 2001-04-13 01:03:22 +00:00
родитель ab7a3c9c12
Коммит 585145373e
6 изменённых файлов: 99 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,23 @@
2001-04-11 Miguel de Icaza <miguel@ximian.com>
* gdesktop.c (should_hide_nautilus_file): New function, used to
decide if things should be hidden (handles nautilus home key,
trash key, and .nautilus-metafile.xml for now)
(desktop_reload_icons): Hook up above function.
* gdesktop-init.c (migrate): New function to help migrate metadata
information.
* gscreen.c (file_list_popup): Changed here too.
* gdesktop-init.c (gdesktop_links_init): Migrate from Trash to
Trash.gmc to integrate with Nautilus on the same computer.
* gcmd.c (create_trash_panel): ditto
* gpopup2.c (check_trash_func): Rename trash directory to Trash.gmc
2001-04-06 Miguel de Icaza <miguel@ximian.com>
* gdesktop.c (do_rescan): Added automatic desktop reloading.

Просмотреть файл

@ -637,7 +637,7 @@ create_trash_panel (void)
is_trash_panel = TRUE;
trash_dir = g_strconcat (gnome_user_home_dir, "/",
DESKTOP_DIR_NAME, "/",
"Trash",
"Trash.gmc",
NULL);
retval = new_panel_at (trash_dir);
g_free (trash_dir);

Просмотреть файл

@ -148,7 +148,7 @@ gdesktop_links_init (void)
g_free (link_name);
/* Create the link to the user's trash directory */
link_name = g_concat_dir_and_file (desktop_directory, "Trash");
link_name = g_concat_dir_and_file (desktop_directory, "Trash.gmc");
icon = gnome_pixmap_file ("mc/gnome-trashcan.png");
mc_mkdir (link_name, S_IRUSR | S_IWUSR | S_IXUSR );
if (icon){

Просмотреть файл

@ -595,14 +595,62 @@ get_drop_grid (gint xpos, gint ypos, gint need_position_list_length, GSList *gri
get_icon_snap_pos (&new_xpos, &new_ypos);
}
grid_list = g_slist_append (grid_list, (void *) new_xpos); grid_list = g_slist_append (grid_list, (void *) new_ypos);
grid_list = g_slist_append (grid_list, (void *) new_xpos);
grid_list = g_slist_append (grid_list, (void *) new_ypos);
}
}
return grid_list;
}
#define NAUTILUS_KEY "<?xml version=\"1.0\"?>\n<nautilus_object nautilus_link=\""
#define NAUTILUS_MOUNT_KEY "Mount Link\""
#define NAUTILUS_GENERIC_KEY "Generic Link\""
#define NAUTILUS_HOME_KEY "Home Link\""
#define NAUTILUS_TRASH_KEY "Trash Link\""
static gboolean
should_skip_nautilus_file (char *name)
{
char buffer [256], *full, *p;
FILE *f;
int n;
if (strcmp (name, ".nautilus-metafile.xml") == 0)
return TRUE;
if (strcmp (name, "Trash") == 0)
return TRUE;
full = g_concat_dir_and_file (desktop_directory, name);
f = fopen (full, "r");
g_free (full);
if (f == NULL)
return FALSE;
n = fread (buffer, sizeof (buffer), 1, f);
fclose (f);
if (n < 0)
return FALSE;
if (strncmp (buffer, NAUTILUS_KEY, strlen (NAUTILUS_KEY)) != 0)
return FALSE;
p = buffer + strlen (NAUTILUS_KEY);
if (strncmp (p, NAUTILUS_HOME_KEY, strlen (NAUTILUS_HOME_KEY)) == 0)
return TRUE;
if (strncmp (p, NAUTILUS_TRASH_KEY, strlen (NAUTILUS_TRASH_KEY)) == 0)
return TRUE;
if (strncmp (p, NAUTILUS_MOUNT_KEY, strlen (NAUTILUS_MOUNT_KEY)) == 0)
return TRUE;
return FALSE;
}
/* Reloads the desktop icons efficiently. If there are "new" files for which no
* icons have been created, then icons for them will be created started at the
@ -665,6 +713,9 @@ desktop_reload_icons (int user_pos, int xpos, int ypos)
&& dirent->d_name[2] == 0))
continue;
if (should_skip_nautilus_file (dirent->d_name))
continue;
l = icon_exists_in_list (all_icons, dirent->d_name);
if (l) {
GdkImlibImage *im;
@ -2428,6 +2479,25 @@ create_layout_info (void)
layout_slots = g_new0 (struct layout_slot, layout_cols * layout_rows);
}
/*
* Rename old Trash directory if found
*/
static void
migrate_init (void)
{
struct stat buf;
char *old_trash_dir = g_concat_dir_and_file (desktop_directory, "Trash");
if (stat (old_trash_dir, &buf) == 0 && S_ISDIR (buf.st_mode)){
char *new_trash_dir = g_concat_dir_and_file (desktop_directory, "Trash.gmc");
rename (old_trash_dir, new_trash_dir);
gnome_metadata_rename (old_trash_dir, new_trash_dir);
g_free (new_trash_dir);
}
g_free (old_trash_dir);
}
/*
* Check that the user's desktop directory exists, and if not, create the
* default desktop setup.
@ -2450,6 +2520,7 @@ create_desktop_dir (void)
gmount_setup_devices ();
gprint_setup_devices ();
}
migrate_init ();
}
/* Property placed on target windows */
@ -3420,7 +3491,7 @@ setup_desktop_clicks (void)
}
static gboolean
do_rescan (void)
do_rescan (gpointer data)
{
struct stat buf;

Просмотреть файл

@ -202,7 +202,7 @@ check_trash_func (WPanel *panel, DesktopIconInfo *dii)
gint i;
trash_dir = g_strconcat (gnome_user_home_dir, "/",
DESKTOP_DIR_NAME, "/",
"Trash",
"Trash.gmc",
NULL);
if (mc_stat (trash_dir, &st) || !S_ISDIR (st.st_mode)) {
@ -243,7 +243,7 @@ check_trash_icon_func (WPanel *panel, DesktopIconInfo *dii)
trash_dir = g_strconcat (gnome_user_home_dir, "/",
DESKTOP_DIR_NAME, "/",
"Trash",
"Trash.gmc",
NULL);
file_name = get_full_filename (panel);
@ -804,7 +804,7 @@ handle_trash (GtkWidget *widget, WPanel *panel)
trash_dir = g_strconcat (gnome_user_home_dir, "/",
DESKTOP_DIR_NAME, "/",
"Trash",
"Trash.gmc",
NULL);
if (panel_operate (cpanel, OP_MOVE, trash_dir, FALSE)) {

Просмотреть файл

@ -1455,7 +1455,7 @@ file_list_popup (GdkEventButton *event, WPanel *panel)
trash_dir = g_strconcat (gnome_user_home_dir, "/",
DESKTOP_DIR_NAME, "/",
"Trash",
"Trash.gmc",
NULL);
if ((strncmp (panel->cwd, trash_dir, strlen (trash_dir)) == 0) && (panel->count != 1))