Enlightenment CVS committal

Author  : atmosphere
Project : misc
Module  : eplayer

Dir     : misc/eplayer/src


Modified Files:
        callbacks.c 


Log Message:
- this fixes compile issues with updates to ewl made yesterday
- this also gives us a reference to the ePlayer in the "Open" callback
- note that it's hiding the file dialog on Open/Cancel so it might be
  wasting memory(don't know how expensive the file dialog is memory wise)
  It feels a lot faster, opens at a sane x,y and remembers the last
  directory you were in.  


===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/callbacks.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- callbacks.c 29 Jan 2004 06:27:34 -0000      1.32
+++ callbacks.c 29 Jan 2004 18:03:15 -0000      1.33
@@ -10,6 +10,10 @@
 #include "utils.h"
 #include "callbacks.h"
 
+static Ewl_Widget *_fd_win = NULL;
+static void file_dialog_cancel(Ewl_Widget *row, void *ev_data, void *user_data);
+static void file_dialog_ok(Ewl_Widget *row, void *ev_data, void *user_data);
+
 int _eplayer_seek_timer(void *data);
 
 typedef enum {
@@ -442,6 +446,7 @@
 {
 
        ewl_widget_destroy(w);
+       _fd_win = NULL;
 
        return;
        ev_data = NULL;
@@ -451,32 +456,36 @@
 /* File Dialog to add files, thanx to EWL */
 EDJE_CB(playlist_add) {
 
-       Ewl_Widget *fd_win;
-       Ewl_Widget *fd;
-       Ewl_Widget *vbox;
-
+    Ewl_Widget *fd_win = NULL;
+    Ewl_Widget *fd = NULL;
+    Ewl_Widget *vbox = NULL;
+    if(!_fd_win)
+    {
        fd_win = ewl_window_new();
        ewl_window_set_title(EWL_WINDOW(fd_win), "Eplayer Add File...");
-  ewl_window_set_name(EWL_WINDOW(fd_win), "Eplayer Add File...");
-  ewl_object_request_size(EWL_OBJECT(fd_win), 500, 400);
-  ewl_object_set_fill_policy(EWL_OBJECT(fd_win), EWL_FLAG_FILL_FILL |
+       ewl_window_set_name(EWL_WINDOW(fd_win), "Eplayer Add File...");
+       ewl_object_request_size(EWL_OBJECT(fd_win), 500, 400);
+       ewl_object_set_fill_policy(EWL_OBJECT(fd_win), EWL_FLAG_FILL_FILL |
                        EWL_FLAG_FILL_SHRINK);
        
-  ewl_callback_append(fd_win, EWL_CALLBACK_DELETE_WINDOW,
+       ewl_callback_append(fd_win, EWL_CALLBACK_DELETE_WINDOW,
                        destroy_ewl_filedialog, NULL);
-  ewl_widget_show(fd_win);
        
-  vbox = ewl_vbox_new ();
-  ewl_object_set_fill_policy(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL |
+       vbox = ewl_vbox_new ();
+       ewl_object_set_fill_policy(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL |
                        EWL_FLAG_FILL_SHRINK);
-  ewl_container_append_child(EWL_CONTAINER(fd_win), vbox);
-  ewl_widget_show (vbox);
+       ewl_container_append_child(EWL_CONTAINER(fd_win), vbox);
+       ewl_widget_show (vbox);
 
        fd = ewl_filedialog_new(fd_win, EWL_FILEDIALOG_TYPE_OPEN,
-                       report);
+                       file_dialog_ok, file_dialog_cancel);
 
-  ewl_container_append_child(EWL_CONTAINER(vbox), fd);
-  ewl_widget_show(fd);
+       ewl_container_append_child(EWL_CONTAINER(vbox), fd);
+       ewl_widget_show(fd);
+       _fd_win = fd_win;
+       ewl_widget_set_data(_fd_win, "player", player);
+    }
+    ewl_widget_show(_fd_win);
 }
 
 EDJE_CB(playlist_del) {
@@ -485,15 +494,33 @@
 
 }
 
-void report(Ewl_Widget *row, void *ev_data, void *user_data) {
-       Ewl_Fileselector *fs = user_data;
-       char *file;
-       
-       file = ewl_fileselector_get_filename (EWL_FILESELECTOR (fs));
-       
-       printf("eplayer file open : %s\n", file);
-       
-       /*
-       playlist_load_file(player->playlist, file, 1);
-       */
+static void 
+file_dialog_ok(Ewl_Widget *w, void *ev_data, void *user_data) {
+    Ewl_Fileselector *fs = user_data;
+    char *file = NULL;
+       
+    if((file = ewl_fileselector_get_filename (EWL_FILESELECTOR (fs))))
+    {
+       if(strlen(file) > 0)
+       {
+           ePlayer *player = NULL;
+           printf("eplayer file open : %s(%p)\n", file, fs);
+           if((player = (ePlayer*)ewl_widget_get_data(_fd_win, "player")))
+           {
+               printf("fs is (%p)\n", player);
+               printf("BING : %s\n", file);
+#if 0
+               if(playlist_load_file(player->playlist, file, 1))
+                   interface_playlist_item_append(player, 
evas_list_nth(player->playlist->items, player->playlist->num - 1));
+#endif
+           }
+       }
+    }
+    if(_fd_win)
+       ewl_widget_hide(_fd_win);
+}
+static void 
+file_dialog_cancel(Ewl_Widget *row, void *ev_data, void *user_data) {
+    if(_fd_win)
+       ewl_widget_hide(_fd_win);
 }




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to