Commit 7b83da12 authored by Guido Gunther's avatar Guido Gunther
Browse files

Add placeholder page

parent 249e509d
......@@ -24,6 +24,8 @@ struct _LiviWindow
{
GtkApplicationWindow parent_instance;
GtkStack *stack_content;
GtkBox *box_content;
GtkPicture *picture_video;
GdkPaintable *paintable;
......@@ -43,6 +45,8 @@ struct _LiviWindow
GtkAdjustment *adj_duration;
GtkImage *img_fullscreen;
GtkBox *box_placeholder;
GstPlayer *player;
GstPlayerState state;
guint cookie;
......@@ -286,7 +290,6 @@ on_media_info_updated (GstPlayer *player, GstPlayerMediaInfo * info, gpointer us
LiviWindow *self = LIVI_WINDOW (user_data);
g_autofree char *text = NULL;
const gchar *title;
gint show;
#if 0
show = gst_player_media_info_get_number_of_audio_streams (info);
......@@ -355,6 +358,7 @@ livi_window_class_init (LiviWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/sigxcpu/Livi/livi-window.ui");
gtk_widget_class_bind_template_child (widget_class, LiviWindow, adj_duration);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, box_content);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, box_placeholder);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, btn_mute);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, btn_play);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, img_fullscreen);
......@@ -368,6 +372,7 @@ livi_window_class_init (LiviWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, LiviWindow, picture_video);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, revealer_controls);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, revealer_info);
gtk_widget_class_bind_template_child (widget_class, LiviWindow, stack_content);
gtk_widget_class_bind_template_callback (widget_class, on_btn_fullscreen_clicked);
gtk_widget_class_bind_template_callback (widget_class, on_btn_mute_clicked);
gtk_widget_class_bind_template_callback (widget_class, on_btn_play_clicked);
......@@ -410,10 +415,17 @@ livi_window_init (LiviWindow *self)
void
livi_window_set_uri (LiviWindow *self, const char *uri)
{
gtk_stack_set_visible_child (self->stack_content, GTK_WIDGET (self->box_content));
gst_player_set_uri (self->player, uri);
}
void
livi_window_set_placeholder (LiviWindow *self)
{
gtk_stack_set_visible_child (self->stack_content, GTK_WIDGET (self->box_placeholder));
}
void
livi_window_set_play (LiviWindow *self)
{
......
......@@ -18,6 +18,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (LiviWindow, livi_window, LIVI, WINDOW, GtkApplicationWindow)
void livi_window_set_uri (LiviWindow *self, const char *uri);
void livi_window_set_placeholder (LiviWindow *self);
void livi_window_set_play (LiviWindow *self);
void livi_window_set_pause (LiviWindow *self);
......
......@@ -11,147 +11,166 @@
<property name="show-title-buttons">True</property>
</object>
</child>
<child>
<object class="GtkBox" id="box_content">
<object class="GtkStack" id="stack_content">
<property name="transition-type">crossfade</property>
<property name="transition-duration">400</property>
<child>
<object class="GtkOverlay" id="overlay">
<object class="GtkBox" id="box_content">
<child>
<object class="GtkPicture" id="picture_video">
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="realize" handler="on_realize" swapped="yes"/>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="revealer_info">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="transition-type">slide-down</property>
<object class="GtkOverlay" id="overlay">
<child>
<object class="GtkBox" id="box_info">
<property name="orientation">horizontal</property>
<object class="GtkPicture" id="picture_video">
<property name="halign">center</property>
<property name="hexpand">True</property>
<child>
<object class="GtkLabel" id="lbl_status">
<property name="visible">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="lbl_title">
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="ellipsize">middle</property>
</object>
</child>
<child>
<object class="GtkImage" id="img_accel">
<property name="icon-name"></property>
<property name="pixel-size">16</property>
</object>
</child>
<style>
<class name="livi-info"/>
</style>
<property name="vexpand">True</property>
<signal name="realize" handler="on_realize" swapped="yes"/>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="revealer_controls">
<property name="halign">center</property>
<property name="valign">end</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkBox" id="box_controls">
<property name="orientation">horizontal</property>
<property name="hexpand">True</property>
<property name="valign">end</property>
<child type="overlay">
<object class="GtkRevealer" id="revealer_info">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="transition-type">slide-down</property>
<child>
<object class="GtkButton" id="btn_play">
<property name="tooltip-text" translatable="yes">Play/Pause</property>
<property name="halign">start</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_play_clicked" swapped="yes"/>
<object class="GtkBox" id="box_info">
<property name="orientation">horizontal</property>
<property name="hexpand">True</property>
<child>
<object class="GtkImage" id="img_play">
<property name="icon-name">media-playback-pause-symbolic</property>
<property name="pixel-size">32</property>
<object class="GtkLabel" id="lbl_status">
<property name="visible">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
</object>
</child>
<child>
<object class="GtkLabel" id="lbl_title">
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="ellipsize">middle</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkScale" id="slider">
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_duration</property>
<property name="show-fill-level">True</property>
<signal name="change-value" handler="on_slider_value_changed" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkLabel" id="lbl_time">
<property name="width-request">24</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-end">6</property>
<property name="label"></property>
</object>
</child>
<child>
<object class="GtkButton" id="btn_mute">
<property name="tooltip-text" translatable="yes">Mute</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_mute_clicked" swapped="yes"/>
<child>
<object class="GtkImage" id="img_mute">
<property name="icon-name">audio-volume-muted-symbolic</property>
<property name="pixel-size">32</property>
<object class="GtkImage" id="img_accel">
<property name="icon-name"></property>
<property name="pixel-size">16</property>
</object>
</child>
<style>
<class name="flat"/>
<class name="livi-info"/>
</style>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="revealer_controls">
<property name="halign">center</property>
<property name="valign">end</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkButton" id="btn_fullscreen">
<property name="tooltip-text" translatable="yes">Fullscreen</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_fullscreen_clicked" swapped="yes"/>
<object class="GtkBox" id="box_controls">
<property name="orientation">horizontal</property>
<property name="hexpand">True</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="img_fullscreen">
<property name="icon-name">view-fullscreen-symbolic</property>
<property name="pixel-size">32</property>
<object class="GtkButton" id="btn_play">
<property name="tooltip-text" translatable="yes">Play/Pause</property>
<property name="halign">start</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_play_clicked" swapped="yes"/>
<child>
<object class="GtkImage" id="img_play">
<property name="icon-name">media-playback-pause-symbolic</property>
<property name="pixel-size">32</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkScale" id="slider">
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="hexpand">True</property>
<property name="adjustment">adj_duration</property>
<property name="show-fill-level">True</property>
<signal name="change-value" handler="on_slider_value_changed" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkLabel" id="lbl_time">
<property name="width-request">24</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-end">6</property>
<property name="label"></property>
</object>
</child>
<child>
<object class="GtkButton" id="btn_mute">
<property name="tooltip-text" translatable="yes">Mute</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_mute_clicked" swapped="yes"/>
<child>
<object class="GtkImage" id="img_mute">
<property name="icon-name">audio-volume-muted-symbolic</property>
<property name="pixel-size">32</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="btn_fullscreen">
<property name="tooltip-text" translatable="yes">Fullscreen</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_fullscreen_clicked" swapped="yes"/>
<child>
<object class="GtkImage" id="img_fullscreen">
<property name="icon-name">view-fullscreen-symbolic</property>
<property name="pixel-size">32</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<style>
<class name="flat"/>
<class name="livi-controls"/>
</style>
</object>
</child>
<style>
<class name="livi-controls"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="box_placeholder">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<child>
<object class="AdwStatusPage">
<property name="icon-name">play-large-symbolic</property>
<property name="title">Waiting for a video to play</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
......
......@@ -38,6 +38,8 @@ on_activate (GtkApplication *app)
g_debug ("Playing %s", url);
livi_window_set_uri (LIVI_WINDOW (window), url);
livi_window_set_play (LIVI_WINDOW (window));
} else {
livi_window_set_placeholder (LIVI_WINDOW (window));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment