From 0c33cc8bf2e778fd529769e9e8a1d653184d00a7 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 22 Jan 2026 10:24:55 +0000 Subject: [PATCH 1/2] Template update --- source/CMakeLists.txt | 12 ++-- source/ubl-settings-logging.c | 128 +++++++++++++++++----------------- source/ubl-settings-logging.h | 8 +-- ubl-settings-logging.desktop | 0 4 files changed, 74 insertions(+), 74 deletions(-) mode change 100644 => 100755 ubl-settings-logging.desktop diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c111278..7291dc9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -12,17 +12,17 @@ pkg_check_modules(VTE291 REQUIRED vte-2.91) include_directories(${VTE291_INCLUDE_DIRS}) link_directories(${VTE291_LIBRARY_DIRS}) add_definitions(${VTE291_CFLAGS_OTHER}) +add_definitions(-DVTE_INCLUDE) -pkg_check_modules(POLKIT REQUIRED polkit-gobject-1) -include_directories(${POLKIT_INCLUDE_DIRS}) -link_directories(${POLKIT_LIBRARY_DIRS}) -add_definitions(${POLKIT_CFLAGS_OTHER}) +# pkg_check_modules(POLKIT REQUIRED polkit-gobject-1) +# include_directories(${POLKIT_INCLUDE_DIRS}) +# link_directories(${POLKIT_LIBRARY_DIRS}) +# add_definitions(${POLKIT_CFLAGS_OTHER}) find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) -option(WEBKIT_FOUND "No" OFF) if(WEBKIT_LIBRARIES_FOUND) - option(WEBKIT_FOUND "Yes" ON) +add_definitions(-DWEBKIT_INCLUDE) PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0) include_directories(${WEBKIT_INCLUDE_DIRS}) link_directories(${WEBKIT_LIBRARY_DIRS}) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index 949d596..d7e14a4 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -2936,73 +2936,73 @@ void on_enable_disable_clicked(GtkButton *, main_window *widgets){ } // standard functions -gboolean on_unelevate(main_window* widgets); -gboolean on_unelevate(main_window* widgets){ - yon_ubl_status_box_render(UNAUTHTORIZED_LABEL,BACKGROUND_IMAGE_INFO_TYPE); - gtk_widget_set_sensitive(widgets->UpgradePermissionsMenuItem,1); - g_object_unref(main_config.authorization_result); - main_config.authorization_result=NULL; - return G_SOURCE_REMOVE; -} -gboolean yon_timeoutcheck_authtorization(gpointer widgets); -gboolean yon_timeoutcheck_authtorization(gpointer widgets){ - - if (!polkit_authorization_result_get_is_authorized(main_config.authorization_result)){ - gdk_threads_add_idle((GSourceFunc)on_unelevate,widgets); - return G_SOURCE_REMOVE; - } - return G_SOURCE_CONTINUE; -} - -void *yon_authorized_loop(void*); -void *yon_authorized_loop(void*){ - while (polkit_authorization_result_get_is_authorized(main_config.authorization_result)){ - g_mutex_lock(&main_config.authorized_mutex); - if (main_config.queue){ - for (int i=0;ifunc)(main_config.queue[i]->data); - } - free(main_config.queue); - main_config.queue=NULL; - main_config.queue_size=0; - } - g_mutex_unlock(&main_config.authorized_mutex); - } - return NULL; -} +// gboolean on_unelevate(main_window* widgets); +// gboolean on_unelevate(main_window* widgets){ +// yon_ubl_status_box_render(UNAUTHTORIZED_LABEL,BACKGROUND_IMAGE_INFO_TYPE); +// gtk_widget_set_sensitive(widgets->UpgradePermissionsMenuItem,1); +// g_object_unref(main_config.authorization_result); +// main_config.authorization_result=NULL; +// return G_SOURCE_REMOVE; +// } +// gboolean yon_timeoutcheck_authtorization(gpointer widgets); +// gboolean yon_timeoutcheck_authtorization(gpointer widgets){ + +// if (!polkit_authorization_result_get_is_authorized(main_config.authorization_result)){ +// gdk_threads_add_idle((GSourceFunc)on_unelevate,widgets); +// return G_SOURCE_REMOVE; +// } +// return G_SOURCE_CONTINUE; +// } -void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets); -void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets){ - GError *err = NULL; - main_config.authorization_result = polkit_authority_check_authorization_finish(POLKIT_AUTHORITY(source),res,&err); - if (err){ +// void *yon_authorized_loop(void*); +// void *yon_authorized_loop(void*){ +// while (polkit_authorization_result_get_is_authorized(main_config.authorization_result)){ +// g_mutex_lock(&main_config.authorized_mutex); +// if (main_config.queue){ +// for (int i=0;ifunc)(main_config.queue[i]->data); +// } +// free(main_config.queue); +// main_config.queue=NULL; +// main_config.queue_size=0; +// } +// g_mutex_unlock(&main_config.authorized_mutex); +// } +// return NULL; +// } - } +// void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets); +// void authorize_callback(GObject *source, GAsyncResult *res, main_window *widgets){ +// GError *err = NULL; +// main_config.authorization_result = polkit_authority_check_authorization_finish(POLKIT_AUTHORITY(source),res,&err); +// if (err){ - g_thread_new("auth_loop",(GThreadFunc)yon_authorized_loop,NULL); - yon_ubl_status_box_render(AUTHTORIZED_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); - g_timeout_add(10000, (GSourceFunc)yon_timeoutcheck_authtorization,widgets); +// } + +// g_thread_new("auth_loop",(GThreadFunc)yon_authorized_loop,NULL); +// yon_ubl_status_box_render(AUTHTORIZED_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); +// g_timeout_add(10000, (GSourceFunc)yon_timeoutcheck_authtorization,widgets); -} +// } -void on_permissions_changed(GtkMenuItem *,main_window *widgets){ - PolkitAuthority *authority; - GError *error = NULL; - authority = polkit_authority_get_sync(NULL,&error); - if (!authority){ - return; - } - polkit_authority_check_authorization( - authority, - main_config.process, - "org.freedesktop.policykit.exec", - NULL, - POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, - NULL, - (GAsyncReadyCallback)authorize_callback, - widgets - ); -} +// void on_permissions_changed(GtkMenuItem *,main_window *widgets){ +// PolkitAuthority *authority; +// GError *error = NULL; +// authority = polkit_authority_get_sync(NULL,&error); +// if (!authority){ +// return; +// } +// polkit_authority_check_authorization( +// authority, +// main_config.process, +// "org.freedesktop.policykit.exec", +// NULL, +// POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, +// NULL, +// (GAsyncReadyCallback)authorize_callback, +// widgets +// ); +// } void config_init(){ main_config.always_open_documentation=0; @@ -3019,7 +3019,7 @@ void config_init(){ main_config.save_config=1; main_config.queue=NULL; main_config.queue_size=0; - main_config.process = polkit_unix_process_new_for_owner(getpid(),0,getuid()); + // main_config.process = polkit_unix_process_new_for_owner(getpid(),0,getuid()); pid_t parent_pid; parent_pid = getppid (); if (parent_pid == 1) @@ -3228,7 +3228,7 @@ void yon_main_window_complete(template_main_window **window){ g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_load_local),NULL); g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),NULL); - g_signal_connect(G_OBJECT(widgets->UpgradePermissionsMenuItem),"activate",G_CALLBACK(on_permissions_changed),widgets); + // 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->ServicesTree),"cursor-changed",G_CALLBACK(on_main_window_services_tree_selection_changed),widgets); diff --git a/source/ubl-settings-logging.h b/source/ubl-settings-logging.h index b78d192..b47825b 100644 --- a/source/ubl-settings-logging.h +++ b/source/ubl-settings-logging.h @@ -14,11 +14,11 @@ #include #include #include -#ifdef WEBKIT_FOUND +#ifdef WEBKIT_INCLUDE #include #endif #include "ubl-strings.h" -#include +// #include #define WIKI_LINK "https://wiki.ublinux.ru/software/programs_and_utilities/all/ubl-settings-logging" @@ -126,8 +126,8 @@ typedef struct { pthread_t inspector_thread; int remove_thread; - PolkitAuthorizationResult *authorization_result; - PolkitSubject *process; + // PolkitAuthorizationResult *authorization_result; + // PolkitSubject *process; queue_func** queue; int queue_size; diff --git a/ubl-settings-logging.desktop b/ubl-settings-logging.desktop old mode 100644 new mode 100755 From 7e20fcf2ff7ed05e1d6d9005cfc3f074cde654db Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 28 Jan 2026 10:00:07 +0600 Subject: [PATCH 2/2] Removed comments --- source/ubl-settings-logging.c | 55 ----------------------------------- 1 file changed, 55 deletions(-) diff --git a/source/ubl-settings-logging.c b/source/ubl-settings-logging.c index d7e14a4..1796d02 100644 --- a/source/ubl-settings-logging.c +++ b/source/ubl-settings-logging.c @@ -158,7 +158,6 @@ void on_load_local(){ void on_config_custom_load(GtkWidget *,main_window *){ yon_load_proceed(YON_CONFIG_CUSTOM); main_config.load_mode=YON_CONFIG_CUSTOM; - // yon_interface_update(widgets); } void on_save_global_local(){ @@ -191,7 +190,6 @@ void on_save_done(main_window *, config_str output, int size){ free(final_output); } yon_char_parsed_free(output,size); - // yon_interface_update(widgets); textdomain(template_ui_LocaleName); switch (main_config.save_config){ @@ -321,9 +319,6 @@ void on_inspector_jornald_read_async(inspector_window *window){ } void on_inspector_update(GtkWidget *self, inspector_window *window){ - // int size; - // GtkTextIter titer; - // config_str output; if (!strcmp(window->journal_name,"journald")){ if(self!=window->UpdateButton){ gtk_style_context_remove_class(gtk_widget_get_style_context(window->ShowKernelButton),"chosenOutline"); @@ -341,7 +336,6 @@ void on_inspector_update(GtkWidget *self, inspector_window *window){ gtk_widget_set_sensitive(window->ShowPriorityButton,1); gtk_widget_set_sensitive(window->ShowSinceBootButton,1); } - // GtkWidget *terminal = (GtkWidget*)window->terminals->first->data; gtk_widget_hide(window->LoggingNotebook); gtk_widget_show(gtk_widget_get_parent(window->JournaldTree)); if (self==window->ShowSinceBootButton){ @@ -694,7 +688,6 @@ void on_logrotate_configuration_path_add(GtkWidget *, logrotate_configure_window GtkTreeIter iter; gtk_list_store_append(window->list, &iter); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(window->LogPathsTree),0); - // GList *list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); gtk_tree_view_set_cursor(GTK_TREE_VIEW(window->LogPathsTree),gtk_tree_model_get_path(model,&iter),column,1); } @@ -703,7 +696,6 @@ void on_path_editing_done(GtkCellRendererText* ,gchar* gtkpath,gchar* new_text,l char *cur_path; gtk_tree_model_get_iter(GTK_TREE_MODEL(window->list),&iter,gtk_tree_path_new_from_string(gtkpath)); gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1); - // int deleted=0; if (!strcmp(new_text,"")||(cur_path&&!strcmp(cur_path,""))) gtk_list_store_remove(window->list,&iter); @@ -741,7 +733,6 @@ void on_logrotate_configuration_path_edit(GtkWidget *, logrotate_configure_windo GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->LogPathsTree)),&model,&iter)){ GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(window->LogPathsTree),0); - // GList *list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); gtk_tree_view_set_cursor(GTK_TREE_VIEW(window->LogPathsTree),gtk_tree_model_get_path(model,&iter),column,1); } } @@ -1056,8 +1047,6 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){ return; } if (on_logrotate_check_repeats(NULL,window)==1) return; - // GtkTreeIter *lastiter; - // GtkTreeIter *lastitar; for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ char *cur_path; gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&cur_path,-1); @@ -1066,8 +1055,6 @@ void on_logrotate_save(GtkWidget *, dictionary *dict){ } path_amount++; paths = yon_char_unite(paths,strcmp(paths,"") ? "," : "", cur_path,NULL); - // lastiter=gtk_tree_iter_copy(&iter); - // lastitar=gtk_tree_iter_copy(&iter); } if(!window->paths) { if (matched==path_amount) { @@ -1493,7 +1480,6 @@ logrotate_configure_window *yon_logrotate_window_new(char *paths, logrotate_wind g_signal_connect(G_OBJECT(window->PathCell),"editing-canceled",G_CALLBACK(on_path_editing_cancel),window); g_signal_connect(G_OBJECT(window->LogPathAddButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_open),window); g_signal_connect(G_OBJECT(window->LogPathEditButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_filechooser_open),window); - // g_signal_connect(G_OBJECT(window->LogPathsTree),"changed",G_CALLBACK(on_logrotate_paths_done),window); g_signal_connect(G_OBJECT(window->LogPathRemoveButton),"clicked",G_CALLBACK(on_logrotate_configuration_path_remove),window); g_signal_connect(G_OBJECT(window->RotationPeriodCheck),"toggled",G_CALLBACK(on_logrotate_period_check_toggled),window); @@ -2314,8 +2300,6 @@ void on_journald_open(GtkWidget *self, main_window *widgets){ gtk_entry_set_text(GTK_ENTRY(window->LogDescriptionLabel),description); gtk_entry_set_text(GTK_ENTRY(window->LogNameLabel),name); } - // int jsize; - // config_str journald_parameters = yon_config_get_all_by_key("JOURNALD[",&jsize); gtk_widget_show(window->MainWindow); } @@ -2355,7 +2339,6 @@ void on_log_save(GtkWidget *self, dictionary *dict){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEAT_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } - // GtkTreeIter iter; char *name = (char*)gtk_entry_get_text(GTK_ENTRY(window->NameEntry)); char *desc = (char*)gtk_entry_get_text(GTK_ENTRY(window->LogDescriptionEntry)); if (!yon_char_is_empty(name)){ @@ -2577,8 +2560,6 @@ void on_log_path_append(GtkWidget *self, add_log_window *window){ } void on_log_add(GtkWidget *, main_window *widgets){ - // GtkTreeModel *model = GTK_TREE_MODEL(widgets->list); - // GtkTreeIter iter; add_log_window *window = on_add_open(widgets); yon_window_config_custom_window_get(GTK_WINDOW(window->MainWindow),"AddWindow"); g_signal_connect(G_OBJECT(window->CancelButton),"clicked", G_CALLBACK(on_subwindow_close),NULL); @@ -2823,7 +2804,6 @@ void on_main_window_services_tree_selection_changed(GtkWidget *,main_window *wid gtk_tree_model_get(model,&iter,0,&is_active,1,&is_enabled,2,&name,-1); if (is_active){ gtk_widget_set_sensitive(widgets->ServicesEditButton,1); - // gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,0)),1); gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,1)),1); gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),stop_icon_name,GTK_ICON_SIZE_BUTTON); GList *item = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,0))); @@ -2833,7 +2813,6 @@ void on_main_window_services_tree_selection_changed(GtkWidget *,main_window *wid g_list_free(items); } else { gtk_widget_set_sensitive(widgets->ServicesEditButton,0); - // gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,0)),1); gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,1)),0); gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),start_icon_name,GTK_ICON_SIZE_BUTTON); GList *item = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,0))); @@ -2842,34 +2821,12 @@ void on_main_window_services_tree_selection_changed(GtkWidget *,main_window *wid g_list_free(item); g_list_free(items); } - // if (is_enabled){ - // gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),disable_icon_name,GTK_ICON_SIZE_BUTTON); - // GList *item = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,1))); - // GList *items = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(item,0))); - // gtk_image_set_from_icon_name(GTK_IMAGE(g_list_nth_data(items,0)),disable_icon_name,GTK_ICON_SIZE_BUTTON); - // gtk_label_set_text(GTK_LABEL(g_list_nth_data(items,1)),AUTOSTART_OFF_LABEL); - // g_list_free(item); - // g_list_free(items); - // } else { - // gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),enable_icon_name,GTK_ICON_SIZE_BUTTON); - // GList *item = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,1))); - // GList *items = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(item,0))); - // gtk_image_set_from_icon_name(GTK_IMAGE(g_list_nth_data(items,0)),enable_icon_name,GTK_ICON_SIZE_BUTTON); - // gtk_label_set_text(GTK_LABEL(g_list_nth_data(items,1)),AUTOSTART_ON_LABEL); - // g_list_free(item); - // g_list_free(items); - // } if (!strcmp(name,"journald")){ - // gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,0)),0); - // gtk_widget_set_sensitive(GTK_WIDGET(g_list_nth_data(list,1)),0); - // gtk_widget_set_sensitive(widgets->ServicesControlButton,0); - // gtk_widget_set_tooltip_text(widgets->ServicesControlButton,AUTOSTART_OFF_LABEL); } g_list_free(list); } else { gtk_widget_set_sensitive(widgets->ServicesEditButton,0); gtk_widget_set_sensitive(widgets->ServicesControlButton,0); - // gtk_widget_set_tooltip_text(widgets->ServicesControlButton,AUTOSTART_ON_LABEL); } } @@ -2918,19 +2875,11 @@ void on_enable_disable_clicked(GtkButton *, main_window *widgets){ gtk_list_store_set(widgets->ServicesList,&iter,1,0,-1); gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),start_icon_name,GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name(GTK_IMAGE(g_list_nth_data(box,0)),start_icon_name,GTK_ICON_SIZE_BUTTON); - // gtk_widget_set_tooltip_text(widgets->ServicesControlButton,AUTOSTART_ON_LABEL); } else { - /* - g_mutex_lock(&main_config.authorized_mutex); - main_config.queue_size += 1; - main_config.queue = yon_remalloc(main_config.queue,sizeof(queue_func**)*(main_config.queue_size)); - main_config.queue[main_config.queue_size-1] = yon_queue_add_function(G_SOURCE_FUNC(system),start_command); - g_mutex_unlock(&main_config.authorized_mutex);*/ yon_launch(start_command); gtk_list_store_set(widgets->ServicesList,&iter,1,1,-1); gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->ServicesControlButton))),stop_icon_name,GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name(GTK_IMAGE(g_list_nth_data(box,0)),stop_icon_name,GTK_ICON_SIZE_BUTTON); - // gtk_widget_set_tooltip_text(widgets->ServicesControlButton,AUTOSTART_OFF_LABEL); } } } @@ -3019,7 +2968,6 @@ void config_init(){ main_config.save_config=1; main_config.queue=NULL; main_config.queue_size=0; - // main_config.process = polkit_unix_process_new_for_owner(getpid(),0,getuid()); pid_t parent_pid; parent_pid = getppid (); if (parent_pid == 1) @@ -3174,7 +3122,6 @@ void yon_main_window_complete(template_main_window **window){ size =0; config_str custom_watchers = yon_file_open(custom_logs_saving_file_path,&size); if (custom_watchers){ - // GtkTreeIter itar; for (int i=0;iHeadInfoLabel,"head-text","label",YON_TYPE_STRING); /* Signal connection | Присоединение сигналов */ g_signal_connect(G_OBJECT(widgets->InspectButton),"clicked",G_CALLBACK(on_inspector_open),widgets); @@ -3245,7 +3191,6 @@ void yon_main_window_complete(template_main_window **window){ SERVICE_MANAGEMENT_TOOLTIP,start_icon_name,G_CALLBACK(on_service_manage),widgets, CONFIGURE_SERVICE_LABEL,settings_icon_name,G_CALLBACK(on_service_edit),widgets, NULL); - // yon_rmb_menu_setup(widgets->ServicesTree,(RmbCheck)gtk_widget_get_sensitive,widgets->MainTree,CONFIGURE_LOG_LABEL,edit_icon_name,G_CALLBACK(on_log_edit),widgets,ADD_LOG_LABEL,add_icon_name,G_CALLBACK(on_log_add),widgets,REMOVE_LOG_LABEL,remove_icon_name,G_CALLBACK(on_log_remove),widgets,NULL); yon_window_config_setup(GTK_WINDOW(widgets->Window)); yon_window_config_load(config_path);