From a1fe0204a4a6e383215e8377eb0189b4a6e974d5 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 5 Feb 2025 14:40:27 +0600 Subject: [PATCH] Crash fix --- source/ubl-settings-logging.c | 22 +++++++++++++++++++++- ubl-settings-logging-add.glade | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index b175f04..aee2820 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -1291,7 +1291,25 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){ } int create_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CreateLogCombo)); if (create_active){ - create = yon_char_unite("create ", gtk_entry_get_text(GTK_ENTRY(window->CreateLogEntry))," ",gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->CreateLogUserCombo))," ",gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->CreateGroupCombo)),NULL); + char *rule = (char*)gtk_entry_get_text(GTK_ENTRY(window->CreateLogEntry)); + char *rule_user = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->CreateLogUserCombo)); + char *rule_group = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->CreateGroupCombo)); + if (yon_char_is_empty(rule)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->CreateLogEntry); + return; + } + if (yon_char_is_empty(rule_user)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->CreateLogUserCombo); + return; + } + if (yon_char_is_empty(rule_group)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->CreateGroupCombo); + return; + } + create = yon_char_unite("create ", rule," ",rule_user," ",rule_group,NULL); } char *commandline = yon_char_unite(period, @@ -3060,7 +3078,9 @@ void yon_main_window_complete(template_main_window **window){ g_signal_connect(G_OBJECT(widgets->UpgradePermissionsMenuItem),"activate",G_CALLBACK(on_permissions_changed),widgets); g_signal_connect(G_OBJECT(widgets->MainTree),"cursor-changed",G_CALLBACK(on_main_window_tree_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->MainTree),"unselect-all",G_CALLBACK(on_main_window_tree_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->ServicesTree),"cursor-changed",G_CALLBACK(on_main_window_services_tree_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->ServicesTree),"unselect-all",G_CALLBACK(on_main_window_services_tree_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->ServicesStartStopButton),"clicked",G_CALLBACK(on_start_stop_clicked),widgets); g_signal_connect(G_OBJECT(widgets->ServicesEnableDisableButton),"clicked",G_CALLBACK(on_enable_disable_clicked),widgets); diff --git a/ubl-settings-logging-add.glade b/ubl-settings-logging-add.glade index 365e93d..a87b313 100644 --- a/ubl-settings-logging-add.glade +++ b/ubl-settings-logging-add.glade @@ -21,7 +21,7 @@ True False - process-stop-symbolic + com.ublinux.libublsettingsui-gtk3.cancel-symbolic True