Skip to content

Commit aa9b737

Browse files
author
Deren Vural
committed
trunk formatting
Signed-off-by: Deren Vural <[email protected]>
1 parent f4d127d commit aa9b737

File tree

2 files changed

+44
-30
lines changed

2 files changed

+44
-30
lines changed

src/gpu_page/imp.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ impl GpuPage {
105105
* Notes:
106106
*
107107
*/
108-
pub fn add_stack_item<T: IsA<gtk::Widget>>(&self, item: &T, name: Option<&str>, title: &str, icon: &str) {
108+
pub fn add_stack_item<T: IsA<gtk::Widget>>(
109+
&self,
110+
item: &T,
111+
name: Option<&str>,
112+
title: &str,
113+
icon: &str,
114+
) {
109115
// Add the passed item to the stack
110116
self.view_stack.add_titled(item, name, title);
111117

src/gpu_page/mod.rs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod imp;
2323
// Imports
2424
use adwaita::{gio, glib};
2525
use gio::Settings;
26-
use glib::{Object, SourceId, translate::FromGlib, clone};
26+
use glib::{clone, translate::FromGlib, Object, SourceId};
2727
use gtk::{prelude::*, subclass::prelude::*, Align, Button, Grid, Label, LayoutChild, Orientation};
2828
use std::{sync::Arc, sync::Mutex, sync::MutexGuard};
2929

@@ -154,7 +154,7 @@ impl GpuPage {
154154

155155
// Load list of Views
156156
let loaded_views_data: Vec<String> = settings_obj.get::<Vec<String>>("viewconfigs");
157-
println!("views saved:`{}`", loaded_views_data.len());//TEST
157+
println!("views saved:`{}`", loaded_views_data.len()); //TEST
158158

159159
// Create Views
160160
// If present in saved settings, use! otherwise follow below defaults
@@ -181,7 +181,8 @@ impl GpuPage {
181181
//child_manager.set_property("column-span", 1);
182182

183183
// Build title label & add to grid
184-
let label_value: String = String::from("Please edit the list of Views using 'Edit Views' button");
184+
let label_value: String =
185+
String::from("Please edit the list of Views using 'Edit Views' button");
185186
let new_title_label: Label = Label::builder()
186187
.label(&label_value)
187188
.name("default")
@@ -200,15 +201,15 @@ impl GpuPage {
200201
&new_grid,
201202
Some("default"),
202203
"Default",
203-
"package-x-generic-symbolic"
204+
"package-x-generic-symbolic",
204205
);
205-
}else{
206+
} else {
206207
// Create temporary structure for sorting loaded data
207208
let mut loaded_views: Vec<String> = vec![String::from(""); loaded_views_data.len()];
208209

209210
// For each loaded view
210211
for index in 0..loaded_views_data.len() {
211-
println!("item: `{}`", loaded_views_data[index]);//TEST
212+
println!("item: `{}`", loaded_views_data[index]); //TEST
212213

213214
// Split current item into the 4 parts
214215
let parts: Vec<&str> = loaded_views_data[index].split(':').collect::<Vec<&str>>();
@@ -220,16 +221,18 @@ impl GpuPage {
220221

221222
// If from valid page
222223
if parts[0] == self.property::<String>("uuid") {
223-
println!("VALID UUID");//TEST
224+
println!("VALID UUID"); //TEST
224225

225226
// If a valid position
226227
match parts[1].parse::<usize>() {
227-
Ok(position) => if position <= loaded_views_data.len() {
228-
println!("VALID POSITION INDEX: `{}`", position);//TEST
228+
Ok(position) => {
229+
if position <= loaded_views_data.len() {
230+
println!("VALID POSITION INDEX: `{}`", position); //TEST
229231

230-
// Add to final list
231-
loaded_views[position] = parts[2].to_owned();
232-
},
232+
// Add to final list
233+
loaded_views[position] = parts[2].to_owned();
234+
}
235+
}
233236
Err(_) => panic!("Invalid Property position in gschema data.."),
234237
}
235238
}
@@ -269,7 +272,7 @@ impl GpuPage {
269272
&new_view_grid,
270273
Some(&new_stack_item_name),
271274
&loaded_views[index],
272-
"package-x-generic-symbolic"
275+
"package-x-generic-symbolic",
273276
);
274277
}
275278
}
@@ -297,7 +300,7 @@ impl GpuPage {
297300

298301
// Load list of Properties for current Page
299302
let loaded_properties_data: Vec<String> = settings_obj.get::<Vec<String>>("pageconfigs");
300-
println!("items saved:`{}`", loaded_properties_data.len());//TEST
303+
println!("items saved:`{}`", loaded_properties_data.len()); //TEST
301304

302305
// If present in saved settings, use! otherwise follow below defaults
303306
if let 0 = loaded_properties_data.len() {
@@ -310,13 +313,16 @@ impl GpuPage {
310313
}
311314
} else {
312315
// Create temporary structure for sorting loaded data
313-
let mut loaded_properties: Vec<String> = vec![String::from(""); loaded_properties_data.len()];
316+
let mut loaded_properties: Vec<String> =
317+
vec![String::from(""); loaded_properties_data.len()];
314318

315319
for index in 0..loaded_properties_data.len() {
316-
println!("item: `{}`", loaded_properties_data[index]);//TEST
320+
println!("item: `{}`", loaded_properties_data[index]); //TEST
317321

318322
// Split current item into the 4 parts
319-
let parts: Vec<&str> = loaded_properties_data[index].split(':').collect::<Vec<&str>>();
323+
let parts: Vec<&str> = loaded_properties_data[index]
324+
.split(':')
325+
.collect::<Vec<&str>>();
320326

321327
// Catch any malformed items
322328
if parts.len() != 4 {
@@ -325,22 +331,24 @@ impl GpuPage {
325331

326332
// If from valid page
327333
if parts[0] == self.property::<String>("uuid") {
328-
println!("VALID UUID");//TEST
334+
println!("VALID UUID"); //TEST
329335

330336
// If from valid view
331337
if parts[1] == view_name {
332-
println!("VALID VIEW #");//TEST
338+
println!("VALID VIEW #"); //TEST
333339

334340
// If a valid position
335341
match parts[2].parse::<usize>() {
336-
Ok(position) => if position <= loaded_properties_data.len() {
337-
println!("VALID POSITION INDEX: `{}`", position);//TEST
342+
Ok(position) => {
343+
if position <= loaded_properties_data.len() {
344+
println!("VALID POSITION INDEX: `{}`", position); //TEST
338345

339-
println!("VALID PROPERTY: `{}`", parts[3]);//TEST
346+
println!("VALID PROPERTY: `{}`", parts[3]); //TEST
340347

341-
// Add to final list
342-
loaded_properties[position] = parts[3].to_owned();
343-
},
348+
// Add to final list
349+
loaded_properties[position] = parts[3].to_owned();
350+
}
351+
}
344352
Err(_) => panic!("Invalid Property position in gschema data.."),
345353
}
346354
}
@@ -391,9 +399,9 @@ impl GpuPage {
391399
// Remove recurring closure
392400
id.remove();
393401

394-
println!("REMOVED RECURRING CLOSURE..");//TEST
402+
println!("REMOVED RECURRING CLOSURE.."); //TEST
395403
} else {
396-
println!("NO PRE-EXISTING RECURRING CLOSURE..");//TEST
404+
println!("NO PRE-EXISTING RECURRING CLOSURE.."); //TEST
397405
}
398406
}
399407

@@ -414,7 +422,7 @@ impl GpuPage {
414422
// For each Property
415423
let mut labels: Vec<Label> = Vec::new();
416424
for property in Arc::clone(&properties_store).lock().unwrap().iter() {
417-
println!("BUILDING PROPERTY LABEL: `{}`", property);//TEST
425+
println!("BUILDING PROPERTY LABEL: `{}`", property); //TEST
418426

419427
//==BUILD==
420428
// Build grid for 2 labels and attach to this page
@@ -536,7 +544,7 @@ impl GpuPage {
536544

537545
// Add to list of content labels, for updating in closure (see below)
538546
labels.push(new_content_label);
539-
},
547+
}
540548
None => panic!("Cannot find layout manager.."),
541549
}
542550
}

0 commit comments

Comments
 (0)