[Cxplorer-cvs 00866] CVS update: cxplorer/src

Zurück zum Archiv-Index

Yasumichi Akahoshi yasum****@users*****
2005年 2月 7日 (月) 18:07:37 JST


Index: cxplorer/src/fileview.c
diff -u cxplorer/src/fileview.c:1.27 cxplorer/src/fileview.c:1.28
--- cxplorer/src/fileview.c:1.27	Sat Jan 22 01:29:21 2005
+++ cxplorer/src/fileview.c	Mon Feb  7 18:07:37 2005
@@ -6,7 +6,7 @@
  * a instance of GtkTreeView.
  * @author Yasumichi Akahoshi <yasum****@users*****>
  * @date 2004
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <magic.h>
 #include "cxplorer.h"
 #include "support.h"
 #include "fileview.h"
@@ -311,33 +312,19 @@
 					 tree_model,
 					 GtkTreeIter * iter, gpointer data)
 {
+	magic_t cookie;
 	gchar *gcFullPath;
+	gchar *filetype;
+
+	cookie = magic_open(MAGIC_NONE);
+	magic_load(cookie, NULL);
 
 	gtk_tree_model_get (tree_model, iter, FVC_FILE_PATH,
 			    &gcFullPath, FVC_TERMINATOR);
-	if (g_file_test (gcFullPath, G_FILE_TEST_IS_DIR))
-	{
-		if (g_file_test (gcFullPath, G_FILE_TEST_IS_SYMLINK))
-		{
-			g_object_set (cell, "text", _("Link to directory"),
-				      NULL);
-		}
-		else
-		{
-			g_object_set (cell, "text", _("Directory"), NULL);
-		}
-	}
-	else
-	{
-		if (g_file_test (gcFullPath, G_FILE_TEST_IS_SYMLINK))
-		{
-			g_object_set (cell, "text", _("Link to file"), NULL);
-		}
-		else
-		{
-			g_object_set (cell, "text", _("File"), NULL);
-		}
-	}
+
+	filetype = g_strdup(magic_file(cookie, gcFullPath));
+	g_object_set(cell, "text", filetype, NULL);	
+	magic_close(cookie);
 }
 
 /**


Cxplorer-cvs メーリングリストの案内
Zurück zum Archiv-Index