Initial playback control area

(not plumbed in)
This commit is contained in:
Zander Brown 2018-05-29 19:09:54 +01:00 committed by Jordan Petridis
parent 09973a6a56
commit 4afdc54914
6 changed files with 147 additions and 6 deletions

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">media-playback-start-symbolic</property>
</object>
<object class="GtkGrid" id="wrapper">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkImage" id="image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="pixel_size">64</property>
<property name="icon_name">image-x-generic-symbolic</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkScale" id="seek">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="show_fill_level">True</property>
<property name="restrict_to_fill_level">False</property>
<property name="draw_value">False</property>
<property name="has_origin">False</property>
<property name="value_pos">right</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="play">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="image">image1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">end</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="time">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">end</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<style>
<class name="playback"/>
</style>
</object>
</interface>

View File

@ -9,3 +9,7 @@ row:last-child {
list, border {
border-radius: 4px;
}
.playback {
border-top: 1px solid @borders;
}

View File

@ -13,6 +13,7 @@
<file compressed="true" preprocess="xml-stripblanks">gtk/inapp_notif.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/menus.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/playback.ui</file>
<file compressed="true">gtk/style.css</file>
</gresource>
</gresources>

View File

@ -18,7 +18,7 @@ use settings::{self, WindowGeometry};
use stacks::{Content, PopulatedState};
use utils;
use widgets::appnotif::{InAppNotification, UndoState};
use widgets::{about_dialog, mark_all_notif, remove_show_notif};
use widgets::{about_dialog, mark_all_notif, remove_show_notif, Playback};
use std::rc::Rc;
use std::sync::Arc;
@ -69,10 +69,6 @@ impl App {
let application = gtk::Application::new("org.gnome.Hammond", ApplicationFlags::empty())
.expect("Application Initialization failed...");
// Weird magic I copy-pasted that sets the Application Name in the Shell.
glib::set_application_name("Hammond");
glib::set_prgname(Some("Hammond"));
let cleanup_date = settings::get_cleanup_date(&settings);
utils::cleanup(cleanup_date);
@ -103,6 +99,9 @@ impl App {
Inhibit(false)
}));
let wrap = gtk::Box::new(gtk::Orientation::Vertical, 0);
window.add(&wrap);
// Create a content instance
let content =
Rc::new(Content::new(sender.clone()).expect(
@ -120,7 +119,13 @@ impl App {
overlay.add(&content.get_stack());
// Add the overlay to the main window
window.add(&overlay);
wrap.add(&overlay);
let playback = Playback::new();
let reveal = gtk::Revealer::new();
reveal.add(&playback.container);
wrap.add(&reveal);
WindowGeometry::from_settings(&settings).apply(&window);
@ -301,6 +306,11 @@ impl App {
}
pub fn run(self) {
// Weird magic I copy-pasted that sets the Application Name in the Shell.
glib::set_application_name("Hammond");
glib::set_prgname(Some("Hammond"));
// We need out own org.gnome.Hammon icon
gtk::Window::set_default_icon_name("multimedia-player");
ApplicationExtManual::run(&self.app_instance, &[]);
}
}

View File

@ -5,6 +5,7 @@ mod episode;
mod home_view;
mod show;
mod shows_view;
mod playback;
pub use self::aboutdialog::about_dialog;
pub use self::empty::EmptyView;
@ -13,3 +14,4 @@ pub use self::home_view::HomeView;
pub use self::show::ShowWidget;
pub use self::show::{mark_all_notif, remove_show_notif};
pub use self::shows_view::ShowsView;
pub use self::playback::Playback;

View File

@ -0,0 +1,21 @@
use gtk;
#[derive(Debug, Clone)]
pub struct Playback {
pub container: gtk::Grid,
}
impl Default for Playback {
fn default() -> Self {
let builder = gtk::Builder::new_from_resource("/org/gnome/Hammond/gtk/playback.ui");
let container = builder.get_object("wrapper").unwrap();
Playback { container }
}
}
impl Playback {
pub fn new() -> Playback {
Playback::default()
}
}