[Xfce4-commits] r30028 - in thunar/branches/migration-to-gio: . thunar

Jannis Pohlmann jannis at xfce.org
Tue Jun 16 01:38:03 CEST 2009


Author: jannis
Date: 2009-06-15 23:38:03 +0000 (Mon, 15 Jun 2009)
New Revision: 30028

Modified:
   thunar/branches/migration-to-gio/ChangeLog
   thunar/branches/migration-to-gio/thunar/thunar-file.c
Log:
	* thunar/thunar-file.c: Use S_ISCHR, S_ISSOCK, S_ISFIFO and S_ISBLK to
	  generate the first character of mode strings for special/unknown
	  file types because we don't have THUNAR_VFS_FILE_TYPE_SOCKET etc.
	  anymore. There will be no replacements for THUNAR_VFS_FILE_TYPE_PORT
	  and THUNAR_VFS_FILE_TYPE_DOOR for now.

Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog	2009-06-15 23:37:41 UTC (rev 30027)
+++ thunar/branches/migration-to-gio/ChangeLog	2009-06-15 23:38:03 UTC (rev 30028)
@@ -1,5 +1,13 @@
 2009-06-16	Jannis Pohlmann <jannis at xfce.org>
 
+	* thunar/thunar-file.c: Use S_ISCHR, S_ISSOCK, S_ISFIFO and S_ISBLK to
+	  generate the first character of mode strings for special/unknown
+	  file types because we don't have THUNAR_VFS_FILE_TYPE_SOCKET etc.
+	  anymore. There will be no replacements for THUNAR_VFS_FILE_TYPE_PORT
+	  and THUNAR_VFS_FILE_TYPE_DOOR for now.
+
+2009-06-16	Jannis Pohlmann <jannis at xfce.org>
+
 	* thunar/thunar-icon-factory.c: Remove commented code.
 
 2009-06-15	Jannis Pohlmann <jannis at xfce.org>

Modified: thunar/branches/migration-to-gio/thunar/thunar-file.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.c	2009-06-15 23:37:41 UTC (rev 30027)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.c	2009-06-15 23:38:03 UTC (rev 30028)
@@ -26,6 +26,10 @@
 #include <sys/types.h>
 #endif
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -1507,25 +1511,26 @@
   text = g_new (gchar, 11);
 
   /* file type */
+  /* TODO earlier versions of Thunar had 'P' for ports and
+   * 'D' for doors. Do we still need those? */
   switch (kind)
     {
-#if 0 /* TODO */
-    case THUNAR_VFS_FILE_TYPE_PORT:       text[0] = 'P'; break;
-    case THUNAR_VFS_FILE_TYPE_DOOR:       text[0] = 'D'; break;
-    case THUNAR_VFS_FILE_TYPE_SOCKET:     text[0] = 's'; break;
-#endif
     case G_FILE_TYPE_SYMBOLIC_LINK:       text[0] = 'l'; break;
     case G_FILE_TYPE_REGULAR:             text[0] = '-'; break;
-#if 0 /* TODO */
-    case THUNAR_VFS_FILE_TYPE_BLOCKDEV:   text[0] = 'b'; break;
-#endif 
     case G_FILE_TYPE_DIRECTORY:           text[0] = 'd'; break;
-#if 0 /* TODO */
-    case THUNAR_VFS_FILE_TYPE_CHARDEV:    text[0] = 'c'; break;
-    case THUNAR_VFS_FILE_TYPE_FIFO:       text[0] = 'f'; break;
-#endif
+    case G_FILE_TYPE_SPECIAL:
     case G_FILE_TYPE_UNKNOWN:
-    default:                              text[0] = ' '; break;
+    default:
+      if (S_ISCHR (mode))
+        text[0] = 'c';
+      else if (S_ISSOCK (mode))
+        text[0] = 's';
+      else if (S_ISFIFO (mode))
+        text[0] = 'f';
+      else if (S_ISBLK (mode))
+        text[0] = 'b';
+      else
+        text[0] = ' ';
     }
 
   /* permission flags */




More information about the Xfce4-commits mailing list