Merge pull request 'Added debug outputs' (#14) from YanTheKaller/libublsettingsui-gtk3:master into master

Reviewed-on: #14
pull/21/head v1.12
Dmitry Razumov 2 years ago
commit 8362bafa82

@ -55,7 +55,7 @@ msgstr "Сохранить"
#: source/libublsettingsui-gtk3.h:42
msgid "Load local configuration"
msgstr "Загрузить локальную конфигуруцию"
msgstr "Загрузить локальную конфигурацию"
#: source/libublsettingsui-gtk3.h:43
msgid "Load global configuration"

@ -113,6 +113,13 @@ void on_about(GtkWidget *self, char *version_application){
}
//functions
void (*save_success_function)(void*)=NULL;
void *save_success_argument=NULL;
void yon_save_window_set_postsave_function(void *function, void *data){
save_success_function=function;
save_success_argument=data;
}
void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, template_saving_window *window){
GtkTreeIter iter,itar;
@ -194,47 +201,51 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
}
}
}
if (debug_output==1){
template_debug_window *debug_window = template_debugger_window_new();
gtk_widget_show(debug_window->Window);
dictionary *dict = NULL;
char *final_command_line = "";
if (final_remove){
for_dictionaries(dict,final_remove){
char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL);
char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL);
if (!yon_char_is_empty(final_command_line))
free(final_command_line);
final_command_line=temp;
free(final_command);
}
}
if (final_append){
for_dictionaries(dict,final_append){
char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL);
char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL);
if (!yon_char_is_empty(final_command_line))
free(final_command_line);
final_command_line=temp;
free(final_command);
}
}
if (window->type==YON_CONFIG_BOTH) {
if (template_config->load_mode==1){
yon_config_save_registered("system");
} else if (template_config->load_mode==0){
yon_config_save_registered("global");
}
}
if (!yon_char_is_empty(final_command_line)){
yon_terminal_integrated_start(debug_window->Vte,final_command_line,NULL,NULL);
}
} else {
// if (debug_output==1){
// template_debug_window *debug_window = template_debugger_window_new();
// gtk_widget_show(debug_window->Window);
// dictionary *dict = NULL;
// char *final_command_line = "";
// if (final_remove){
// for_dictionaries(dict,final_remove){
// char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL);
// char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \"":"echo \"",final_command,"\";",final_command,NULL);
// if (!yon_char_is_empty(final_command_line))
// free(final_command_line);
// final_command_line=temp;
// free(final_command);
// }
// }
// if (final_append){
// for_dictionaries(dict,final_append){
// char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL);
// char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \"":"echo \"",final_command,"\";",final_command,NULL);
// if (!yon_char_is_empty(final_command_line))
// free(final_command_line);
// final_command_line=temp;
// free(final_command);
// }
// }
// if (window->type==YON_CONFIG_BOTH) {
// if (template_config->load_mode==1){
// yon_config_save_registered("system");
// } else if (template_config->load_mode==0){
// yon_config_save_registered("global");
// }
// }
// if (!yon_char_is_empty(final_command_line)){
// if (debug_output)
// printf("%s\n",final_command_line);
// yon_terminal_integrated_start(debug_window->Vte,final_command_line,NULL,NULL);
// }
// } else
{
dictionary *dict = NULL;
if (final_remove){
for_dictionaries(dict,final_remove){
char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL);
system(final_command);
printf("%s\n",final_command);
free(final_command);
}
}
@ -242,6 +253,7 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
for_dictionaries(dict,final_append){
char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL);
system(final_command);
printf("%s\n",final_command);
free(final_command);
}
}
@ -709,8 +721,6 @@ int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments
template_config->load_socket_id=atoi(optarg);
break;
case 'c': if (system(remove_config_dir_command)){};
break;
case 'd': debug_output = 1;
break;
case 1:
template_config->lock_help=1;

@ -215,10 +215,10 @@ typedef struct {
char *action_text;
} dialog_confirmation_data;
static int debug_output;
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data);
void yon_save_window_set_postsave_function(void *function, void *data);
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
/**yon_open_browser(GtkWidget *self, char *link)

Loading…
Cancel
Save