[snappy] ui: recheck for subtitles when file is droped
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] ui: recheck for subtitles when file is droped
- Date: Tue, 23 Apr 2013 17:45:54 +0000 (UTC)
commit f895080d50267f7efa7da668c7cb30a2a7030148
Author: Luis de Bethencourt <luis debethencourt com>
Date: Thu Apr 18 18:43:18 2013 -0400
ui: recheck for subtitles when file is droped
src/gst_engine.c | 25 ++++++++++++++++++++-----
src/gst_engine.h | 1 +
src/user_interface.c | 22 ++++++++++++++++------
3 files changed, 37 insertions(+), 11 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index 507debc..623b71b 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -496,12 +496,10 @@ bus_call (GstBus * bus, GstMessage * msg, gpointer data)
else
g_print ("Secret mode. Not saving uri in history.\n");
- g_object_get (G_OBJECT (engine->player), "n-text", &streams, NULL);
- if (streams > 0) {
+ if (has_subtitles (engine))
ui->subtitles_available = TRUE;
- } else {
+ else
ui->subtitles_available = FALSE;
- }
interface_update_controls (ui);
engine->has_started = TRUE;
@@ -819,7 +817,7 @@ engine_play (GstEngine * engine)
GstStateChangeReturn change;
change = gst_element_set_state (engine->player, GST_STATE_PLAYING);
- engine->has_started = TRUE;
+
engine->playing = TRUE;
engine->queries_blocked = FALSE;
@@ -959,6 +957,23 @@ get_recently_viewed ()
}
+/* Check if the uri has subtitles */
+gboolean
+has_subtitles (GstEngine * engine)
+{
+ gint streams;
+ gboolean ret;
+
+ g_object_get (G_OBJECT (engine->player), "n-text", &streams, NULL);
+ if (streams > 0)
+ ret = TRUE;
+ else
+ ret = FALSE;
+
+ return ret;
+}
+
+
/* Get pipeline state */
GstState
get_state (GstEngine * engine)
diff --git a/src/gst_engine.h b/src/gst_engine.h
index ad17be0..6f0c1d5 100644
--- a/src/gst_engine.h
+++ b/src/gst_engine.h
@@ -75,6 +75,7 @@ void engine_volume (GstEngine * engine, gdouble level);
gboolean frame_stepping (GstEngine * engine, gboolean foward);
gchar **get_recently_viewed ();
GstState get_state (GstEngine * engine);
+gboolean has_subtitles (GstEngine * engine);
gint64 query_position (GstEngine * engine);
void set_subtitle_uri (GstEngine * engine, gchar *suburi);
gboolean toggle_subtitles (GstEngine * engine);
diff --git a/src/user_interface.c b/src/user_interface.c
index 9a366f4..c1ef848 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -690,9 +690,15 @@ load_controls (UserInterface * ui)
// Controls play toggle
ui->control_play_toggle = gtk_clutter_texture_new ();
- gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
- (ui->control_play_toggle), gdk_pixbuf_new_from_file (ui->pause_png, NULL),
- &error);
+ if (strcmp (ui->filename, "") == 0) {
+ gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
+ (ui->control_play_toggle), gdk_pixbuf_new_from_file (ui->play_png,
+ NULL), &error);
+ } else {
+ gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
+ (ui->control_play_toggle), gdk_pixbuf_new_from_file (ui->pause_png,
+ NULL), &error);
+ }
if (!ui->control_play_toggle && error)
g_debug ("Clutter error: %s", error->message);
if (error) {
@@ -862,7 +868,7 @@ load_controls (UserInterface * ui)
right_box = clutter_actor_new ();
clutter_actor_set_layout_manager (right_box, right_box_layout);
- clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (ui->info_box_layout), right_box, FALSE, /* expand */
+ clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (ui->info_box_layout), right_box, FALSE, /* expand */
FALSE, /* x-fill */
FALSE, /* y-fill */
CLUTTER_BOX_ALIGNMENT_CENTER, /* x-align */
@@ -902,7 +908,8 @@ load_controls (UserInterface * ui)
CLUTTER_BOX_ALIGNMENT_CENTER, /* x-align */
CLUTTER_BOX_ALIGNMENT_CENTER); /* y-align */
- clutter_actor_set_child_below_sibling(ui->control_box, ui->control_bg, ui->main_box);
+ clutter_actor_set_child_below_sibling (ui->control_box, ui->control_bg,
+ ui->main_box);
size_change (CLUTTER_STAGE (ui->stage), NULL, 0, ui);
}
@@ -1171,7 +1178,6 @@ toggle_playing (UserInterface * ui)
gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
(ui->control_play_toggle), gdk_pixbuf_new_from_file (ui->pause_png,
NULL), NULL);
-
}
}
@@ -1404,6 +1410,10 @@ interface_load_uri (UserInterface * ui, gchar * uri)
if (!ui->penalty_box_active)
show_controls (ui, TRUE);
+ gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE
+ (ui->control_play_toggle), gdk_pixbuf_new_from_file (ui->pause_png,
+ NULL), NULL);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]