disable playback when there's nothing in the timeline

This commit is contained in:
Brandon Lewis 2010-07-22 13:13:20 +02:00 committed by Edward Hervey
parent 921378b488
commit b20a89540f
2 changed files with 23 additions and 7 deletions

View file

@ -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);
}

View file

@ -99,8 +99,9 @@
<child>
<object class="GtkImageMenuItem" id="delete_item">
<property name="visible">True</property>
<property name="use_action_appearance">True</property>
<property name="related_action">delete</property>
<property name="use_action_appearance">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
@ -126,8 +127,9 @@
<child>
<object class="GtkImageMenuItem" id="add_file_item">
<property name="visible">True</property>
<property name="use_action_appearance">True</property>
<property name="related_action">add_file</property>
<property name="use_action_appearance">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
@ -139,8 +141,10 @@
<child>
<object class="GtkImageMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="use_action_appearance">True</property>
<property name="related_action">play</property>
<property name="use_action_appearance">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
</object>
@ -179,8 +183,8 @@
<child>
<object class="GtkToolButton" id="add_button">
<property name="visible">True</property>
<property name="related_action">add_file</property>
<property name="use_action_appearance">True</property>
<property name="related_action">add_file</property>
<property name="label" translatable="yes">toolbutton1</property>
<property name="use_underline">True</property>
</object>
@ -192,8 +196,8 @@
<child>
<object class="GtkToolButton" id="delete_button">
<property name="visible">True</property>
<property name="related_action">delete</property>
<property name="use_action_appearance">True</property>
<property name="related_action">delete</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
</object>
@ -214,8 +218,8 @@
<child>
<object class="GtkToolButton" id="play_button">
<property name="visible">True</property>
<property name="related_action">play</property>
<property name="use_action_appearance">True</property>
<property name="related_action">play</property>
<property name="label" translatable="yes">toolbutton1</property>
<property name="use_underline">True</property>
</object>
@ -397,8 +401,8 @@
<object class="GtkTreeSelection" id="selection"/>
<object class="GtkSizeGroup" id="LabelSizeGroup">
<widgets>
<widget name="label_inpoint"/>
<widget name="label_duration"/>
<widget name="label_inpoint"/>
</widgets>
</object>
<object class="GtkAction" id="delete">
@ -416,6 +420,7 @@
<object class="GtkAction" id="play">
<property name="label">Play</property>
<property name="stock_id">gtk-media-play</property>
<property name="sensitive">False</property>
<property name="always_show_image">True</property>
<signal name="activate" handler="play_activate_cb"/>
</object>