Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
Makefile.am e_fm.c e_includes.h
Added Files:
e_fm_mime.c e_fm_mime.h
Log Message:
add mime type parser for system mime types (old mime.types and new xdg shared
mimeinfo) as well as pasring user versions of thoses files - use them in fm2.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/Makefile.am,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -3 -r1.130 -r1.131
--- Makefile.am 23 Jul 2006 10:24:30 -0000 1.130
+++ Makefile.am 30 Jul 2006 16:58:38 -0000 1.131
@@ -166,7 +166,8 @@
e_fm.h \
e_widget_scrollframe.h \
e_sha1.h \
-e_widget_fsel.h
+e_widget_fsel.h \
+e_fm_mime.h
enlightenment_src = \
e_user.c \
@@ -309,6 +310,7 @@
e_widget_scrollframe.c \
e_sha1.c \
e_widget_fsel.c \
+e_fm_mime.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- e_fm.c 29 Jul 2006 16:27:54 -0000 1.22
+++ e_fm.c 30 Jul 2006 16:58:38 -0000 1.23
@@ -1107,6 +1107,7 @@
Evas_Coord mw = 0, mh = 0;
Evas_Object *obj, *obj2;
char buf[4096], *lnk;
+ const char *mime;
/* create icon */
ic = E_NEW(E_Fm2_Icon, 1);
@@ -1124,10 +1125,17 @@
ic->info.link = evas_stringshare_add(lnk);
free(lnk);
}
- evas_event_freeze(evas_object_evas_get(sd->obj));
- edje_freeze();
+
+ if (!ic->info.mime)
+ {
+ mime = e_fm_mime_filename_get(ic->info.file);
+ if (mime) ic->info.mime = evas_stringshare_add(mime);
+ }
+
if (e_util_glob_case_match(ic->info.file, "*.desktop"))
_e_fm2_icon_desktop_load(ic);
+ evas_event_freeze(evas_object_evas_get(sd->obj));
+ edje_freeze();
switch (sd->config->view.mode)
{
case E_FM2_VIEW_MODE_ICONS:
@@ -1360,7 +1368,7 @@
static void
_e_fm2_icon_icon_set(E_Fm2_Icon *ic)
{
- char buf[4096];
+ char buf[4096], *p;
if (!ic->realized) return;
if (ic->info.icon)
@@ -1383,6 +1391,39 @@
if (ic->info.mime)
{
/* use mime type to select icon */
+ if (
+ (!strcmp(ic->info.mime, "image/jpeg")) ||
+ (!strcmp(ic->info.mime, "image/png")) ||
+ (!strcmp(ic->info.mime, "image/gif")) ||
+ (!strcmp(ic->info.mime, "image/tiff"))
+ )
+ {
+ snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath,
ic->info.file);
+ ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
+ e_thumb_icon_file_set(ic->obj_icon, buf, NULL);
+ e_thumb_icon_size_set(ic->obj_icon, 64, 48);
+ evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen",
_e_fm2_cb_icon_thumb_gen, ic);
+ _e_fm2_icon_thumb(ic);
+ edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
+ evas_object_show(ic->obj_icon);
+ }
+ else
+ {
+ /* fixme: quick hack to get some icons - need to have a proper
+ * mime -> icon mapping users can edit
+ */
+ p = strchr(ic->info.mime, '/');
+ if (p) p++;
+ else p = ic->info.mime;
+ snprintf(buf, sizeof(buf), "icons/fileman/%s", p);
+ ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
+ if (!e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman",
+ buf))
+ e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman",
+ "icons/fileman/file");
+ edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
+ evas_object_show(ic->obj_icon);
+ }
return;
}
/* fallback */
@@ -1397,28 +1438,8 @@
else
{
if (
- (e_util_glob_case_match(ic->info.file, "*.jpg")) ||
- (e_util_glob_case_match(ic->info.file, "*.jpeg")) ||
- (e_util_glob_case_match(ic->info.file, "*.jfif")) ||
- (e_util_glob_case_match(ic->info.file, "*.jpe")) ||
- (e_util_glob_case_match(ic->info.file, "*.png")) ||
- (e_util_glob_case_match(ic->info.file, "*.gif")) ||
- (e_util_glob_case_match(ic->info.file, "*.tif")) ||
- (e_util_glob_case_match(ic->info.file, "*.tiff"))
+ (e_util_glob_case_match(ic->info.file, "*.edj"))
)
- {
- snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath,
ic->info.file);
- ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
- e_thumb_icon_file_set(ic->obj_icon, buf, NULL);
- e_thumb_icon_size_set(ic->obj_icon, 64, 64);
- evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen",
_e_fm2_cb_icon_thumb_gen, ic);
- _e_fm2_icon_thumb(ic);
- edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
- evas_object_show(ic->obj_icon);
- }
- else if (
- (e_util_glob_case_match(ic->info.file, "*.edj"))
- )
{
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath,
ic->info.file);
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_includes.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- e_includes.h 23 Jul 2006 11:22:13 -0000 1.109
+++ e_includes.h 30 Jul 2006 16:58:38 -0000 1.110
@@ -143,3 +143,4 @@
#include "e_sha1.h"
#include "e_widget_framelist.h"
#include "e_widget_fsel.h"
+#include "e_fm_mime.h"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs