Enlightenment CVS committal

Author  : handyande
Project : e17
Module  : proto

Dir     : e17/proto/exhibit/src/bin


Modified Files:
        Makefile.am exhibit_comment.c exhibit_comment.h exhibit_file.c 
        exhibit_file.h 
Added Files:
        exhibit_comment_jpeg.c exhibit_comment_jpeg.h 


Log Message:
Code for writing comments into the JPEG headers. PLEASE backup your photos 
before testing this - just in case ;)
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Makefile.am 3 Mar 2006 00:44:37 -0000       1.8
+++ Makefile.am 14 Mar 2006 01:01:15 -0000      1.9
@@ -20,7 +20,8 @@
 exhibit_slideshow.h \
 exhibit_favorites.h \
 exhibit_options.h \
-exhibit_comment.h
+exhibit_comment.h \
+exhibit_comment_jpeg.h
 
 exhibit_SOURCES = \
 exhibit_file.c \
@@ -34,6 +35,7 @@
 exhibit_favorites.c \
 exhibit_options.c \
 exhibit_comment.c \
+exhibit_comment_jpeg.c \
 $(exhibit_INCLUDES)
 
 exhibit_LDADD = @my_libs@
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_comment.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- exhibit_comment.c   3 Mar 2006 00:44:37 -0000       1.1
+++ exhibit_comment.c   14 Mar 2006 01:01:15 -0000      1.2
@@ -60,27 +60,43 @@
 void
 _ex_comment_load(Exhibit *e)
 {
-   
+   char *file, *comment;
+   unsigned int len;
+
+   file = ((Ex_Tab *) e->cur_tab)->cur_file;
+   if (_ex_file_is_jpg(file))
+     if (_ex_comment_jpeg_read(file, &comment, &len))
+       {
+         etk_entry_text_set(ETK_ENTRY(e->comment.entry), comment);
+         return;
+       }
+   etk_entry_text_set(ETK_ENTRY(e->comment.entry), "");
 }
 
 void
 _ex_comment_save(Exhibit *e)
 {
-   
+   char *file;
+
+   file = ((Ex_Tab *) e->cur_tab)->cur_file;
+   if (_ex_file_is_jpg(file))
+     _ex_comment_jpeg_write(file,
+       etk_entry_text_get(ETK_ENTRY(e->comment.entry)),
+       strlen(etk_entry_text_get(ETK_ENTRY(e->comment.entry))));
 }
 
 void
 _ex_comment_revert(Exhibit *e)
 {
-   
+   _ex_comment_load(e);
 }
 
 static void _ex_comment_save_clicked_cb(Etk_Object *obj, void *data)
 {
-   
+   _ex_comment_save((Exhibit *) data);
 }
 
 static void _ex_comment_revert_clicked_cb(Etk_Object *obj, void *data)
 {
-   
+   _ex_comment_revert((Exhibit *) data);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_comment.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- exhibit_comment.h   3 Mar 2006 00:44:37 -0000       1.1
+++ exhibit_comment.h   14 Mar 2006 01:01:15 -0000      1.2
@@ -1,6 +1,8 @@
 #ifndef _EX_COMMENT_H
 #define _EX_COMMENT_H
 
+#include "exhibit_comment_jpeg.h"
+
 void _ex_comment_show(Exhibit *e);
 void _ex_comment_hide(Exhibit *e);
 void _ex_comment_load(Exhibit *e);
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_file.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- exhibit_file.c      3 Jan 2006 15:02:15 -0000       1.5
+++ exhibit_file.c      14 Mar 2006 01:01:15 -0000      1.6
@@ -56,6 +56,21 @@
    return val;
 }
 
+int
+_ex_file_is_jpg(char *file)
+{
+   char        *ext;
+   Evas_List   *groups, *l;
+
+   ext = strrchr(file, '.');
+   if (!ext) return 0;
+
+   if (strcasecmp(ext, ".jpg") && strcasecmp(ext, ".jpeg"))
+      return 0;
+
+   return 1;
+}
+
 char *
 _ex_file_strip_extention(char *path) {
    char *ptr;
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/exhibit/src/bin/exhibit_file.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- exhibit_file.h      3 Jan 2006 15:02:15 -0000       1.5
+++ exhibit_file.h      14 Mar 2006 01:01:15 -0000      1.6
@@ -3,6 +3,8 @@
 
 int         _ex_file_is_viewable(char *file);
 int         _ex_file_is_ebg(char *file);
+int         _ex_file_is_jpg(char *file);
+
 char       *_ex_file_strip_extention(char *path);
 char       *_ex_file_get(char *path);
     




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to