launch parameters rework

pull/95/head
parent 2c889acae0
commit d449466ef0

@ -2095,17 +2095,6 @@ main_window *yon_main_window_complete(main_window *widgets){
widgets->SavingSettingsButton=yon_gtk_builder_get_widget(builder,"SavingSettingsButton");
if (main_config.lock_load_global == 1){
gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0);
}
if (main_config.lock_save_global == 1){
gtk_widget_set_sensitive(widgets->SaveGlobalMenuItem,0);
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
}
if (main_config.lock_save_local == 1){
gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0);
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
}
main_config.users_list = widgets->UsersList;
main_config.groups_list = widgets->GroupsList;
@ -2150,81 +2139,12 @@ int main(int argc, char *argv[]){
local=setlocale(LC_ALL, "");
textdomain (LocaleName);
config_init();
int option_index=0;
int show_help=0;
int debug_mode=0;
{
struct option long_options[] = {
{"help", 0, 0, 'h'},
{"version", 0, 0, 'V'},
{"lock-help", 0,0, 1},
{"lock-save", 0,0, 2},
{"lock-save-local", 0,0, 3},
{"lock-save-global", 0,0, 4},
{"lock-load-global", 0,0, 5},
{"socket-id", 1, 0, 's'},
{"socket-ext-id", 1,0, 'e'},
{"socket-trd-id", 1,0, 't'},
{"clear-config", 0,0, 'c'},
{ NULL, 0, NULL, 0 }
};
for (int i=0;i<argc;i++){
int argument=getopt_long(argc,argv,"hVvs:e:t:c",long_options,&option_index);
switch(argument){
case 'h':
show_help=1;
break;
case 'v':
case 'V':
printf("%s\n",VERSION_LABEL);
exit(0);
break;
case 's':
if(optarg)
main_config.socket_id=atoi(optarg);
break;
case 'e':
if(optarg)
main_config.save_socket_id=atoi(optarg);
break;
case 't':
if(optarg)
main_config.load_socket_id=atoi(optarg);
break;
case 'c': if (system(remove_config_dir_command)){};
break;
case 1:
main_config.lock_help=1;
break;
case 2:
main_config.lock_save_local=1;
main_config.lock_save_global=1;
break;
case 3:
main_config.lock_save_local=1;
break;
case 4:
main_config.lock_save_global=1;
break;
case 5:
main_config.lock_load_global=1;
break;
}
}
if (show_help==1&&main_config.lock_help!=1){
printf("%s\n",HELP_LABEL);
exit(0);
}
}
if (getuid()!=0){
main_config.lock_load_global=1;
main_config.lock_save_global=1;
main_config.lock_save_local=1;
}
gtk_init(&argc,&argv);
yon_ubl_connect_config((_template_config*)&main_config);
yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK);
config_str unfound = NULL;
int size=0;
yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL);
gtk_init(&argc,&argv);
template_main_window *widgets = yon_ubl_window_setup();
textdomain (template_ui_LocaleName);
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);

@ -41,7 +41,7 @@
#define get_default_hash_command "ubconfig --raw --source default get [users] HASHPASSWD"
#define clear_config_global_command "ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER"
#define clear_config_local_command "ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER"
#define remove_config_dir_command yon_char_unite("rm -rfd ", yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",NULL)
// #define remove_config_dir_command yon_char_unite("rm -rfd ", yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",NULL)
#define samba_sync_command(user) yon_char_unite("sudo smbpasswd -Las ",user,NULL)
#define samba_sync_password_command(user, password) yon_char_unite("(echo \"",password,"\"; echo \"",password,"\") | sudo smbpasswd -Las ",user,NULL)
@ -80,6 +80,7 @@ typedef struct {
int lock_save_local;
int lock_save_global;
int lock_load_global;
int lock_load_system;
int load_mode;

@ -1,5 +1,4 @@
#define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(version_application)?version_application:"","\n",NULL)
#define HELP_LABEL yon_char_unite(_("ubl-settings-usergroups version:")," ", !yon_char_is_empty(version_application)?version_application:"","\n",_("Users and groups"),"\n",_("Usage:"), " ubl-settings-usergroups ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",NULL)
#define TITLE_LABEL _("Users and groups")
#define TITLE_INFO_LABEL _("System users and groups configuration")

Loading…
Cancel
Save