@@ -83,8 +83,6 @@ fn build_ui(app: &Application) {
83
83
. build ( ) ;
84
84
// Connect to "clicked" signal of `button`
85
85
button2. connect_clicked ( move |_| {
86
- println ! ( "Trying to open settings!" ) ; //DEBUG
87
-
88
86
// Ideally we should grab if nvidia-settings 'failed' somehow or exited normally
89
87
match subprocess:: exec_communicate (
90
88
& [
@@ -93,14 +91,38 @@ fn build_ui(app: &Application) {
93
91
OsStr :: new ( "GpuUUID" ) ,
94
92
OsStr :: new ( "-t" ) ,
95
93
] ,
96
- None ,
97
94
None :: < & gio:: Cancellable > ,
98
95
) {
99
- Ok ( _x) => {
100
- println ! ( "........yay" ) ; //DEBUG
96
+ Ok ( return_val) => {
97
+ match return_val {
98
+ ( None , None ) => println ! ( "no stdout or stderr, something went really wrong..." ) ,
99
+ ( None , Some ( stderr_buffer) ) => {
100
+ match std:: str:: from_utf8 ( & stderr_buffer) {
101
+ Ok ( stderr_buffer_contents) => println ! ( "Process failed with error: {}" , stderr_buffer_contents) ,
102
+ Err ( err) => panic ! ( "{}" , err) ,
103
+ }
104
+ } ,
105
+ ( Some ( stdout_buffer) , None ) => {
106
+ match std:: str:: from_utf8 ( & stdout_buffer) {
107
+ Ok ( stdout_buffer_contents) => println ! ( "Process suceeded, returning: {}" , stdout_buffer_contents) ,
108
+ Err ( err) => panic ! ( "{}" , err) ,
109
+ }
110
+ } ,
111
+ ( Some ( stdout_buffer) , Some ( stderr_buffer) ) => {
112
+ match std:: str:: from_utf8 ( & stdout_buffer) {
113
+ Ok ( stdout_buffer_contents) => {
114
+ match std:: str:: from_utf8 ( & stderr_buffer) {
115
+ Ok ( stderr_buffer_contents) => println ! ( "Process suceeded, returning: {} but with error: {}" , stdout_buffer_contents, stderr_buffer_contents) ,
116
+ Err ( err) => panic ! ( "{}" , err) ,
117
+ }
118
+ } ,
119
+ Err ( err) => panic ! ( "{}" , err) ,
120
+ }
121
+ } ,
122
+ }
101
123
}
102
124
Err ( _y) => {
103
- println ! ( "........fak " ) ; //DEBUG
125
+ println ! ( "something went wrong! " ) ; //DEBUG
104
126
}
105
127
} ;
106
128
} ) ;
@@ -132,8 +154,8 @@ fn build_ui(app: &Application) {
132
154
window. set_show_menubar ( true ) ;
133
155
134
156
// Add children to window
135
- window. set_child ( Some ( & button1) ) ;
136
- // window.set_child(Some(&button2));
157
+ // window.set_child(Some(&button1));
158
+ window. set_child ( Some ( & button2) ) ;
137
159
138
160
// Present window
139
161
window. show ( ) ;
0 commit comments