|
|
|
|
@ -4,38 +4,111 @@ config main_config;
|
|
|
|
|
|
|
|
|
|
//functions
|
|
|
|
|
|
|
|
|
|
void yon_load_proceed(char *command){
|
|
|
|
|
int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
if (yon_config_load_register(type,"logging","",NULL)){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_save(){
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,"logging", "",NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(){
|
|
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,"logging", "",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(){
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,"logging", "",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_save_proceed(char *section,YON_CONFIG_TYPE type){
|
|
|
|
|
void on_password_combo_changed(GtkComboBox *self, GtkWidget *target){
|
|
|
|
|
gtk_widget_set_sensitive(target,gtk_combo_box_get_active(self)>1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_filechooser_open(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
int responce = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
if (responce==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
|
gtk_entry_set_text(output_target,filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new();
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
// gtk_widget_show(window->Window);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_groups_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_group_window*);
|
|
|
|
|
GtkEntry *output = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(window->list);
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),&model,&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,-1);
|
|
|
|
|
gtk_entry_set_text(output,name);
|
|
|
|
|
free(name);
|
|
|
|
|
}
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_groups_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),0),0);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),GTK_SELECTION_SINGLE);
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"output",output_target);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_groups_save),dict);
|
|
|
|
|
gtk_widget_show(window->GroupsWindow);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_groups_multiple_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_group_window*);
|
|
|
|
|
GtkEntry *output = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
|
char *full_groups="";
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&status,1,&name,-1);
|
|
|
|
|
if (status){
|
|
|
|
|
char *extend_groups = yon_char_unite(full_groups,!yon_char_is_empty(full_groups)?",":"",name,NULL);
|
|
|
|
|
if (!yon_char_is_empty(full_groups))
|
|
|
|
|
free(full_groups);
|
|
|
|
|
full_groups=extend_groups;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_entry_set_text(output,full_groups);
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"output",output_target);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_groups_multiple_save),dict);
|
|
|
|
|
gtk_widget_show(window->GroupsWindow);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_change(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new();
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"target",output_target);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_password_accept),dict);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(output_target))));
|
|
|
|
|
gtk_widget_show(window->CreateGroupWindow);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -53,7 +126,36 @@ void on_expiration_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_additional_settings_save(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
const char *default_user = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry));
|
|
|
|
|
if (!yon_char_is_empty(default_user)){
|
|
|
|
|
yon_config_register("DEFAULTUSER","users",yon_char_new((char*)default_user));
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key("DEFAULTUSER");
|
|
|
|
|
}
|
|
|
|
|
char *default_password = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry));
|
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
|
yon_config_register("DEFAULTPASSWD","users",default_password);
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key("DEFAULTPASSWD");
|
|
|
|
|
}
|
|
|
|
|
char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry));
|
|
|
|
|
if (!yon_char_is_empty(root_password)){
|
|
|
|
|
yon_config_register("DEFAULTROOTPASSWD","users",root_password);
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key("DEFAULTROOTPASSWD");
|
|
|
|
|
}
|
|
|
|
|
int user_k_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck));
|
|
|
|
|
if (user_k_admin){
|
|
|
|
|
yon_config_register("ADDADM","users","yes");
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_register("ADDADM","users","no");
|
|
|
|
|
}
|
|
|
|
|
char *hash = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->PasswordHashCombo));
|
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
|
yon_config_register("HASHPASSWD","users",hash);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
@ -64,12 +166,41 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
window->DefaultUserAdministratorCheck=yon_gtk_builder_get_widget(builder,"DefaultUserAdministratorCheck");
|
|
|
|
|
window->DefaultPasswordCombo=yon_gtk_builder_get_widget(builder,"DefaultPasswordCombo");
|
|
|
|
|
window->DefaultPasswordEntry=yon_gtk_builder_get_widget(builder,"DefaultPasswordEntry");
|
|
|
|
|
window->DefaultPasswordButton=yon_gtk_builder_get_widget(builder,"DefaultPasswordButton");
|
|
|
|
|
window->RootPasswordCombo=yon_gtk_builder_get_widget(builder,"RootPasswordCombo");
|
|
|
|
|
window->RootPasswordEntry=yon_gtk_builder_get_widget(builder,"RootPasswordEntry");
|
|
|
|
|
window->RootPasswordButton=yon_gtk_builder_get_widget(builder,"RootPasswordButton");
|
|
|
|
|
window->PasswordHashCombo=yon_gtk_builder_get_widget(builder,"PasswordHashCombo");
|
|
|
|
|
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
|
|
|
|
|
char *default_user = yon_config_get_by_key("DEFAULTUSER");
|
|
|
|
|
if (!yon_char_is_empty(default_user))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultUserNameEntry),default_user);
|
|
|
|
|
char *default_password = yon_config_get_by_key("DEFAULTPASSWD");
|
|
|
|
|
if (!yon_char_is_empty(default_password))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password);
|
|
|
|
|
char *root_password = yon_config_get_by_key("DEFAULTROOTPASSWD");
|
|
|
|
|
if (!yon_char_is_empty(root_password))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->RootPasswordEntry),root_password);
|
|
|
|
|
char *is_k_admin = yon_config_get_by_key("ADDADM");
|
|
|
|
|
if (!yon_char_is_empty(is_k_admin))
|
|
|
|
|
if (!strcmp(is_k_admin,"yes"))
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck),1);
|
|
|
|
|
char *hash = yon_config_get_by_key("HASHPASSWD");
|
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordHashCombo),yon_gtk_combo_box_text_find(window->PasswordHashCombo,hash));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_additional_settings_save),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordButton),"clicked",G_CALLBACK(on_password_change),window->DefaultPasswordEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordButton),"clicked",G_CALLBACK(on_password_change),window->RootPasswordEntry);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -111,49 +242,136 @@ return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_group_clicked(GtkCellRenderer *self, char *path, ubl_settings_usergroups_group_window *window){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gboolean status;
|
|
|
|
|
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path);
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&status,-1);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,0,!status,-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = malloc(sizeof(ubl_settings_usergroups_group_window));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group);
|
|
|
|
|
window->groupsAdmGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAdmGroupCheck");
|
|
|
|
|
window->groupsAudioGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAudioGroupCheck");
|
|
|
|
|
window->groupsAutologinGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAutologinGroupCheck");
|
|
|
|
|
window->groupsAvahiGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAvahiGroupCheck");
|
|
|
|
|
window->groupsBinGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBinGroupCheck");
|
|
|
|
|
window->groupsBrlapiGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBrlapiGroupCheck");
|
|
|
|
|
window->groupsBrittyGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBrittyGroupCheck");
|
|
|
|
|
window->groupsBumblbeeGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBumblbeeGroupCheck");
|
|
|
|
|
window->groupsChronyGroupCheck=yon_gtk_builder_get_widget(builder,"groupsChronyGroupCheck");
|
|
|
|
|
window->groupsClamavGroupCheck=yon_gtk_builder_get_widget(builder,"groupsClamavGroupCheck");
|
|
|
|
|
window->groupsCockpitWsGroupCheck=yon_gtk_builder_get_widget(builder,"groupsCockpitWsGroupCheck");
|
|
|
|
|
window->groupsCockpitWsinstanceGroupCheck=yon_gtk_builder_get_widget(builder,"groupsCockpitWsinstanceGroupCheck");
|
|
|
|
|
window->groupsColordGroupCheck=yon_gtk_builder_get_widget(builder,"groupsColordGroupCheck");
|
|
|
|
|
window->GroupsWindow=yon_gtk_builder_get_widget(builder,"GroupsWindow");
|
|
|
|
|
window->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree");
|
|
|
|
|
window->GroupsCancelButton=yon_gtk_builder_get_widget(builder,"GroupsCancelButton");
|
|
|
|
|
window->GroupsOkButton=yon_gtk_builder_get_widget(builder,"GroupsOkButton");
|
|
|
|
|
window->StatusCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StatusCell"));
|
|
|
|
|
window->list = gtk_list_store_new(2,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->GroupsTree),GTK_TREE_MODEL(window->list));
|
|
|
|
|
for (int i=0;i<main_config.groups_size;i++){
|
|
|
|
|
char *group_record = yon_char_new(main_config.groups[i]);
|
|
|
|
|
char *group_name = yon_char_divide_search(group_record,":",-1);
|
|
|
|
|
gtk_list_store_append(window->list,&iter);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,0,0,1,group_name,-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_window *window){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(window->list);
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(model,&iter);
|
|
|
|
|
char *standard_groups="";
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(model,&iter)){
|
|
|
|
|
int status;
|
|
|
|
|
char *group;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&status,1,&group,-1);
|
|
|
|
|
if (status){
|
|
|
|
|
char *extend_groups = yon_char_unite(standard_groups,!yon_char_is_empty(standard_groups)?",":"",group,NULL);
|
|
|
|
|
if (!yon_char_is_empty(standard_groups))
|
|
|
|
|
free(standard_groups);
|
|
|
|
|
standard_groups=extend_groups;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_config_register("USERGROUPS","users",standard_groups);
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_standard_groups_open(GtkWidget *self, main_window *widgets){
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_standard_groups_accept),window);
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->GroupsWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
|
char *groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
|
if (!yon_char_is_empty(groups)){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
int size;
|
|
|
|
|
config_str standard_groups = yon_char_parse(groups,&size,",");
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
|
char *cur_name;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&cur_name,-1);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
if (!strcmp(standard_groups[i],cur_name)){
|
|
|
|
|
gtk_list_store_set(window->list,&iter,0,1,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free(cur_name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_show(window->GroupsWindow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_password_show_hide(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEvent* event){
|
|
|
|
|
if (icon_pos == GTK_ENTRY_ICON_SECONDARY){
|
|
|
|
|
int visible = gtk_entry_get_visibility(self);
|
|
|
|
|
if (!visible){
|
|
|
|
|
gtk_entry_set_visibility(self,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_entry_set_visibility(self,0);
|
|
|
|
|
gtk_entry_set_invisible_char(self,'*');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_window *window){
|
|
|
|
|
char *self_text = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
char *pair_text = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if ((!yon_char_is_empty(self_text)&&!yon_char_is_empty(pair_text))&&strcmp(self_text,pair_text)){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_despawn_infinite(GTK_CONTAINER(window->StatusBox));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*);
|
|
|
|
|
GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
|
char *password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)));
|
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
if (strcmp(password,password_check)){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){
|
|
|
|
|
ubl_settings_usergroups_password_window *window = malloc(sizeof(ubl_settings_usergroups_password_window));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_password);
|
|
|
|
|
window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow");
|
|
|
|
|
window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry");
|
|
|
|
|
window->RepeatPasswordEntry=yon_gtk_builder_get_widget(builder,"RepeatPasswordEntry");
|
|
|
|
|
window->PasswordHashEntry=yon_gtk_builder_get_widget(builder,"PasswordHashEntry");
|
|
|
|
|
|
|
|
|
|
window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton");
|
|
|
|
|
window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton");
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),TITLE_LABEL);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -229,6 +447,10 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordButton),"clicked",G_CALLBACK(on_password_change),window->userPasswordEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window->userPasswordExpirationEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userPasswordButton);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -313,6 +535,8 @@ void config_init(){
|
|
|
|
|
main_config.lock_load_global=0;
|
|
|
|
|
main_config.lock_save_global=0;
|
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
|
main_config.groups_size=0;
|
|
|
|
|
main_config.groups = yon_file_open(groups_path,&main_config.groups_size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**yon_main_window_complete(main_window *widgets)
|
|
|
|
|
@ -342,9 +566,6 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
widgets->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree");
|
|
|
|
|
widgets->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
|
|
|
|
|
|
|
|
|
|
main_config.usersListStore = GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersList"));
|
|
|
|
|
main_config.groupsListStore = GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsList"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (main_config.lock_load_global == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0);
|
|
|
|
|
@ -365,6 +586,9 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->button3),"clicked",G_CALLBACK(on_standard_groups_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->button2),"clicked",G_CALLBACK(on_ubl_settings_usergroups_additional_settings_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->button1),"clicked",G_CALLBACK(on_settings_usergroups_system_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveMenuItem),"activate",G_CALLBACK(on_config_save),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
|
@ -451,5 +675,6 @@ int main(int argc, char *argv[]){
|
|
|
|
|
yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK);
|
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
|
yon_main_window_complete((main_window*)widgets);
|
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
|
gtk_main();
|
|
|
|
|
}
|