diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 85524d5..e867e87 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -1370,6 +1370,26 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){ } } +void on_rules_changed(GtkEditable *editable, const gchar *text, gint length, gint *position){ +gchar *new_text = g_new(gchar, length + 1); + gint i, j = 0; + + for (i = 0; i < length; i++) { + if (text[i]>'0'&&text[i]<'7') { + new_text[j] = text[i]; + j++; + } + } + if (j < length) { + g_signal_handlers_block_by_func(editable, G_CALLBACK(on_rules_changed), NULL); + gtk_editable_insert_text(editable, new_text, j, position); + g_signal_handlers_unblock_by_func(editable, G_CALLBACK(on_rules_changed), NULL); + g_signal_stop_emission_by_name(editable, "insert-text"); + } + + g_free(new_text); +} + logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_window *dialog, char *log_name){ logrotate_configure_window *window = malloc(sizeof(logrotate_configure_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_logrotate_path); @@ -1435,6 +1455,7 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind window->CommandAfterEntry=yon_gtk_builder_get_widget(builder,"CommandAfterEntry"); window->EndworkCommandEntry=yon_gtk_builder_get_widget(builder,"EndworkCommandEntry"); window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + g_signal_connect(G_OBJECT(window->CreateLogEntry),"insert-text",G_CALLBACK(on_rules_changed),NULL); gtk_window_set_title(GTK_WINDOW(window->MainWindow),LOGROTATE_TITLE_LABEL); if (dialog) @@ -1463,6 +1484,12 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind } yon_entry_set_entry_type(GTK_ENTRY(window->EmailEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->FileAmountEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->CommandBeforeOnceEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->CommandAfterOnceEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->CommandBeforeEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->CommandAfterEntry),GTK_BOX(window->StatusBox)); + yon_entry_set_entry_type(GTK_ENTRY(window->EndworkCommandEntry),GTK_BOX(window->StatusBox)); dictionary *dict=NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"dialog",dialog); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); diff --git a/source/ubl-settings-logging.h b/source/ubl-settings-logging.h index 1f4cdfa..1e88364 100644 --- a/source/ubl-settings-logging.h +++ b/source/ubl-settings-logging.h @@ -457,4 +457,5 @@ void yon_main_window_complete(template_main_window **window); void on_logrotate_apps_configure_activate(GtkWidget *, GtkTreePath*, GtkTreeViewColumn*,logrotate_window *window); void on_logrotate_edit_activate(GtkWidget*,GtkTreePath*,GtkTreeViewColumn*, logrotate_window *window); void on_logrotate_closed(GtkWidget *,logrotate_window *window); +void on_rules_changed(GtkEditable *editable, const gchar *text, gint length, gint *position); int main(int argc, char *argv[]); \ No newline at end of file diff --git a/ubl-settings-logging-logrotate.glade b/ubl-settings-logging-logrotate.glade index 452802f..3ce8738 100644 --- a/ubl-settings-logging-logrotate.glade +++ b/ubl-settings-logging-logrotate.glade @@ -1,5 +1,5 @@ - + @@ -1233,6 +1233,7 @@ True False True + 3 False