|
|
|
@ -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);
|
|
|
|
|