From 949ea7d73af2d50123114b4a682f3470febd9258 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 25 Oct 2024 10:13:38 +0600 Subject: [PATCH 1/5] Added own changing to all file access functions --- source/libublsettings-gtk3.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index cdd8dfe..adc26ee 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -293,6 +293,8 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi if (!access(path,0)){ __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + chown(__yon_window_config_path,user->pw_uid,user->pw_gid); chmod(__yon_window_config_path,0777); if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ struct stat st; @@ -304,6 +306,8 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi } FILE *fp; fp=fopen(__yon_window_config_path,"w"); + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + chown(__yon_window_config_path,user->pw_uid,user->pw_gid); chmod(__yon_window_config_path,0777); fclose(fp); g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); From 2b854019c1fff69c8ae249b87c684eefbffe2c9e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 8 Nov 2024 14:39:40 +0600 Subject: [PATCH 2/5] function add --- source/libublsettings-gtk3.c | 16 ++++++++++++++++ source/libublsettings-gtk3.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index adc26ee..56aa994 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -699,6 +699,22 @@ int yon_gtk_list_store_find_text(GtkListStore *list, GtkTreeIter *iter, int seek } return 0; } +void yon_on_cell_renderer_toggle_toggled_for_list_store(GtkWidget *self, gchar *path,GtkWidget *tree){ + GtkTreePath *path_converted = gtk_tree_path_new_from_string(path); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree)); + GtkTreeIter iter; + gtk_tree_model_get_iter(model,&iter,path_converted); + int last = yon_char_find_last(path,':'); + char *col = path+last+1; + int status; + gtk_tree_model_get(model,&iter,atoi(col),&status,-1); + gtk_list_store_set(GTK_LIST_STORE(model),&iter,atoi(col),!status,-1); +} + +void yon_cell_renderer_toggle_set_toggle(GtkCellRendererToggle *target,GtkWidget *tree){ + g_return_if_fail(GTK_IS_CELL_RENDERER_TOGGLE(target)); + g_signal_connect(G_OBJECT(target),"toggled",G_CALLBACK(yon_on_cell_renderer_toggle_toggled_for_list_store),tree); +} void yon_gtk_toggle_button_set_inactive_from_toggle(GtkToggleButton *self, GtkToggleButton *target){ if (gtk_toggle_button_get_active(self)){ diff --git a/source/libublsettings-gtk3.h b/source/libublsettings-gtk3.h index e15ad98..7c1f9c9 100644 --- a/source/libublsettings-gtk3.h +++ b/source/libublsettings-gtk3.h @@ -252,6 +252,8 @@ int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean e int yon_gtk_list_store_find_text(GtkListStore *list, GtkTreeIter *iter, int seek_column, char *value); +void yon_cell_renderer_toggle_set_toggle(GtkCellRendererToggle *target,GtkWidget *tree); + void yon_gtk_toggle_button_set_inactive_from_toggle(GtkToggleButton *self, GtkToggleButton *target); void yon_gtk_toggle_button_set_inactive_from_entry(GtkEntry *self, GtkToggleButton *target); From 0bc9cc467948da9cd749825e70bdd05e9a9f0d97 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Nov 2024 11:42:53 +0600 Subject: [PATCH 3/5] fixed config file creation --- source/libublsettings-gtk3.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index 56aa994..2161f2e 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -290,7 +290,9 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi int yon_window_config_load(char *path){ if(__yon_window_config_target_window){ - if (!access(path,0)){ + if (access(path,0)){ + yon_file_create_full_path(path,0777); + } __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); struct passwd *user = getpwnam(yon_ubl_root_user_get()); @@ -348,9 +350,6 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi pthread_create(&tid,NULL,(void *)_yon_maximize,NULL); return 1; } - } else { - // g_warning("config file were not loaded properly"); - } return 0; } From 3d64db29220a010616e2d9d3cb66c904ef692ffb Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Nov 2024 12:14:45 +0600 Subject: [PATCH 4/5] Changed chmod rules --- source/libublsettings-gtk3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index 2161f2e..a37238f 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -291,26 +291,26 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi int yon_window_config_load(char *path){ if(__yon_window_config_target_window){ if (access(path,0)){ - yon_file_create_full_path(path,0777); + yon_file_create_full_path(path,0644); } __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); struct passwd *user = getpwnam(yon_ubl_root_user_get()); chown(__yon_window_config_path,user->pw_uid,user->pw_gid); - chmod(__yon_window_config_path,0777); + chmod(__yon_window_config_path,0644); if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ struct stat st; int size; config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,"/"); char *path = yon_char_unite(conf[0],"/",conf[1],"/",conf[2],"/",conf[3],"/",conf[4],"/",NULL); if (stat(path, &st) == -1) { - mkdir(path, 0777); + mkdir(path, 0644); } FILE *fp; fp=fopen(__yon_window_config_path,"w"); struct passwd *user = getpwnam(yon_ubl_root_user_get()); chown(__yon_window_config_path,user->pw_uid,user->pw_gid); - chmod(__yon_window_config_path,0777); + chmod(__yon_window_config_path,0644); fclose(fp); g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); } From be94db8ba02876de9ea1c7ebd52c10e68fb28787 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 15 Nov 2024 10:17:55 +0600 Subject: [PATCH 5/5] Removed unnessessary chmod --- source/libublsettings-gtk3.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index a37238f..9c8ff61 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -295,23 +295,9 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi } __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); - struct passwd *user = getpwnam(yon_ubl_root_user_get()); - chown(__yon_window_config_path,user->pw_uid,user->pw_gid); - chmod(__yon_window_config_path,0644); if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ struct stat st; int size; - config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,"/"); - char *path = yon_char_unite(conf[0],"/",conf[1],"/",conf[2],"/",conf[3],"/",conf[4],"/",NULL); - if (stat(path, &st) == -1) { - mkdir(path, 0644); - } - FILE *fp; - fp=fopen(__yon_window_config_path,"w"); - struct passwd *user = getpwnam(yon_ubl_root_user_get()); - chown(__yon_window_config_path,user->pw_uid,user->pw_gid); - chmod(__yon_window_config_path,0644); - fclose(fp); g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); } __yon_main_window_config.x = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosX",NULL);