mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
disable playback when there's nothing in the timeline
This commit is contained in:
parent
921378b488
commit
b20a89540f
2 changed files with 23 additions and 7 deletions
|
@ -33,6 +33,7 @@ typedef struct App
|
||||||
GtkWidget *properties;
|
GtkWidget *properties;
|
||||||
GList *selected_objects;
|
GList *selected_objects;
|
||||||
int n_selected;
|
int n_selected;
|
||||||
|
int n_objects;
|
||||||
GtkHScale *duration;
|
GtkHScale *duration;
|
||||||
GtkHScale *in_point;
|
GtkHScale *in_point;
|
||||||
GtkAction *add_file;
|
GtkAction *add_file;
|
||||||
|
@ -413,6 +414,12 @@ desc_for_object (GESTimelineObject * object)
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
object_count_changed (App * app)
|
||||||
|
{
|
||||||
|
gtk_action_set_sensitive (app->play, app->n_objects > 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
||||||
App * app)
|
App * app)
|
||||||
|
@ -430,6 +437,8 @@ layer_object_added_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
||||||
g_signal_connect (G_OBJECT (object), "notify::duration",
|
g_signal_connect (G_OBJECT (object), "notify::duration",
|
||||||
G_CALLBACK (timeline_object_notify_duration_cb), app);
|
G_CALLBACK (timeline_object_notify_duration_cb), app);
|
||||||
timeline_object_notify_duration_cb (object, NULL, app);
|
timeline_object_notify_duration_cb (object, NULL, app);
|
||||||
|
app->n_objects++;
|
||||||
|
object_count_changed (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -444,6 +453,8 @@ layer_object_removed_cb (GESTimelineLayer * layer, GESTimelineObject * object,
|
||||||
g_print ("object deleted but we don't own it");
|
g_print ("object deleted but we don't own it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
app->n_objects--;
|
||||||
|
object_count_changed (app);
|
||||||
|
|
||||||
gtk_list_store_remove (app->model, &iter);
|
gtk_list_store_remove (app->model, &iter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,9 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImageMenuItem" id="delete_item">
|
<object class="GtkImageMenuItem" id="delete_item">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="related_action">delete</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>
|
<property name="use_stock">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -126,8 +127,9 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImageMenuItem" id="add_file_item">
|
<object class="GtkImageMenuItem" id="add_file_item">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="related_action">add_file</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>
|
<property name="use_stock">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -139,8 +141,10 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImageMenuItem" id="menuitem2">
|
<object class="GtkImageMenuItem" id="menuitem2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="use_action_appearance">True</property>
|
|
||||||
<property name="related_action">play</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>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -179,8 +183,8 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolButton" id="add_button">
|
<object class="GtkToolButton" id="add_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="related_action">add_file</property>
|
|
||||||
<property name="use_action_appearance">True</property>
|
<property name="use_action_appearance">True</property>
|
||||||
|
<property name="related_action">add_file</property>
|
||||||
<property name="label" translatable="yes">toolbutton1</property>
|
<property name="label" translatable="yes">toolbutton1</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -192,8 +196,8 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolButton" id="delete_button">
|
<object class="GtkToolButton" id="delete_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="related_action">delete</property>
|
|
||||||
<property name="use_action_appearance">True</property>
|
<property name="use_action_appearance">True</property>
|
||||||
|
<property name="related_action">delete</property>
|
||||||
<property name="label" translatable="yes">Delete</property>
|
<property name="label" translatable="yes">Delete</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -214,8 +218,8 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolButton" id="play_button">
|
<object class="GtkToolButton" id="play_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="related_action">play</property>
|
|
||||||
<property name="use_action_appearance">True</property>
|
<property name="use_action_appearance">True</property>
|
||||||
|
<property name="related_action">play</property>
|
||||||
<property name="label" translatable="yes">toolbutton1</property>
|
<property name="label" translatable="yes">toolbutton1</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -397,8 +401,8 @@
|
||||||
<object class="GtkTreeSelection" id="selection"/>
|
<object class="GtkTreeSelection" id="selection"/>
|
||||||
<object class="GtkSizeGroup" id="LabelSizeGroup">
|
<object class="GtkSizeGroup" id="LabelSizeGroup">
|
||||||
<widgets>
|
<widgets>
|
||||||
<widget name="label_inpoint"/>
|
|
||||||
<widget name="label_duration"/>
|
<widget name="label_duration"/>
|
||||||
|
<widget name="label_inpoint"/>
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAction" id="delete">
|
<object class="GtkAction" id="delete">
|
||||||
|
@ -416,6 +420,7 @@
|
||||||
<object class="GtkAction" id="play">
|
<object class="GtkAction" id="play">
|
||||||
<property name="label">Play</property>
|
<property name="label">Play</property>
|
||||||
<property name="stock_id">gtk-media-play</property>
|
<property name="stock_id">gtk-media-play</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
<signal name="activate" handler="play_activate_cb"/>
|
<signal name="activate" handler="play_activate_cb"/>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in a new issue