Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : eplayer

Dir     : misc/eplayer/src


Modified Files:
        callbacks.c eplayer.c interface.c interface.h 


Log Message:
renamed the playback signals. ui_deinit renamed to ui_shutdown. reverted ben's 
ewl_shutdown() change :)
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/callbacks.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- callbacks.c 3 Feb 2004 22:01:57 -0000       1.43
+++ callbacks.c 6 Feb 2004 15:05:45 -0000       1.44
@@ -1,5 +1,5 @@
 /*
- * $Id: callbacks.c,v 1.43 2004/02/03 22:01:57 tsauerbeck Exp $
+ * $Id: callbacks.c,v 1.44 2004/02/06 15:05:45 tsauerbeck Exp $
  */
 
 #include <config.h>
@@ -23,10 +23,24 @@
 typedef enum {
        PLAYBACK_STATE_STOPPED,
        PLAYBACK_STATE_PAUSED,
-       PLAYBACK_STATE_PLAYING
+       PLAYBACK_STATE_PLAYING,
+       PLAYBACK_STATE_NUM
 } PlaybackState;
 
-static PlaybackState state = PLAYBACK_STATE_STOPPED;
+static PlaybackState playback_state = PLAYBACK_STATE_STOPPED;
+
+static void playback_state_set(ePlayer *player, PlaybackState new_state) {
+       char *sig[PLAYBACK_STATE_NUM] = {"PLAYBACK_STATE_STOPPED",
+                                        "PLAYBACK_STATE_PAUSED",
+                                        "PLAYBACK_STATE_PLAYING"};
+       assert(player);
+
+       if (new_state != playback_state)
+               edje_object_signal_emit(player->gui.edje, sig[new_state],
+                                       "ePlayer");
+
+       playback_state = new_state;
+}
 
 /**
  * Starts/resumes playback.
@@ -36,7 +50,7 @@
 
        debug(DEBUG_LEVEL_INFO, "Play callback entered\n");
 
-       switch (state) {
+       switch (playback_state) {
                case PLAYBACK_STATE_STOPPED:
                case PLAYBACK_STATE_PAUSED: /* continue playback */
                        res = eplayer_playback_start(player, false);
@@ -46,12 +60,12 @@
                        res = eplayer_playback_start(player, true);
                        break;
                default:
-                       assert(0);
+                       assert(false);
                        break;
        }
 
        if (res)
-               state = PLAYBACK_STATE_PLAYING;
+               playback_state_set(player, PLAYBACK_STATE_PLAYING);
 }
 
 /**
@@ -62,31 +76,35 @@
 
        eplayer_playback_stop(player);
        track_rewind(player);
-       state = PLAYBACK_STATE_STOPPED;
+
+       playback_state_set(player, PLAYBACK_STATE_STOPPED);
 }
 
 /**
  * Pauses/resumes playback.
  */
 EDJE_CB(pause) {
+       PlaybackState state = playback_state;
+
        debug(DEBUG_LEVEL_INFO, "Pause callback entered\n");
 
-       switch (state) {
+       switch (playback_state) {
                case PLAYBACK_STATE_STOPPED:
-                       return;
                        break;
                case PLAYBACK_STATE_PAUSED:
-                       eplayer_playback_start(player, false);
-                       state = PLAYBACK_STATE_PLAYING;
+                       if (eplayer_playback_start(player, false))
+                               state = PLAYBACK_STATE_PLAYING;
                        break;
                case PLAYBACK_STATE_PLAYING:
                        eplayer_playback_stop(player);
                        state = PLAYBACK_STATE_PAUSED;
                        break;
                default:
-                       assert(0);
+                       assert(false);
                        break;
        }
+       
+       playback_state_set(player, state);
 }
 
 /**
@@ -108,6 +126,7 @@
  * back to the beginning of the playlist.
  */
 EDJE_CB(track_next) {
+       PlaybackState state = playback_state;
        bool play = true;
 
        debug(DEBUG_LEVEL_INFO, "Next File Called\n");
@@ -128,6 +147,7 @@
        }
 
        hilight_current_track(player);
+       playback_state_set(player, state);
 }
 
 /**
@@ -135,6 +155,8 @@
  * at the first track already.
  */
 EDJE_CB(track_prev) {
+       PlaybackState state = playback_state;
+
        debug(DEBUG_LEVEL_INFO, "Previous File Called\n");
 
        /* first item on the list: do nothing */
@@ -150,6 +172,7 @@
                state = PLAYBACK_STATE_PLAYING;
        
        hilight_current_track(player);
+       playback_state_set(player, state);
 }
 
 EDJE_CB(volume_raise) {
@@ -202,6 +225,7 @@
 }
 
 EDJE_CB(playlist_item_play) {
+       PlaybackState state = playback_state;
        PlayListItem *pli = evas_object_data_get(obj, "PlayListItem");
 
        eplayer_playback_stop(player);
@@ -210,6 +234,8 @@
        
        if (eplayer_playback_start(player, true))
                state = PLAYBACK_STATE_PLAYING;
+       
+       playback_state_set(player, state);
 }
 
 static void remove_playlist_item(ePlayer *player, PlayListItem *pli) {
@@ -254,6 +280,7 @@
 }
 
 EDJE_CB(seek_forward) {
+       PlaybackState state = playback_state;
        PlayListItem *pli = playlist_current_item_get(player->playlist);
 
        debug(DEBUG_LEVEL_INFO, "Seeking forward\n");
@@ -266,9 +293,12 @@
        
        if (eplayer_playback_start(player, false))
                state = PLAYBACK_STATE_PLAYING;
+
+       playback_state_set(player, state);
 }
 
 EDJE_CB(seek_backward) {
+       PlaybackState state = playback_state;
        PlayListItem *pli = playlist_current_item_get(player->playlist);
        int cur_time = pli->plugin->get_current_pos();
        
@@ -282,6 +312,8 @@
 
        if (eplayer_playback_start(player, cur_time < 6))
                state = PLAYBACK_STATE_PLAYING;
+
+       playback_state_set(player, state);
 }
 
 EDJE_CB(seek_forward_start) {
@@ -317,7 +349,7 @@
 }
 
 EDJE_CB(switch_group) {
-       ui_deinit_edje(player);
+       ui_shutdown_edje(player);
        ui_init_edje(player, src);
 
        ui_refresh_volume(player);
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/eplayer.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- eplayer.c   4 Feb 2004 20:12:25 -0000       1.37
+++ eplayer.c   6 Feb 2004 15:05:45 -0000       1.38
@@ -2,7 +2,7 @@
 /* Edje Overhaul startnig phase 4 - Started 7/30/03 */
 
 /*
- * $Id: eplayer.c,v 1.37 2004/02/04 20:12:25 tsauerbeck Exp $
+ * $Id: eplayer.c,v 1.38 2004/02/06 15:05:45 tsauerbeck Exp $
  */
 
 #include <config.h>
@@ -128,7 +128,7 @@
        pthread_mutex_destroy(&player->playback_stop_mutex);
        pthread_mutex_destroy(&player->playback_next_mutex);
 
-       ui_deinit(player);
+       ui_shutdown(player);
 
        free(player);
 }
