From f3a04ee479ca8ae946b564548692d69ca23f4d80 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 26 Sep 2023 13:55:36 +0600 Subject: [PATCH] Added block for 'id changed' function --- source/ubl-settings-system.c | 8 ++++++-- source/ubl-settings-system.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index 71ce381..be77a12 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -110,6 +110,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ } void yon_config_local_load(GtkWidget *self, main_window *widgets){ + g_signal_handlers_block_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),DEFAULT_LABEL); @@ -166,10 +167,13 @@ void yon_config_local_load(GtkWidget *self, main_window *widgets){ } if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string); } + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); + if (getuid()==0) yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); } void yon_config_global_load(GtkWidget *self, main_window *widgets){ + g_signal_handlers_block_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); gtk_entry_set_text(GTK_ENTRY(widgets->HostnameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->IDEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),DEFAULT_LABEL); @@ -226,6 +230,8 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){ } if (strcmp(locale_string,"")) gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),locale_string); } + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->IDEntry),G_CALLBACK(on_id_changed),widgets); + if (getuid()==0) yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); } @@ -597,8 +603,6 @@ int main(int argc, char *argv[]){ yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel); if (getuid()!=0) yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); - else - yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id); yon_window_config_setup(GTK_WINDOW(widgets->Window)); yon_window_config_load(config_path); diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 152a713..e05ebbd 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -135,4 +135,5 @@ typedef struct { GtkCellRenderer *ToggleCell; } locals_window; -main_window *setup_window(); \ No newline at end of file +main_window *setup_window(); +void on_id_changed(GtkEntry *self, main_window *widgets); \ No newline at end of file