Yasumichi Akahoshi
yasum****@users*****
2005年 9月 3日 (土) 02:55:15 JST
Index: cxplorer/src/cxp-right-pane.c diff -u cxplorer/src/cxp-right-pane.c:1.55 cxplorer/src/cxp-right-pane.c:1.56 --- cxplorer/src/cxp-right-pane.c:1.55 Thu Sep 1 23:43:06 2005 +++ cxplorer/src/cxp-right-pane.c Sat Sep 3 02:55:15 2005 @@ -527,17 +527,40 @@ { CxpRightPanePrivate *priv = CXP_RIGHT_PANE_GET_PRIVATE (data); gchar *filename; + gchar *mimetype; + GdkPixbuf *icon; + struct stat status; gtk_tree_model_get (tree_model, iter, COL_FILE_PATH, &filename, COL_TERMINATOR); - if (g_file_test (filename, G_FILE_TEST_IS_DIR)) - { - g_object_set (cell, "pixbuf", priv->cxp_dir, NULL); - } - else + lstat (filename, &status); + switch (status.st_mode & S_IFMT) { - g_object_set (cell, "pixbuf", priv->cxp_unknown, NULL); + case S_IFSOCK: + mimetype = g_strdup("inode/socket"); + break; + case S_IFLNK: + mimetype = g_strdup("inode/symlink"); + break; + case S_IFREG: + mimetype = cxp_get_mime_type_for_file (filename); + break; + case S_IFBLK: + mimetype = g_strdup("inode/blockdevice"); + break; + case S_IFDIR: + mimetype = g_strdup("inode/directory"); + break; + case S_IFCHR: + mimetype = g_strdup("inode/chardevice"); + break; + case S_IFIFO: + mimetype = g_strdup("inode/fifo"); + break; } + icon = cxp_lookup_icon_from_mime (mimetype); + g_object_set (cell, "pixbuf", icon, NULL); + g_free (mimetype); g_free (filename); }