@@ -216,9 +216,6 @@
        pthread_mutex_unlock(&player->playback_stop_mutex);
 
        pthread_join(player->playback_thread, NULL);
-
-       edje_object_signal_emit(player->gui.edje, "PLAYBACK_STOPPED",
-                               "ePlayer");
 }
 
 static int check_playback_next(void *udata) {
@@ -265,9 +262,6 @@
        pthread_create(&player->playback_thread, NULL,
                       (void *) &track_play_chunk, player);
 
-       edje_object_signal_emit(player->gui.edje, "PLAYBACK_STARTED",
-                               "ePlayer");
-
        return true;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/interface.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- interface.c 6 Feb 2004 11:39:58 -0000       1.51
+++ interface.c 6 Feb 2004 15:05:45 -0000       1.52
@@ -1,5 +1,5 @@
 /*
- * $Id: interface.c,v 1.51 2004/02/06 11:39:58 technikolor Exp $
+ * $Id: interface.c,v 1.52 2004/02/06 15:05:45 tsauerbeck Exp $
  */
 
 #include <config.h>
@@ -151,7 +151,7 @@
        return ui_init_edje(player, "eplayer");
 }
 
-void ui_deinit_edje(ePlayer *player) {
+void ui_shutdown_edje(ePlayer *player) {
        if (player->gui.playlist) {
                edje_object_part_unswallow(player->gui.edje,
                                           player->gui.playlist);
@@ -165,12 +165,12 @@
        }
 }
 
-void ui_deinit(ePlayer *player) {
+void ui_shutdown(ePlayer *player) {
        assert(player);
 
-       ui_deinit_edje(player);
+       ui_shutdown_edje(player);
 
-       ewl_deinit();
+       ewl_shutdown();
        edje_shutdown();
        ecore_evas_shutdown();
        ecore_shutdown();
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/interface.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- interface.h 3 Feb 2004 20:21:11 -0000       1.11
+++ interface.h 6 Feb 2004 15:05:45 -0000       1.12
@@ -2,7 +2,7 @@
 #define __INTERFACE_H
 
 /*
- * $Id: interface.h,v 1.11 2004/02/03 20:21:11 tsauerbeck Exp $
+ * $Id: interface.h,v 1.12 2004/02/06 15:05:45 tsauerbeck Exp $
  */
 
 #include "eplayer.h"
@@ -10,8 +10,8 @@
 bool ui_init(ePlayer *player);
 bool ui_init_edje(ePlayer *player, const char *name);
 
-void ui_deinit_edje(ePlayer *player);
-void ui_deinit(ePlayer *player);
+void ui_shutdown_edje(ePlayer *player);
+void ui_shutdown(ePlayer *player);
 
 void ui_fill_track_info(ePlayer *player);
 void ui_fill_playlist(ePlayer *player);




-------------------------------------------------------
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