Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_media.c ewl_media.h 


Log Message:
- Allow ewl_media_init to recieve the path (api change)
- fix possible mem leak
- change ewl_media_test to allow specifing file on cmd line

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_media.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_media.c 16 Jul 2004 00:04:43 -0000      1.2
+++ ewl_media.c 16 Jul 2004 00:26:13 -0000      1.3
@@ -3,10 +3,11 @@
 static void ewl_media_size_update(Ewl_Media *m);
 
 /**
+ * @param media: the media to be played or NULL
  * @return Returns a pointer to a new media on success, NULL on failure.
  * @brief Allocate a new media widget
  */
-Ewl_Widget      *ewl_media_new()
+Ewl_Widget      *ewl_media_new(char *media)
 {
        Ewl_Media   *m;
 
@@ -16,19 +17,20 @@
        if (!m)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
-       ewl_media_init(m);
+       ewl_media_init(m, media);
 
        DRETURN_PTR(EWL_WIDGET(m), DLEVEL_STABLE);
 }
 
 /**
  * @param m: the media area to be initialized
+ * @param media: the media to be played or NULL
  * @return Returns no value.
  * @brief Initialize the fields and callbacks of a media object
  *
  * Sets the internal fields and callbacks of a media object to there defaults.
  */
-void ewl_media_init(Ewl_Media *m)
+void ewl_media_init(Ewl_Media *m, char *media)
 {
        Ewl_Widget *w;
 
@@ -46,6 +48,9 @@
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
                                ewl_media_configure_cb, NULL);
 
+       if (media)
+               ewl_media_media_set(m, media);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -63,6 +68,7 @@
        DCHECK_PARAM_PTR("m", m);
        DCHECK_PARAM_PTR("media", media);
 
+       IF_FREE(m->media);
        m->media = strdup(media);
 
        /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_media.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_media.h 16 Jul 2004 00:04:43 -0000      1.2
+++ ewl_media.h 16 Jul 2004 00:26:13 -0000      1.3
@@ -31,8 +31,8 @@
        char           *media;        /**< Path to the media file */
 };
 
-Ewl_Widget  *ewl_media_new();
-void         ewl_media_init(Ewl_Media * m);
+Ewl_Widget  *ewl_media_new(char *media);
+void         ewl_media_init(Ewl_Media * m, char *media);
 
 void         ewl_media_media_set(Ewl_Media * m, char *media);
 char        *ewl_media_media_get(Ewl_Media * m);




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to