diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 676f7f4..bac30c9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -38,6 +38,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES view/ubl-settings-resourcequota.c view/ubl-settings-resourcequota.h + view/filters.c + view/filters.h view/ubl-strings.h view/ubl-utils.h view/ubl-utils.c diff --git a/source/view/filters.c b/source/view/filters.c new file mode 100644 index 0000000..990f704 --- /dev/null +++ b/source/view/filters.c @@ -0,0 +1,40 @@ +#include "filters.h" + +filters_window *filters_widgets; + +filters_window *filters_setup_window(char* glade_path){ + filters_widgets = malloc(sizeof(filters_window)); + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + filters_widgets->Window = yon_gtk_builder_get_widget(builder,"wndFilters"); + filters_widgets->chbFilterTypeQouota = yon_gtk_builder_get_widget(builder,"chbFilterTypeQouota"); + filters_widgets->chbQuotaVolume = yon_gtk_builder_get_widget(builder,"chbQuotaVolume"); + filters_widgets->chbSoftLimit = yon_gtk_builder_get_widget(builder,"chbSoftLimit"); + filters_widgets->chbHardLimit = yon_gtk_builder_get_widget(builder,"chbHardLimit"); + filters_widgets->chbSwapFileLimit = yon_gtk_builder_get_widget(builder,"chbSwapFileLimit"); + filters_widgets->chbIOLimitWrite = yon_gtk_builder_get_widget(builder,"chbIOLimitWrite"); + filters_widgets->chbCPULimit = yon_gtk_builder_get_widget(builder,"chbCPULimit"); + filters_widgets->chbIOLimitRead = yon_gtk_builder_get_widget(builder,"chbIOLimitRead"); + filters_widgets->btnFiltersCancel = yon_gtk_builder_get_widget(builder,"btnFiltersCancel"); + filters_widgets->btnFiltersSave = yon_gtk_builder_get_widget(builder,"btnFiltersSave"); + return filters_widgets; +} + +void filters_event(filters_window *widgets) { + g_signal_connect(G_OBJECT(widgets->btnFiltersCancel),"clicked",G_CALLBACK(filters_on_hide_subwindow),NULL); +} + +void filters_localization(filters_window *widgets) { + +} + +void filters_on_hide_subwindow(GtkWidget *self) { + gtk_widget_destroy(gtk_widget_get_toplevel(self)); +} + +filters_window *get_widget_filters() { + return filters_widgets; +} + +void filters_show(GtkWidget *self) { + gtk_widget_show_all(filters_widgets->Window); +} \ No newline at end of file diff --git a/source/view/filters.h b/source/view/filters.h new file mode 100644 index 0000000..8f6a9ef --- /dev/null +++ b/source/view/filters.h @@ -0,0 +1,37 @@ +#ifndef FILTERS_H +#define FILTERS_H +#include +#include +#include "ubl-utils.h" +#include "ubl-strings.h" +#include +#include +#include +#include +#include +#include +#include + +// Переменные +typedef struct { + GtkWidget* Window; + GtkWidget* btnFiltersSave; + GtkWidget* btnFiltersCancel; + GtkWidget* chbFilterTypeQouota; + GtkWidget* chbCPULimit; + GtkWidget* chbIOLimitRead; + GtkWidget* chbIOLimitWrite; + GtkWidget* chbSwapFileLimit; + GtkWidget* chbHardLimit; + GtkWidget* chbSoftLimit; + GtkWidget* chbQuotaVolume; +} filters_window; + +// Функции +filters_window *filters_setup_window(char* glade_path); +void filters_event(filters_window *widgets); +void filters_localization(filters_window *widgets); +void filters_on_hide_subwindow(GtkWidget *self); +filters_window *get_widget_filters(); +void filters_show(GtkWidget *self); +#endif \ No newline at end of file diff --git a/source/view/ubl-settings-resourcequota.c b/source/view/ubl-settings-resourcequota.c index 0c9db9d..c1cddae 100644 --- a/source/view/ubl-settings-resourcequota.c +++ b/source/view/ubl-settings-resourcequota.c @@ -90,7 +90,7 @@ void on_about(){ GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),PROJECT_HOME_LABEL); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); + // gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL); gtk_widget_set_visible(hideButtonBox,0); @@ -146,6 +146,20 @@ main_window *setup_window(){ widgets->DocumentationMenuItem = yon_gtk_builder_get_widget(builder,"DocumentationMenuItem"); widgets->AboutMenuItem = yon_gtk_builder_get_widget(builder,"AboutMenuItem"); + widgets->btnShowFilters = yon_gtk_builder_get_widget(builder,"btnShowFilters"); + + + gtk_widget_show_all(widgets->Window); + return widgets; +} + + + +void event_all(main_window *widgets) { + g_signal_connect(G_OBJECT(widgets->btnShowFilters),"clicked",G_CALLBACK(filters_show),NULL); +} + +void main_event(main_window *widgets) { /* Signal connection | Присоединение сигналов */ g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); @@ -164,9 +178,6 @@ main_window *setup_window(){ gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->DocumentationMenuItem),DOCUMENTATION_LABEL); gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->AboutMenuItem),ABOUT_LABEL); - - gtk_widget_show_all(widgets->Window); - return widgets; } int main(int argc, char *argv[]){ @@ -189,6 +200,7 @@ int main(int argc, char *argv[]){ {"socket-trd-id", 1,0, 't'}, { NULL, 0, NULL, 0 } }; + for (int i=0;iHeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); if (yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel)) @@ -249,4 +263,5 @@ int main(int argc, char *argv[]){ GTK_STYLE_PROVIDER(css), -1); gtk_main(); -} \ No newline at end of file +} + diff --git a/source/view/ubl-settings-resourcequota.h b/source/view/ubl-settings-resourcequota.h index 60db6c0..6c45ea1 100644 --- a/source/view/ubl-settings-resourcequota.h +++ b/source/view/ubl-settings-resourcequota.h @@ -10,6 +10,9 @@ #include #include #include "ubl-cmake.h" +#include "filters.h" + + #ifdef WEBKIT_FOUND #include #endif @@ -26,9 +29,9 @@ #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-resourcequota" typedef char* string; -string version_application; +static string version_application; -char *local; +static char *local; typedef struct { int always_open_documentation; @@ -49,6 +52,7 @@ typedef struct { typedef struct { GtkWidget *Window; + GtkWidget *btnShowFilters; GtkWidget *HatLabel; GtkWidget *PlugBox; @@ -91,4 +95,8 @@ typedef struct { } documentation_confirmation_window; -main_window *setup_window(); \ No newline at end of file +main_window *setup_window(); +void config_init(); +void event_all(); +void main_event(main_window *widgets); +void event_all(main_window *widgets); \ No newline at end of file diff --git a/source/view/ubl-strings.h b/source/view/ubl-strings.h index c48c6e7..50060ce 100644 --- a/source/view/ubl-strings.h +++ b/source/view/ubl-strings.h @@ -1,7 +1,7 @@ #define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL) #define HELP_LABEL yon_char_unite(_("ubl-settings-resourcequota version:")," ", version_application,"\n",_("TEMPLATE settings"),"\n",_("Usage:"), " ubl-settings-resourcequota ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n",NULL) -#define TITLE_LABEL _("ubl-settings-resourcequota") +#define TITLE_LABEL _("CPU and RAM quotas") #define TITLE_INFO_LABEL _("System resource quota settings management") #define ABOUT_LABEL _("About") diff --git a/ubl-settings-resourcequota.glade b/ubl-settings-resourcequota.glade index 91c19a1..36a2ca2 100644 --- a/ubl-settings-resourcequota.glade +++ b/ubl-settings-resourcequota.glade @@ -8,20 +8,20 @@ False True center - com.ublinux.ubl-settings-TEMPLATE + com.ublinux.ubl-settings-resourcequota dialog True ubl-settings-resourcequota 1.0 Copyright © 2022 - 2023, UBSoft LLC - ubl-settings-resourcequota - https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-TEMPLATE + CPU and RAM quotas + https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-resourcequota Project Home Page Это приложение распространяется без каких-либо гарантий. Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. UBGroup UBGroup - com.ublinux.ubl-settings-TEMPLATE + com.ublinux.ubl-settings-resourcequota True gpl-2-0 @@ -31,7 +31,7 @@ vertical 2 - + False end @@ -50,6 +50,7 @@ True False + True True @@ -398,6 +399,7 @@ translated and supported by community. True False + True True @@ -754,7 +756,7 @@ translated and supported by community. True False - + True True True @@ -1040,12 +1042,12 @@ translated and supported by community. - + True False vertical - + True False @@ -1183,7 +1185,7 @@ translated and supported by community. False vertical - + True False @@ -1284,7 +1286,7 @@ translated and supported by community. False vertical - + True False @@ -1317,7 +1319,7 @@ translated and supported by community. 5 - False + True True 1 @@ -1334,7 +1336,7 @@ translated and supported by community. 5 - False + True True 2 @@ -1591,6 +1593,14 @@ translated and supported by community. + + vertical + + + + + + False start @@ -1607,7 +1617,7 @@ translated and supported by community. 5 vertical - + Type quota True True @@ -1622,7 +1632,7 @@ translated and supported by community. - + Quota volume True True @@ -1637,7 +1647,7 @@ translated and supported by community. - + Soft RAM limit, (volume) True True @@ -1698,7 +1708,7 @@ translated and supported by community. - + Hard RAM limit, (volume) True True @@ -1713,7 +1723,7 @@ translated and supported by community. - + Swap file limit (volume) True True @@ -1728,7 +1738,7 @@ translated and supported by community. - + CPU limit (%) True True @@ -1743,7 +1753,7 @@ translated and supported by community. - + I/O limit (write) True True @@ -1758,7 +1768,7 @@ translated and supported by community. - + I/O limit (read) True True @@ -1778,6 +1788,7 @@ translated and supported by community. True False + True True diff --git a/ubl-settings-resourcequota_ru.po b/ubl-settings-resourcequota_ru.po index 4c026e1..0a16e05 100644 --- a/ubl-settings-resourcequota_ru.po +++ b/ubl-settings-resourcequota_ru.po @@ -19,6 +19,22 @@ msgstr "" #: source/ubl-strings.h:9 #: source/ubl-strings.h:8 +msgid "Read Online" +msgstr "Читать онлайн" + +msgid "Always redirect to online documentation" +msgstr "Всегда перенаправлять" + +msgid "Would you like to read documentation in the Web?" +msgstr "Вы хотите прочитать справку в Сети?" + +msgid "" +"You will be redirected to documentation website where documentation is\n" +"translated and supported by community." +msgstr "" +"Вы будете перенаправлены на сайт с документацией где страницы помощи\n" +"переводятся и поддерживаются сообществом." + msgid "Documentation" msgstr "Справка" @@ -235,8 +251,31 @@ msgstr "Ручной ввод (для опытных пользователей) msgid "Settings quotas - Adding" msgstr "Квоты настроек - Добавление" +#: source/ubl-strings.h:24 +msgid "Nothing were chosen" +msgstr "Ничего не было выбрано" -msgid "" -msgstr "" +msgid "Cancel" +msgstr "Отмена" + +#: source/ubl-strings.h:27 +msgid "Global configuration loading succseeded." +msgstr "Успешно загружена глобальная конфигурация" + +#: source/ubl-strings.h:28 +msgid "Local configuration loading succseeded." +msgstr "Успешно загружена локальная конфигурация" + +#: source/ubl-strings.h:30 +msgid "Local and global configuration saving succseeded." +msgstr "Успешно записаны локальная и глобальная конфигурация" + +#: source/ubl-strings.h:31 +msgid "Global configuration saving succseeded." +msgstr "Успешно записана глобальная конфигурация" + +#: source/ubl-strings.h:32 +msgid "Local configuration saving succseeded." +msgstr "Успешно записана локальная конфигурация"