Small refactoring process

pull/70/head
Ivan Yartsev 2 years ago
parent 5097e4c959
commit 174fd8e31d

@ -1,6 +0,0 @@
make
gcc compile/resources.c compile/ubl-cmake.h source/view_set_disk.h source/view_set_disk.c source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
sudo make install clean
cd ./terminal-commands
make
cd ../

@ -9,8 +9,10 @@ CMAKE_COMMAND = cmake
CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source
CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile
DEPENDS = /bin/cmake
PREFIX ?= /usr
PREFIX ?= /usr/local
PKGNAME = $(MAKEFILE_DIR)
FILE_VER = source/${PKGNAME}.h
PKGIDENT=$(subst /,-,${PREFIX})
default_target: all
@ -21,11 +23,16 @@ all: init build
init:
@echo "Initialize ..."; \
if [ -d ".git" ]; then \
LATEST_TAG=$$(git describe --tags | sed 's/^v//'|grep -oE "^[0-9]{1,}.[0-9]{1,}"); \
LATEST_TAG=$$(git describe --abbrev=0 --tags | sed 's/^v//'); \
if [ -z "$${LATEST_TAG}" ]; \
then \
LATEST_TAG=$$"0.0"; \
echo "$${LATEST_TAG} is empty"; \
fi; \
else \
LATEST_TAG="0.0"; \
LATEST_TAG="Development"; \
fi; \
sed -r "s/^(string version_application).*/\1=\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.h; \
sed -r "s/^(string version_application).*/\1 = \"$${LATEST_TAG}\";/" -i ${FILE_VER}; \
echo "-- Build path: ${CMAKE_BUILD_DIR}"
depend:
@ -43,8 +50,6 @@ debug:
@echo "Debug ..."
if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${PREFIX}"; \
@gcc compile/resources.c compile/ubl-cmake.h source/view_set_disk.h source/view_set_disk.c source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
fi; \
echo "Debug: OK"
@ -66,7 +71,8 @@ check:
build: depend prepare
@echo "Build ..."; \
make --directory=${CMAKE_BUILD_DIR}; \
$(MAKE_COMMAND) --directory=${CMAKE_BUILD_DIR}; \
sed -r "s/^(string version_application).*/\1;/" -i ${FILE_VER}; \
echo "Build: OK"
uninstall:
@ -74,7 +80,7 @@ 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}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
$(RM) "$${PATH_FILE_MO}"; \
done
@for SIZE in 16x16 32x32 48x48 scalable; do \
@ -89,9 +95,7 @@ uninstall:
@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}"
@$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop"
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg"
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/com.ublinux.${PKGNAME}.checked.svg"
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/com.ublinux.${PKGNAME}.warning.svg"
@$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy"
@$(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; \
update-desktop-database --quiet &>/dev/null || true; \
@ -103,9 +107,9 @@ install: check uninstall
@echo "Install ..."
@for FILE_PO in $(wildcard *.po); do \
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \
install -dm755 "${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES"; \
FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_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}"; \
done
@ -113,25 +117,22 @@ install: check uninstall
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"; \
done
@install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps"
@install -Dm644 -t "${DESTDIR}${PREFIX}/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}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
@install -Dm644 -t "${DESTDIR}${PREFIX}/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"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.funnel.svg"
@install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "gdb.policy"
@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}"
@install -dm755 "${DESTDIR}/etc/xdg"
@install -dm755 "${DESTDIR}${PREFIX}/share/applications"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop"
@ldconfig -n /usr/local/lib
@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; \
fi
@echo "Install: OK"
@sed -r "s/^(string version_application=\"*\").*/string version_application;/" -i source/${PKGNAME}.h; \
clean:
@echo "Clean ..."
@ -151,5 +152,4 @@ help:
echo "... compile"; \
echo "... install"; \
echo "... uninstall"; \
echo "... clean"
echo "... clean"

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>UBLinux</vendor>
<vendor_url>https://ublinux.ru</vendor_url>
<action id="com.ublinux.gdb.run">
<description>Run ubl-settings-diskquota as root</description>
<description xml:lang="ru">Запуск утилиты ubl-settings-diskquota с правами root</description>
<message>Authentication is required to run ubl-settings-diskquota</message>
<message xml:lang="ru">Требуется авторизация для запуска утилиты ubl-settings-diskquota с правами root</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gdb</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

@ -369,6 +369,7 @@ void wrapper_all_save() {
yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
}
void wrapper_global_save() {
if (wrapper_template_save(&all_config, CMD_SAVE_GLOBAL, CMD_REMOVE_GLOBAL)) {
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);

@ -109,7 +109,7 @@ typedef struct {
} documentation_confirmation_window;
typedef char* string;
static string version_application="";
static string version_application;
main_window *setup_window(main_window* widgets, custom_window* custom_widgets);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save