Added functionality for new check buttons at additional settings window; Added reloading of current configuration after saving

pull/141/head
parent 3e74ec34c0
commit a6b1b0844d

@ -6,7 +6,7 @@ config main_config;
int yon_load_proceed(YON_CONFIG_TYPE type){ int yon_load_proceed(YON_CONFIG_TYPE type){
yon_config_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",NULL); yon_config_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",NULL);
yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL); yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL);
if (type!=YON_CONFIG_GLOBAL){ if (type!=YON_CONFIG_GLOBAL){
yon_config_load_register_no_cleaning(YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD",NULL); yon_config_load_register_no_cleaning(YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD",NULL);
} }
@ -355,6 +355,11 @@ void yon_hide_passwords(template_saving_window *window){
} }
} }
void on_save_done(main_window *widgets){
on_config_update(NULL,widgets);
}
void on_config_save(GtkWidget *self, main_window *widgets){ void on_config_save(GtkWidget *self, main_window *widgets){
yon_accept_changes(); yon_accept_changes();
yon_samba_sync_proceed(); yon_samba_sync_proceed();
@ -417,12 +422,13 @@ void on_config_save(GtkWidget *self, main_window *widgets){
} }
} }
void on_config_global_save(){ void on_config_global_save(GtkWidget *self, main_window *widgets){
yon_accept_changes(); yon_accept_changes();
yon_samba_sync_proceed(); yon_samba_sync_proceed();
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL); template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
if (window) yon_hide_passwords(window); if (window){
yon_hide_passwords(window);
}
} }
void on_config_local_save(GtkWidget *self, main_window *widgets){ void on_config_local_save(GtkWidget *self, main_window *widgets){
@ -960,6 +966,32 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
yon_char_parsed_free(hash_algos,hash_size); yon_char_parsed_free(hash_algos,hash_size);
} }
void on_users_boot_toggled(GtkToggleButton *self){
if (gtk_toggle_button_get_active(self)){
char *parameter = yon_config_get_by_key("USERADD_SYNC");
if (!parameter){
yon_config_register("USERADD_SYNC","users","boot");
} else {
yon_config_append("USERADD_SYNC","boot",",");
}
} else {
yon_config_remove_element("USERADD_SYNC","boot",",");
}
}
void on_users_shutdown_toggled(GtkToggleButton *self){
if (gtk_toggle_button_get_active(self)){
char *parameter = yon_config_get_by_key("USERADD_SYNC");
if (!parameter){
yon_config_register("USERADD_SYNC","users","shutdown");
} else {
yon_config_append("USERADD_SYNC","shutdown",",");
}
} else {
yon_config_remove_element("USERADD_SYNC","shutdown",",");
}
}
ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){
ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window));
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings);
@ -977,9 +1009,20 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton"); window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton");
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton"); window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton");
window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck");
window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck");
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow");
gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL);
char *sync_parameters = yon_config_get_by_key("USERADD_SYNC");
if (sync_parameters){
if (strstr(sync_parameters,"boot")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1);
}
if (strstr(sync_parameters,"shutdown")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1);
}
}
int hash_size=0; int hash_size=0;
config_str hash_algos = yon_file_open(hash_list_path,&hash_size); config_str hash_algos = yon_file_open(hash_list_path,&hash_size);
@ -1063,6 +1106,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window); g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window);
g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL);
g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL);
return window; return window;
} }
@ -2694,6 +2740,7 @@ main_window *yon_main_window_complete(main_window *widgets){
yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT); yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
} }
g_list_free(list); g_list_free(list);
yon_save_window_set_postsave_function(on_save_done,widgets);
return widgets; return widgets;
} }

@ -189,6 +189,8 @@ typedef struct{
GtkWidget *CancelButton; GtkWidget *CancelButton;
GtkWidget *AcceptButton; GtkWidget *AcceptButton;
GtkWidget *EncryptAllPasswordsButton; GtkWidget *EncryptAllPasswordsButton;
GtkWidget *UsersBootCheck;
GtkWidget *UsersShutdownCheck;
} ubl_settings_usergroups_additional_settings_window; } ubl_settings_usergroups_additional_settings_window;
typedef struct{ typedef struct{
@ -336,4 +338,6 @@ void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets);
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(); ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new();
void on_password_accept(GtkWidget *self, dictionary *dict); void on_password_accept(GtkWidget *self, dictionary *dict);
void on_config_update(GtkWidget *self, main_window *widgets);

@ -383,7 +383,7 @@
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="UsersBootCheck">
<property name="label" translatable="yes">While booting the operating system, apply the settings of all users from the configuration</property> <property name="label" translatable="yes">While booting the operating system, apply the settings of all users from the configuration</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
@ -397,7 +397,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="UsersShutdownCheck">
<property name="label" translatable="yes">While shutdown, save the settings of all users with UID&gt;=1000 to the configuration</property> <property name="label" translatable="yes">While shutdown, save the settings of all users with UID&gt;=1000 to the configuration</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>

Loading…
Cancel
Save