mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-16 01:01:28 +03:00
gtk: use predifined css classes instead of custom ones
This commit is contained in:
@@ -66,6 +66,7 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="name">delete-button</property>
|
<property name="name">delete-button</property>
|
||||||
|
<style><class name="error"/></style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
<gresource prefix="/de/feschber/LanMouse">
|
<gresource prefix="/de/feschber/LanMouse">
|
||||||
<file compressed="true" preprocess="xml-stripblanks">window.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">window.ui</file>
|
||||||
<file compressed="true" preprocess="xml-stripblanks">client_row.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">client_row.ui</file>
|
||||||
<file compressed="true">style.css</file>
|
|
||||||
<file compressed="true">style-dark.css</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/de/feschber/LanMouse/icons">
|
<gresource prefix="/de/feschber/LanMouse/icons">
|
||||||
<file compressed="true" preprocess="xml-stripblanks">de.feschber.LanMouse.svg</file>
|
<file compressed="true" preprocess="xml-stripblanks">de.feschber.LanMouse.svg</file>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#delete-button {
|
|
||||||
color: @red_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#port-edit-cancel {
|
|
||||||
color: @red_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#port-edit-apply {
|
|
||||||
color: @green_1;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#delete-button {
|
|
||||||
color: @red_3;
|
|
||||||
}
|
|
||||||
|
|
||||||
#port-edit-cancel {
|
|
||||||
color: @red_3;
|
|
||||||
}
|
|
||||||
|
|
||||||
#port-edit-apply {
|
|
||||||
color: @green_3;
|
|
||||||
}
|
|
||||||
@@ -84,6 +84,7 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="visible">false</property>
|
<property name="visible">false</property>
|
||||||
<property name="name">port-edit-apply</property>
|
<property name="name">port-edit-apply</property>
|
||||||
|
<style><class name="success"/></style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -93,6 +94,7 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="visible">false</property>
|
<property name="visible">false</property>
|
||||||
<property name="name">port-edit-cancel</property>
|
<property name="name">port-edit-cancel</property>
|
||||||
|
<style><class name="error"/></style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::frontend::gtk::window::Window;
|
|||||||
|
|
||||||
use adw::Application;
|
use adw::Application;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gdk::Display, glib::clone, prelude::*, subclass::prelude::ObjectSubclassIsExt, CssProvider,
|
gdk::Display, glib::clone, prelude::*, subclass::prelude::ObjectSubclassIsExt,
|
||||||
IconTheme,
|
IconTheme,
|
||||||
};
|
};
|
||||||
use gtk::{gio, glib, prelude::ApplicationExt};
|
use gtk::{gio, glib, prelude::ApplicationExt};
|
||||||
@@ -51,23 +51,12 @@ fn gtk_main() -> glib::ExitCode {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
app.connect_startup(|_| load_icons());
|
app.connect_startup(|_| load_icons());
|
||||||
app.connect_startup(|_| load_css());
|
|
||||||
app.connect_activate(build_ui);
|
app.connect_activate(build_ui);
|
||||||
|
|
||||||
let args: Vec<&'static str> = vec![];
|
let args: Vec<&'static str> = vec![];
|
||||||
app.run_with_args(&args)
|
app.run_with_args(&args)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_css() {
|
|
||||||
let provider = CssProvider::new();
|
|
||||||
provider.load_from_resource("de/feschber/LanMouse/style.css");
|
|
||||||
gtk::style_context_add_provider_for_display(
|
|
||||||
&Display::default().expect("Could not connect to a display."),
|
|
||||||
&provider,
|
|
||||||
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_icons() {
|
fn load_icons() {
|
||||||
let display = &Display::default().expect("Could not connect to a display.");
|
let display = &Display::default().expect("Could not connect to a display.");
|
||||||
let icon_theme = IconTheme::for_display(display);
|
let icon_theme = IconTheme::for_display(display);
|
||||||
|
|||||||
Reference in New Issue
Block a user