1998-12-10 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gcmd.c (gnome_close_panel): When a panel is destroyed, chdir to
	root directory, as the process will be holding the inode for the
	directory that was selected until an operation is performed in
	another panel.

	* gicon.c (gicon_get_icon_for_file): Invert the way the testing
	for icons is done to handle directories properly.
This commit is contained in:
Miguel de Icaza 1998-12-11 02:58:48 +00:00
parent 940cdf53c3
commit 51d2d5aff1
3 changed files with 59 additions and 42 deletions

View File

@ -1,3 +1,13 @@
1998-12-10 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gcmd.c (gnome_close_panel): When a panel is destroyed, chdir to
root directory, as the process will be holding the inode for the
directory that was selected until an operation is performed in
another panel.
* gicon.c (gicon_get_icon_for_file): Invert the way the testing
for icons is done to handle directories properly.
1998-12-10 Jonathan Blandford <jrb@redhat.com>
* gscreen.c (x_create_panel): made some small stylistic changes.
@ -45,6 +55,7 @@ Thu Dec 10 21:38:55 1998 Owen Taylor <otaylor@redhat.com>
* gscreen.c (panel_icon_list_select_icon): Middle button opens a
new panel on a directory.
>>>>>>> 1.184
1998-12-08 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there

View File

@ -120,5 +120,7 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel)
destroy_widget ((void *)panel);
layout_panel_gone (panel);
mc_chdir ("/");
return TRUE;
}

View File

@ -140,45 +140,6 @@ gnome_file_entry_color (file_entry *fe)
{
mode_t mode = fe->buf.st_mode;
/*
* If a directory, choose the best icon that reprensents it
*/
if (S_ISDIR (mode)){
if (fe->buf.st_uid != our_uid){
if (fe->buf.st_gid != our_gid){
/*
* We do not share the UID or the GID,
* test for read/execute permissions
*/
if ((mode & (S_IROTH | S_IXOTH)) != (S_IROTH | S_IXOTH))
return icon_view_dirclosed;
} else {
/*
* Same group, check if we have permissions
*/
if ((mode & (S_IRGRP | S_IXGRP)) != (S_IRGRP | S_IXGRP))
return icon_view_dirclosed;
}
} else {
if ((mode & (S_IRUSR | S_IXUSR)) != (S_IRUSR | S_IXUSR))
return icon_view_dirclosed;
}
return icon_view_directory;
}
if (S_ISLNK (mode)){
if (fe->f.link_to_dir)
return icon_view_directory;
if (fe->f.stalled_link)
return icon_view_stalled;
return icon_view_symlink;
}
if (S_ISSOCK (mode))
return icon_view_sock;
@ -212,14 +173,57 @@ gicon_get_icon_for_file (file_entry *fe)
GdkImlibImage *image;
int size;
char *buf;
mode_t mode;
g_return_val_if_fail (fe != NULL, NULL);
if (!gicon_inited)
gicon_init ();
mode = fe->buf.st_mode;
/*
* 1. Try to fetch the icon from the metadata.
* 1. First test for it being a directory or a link to a directory.
*/
if (S_ISDIR (mode)){
if (fe->buf.st_uid != our_uid){
if (fe->buf.st_gid != our_gid){
/*
* We do not share the UID or the GID,
* test for read/execute permissions
*/
if ((mode & (S_IROTH | S_IXOTH)) != (S_IROTH | S_IXOTH))
return icon_view_dirclosed;
} else {
/*
* Same group, check if we have permissions
*/
if ((mode & (S_IRGRP | S_IXGRP)) != (S_IRGRP | S_IXGRP))
return icon_view_dirclosed;
}
} else {
if ((mode & (S_IRUSR | S_IXUSR)) != (S_IRUSR | S_IXUSR))
return icon_view_dirclosed;
}
return icon_view_directory;
}
if (S_ISLNK (mode)){
if (fe->f.link_to_dir)
return icon_view_directory;
if (fe->f.stalled_link)
return icon_view_stalled;
return icon_view_symlink;
}
/*
* 2. Try to fetch the icon from the metadata.
*/
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
image = gicon_get_by_filename (buf);
@ -229,7 +233,7 @@ gicon_get_icon_for_file (file_entry *fe)
}
/*
* 2. Try to fetch the icon as an inline png from the metadata.
* 3. Try to fetch the icon as an inline png from the metadata.
*/
if (gnome_metadata_get (fe->fname, "icon-inline-png", &size, &buf) == 0){
image = gdk_imlib_inlined_png_to_image (buf, size);
@ -241,7 +245,7 @@ gicon_get_icon_for_file (file_entry *fe)
}
/*
* 3. Try to find an appropiate icon from the stat information or
* 4. Try to find an appropiate icon from the stat information or
* the hard coded filename.
*/
image = gnome_file_entry_color (fe);