diff --git a/Makefile b/Makefile
index 371bb65..21263cf 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,6 @@ DEPENDS = /bin/cmake
PREFIX ?= /usr/local
PKGNAME = $(MAKEFILE_DIR)
FILE_VER = source/${PKGNAME}.h
-PKGIDENT=$(subst /,-,${PREFIX})
default_target: all
@@ -22,9 +21,9 @@ all: init build
init:
@echo "Initialize ..."; \
- if [ -d ".git" ]; then \
+ if [[ -d ".git" ]]; then \
LATEST_TAG=$$(git describe --abbrev=0 --tags | sed 's/^v//'); \
- if [ -z "$${LATEST_TAG}" ]; \
+ if [[ -z "$${LATEST_TAG}" ]]; \
then \
LATEST_TAG=$$"0.0"; \
echo "$${LATEST_TAG} is empty"; \
@@ -38,7 +37,7 @@ init:
depend:
@echo "Check depends ..."
@for FILE_DEPEND in $(DEPENDS); do \
- if [ ! -f $${FILE_DEPEND} ]; then \
+ if [[ ! -f "$${FILE_DEPEND}" ]]; then \
echo "ERROR: Depend '$${FILE_DEPEND}' not found !"; \
exit 1; \
fi; \
@@ -48,21 +47,21 @@ depend:
debug:
@echo "Debug ..."
- if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
+ if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then \
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
fi; \
echo "Debug: OK"
prepare:
@echo "Prepare ..."; \
- if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
+ if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then \
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
fi; \
echo "Prepare: OK"
check:
@echo "Check ..."; \
- if [ -f ${CMAKE_BUILD_DIR}/${PKGNAME} ]; then \
+ if [[ -f "${CMAKE_BUILD_DIR}/${PKGNAME}" ]]; then \
echo "Check: OK"; \
else \
echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not found !"; \
@@ -77,10 +76,9 @@ build: depend prepare
uninstall:
@echo "Uninstall ..."
- @for FILE_PO in $(wildcard *.po); do \
- LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
- FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
- PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
+ @for LANG in $$(find ./locale -iname "*.po" -print | sed -En "s/.+_([[:alpha:]]+)\.po/\1/p" | sort -u); do \
+# PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
+ PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
$(RM) "$${PATH_FILE_MO}"; \
done
@for SIZE in 16x16 32x32 48x48 scalable; do \
@@ -92,50 +90,64 @@ uninstall:
$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \
done; \
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}"; \
+ done
@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}"
@$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop"
- @$(RM) "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy"
- @if [ -z ${DESTDIR} ]; then \
- [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
+ @if [[ "${PREFIX}" == @("/usr"|"/usr/") ]]; then \
+ $(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy"; \
+ else \
+# $(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+ $(RM) "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+ fi
+ @if [[ -z "${DESTDIR}" ]]; then \
+ [[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ]] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
- [ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
+ [[ -d "${DESTDIR}${PREFIX}/share/applications" ]] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
fi
@echo "Uninstall: OK"
install: check uninstall
@echo "Install ..."
- @for FILE_PO in $(wildcard *.po); do \
- LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
- install -dm755 "${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES"; \
- FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
- PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
- echo "$${FILE_PO}"; \
- msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \
+ @for LANG in $$(find ./locale -iname "*.po" -print | sed -En "s/.+_([[:alpha:]]+)\.po/\1/p" | sort -u); do \
+ install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \
+# PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
+ PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/${PKGNAME}.mo"; \
+ PKGNAME_PO="./locale/${PKGNAME}_$${LANG}.po"; [[ -f "$${PKGNAME_PO}" ]] || PKGNAME_PO= ; \
+ msgfmt --verbose --use-fuzzy --output-file "$${PATH_FILE_MO}" - < <(msgcat --use-first --no-wrap $${PKGNAME_PO} ./locale/*_$${LANG}.po); \
done
@for SIZE in 16 32 48; do \
- install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
- rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
+ install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
+ rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "icons/apps/com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
+ done
+ @for FILE_ICON in $(wildcard icons/*/*.svg); do \
+ SUB_NAME=$${FILE_ICON#*/}; SUB_NAME=$${SUB_NAME%/*}; \
+ install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/$${SUB_NAME}" $${FILE_ICON}; \
done
- @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
- @cp ./com.ublinux.${PKGNAME}.policy ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy
- @sed -e 's+/usr/bin+${PREFIX}/bin+' -e 's+.run+${PKGIDENT}.run+g' ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy -i
@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop"
- @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
- @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
- @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "${CMAKE_BUILD_DIR}/com.ublinux.${PKGNAME}${PKGIDENT}.policy"
- @ldconfig -n /usr/local/lib
- @if [ -z ${DESTDIR} ]; then \
- [ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/share/icons/hicolor/" &>/dev/null || true; \
+ @if [[ "${PREFIX}" == @("/usr"|"/usr/") ]]; then \
+ install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy"; \
+ else \
+# install -Dm644 "com.ublinux.${PKGNAME}.policy" "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+ install -Dm644 "com.ublinux.${PKGNAME}.policy" "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+# sed -e "s+/usr/bin+${PREFIX}/bin+" -e "s+\.run+$${PREFIX//\//-}\.run+g" -i "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+ sed -e "s+/usr/bin+${PREFIX}/bin+" -e "s+\.run+$${PREFIX//\//-}\.run+g" -i "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}$${PREFIX//\//-}.policy"; \
+ fi
+ @if [[ -z "${DESTDIR}" ]]; then \
+ ldconfig -n ${DESTDIR}${PREFIX}/lib; \
+ [[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ]] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
- [ -d "${DESTDIR}/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \
+ [[ -d "${DESTDIR}${PREFIX}/share/applications" ]] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
fi
@echo "Install: OK"
clean:
@echo "Clean ..."
@$(RM) -rd ${CMAKE_BUILD_DIR}
- @if [ -d ${CMAKE_BUILD_DIR} ]; then \
+ @if [[ -d "${CMAKE_BUILD_DIR}" ]]; then \
echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \
else \
echo "Clean: OK"; \
diff --git a/com.ublinux.ubl-settings-resourcequota.checked.svg b/com.ublinux.ubl-settings-resourcequota.checked.svg
deleted file mode 100644
index e3cab42..0000000
--- a/com.ublinux.ubl-settings-resourcequota.checked.svg
+++ /dev/null
@@ -1,327 +0,0 @@
-
-
diff --git a/com.ublinux.ubl-settings-resourcequota.funnel-symbolic.svg b/com.ublinux.ubl-settings-resourcequota.funnel-symbolic.svg
deleted file mode 100644
index 4aec04a..0000000
--- a/com.ublinux.ubl-settings-resourcequota.funnel-symbolic.svg
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
diff --git a/com.ublinux.ubl-settings-resourcequota.warning.svg b/com.ublinux.ubl-settings-resourcequota.warning.svg
deleted file mode 100644
index 9a90dba..0000000
--- a/com.ublinux.ubl-settings-resourcequota.warning.svg
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
diff --git a/gresource.xml b/gresource.xml
index 329188e..cff610e 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -8,7 +8,4 @@
ubl-settings-resourcequota.css
-
- ubl-settings-resourcequota-banner.png
-
\ No newline at end of file
diff --git a/com.ublinux.ubl-settings-resourcequota.svg b/icons/apps/com.ublinux.ubl-settings-resourcequota.svg
similarity index 100%
rename from com.ublinux.ubl-settings-resourcequota.svg
rename to icons/apps/com.ublinux.ubl-settings-resourcequota.svg
diff --git a/ubl-settings-resourcequota.pot b/locale/ubl-settings-resourcequota.pot
similarity index 96%
rename from ubl-settings-resourcequota.pot
rename to locale/ubl-settings-resourcequota.pot
index e6c9622..19cb3d7 100644
--- a/ubl-settings-resourcequota.pot
+++ b/locale/ubl-settings-resourcequota.pot
@@ -352,11 +352,19 @@ msgid "View properties for"
msgstr ""
#: source/ubl-strings.h:90
-msgid "CPU and RAM quotas - Adding"
+msgid "Are you sure you want to remove quota"
+msgstr ""
+
+#: source/ubl-strings.h:90
+msgid "Remove quota"
+msgstr ""
+
+#: source/ubl-strings.h:90
+msgid "Add quota"
msgstr ""
#: source/ubl-strings.h:91
-msgid "CPU and RAM quotas - Editing"
+msgid "Edit quota"
msgstr ""
#: source/ubl-strings.h:92
@@ -406,3 +414,7 @@ msgstr ""
#: source/ubl-strings.h:103
msgid "Manual input (for advanced users)"
msgstr ""
+
+#: source/ubl-strings.h:103
+msgid "Current quota has no parameters"
+msgstr ""
diff --git a/ubl-settings-resourcequota_ru.po b/locale/ubl-settings-resourcequota_ru.po
similarity index 95%
rename from ubl-settings-resourcequota_ru.po
rename to locale/ubl-settings-resourcequota_ru.po
index 8c1aff1..af8c679 100644
--- a/ubl-settings-resourcequota_ru.po
+++ b/locale/ubl-settings-resourcequota_ru.po
@@ -377,14 +377,20 @@ msgid "View properties for"
msgstr "Посмотреть свойства для"
#: source/ubl-strings.h:90
-#, fuzzy
-msgid "CPU and RAM quotas - Adding"
-msgstr "Квоты процессора и ОЗУ - Добавление"
+msgid "Are you sure you want to remove quota"
+msgstr "Вы уверены что хотите удалить квоту"
+
+#: source/ubl-strings.h:90
+msgid "Remove quota"
+msgstr "Удалить квоту"
+
+#: source/ubl-strings.h:90
+msgid "Add quota"
+msgstr "Добавление квоты"
#: source/ubl-strings.h:91
-#, fuzzy
-msgid "CPU and RAM quotas - Editing"
-msgstr "Квоты процессора и ОЗУ - Изменение"
+msgid "Edit quota"
+msgstr "Редактирование квоты"
#: source/ubl-strings.h:92
msgid "Quota object:"
@@ -433,3 +439,7 @@ msgstr "Применить изменения лимита операций"
#: source/ubl-strings.h:103
msgid "Manual input (for advanced users)"
msgstr "Ручной ввод (для опытных пользователей)"
+
+#: source/ubl-strings.h:103
+msgid "Current quota has no parameters"
+msgstr "Для текущей квоты не было задано ни одного параметра"
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 5c92b1a..e4d222f 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -35,65 +35,64 @@ set(DEPENDFILES
../ubl-settings-resourcequota-filters.glade
../ubl-settings-resourcequota-quota.glade
../gresource.xml
- ../ubl-settings-resourcequota-banner.png
../ubl-settings-resourcequota.css
+ )
+
+ file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(
+ OUTPUT ${GRESOURCE_C}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${GLIB_COMPILE_RESOURCES}
+ ARGS
+ --generate-source
+ --target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
+ ${GRESOURCE_XML}
+ VERBATIM
+ MAIN_DEPENDENCY ${GRESOURCE_XML}
+ DEPENDS
+ ${GLADE}
+ )
+ add_custom_target(
+ dummy-resource
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
)
-
-file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-
-add_custom_command(
- OUTPUT ${GRESOURCE_C}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${GLIB_COMPILE_RESOURCES}
- ARGS
- --generate-source
- --target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
- ${GRESOURCE_XML}
- VERBATIM
- MAIN_DEPENDENCY ${GRESOURCE_XML}
- DEPENDS
- ${GLADE}
-)
-add_custom_target(
- dummy-resource
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
-)
-
-add_definitions(-DVTE_INCLUDE)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
- -O2 -pipe -fno-plt -fexceptions \
- -Wformat -Werror=format-security \
- -fstack-clash-protection -fcf-protection")
-string(FIND "${CMAKE_CXX_FLAGS}" "-D_FORTIFY_SOURCE" FORTIFY_FOUND)
-
-if(FORTIFY_FOUND EQUAL -1)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
-endif()
+ add_definitions(-DVTE_INCLUDE)
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
+ -O2 -pipe -fno-plt -fexceptions \
+ -Wformat -Werror=format-security \
+ -fstack-clash-protection -fcf-protection")
+
+ string(FIND "${CMAKE_CXX_FLAGS}" "-D_FORTIFY_SOURCE" FORTIFY_FOUND)
+
+ if(FORTIFY_FOUND EQUAL -1)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
+ endif()
+
+ set(SOURCE_FILES
+ ubl-settings-resourcequota.c
+ ubl-settings-resourcequota.h
+ ubl-strings.h
+ )
+
+ set(LIBRARIES
+ ${GTK_LIBRARIES}
+ ${WEBKIT_LIBRARIES}
+ ${UTILS_LIBRARIES}
+ ${VTE291_LIBRARIES}
+ ublsettings
+ ublsettings-gtk3
+ ublsettingsui-gtk3)
-set(SOURCE_FILES
- ubl-settings-resourcequota.c
- ubl-settings-resourcequota.h
- ubl-strings.h
+
+ add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES})
+ target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
+ set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
+ PROPERTIES GENERATED TRUE
)
-
-set(LIBRARIES
- ${GTK_LIBRARIES}
- ${WEBKIT_LIBRARIES}
- ${UTILS_LIBRARIES}
- ${VTE291_LIBRARIES}
- ublsettings
- ublsettings-gtk3
- ublsettingsui-gtk3)
-
-
-add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})
-target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES})
-target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
-set_source_files_properties(
- ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
- PROPERTIES GENERATED TRUE
-)
-install(TARGETS ${PROJECT_NAME} DESTINATION bin)
-add_dependencies(${PROJECT_NAME} dummy-resource)
\ No newline at end of file
+ install(TARGETS ${PROJECT_NAME} DESTINATION bin)
+ add_dependencies(${PROJECT_NAME} dummy-resource)
\ No newline at end of file
diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c
index ad44067..0e8be93 100644
--- a/source/ubl-settings-resourcequota.c
+++ b/source/ubl-settings-resourcequota.c
@@ -292,7 +292,7 @@ void on_quotas_save(GtkWidget *self, dictionary *windows){
// main_window *widgets = yon_dictionary_get_data(windows->first->next,main_window*);
GtkTreeIter iter;
if (!strcmp(gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry)),"")){
- yon_ubl_status_box_render(OPERATION_FAILED_EMPTY_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),OPERATION_FAILED_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
return;
}
const char *string = gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry));
@@ -673,6 +673,7 @@ void on_add_open(GtkWidget *, main_window *widgets){
window->Window = yon_gtk_builder_get_widget(builder,"QuotasWindow");
window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
+ window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
window->BlockUiBox = yon_gtk_builder_get_widget(builder,"BlockUiBox");
window->TargetTypeCombo = yon_gtk_builder_get_widget(builder,"TargetTypeCombo");
window->AddQuotaTargetBox = yon_gtk_builder_get_widget(builder,"AddQuotaTargetBox");
@@ -845,9 +846,14 @@ void on_remove(GtkWidget *, main_window *widgets){
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){
char *name;
gtk_tree_model_get(model,&iter,1,&name,-1);
- yon_config_set(CGROUP_QUOTA(name),"");
- gtk_list_store_remove(main_config.list,&iter);
- yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
+ data->title = REMOVE_TITLE_LABEL;
+ data->action_text = REMOVE_VALIDATION_LABEL(name);
+ if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
+ yon_config_remove_by_key(CGROUP_QUOTA(name));
+ gtk_list_store_remove(main_config.list,&iter);
+ yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ }
}
else yon_ubl_status_box_render(NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
@@ -859,7 +865,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
main_window *widgets = yon_dictionary_get_data(windows->first->next,main_window*);
GtkTreeIter iter;
if (!strcmp(gtk_entry_get_text(GTK_ENTRY(window->ManualInputEntry)),"")){
- yon_ubl_status_box_render(OPERATION_FAILED_EMPTY_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),OPERATION_FAILED_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
return;
}
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MainTree)),&model,&iter)){
@@ -868,7 +874,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
char *soft = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SoftRestrictionCheck)) ? yon_char_append(yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->SoftRestrictionSpin))),get_size_mod(GTK_COMBO_BOX(window->SoftRestrictionCombo))) : NULL;
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_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CpuLimitSpin))) : 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 = "";
dictionary *dict;
@@ -889,7 +895,7 @@ void on_quotas_edit(GtkWidget *self, dictionary *windows){
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);
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_set(CGROUP_QUOTA(target),(void*)yon_char_new((char*)string));
+ yon_config_register(CGROUP_QUOTA(target),CGROUP_QUOTA_comd(target),(char*)string);
on_subwindow_close(self);
yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
@@ -931,6 +937,7 @@ void on_edit_open(GtkWidget *, main_window *widgets){
window->Window = yon_gtk_builder_get_widget(builder,"QuotasWindow");
window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
+ window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
window->BlockUiBox = yon_gtk_builder_get_widget(builder,"BlockUiBox");
window->TargetTypeCombo = yon_gtk_builder_get_widget(builder,"TargetTypeCombo");
window->AddQuotaTargetBox = yon_gtk_builder_get_widget(builder,"AddQuotaTargetBox");
@@ -970,7 +977,8 @@ void on_edit_open(GtkWidget *, main_window *widgets){
window->devices = NULL;
- gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL);
+ gtk_window_set_title(GTK_WINDOW(window->Window),EDITING_LABEL);
+ gtk_label_set_text(GTK_LABEL(window->TitleLabel),EDITING_LABEL);
gtk_widget_show(window->EditQuotaTargetBox);
gtk_widget_hide(window->AddQuotaTargetBox);
@@ -1258,7 +1266,6 @@ void yon_main_window_complete(main_window *widgets){
/* Signal connection | Присоединение сигналов */
g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK);
- g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL);
g_signal_connect(G_OBJECT(widgets->FiltersButton),"clicked",G_CALLBACK(on_filters_opened),widgets);
g_signal_connect(G_OBJECT(widgets->InformationButton),"clicked",G_CALLBACK(on_information),widgets);
g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_remove),widgets);
diff --git a/source/ubl-settings-resourcequota.h b/source/ubl-settings-resourcequota.h
index b44c827..1146aed 100644
--- a/source/ubl-settings-resourcequota.h
+++ b/source/ubl-settings-resourcequota.h
@@ -129,6 +129,7 @@ typedef struct {
GtkWidget *Window;
GtkWidget *TitleLabel;
+ GtkWidget *StatusBox;
GtkWidget *BlockUiBox;
GtkWidget *EditQuotaTargetBox;
GtkWidget *AddQuotaTargetBox;
diff --git a/source/ubl-strings.h b/source/ubl-strings.h
index c9fdef0..0915a56 100644
--- a/source/ubl-strings.h
+++ b/source/ubl-strings.h
@@ -87,8 +87,11 @@
#define VIEW_PROPERTIES_LABEL _("View properties for")
-#define ADDING_LABEL _("CPU and RAM quotas - Adding")
-#define EDITING_LABEL _("CPU and RAM quotas - Editing")
+#define REMOVE_TITLE_LABEL _("Remove quota")
+#define REMOVE_VALIDATION_LABEL(target) yon_char_unite(_("Are you sure you want to remove quota")," ",target,"?",NULL)
+#define ADDING_LABEL _("Add quota")
+#define ADDING_LABEL _("Add quota")
+#define EDITING_LABEL _("Edit quota")
#define QUOTA_OBJ_LABEL _("Quota object:")
#define RAM_LABEL _("RAM limit")
#define SOFT_RESTRICTION_LABEL _("Soft restriction")
diff --git a/ubl-settings-resourcequota-banner.png b/ubl-settings-resourcequota-banner.png
deleted file mode 100644
index 8eb67cb..0000000
Binary files a/ubl-settings-resourcequota-banner.png and /dev/null differ
diff --git a/ubl-settings-resourcequota-quota.glade b/ubl-settings-resourcequota-quota.glade
index 4708587..302ac46 100644
--- a/ubl-settings-resourcequota-quota.glade
+++ b/ubl-settings-resourcequota-quota.glade
@@ -3,40 +3,6 @@
-
-
-
-
-
-
-
-