Everything works (ish)
Also use FileChooserNative for flatpak nicities
This commit is contained in:
parent
8c2ea052de
commit
75c50392cb
@ -11,7 +11,7 @@
|
|||||||
<property name="title" translatable="yes">Miscellaneous</property>
|
<property name="title" translatable="yes">Miscellaneous</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkShortcutsShortcut">
|
<object class="GtkShortcutsShortcut">
|
||||||
<property name="accelerator"><primar>q</property>
|
<property name="accelerator"><primary>q</property>
|
||||||
<property name="title" translatable="yes">Quit</property>
|
<property name="title" translatable="yes">Quit</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||||
<attribute name="action">app.quit</attribute>
|
<attribute name="action">app.quit</attribute>
|
||||||
|
<attribute name="accel"><primary>q</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@ -9,12 +9,12 @@ use gtk::SettingsExt as GtkSettingsExt;
|
|||||||
use hammond_data::Podcast;
|
use hammond_data::Podcast;
|
||||||
use hammond_data::{opml};
|
use hammond_data::{opml};
|
||||||
|
|
||||||
//use appnotif::{InAppNotification, UndoState};
|
use appnotif::{InAppNotification, UndoState};
|
||||||
use headerbar::Header;
|
use headerbar::Header;
|
||||||
use settings::{self, WindowGeometry};
|
use settings::{self, WindowGeometry};
|
||||||
use stacks::{Content/*, PopulatedState*/};
|
use stacks::{Content, PopulatedState};
|
||||||
use utils;
|
use utils;
|
||||||
//use widgets::{mark_all_notif, remove_show_notif};
|
use widgets::{mark_all_notif, remove_show_notif};
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::{channel, Sender};
|
use std::sync::mpsc::{channel, Sender};
|
||||||
@ -22,6 +22,8 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use rayon;
|
use rayon;
|
||||||
|
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
RefreshAllViews,
|
RefreshAllViews,
|
||||||
@ -63,7 +65,8 @@ impl App {
|
|||||||
// Ideally a lot more than actions would happen in startup & window
|
// Ideally a lot more than actions would happen in startup & window
|
||||||
// creation would be in activate
|
// creation would be in activate
|
||||||
application.connect_startup(clone!(settings => move |app| {
|
application.connect_startup(clone!(settings => move |app| {
|
||||||
let (sender, _receiver) = channel();
|
let (sender, receiver) = channel();
|
||||||
|
let receiver = Rc::new(RefCell::new(receiver));
|
||||||
|
|
||||||
let refresh = SimpleAction::new("refresh", None);
|
let refresh = SimpleAction::new("refresh", None);
|
||||||
refresh.connect_activate(clone!(sender => move |_, _| {
|
refresh.connect_activate(clone!(sender => move |_, _| {
|
||||||
@ -93,7 +96,7 @@ impl App {
|
|||||||
quit.connect_activate(clone!(app => move |_, _| app.quit()));
|
quit.connect_activate(clone!(app => move |_, _| app.quit()));
|
||||||
app.add_action(&quit);
|
app.add_action(&quit);
|
||||||
|
|
||||||
app.connect_activate(clone!(sender, settings => move |app| {
|
app.connect_activate(clone!(sender, settings, receiver => move |app| {
|
||||||
// Get the current window (if any)
|
// Get the current window (if any)
|
||||||
if let Some(window) = app.get_active_window() {
|
if let Some(window) = app.get_active_window() {
|
||||||
// Already open, just raise the window
|
// Already open, just raise the window
|
||||||
@ -115,7 +118,7 @@ impl App {
|
|||||||
Rc::new(Content::new(sender.clone()).expect("Content Initialization failed."));
|
Rc::new(Content::new(sender.clone()).expect("Content Initialization failed."));
|
||||||
|
|
||||||
// Create the headerbar
|
// Create the headerbar
|
||||||
let _header = Rc::new(Header::new(&content, &window, &sender));
|
let header = Rc::new(Header::new(&content, &window, &sender));
|
||||||
|
|
||||||
// Add the content main stack to the overlay.
|
// Add the content main stack to the overlay.
|
||||||
let overlay = gtk::Overlay::new();
|
let overlay = gtk::Overlay::new();
|
||||||
@ -131,9 +134,12 @@ impl App {
|
|||||||
window.show_all();
|
window.show_all();
|
||||||
window.activate();
|
window.activate();
|
||||||
|
|
||||||
let _headerbar = _header;
|
let headerbar = header;
|
||||||
gtk::timeout_add(50, move || {
|
gtk::timeout_add(50, clone!(sender, receiver => move || {
|
||||||
/*match receiver.try_recv() {
|
// Uses receiver, content, headerbar, sender, overlay
|
||||||
|
let act = receiver.borrow().try_recv();
|
||||||
|
//let act: Result<Action, RecvError> = Ok(Action::RefreshAllViews);
|
||||||
|
match act {
|
||||||
Ok(Action::RefreshAllViews) => content.update(),
|
Ok(Action::RefreshAllViews) => content.update(),
|
||||||
Ok(Action::RefreshShowsView) => content.update_shows_view(),
|
Ok(Action::RefreshShowsView) => content.update_shows_view(),
|
||||||
Ok(Action::RefreshWidgetIfSame(id)) => content.update_widget_if_same(id),
|
Ok(Action::RefreshWidgetIfSame(id)) => content.update_widget_if_same(id),
|
||||||
@ -181,10 +187,10 @@ impl App {
|
|||||||
notif.show(&overlay);
|
notif.show(&overlay);
|
||||||
}
|
}
|
||||||
Err(_) => (),
|
Err(_) => (),
|
||||||
}*/
|
}
|
||||||
|
|
||||||
Continue(true)
|
Continue(true)
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
@ -282,19 +288,17 @@ fn about_dialog(window: >k::Window) {
|
|||||||
|
|
||||||
fn on_import_clicked(window: >k::Window, sender: &Sender<Action>) {
|
fn on_import_clicked(window: >k::Window, sender: &Sender<Action>) {
|
||||||
use glib::translate::ToGlib;
|
use glib::translate::ToGlib;
|
||||||
use gtk::{FileChooserAction, FileChooserDialog, FileFilter, ResponseType};
|
use gtk::{FileChooserAction, FileChooserNative, FileFilter, ResponseType};
|
||||||
|
|
||||||
// let dialog = FileChooserDialog::new(title, Some(&window), FileChooserAction::Open);
|
// let dialog = FileChooserDialog::new(title, Some(&window), FileChooserAction::Open);
|
||||||
// TODO: It might be better to use a FileChooserNative widget.
|
// TODO: It might be better to use a FileChooserNative widget.
|
||||||
// Create the FileChooser Dialog
|
// Create the FileChooser Dialog
|
||||||
let dialog = FileChooserDialog::with_buttons(
|
let dialog = FileChooserNative::new(
|
||||||
Some("Select the file from which to you want to Import Shows."),
|
Some("Select the file from which to you want to Import Shows."),
|
||||||
Some(window),
|
Some(window),
|
||||||
FileChooserAction::Open,
|
FileChooserAction::Open,
|
||||||
&[
|
Some("_Cancel"),
|
||||||
("_Cancel", ResponseType::Cancel),
|
Some("_Import"),
|
||||||
("_Open", ResponseType::Accept),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Do not show hidden(.thing) files
|
// Do not show hidden(.thing) files
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
)]
|
)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
#![warn(unused_extern_crates, unused)]
|
#![warn(unused_extern_crates, unused)]
|
||||||
//#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
extern crate gdk;
|
extern crate gdk;
|
||||||
extern crate gdk_pixbuf;
|
extern crate gdk_pixbuf;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user