summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2014-02-04 15:41:43 +0100
committerBastien Nocera <hadess@hadess.net>2014-02-04 17:36:15 +0100
commit9fdad927060b12b3c5b03068d06d2bb3959eca95 (patch)
treea685b09706684f446a1cb86e61b9337f59eec3f9
parent2c0d5198bccda8b665e0275f321e432f17c990b2 (diff)
downloadtotem-9fdad927060b12b3c5b03068d06d2bb3959eca95.tar.gz
backend: Allow forcing the popup to stay on
-rw-r--r--src/backend/bacon-video-widget.c43
-rw-r--r--src/backend/bacon-video-widget.h4
2 files changed, 47 insertions, 0 deletions
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 7f2edb8ad..e980f0e67 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -220,6 +220,7 @@ struct BaconVideoWidgetPrivate
/* Controls */
gboolean reveal_controls;
guint transition_timeout_id;
+ GHashTable *busy_popup_ht; /* key=reason string, value=gboolean */
/* Visual effects */
GList *vis_plugins_list;
@@ -1352,6 +1353,8 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
priv->auth_last_result = G_MOUNT_OPERATION_HANDLED;
priv->auth_dialog = NULL;
+ priv->busy_popup_ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
bacon_video_widget_gst_missing_plugins_blacklist ();
}
@@ -2796,6 +2799,7 @@ bacon_video_widget_finalize (GObject * object)
g_clear_pointer (&bvw->priv->mrl, g_free);
g_clear_pointer (&bvw->priv->subtitle_uri, g_free);
g_clear_pointer (&bvw->priv->vis_element_name, g_free);
+ g_clear_pointer (&bvw->priv->busy_popup_ht, g_hash_table_destroy);
g_clear_object (&bvw->priv->clock);
@@ -3545,6 +3549,45 @@ bacon_video_widget_show_popup (BaconVideoWidget *bvw)
schedule_hiding_popup (bvw);
}
+void
+bacon_video_widget_mark_popup_busy (BaconVideoWidget *bvw,
+ const char *reason)
+{
+ gboolean was_busy;
+
+ g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+
+ was_busy = (g_hash_table_size (bvw->priv->busy_popup_ht) > 0);
+ g_hash_table_insert (bvw->priv->busy_popup_ht,
+ g_strdup (reason),
+ GINT_TO_POINTER (1));
+
+ GST_DEBUG ("Adding popup busy for reason %s", reason);
+
+ if (!was_busy) {
+ GST_DEBUG ("Will not hide popup due to timeout");
+ unschedule_hiding_popup (bvw);
+ }
+}
+
+void
+bacon_video_widget_unmark_popup_busy (BaconVideoWidget *bvw,
+ const char *reason)
+{
+ g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+ g_return_if_fail (clutter_actor_get_opacity (bvw->priv->controls) != 0);
+
+ g_hash_table_remove (bvw->priv->busy_popup_ht, reason);
+
+ GST_DEBUG ("Removing popup busy for reason %s", reason);
+
+ if (g_hash_table_size (bvw->priv->busy_popup_ht) == 0 &&
+ clutter_actor_get_opacity (bvw->priv->controls) != 0) {
+ GST_DEBUG ("Will hide popup soon");
+ schedule_hiding_popup (bvw);
+ }
+}
+
GObject *
bacon_video_widget_get_controls_object (BaconVideoWidget *bvw)
{
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index ab97b6751..e33e6041f 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -456,6 +456,10 @@ void bacon_video_widget_set_audio_output_type (BaconVideoWidget *bvw,
/* OSD */
void bacon_video_widget_show_popup (BaconVideoWidget *bvw);
+void bacon_video_widget_mark_popup_busy (BaconVideoWidget *bvw,
+ const char *reason);
+void bacon_video_widget_unmark_popup_busy (BaconVideoWidget *bvw,
+ const char *reason);
GObject * bacon_video_widget_get_controls_object (BaconVideoWidget *bvw);