diff --git a/gnome/ChangeLog b/gnome/ChangeLog index af8320bd7..a5d5abc1f 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,13 @@ +1998-12-10 Miguel de Icaza + + * 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 * gscreen.c (x_create_panel): made some small stylistic changes. @@ -45,6 +55,7 @@ Thu Dec 10 21:38:55 1998 Owen Taylor * gscreen.c (panel_icon_list_select_icon): Middle button opens a new panel on a directory. +>>>>>>> 1.184 1998-12-08 Federico Mena Quintero * gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there diff --git a/gnome/gcmd.c b/gnome/gcmd.c index 8744de5da..a8c22d1a2 100644 --- a/gnome/gcmd.c +++ b/gnome/gcmd.c @@ -120,5 +120,7 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel) destroy_widget ((void *)panel); layout_panel_gone (panel); + + mc_chdir ("/"); return TRUE; } diff --git a/gnome/gicon.c b/gnome/gicon.c index 1b56d77f9..e4022fe5f 100644 --- a/gnome/gicon.c +++ b/gnome/gicon.c @@ -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);