Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_media.c ewl_media.h 


Log Message:
update to the new emotion api
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_media.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_media.c 5 Sep 2005 14:12:15 -0000       1.3
+++ ewl_media.c 2 Oct 2005 09:44:21 -0000       1.4
@@ -12,7 +12,7 @@
  * @return Returns a pointer to a new media on success, NULL on failure.
  * @brief Allocate a new media widget
  */
-Ewl_Widget      *ewl_media_new(char *media)
+Ewl_Widget      *ewl_media_new(char *module, char *media)
 {
        Ewl_Media   *m;
 
@@ -22,7 +22,7 @@
        if (!m)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
-       ewl_media_init(m, media);
+       ewl_media_init(m, module, media);
 
        DRETURN_PTR(EWL_WIDGET(m), DLEVEL_STABLE);
 }
@@ -35,7 +35,7 @@
  *
  * Sets the internal fields and callbacks of a media object to there defaults.
  */
-void ewl_media_init(Ewl_Media *m, char *media)
+void ewl_media_init(Ewl_Media *m, char *module, char *media)
 {
        Ewl_Widget *w;
 
@@ -54,13 +54,62 @@
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
                                ewl_media_configure_cb, NULL);
 
-       if (media)
-               ewl_media_media_set(m, media);
+       if (module) {
+               ewl_media_module_set(m, module);
+                if (media) {
+                        ewl_media_media_set(m, media);
+                }
+                
+        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
+ * @param m: the media area widget to set the module
+ * @param module: the module to set in the media widget @a m 
+ * @return Returns 0 if fail to load the module, 1 otherwise.
+ * @brief Set the module of a media widget
+ *
+ * Sets the module of the media widget @a m 
+ */
+int ewl_media_module_set(Ewl_Media * m, char *module)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("m", m, 0);
+       DCHECK_PARAM_PTR_RET("module", module, 0);
+
+       IF_FREE(m->module);
+       m->module = strdup(module);
+
+       /*
+        * Initialize emotion
+        */
+        if (!m->module || !emotion_object_init(m->video, m->module))
+                DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+       DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+/**
+ * @param m: the media widget to retrieve module contents
+ * @return Returns a copy of the module in @a m on success, NULL on failure.
+ * @brief Retrieve the module of a media widget
+ */
+char *ewl_media_module_get(Ewl_Media * m)
+{
+       char *txt = NULL;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("m", m, NULL);
+
+       if (m->module)
+               txt = strdup(m->module);
+
+       DRETURN_PTR(txt, DLEVEL_STABLE);
+}
+
+/**
  * @param m: the media area widget to set the media
  * @param media: the media to set in the media widget @a m 
  * @return Returns no value.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_media.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_media.h 10 Apr 2005 05:05:18 -0000      1.3
+++ ewl_media.h 2 Oct 2005 09:44:21 -0000       1.4
@@ -35,13 +35,16 @@
 {
        Ewl_Widget      widget;       /**< Inherit from Ewl_Widget */
        Evas_Object    *video;        /**< Emotion does the actual work */
+       char           *module;       /**< Path to the module file */
        char           *media;        /**< Path to the media file */
        int             block_seek;   /**< Temporarily prevent seeking */
 };
 
-Ewl_Widget  *ewl_media_new(char *media);
-void         ewl_media_init(Ewl_Media * m, char *media);
+Ewl_Widget  *ewl_media_new(char *module, char *media);
+void         ewl_media_init(Ewl_Media * m, char *module, char *media);
 
+int          ewl_media_module_set(Ewl_Media * m, char *module);
+char        *ewl_media_module_get(Ewl_Media * m);
 void         ewl_media_media_set(Ewl_Media * m, char *media);
 char        *ewl_media_media_get(Ewl_Media * m);
 int          ewl_media_length_get(Ewl_Media *m);




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to