Use mime-types as well
Этот коммит содержится в:
родитель
4a445469be
Коммит
f0bf5bc2b8
@ -172,7 +172,7 @@ DISTGNOME = \
|
|||||||
main-corba.o: main.c
|
main-corba.o: main.c
|
||||||
$(CC) -c -DHAVE_CORBA $(CPPFLAGS) $(DEFS) $(CFLAGS) $< -o main-corba.o
|
$(CC) -c -DHAVE_CORBA $(CPPFLAGS) $(DEFS) $(CFLAGS) $< -o main-corba.o
|
||||||
|
|
||||||
all: @gmc@ Makefile mc.metadata image.metadata
|
all: @gmc@ Makefile mc.metadata mc.keys image.metadata
|
||||||
|
|
||||||
Makefile: Makefile.in ../config.status
|
Makefile: Makefile.in ../config.status
|
||||||
(cd ..; CONFIG_FILES=gnome/Makefile CONFIG_HEADERS= ./config.status)
|
(cd ..; CONFIG_FILES=gnome/Makefile CONFIG_HEADERS= ./config.status)
|
||||||
@ -195,6 +195,10 @@ image.metadata: image.metadata.in Makefile
|
|||||||
sed -e 's^\@icondir\@^$(icondir)^g' < $(srcdir)/image.metadata.in > image.metadata.tmp \
|
sed -e 's^\@icondir\@^$(icondir)^g' < $(srcdir)/image.metadata.in > image.metadata.tmp \
|
||||||
&& mv image.metadata.tmp image.metadata
|
&& mv image.metadata.tmp image.metadata
|
||||||
|
|
||||||
|
mc.keys: mc.keys.in Makefile
|
||||||
|
sed -e 's^\@icondir\@^$(icondir)^g' < $(srcdir)/mc.keys.in > mc.keys.tmp \
|
||||||
|
&& mv mc.keys.tmp mc.keys
|
||||||
|
|
||||||
@LIBVFS@:
|
@LIBVFS@:
|
||||||
cd ../vfs; $(MAKE) @LIBVFS@
|
cd ../vfs; $(MAKE) @LIBVFS@
|
||||||
@PCENTRULE@ -$(RMF) @LIBVFS@
|
@PCENTRULE@ -$(RMF) @LIBVFS@
|
||||||
|
@ -36,6 +36,11 @@ static GdkImlibImage *icon_view_stalled;
|
|||||||
static uid_t our_uid;
|
static uid_t our_uid;
|
||||||
static gid_t our_gid;
|
static gid_t our_gid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If true, we choose the icon in a way that might be a bit slow
|
||||||
|
*/
|
||||||
|
static int we_can_affort_the_speed = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gicon_init:
|
* gicon_init:
|
||||||
*
|
*
|
||||||
@ -172,7 +177,7 @@ gicon_get_icon_for_file (file_entry *fe)
|
|||||||
{
|
{
|
||||||
GdkImlibImage *image;
|
GdkImlibImage *image;
|
||||||
int size;
|
int size;
|
||||||
char *buf;
|
char *buf, *mime_type;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
g_return_val_if_fail (fe != NULL, NULL);
|
g_return_val_if_fail (fe != NULL, NULL);
|
||||||
@ -221,27 +226,48 @@ gicon_get_icon_for_file (file_entry *fe)
|
|||||||
return icon_view_symlink;
|
return icon_view_symlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2. Try to fetch the icon as an inline png from the metadata.
|
* 2. Expensive tests
|
||||||
*/
|
*/
|
||||||
if (gnome_metadata_get (fe->fname, "icon-inline-png", &size, &buf) == 0){
|
if (we_can_affort_the_speed){
|
||||||
image = gdk_imlib_inlined_png_to_image (buf, size);
|
/*
|
||||||
|
* 2.1 Try to fetch the icon as an inline png from the metadata.
|
||||||
|
*/
|
||||||
|
if (gnome_metadata_get (fe->fname, "icon-inline-png", &size, &buf) == 0){
|
||||||
|
image = gdk_imlib_inlined_png_to_image (buf, size);
|
||||||
|
|
||||||
free (buf);
|
free (buf);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
return image;
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 2.2. Try to fetch the icon from the metadata.
|
||||||
|
*/
|
||||||
|
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
|
||||||
|
image = gicon_get_by_filename (buf);
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
return image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 3. Try to fetch the icon from the metadata.
|
* 3. Mime-type based
|
||||||
*/
|
*/
|
||||||
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
|
mime_type = gnome_mime_type_or_default (fe->fname, NULL);
|
||||||
image = gicon_get_by_filename (buf);
|
if (mime_type){
|
||||||
|
char *icon;
|
||||||
|
|
||||||
if (image)
|
icon = gnome_mime_type_get_value (mime_type, "icon-filename");
|
||||||
return image;
|
|
||||||
|
if (icon){
|
||||||
|
image = gicon_get_by_filename (icon);
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
return image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
35
gnome/mc.keys.in
Обычный файл
35
gnome/mc.keys.in
Обычный файл
@ -0,0 +1,35 @@
|
|||||||
|
text/c:
|
||||||
|
icon-filename=@icondir@/c.xpm
|
||||||
|
|
||||||
|
text/h:
|
||||||
|
icon-filename=@icondir@/h.xpm
|
||||||
|
|
||||||
|
text/C++:
|
||||||
|
icon-filename=@icondir@/cc.xpm
|
||||||
|
|
||||||
|
application/x-bzip:
|
||||||
|
icon-filename=@icondir@/compressed.xpm
|
||||||
|
|
||||||
|
application/x-gzip:
|
||||||
|
icon-filename=@icondir@/compressed.xpm
|
||||||
|
|
||||||
|
application/zip:
|
||||||
|
icon-filename=@icondir@/zip.xpm
|
||||||
|
|
||||||
|
application/x-tex:
|
||||||
|
icon-filename=@icondir@/tex.xpm
|
||||||
|
|
||||||
|
application/postscript:
|
||||||
|
icon-filename=@icondir@/postscript.xpm
|
||||||
|
|
||||||
|
audio/*:
|
||||||
|
icon-filename=@icondir@/sound.xpm
|
||||||
|
|
||||||
|
text/html:
|
||||||
|
icon-filename=@icondir@/html.xpm
|
||||||
|
|
||||||
|
application/vcard:
|
||||||
|
icon-filename=@icondir@/calendar.xpm
|
||||||
|
|
||||||
|
application/x-troff-man:
|
||||||
|
icon-filename=@icondir@/man.xpm
|
Загрузка…
x
Ссылка в новой задаче
Block a user