Repeat paths highlighting redone

pull/62/head
parent 181c266213
commit c3b63593e7

@ -456,15 +456,31 @@ void on_logrotate_configuration_path_add(GtkWidget *self, logrotate_configure_wi
}
void on_path_editing_done(GtkCellRendererText* self,gchar* path,gchar* new_text,logrotate_configure_window *window){
GtkTreeIter iter;
GtkTreeIter iter, itar;
char *cur_path;
gtk_tree_model_get_iter(GTK_TREE_MODEL(window->list),&iter,gtk_tree_path_new_from_string(path));
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1);
if (cur_path&&!strcmp(cur_path,"")&&!strcmp(new_text,""))
if (!strcmp(new_text,"")||cur_path&&!strcmp(cur_path,""))
gtk_list_store_remove(window->list,&iter);
else if (new_text&&strcmp(new_text,"")){
int deleted=0;
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar);
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){
char *path;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&path,-1);
if (path&&new_text)
if (!strcmp(path,new_text)){
yon_ubl_status_list_store_highlight_incorrect(window->list,gtk_tree_iter_copy(&itar));
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
gtk_list_store_remove(window->list,&iter);
else if (new_text&&strcmp(new_text,""))
deleted=1;
}
}
if (!deleted)
gtk_list_store_set(window->list,&iter,0,new_text,-1);
}
GValue *val = g_malloc0(sizeof(GValue));
g_object_get_property(G_OBJECT(self),"editable",val);
g_value_set_boolean(val,0);
@ -779,20 +795,6 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
return;
}
}
if (paths){
int psize=0;
int fo=0;
int so=0;
config_str paths_parsed = yon_char_parse(paths,&psize,",");
if (yon_char_parsed_check_repeats(paths_parsed,psize,&fo,&so)){
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),lastiter,yon_char_from_int(fo));
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),lastitar,yon_char_from_int(so));
yon_ubl_status_list_store_highlight_incorrect(window->list,lastiter);
yon_ubl_status_list_store_highlight_incorrect(window->list,lastitar);
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
return;
}
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RotationPeriodCheck))){
int active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RotationPeriodMainCombo));
switch (active){

Loading…
Cancel
Save