disable playback when layer is in invalid state
authorBrandon Lewis <brandon@collabora.co.uk>
Thu, 5 Aug 2010 13:46:34 +0000 (15:46 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Thu, 2 Sep 2010 16:08:43 +0000 (18:08 +0200)
tests/examples/ges-ui.c

index 7113d15..2278c3e 100644 (file)
@@ -158,8 +158,25 @@ update_move_up_down_sensitivity (App * app)
   gtk_action_set_sensitive (app->move_down, can_move && (!app->last_selected));
 }
 
+static void
+update_play_sensitivity (App * app)
+{
+  gboolean valid;
+
+  g_object_get (app->layer, "valid", &valid, NULL);
+
+  gtk_action_set_sensitive (app->play, (app->n_objects && valid));
+}
+
 /* Backend callbacks ********************************************************/
 
+static void
+layer_notify_valid_changed_cb (GObject * object, GParamSpec * unused
+    G_GNUC_UNUSED, App * app)
+{
+  update_play_sensitivity (app);
+}
+
 static gboolean
 find_row_for_object (GtkListStore * model, GtkTreeIter * ret,
     GESTimelineObject * object)
@@ -252,7 +269,7 @@ object_count_changed (App * app)
 {
   app_update_first_last_selected (app);
   update_move_up_down_sensitivity (app);
-  gtk_action_set_sensitive (app->play, app->n_objects > 0);
+  update_play_sensitivity (app);
 }
 
 static void
@@ -770,6 +787,8 @@ create_ui (App * app)
       G_CALLBACK (layer_object_removed_cb), app);
   g_signal_connect (app->layer, "object-moved",
       G_CALLBACK (layer_object_moved_cb), app);
+  g_signal_connect (app->layer, "notify::valid",
+      G_CALLBACK (layer_notify_valid_changed_cb), app);
 
   bus = gst_pipeline_get_bus (GST_PIPELINE (app->pipeline));
   gst_bus_add_signal_watch (bus);