Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : apps/euphoria
Dir : e17/apps/euphoria/src
Modified Files:
callbacks.c callbacks.h euphoria.c playlist.c playlist_item.c
Log Message:
small fixups, mainly stopping segv's and failed assertions
callbacks.c
* remove_playlist_item: was removing local copies, then sending xmms message,
and trying to remove again when xmms piped message back. It also sends a
removal id of 0(which is invalid) back to us if we delete from euphoria.
* reenable the ewl file dialog, I dunno if ewl broke the file dialog or
what, but you have to resize it to be quite large in order to see the
Ok/Cancel buttons, you can now add local files with this
* on_xmms_playback_currentid : this would segv, or fail assertions if you
tried starting up euphoria w/ an empty playlist.
* playlist_list: commented out the playlist_remove_all call. Why delete all
the files in the list if we're appending a set of files ?
* playlist_remove: added a printf to display we're not getting parameters
right from the xmms2 signal emission. Delay actually removing edje/evas
objects until the xmms signal comes across, so we only have this code in
one spot
* on_xmms_playlist_clear: added this function to support clearing all the
elements from the playlist, it corresponds to `xmms2 clear`
callbacks.h
* added prototype for on_xmms_playlist_clear
euphoria.c
* added callback initialization for XMMS_SIGNAL_PLAYLIST_CLEAR
playlist.c
* modified playlist_set_current: this failed assertion far too often... Like
when you start the app
* playlist_load_file: the function was prototyped in the header, but didn't
exist, added a simple request to xmms to load the uri
playlist_item.c
* small parameter check in playlist_item_free
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/callbacks.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- callbacks.c 22 Feb 2004 10:12:11 -0000 1.1
+++ callbacks.c 25 Feb 2004 06:06:51 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: callbacks.c,v 1.1 2004/02/22 10:12:11 tsauerbeck Exp $
+ * $Id: callbacks.c,v 1.2 2004/02/25 06:06:51 atmosphere Exp $
*/
#include <config.h>
@@ -185,13 +185,17 @@
}
static void remove_playlist_item(Euphoria *e, PlayListItem *pli) {
- unsigned int id = pli->id;
-
+
assert(pli);
-
+
+ xmmsc_playlist_remove(e->xmms, pli->id);
+ /* This is all commented out pending xmms feeding us a valid id, on
+ * playlist item removal */
+ /*
+ if(e->playlist->current_item == pli && e->track_current_pos > 0)
+ xmmsc_playback_next(e->xmms);
playlist_item_remove(e->playlist, pli);
- xmmsc_playlist_remove(e->xmms, id);
- xmmsc_playback_next(e->xmms);
+ */
}
EDJE_CB(playlist_item_remove) {
@@ -417,9 +421,8 @@
}
-#if 0
/* Callback to to close the filedialog window */
-void destroy_ewl_filedialog(Ewl_Widget * w, void *ev_data,
+static void destroy_ewl_filedialog(Ewl_Widget * w, void *ev_data,
void *user_data)
{
ewl_widget_destroy(w);
@@ -427,19 +430,21 @@
}
static void cb_file_dialog_value_changed(Ewl_Widget *w, void *ev_data,
- void *udata) {
+ void *udata)
+{
Euphoria *e = udata;
if (ev_data)
- playlist_load_any(e->playlist, ev_data, true);
-
+ {
+ char buf[PATH_MAX];
+ snprintf(buf, PATH_MAX, "file://%s", (char*)ev_data);
+ xmmsc_playlist_add(e->xmms, buf);
+ }
ewl_widget_hide(_fd_win);
}
-#endif
/* File Dialog to add files, thanx to EWL */
EDJE_CB(playlist_add) {
-#if 0
Ewl_Widget *fd_win = NULL;
Ewl_Widget *fd = NULL;
Ewl_Widget *vbox = NULL;
@@ -466,6 +471,8 @@
ewl_widget_show(vbox);
fd = ewl_filedialog_new(EWL_FILEDIALOG_TYPE_OPEN);
+ ewl_object_set_fill_policy(EWL_OBJECT(fd), EWL_FLAG_FILL_FILL |
+ EWL_FLAG_FILL_SHRINK);
ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED,
cb_file_dialog_value_changed, e);
@@ -475,7 +482,6 @@
_fd_win = fd_win;
ewl_widget_show(_fd_win);
-#endif
}
EDJE_CB(playlist_del) {
@@ -515,12 +521,22 @@
XMMS_CB(playback_currentid) {
unsigned int id = (unsigned int) arg;
-
+ unsigned int *ids = NULL;
/* if there's no current item, use the first one instead */
id = MAX(id, 1);
-
- playlist_set_current(e->playlist, id);
- xmmsc_playlist_get_mediainfo(e->xmms, id);
+ if((id = xmmscs_playback_current_id(e->xmms)) < 1)
+ {
+ if((ids = xmmscs_playlist_list(e->xmms)))
+ {
+ if(ids[0])
+ id = ids[0];
+ }
+ }
+ if(id >= 1)
+ {
+ playlist_set_current(e->playlist, id);
+ xmmsc_playlist_get_mediainfo(e->xmms, id);
+ }
hilight_current_track(e);
}
@@ -546,8 +562,10 @@
XMMS_CB(playlist_list) {
int i, *id = arg;
-
+
+ /*
playlist_remove_all(e->playlist);
+ */
if (!id)
return;
@@ -564,11 +582,22 @@
}
XMMS_CB(playlist_remove) {
- PlayListItem *pli;
+ PlayListItem *pli = NULL;
unsigned int id = (unsigned int) arg;
-
- pli = playlist_item_find_by_id(e->playlist, id);
- assert(pli);
-
- playlist_item_remove(e->playlist, pli);
+
+ /* FIXME: I think this is xmms2, id is always 0, stopping segv */
+ if(id < 1)
+ fprintf(stderr, "Is %d what really was removed??? :)\n", id);
+ else
+ {
+ pli = playlist_item_find_by_id(e->playlist, id);
+ assert(pli);
+ playlist_item_remove(e->playlist, pli);
+ }
+}
+XMMS_CB(playlist_clear) {
+ PlayListItem *pli;
+
+ playlist_remove_all(e->playlist);
+ /* FIXME: Set the text in the player to the default */
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/callbacks.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- callbacks.h 22 Feb 2004 10:12:11 -0000 1.1
+++ callbacks.h 25 Feb 2004 06:06:52 -0000 1.2
@@ -2,7 +2,7 @@
#define __CALLBACKS_H
/*
- * $Id: callbacks.h,v 1.1 2004/02/22 10:12:11 tsauerbeck Exp $
+ * $Id: callbacks.h,v 1.2 2004/02/25 06:06:52 atmosphere Exp $
*/
#include <Evas.h>
@@ -67,6 +67,7 @@
XMMS_CB(playlist_list);
XMMS_CB(playlist_add);
XMMS_CB(playlist_remove);
+XMMS_CB(playlist_clear);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/euphoria.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- euphoria.c 22 Feb 2004 10:12:11 -0000 1.1
+++ euphoria.c 25 Feb 2004 06:06:52 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: euphoria.c,v 1.1 2004/02/22 10:12:11 tsauerbeck Exp $
+ * $Id: euphoria.c,v 1.2 2004/02/25 06:06:52 atmosphere Exp $
*/
#include <config.h>
@@ -96,6 +96,8 @@
(XmmsCb) on_xmms_playlist_add, e);
xmmsc_set_callback(e->xmms, XMMS_SIGNAL_PLAYLIST_REMOVE,
(XmmsCb) on_xmms_playlist_remove, e);
+ xmmsc_set_callback(e->xmms, XMMS_SIGNAL_PLAYLIST_CLEAR,
+ (XmmsCb) on_xmms_playlist_clear, e);
return true;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/playlist.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- playlist.c 22 Feb 2004 10:12:11 -0000 1.1
+++ playlist.c 25 Feb 2004 06:06:52 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: playlist.c,v 1.1 2004/02/22 10:12:11 tsauerbeck Exp $
+ * $Id: playlist.c,v 1.2 2004/02/25 06:06:52 atmosphere Exp $
*/
#include <config.h>
@@ -71,7 +71,6 @@
assert(pli);
pl->duration -= playlist_item_duration_get(pli);
-
pl->items = evas_list_remove(pl->items, pli);
playlist_item_free(pli);
}
@@ -123,12 +122,31 @@
PlayListItem *playlist_set_current(PlayList *pl, unsigned int id)
{
- PlayListItem *pli;
-
- pli = playlist_item_find_by_id (pl, id);
- assert(pli);
-
- pl->current_item = pli;
+ PlayListItem *pli = NULL;
+ assert(pl);
+ if((pli = playlist_item_find_by_id (pl, id)))
+ {
+ pl->current_item = pli;
+ }
+ else
+ {
+ fprintf(stderr, "%p %d\n", pl, id);
+ }
return pli;
}
+bool
+playlist_load_file(PlayList *pl, const char *fileuri, bool append)
+{
+ if(pl)
+ {
+ if(fileuri)
+ {
+ xmmsc_playlist_add(pl->xmms, (char*)fileuri);
+ return(true);
+ }
+ }
+ else
+ fprintf(stderr, "Playlist was NULL in playlist_load_file\n");
+ return(false);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/playlist_item.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- playlist_item.c 22 Feb 2004 10:12:11 -0000 1.1
+++ playlist_item.c 25 Feb 2004 06:06:52 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: playlist_item.c,v 1.1 2004/02/22 10:12:11 tsauerbeck Exp $
+ * $Id: playlist_item.c,v 1.2 2004/02/25 06:06:52 atmosphere Exp $
*/
#include <config.h>
@@ -38,10 +38,9 @@
* @param pli
*/
void playlist_item_free(PlayListItem *pli) {
- if (!pli)
- return;
+ assert(pli);
- if (pli->container)
+ if (pli->container && pli->edje)
e_container_element_destroy(pli->container, pli->edje);
free(pli);
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs