1
1
Этот коммит содержится в:
Miguel de Icaza 1998-12-12 00:55:54 +00:00
родитель 4a445469be
Коммит f0bf5bc2b8
3 изменённых файлов: 83 добавлений и 18 удалений

Просмотреть файл

@ -172,7 +172,7 @@ DISTGNOME = \
main-corba.o: main.c
$(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
(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 \
&& 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@:
cd ../vfs; $(MAKE) @LIBVFS@
@PCENTRULE@ -$(RMF) @LIBVFS@

Просмотреть файл

@ -36,6 +36,11 @@ static GdkImlibImage *icon_view_stalled;
static uid_t our_uid;
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:
*
@ -172,7 +177,7 @@ gicon_get_icon_for_file (file_entry *fe)
{
GdkImlibImage *image;
int size;
char *buf;
char *buf, *mime_type;
mode_t mode;
g_return_val_if_fail (fe != NULL, NULL);
@ -221,35 +226,56 @@ gicon_get_icon_for_file (file_entry *fe)
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){
image = gdk_imlib_inlined_png_to_image (buf, size);
free (buf);
if (we_can_affort_the_speed){
/*
* 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);
if (image)
return image;
}
if (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){
image = gicon_get_by_filename (buf);
mime_type = gnome_mime_type_or_default (fe->fname, NULL);
if (mime_type){
char *icon;
if (image)
return image;
icon = gnome_mime_type_get_value (mime_type, "icon-filename");
if (icon){
image = gicon_get_by_filename (icon);
if (image)
return image;
}
}
/*
* 4. Try to find an appropiate icon from the stat information or
* the hard coded filename.
*/
image = gnome_file_entry_color (fe);
g_assert (image != NULL);
return image;

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