Skip to content

Commit 3fbe187

Browse files
authored
Update main.rs
1 parent 7c13d21 commit 3fbe187

File tree

1 file changed

+68
-76
lines changed

1 file changed

+68
-76
lines changed

source-code/src/main.rs

Lines changed: 68 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
// src/main.rs
21
use adw::prelude::*;
3-
use adw::{Application, ApplicationWindow, HeaderBar, StyleManager};
4-
use gio::prelude::*;
5-
use glib::clone;
6-
use gtk::prelude::*;
7-
use gtk::{Box as GtkBox, Button, CssProvider, FlowBox, Image, Label, Orientation, PolicyType, ScrolledWindow, Separator, StyleContext};
2+
use adw::{Application, ApplicationWindow, StyleManager};
3+
use gtk::{CssProvider, gdk::Display};
84
use std::cell::RefCell;
95
use std::env;
10-
use std::path::Path;
116
use std::rc::Rc;
12-
use gdk_pixbuf::Pixbuf;
137

148
mod actions;
159
mod ui;
@@ -19,90 +13,88 @@ use ui::build_ui;
1913

2014
fn main() {
2115
let application = Application::builder()
22-
.application_id("org.hackeros.welcome")
23-
.build();
16+
.application_id("org.hackeros.welcome")
17+
.build();
2418

2519
application.connect_startup(|_| {
2620
StyleManager::default().set_color_scheme(adw::ColorScheme::ForceDark);
2721
});
2822

2923
application.connect_activate(|app| {
3024
let window = ApplicationWindow::builder()
31-
.application(app)
32-
.title("HackerOS Welcome")
33-
.default_width(1000)
34-
.default_height(750)
35-
.build();
25+
.application(app)
26+
.title("HackerOS Welcome")
27+
.default_width(1000)
28+
.default_height(750)
29+
.build();
3630

3731
// Load CSS
3832
let provider = CssProvider::new();
3933
provider.load_from_data("
40-
window {
41-
background-color: #121212;
42-
color: white;
43-
border-radius: 12px;
44-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
45-
}
46-
label {
47-
color: white;
48-
text-shadow: 1px 1px 2px black;
49-
}
50-
button {
51-
background-color: #1E1E1E;
52-
color: white;
53-
border: 2px solid #555;
54-
border-radius: 8px;
55-
padding: 12px 20px;
56-
font-size: 16px;
57-
font-weight: bold;
58-
transition: all 0.3s ease;
59-
}
60-
button:hover {
61-
background-color: #333;
62-
border-color: #777;
63-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
64-
}
65-
button:active {
66-
background-color: #444;
67-
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
68-
}
69-
.title {
70-
font-size: 32px;
71-
font-weight: bold;
72-
color: #FFFFFF;
73-
}
74-
.subtitle {
75-
font-size: 20px;
76-
color: #CCCCCC;
77-
}
78-
separator {
79-
background-color: #555;
80-
margin: 10px 0;
81-
}
82-
scrolledwindow {
83-
background-color: #181818;
84-
border-radius: 8px;
85-
padding: 10px;
86-
}
87-
.footer {
88-
font-size: 14px;
89-
color: #888888;
90-
padding: 10px;
91-
background-color: #0A0A0A;
92-
border-top: 1px solid #333;
93-
}
94-
");
34+
window {
35+
background-color: #121212;
36+
color: white;
37+
border-radius: 12px;
38+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
39+
}
40+
label {
41+
color: white;
42+
text-shadow: 1px 1px 2px black;
43+
}
44+
button {
45+
background-color: #1E1E1E;
46+
color: white;
47+
border: 2px solid #555;
48+
border-radius: 8px;
49+
padding: 12px 20px;
50+
font-size: 16px;
51+
font-weight: bold;
52+
transition: all 0.3s ease;
53+
}
54+
button:hover {
55+
background-color: #333;
56+
border-color: #777;
57+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
58+
}
59+
button:active {
60+
background-color: #444;
61+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
62+
}
63+
.title {
64+
font-size: 32px;
65+
font-weight: bold;
66+
color: #FFFFFF;
67+
}
68+
.subtitle {
69+
font-size: 20px;
70+
color: #CCCCCC;
71+
}
72+
separator {
73+
background-color: #555;
74+
margin: 10px 0;
75+
}
76+
scrolledwindow {
77+
background-color: #181818;
78+
border-radius: 8px;
79+
padding: 10px;
80+
}
81+
.footer {
82+
font-size: 14px;
83+
color: #888888;
84+
padding: 10px;
85+
background-color: #0A0A0A;
86+
border-top: 1px solid #333;
87+
}
88+
");
9589

96-
StyleContext::add_provider_for_display(
97-
&gtk::gdk::Display::default().expect("Error initializing GTK CSS provider."),
98-
&provider,
99-
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
90+
gtk::style_context_add_provider_for_display(
91+
&Display::default().expect("Error initializing GTK CSS provider."),
92+
&provider,
93+
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
10094
);
10195

10296
let actions = Rc::new(RefCell::new(Actions::new()));
103-
10497
build_ui(&window, actions.clone());
105-
10698
window.present();
10799
});
108100

0 commit comments

Comments
 (0)