From 20624aba9ee2727d528c81207a0355d8205b2bb3 Mon Sep 17 00:00:00 2001 From: Dmitry Razumov Date: Thu, 28 Nov 2024 23:52:30 +0600 Subject: [PATCH 01/11] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D0=BD=D0=B0=20'com.ublinux.ubl-settings-resou?= =?UTF-8?q?rcequota.policy'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.ublinux.ubl-settings-resourcequota.policy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.ublinux.ubl-settings-resourcequota.policy b/com.ublinux.ubl-settings-resourcequota.policy index 7ddcc9b..b00df3b 100644 --- a/com.ublinux.ubl-settings-resourcequota.policy +++ b/com.ublinux.ubl-settings-resourcequota.policy @@ -13,9 +13,9 @@ Authentication is required to run ubl-settings-resourcequota Требуется авторизация для запуска утилиты ubl-settings-resourcequota с правами root - auth_admin - auth_admin - auth_admin + auth_admin_keep + auth_admin_keep + auth_admin_keep /usr/bin/ubl-settings-resourcequota true From 22e6e8b4f3a5343c7fa812ae9650669daf429bd0 Mon Sep 17 00:00:00 2001 From: asmeron Date: Mon, 2 Jun 2025 22:02:22 +0600 Subject: [PATCH 02/11] Fix uninstall --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 21263cf..2e62183 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ uninstall: done @for FILE_ICON in $(wildcard icons/*/*.svg); do \ SUB_NAME=$${FILE_ICON#*/}; SUB_NAME=$${SUB_NAME%/*}; \ - $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/$${SUB_NAME}/$${FILE_ICON}"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/$${SUB_NAME}/$${FILE_ICON##*/}"; \ done @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" From d7b707d4bb0d172b34f98597ed74d4774d68aa51 Mon Sep 17 00:00:00 2001 From: asmeron Date: Mon, 2 Jun 2025 23:35:34 +0600 Subject: [PATCH 03/11] Fixed ubl-settings-manager opening --- source/ubl-settings-resourcequota.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 0e8be93..c77a4c7 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -1308,7 +1308,6 @@ void yon_main_window_complete(main_window *widgets){ main_config.processes = yon_config_load(get_processes_command,&main_config.processes_size); main_config.slices = yon_config_load(get_slices_command,&main_config.slices_size); on_info_target_type_switched(widgets->TargetTypeCombo,widgets); - gtk_widget_show(widgets->Window); } yon_root_button_setup((template_main_window*)widgets,main_config.launch_arguments,main_config.launch_size); From 9788a58676e877eb30ad33fada8363264e6a7520 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 04:56:50 +0000 Subject: [PATCH 04/11] Optimise out fix --- source/ubl-settings-resourcequota.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index c77a4c7..3edf250 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -302,25 +302,25 @@ void on_quotas_save(GtkWidget *self, dictionary *windows){ char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL; char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL; char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL; - char *read_limit = ""; - char *read_devices = ""; + char *read_limit = NULL; + char *read_devices = NULL; dictionary *dict; for_dictionaries(dict,window->devices){ if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read) - read_devices = yon_char_unite(read_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL); + read_devices = yon_char_unite(read_devices?read_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL); } - if (read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0'; - read_limit = yon_char_unite(read_limit,read_devices,NULL); + if (!yon_char_is_empty(read_devices)&&read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0'; + read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL); - char *write_limit = ""; - char *write_devices = ""; + char *write_limit = NULL; + char *write_devices = NULL; for_dictionaries(dict,window->devices){ if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write) - write_devices = yon_char_unite(write_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL); + write_devices = yon_char_unite(write_devices?write_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL); } - if (write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0'; - write_limit = yon_char_unite(write_limit,write_devices,NULL); + if (!yon_char_is_empty(write_devices)&&write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0'; + write_limit = yon_char_unite(write_limit?write_limit:"",write_devices,NULL); gtk_list_store_append(main_config.list,&iter); gtk_list_store_set(main_config.list,&iter,0,type,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1); yon_config_register(CGROUP_QUOTA((char*)target),CGROUP_QUOTA_comd((char*)target),yon_char_new((char*)string)); From 98711bc2736c0389f7bb02d187337d82dedbbaf6 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 09:16:53 +0000 Subject: [PATCH 05/11] Optimise out fix --- source/ubl-settings-resourcequota.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 3edf250..0080858 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -875,25 +875,25 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){ char *hard = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->HardRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->HardRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->HardRestrictionCombo))) : NULL; char *paging = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PagingLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PagingLimitSpin))),get_size_mod(GTK_COMBO_BOX(window->PagingLimitCombo))) : NULL; char *cpu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CpuLimitCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))),"%") : NULL; - char *read_limit = ""; - char *read_devices = ""; + char *read_limit = NULL; + char *read_devices = NULL; dictionary *dict; for_dictionaries(dict,window->devices){ if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->read) - read_devices = yon_char_unite(read_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL); + read_devices = yon_char_unite(read_devices?read_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->read,"\n",NULL); } if (read_devices[strlen(read_devices)-1]=='\n') read_devices[strlen(read_devices)-1]='\0'; - read_limit = yon_char_unite(read_limit,read_devices,NULL); + read_limit = yon_char_unite(read_limit?read_limit:"",read_devices,NULL); - char *write_limit = ""; - char *write_devices = ""; + char *write_limit = NULL; + char *write_devices = NULL; for_dictionaries(dict,window->devices){ if (dict->data&&yon_dictionary_get_data(dict,device_limits*)->write) - write_devices = yon_char_unite(write_devices,"",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL); + write_devices = yon_char_unite(write_devices?write_devices:"","",yon_char_divide_search(yon_char_new(dict->key)," ",-1)," ",yon_dictionary_get_data(dict,device_limits*)->write,"\n",NULL); } if (write_devices[strlen(write_devices)-1]=='\n') write_devices[strlen(write_devices)-1]='\0'; - write_limit = yon_char_unite(write_limit,write_devices,NULL); + write_limit = yon_char_unite(write_limit?write_limit:"",write_devices,NULL); gtk_list_store_set(main_config.list,&iter,1,target,2,soft,3,hard,4,paging,5,cpu,6,read_limit,7,write_limit,8,string,-1); yon_config_register(CGROUP_QUOTA(target),CGROUP_QUOTA_comd(target),(char*)string); on_subwindow_close(self); From 5f4e3f3b01266c93cb71bae36c512120ba04db6a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 09:33:50 +0000 Subject: [PATCH 06/11] Global and local config save success message fix --- source/ubl-settings-resourcequota.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 0080858..d6f22f0 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -17,7 +17,7 @@ void on_save_done(main_window *, config_str output, int size){ case 1: yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); break; - case 2: + case 3: yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); break; } From be0547cd19e26071d4e78edb7fd42e4949e3f354 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 09:39:33 +0000 Subject: [PATCH 07/11] config load fix --- source/ubl-settings-resourcequota.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index d6f22f0..9b0e02a 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -1309,7 +1309,7 @@ void yon_main_window_complete(main_window *widgets){ main_config.slices = yon_config_load(get_slices_command,&main_config.slices_size); on_info_target_type_switched(widgets->TargetTypeCombo,widgets); } - + on_config_local_load(NULL,widgets); yon_root_button_setup((template_main_window*)widgets,main_config.launch_arguments,main_config.launch_size); yon_save_window_set_postsave_function(on_save_done,widgets); } From 18aaef2d7adc3bb054d1cf34c93e081dd905ab7d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 10:10:46 +0000 Subject: [PATCH 08/11] Fixed missing funnel icon --- ubl-settings-resourcequota.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubl-settings-resourcequota.glade b/ubl-settings-resourcequota.glade index f3c35fe..07598a6 100644 --- a/ubl-settings-resourcequota.glade +++ b/ubl-settings-resourcequota.glade @@ -331,7 +331,7 @@ limit True False - com.ublinux.ubl-settings-resourcequota.funnel-symbolic + com.ublinux.libublsettingsui-gtk3.funnel-symbolic False From 187850c88cba1cbd4c27d3f3386419993b8fa60b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 11:12:06 +0000 Subject: [PATCH 09/11] Fixed spin button buttons --- source/ubl-settings-resourcequota.c | 3 ++- source/ubl-settings-resourcequota.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 9b0e02a..09a64bd 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -1163,7 +1163,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){ } } -void on_dispatcher_update(GtkWidget *,main_window *widgets){ +gboolean on_dispatcher_update(GtkWidget *,main_window *widgets){ int interval = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->DispatcherUpdateSpin)); if (interval>0) { char* str_second = yon_char_from_int(interval); @@ -1177,6 +1177,7 @@ void on_dispatcher_update(GtkWidget *,main_window *widgets){ g_object_set_property(G_OBJECT(widgets->DispatcherUpdateSpin),"has-focus",val); g_free(val); } + return 0; } void on_processes_update(GtkWidget *,main_window *widgets){ diff --git a/source/ubl-settings-resourcequota.h b/source/ubl-settings-resourcequota.h index 1146aed..1056df7 100644 --- a/source/ubl-settings-resourcequota.h +++ b/source/ubl-settings-resourcequota.h @@ -189,7 +189,7 @@ void config_init(); void on_info_target_type_switched(GtkWidget *self, main_window *widgets); void on_tab_changed(GtkWidget *self, GtkWidget *page, int page_num, main_window *widgets); void on_processes_update(GtkWidget *self,main_window *widgets); -void on_dispatcher_update(GtkWidget *self,main_window *widgets); +gboolean on_dispatcher_update(GtkWidget *self,main_window *widgets); void on_edit_open(GtkWidget *self, main_window *widgets); void on_quotas_edit(GtkWidget *self, dictionary *windows); void on_remove(GtkWidget *self, main_window *widgets); From ef3894c19b0335900aa361455d49b162ab45bec4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 11:44:47 +0000 Subject: [PATCH 10/11] Command changed --- source/ubl-settings-resourcequota.c | 7 ++++--- source/ubl-settings-resourcequota.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 09a64bd..b3673ce 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -801,7 +801,7 @@ void on_add_open(GtkWidget *, main_window *widgets){ void on_information_chosen_changed(GtkWidget *self, main_window *widgets){ const char *chosen = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(self)); if (chosen){ - char *command = yon_char_unite(get_information_command, (char*)chosen," --no-pager",NULL); + char *command = get_information_command((char*)chosen); main_config.last_info = yon_char_new((char*)chosen); vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1); yon_terminal_integrated_start(widgets->InformationTerminal, command); @@ -824,7 +824,7 @@ void on_information(GtkWidget *, main_window *widgets){ } gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->TargetCombo),yon_gtk_combo_box_text_find(widgets->TargetCombo,name)); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TargetCombo),on_information_chosen_changed,widgets); - char *command = yon_char_unite(get_information_command, (char*)name," --no-pager",NULL); + char *command = get_information_command((char*)name); main_config.last_info = yon_char_new((char*)name); vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1); yon_terminal_integrated_start(widgets->InformationTerminal, command); @@ -835,7 +835,7 @@ void on_information(GtkWidget *, main_window *widgets){ } void on_information_update(GtkWidget *, main_window *widgets){ - char *command = yon_char_unite(get_information_command, main_config.last_info," --no-pager",NULL); + char *command = get_information_command(main_config.last_info); vte_terminal_reset(VTE_TERMINAL(widgets->InformationTerminal),1,1); yon_terminal_integrated_start(widgets->InformationTerminal, command); } @@ -1169,6 +1169,7 @@ gboolean on_dispatcher_update(GtkWidget *,main_window *widgets){ char* str_second = yon_char_from_int(interval); char *command = yon_char_unite(get_dispatcher_command," -d ",str_second,NULL); if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->DispatcherUpdateCheck))) command = yon_char_append(command," -n 1"); + vte_terminal_reset(VTE_TERMINAL(widgets->DispatcherTerminal),1,1); yon_terminal_integrated_start_shell(widgets->DispatcherTerminal, command,NULL,NULL); free(str_second); GValue *val = g_malloc0(sizeof(GValue)); diff --git a/source/ubl-settings-resourcequota.h b/source/ubl-settings-resourcequota.h index 1056df7..dc299b4 100644 --- a/source/ubl-settings-resourcequota.h +++ b/source/ubl-settings-resourcequota.h @@ -39,10 +39,10 @@ // #define remove_command "ubconfig remove security " // #define remove_global_command "ubconfig --target global --noexecute remove security " // #define remove_local_command "ubconfig --target system remove security " -#define get_devices_command "findmnt -lo source,target,fstype,label,size -t ext4 |grep -vE \"zram|\\]|\\[|SOURCE\"" +#define get_devices_command "clear;findmnt -lo source,target,fstype,label,size -t ext4 |grep -vE \"zram|\\]|\\[|SOURCE\"" #define get_processes_tree_command "clear; systemd-cgls --no-page" -#define get_dispatcher_command "clear; systemd-cgtop" -#define get_information_command "systemctl status " +#define get_dispatcher_command "clear; systemd-cgtop -c" +#define get_information_command(target) yon_char_unite("systemctl status ",target,".slice --no-pager",NULL) #define get_processes_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.service\"" #define get_slices_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.slice\"" From 190b857d440ea5c578bf36620d540b9e6007d3dd Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 3 Jun 2025 12:02:30 +0000 Subject: [PATCH 11/11] Fixed slice --- source/ubl-settings-resourcequota.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index b3673ce..1a92013 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -1309,6 +1309,15 @@ void yon_main_window_complete(main_window *widgets){ main_config.users = yon_ubl_get_all_users(&main_config.users_size); main_config.processes = yon_config_load(get_processes_command,&main_config.processes_size); main_config.slices = yon_config_load(get_slices_command,&main_config.slices_size); + for(int i=0;iTargetTypeCombo,widgets); } on_config_local_load(NULL,widgets);