|
|
|
|
@ -87,8 +87,26 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_additional_settings_user_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){
|
|
|
|
|
void on_additional_settings_user_sync_add(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkWidget *tree;
|
|
|
|
|
if (self == window->UserAddButton){
|
|
|
|
|
tree = window->UsersTree;
|
|
|
|
|
} else {
|
|
|
|
|
tree = window->GroupsTree;
|
|
|
|
|
}
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
char *parameter;
|
|
|
|
|
int min_sensitive;
|
|
|
|
|
int max_sensitive;
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,7,&min_sensitive,8,&max_sensitive,9,¶meter,-1);
|
|
|
|
|
|
|
|
|
|
gtk_list_store_append(GTK_LIST_STORE(model),&iter);
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,1,1,name,5,1,6,1,7,min_sensitive,8,max_sensitive,9,parameter,10,1,11,1,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_additional_settings_user_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
@ -119,6 +137,96 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = NULL;
|
|
|
|
|
if (self == window->UserActiveCell){
|
|
|
|
|
model = GTK_TREE_MODEL(window->UsersShutdownList);
|
|
|
|
|
} else {
|
|
|
|
|
model = GTK_TREE_MODEL(window->GroupsShutdownList);
|
|
|
|
|
}
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get_iter_from_string(model,&iter,path);
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&status,-1);
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,!status,6,!status,-1);
|
|
|
|
|
if (path[0]=='0'&&!!status){
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,5,1,-1);
|
|
|
|
|
}
|
|
|
|
|
} else if (path[0] == '0'&&!status) {
|
|
|
|
|
int i=0;
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
if (i){
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,5,0,-1);
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
for (size_t i=0;i<strlen(new_text);i++){
|
|
|
|
|
if (!g_ascii_isdigit(new_text[i])) return;
|
|
|
|
|
}
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = NULL;
|
|
|
|
|
int place_to_set = -1;
|
|
|
|
|
if (self == window->UserMinCell){
|
|
|
|
|
model = GTK_TREE_MODEL(window->UsersShutdownList);
|
|
|
|
|
place_to_set=2;
|
|
|
|
|
} else if (self == window->UserMaxCell) {
|
|
|
|
|
model = GTK_TREE_MODEL(window->UsersShutdownList);
|
|
|
|
|
place_to_set=3;
|
|
|
|
|
} else if (self == window->GroupMinCell) {
|
|
|
|
|
model = GTK_TREE_MODEL(window->GroupsShutdownList);
|
|
|
|
|
place_to_set=2;
|
|
|
|
|
} else if (self == window->GroupMaxCell) {
|
|
|
|
|
model = GTK_TREE_MODEL(window->GroupsShutdownList);
|
|
|
|
|
place_to_set=3;
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_model_get_iter_from_string(model,&iter,path);
|
|
|
|
|
char *old_val;
|
|
|
|
|
gtk_tree_model_get(model,&iter,place_to_set==2?3:2,&old_val,-1);
|
|
|
|
|
if (yon_char_is_empty(old_val)) old_val = "";
|
|
|
|
|
if (!yon_char_is_empty(old_val)){
|
|
|
|
|
if (place_to_set==2){
|
|
|
|
|
if (atoi(new_text)>atoi(old_val)){
|
|
|
|
|
new_text=old_val;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (atoi(old_val)>atoi(new_text)){
|
|
|
|
|
new_text = old_val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,place_to_set,new_text,place_to_set==2?3:2,old_val,-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkWidget *tree;
|
|
|
|
|
GtkWidget *add_button;
|
|
|
|
|
GtkWidget *remove_button;
|
|
|
|
|
if (self == window->UsersTree){
|
|
|
|
|
tree = window->UsersTree;
|
|
|
|
|
add_button = window->UserAddButton;
|
|
|
|
|
remove_button = window->UserRemoveButton;
|
|
|
|
|
} else {
|
|
|
|
|
tree = window->GroupsTree;
|
|
|
|
|
add_button = window->GroupAddButton;
|
|
|
|
|
remove_button = window->GroupRemoveButton;
|
|
|
|
|
}
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){
|
|
|
|
|
int deletable;
|
|
|
|
|
int creatable;
|
|
|
|
|
char *parameter;
|
|
|
|
|
gtk_tree_model_get(model,&iter,9,¶meter,10,&creatable,11,&deletable,-1);
|
|
|
|
|
if (creatable) gtk_widget_set_sensitive(add_button,1); else gtk_widget_set_sensitive(add_button,0);
|
|
|
|
|
if (deletable) gtk_widget_set_sensitive(remove_button,1); else gtk_widget_set_sensitive(remove_button,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings);
|
|
|
|
|
@ -150,6 +258,12 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
window->GroupRemoveButton=yon_gtk_builder_get_widget(builder,"GroupRemoveButton");
|
|
|
|
|
window->UsersShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersShutdownList"));
|
|
|
|
|
window->GroupsShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsShutdownList"));
|
|
|
|
|
window->UserActiveCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserActiveCell"));
|
|
|
|
|
window->UserMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserMinCell"));
|
|
|
|
|
window->UserMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserMaxCell"));
|
|
|
|
|
window->GroupActiveCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupActiveCell"));
|
|
|
|
|
window->GroupMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMinCell"));
|
|
|
|
|
window->GroupMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMaxCell"));
|
|
|
|
|
|
|
|
|
|
window->default_password=NULL;
|
|
|
|
|
window->default_root_password=NULL;
|
|
|
|
|
@ -164,8 +278,18 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupAddButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_add),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupRemoveButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_remove),window);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserActiveCell),"toggled",G_CALLBACK(on_additional_settings_cell_toggled),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupActiveCell),"toggled",G_CALLBACK(on_additional_settings_cell_toggled),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserMinCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserMaxCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupMinCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupMaxCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UsersTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window);
|
|
|
|
|
yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch));
|
|
|
|
|
yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch));
|
|
|
|
|
|
|
|
|
|
@ -180,7 +304,6 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(window->UsersShutdownSwitch),1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hash_size=0;
|
|
|
|
|
config_str hash_algos = yon_file_open(hash_list_path,&hash_size);
|
|
|
|
|
if (main_config.hash_default_id==-1){
|
|
|
|
|
|