Yasumichi Akahoshi
yasum****@users*****
2005年 10月 2日 (日) 01:45:03 JST
Index: cxplorer/src/cxp-file-list-store.c diff -u cxplorer/src/cxp-file-list-store.c:1.4 cxplorer/src/cxp-file-list-store.c:1.5 --- cxplorer/src/cxp-file-list-store.c:1.4 Fri Sep 23 02:05:09 2005 +++ cxplorer/src/cxp-file-list-store.c Sun Oct 2 01:45:03 2005 @@ -642,31 +642,8 @@ newrecord = g_new0 (CxpFileInfo, 1); newrecord->fullpath = g_strdup (fullpath); + newrecord->mime_type = cxp_get_mime_type_for_file (fullpath); lstat (fullpath, &status); - switch (status.st_mode & S_IFMT) - { - case S_IFSOCK: - newrecord->mime_type = g_strdup ("inode/socket"); - break; - case S_IFLNK: - newrecord->mime_type = g_strdup ("inode/symlink"); - break; - case S_IFREG: - newrecord->mime_type = cxp_get_mime_type_for_file (fullpath);; - break; - case S_IFBLK: - newrecord->mime_type = g_strdup ("inode/blockdevice"); - break; - case S_IFDIR: - newrecord->mime_type = g_strdup ("inode/directory"); - break; - case S_IFCHR: - newrecord->mime_type = g_strdup ("inode/chardevice"); - break; - case S_IFIFO: - newrecord->mime_type = g_strdup ("inode/fifo"); - break; - } newrecord->file_size = status.st_size; newrecord->file_mode = status.st_mode; newrecord->file_mtime = status.st_mtime; Index: cxplorer/src/cxp-right-pane.c diff -u cxplorer/src/cxp-right-pane.c:1.77 cxplorer/src/cxp-right-pane.c:1.78 --- cxplorer/src/cxp-right-pane.c:1.77 Tue Sep 27 00:41:00 2005 +++ cxplorer/src/cxp-right-pane.c Sun Oct 2 01:45:03 2005 @@ -556,11 +556,38 @@ GtkTreeIter * iter, gpointer data) { gchar *mimetype; + gchar *fullpath; + gchar buf[1024]; + gchar *linkend; + gchar *linkmime; GdkPixbuf *icon; + gint length; + mode_t mode; + + gtk_tree_model_get (tree_model, iter, FILE_LIST_COL_MIMETYPE, &mimetype, + FILE_LIST_COL_FULLPATH, &fullpath, + FILE_LIST_COL_FILEMODE, &mode, + -1); + + switch (mode & S_IFMT) + { + case S_IFLNK: + if((length = readlink(fullpath, buf, 1024)) > 0) + { + buf[length] = '\0'; + linkmime = cxp_get_mime_type_for_file (buf); + icon = cxp_lookup_icon_from_mime (linkmime); + g_free (linkmime); + } + else + { + icon = cxp_lookup_icon_from_mime (mimetype); + } + break; + default: + icon = cxp_lookup_icon_from_mime (mimetype); + } - gtk_tree_model_get (tree_model, iter, FILE_LIST_COL_MIMETYPE, - &mimetype, -1); - icon = cxp_lookup_icon_from_mime (mimetype); g_object_set (cell, "pixbuf", icon, NULL); g_free (mimetype); }