[snappy/aurena] ui updates playing state
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy/aurena] ui updates playing state
- Date: Sun, 16 Sep 2012 17:18:26 +0000 (UTC)
commit 87917feb12a9bb2cd87d82c1c4827facb2a7c0b9
Author: Luis de Bethencourt <luis debethencourt com>
Date: Sun Sep 16 18:18:38 2012 +0100
ui updates playing state
src/snra-client.c | 16 +++++++++-------
src/user_interface.c | 17 +++++------------
src/user_interface.h | 1 +
3 files changed, 15 insertions(+), 19 deletions(-)
---
diff --git a/src/snra-client.c b/src/snra-client.c
index 40bb041..24a8513 100644
--- a/src/snra-client.c
+++ b/src/snra-client.c
@@ -364,17 +364,18 @@ handle_received_chunk (G_GNUC_UNUSED SoupMessage * msg, SoupBuffer * chunk,
}
if (g_str_equal (msg_type, "enrol")) {
- g_print ("enrol\n");
+ g_print ("chunk: enrol\n");
handle_enrol_message (client, s);
} else if (g_str_equal (msg_type, "set-media")) {
- g_print ("set-media\n");
+ g_print ("chunk: set-media\n");
handle_set_media_message (client, s);
} else if (g_str_equal (msg_type, "play")) {
- g_print ("play\n");
+ g_print ("chunk: play\n");
handle_play_message (client, s);
change_state (client->ui->engine, "Playing");
+ toggle_playing (client->ui, TRUE);
} else if (g_str_equal (msg_type, "pause")) {
- g_print ("pause\n");
+ g_print ("chunk: pause\n");
client->paused = TRUE;
if (client->enabled == FALSE) {
client->state = DISABLED_STATE;
@@ -382,15 +383,16 @@ handle_received_chunk (G_GNUC_UNUSED SoupMessage * msg, SoupBuffer * chunk,
} else {
client->state = GST_STATE_PAUSED;
change_state (client->ui->engine, "Paused");
+ toggle_playing (client->ui, FALSE);
}
} else if (g_str_equal (msg_type, "volume")) {
- g_print ("volume\n");
+ g_print ("chunk: volume\n");
handle_set_volume_message (client, s);
} else if (g_str_equal (msg_type, "client-setting")) {
- g_print ("client-setting\n");
+ g_print ("chunk: client-setting\n");
handle_set_client_message (client, s);
} else {
- g_print ("Unhandled event of type %s\n", msg_type);
+ g_print ("chunk: Unhandled event of type %s\n", msg_type);
}
}
}
diff --git a/src/user_interface.c b/src/user_interface.c
index b12fec5..ff90b0f 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -43,7 +43,6 @@ static void size_change (ClutterStage * stage,
UserInterface * ui);
static void show_controls (UserInterface * ui, gboolean vis);
static void toggle_fullscreen (UserInterface * ui);
-static void toggle_playing (UserInterface * ui);
static void update_controls_size (UserInterface * ui);
static gboolean update_volume (UserInterface * ui, gdouble volume);
@@ -716,23 +715,17 @@ toggle_fullscreen (UserInterface * ui)
}
}
-static void
-toggle_playing (UserInterface * ui)
+void
+toggle_playing (UserInterface * ui, gboolean playing)
{
GstEngine *engine = ui->engine;
- if (engine->playing) {
- change_state (engine, "Paused");
- engine->playing = FALSE;
-
+ if (playing) {
clutter_texture_set_from_file (CLUTTER_TEXTURE (ui->control_play_toggle),
- ui->play_png, NULL);
+ ui->pause_png, NULL);
} else {
- change_state (engine, "Playing");
- engine->playing = TRUE;
-
clutter_texture_set_from_file (CLUTTER_TEXTURE (ui->control_play_toggle),
- ui->pause_png, NULL);
+ ui->play_png, NULL);
}
}
diff --git a/src/user_interface.h b/src/user_interface.h
index e253086..5fee021 100644
--- a/src/user_interface.h
+++ b/src/user_interface.h
@@ -123,6 +123,7 @@ gboolean interface_load_uri (UserInterface * ui, gchar * uri);
void interface_play_next_or_prev (UserInterface * ui, gboolean next);
void interface_start (UserInterface * ui, gchar * uri);
gboolean interface_update_controls (UserInterface * ui);
+void toggle_playing (UserInterface * ui, gboolean playing);
G_END_DECLS
#endif /* __USER_INTERFACE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]