diff --git a/.gitignore b/.gitignore index 196e176..c4e63fc 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Cargo.lock # Added by cargo /target +.idea/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index e53c452..0ad538e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,8 @@ description = "A wip universal Linux settings application." [dependencies] ReSet-Lib = "0.1.0" +adw = { version = "0.5.3", package = "libadwaita" } +gtk = { version = "0.7.3", package = "gtk4" } + +[build-dependencies] +glib-build-tools = "0.18.0" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..0bb8c79 --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +fn main() { + glib_build_tools::compile_resources( + &["src/resources"], + "src/resources/resources.gresource.xml", + "src.templates.gresource", + ); +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 4e53285..5968362 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,29 @@ +mod window; + +use gtk::prelude::*; +use gtk::{Application, gio}; +use window::Window; + +const APP_ID: &str = "org.Xetibo.ReSet"; + fn main() { - println!("Hello, world!"); + gio::resources_register_include!("src.templates.gresource") + .expect("Failed to register resources."); + + // Create a new application + let app = Application::builder() + .application_id(APP_ID) + .build(); + + // Connect to "activate" signal of `app` + app.connect_activate(build_ui); + + // Run the application + app.run(); } -#[test] -fn name() { - assert_eq!(1, 1); -} +fn build_ui(app: &Application) { + // Create new window and present it + let window = Window::new(app); + window.present(); +} \ No newline at end of file diff --git a/src/resources/resetMainWindow.ui b/src/resources/resetMainWindow.ui new file mode 100644 index 0000000..3eb7445 --- /dev/null +++ b/src/resources/resetMainWindow.ui @@ -0,0 +1,401 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Created with Cambalache 0.17.0 --> +<interface> + <requires lib="gtk" version="4.12"/> + <requires lib="libadwaita" version="1.4"/> + <template class="resetUI" parent="AdwApplicationWindow"> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="AdwHeaderBar"> + <property name="centering-policy">strict</property> + <property name="title-widget"> + <object class="AdwWindowTitle"> + <property name="title">ReSet</property> + </object> + </property> + </object> + </child> + <child> + <object class="AdwNavigationSplitView"> + <property name="content"> + <object class="AdwNavigationPage"> + <property name="child"> + <object class="GtkFlowBox" id="resetMainWindow"> + <child> + <object class="GtkBox" id="resetWifi_2"> + <property name="orientation">vertical</property> + <child> + <object class="AdwClampScrollable"> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="GtkLabel"> + <property name="halign">start</property> + <property name="justify">right</property> + <property name="label">Available networks</property> + </object> + </child> + <child> + <object class="GtkListBox" id="resetWifiList"> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength_2"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel_2"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton_2"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength_3"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel_3"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton_3"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength_4"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel_4"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton_4"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength_5"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel_5"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton_5"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength_6"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel_6"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton_6"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkButton"> + <property name="halign">start</property> + <property name="label">Advanced</property> + <property name="valign">start</property> + </object> + </child> + </object> + </child> + </object> + </property> + <property name="margin-bottom">20</property> + <property name="margin-end">20</property> + <property name="margin-start">20</property> + <property name="margin-top">20</property> + </object> + </property> + <property name="sidebar"> + <object class="AdwNavigationPage"> + <property name="child"> + <object class="GtkViewport"> + <property name="vscroll-policy">natural</property> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <property name="width-request">150</property> + <child> + <object class="GtkSearchEntry"> + <property name="margin-end">5</property> + <property name="margin-start">5</property> + <property name="placeholder-text">Search</property> + </object> + </child> + <child> + <object class="GtkListBox"> + <property name="css-name">resetList</property> + <property name="width-request">150</property> + <child> + <object class="GtkListBoxRow" id="resetConnectivity"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">10</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">network-wired-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">Connectivity</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetWifi"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">30</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">WiFi</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetBluetooth"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">30</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">bluetooth-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">Bluetooth</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetVPN"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">30</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">network-vpn-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">VPN</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetAudio"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">10</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">audio-headset-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">Audio</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetVolume"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">35</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">audio-volume-high-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">Volume</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkListBoxRow" id="resetMicrophone"> + <child> + <object class="GtkBox"> + <property name="margin-bottom">10</property> + <property name="margin-start">30</property> + <property name="margin-top">10</property> + <child> + <object class="GtkImage"> + <property name="icon-name">audio-input-microphone-symbolic</property> + <property name="margin-end">10</property> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label">Microphone</property> + </object> + </child> + </object> + </child> + </object> + </child> + <style> + <class name="b"/> + </style> + </object> + </child> + </object> + </child> + </object> + </property> + </object> + </property> + </object> + </child> + </object> + </child> + </template> +</interface> diff --git a/src/resources/resetUI.cmb b/src/resources/resetUI.cmb new file mode 100644 index 0000000..073cbce --- /dev/null +++ b/src/resources/resetUI.cmb @@ -0,0 +1,150 @@ +<?xml version='1.0' encoding='UTF-8' standalone='no'?> +<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd"> +<cambalache-project version="0.13.1" target_tk="gtk-4.0"> + <ui> + (3,None,None,"resetMainWindow",None,None,None,None,None,None,None), + (4,None,None,"resetWiFi",None,None,None,None,None,None,None) + </ui> + <object> + (3,1,"AdwApplicationWindow",None,None,None,None,None,-1,None), + (3,2,"GtkBox",None,1,None,None,None,-1,None), + (3,3,"AdwHeaderBar",None,2,None,None,None,None,None), + (3,5,"AdwWindowTitle",None,3,None,None,None,-1,None), + (3,6,"AdwNavigationSplitView",None,2,None,None,None,1,None), + (3,7,"AdwNavigationPage",None,6,None,None,None,-1,None), + (3,8,"AdwNavigationPage",None,6,None,None,None,-1,None), + (3,73,"GtkViewport",None,7,None,None,None,-1,None), + (3,74,"GtkBox",None,73,None,None,None,None,None), + (3,75,"GtkSearchEntry",None,74,None,None,None,None,None), + (3,76,"GtkListBox",None,74,None,None,None,1,None), + (3,79,"GtkListBoxRow","resetWifi",76,None,None,None,1,None), + (3,81,"GtkListBoxRow","resetBluetooth",76,None,None,None,2,None), + (3,83,"GtkListBoxRow","resetVPN",76,None,None,None,3,None), + (3,85,"GtkListBoxRow","resetAudio",76,None,None,None,4,None), + (3,87,"GtkListBoxRow","resetVolume",76,None,None,None,5,None), + (3,89,"GtkListBoxRow","resetMicrophone",76,None,None,None,6,None), + (3,91,"GtkListBoxRow","resetConnectivity",76,None,None,None,None,None), + (3,93,"GtkBox",None,91,None,None,None,None,None), + (3,94,"GtkImage",None,93,None,None,None,None,None), + (3,95,"GtkLabel",None,93,None,None,None,1,None), + (3,96,"GtkBox",None,79,None,None,None,None,None), + (3,97,"GtkImage",None,96,None,None,None,None,None), + (3,98,"GtkLabel",None,96,None,None,None,1,None), + (3,99,"GtkBox",None,89,None,None,None,None,None), + (3,100,"GtkImage",None,99,None,None,None,None,None), + (3,101,"GtkLabel",None,99,None,None,None,1,None), + (3,102,"GtkBox",None,83,None,None,None,None,None), + (3,103,"GtkImage",None,102,None,None,None,None,None), + (3,104,"GtkLabel",None,102,None,None,None,1,None), + (3,105,"GtkBox",None,87,None,None,None,None,None), + (3,106,"GtkImage",None,105,None,None,None,None,None), + (3,107,"GtkLabel",None,105,None,None,None,1,None), + (3,108,"GtkBox",None,81,None,None,None,None,None), + (3,109,"GtkImage",None,108,None,None,None,None,None), + (3,110,"GtkLabel",None,108,None,None,None,1,None), + (3,111,"GtkBox",None,85,None,None,None,None,None), + (3,112,"GtkImage",None,111,None,None,None,None,None), + (3,113,"GtkLabel",None,111,None,None,None,1,None), + (3,114,"GtkFlowBox","resetMainWindow",8,None,None,None,-1,None), + (4,1,"GtkListBoxRow","resetWifiEntry",None,None,None,None,None,None), + (4,2,"GtkBox",None,1,None,None,None,None,None), + (4,3,"GtkImage","resetWifiStrength",2,None,None,None,None,None), + (4,4,"GtkLabel","resetWifiLabel",2,None,None,None,1,None), + (4,5,"GtkButton","resetWifiButton",2,None,None,None,2,None), + (4,7,"GtkBox","resetWifi",None,None,None,None,None,None), + (4,8,"AdwClampScrollable",None,7,None,None,None,None,None), + (4,9,"GtkBox",None,8,None,None,None,None,None), + (4,10,"GtkLabel",None,9,None,None,None,None,None), + (4,11,"GtkListBox","resetWifiList",9,None,None,None,1,None), + (4,42,"GtkButton",None,7,None,None,None,1,None), + (4,43,"AdwToast",None,None,None,None,None,-1,None) + </object> + <object_property> + (3,2,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None), + (3,3,"AdwHeaderBar","centering-policy","strict",None,None,None,None,None,None,None,None,None), + (3,3,"AdwHeaderBar","title-widget",None,None,None,None,None,5,None,None,None,None), + (3,5,"AdwWindowTitle","title","ReSet",None,None,None,None,None,None,None,None,None), + (3,6,"AdwNavigationSplitView","content",None,None,None,None,None,8,None,None,None,None), + (3,6,"AdwNavigationSplitView","sidebar",None,None,None,None,None,7,None,None,None,None), + (3,7,"AdwNavigationPage","child",None,None,None,None,None,73,None,None,None,None), + (3,8,"AdwNavigationPage","child",None,None,None,None,None,114,None,None,None,None), + (3,8,"GtkWidget","margin-bottom","20",None,None,None,None,None,None,None,None,None), + (3,8,"GtkWidget","margin-end","20",None,None,None,None,None,None,None,None,None), + (3,8,"GtkWidget","margin-start","20",None,None,None,None,None,None,None,None,None), + (3,8,"GtkWidget","margin-top","20",None,None,None,None,None,None,None,None,None), + (3,73,"GtkScrollable","vscroll-policy","natural",None,None,None,None,None,None,None,None,None), + (3,74,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None), + (3,74,"GtkWidget","width-request","150",None,None,None,None,None,None,None,None,None), + (3,75,"GtkSearchEntry","placeholder-text","Search",None,None,None,None,None,None,None,None,None), + (3,75,"GtkWidget","margin-end","5",None,None,None,None,None,None,None,None,None), + (3,75,"GtkWidget","margin-start","5",None,None,None,None,None,None,None,None,None), + (3,76,"GtkWidget","css-name","resetList",None,None,None,None,None,None,None,None,None), + (3,76,"GtkWidget","width-request","150",None,None,None,None,None,None,None,None,None), + (3,93,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,93,"GtkWidget","margin-start","10",None,None,None,None,None,None,None,None,None), + (3,93,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,94,"GtkImage","icon-name","network-wired-symbolic",None,None,None,None,None,None,None,None,None), + (3,94,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,95,"GtkLabel","label","Connectivity",None,None,None,None,None,None,None,None,None), + (3,96,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,96,"GtkWidget","margin-start","30",None,None,None,None,None,None,None,None,None), + (3,96,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,97,"GtkImage","icon-name","network-wireless-symbolic",None,None,None,None,None,None,None,None,None), + (3,97,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,98,"GtkLabel","label","WiFi",None,None,None,None,None,None,None,None,None), + (3,99,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,99,"GtkWidget","margin-start","30",None,None,None,None,None,None,None,None,None), + (3,99,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,100,"GtkImage","icon-name","audio-input-microphone-symbolic",None,None,None,None,None,None,None,None,None), + (3,100,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,101,"GtkLabel","label","Microphone",None,None,None,None,None,None,None,None,None), + (3,102,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,102,"GtkWidget","margin-start","30",None,None,None,None,None,None,None,None,None), + (3,102,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,103,"GtkImage","icon-name","network-vpn-symbolic",None,None,None,None,None,None,None,None,None), + (3,103,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,104,"GtkLabel","label","VPN",None,None,None,None,None,None,None,None,None), + (3,105,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,105,"GtkWidget","margin-start","35",None,None,None,None,None,None,None,None,None), + (3,105,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,106,"GtkImage","icon-name","audio-volume-high-symbolic",None,None,None,None,None,None,None,None,None), + (3,106,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,107,"GtkLabel","label","Volume",None,None,None,None,None,None,None,None,None), + (3,108,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,108,"GtkWidget","margin-start","30",None,None,None,None,None,None,None,None,None), + (3,108,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,109,"GtkImage","icon-name","bluetooth-symbolic",None,None,None,None,None,None,None,None,None), + (3,109,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,110,"GtkLabel","label","Bluetooth",None,None,None,None,None,None,None,None,None), + (3,111,"GtkWidget","margin-bottom","10",None,None,None,None,None,None,None,None,None), + (3,111,"GtkWidget","margin-start","10",None,None,None,None,None,None,None,None,None), + (3,111,"GtkWidget","margin-top","10",None,None,None,None,None,None,None,None,None), + (3,112,"GtkImage","icon-name","audio-headset-symbolic",None,None,None,None,None,None,None,None,None), + (3,112,"GtkWidget","margin-end","10",None,None,None,None,None,None,None,None,None), + (3,113,"GtkLabel","label","Audio",None,None,None,None,None,None,None,None,None), + (4,3,"GtkImage","icon-name","network-wireless-symbolic",None,None,None,None,None,None,None,None,None), + (4,3,"GtkWidget","margin-end","15",None,None,None,None,None,None,None,None,None), + (4,4,"GtkLabel","label","LoremIpsumInternet",None,None,None,None,None,None,None,None,None), + (4,4,"GtkLabel","xalign","0.0",None,None,None,None,None,None,None,None,None), + (4,4,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None), + (4,5,"GtkButton","icon-name","emblem-system-symbolic",None,None,None,None,None,None,None,None,None), + (4,5,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None), + (4,5,"GtkWidget","valign","center",None,None,None,None,None,None,None,None,None), + (4,7,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None), + (4,8,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None), + (4,9,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None), + (4,10,"GtkLabel","justify","right",None,None,None,None,None,None,None,None,None), + (4,10,"GtkLabel","label","Available networks",None,None,None,None,None,None,None,None,None), + (4,10,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None), + (4,42,"GtkButton","label","Advanced",None,None,None,None,None,None,None,None,None), + (4,42,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None), + (4,42,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None) + </object_property> + <object_data> + (3,76,"GtkWidget",2,2,None,1,None,None,None,None), + (3,76,"GtkWidget",1,1,None,None,None,None,None,None) + </object_data> + <object_data_arg> + (3,76,"GtkWidget",2,2,"name","b") + </object_data_arg> +</cambalache-project> diff --git a/src/resources/resetWiFi.ui b/src/resources/resetWiFi.ui new file mode 100644 index 0000000..3112867 --- /dev/null +++ b/src/resources/resetWiFi.ui @@ -0,0 +1,61 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Created with Cambalache 0.17.0 --> +<interface> + <object class="GtkListBoxRow" id="resetWifiEntry"> + <child> + <object class="GtkBox"> + <child> + <object class="GtkImage" id="resetWifiStrength"> + <property name="icon-name">network-wireless-symbolic</property> + <property name="margin-end">15</property> + </object> + </child> + <child> + <object class="GtkLabel" id="resetWifiLabel"> + <property name="hexpand">True</property> + <property name="label">LoremIpsumInternet</property> + <property name="xalign">0.0</property> + </object> + </child> + <child> + <object class="GtkButton" id="resetWifiButton"> + <property name="halign">start</property> + <property name="icon-name">emblem-system-symbolic</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> + </object> + <object class="GtkBox" id="resetWifi"> + <property name="orientation">vertical</property> + <child> + <object class="AdwClampScrollable"> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="GtkLabel"> + <property name="halign">start</property> + <property name="justify">right</property> + <property name="label">Available networks</property> + </object> + </child> + <child> + <object class="GtkListBox" id="resetWifiList"/> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkButton"> + <property name="halign">start</property> + <property name="label">Advanced</property> + <property name="valign">start</property> + </object> + </child> + </object> + <object class="AdwToast"/> +</interface> diff --git a/src/resources/resources.gresource.xml b/src/resources/resources.gresource.xml new file mode 100644 index 0000000..26a1a8f --- /dev/null +++ b/src/resources/resources.gresource.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/xetibo/reset/"> + <file compressed="true" preprocess="xml-stripblanks">resetMainWindow.ui</file> +<!-- <file compressed="true" preprocess="xml-stripblanks">resetWiFi.ui</file>--> + </gresource> +</gresources> diff --git a/src/window/imp.rs b/src/window/imp.rs new file mode 100644 index 0000000..b0168bd --- /dev/null +++ b/src/window/imp.rs @@ -0,0 +1,37 @@ +use adw::subclass::prelude::AdwApplicationWindowImpl; +use glib::subclass::InitializingObject; +use gtk::subclass::prelude::*; +use gtk::{glib, CompositeTemplate}; + +#[derive(CompositeTemplate, Default)] +#[template(resource = "/org/xetibo/reset/resetMainWindow.ui")] +pub struct Window { + // todo i guess +} + +#[glib::object_subclass] +impl ObjectSubclass for Window { + const NAME: &'static str = "resetUI"; + type Type = super::Window; + type ParentType = adw::ApplicationWindow; + + fn class_init(klass: &mut Self::Class) { + klass.bind_template(); + } + + fn instance_init(obj: &InitializingObject<Self>) { + obj.init_template(); + } +} + +impl ObjectImpl for Window {} + +impl WidgetImpl for Window {} + +impl WindowImpl for Window {} + +impl ApplicationWindowImpl for Window {} + +impl AdwApplicationWindowImpl for Window {} + + diff --git a/src/window/mod.rs b/src/window/mod.rs new file mode 100644 index 0000000..5809612 --- /dev/null +++ b/src/window/mod.rs @@ -0,0 +1,20 @@ +mod imp; + +use glib::Object; +use gtk::{gio, glib, Application}; + +glib::wrapper! { + pub struct Window(ObjectSubclass<imp::Window>) + @extends gtk::ApplicationWindow, gtk::Window, gtk::Widget, + @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, + gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; +} + +impl Window { + pub fn new(app: &Application) -> Self { + // Create new window + Object::builder() + .property("application", app) + .build() + } +} \ No newline at end of file