21
21
// Modules
22
22
mod custom_button;
23
23
//use custom_button::CustomButton;
24
- mod subprocess;
25
24
mod processor;
25
+ mod subprocess;
26
26
27
27
// Imports
28
- use std:: ffi:: OsStr ;
29
28
use gtk:: prelude:: * ;
30
29
use gtk:: {
31
- /* Libraries */ gio,
32
- /* Application */ Application , ApplicationWindow ,
30
+ /* Libraries */ gio, /* Application */ Application , ApplicationWindow ,
33
31
/* Widgets */ Button ,
34
32
} ;
35
33
use processor:: Processor ;
34
+ use std:: ffi:: OsStr ;
36
35
//use std::env;
37
36
//use std::path::Path;
38
37
//use libappindicator::{
@@ -70,7 +69,10 @@ fn build_ui(app: &Application) {
70
69
button1. connect_clicked ( move |_| {
71
70
match subprocess:: exec_check ( & [ OsStr :: new ( "nvidia-settings" ) ] , None :: < & gio:: Cancellable > ) {
72
71
Ok ( _x) => println ! ( "Opening the Nvidia Settings app.." ) ,
73
- Err ( y) => println ! ( "An error occured while opening the Nvidia Settings app: {}" , y. message( ) ) ,
72
+ Err ( y) => println ! (
73
+ "An error occured while opening the Nvidia Settings app: {}" ,
74
+ y. message( )
75
+ ) ,
74
76
} ;
75
77
} ) ;
76
78
// Button Child 2
@@ -95,21 +97,30 @@ fn build_ui(app: &Application) {
95
97
Ok ( return_val) => match return_val {
96
98
( None , None ) => println ! ( "no stdout or stderr, something went really wrong..." ) ,
97
99
( None , Some ( stderr_buffer) ) => match std:: str:: from_utf8 ( & stderr_buffer) {
98
- Ok ( stderr_buffer_contents) => println ! ( "Process failed with error: {}" , stderr_buffer_contents) ,
100
+ Ok ( stderr_buffer_contents) => {
101
+ println ! ( "Process failed with error: {}" , stderr_buffer_contents)
102
+ }
99
103
Err ( err) => panic ! ( "{}" , err) ,
100
104
} ,
101
105
( Some ( stdout_buffer) , None ) => match std:: str:: from_utf8 ( & stdout_buffer) {
102
- Ok ( stdout_buffer_contents) => println ! ( "Process suceeded, returning: {}" , stdout_buffer_contents) ,
106
+ Ok ( stdout_buffer_contents) => {
107
+ println ! ( "Process suceeded, returning: {}" , stdout_buffer_contents)
108
+ }
103
109
Err ( err) => panic ! ( "{}" , err) ,
104
110
} ,
105
- ( Some ( stdout_buffer) , Some ( stderr_buffer) ) => match std:: str:: from_utf8 ( & stdout_buffer) {
106
- Ok ( stdout_buffer_contents) => match std:: str:: from_utf8 ( & stderr_buffer) {
107
- Ok ( stderr_buffer_contents) => println ! ( "Process suceeded, returning: {} but with error: {}" , stdout_buffer_contents, stderr_buffer_contents) ,
111
+ ( Some ( stdout_buffer) , Some ( stderr_buffer) ) => {
112
+ match std:: str:: from_utf8 ( & stdout_buffer) {
113
+ Ok ( stdout_buffer_contents) => match std:: str:: from_utf8 ( & stderr_buffer) {
114
+ Ok ( stderr_buffer_contents) => println ! (
115
+ "Process suceeded, returning: {} but with error: {}" ,
116
+ stdout_buffer_contents, stderr_buffer_contents
117
+ ) ,
118
+ Err ( err) => panic ! ( "{}" , err) ,
119
+ } ,
108
120
Err ( err) => panic ! ( "{}" , err) ,
109
- } ,
110
- Err ( err) => panic ! ( "{}" , err) ,
111
- } ,
112
- }
121
+ }
122
+ }
123
+ } ,
113
124
Err ( err) => println ! ( "something went wrong: {}" , err) ,
114
125
} ;
115
126
} ) ;
0 commit comments