From b20a89540f55fe83572c8de52e0391a65fab5e47 Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Thu, 22 Jul 2010 13:13:20 +0200 Subject: [PATCH] disable playback when there's nothing in the timeline --- tests/examples/ges-ui.c | 11 +++++++++++ tests/examples/ges-ui.glade | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index ca3532aaae..a3637badd7 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -33,6 +33,7 @@ typedef struct App GtkWidget *properties; GList *selected_objects; int n_selected; + int n_objects; GtkHScale *duration; GtkHScale *in_point; GtkAction *add_file; @@ -413,6 +414,12 @@ desc_for_object (GESTimelineObject * object) return uri; } +static void +object_count_changed (App * app) +{ + gtk_action_set_sensitive (app->play, app->n_objects > 0); +} + static void layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object, App * app) @@ -430,6 +437,8 @@ layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object, g_signal_connect (G_OBJECT (object), "notify::duration", G_CALLBACK (timeline_object_notify_duration_cb), app); timeline_object_notify_duration_cb (object, NULL, app); + app->n_objects++; + object_count_changed (app); } static void @@ -444,6 +453,8 @@ layer_object_removed_cb (GESTimelineLayer * layer, GESTimelineObject * object, g_print ("object deleted but we don't own it"); return; } + app->n_objects--; + object_count_changed (app); gtk_list_store_remove (app->model, &iter); } diff --git a/tests/examples/ges-ui.glade b/tests/examples/ges-ui.glade index bd26c408fc..87463bc480 100644 --- a/tests/examples/ges-ui.glade +++ b/tests/examples/ges-ui.glade @@ -99,8 +99,9 @@ True - True delete + True + True True @@ -126,8 +127,9 @@ True - True add_file + True + True True @@ -139,8 +141,10 @@ True - True play + True + True + True @@ -179,8 +183,8 @@ True - add_file True + add_file toolbutton1 True @@ -192,8 +196,8 @@ True - delete True + delete Delete True @@ -214,8 +218,8 @@ True - play True + play toolbutton1 True @@ -397,8 +401,8 @@ - + @@ -416,6 +420,7 @@ Play gtk-media-play + False True