|
|
|
|
@ -3,6 +3,26 @@
|
|
|
|
|
config main_config;
|
|
|
|
|
|
|
|
|
|
//saving & loading
|
|
|
|
|
|
|
|
|
|
void on_save_done(main_window *widgets, config_str output, int size){
|
|
|
|
|
|
|
|
|
|
char *final_output = yon_char_parsed_to_string(output,size,"");
|
|
|
|
|
printf("%s\n",final_output);
|
|
|
|
|
free(final_output);
|
|
|
|
|
yon_char_parsed_free(output,size);
|
|
|
|
|
on_config_update(NULL,widgets);
|
|
|
|
|
switch (main_config.save_config){
|
|
|
|
|
case 0:
|
|
|
|
|
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
yon_config_clean();
|
|
|
|
|
@ -77,21 +97,25 @@ void on_service_constant_update(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_global_local_save(){
|
|
|
|
|
main_config.save_config=3;
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(){
|
|
|
|
|
main_config.save_config=1;
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_local_command,NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(){
|
|
|
|
|
main_config.save_config=0;
|
|
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_global_command,NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_custom_save(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (self&&widgets){}
|
|
|
|
|
main_config.save_config=1;
|
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_command("system"),NULL);
|
|
|
|
|
if (window){};
|
|
|
|
|
}
|
|
|
|
|
@ -554,11 +578,11 @@ void yon_system_systemd_restart(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (widgets){
|
|
|
|
|
if (getuid()!=0&>k_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
|
if (system(reload_systemd_root_command)){
|
|
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_render(SYSTEMD_RELAUNCH_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (system(reload_systemd_user_command)){
|
|
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_render(SYSTEMD_RELAUNCH_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -569,11 +593,11 @@ void yon_system_systemd_reexec(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (widgets){
|
|
|
|
|
if (getuid()!=0&>k_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
|
if (system(reexec_systemd_root_command)){
|
|
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_render(SYSTEMD_REEXEC_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (system(reexec_systemd_user_command)){
|
|
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_render(SYSTEMD_REEXEC_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1583,6 +1607,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
pthread_t tid;
|
|
|
|
|
pthread_create(&tid,NULL,(void*)(void*)((yon_interface_update)),widgets);
|
|
|
|
|
}
|
|
|
|
|
yon_save_window_set_postsave_function(on_save_done)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
|
|