minor changes
This commit is contained in:
parent
2d81a1b8b4
commit
5434b0b8c6
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pika-drivers"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
2
Makefile
2
Makefile
@ -8,7 +8,9 @@ install:
|
||||
cp -vf target/release/pika-drivers $(DESTDIR)/usr/bin/
|
||||
chmod 755 $(DESTDIR)/usr/bin/pika-drivers
|
||||
mkdir -p $(DESTDIR)/usr/lib/pika/drivers/
|
||||
mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||
cp data/*.sh $(DESTDIR)/usr/lib/pika/drivers/
|
||||
cp data/*.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
|
||||
chmod 755 $(DESTDIR)/usr/lib/pika/drivers/*.sh
|
||||
mkdir -p $(DESTDIR)/usr/share/applications
|
||||
mkdir -p $(DESTDIR)/usr/share/icons/hicolor/scalable/apps
|
||||
|
17
data/com.pika.drivers.gschema.xml
Normal file
17
data/com.pika.drivers.gschema.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<schemalist>
|
||||
<schema id="com.pika.drivers" path="/com/pika/drivers/">
|
||||
<key name="window-width" type="i">
|
||||
<default>1200</default>
|
||||
<summary>Default window width</summary>
|
||||
</key>
|
||||
<key name="window-height" type="i">
|
||||
<default>600</default>
|
||||
<summary>Default window height</summary>
|
||||
</key>
|
||||
<key name="is-maximized" type="b">
|
||||
<default>false</default>
|
||||
<summary>Default window maximized behaviour</summary>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
pika-drivers (0.3.1-99pika1.lunar) lunar; urgency=medium
|
||||
pika-drivers (0.3.2-99pika1.lunar) lunar; urgency=medium
|
||||
|
||||
* initial release
|
||||
|
||||
|
34
src/main.rs
34
src/main.rs
@ -9,7 +9,7 @@ use gdk::Display;
|
||||
const PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
fn main() {
|
||||
let application = Application::new(Some("com.pika.drivers"), Default::default());
|
||||
let application = gtk::Application::new(Some("com.pika.drivers"), Default::default());
|
||||
application.connect_startup(|app| {
|
||||
// The CSS "magic" happens here.
|
||||
let provider = CssProvider::new();
|
||||
@ -29,11 +29,12 @@ fn main() {
|
||||
}
|
||||
|
||||
|
||||
fn build_ui(app: &Application) {
|
||||
fn build_ui(app: >k::Application) {
|
||||
|
||||
|
||||
gtk::glib::set_prgname(Some("Pika Drivers"));
|
||||
glib::set_application_name("Pika Drivers");
|
||||
let glib_settings = gio::Settings::new("com.pika.drivers");
|
||||
|
||||
let loading_box = gtk::Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
@ -87,13 +88,20 @@ fn build_ui(app: &Application) {
|
||||
.application(app)
|
||||
.child(&loading_box)
|
||||
.icon_name("pika-drivers")
|
||||
.default_width(1200)
|
||||
.default_height(600)
|
||||
.default_width(glib_settings.int("window-width"))
|
||||
.default_height(glib_settings.int("window-height"))
|
||||
.width_request(700)
|
||||
.height_request(500)
|
||||
.startup_id("pika-drivers")
|
||||
.hide_on_close(true)
|
||||
.build();
|
||||
|
||||
if glib_settings.boolean("is-maximized") == true {
|
||||
window.maximize()
|
||||
}
|
||||
|
||||
|
||||
|
||||
let credits_window_box = gtk::Box::builder()
|
||||
.orientation(Orientation::Vertical)
|
||||
.build();
|
||||
@ -151,7 +159,11 @@ fn build_ui(app: &Application) {
|
||||
|
||||
window_title_bar.pack_end(&credits_button.clone());
|
||||
|
||||
window.connect_hide(clone!(@weak window => move |_| save_window_size(&window, &glib_settings)));
|
||||
window.connect_hide(clone!(@weak window => move |_| window.destroy()));
|
||||
|
||||
credits_button.connect_clicked(clone!(@weak credits_button => move |_| credits_window.show()));
|
||||
|
||||
|
||||
let (sender, receiver) = MainContext::channel(Priority::default());
|
||||
window.connect_show(move |_| {
|
||||
@ -300,7 +312,8 @@ fn get_drivers(main_window: &ApplicationWindow, ubuntu_drivers_list_utf8: String
|
||||
.build();
|
||||
|
||||
let driver_label = gtk::Label::builder()
|
||||
.margin_top(35)
|
||||
.margin_top(26)
|
||||
.margin_bottom(5)
|
||||
.build();
|
||||
driver_label.add_css_class("startLabel");
|
||||
|
||||
@ -435,8 +448,15 @@ fn get_drivers(main_window: &ApplicationWindow, ubuntu_drivers_list_utf8: String
|
||||
driver_button.connect_clicked(clone!(@weak driver_button => move |_| modify_package(&driver_string, &driver_button_icon)));
|
||||
|
||||
main_window.set_child(Some(&window_box));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fn save_window_size(window: &ApplicationWindow, glib_settings: &gio::Settings) {
|
||||
|
||||
let size = window.default_size();
|
||||
|
||||
glib_settings.set_int("window-width", size.0);
|
||||
glib_settings.set_int("window-height", size.1);
|
||||
glib_settings.set_boolean("is-maximized", window.is_maximized());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user