From 771413102b71501e804ac30f9e2ea1644b56b79c Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 11 Dec 1998 01:57:01 +0000 Subject: [PATCH] 1998-12-07 Miguel de Icaza * gicon.c (gnome_file_entry_color): If we do not have permissions for this directory, indicate this with a special icon. * gscreen.c (panel_icon_list_select_icon): Middle button opens a new panel on a directory. --- gnome/ChangeLog | 8 ++++++++ gnome/Makefile.in | 2 ++ gnome/gicon.c | 40 ++++++++++++++++++++++++++++++++++++++-- gnome/gview.c | 4 ++-- gnome/i-dirclosed.png | Bin 0 -> 1102 bytes gnome/mc.metadata.in | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 gnome/i-dirclosed.png diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 5b17cbeab..9dfd23f64 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,11 @@ +1998-12-07 Miguel de Icaza + + * gicon.c (gnome_file_entry_color): If we do not have permissions + for this directory, indicate this with a special icon. + + * gscreen.c (panel_icon_list_select_icon): Middle button opens a + new panel on a directory. + 1998-12-08 Federico Mena Quintero * gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there diff --git a/gnome/Makefile.in b/gnome/Makefile.in index 2f9c01297..a78c211a5 100644 --- a/gnome/Makefile.in +++ b/gnome/Makefile.in @@ -26,6 +26,7 @@ PIXMAPS = \ dir-open.xpm GNOMESRCS = \ + gaction.c \ gblist.c \ gcache.c \ gcliplabel.c \ @@ -79,6 +80,7 @@ GNOMEHDRS = \ ICONS = \ directory.xpm \ + i-dirclosed.png \ i-directory.png \ i-executable.png \ i-symlink.png \ diff --git a/gnome/gicon.c b/gnome/gicon.c index df953d682..1b56d77f9 100644 --- a/gnome/gicon.c +++ b/gnome/gicon.c @@ -22,6 +22,7 @@ static int gicon_inited = FALSE; /* These are some default images used in the Icon View */ static GdkImlibImage *icon_view_directory; +static GdkImlibImage *icon_view_dirclosed; static GdkImlibImage *icon_view_executable; static GdkImlibImage *icon_view_symlink; static GdkImlibImage *icon_view_regular; @@ -31,6 +32,10 @@ static GdkImlibImage *icon_view_char_dev; static GdkImlibImage *icon_view_block_dev; static GdkImlibImage *icon_view_stalled; +/* Our UID and GID */ +static uid_t our_uid; +static gid_t our_gid; + /** * gicon_init: * @@ -45,8 +50,12 @@ gicon_init (void) icon_hash = g_hash_table_new (g_str_hash, g_str_equal); gicon_inited = TRUE; + our_uid = getuid (); + our_gid = getgid (); + /* Recursive call to load the stock images */ icon_view_directory = gicon_stock_load ("i-directory.png"); + icon_view_dirclosed = gicon_stock_load ("i-dirclosed.png"); icon_view_executable = gicon_stock_load ("i-executable.png"); icon_view_symlink = gicon_stock_load ("i-symlink.png"); icon_view_regular = gicon_stock_load ("i-regular.png"); @@ -57,6 +66,7 @@ gicon_init (void) icon_view_stalled = gicon_stock_load ("i-stalled.png"); if (icon_view_directory == NULL || + icon_view_dirclosed == NULL || icon_view_executable == NULL || icon_view_symlink == NULL || icon_view_regular == NULL || @@ -129,9 +139,35 @@ static GdkImlibImage * gnome_file_entry_color (file_entry *fe) { mode_t mode = fe->buf.st_mode; - - if (S_ISDIR (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) diff --git a/gnome/gview.c b/gnome/gview.c index 88736bcd9..c32bfce10 100644 --- a/gnome/gview.c +++ b/gnome/gview.c @@ -290,8 +290,8 @@ GnomeUIInfo gview_file_menu [] = { N_("Jump to a specified line number"), &gnome_goto_line, GNOME_STOCK_PIXMAP_JUMP_TO), GNOMEUIINFO_ITEM (N_("Monitor file"), N_("Monitor file growing"), &gnome_monitor, NULL), - GNOMEUIINFO_ITEM_STOCK (N_("Quit"), - N_("Terminate the viewer"), + GNOMEUIINFO_ITEM_STOCK (N_("Close"), + N_("Close the viewer"), &gview_quit, GNOME_STOCK_PIXMAP_QUIT), { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; diff --git a/gnome/i-dirclosed.png b/gnome/i-dirclosed.png new file mode 100644 index 0000000000000000000000000000000000000000..6a014c67e4d2bfb4006045836ec9bac0b0c89633 GIT binary patch literal 1102 zcmV-U1hM;xP)i0Hs=uIt7qnhVFS)~y#E+s)X` zZXMFz4a8Y23}mZe7oDK=ra~PBVO{B!3oGbyGY1`IQtKb;1f#K0Yr)3E6-{!^E^N+X z(#)Jc>IUb51LvINeCK)I?|I+vydT)GVZ(+E8~15(($;p8=H^BK ze7+XL1ItGcS^E3?Id#gX5jHrMFl3?O;qN$e=3VVNCt5Fv>{~Q9`-)~cIXTVD%sk!Q zm-Bw>`1~^-Jz8TlI9`yeTny=KtgPI_=W9^`hK7cytu3de+4(9NaUXOm=L8%k^_KfbQK{4j~{Q7N+p?^nx&_wM;ov6iwY& zZrq~1-AR3YE5YChB_(A5JbbuJTibg~Obm1F+K3k2qav%T3f;Xsir;^ZVDKl-o_!x# zE>%;hojuiZDP5iCd8O&)LnpYo`IN4Um-Sf)!0$iDUcxSF_asS1QBnYSt35@NXur^% zcW>xwz!HJdL4Sxu=AW0y9g#^|0Ea`;MSkdNKsySFIurpXPSh|nbKlV5g-BW{qM!gF z_AKXiyBHfAHT;51)N{!eYoS;yZf*veni`44;)Z7-o3N3HZ^aYF1qdN11?u3 zvg|Nr8$C(9x%pH(-`@Vqynx%cgZTY#oASP%l~-GXR#vI3tS~R2uWyh$cSaZ+`&r0x zsha&VueaK=PljxJMpxIl{{77ZKY5C7Dcx=t^YaV)%A3biWeMSI;(snIa`V<`q4rW3 z7BD{kE7jHReLaJoS;!@vTLkV;&1PE1V)|sETfn7D-x3P_s9o>u>=KK`@p!8KRYW1; zTk!l-hM_TlYHghIb*=exT}jZj9!L1lI;o*