|
|
|
@ -265,11 +265,20 @@ void on_inspector_jornald_read_async(inspector_window *window){
|
|
|
|
|
fl = popen(get_journal_init_tree_command,"r");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
char output[4092];
|
|
|
|
|
char *output = g_malloc0(sizeof(char)*4096);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
main_config.remove_thread=0;
|
|
|
|
|
fd_set fds;
|
|
|
|
|
struct timeval tv;
|
|
|
|
|
int fd = fileno(fl);
|
|
|
|
|
while (main_config.remove_thread==0){
|
|
|
|
|
if(fgets(output,4092,fl)){
|
|
|
|
|
FD_ZERO(&fds);
|
|
|
|
|
FD_SET(fd, &fds);
|
|
|
|
|
tv.tv_sec = 1;
|
|
|
|
|
tv.tv_usec = 0;
|
|
|
|
|
if(select(fd + 1, &fds, NULL, NULL, &tv)){
|
|
|
|
|
output = fgets(output,4092,fl);
|
|
|
|
|
if((output)){
|
|
|
|
|
if(strcmp(output,"")){
|
|
|
|
|
gtk_list_store_append(window->list, &iter);
|
|
|
|
|
|
|
|
|
@ -288,14 +297,15 @@ void on_inspector_jornald_read_async(inspector_window *window){
|
|
|
|
|
identifier=yon_char_divide(iden,strlen(identifier)-strlen(log)-1);
|
|
|
|
|
free(iden);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&iter,0,identifier,1,log,-1);
|
|
|
|
|
free(temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// g_usleep(100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
main_config.inspector_thread=0;
|
|
|
|
|
pclose(fl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_inspector_update(GtkWidget *self, inspector_window *window){
|
|
|
|
|
int size;
|
|
|
|
@ -308,25 +318,25 @@ void on_inspector_update(GtkWidget *self, inspector_window *window){
|
|
|
|
|
if (self==window->ShowSinceBootButton){
|
|
|
|
|
window->last_mode=1;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->NewMessagesButton){
|
|
|
|
|
else if (self==window->NewMessagesButton){
|
|
|
|
|
window->last_mode=2;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->ShowKernelButton){
|
|
|
|
|
else if (self==window->ShowKernelButton){
|
|
|
|
|
window->last_mode=3;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->ShowPriorityButton){
|
|
|
|
|
else if (self==window->ShowPriorityButton){
|
|
|
|
|
window->last_mode=4;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->ShowAllBootsButton){
|
|
|
|
|
else if (self==window->ShowAllBootsButton){
|
|
|
|
|
window->last_mode=5;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->ShowAllUnitsButton){
|
|
|
|
|
else if (self==window->ShowAllUnitsButton){
|
|
|
|
|
window->last_mode=6;
|
|
|
|
|
}
|
|
|
|
|
if (self==window->ShowInitTreeButton){
|
|
|
|
|
else if (self==window->ShowInitTreeButton){
|
|
|
|
|
window->last_mode=7;
|
|
|
|
|
}
|
|
|
|
|
main_config.remove_thread++;
|
|
|
|
|
main_config.remove_thread=0;
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->JournaldTree),GTK_TREE_MODEL(window->list));
|
|
|
|
|
gtk_list_store_clear(window->list);
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->JournaldTree),GTK_TREE_MODEL(window->list));
|
|
|
|
@ -342,7 +352,6 @@ void on_inspector_update(GtkWidget *self, inspector_window *window){
|
|
|
|
|
dictionary *dict=NULL;
|
|
|
|
|
for_dictionaries (dict,window->terminals){
|
|
|
|
|
GtkWidget *terminal = (GtkWidget*)dict->data;
|
|
|
|
|
// window->journal_paths = yon_char_replace(window->journal_paths,"\n"," ");
|
|
|
|
|
yon_terminal_integrated_start(terminal,yon_char_unite("cat ",dict->key,NULL),NULL,NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -881,11 +890,6 @@ void on_logrotate_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
maxsize = yon_char_unite("maxsize ", yon_char_from_long(value),yon_size_get_letter_from_int(last),NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// int create_log_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CreateLogCombo));
|
|
|
|
|
// if (create_log_active){
|
|
|
|
|
// if (create_log_active==2)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
copytruncate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CutCheck)) ? "copytruncate" : "";
|
|
|
|
|
|
|
|
|
|
int compression_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->CompressionCombo));
|
|
|
|
@ -1220,10 +1224,6 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->RotateSizeMaxBeforeTimeSpin),atol(value));
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RotateSizeMaxBeforeTimeCheck),1);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RotateSizeMaxBeforeTimeCombo),yon_size_get_int_from_letter(value[strlen(value)-1]));
|
|
|
|
|
// }else if (!strcmp(parsed[i],"create")){
|
|
|
|
|
//
|
|
|
|
|
// }else if (!strcmp(parsed[i],"nocreate")){
|
|
|
|
|
//
|
|
|
|
|
}else if (strstr(parsed[i],"size")){
|
|
|
|
|
int sizemod = yon_size_get_int_from_letter(parsed[i][strlen(parsed[i])-1]);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->JournalMaxSizeSpin),atol(strstr(parsed[i], " ")+1));
|
|
|
|
@ -1325,9 +1325,7 @@ void on_logrotate_edit(GtkWidget *self, logrotate_window *window){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(dialog->LogNameEntry),name ? name : "");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(dialog->LogDescriptionEntry),description ? description : "");
|
|
|
|
|
gtk_widget_set_can_focus(dialog->LogNameEntry,0);
|
|
|
|
|
// gtk_widget_set_can_focus(dialog->LogDescriptionEntry,0);
|
|
|
|
|
gtk_entry_set_has_frame(GTK_ENTRY(dialog->LogNameEntry),0);
|
|
|
|
|
// gtk_entry_set_has_frame(GTK_ENTRY(dialog->LogDescriptionEntry),0);
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(dialog->LogNameEntry),"nobackground");
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(dialog->LogDescriptionEntry),"nobackground");
|
|
|
|
|
}
|
|
|
|
@ -2007,8 +2005,6 @@ void on_log_edit(GtkWidget *self,main_window *widgets){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->LogrotateButton),"clicked", G_CALLBACK(on_log_edit_logrotate_settings),dict);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->MetalogButton),"clicked", G_CALLBACK(on_log),widgets);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->SyslogButton),"clicked", G_CALLBACK(yon_journald_open),widgets);
|
|
|
|
|
}
|
|
|
|
|
window->log_name=name;
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->LogDescriptionEntry),description ? description : "");
|
|
|
|
@ -2214,7 +2210,7 @@ void on_permissions_changed(){
|
|
|
|
|
char *command[] = {"/bin/pkexec","/bin/echo","1", NULL};
|
|
|
|
|
gchar *standard_output = NULL;
|
|
|
|
|
gchar *standard_error = NULL;
|
|
|
|
|
gint exit_status = -1; // Инициализируем переменную для статуса выхода
|
|
|
|
|
gint exit_status = -1;
|
|
|
|
|
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
gboolean success = g_spawn_sync(
|
|
|
|
@ -2279,11 +2275,7 @@ void config_init(){
|
|
|
|
|
g_printerr ("Parent process was reaped by init(1)\n");
|
|
|
|
|
}
|
|
|
|
|
subject = polkit_unix_process_new_for_owner (parent_pid,0,getuid());
|
|
|
|
|
main_config.permissions = polkit_permission_new_sync(
|
|
|
|
|
"com.ublinux.ubl-settings-logging",
|
|
|
|
|
subject, // Пользователь (текущий пользователь)
|
|
|
|
|
NULL, // Опции (NULL, если не требуются)
|
|
|
|
|
NULL);
|
|
|
|
|
main_config.permissions = polkit_permission_new_sync("com.ublinux.ubl-settings-logging",subject,NULL,NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(main_config.permissions),"notify::allowed",G_CALLBACK(on_permissions_changed),NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2378,7 +2370,6 @@ main_window *setup_window(){
|
|
|
|
|
services[i]=yon_char_divide_search(services[i],"\n",-1);
|
|
|
|
|
config_str log = yon_char_parse(services[i],&log_size,";");
|
|
|
|
|
gtk_list_store_append(widgets->ServicesList,&iter);
|
|
|
|
|
// yon_config_load
|
|
|
|
|
gtk_list_store_set(widgets->ServicesList,&iter,0,1,1,1,2,log[0],3,_(log[1]),4,log[2],5,log[3],6,log[4],7,log[5],8,log[6],-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2421,13 +2412,11 @@ main_window *setup_window(){
|
|
|
|
|
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->MainTree));
|
|
|
|
|
for (int i=0; i<g_list_length(list);i++){
|
|
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("column",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
|
// yon_gtk_column_minimal_fixed_size_set((GtkTreeViewColumn*)g_list_nth_data(list,i));
|
|
|
|
|
}
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->ServicesTree));
|
|
|
|
|
for (int i=0; i<g_list_length(list);i++){
|
|
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("servicecolumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
|
// yon_gtk_column_minimal_fixed_size_set((GtkTreeViewColumn*)g_list_nth_data(list,i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main_config.groups = yon_file_open(group_list_path,&main_config.groups_size);
|
|
|
|
|