From 2cc04d8eff0ea3bf00557999f9ee5687839e6fb3 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 21 Oct 2024 14:14:16 +0600 Subject: [PATCH 1/2] Added chmod for all file creation processes --- source/libublsettings-gtk3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index b8c2707..8987200 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -293,6 +293,7 @@ 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); + 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; int size; @@ -1088,9 +1089,7 @@ GtkWidget *yon_ubl_browser_window_open(char *link, char *browser_window_name){ #else GtkWidget *yon_ubl_browser_window_open(char *link, char *browser_window_name){ - char *user=getenv("SUDO_USER"); - if (!user) - user=getlogin(); + char *user=yon_ubl_root_user_get(); char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL); yon_launch(command); return NULL; From 3f8ef08ef49579a9157a848a0e8a1dde82d4a5b1 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 22 Oct 2024 11:34:46 +0600 Subject: [PATCH 2/2] Added function to convert entry into password entry --- source/libublsettings-gtk3.c | 13 +++++++++++++ source/libublsettings-gtk3.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index 8987200..cdd8dfe 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -1282,6 +1282,19 @@ void yon_gtk_tree_store_fill_children(GtkTreeStore *tree, GtkTreeIter *parent, d #include +void yon_on_password_visibility_changed(GtkEntry *self, GtkEntryIconPosition position){ + if (position==GTK_ENTRY_ICON_SECONDARY){ + int status = gtk_entry_get_visibility(self); + gtk_entry_set_visibility(self,!status); + } +} + +void yon_gtk_entry_set_password_visibility_icon(GtkEntry *target){ + g_return_if_fail(GTK_IS_ENTRY(target)); + gtk_entry_set_icon_from_icon_name(target,GTK_ENTRY_ICON_SECONDARY,"com.ublinux.libublsettingsui-gtk3.view-symbolic"); + g_signal_connect(G_OBJECT(target),"icon-release",G_CALLBACK(yon_on_password_visibility_changed),NULL); +} + void yon_gtk_tree_store_copy_recursive(GtkTreeModel *sourceModel, GtkTreeIter *sourceIter, GtkTreeStore *destination, GtkTreeIter *parentIter) { GtkTreeIter destIter; diff --git a/source/libublsettings-gtk3.h b/source/libublsettings-gtk3.h index 2382910..e15ad98 100644 --- a/source/libublsettings-gtk3.h +++ b/source/libublsettings-gtk3.h @@ -482,6 +482,8 @@ typedef struct { rmb_menu_window *yon_rmb_menu_setup(GtkWidget *target_widget, int (*show_function)(void*), void *show_data, const char *button_label, const char *icon_name, GCallback function, gpointer data,...); #endif +void yon_gtk_entry_set_password_visibility_icon(GtkEntry *target); + void yon_on_text_insert_only_digits(GtkEditable *editable, const gchar *text, gint length, gint *position, gpointer user_data); // GtkTreeStore section