Skip to content

Commit 7330d4a

Browse files
authored
Merge pull request #12 from derenv/docs
Docs
2 parents 8c399ac + cd6e90f commit 7330d4a

File tree

17 files changed

+314
-219
lines changed

17 files changed

+314
-219
lines changed

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
66
* build.rs
77
*
@@ -25,7 +25,7 @@
2525
// Imports
2626
use adwaita::gio::compile_resources;
2727

28-
/*
28+
/**
2929
* Name:
3030
* main
3131
*

src/custom_button/imp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
66
* imp.rs
77
*
@@ -21,11 +21,11 @@
2121
// Imports
2222
use gtk::{glib, subclass::prelude::*};
2323

24-
// Object holding the state
24+
/// Object holding the State and any Template Children
2525
#[derive(Default)]
2626
pub struct CustomButton;
2727

28-
// The central trait for subclassing a GObject
28+
/// The central trait for subclassing a GObject
2929
#[glib::object_subclass]
3030
impl ObjectSubclass for CustomButton {
3131
//Crate+Obj to avoid collisions

src/custom_button/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
66
* mod.rs
77
*

src/formatter/imp.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
66
* imp.rs
77
*
@@ -25,11 +25,11 @@ use gtk::{glib, subclass::prelude::*};
2525
// Modules
2626
//
2727

28-
// Object holding the state
28+
/// Object holding the State and any Template Children
2929
#[derive(Default)]
3030
pub struct Formatter;
3131

32-
// The central trait for subclassing a GObject
32+
/// The central trait for subclassing a GObject
3333
#[glib::object_subclass]
3434
impl ObjectSubclass for Formatter {
3535
//Crate+Obj to avoid collisions
@@ -40,7 +40,7 @@ impl ObjectSubclass for Formatter {
4040
type ParentType = gtk::Widget;
4141
}
4242

43-
/*
43+
/**
4444
* Trait Name:
4545
* ObjectImpl
4646
*
@@ -57,7 +57,7 @@ impl ObjectSubclass for Formatter {
5757
*
5858
*/
5959
impl ObjectImpl for Formatter {
60-
/*
60+
/**
6161
* Name:
6262
* properties
6363
*
@@ -71,7 +71,7 @@ impl ObjectImpl for Formatter {
7171
* Deren Vural
7272
*
7373
* Notes:
74-
* beware that you need to use kebab-case (https://en.wikipedia.org/wiki/Letter_case#Kebab_case)
74+
* beware that you need to use kebab-case (<https://en.wikipedia.org/wiki/Letter_case#Kebab_case>)
7575
*
7676
* ParamSpec Examples:
7777
* glib::ParamSpecString::builder("icon").build(),
@@ -94,7 +94,7 @@ impl ObjectImpl for Formatter {
9494
PROPERTIES.as_ref()
9595
}
9696

97-
/*
97+
/**
9898
* Name:
9999
* set_property
100100
*
@@ -119,7 +119,7 @@ impl ObjectImpl for Formatter {
119119
}
120120
}
121121

122-
/*
122+
/**
123123
* Name:
124124
* property
125125
*
@@ -145,7 +145,7 @@ impl ObjectImpl for Formatter {
145145
}
146146
}
147147

148-
/*
148+
/**
149149
* Trait Name:
150150
* WidgetImpl
151151
*

src/formatter/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
66
* mod.rs
77
*
@@ -35,7 +35,7 @@ glib::wrapper! {
3535
@implements gtk::Accessible, gtk::Actionable, gtk::Buildable, gtk::ConstraintTarget;
3636
}
3737

38-
/*
38+
/**
3939
* Trait Name:
4040
* Formatter
4141
*
@@ -52,7 +52,7 @@ glib::wrapper! {
5252
*
5353
*/
5454
impl Formatter {
55-
/*
55+
/**
5656
* Name:
5757
* new
5858
*
@@ -118,7 +118,7 @@ impl Formatter {
118118
}
119119
}
120120

121-
/*
121+
/**
122122
* Trait Name:
123123
* Default
124124
*

src/main.rs

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// SPDX-FileCopyrightText: 2022 Deren Vural
22
// SPDX-License-Identifier: GPL-3.0-or-later
33

4-
/*
4+
/**
55
* Name:
6-
* main.rs
6+
* gtk4-nvidia-monitor-rust
77
*
88
* Description:
9-
* Rust Implementation of Nvidia Gnome Extension
9+
* GTK-rs app for monitoring Nvidia GPU statistics
1010
*
1111
* Made:
1212
* 12/09/2022
@@ -17,7 +17,6 @@
1717
* Notes:
1818
*
1919
*/
20-
2120
// Modules
2221
mod formatter;
2322
mod mainwindow;
@@ -30,16 +29,30 @@ mod custom_button;
3029
mod settingswindow;
3130

3231
// Imports
33-
use adwaita::prelude::*;
34-
use adwaita::{gio, Application};
32+
use adwaita::{gio, prelude::*, Application};
3533
use gdk::Display;
3634
use gio::resources_register_include;
3735
use gtk::{CssProvider, StyleContext};
3836

3937
// Constants
4038
const APP_ID: &str = "com.gtk_d.NvidiaMonitorRust";
4139

42-
// Main Function
40+
/**
41+
* Name:
42+
* main
43+
*
44+
* Description:
45+
* Load resources, initialise GTK, create application and connect signals
46+
*
47+
* Made:
48+
* 13/09/2022
49+
*
50+
* Made by:
51+
* Deren Vural
52+
*
53+
* Notes:
54+
*
55+
*/
4356
fn main() {
4457
// Resources
4558
resources_register_include!("nvidiamonitorrust.gresource")
@@ -60,17 +73,48 @@ fn main() {
6073
println!("{}", app.run());
6174
}
6275

76+
/**
77+
* Name:
78+
* setup_shortcuts
79+
*
80+
* Description:
81+
* Add keyboard shortcuts to the program
82+
*
83+
* Made:
84+
* 09/10/2022
85+
*
86+
* Made by:
87+
* Deren Vural
88+
*
89+
* Notes:
90+
* <https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/todo/5/main.rs>
91+
* <https://gtk-rs.org/gtk4-rs/stable/latest/book/todo_3.html>
92+
*
93+
*/
6394
/*
64-
//https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/todo/5/main.rs
65-
//https://gtk-rs.org/gtk4-rs/stable/latest/book/todo_3.html
6695
fn setup_shortcuts(app: &Application) {
6796
app.set_accels_for_action("win.filter('All')", &["<Ctrl>a"]);
6897
app.set_accels_for_action("win.filter('Open')", &["<Ctrl>o"]);
6998
app.set_accels_for_action("win.filter('Done')", &["<Ctrl>d"]);
7099
}
71100
*/
72101

73-
// Load CSS styles
102+
/**
103+
* Name:
104+
* load_css
105+
*
106+
* Description:
107+
* Load css from file and add as style provider
108+
*
109+
* Made:
110+
* 23/10/2022
111+
*
112+
* Made by:
113+
* Deren Vural
114+
*
115+
* Notes:
116+
*
117+
*/
74118
fn load_css() {
75119
// Load the CSS file and add it to the provider
76120
let provider = CssProvider::new();
@@ -84,10 +128,27 @@ fn load_css() {
84128
);
85129
}
86130

87-
// Build Function
131+
/**
132+
* Name:
133+
* build_ui
134+
*
135+
* Description:
136+
* Build the main window (given the application object) and run
137+
*
138+
* Made:
139+
* 13/09/2022
140+
*
141+
* Made by:
142+
* Deren Vural
143+
*
144+
* Notes:
145+
*
146+
*/
88147
fn build_ui(app: &Application) {
89148
// Create a new custom window and show it
90149
let window: MainWindow = MainWindow::new(app);
150+
151+
// Present window
91152
window.show();
92153

93154
/*

0 commit comments

Comments
 (0)