More modulation of the gtk client.

This commit is contained in:
Jordan Petridis 2017-10-18 18:32:39 +03:00
parent ddf62711c7
commit 52f2fa8791
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
8 changed files with 33 additions and 49 deletions

View File

@ -2,44 +2,6 @@
<!-- Generated with glade 3.20.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="FooStore">
<columns>
<!-- column-name id -->
<column type="guint"/>
<!-- column-name title -->
<column type="gchararray"/>
<!-- column-name description -->
<column type="gchararray"/>
<!-- column-name link -->
<column type="gchararray"/>
<!-- column-name image -->
<column type="GdkPixbuf"/>
<!-- column-name image_uri -->
<column type="gchararray"/>
<!-- column-name uri -->
<column type="gchararray"/>
<!-- column-name local_uri -->
<column type="gchararray"/>
<!-- column-name published_date -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="PdListStore">
<columns>
<!-- column-name id -->
<column type="guint"/>
<!-- column-name title -->
<column type="gchararray"/>
<!-- column-name description -->
<column type="gchararray"/>
<!-- column-name link -->
<column type="gchararray"/>
<!-- column-name image_uri -->
<column type="gchararray"/>
<!-- column-name img -->
<column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkApplicationWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">1000</property>
@ -104,7 +66,7 @@
</child>
</object>
</child>
<child>
<child type="titlebar">
<placeholder/>
</child>
</object>

View File

@ -2,6 +2,22 @@
<!-- Generated with glade 3.20.1 -->
<interface domain="gnome-music">
<requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="pd_store">
<columns>
<!-- column-name id -->
<column type="guint"/>
<!-- column-name title -->
<column type="gchararray"/>
<!-- column-name description -->
<column type="gchararray"/>
<!-- column-name link -->
<column type="gchararray"/>
<!-- column-name image_uri -->
<column type="gchararray"/>
<!-- column-name img -->
<column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkBox" id="podcast_widget">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -25,10 +25,10 @@ use gtk::prelude::*;
use gio::ApplicationExt;
use gdk_pixbuf::Pixbuf;
pub mod podcast_widget;
pub mod episode_widget;
pub mod views;
pub mod widgets;
use podcast_widget::{create_flowbox_child, podcast_liststore, podcast_widget};
use widgets::podcast::{create_flowbox_child, podcast_liststore, podcast_widget};
/*
THIS IS STILL A PROTOTYPE.
@ -120,7 +120,7 @@ fn build_ui() {
});
let tempdb = db.lock().unwrap();
let pd_model = podcast_liststore(&tempdb, &builder);
let pd_model = podcast_liststore(&tempdb);
drop(tempdb);
// Get a ListStore iterator at the first element.

View File

@ -0,0 +1 @@
pub mod podcasts_view;

View File

@ -0,0 +1 @@

View File

@ -16,7 +16,7 @@ fn epidose_widget(
pd_title: &str,
) -> gtk::Box {
// This is just a prototype and will be reworked probably.
let builder = include_str!("../gtk/episode_widget.ui");
let builder = include_str!("../../gtk/episode_widget.ui");
let builder = gtk::Builder::new_from_string(builder);
let ep: gtk::Box = builder.get_object("episode_box").unwrap();

View File

@ -0,0 +1,2 @@
pub mod podcast;
pub mod episode;

View File

@ -7,7 +7,7 @@ use hammond_data::dbqueries;
use std::sync::{Arc, Mutex};
use episode_widget::episodes_listbox;
use widgets::episode::episodes_listbox;
pub fn podcast_widget(
connection: Arc<Mutex<SqliteConnection>>,
@ -16,7 +16,7 @@ pub fn podcast_widget(
image: Option<Pixbuf>,
) -> gtk::Box {
// Adapted from gnome-music AlbumWidget
let pd_widget_source = include_str!("../gtk/podcast_widget.ui");
let pd_widget_source = include_str!("../../gtk/podcast_widget.ui");
let pd_widget_buidler = gtk::Builder::new_from_string(pd_widget_source);
let pd_widget: gtk::Box = pd_widget_buidler.get_object("podcast_widget").unwrap();
@ -44,7 +44,7 @@ pub fn podcast_widget(
}
pub fn create_flowbox_child(title: &str, cover: Option<Pixbuf>) -> gtk::FlowBoxChild {
let build_src = include_str!("../gtk/pd_fb_child.ui");
let build_src = include_str!("../../gtk/pd_fb_child.ui");
let builder = gtk::Builder::new_from_string(build_src);
// Copy of gnome-music AlbumWidget
@ -70,8 +70,10 @@ pub fn create_flowbox_child(title: &str, cover: Option<Pixbuf>) -> gtk::FlowBoxC
fbc
}
pub fn podcast_liststore(connection: &SqliteConnection, builder: &gtk::Builder) -> gtk::ListStore {
let podcast_model: gtk::ListStore = builder.get_object("PdListStore").unwrap();
pub fn podcast_liststore(connection: &SqliteConnection) -> gtk::ListStore {
let builder = include_str!("../../gtk/podcast_widget.ui");
let builder = gtk::Builder::new_from_string(builder);
let podcast_model: gtk::ListStore = builder.get_object("pd_store").unwrap();
let podcasts = dbqueries::get_podcasts(connection).unwrap();