diff --git a/.gitignore b/.gitignore index d6a6261..1f125bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ -ubl-util-standard.glade~ -ubl-settings-info -/css/ -/ui/ .vscode/ -/ubl-standard-ui.c -ubl-settings-info.glade~ -*ubl-settings-info.glade# -*.o -source/ubl-util-standard-ui.c -source/ubl-util-standard-ui.h \ No newline at end of file +ubl-settings-info +*~ +build/ +compile/ +*# +terminal-commands/ +source/ubl-cmake.h +vgcore* +.BUILD.md +.updatebuild.sh +.install.sh \ No newline at end of file diff --git a/Makefile b/Makefile index 667e8e6..9a44772 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,14 @@ MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) CMAKE_COMMAND = cmake CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile -DEPENDS = /bin/cmake /bin/screenfetch -PREFIX ?= /usr +DEPENDS = /bin/cmake +PREFIX ?= /usr/local PKGNAME = $(MAKEFILE_DIR) +FILE_VER = source/${PKGNAME}.h +PKGIDENT=$(subst /,-,${PREFIX}) + +FILE_MO := $(PKGNAME).mo +LOCALE_DIR := ./locale default_target: all @@ -21,11 +26,16 @@ all: init build init: @echo "Initialize ..."; \ if [ -d ".git" ]; then \ - LATEST_TAG=$$(git describe --tags | sed 's/^v//'); \ + 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}.c; \ + sed -r "s/^(string version_application).*/\1 = \"$${LATEST_TAG}\";/" -i ${FILE_VER}; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: @@ -36,8 +46,8 @@ depend: exit 1; \ fi; \ done; \ + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B${CMAKE_BUILD_DIR} --check-build-system CMakeFiles/Makefile.cmake 1 || exit 1; \ echo "Check depends: OK" -# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 debug: @echo "Debug ..." @@ -64,7 +74,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: @@ -72,7 +83,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 \ @@ -86,9 +97,7 @@ uninstall: done @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" - @$(RM) "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/logo-background.png" - @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" - @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @$(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; \ @@ -98,33 +107,28 @@ uninstall: 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"; \ - FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ - echo "$${FILE_PO}"; \ - msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ + @for po in $(LOCALE_DIR)/$(PKGNAME)_*.po; do \ + lang=$$(basename $$po | sed -E 's/^$(PKGNAME)_([^.]+)\.po$$/\1/'); \ + file=$$(find ./locale/ -name '*_'"$$lang"'.po'); \ + msgfmt $$file -v -f -o ${DESTDIR}/usr/share/locale/$$lang/LC_MESSAGES/$(FILE_MO); \ 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 png --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \ + 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 + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/" "icons/apps/com.ublinux.${PKGNAME}.svg" + @for FILE_ICON in $(wildcard icons/*/*.svg); do \ + SUB_NAME=$${FILE_ICON#*/}; SUB_NAME=$${SUB_NAME%/*}; \ + install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/$${SUB_NAME}" $${FILE_ICON}; \ done - @install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" - @install -dm755 "${DESTDIR}${PREFIX}/share/applications" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" - @install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images} - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}.glade" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/css/" "${PKGNAME}.css" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" \ - "logo-background.png" \ - "ublinux-logo.svg" + @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; \ + [ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/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}/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \ fi @echo "Install: OK" @@ -146,4 +150,4 @@ help: echo "... compile"; \ echo "... install"; \ echo "... uninstall"; \ - echo "... clean" + echo "... clean" \ No newline at end of file diff --git a/gresource.xml b/gresource.xml new file mode 100644 index 0000000..82adf4b --- /dev/null +++ b/gresource.xml @@ -0,0 +1,9 @@ + + + + ubl-settings-info.glade + + + ubl-settings-info.css + + \ No newline at end of file diff --git a/com.ublinux.ubl-settings-info.svg b/icons/apps/com.ublinux.ubl-settings-info.svg similarity index 100% rename from com.ublinux.ubl-settings-info.svg rename to icons/apps/com.ublinux.ubl-settings-info.svg diff --git a/ubl-settings-info.pot b/locale/ubl-settings-info.pot similarity index 69% rename from ubl-settings-info.pot rename to locale/ubl-settings-info.pot index fb2eda8..c8beaef 100644 --- a/ubl-settings-info.pot +++ b/locale/ubl-settings-info.pot @@ -17,22 +17,20 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-info.c:37 -msgid "Basic System Information" +#: source/ubl-settings-info.h:26 +msgid "fastfetch --logo none --disable-linewrap --config all.jsonc" msgstr "" -#: source/ubl-settings-info.c:38 source/ubl-settings-info.c:67 source/ubl-settings-info.c:68 +#: source/ubl-strings.h:2 msgid "System Information" msgstr "" -#: source/ubl-settings-info.c:40 -msgid "Project Home Page" -msgstr "" - -#: source/ubl-settings-info.c:41 -msgid "About ubl-settings-info" +#: source/ubl-strings.h:3 +msgid "Basic System Information" msgstr "" -#: source/ubl-settings-info.c:70 -msgid "About program" +#: source/ubl-strings.h:4 +msgid "" +"https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/" +"ubl-settings-info" msgstr "" diff --git a/ubl-settings-info_ru.po b/locale/ubl-settings-info_ru.po similarity index 60% rename from ubl-settings-info_ru.po rename to locale/ubl-settings-info_ru.po index 90ec7f1..6f1642d 100644 --- a/ubl-settings-info_ru.po +++ b/locale/ubl-settings-info_ru.po @@ -17,22 +17,20 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-info.c:41 -msgid "Basic System Information" -msgstr "Основная информацией о системе" +#: source/ubl-settings-info.h:26 +msgid "fastfetch --logo none --disable-linewrap --config all.jsonc" +msgstr "" -#: source/ubl-settings-info.c:38 source/ubl-settings-info.c:67 source/ubl-settings-info.c:68 +#: source/ubl-strings.h:2 msgid "System Information" msgstr "Информация о системе" -#: source/ubl-settings-info.c:40 -msgid "Project Home Page" -msgstr "Домашняя страница проекта" - -#: source/ubl-settings-info.c:45 -msgid "About ubl-settings-info" -msgstr "О программе ubl-settings-info" +#: source/ubl-strings.h:3 +msgid "Basic System Information" +msgstr "Основная информация о системе" -#: source/ubl-settings-info.c:70 -msgid "About" -msgstr "О программе" +#: source/ubl-strings.h:4 +msgid "" +"https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/" +"ubl-settings-info" +msgstr "" diff --git a/logo-background.png b/logo-background.png deleted file mode 100644 index 8eb67cb..0000000 Binary files a/logo-background.png and /dev/null differ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2457623..4075f3c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -3,24 +3,79 @@ project(ubl-settings-info) find_package(PkgConfig REQUIRED) -pkg_check_modules(GTK REQUIRED gtkmm-3.0) +pkg_check_modules(GTK REQUIRED gtk+-3.0) include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ +pkg_check_modules(VTE291 REQUIRED vte-2.91) +include_directories(${VTE291_INCLUDE_DIRS}) +link_directories(${VTE291_LIBRARY_DIRS}) +add_definitions(${VTE291_CFLAGS_OTHER}) + +set(GRESOURCE_C resources.c) +set(GRESOURCE_XML gresource.xml) + +find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED) +add_custom_target(GLADE ubl-settings-info.glade) + +set(DEPENDFILES + ../ubl-settings-info.glade + ../gresource.xml + ../ubl-settings-info.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} +) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ - -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ + -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-info.c) + ubl-settings-info.c + ubl-settings-info.h + ) set(LIBRARIES ${GTK_LIBRARIES} - pthread) + ${WEBKIT_LIBRARIES} + ${VTE291_LIBRARIES} + ublsettings + ublsettings-gtk3 + ublsettingsui-gtk3) + -add_executable(ubl-settings-info ${SOURCE_FILES}) -target_link_libraries(ubl-settings-info ${LIBRARIES}) -install(TARGETS ubl-settings-info DESTINATION bin) \ No newline at end of file +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 diff --git a/source/ubl-settings-info.c b/source/ubl-settings-info.c index 4b15c6e..5564db5 100644 --- a/source/ubl-settings-info.c +++ b/source/ubl-settings-info.c @@ -1,179 +1,76 @@ -#include -#include -#include -#include -#include -#include "ubl-util-standard.c" -#define cssPath "/usr/share/ubl-settings-info/css/ubl-settings-info.css" -#define gladePath "/usr/share/ubl-settings-info/ui/ubl-settings-info.glade" -#define HeadBackgroundImagePath "/usr/share/ubl-settings-info/images/logo-background.png" -#define LogoImagePath "/usr/share/ubl-settings-info/images/ublinux-logo.svg" -#define LocaleName "ubl-settings-info" -#define LocalePath "/usr/share/locale" +#include "ubl-settings-info.h" -typedef char* string; -string version_application = "1.3"; +config main_config; -#define _(String) gettext(String) - - -char *yon_char_get_augumented(char *source, char *append){ - int size=strlen(source)+strlen(append)+1; - char *final=malloc(size); - memset(final,0,size); - sprintf(final,"%s%s",source,append); - return final; +void yon_terminal_style_update(VteTerminal *, main_window *widgets){ + GdkRGBA *bg_color = NULL, *color=NULL; + gtk_style_context_get(gtk_widget_get_style_context(widgets->TerminalTemplateLabel),GTK_STATE_FLAG_NORMAL,GTK_STYLE_PROPERTY_BACKGROUND_COLOR,&bg_color,GTK_STYLE_PROPERTY_COLOR,&color,NULL); + vte_terminal_set_color_background(VTE_TERMINAL(widgets->InfoTerminal),bg_color); + vte_terminal_set_color_foreground(VTE_TERMINAL(widgets->InfoTerminal),color); + vte_terminal_set_color_cursor_foreground(VTE_TERMINAL(widgets->InfoTerminal),bg_color); + vte_terminal_set_color_cursor(VTE_TERMINAL(widgets->InfoTerminal),bg_color); + if (bg_color->blue>0.5&&bg_color->green>0.5&&bg_color->red>0.5){ + gtk_image_set_from_file(GTK_IMAGE(widgets->InfoIcon),logo_icon_path); + gtk_image_set_pixel_size(GTK_IMAGE(widgets->InfoIcon),255); + } else if (bg_color->blue<0.5&&bg_color->green<0.5&&bg_color->red<0.5){ + gtk_image_set_from_file(GTK_IMAGE(widgets->InfoIcon),logo_dark_icon_path); + gtk_image_set_pixel_size(GTK_IMAGE(widgets->InfoIcon),255); + } } -char *yon_cut(char *source, int size, int startpos){ - char *cut=NULL; - cut=malloc(size+1); - memset(cut,0,size+1); - memcpy(cut,source+startpos,size); - return cut; -} -void on_about(GtkWidget *button){ - GtkBuilder *builder = gtk_builder_new_from_file(gladePath); - GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); - GtkWidget *About = GTK_WIDGET(gtk_builder_get_object(builder, "About")); - GtkWidget *HeaderAboutTopic = GTK_WIDGET(gtk_builder_get_object(builder, "headerAboutTopic")); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(About),version_application); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(About),_("Basic System Information")); - gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(About),_("System Information")); - gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(builder,"About"))); - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_("Project Home Page")); - gtk_label_set_text(GTK_LABEL(HeaderAboutTopic),_("About ubl-settings-info")); - gtk_widget_set_visible(AboutButtons,0); +void on_theme_changed(GSettings *, char *, main_window *widgets){ + yon_terminal_style_update(NULL, widgets); } -void yon_on_window_close_dont_destroy(){ +/**yon_main_window_complete(main_window *widgets) + * [EN] + * + * [RU] + * Функция настройки основного окна приложения. [widgets] - структура со стандартным интерфейсом. +*/ +void yon_main_window_complete(main_window *widgets){ + widgets = yon_remalloc(widgets,sizeof(main_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + gtk_box_pack_start(GTK_BOX(widgets->InterfaceBox),yon_gtk_builder_get_widget(builder,"BoxMain"),1,1,0); + // Custom widgets configuration + { + widgets->InfoIcon = yon_gtk_builder_get_widget(builder,"InfoIcon"); + widgets->InfoTerminal = yon_gtk_builder_get_widget(builder,"InfoTerminal"); + widgets->TerminalTemplateLabel = yon_gtk_builder_get_widget(builder,"TerminalTemplateLabel"); + } + { + yon_terminal_integrated_start(widgets->InfoTerminal,main_command); + yon_terminal_style_update(NULL, widgets); -} + GSettings *settings = g_settings_new("org.gnome.desktop.interface"); + g_signal_connect(G_OBJECT(settings), "changed",G_CALLBACK(on_theme_changed),widgets); + + } + GList *children = gtk_container_get_children(GTK_CONTAINER(widgets->RightBox)); + gtk_widget_hide(GTK_WIDGET(g_list_nth_data(children,0))); + gtk_widget_hide(widgets->LeftBox); + gtk_widget_hide(widgets->StatusBox); + g_list_free(children); +} -int main(int argc, char *argv[]){ - int argsc=0; - char *arv=""; - char **argsv=&arv; - GError *err=NULL; - gtk_init(&argsc, &argsv); +int main(int argc, char *argv[]){ setlocale(LC_ALL, ""); - bindtextdomain (LocaleName, LocalePath); textdomain (LocaleName); - GtkBuilder *builder = gtk_builder_new_from_file(gladePath); - GtkWidget *plugBox = GTK_WIDGET(gtk_builder_get_object(builder, "plugBox")); - GtkWidget *labelInfo = GTK_WIDGET(gtk_builder_get_object(builder, "InfoLabel")); - GtkWidget *iconInfo = GTK_WIDGET(gtk_builder_get_object(builder, "InfoIcon")); - GtkWidget *headLabel = GTK_WIDGET(gtk_builder_get_object(builder, "headLabel")); - GtkWidget *HeaderTopic = GTK_WIDGET(gtk_builder_get_object(builder, "headerTopic")); - GtkWidget *AboutButton = GTK_WIDGET(gtk_builder_get_object(builder,"MenuItemAbout")); - GtkWidget *buttonSettings = GTK_WIDGET(gtk_builder_get_object(builder,"buttonSettings")); - GtkWidget *headBackgroundIcon = GTK_WIDGET(gtk_builder_get_object(builder,"HeadBackgroundImage")); - GtkWidget *headOverlay = GTK_WIDGET(gtk_builder_get_object(builder,"HeadOverlay")); - GtkWidget *headbox = GTK_WIDGET(gtk_builder_get_object(builder,"boxColor")); - gtk_image_set_from_file(GTK_IMAGE(headBackgroundIcon),HeadBackgroundImagePath); - gtk_overlay_add_overlay(GTK_OVERLAY(headOverlay),headbox); - gtk_label_set_text(GTK_LABEL(HeaderTopic),_("System Information")); - gtk_label_set_text(GTK_LABEL(headLabel),_("System Information")); - g_signal_connect(G_OBJECT(AboutButton), "activate", G_CALLBACK(on_about),NULL); - gtk_menu_item_set_label(GTK_MENU_ITEM(AboutButton),_("About")); - gtk_image_set_from_pixbuf(GTK_IMAGE(iconInfo),gdk_pixbuf_new_from_file_at_size(LogoImagePath,256,256,&err)); - if (err){ - printf("%s\n",err->message); - g_error_free(err); - } - GtkCssProvider *css=gtk_css_provider_new(); - gtk_css_provider_load_from_path(css,cssPath,&err); - if (err){ - printf("%s\n",err->message); - g_error_free(err); - } - gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), - GTK_STYLE_PROVIDER(css), - -1); - FILE *fp; - char path[1035]; - char *loc=setlocale(LC_ALL,NULL); - if (strcmp(loc,"ru_RU.UTF-8")==0) - fp = popen("screenfetch -N -n | sed 's/OS:/Система:/' | sed 's/Kernel:/Ядро:/g' | sed 's/Uptime:/Время работы:/g' | \ - sed 's/Packages:/Установлено пакетов:/g' | sed 's/Shell:/Оболочка:/g' | sed 's/Resolution:/Разрешение:/g' | sed 's/DE:/Среда рабочего стола:/g' | \ - sed 's/WM:/Оконный менеджер:/g' | sed 's/WM Theme:/Тема оконного менеджера:/g' | sed 's/GTK Theme:/Тема GTK:/g' | sed 's/Icon Theme:/Тема значков:/g' | sed 's/Font:/Шрифт:/g' | \ - sed 's/Disk:/Диск:/g' | sed 's/RAM:/Оперативная память:/g'", "r"); - else fp = popen("screenfetch -n -w -N", "r"); - if (fp == NULL) { - printf("Failed to run command\n" ); - exit(1); - } - char *line=NULL; - line=""; - char *prevline=""; - char *pth; - char *preph=""; - line=""; - while (fgets(path, sizeof(path),fp)!=NULL){ - - line=strstr(path,": "); - if (line!=NULL){ - line=yon_cut(line,strlen(line),1); - int size=strlen(path)-strlen(line)+1; - pth=yon_cut(path,size,0); - pth=yon_char_get_augumented("",pth); - pth=yon_char_get_augumented(pth,""); - line=yon_char_get_augumented(pth,line); - } else { - line=path; - pth="\n"; - line=yon_char_get_augumented(pth,line); - if (strlen(line)>40){ - char *fnd=strstr(line," "); - *fnd='\n'; - } - } - prevline=yon_char_get_augumented(prevline,line); - } - prevline=yon_char_get_augumented(prevline,"");; - gtk_label_set_text(GTK_LABEL(labelInfo),prevline); - gtk_label_set_markup (GTK_LABEL(labelInfo),prevline);; + yon_ubl_connect_config((_template_config*)&main_config); + yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK); + config_str unfound = NULL; + int size=0; + yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL); + gtk_init(&argc,&argv); + template_main_window *widgets = yon_ubl_window_setup(); - int socket_id=0; - int socket_ext_id=0; - int socket_trd_id=0; - int option_index=0; - int textsize=0; - int pointer=0; - static struct option long_options[] = { - {"socket-id", 1, 0, 's'}, - {"socket-ext-id", 1, 0, 'e'}, - {"socket-trd-id", 1, 0, 't'}, - }; - int socket_find; - for (int i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ubl-strings.h" + +#define _(String) gettext(String) + +#define glade_path "/com/ublinux/ui/ubl-settings-info.glade" +#define CssPath "/com/ublinux/css/ubl-settings-info.css" +#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) +#define icon_path "com.ublinux.ubl-settings-info" + +#define logo_icon_path "/usr/share/pixmaps/ublinux-logo-text.png" +#define logo_dark_icon_path "/usr/share/pixmaps/ublinux-logo-text-dark.png" + +#define LocaleName "ubl-settings-info" + +#define main_command _("fastfetch --logo none --disable-linewrap --config all.jsonc") + +typedef char* string; + +__attribute__((unused)) static \ +string version_application; + +typedef struct { + template_config_fields + int save_config; + config_str launch_arguments; + int launch_size; +} config; + +typedef struct { + template_window_fields + GtkWidget *InfoIcon; + GtkWidget *InfoTerminal; + GtkWidget *TerminalTemplateLabel; +} main_window; + + + +void yon_main_window_complete(main_window *widgets); +void on_theme_changed(GSettings *, char *, main_window *widgets); +void yon_terminal_style_update(VteTerminal *, main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h new file mode 100644 index 0000000..09a417d --- /dev/null +++ b/source/ubl-strings.h @@ -0,0 +1,4 @@ + +#define TITLE_LABEL _("System Information") +#define TITLE_INFO_LABEL _("Basic System Information") +#define WIKI_LINK _("https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-info") diff --git a/source/ubl-util-standard.c b/source/ubl-util-standard.c deleted file mode 100644 index 8dff154..0000000 --- a/source/ubl-util-standard.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "ubl-util-standard.h" -#ifndef __cplusplus -#ifndef UBL_GET_STANDARD_UI -#define UBL_GET_STANDARD_UI - - -inline returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id){ - returnstruct *ret=(returnstruct*)malloc(sizeof(returnstruct*)); - if (left_plug_id>0&&LeftWidget){ - GtkWidget *plug=gtk_plug_new(left_plug_id); - GtkWidget *toplug=LeftWidget; - gtk_widget_set_visual(plug,gdk_screen_get_rgba_visual(gtk_widget_get_screen(plug))); - gtk_widget_set_app_paintable(plug,1); - if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ - g_object_ref(G_OBJECT(toplug)); - GtkWidget *parent=gtk_widget_get_parent(toplug); - gtk_container_remove(GTK_CONTAINER(parent),toplug); - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - } else - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - gtk_widget_show(GTK_WIDGET(plug)); - ret->plugLeft=plug; - gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); - gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"button"); - gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"opacited"); - gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"color"); - } - if (right_plug_id>0&&RightWidget){ - GtkWidget *plug=gtk_plug_new(right_plug_id); - GtkWidget *toplug=RightWidget; - gtk_widget_set_visual(plug,gdk_screen_get_rgba_visual(gtk_widget_get_screen(plug))); - gtk_widget_set_app_paintable(plug,1); - if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ - g_object_ref(G_OBJECT(toplug)); - GtkWidget *parent=gtk_widget_get_parent(toplug); - gtk_container_remove(GTK_CONTAINER(parent),toplug); - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - } else - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - gtk_widget_show(GTK_WIDGET(plug)); - ret->plugRight=plug; - - GtkStyleContext *context = gtk_widget_get_style_context(plug); - gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); - gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"opacited"); - gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"color"); - } - return ret; -} - -#endif - -#else - - -inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id){ - if (left_plug_id>0&&LeftWidget){ - GtkWidget *plug=gtk_plug_new(left_plug_id); - GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj()); - if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ - g_object_ref(G_OBJECT(toplug)); - GtkWidget *parent=gtk_widget_get_parent(toplug); - gtk_container_remove(GTK_CONTAINER(parent),toplug); - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - } else - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - gtk_widget_show(GTK_WIDGET(plug)); - } - if (right_plug_id>0&&RightWidget){ - GtkWidget *plug=gtk_plug_new(right_plug_id); - GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj()); - if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ - g_object_ref(G_OBJECT(toplug)); - GtkWidget *parent=gtk_widget_get_parent(toplug); - gtk_container_remove(GTK_CONTAINER(parent),toplug); - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - } else - gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); - gtk_widget_show(GTK_WIDGET(plug)); - } -} -#endif \ No newline at end of file diff --git a/source/ubl-util-standard.h b/source/ubl-util-standard.h deleted file mode 100644 index 3209625..0000000 --- a/source/ubl-util-standard.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __cplusplus -#include -#include - -typedef struct { - GtkWidget *plugLeft; - GtkWidget *plugRight; - - -} returnstruct; -static returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id); -#else -#include -#include -#include -#include - - -static void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id); -#endif \ No newline at end of file diff --git a/ubl-settings-info.css b/ubl-settings-info.css index c5e34f2..a036e37 100644 --- a/ubl-settings-info.css +++ b/ubl-settings-info.css @@ -1,44 +1,131 @@ +.thin { + margin:0px; + padding:0px; +} +.noborder { + border:none; +} +.nobackground { +background:transparent; +} +.nobackground:active { +background:transparent; +} .textHead{ text-shadow: 2px 2px @theme_bg_color; color: @theme_text_color; } -.button { - background-image: -gtk-gradient(linear, - left top, left bottom, - from(@entry_background_a), - color-stop(0.20, @entry_background_b), - color-stop(0.85, @entry_background_c), - to(@entry_background_d)); -} -.opacited { - transition: 0ms ease-out; - opacity:0.98; +.inherited>* { border:none; - border-radius:0px; -} -.color { - background-color: inherit; + background:inherit; } -.menuitemsolo { - border-color:alpha(@theme_text_color, 0.4); - border-style:solid; - border-width:inherit; +.workingbg { + background:@theme_base_color; } -.menuitemsolo *{ +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + + .menuitemtop{ + margin-bottom:0px; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop >*{ + margin:6px 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitemmiddle >*{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitembottom >*{ margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; -} -.menuitemsolo:hover { + padding: 3px 10px 3px 5px; + } + .menuitemtop:hover { background:@theme_bg_color; - border:inherit; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle:hover { + background:@theme_bg_color; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitembottom:hover { + background:@theme_bg_color; + border-color:inherit; + border-bottom-width:0px; + border-left-width:inherit; + border-right-width:inherit; -} -.menuitemsolo:hover* { + } + .menuitemtop:hover>* { + margin:6px 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitemmiddle:hover>* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitembottom:hover>* { margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; + padding: 3px 10px 3px 5px; background:@theme_selected_bg_color; - border-color:transparent; - border-radius: 2px; + border-radius:2px; + } + .boxInfoMessError{ + background-color: #ea9999; +} + +.boxInfoMessOK{ + background-color: #f3f0ac; +} +.errorBox { + border-width: 2px; + border-color: #ea9999; + border-style:solid; } + +.chosenOutline{ + transition: 0ms; + border-width: 1px; + border-color: #f3f0ac; + border-style:solid; +} + +.debugborders *{ + border-width: 2px; + border-color: #000000; + border-style: solid; +} + +.terminaltemplate{ + background: @theme_bg_color; + color: @theme_fg_color; +} \ No newline at end of file diff --git a/ubl-settings-info.glade b/ubl-settings-info.glade index fc0c213..cf0f801 100644 --- a/ubl-settings-info.glade +++ b/ubl-settings-info.glade @@ -2,83 +2,40 @@ + - + + True False - False - True - center - com.ublinux.ubl-settings-info - dialog - True - System info - 1.1 - Copyright © 2022 - 2023, UBSoft LLC - Sum up system information - https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-info - Project Home Page - UBGroup - UBGroup - com.ublinux.ubl-settings-info - gpl-2-0 - - - True - False - vertical - 2 - - - False - end - - - False - False - 1 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - System info - - - - - - - + center + 10 + 10 + 10 + 10 + label + True + 0.019999999552965164 + 0.5 + - + + 100 + 1 + 10 + + True False - - 90 + True False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-info + center + 1 + 255 + com.ublinux.ubl-settings-info.logo False @@ -87,52 +44,18 @@ - + True False - - - True - False - - - True - False - vertical - - - 255 - True - False - System Info - - - - - - - - True - True - 0 - - - - - False - True - 0 - - - - - True - True - 0 - - + natural + adjustment1 + natural + UTF-8 + True + False + True @@ -140,6 +63,19 @@ 1 + + + True + False + vertical + adjustment1 + + + False + True + 2 + + True @@ -158,182 +94,4 @@ - - False - com.ublinux.ubl-settings-info - - - True - False - vertical - - - True - False - vertical - - - True - False - vertical - - - 81 - True - False - - - True - False - start - gtk-missing-image - - - -1 - - - - - False - True - 0 - - - - - False - True - 1 - - - - - True - False - True - True - vertical - - - True - False - True - True - - - True - False - center - 1 - gtk-missing-image - 255 - - - True - True - 0 - - - - - True - False - center - 10 - 10 - label - 0.019999999552965164 - 0.5 - - - True - True - 1 - - - - - False - True - 0 - - - - - False - True - 2 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - System info - - - - - - - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 32 - com.ublinux.ubl-settings-info - - - - - True - True - True - False - True - True - menu2 - none - - - - - - - end - 1 - - - - - - diff --git a/ublinux-logo.svg b/ublinux-logo.svg deleted file mode 100644 index d44113c..0000000 --- a/ublinux-logo.svg +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -