Skip to content

Commit 6302669

Browse files
author
Deren Vural
committed
Updated main.rs
- removed unused imports - changed APP_ID to match new name - added CSS loading Added style.css - for CSS fixes, currently only popovermenu in settings window Signed-off-by: Deren Vural <[email protected]>
1 parent 68d83a7 commit 6302669

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/main.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,22 @@ use mainwindow::MainWindow;
2929
mod settingswindow;
3030

3131
// Imports
32-
//use std::env;
33-
//use std::path::Path;
34-
//use libappindicator::{
35-
// /* SysTray */ AppIndicator, AppIndicatorStatus
36-
//};
37-
3832
use adwaita::prelude::*;
39-
//use gtk::Application;
4033
use adwaita::{
4134
/* Libraries */ gio,
4235
/* Application */ Application,
43-
// SplitButton
4436
};
45-
use gio::{resources_register_include, Settings};
37+
use gtk::{CssProvider, StyleContext};
38+
use gio::{resources_register_include};
39+
use gdk::{Display};
4640

4741
// Constants
48-
const APP_ID: &str = "com.gtk_d.NvidiaExtensionRust";
42+
const APP_ID: &str = "com.gtk_d.NvidiaMonitorRust";
4943

5044
// Main Function
5145
fn main() {
5246
// Resources
53-
resources_register_include!("nvidiaextensionrust.gresource")
47+
resources_register_include!("nvidiamonitorrust.gresource")
5448
.expect("Failed to register resources.");
5549

5650
// Intialise GTK
@@ -59,8 +53,9 @@ fn main() {
5953
// Create a new application
6054
let app: Application = Application::builder().application_id(APP_ID).build();
6155

62-
// Connect to "activate" signal of `app`
56+
// Connect to signals of `app`
6357
//app.connect_startup(setup_shortcuts);
58+
app.connect_startup(|_| load_css());
6459
app.connect_activate(build_ui);
6560

6661
// Run the application
@@ -77,6 +72,20 @@ fn setup_shortcuts(app: &Application) {
7772
}
7873
*/
7974

75+
// Load CSS styles
76+
fn load_css() {
77+
// Load the CSS file and add it to the provider
78+
let provider = CssProvider::new();
79+
provider.load_from_path("style.css");
80+
81+
// Add the provider to the default screen
82+
StyleContext::add_provider_for_display(
83+
&Display::default().expect("..Could not connect to a display."),
84+
&provider,
85+
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
86+
);
87+
}
88+
8089
// Build Function
8190
fn build_ui(app: &Application) {
8291
// Create a new custom window and show it

style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* SPDX-FileCopyrightText: 2022 Deren Vural */
2+
/* SPDX-License-Identifier: GPL-3.0-or-later */
3+
4+
listview row box label {
5+
min-width: 195px;
6+
}

0 commit comments

Comments
 (0)