From 909c698091380fe9e02718ee99104319eab9b7c2 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 28 Mar 2023 12:28:09 +0600 Subject: [PATCH 01/16] First commit --- .gitignore | 4 + Makefile | 157 + com.ublinux.ubl-settings-video.display.svg | 142 + com.ublinux.ubl-settings-video.svg | 6594 ++++++++++++++++++++ source/CMakeLists.txt | 31 + source/ubl-settings-video.c | 249 + source/ubl-settings-video.h | 139 + source/ubl-utils.c | 474 ++ source/ubl-utils.h | 141 + ubl-settings-video-banner.png | Bin 0 -> 33872 bytes ubl-settings-video.css | 91 + ubl-settings-video.desktop | 15 + ubl-settings-video.glade | 1512 +++++ ubl-settings-video.pot | 170 + ubl-settings-video_ru.po | 184 + 15 files changed, 9903 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 com.ublinux.ubl-settings-video.display.svg create mode 100644 com.ublinux.ubl-settings-video.svg create mode 100644 source/CMakeLists.txt create mode 100644 source/ubl-settings-video.c create mode 100644 source/ubl-settings-video.h create mode 100644 source/ubl-utils.c create mode 100644 source/ubl-utils.h create mode 100644 ubl-settings-video-banner.png create mode 100644 ubl-settings-video.css create mode 100644 ubl-settings-video.desktop create mode 100644 ubl-settings-video.glade create mode 100644 ubl-settings-video.pot create mode 100644 ubl-settings-video_ru.po diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b9beb7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode/ +ubl-settings-video +ubl-settings-video.glade~ +*ubl-settings-video.glade# \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9b33e6e --- /dev/null +++ b/Makefile @@ -0,0 +1,157 @@ +#!/usr/bin/make -f + +#SHELL := /bin/bash +MAKEFILE_FILEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) +MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH)))) +MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) + +CMAKE_COMMAND = cmake +CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source +CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile +#CMAKE_SOURCE_DIR = ./source +#CMAKE_BUILD_DIR = ./compile +FILE_VERSION = VERSION.md +DEPENDS = /bin/cmake +PREFIX ?= /usr +PKGNAME = $(MAKEFILE_DIR) +#PKGNAME = ubl-settings-manager + +default_target: all + +.PHONY: all init depend debug prepare check build uninstall install clean up_ver help + +all: init build + +init: + @echo "Initialize ..."; \ + sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-video.h; \ + gcc source/ubl-settings-video.c source/ubl-utils.c -o ubl-settings-video `pkg-config --cflags --libs gtk+-3.0` -g; \ + echo "-- Build path: ${CMAKE_BUILD_DIR}" + +depend: + @echo "Check depends ..." + @for FILE_DEPEND in $(DEPENDS); do \ + if [ ! -f $${FILE_DEPEND} ]; then \ + echo "ERROR: Depend '$${FILE_DEPEND}' not found !"; \ + exit 1; \ + fi; \ + done; \ + echo "Check depends: OK" +# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 + +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}"; \ + fi; \ + echo "Debug: OK" + +prepare: + @echo "Prepare ..."; \ + 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 \ + echo "Check: OK"; \ + else \ + echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not found !"; \ + exit 1; \ + fi + +build: depend prepare + @echo "Build ..."; \ + make --directory=${CMAKE_BUILD_DIR}; \ + echo "Build: OK" + +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}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + $(RM) "$${PATH_FILE_MO}"; \ + done + @for SIZE in 16x16 32x32 48x48 scalable; do \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/apps/com.ublinux.${PKGNAME}.png"; \ + done + @for FILE_SVG in $(wildcard *.svg); do \ + for SIZE in 16x16 32x32 48x48 scalable; do \ + $(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ + done; \ + done + @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" + @$(RM) "${DESTDIR}/etc/xdg/${PKGNAME}/${PKGNAME}.conf" + @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" + @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" + @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @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 "Uninstall: OK" + +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}"; \ + 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"; \ + 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 -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/devices/" "com.ublinux.${PKGNAME}.display.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}/ui/" "${PKGNAME}-banner.png" + @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" + +clean: + @echo "Clean ..." + @$(RM) -rd ${CMAKE_BUILD_DIR} + @if [ -d ${CMAKE_BUILD_DIR} ]; then \ + echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \ + else \ + echo "Clean: OK"; \ + fi + +up_ver: + @CURRENT=$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2); \ + MAJOR=$$(cut -d. -f1 <<< $${CURRENT}); \ + MINOR=$$(cut -d. -f2 <<< $${CURRENT}); \ + VER="$${MAJOR}.$$(($${MINOR}+1))"; \ + sed "s/VERSION *[[:digit:]]*.*/VERSION $${VER}/" -i ${FILE_VERSION}; \ + echo "Updated version to VERSION.md: $${CURRENT} to $${VER}" + +help: + @echo "The following are some of the valid targets for this Makefile:"; \ + echo "... all (the default if no target is provided)"; \ + echo "... init"; \ + echo "... debug"; \ + echo "... prepare"; \ + echo "... compile"; \ + echo "... install"; \ + echo "... uninstall"; \ + echo "... clean"; \ + echo "... up_ver" diff --git a/com.ublinux.ubl-settings-video.display.svg b/com.ublinux.ubl-settings-video.display.svg new file mode 100644 index 0000000..999af37 --- /dev/null +++ b/com.ublinux.ubl-settings-video.display.svg @@ -0,0 +1,142 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-video.svg b/com.ublinux.ubl-settings-video.svg new file mode 100644 index 0000000..392fcb1 --- /dev/null +++ b/com.ublinux.ubl-settings-video.svg @@ -0,0 +1,6594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt new file mode 100644 index 0000000..0829c09 --- /dev/null +++ b/source/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.7) +project(ubl-settings-video) + +find_package(PkgConfig REQUIRED) + +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") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ + -O2 -pipe -fno-plt -fexceptions \ + -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ + -fstack-clash-protection -fcf-protection") + +set(SOURCE_FILES + ubl-settings-video.c + ubl-settings-video.h + ubl-utils.c + ubl-utils.h) + +set(LIBRARIES + ${GTK_LIBRARIES} + pthread) + + +add_executable(ubl-settings-video ${SOURCE_FILES}) +target_link_libraries(ubl-settings-video ${LIBRARIES}) +install(TARGETS ubl-settings-video DESTINATION bin) \ No newline at end of file diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c new file mode 100644 index 0000000..4783211 --- /dev/null +++ b/source/ubl-settings-video.c @@ -0,0 +1,249 @@ +#include "ubl-settings-video.h" +#include "ubl-utils.h" + +// #include + +config videoconfig; + +void yon_on_plug_added(GtkSocket* self, gpointer user_data){ + +} +void yon_on_plug_removed(GtkSocket* self, gpointer user_data){ + +} + +void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets){ + int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel,!state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo,!state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel,!state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo,!state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel,!state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo,!state); +} + +void on_manual_config_moniitors(GtkWidget *self, widgets_dict *widgets){ + int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(widgets->mainMonitorVisualConfigurationBox,state); +} + +void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors){ + gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); +} + +void on_save_configuration(GtkWidget self, MonitorSettings *monitors){ + +} + +void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ + int monitors_n=yon_check_for_monitors(); + MonitorSettings *monitors = NULL; + monitors=malloc(sizeof(MonitorSettings)); + GtkBuilder *builder=gtk_builder_new_from_file(glade_path); + monitors->templateMonitorConfigurationWindow=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationWindow")); + monitors->templateMonitorConfigurationBox=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationBox")); + monitors->templateMonitorConfigurationMonitorLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationMonitorLabel")); + monitors->templateMonitorConfigurationResolutionLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationResolutionLabel")); + monitors->templateMonitorConfigurationResolutionCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationResolutionCombo")); + monitors->templateMonitorConfigurationFrequencyLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationFrequencyLabel")); + monitors->templateMonitorConfigurationFrequencyCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationFrequencyCombo")); + monitors->templateMonitorConfigurationRotationCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationRotationCombo")); + monitors->templateMonitorConfigurationRotationLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationRotationLabel")); + monitors->templateMonitorConfigurationMainRadio=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationMainRadio")); + monitors->templateMonitorConfigurationParameterLineCheck=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationParameterLineCheck")); + monitors->templateMonitorConfigurationParameterLineEntry=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationParameterLineEntry")); + monitors->templateMonitorConfigurationDoNotSwitchOffLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationDoNotSwitchOffLabel")); + monitors->templateMonitorConfigurationDoNotSwitchOffCheck=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationDoNotSwitchOffCheck")); + monitors->templateMonitorConfigurationCancelButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationCancelButton")); + monitors->templateMonitorConfigurationSaveButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationSaveButton")); + + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_configuration), monitors); + // if (i!=0) + // gtk_radio_button_join_group(GTK_RADIO_BUTTON(monitors[i].templateMonitorConfigurationMainRadio),GTK_RADIO_BUTTON(monitors[i-1].templateMonitorConfigurationMainRadio)); + + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel),_("Monitor: ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel),_("Resolution (px): ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel),_("Frequency (Hz): ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel),_("Rotation: ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); + + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio),_("Main monitor")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),_("through parameter line:")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); + gtk_widget_show(monitors->templateMonitorConfigurationWindow); +} + +MonitorSettings *yon_setup_monitor_settings(){ + int monitors_n=yon_check_for_monitors(); + MonitorSettings *monitors = NULL; + monitors=malloc(sizeof(MonitorSettings)*monitors_n); + for (int i=0;ibuilder=gtk_builder_new_from_file(glade_path); + widgets->MainWindow=yon_gtk_builder_get_widget(widgets->builder,"MainWindow"); + widgets->headBox=yon_gtk_builder_get_widget(widgets->builder,"headBox"); + widgets->headInfoLabel=yon_gtk_builder_get_widget(widgets->builder,"headInfoLabel"); + widgets->mainPlugBox=yon_gtk_builder_get_widget(widgets->builder,"mainPlugBox"); + widgets->mainErrorBox=yon_gtk_builder_get_widget(widgets->builder,"mainErrorBox"); + widgets->mainHeadOverlay=yon_gtk_builder_get_widget(widgets->builder,"mainHeadOverlay"); + widgets->mainHeadBackgroundImage=yon_gtk_builder_get_widget(widgets->builder,"mainHeadBackgroundImage"); + widgets->mainDriverAutomaticallyChooseCheck=yon_gtk_builder_get_widget(widgets->builder,"mainDriverAutomaticallyChooseCheck"); + widgets->mainDriverProprietaryDriverLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverLabel"); + widgets->mainDriverFailsafeNvidiaLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaLabel"); + widgets->mainDriverFailsafeAMDLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDLabel"); + widgets->mainDriverProprietaryDriverCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverCombo"); + widgets->mainDriverFailsafeNvidiaCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaCombo"); + widgets->mainDriverFailsafeAMDCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDCombo"); + widgets->mainDriverFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFrameLabel"); + widgets->monitorConfigurationMethodLabel=yon_gtk_builder_get_widget(widgets->builder,"monitorConfigurationMethodLabel"); + widgets->monitorConfigurationMethodCombo=yon_gtk_builder_get_widget(widgets->builder,"monitorConfigurationMethodCombo"); + widgets->mainMonitorVisualConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorVisualConfigurationBox"); + widgets->mainMonitorConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorConfigurationBox"); + widgets->mainMonitorConfigurationFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorConfigurationFrameLabel"); + widgets->mainHybridGraphicsDiscreteLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsDiscreteLabel"); + widgets->mainHybridGraphicsDiscreteCheck=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsDiscreteCheck"); + widgets->mainHybridGraphicsFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsFrameLabel"); + widgets->mainExtraLaunchOptirunCheck=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchOptirunCheck"); + widgets->mainExtraLaunchPrismusunCheck=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchPrismusunCheck"); + widgets->mainExtraFixGapLabel=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapLabel"); + widgets->mainExtraLaunchOptirunEntry=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchOptirunEntry"); + widgets->mainExtraLaunchPrismusunEntry=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchPrismusunEntry"); + widgets->mainExtraFixGapLabelCombo=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapLabelCombo"); + widgets->mainExtraLaunchThroughButton=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchThroughButton"); + widgets->mainExtraFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFrameLabel"); + widgets->mainHeaderTitleLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderTitleLabel"); + widgets->mainHeaderLoadButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadButton"); + widgets->mainHeaderConfigLoadLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderConfigLoadLabel"); + widgets->mainHeaderSaveConfigurationLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveConfigurationLabel"); + widgets->mainHeaderSaveButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveButton"); + widgets->mainHeaderSettingsButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsButton"); + widgets->mainHeaderLoadGlobalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadGlobalMenuItem"); + widgets->mainHeaderLoadLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadLocalMenuItem"); + widgets->mainHeaderSaveGlobalLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveGlobalLocalMenuItem"); + widgets->mainHeaderSaveGlobalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveGlobalMenuItem"); + widgets->mainHeaderSaveLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveLocalMenuItem"); + widgets->mainHeaderSettingsDocumentationMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsDocumentationMenuItem"); + widgets->mainHeaderSettingsAboutMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsAboutMenuItem"); + widgets->mainStatusBox=yon_gtk_builder_get_widget(widgets->builder,"mainStatusBox"); + widgets->mainStatusIcon=yon_gtk_builder_get_widget(widgets->builder,"mainStatusIcon"); + widgets->mainStatusLabel=yon_gtk_builder_get_widget(widgets->builder,"mainStatusLabel"); + widgets->templateMonitorConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationBox"); + widgets->templateMonitorConfigurationMonitorLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationMonitorLabel"); + widgets->templateMonitorConfigurationResolutionLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationResolutionLabel"); + widgets->templateMonitorConfigurationResolutionCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationResolutionCombo"); + widgets->templateMonitorConfigurationFrequencyLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationFrequencyLabel"); + widgets->templateMonitorConfigurationFrequencyCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationFrequencyCombo"); + widgets->templateMonitorConfigurationRotationLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationRotationLabel"); + widgets->templateMonitorConfigurationRotationCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationRotationCombo"); + widgets->templateMonitorConfigurationMainRadio=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationMainRadio"); + widgets->templateMonitorConfigurationParameterLineCheck=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationParameterLineCheck"); + widgets->templateMonitorConfigurationParameterLineEntry=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationParameterLineEntry"); + widgets->templateMonitorConfigurationDoNotSwitchOffLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationDoNotSwitchOffLabel"); + widgets->templateMonitorConfigurationDoNotSwitchOffCheck=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationDoNotSwitchOffCheck"); + + g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); + + g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); + + + gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel),_("Video output configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel),_("Proprietary driver: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel),_("Failsafe driver nVidia: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeAMDLabel),_("Failsafe driver AMD/ATI: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFrameLabel),_("Driver")); + // gtk_label_set_text(GTK_LABEL(widgets->monitorConfigurationMethodLabel),_("Configuration method")); + gtk_label_set_text(GTK_LABEL(widgets->mainMonitorConfigurationFrameLabel),_("Monitor configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainHybridGraphicsFrameLabel),_("Hybrid graphics")); + gtk_label_set_text(GTK_LABEL(widgets->mainExtraFixGapLabel),_("Fix frame gap (nVidia)")); + gtk_label_set_text(GTK_LABEL(widgets->mainExtraFrameLabel),_("Extra")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderTitleLabel),_("UBlinux Video Configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderConfigLoadLabel),_("Load")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderSaveConfigurationLabel),_("Save")); + + gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck),_("On")); + gtk_button_set_label(GTK_BUTTON(widgets->mainDriverAutomaticallyChooseCheck),_("Automatically choose and use driver")); + gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchOptirunCheck),_("Launch programms through optirun (nVidia): ")); + gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchPrismusunCheck),_("Launch programs through primusun (nVidia): ")); + gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck),_("discrete video only (AMD/ATI)")); + + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadGlobalMenuItem),_("Load from global configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadLocalMenuItem),_("Load from local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalLocalMenuItem),_("Save to global an local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalMenuItem),_("Save to global configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveLocalMenuItem),_("Save to local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsDocumentationMenuItem),_("Documentation")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsAboutMenuItem),_("About")); + + // gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchThroughButton),_("Change")); + + gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); + + gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); + MonitorSettings *monitors = yon_setup_monitor_settings(); + widgets->monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); + widgets->overlays=yon_dictionary_pack_overlays(monitors,yon_check_for_monitors()); + yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays,widgets->mainMonitorVisualConfigurationBox,0,0,0); + // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->monitors,widgets->mainMonitorConfigurationBox,0,0,0); +} + +int main(int argc, char *argv[]){ + + local=setlocale(LC_ALL, ""); + textdomain (LocaleName); + gtk_init(&argc, &argv); + + GError error; + // xfconf_init (&error); + // display_channel = xfconf_channel_new ("displays"); + + + widgets_dict widgets; + yon_setup_widgets(&widgets); + gtk_widget_show(widgets.MainWindow); + + GtkCssProvider *css=gtk_css_provider_new(); + gtk_css_provider_load_from_path(css,CssPath,NULL); + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css), + -1); + gtk_main(); + return 0; +} \ No newline at end of file diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h new file mode 100644 index 0000000..f329a68 --- /dev/null +++ b/source/ubl-settings-video.h @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include "ubl-utils.h" +#ifndef UBL_SETINGS_VIDEO_H +#define UBL_SETINGS_VIDEO_H + +#define banner_path "/usr/share/ubl-settings-video/ui/ubl-settings-video-banner.png" + +#define glade_path "/usr/share/ubl-settings-video/ui/ubl-settings-video.glade" +#define LocalePath "/usr/share/locale" +#define LocaleName "ubl-settings-video" +#define CssPath "/usr/share/ubl-settings-video/css/ubl-settings-video.css" +#define StatusLoadGlobalFailed _("Failed to load global configuration") +#define StatusLoadLocalFailed _("Failed to load local configuration") + +#define StatusSaveGlobalFailed _("Saving to global configuration Succeeded") +#define StatusSaveLocalFailed _("Saving to local configuration Succeeded") + +char *local; + +typedef char* string; + +string version_application = ""; + + + +#define _(String) gettext(String) + +typedef struct { + dictionary *videoconfig; +} config; + +typedef struct { + dictionary *monitors; + dictionary *overlays; + GtkBuilder *builder; + GtkWidget *MainWindow; + GtkWidget *headBox; + GtkWidget *headInfoLabel; + GtkWidget *mainPlugBox; + GtkWidget *mainErrorBox; + GtkWidget *mainHeadOverlay; + GtkWidget *mainHeadBackgroundImage; + GtkWidget *mainDriverAutomaticallyChooseCheck; + GtkWidget *mainDriverProprietaryDriverLabel; + GtkWidget *mainDriverFailsafeNvidiaLabel; + GtkWidget *mainDriverFailsafeAMDLabel; + GtkWidget *mainDriverProprietaryDriverCombo; + GtkWidget *mainDriverFailsafeNvidiaCombo; + GtkWidget *mainDriverFailsafeAMDCombo; + GtkWidget *mainDriverFrameLabel; + GtkWidget *monitorConfigurationMethodLabel; + GtkWidget *monitorConfigurationMethodCombo; + GtkWidget *mainMonitorVisualConfigurationBox; + GtkWidget *mainMonitorConfigurationBox; + GtkWidget *mainMonitorConfigurationFrameLabel; + GtkWidget *mainHybridGraphicsDiscreteLabel; + GtkWidget *mainHybridGraphicsDiscreteCheck; + GtkWidget *mainHybridGraphicsFrameLabel; + GtkWidget *mainExtraLaunchOptirunCheck; + GtkWidget *mainExtraLaunchPrismusunCheck; + GtkWidget *mainExtraFixGapLabel; + GtkWidget *mainExtraLaunchOptirunEntry; + GtkWidget *mainExtraLaunchPrismusunEntry; + GtkWidget *mainExtraLaunchThroughEntry; + GtkWidget *mainExtraFixGapLabelCombo; + GtkWidget *mainExtraLaunchThroughButton; + GtkWidget *mainExtraFrameLabel; + GtkWidget *mainHeaderTitleLabel; + GtkWidget *mainHeaderLoadButton; + GtkWidget *mainHeaderConfigLoadLabel; + GtkWidget *mainHeaderSaveConfigurationLabel; + GtkWidget *mainHeaderSaveButton; + GtkWidget *mainHeaderSettingsButton; + GtkWidget *mainHeaderLoadGlobalMenuItem; + GtkWidget *mainHeaderLoadLocalMenuItem; + GtkWidget *mainHeaderSaveGlobalLocalMenuItem; + GtkWidget *mainHeaderSaveGlobalMenuItem; + GtkWidget *mainHeaderSaveLocalMenuItem; + GtkWidget *mainHeaderSettingsDocumentationMenuItem; + GtkWidget *mainHeaderSettingsAboutMenuItem; + GtkWidget *mainStatusBox; + GtkWidget *mainStatusIcon; + GtkWidget *mainStatusLabel; + GtkWidget *templateMonitorConfigurationBox; + GtkWidget *templateMonitorConfigurationMonitorLabel; + GtkWidget *templateMonitorConfigurationResolutionLabel; + GtkWidget *templateMonitorConfigurationResolutionCombo; + GtkWidget *templateMonitorConfigurationFrequencyLabel; + GtkWidget *templateMonitorConfigurationFrequencyCombo; + GtkWidget *templateMonitorConfigurationRotationLabel; + GtkWidget *templateMonitorConfigurationRotationCombo; + GtkWidget *templateMonitorConfigurationMainRadio; + GtkWidget *templateMonitorConfigurationParameterLineCheck; + GtkWidget *templateMonitorConfigurationParameterLineEntry; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffLabel; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; +} widgets_dict; + +typedef struct { + GtkWidget *templateMonitorConfigurationWindow; + GtkWidget *templateMonitorConfigurationBox; + GtkWidget *templateMonitorConfigurationMonitorLabel; + GtkWidget *templateMonitorConfigurationResolutionLabel; + GtkWidget *templateMonitorConfigurationResolutionCombo; + GtkWidget *templateMonitorConfigurationFrequencyLabel; + GtkWidget *templateMonitorConfigurationFrequencyCombo; + GtkWidget *templateMonitorConfigurationRotationCombo; + GtkWidget *templateMonitorConfigurationRotationLabel; + GtkWidget *templateMonitorConfigurationMainRadio; + GtkWidget *templateMonitorConfigurationParameterLineCheck; + GtkWidget *templateMonitorConfigurationParameterLineEntry; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffLabel; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; + GtkWidget *templateMonitorConfigurationCancelButton; + GtkWidget *templateMonitorConfigurationSaveButton; + + GtkWidget *templateMonitorscreenOverlay; + GtkWidget *templateMonitorInfoBox; + GtkWidget *templateMonitorInfoNameLabel; + GtkWidget *templateMonitorInfoResolutionLabel; + GtkWidget *templateMonitorInfoConfigureButton; +} MonitorSettings; + + + +int yon_check_for_monitors(); +MonitorSettings *yon_setup_monitor_settings(); +dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size); +dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size); +void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); +void on_save_configuration(GtkWidget self, MonitorSettings *monitors); + +#endif \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c new file mode 100644 index 0000000..befb9a1 --- /dev/null +++ b/source/ubl-utils.c @@ -0,0 +1,474 @@ +#include "ubl-utils.h" +#ifndef UBL_UTILS + +typedef enum { + DICTIONARY_ACTION_WIDGETS_TYPE, + DICTIONARY_IVGRAPHICALS_TYPE, + DICTIONARY_OTHER_TYPE + +} DICT_TYPE; + +typedef struct dictionary { + char *key; + void *data; + struct dictionary *next; + struct dictionary *prev; + struct dictionary *first; + DICT_TYPE data_type; +} dictionary; + +typedef struct apps{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; + } apps; + +typedef struct { + char *command; + int *exitcode; +} thread_output; + +#ifdef __GTK_H__ +typedef struct IVGrapgicals{ + char *sectionName; + char *categories; + GtkListStore *LV; + GtkWidget *Box; + GtkWidget *IV; + GtkWidget *label; + GtkWidget *sep; + GtkCellRendererPixbuf *iconRender; +} IVGraphicals; +#endif +#endif + + +//dictionary functions + +dictionary *yon_dictionary_create_empty(){ + dictionary *dict=malloc(sizeof(dictionary)); + dict->data=NULL; + dict->key=NULL; + dict->next=NULL; + dict->prev=NULL; + dict->first=dict; + dict->data_type=DICTIONARY_OTHER_TYPE; + return dict; +} + +void yon_dictionary_switch_to_last(dictionary **dict){ + if ((*dict)->next!=NULL) + for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){} +} + +dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ + yon_dictionary_switch_to_last(&targetdict); + targetdict->next=yon_dictionary_create_empty(); + targetdict->next->prev=targetdict; + targetdict->next->first=targetdict->first; + targetdict->next->data_type=DICTIONARY_OTHER_TYPE; + return targetdict->next; +} + +dictionary *yon_dictionary_get_last(dictionary *dict){ + dictionary *dct=NULL; + for (dct=dict->first;dct->next!=NULL;dct=dct->next){} + return dct; +} + +dictionary *yon_dictionary_switch_places(dictionary *dict,int aim){ + if (aim<0){ + if (dict->prev){ + if (dict->prev->prev){ + dictionary *next = dict->next,*prev=dict->prev,*preprev=prev->prev; + if (next){ + preprev->next=dict; + dict->prev=preprev; + dict->next=prev; + prev->prev=dict; + prev->next=next; + next->prev=prev; + } else { + preprev->next=dict; + dict->prev=preprev; + dict->next=prev; + prev->prev=dict; + prev->next=NULL; + } + return prev; + } else { + dictionary *next = dict->next,*prev=dict->prev; + if (next){ + yon_dictionary_make_first(dict); + dict->prev=NULL; + dict->next=prev; + prev->prev=dict; + prev->next=next; + next->prev=prev; + } else { + dict->prev=NULL; + dict->next=prev; + prev->prev=dict; + prev->next=NULL; + } + return prev; + } + } + } else if (aim>0){ + if (dict->next){ + if (dict->next->next){ + dictionary *next = dict->next,*prev=dict->prev,*afnext=next->next; + if (prev){ + prev->next=next; + next->prev=prev; + next->next=dict; + dict->prev=next; + dict->next=afnext; + afnext->prev=dict; + } else { + yon_dictionary_make_first(next); + next->prev=NULL; + next->next=dict; + dict->prev=next; + dict->next=afnext; + afnext->prev=dict; + } + return next; + } else { + dictionary *next = dict->next,*prev=dict->prev; + if (prev){ + prev->next=next; + next->prev=prev; + next->next=dict; + dict->prev=next; + dict->next=NULL; + } else { + next->prev=NULL; + next->next=dict; + dict->prev=next; + dict->next=NULL; + } + } + } + } +} + +void yon_dictionary_make_first(dictionary *dict){ + for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ + dct->first=dict; + } +} + +void yon_dictionary_make_nth(dictionary *dict, int nth){ + dictionary *dct=dict->first; + for (int i=0;inext;} + yon_dictionary_rip(dict); + dictionary *prev=dct->prev; + prev->next=dict; + dict->prev=prev; + dict->next=dct; + dct->prev=dict; +} + +dictionary *yon_dictionary_create_with_data(char *key, void *data){ + dictionary *dct=yon_dictionary_create_empty(); + dct->key=key; + dct->data=data; + dct->data_type=DICTIONARY_OTHER_TYPE; + return dct; +} + +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ + dictionary *dct=yon_dictionary_create_conneced(dict); + dct->key=key; + dct->data=data; + dct->data_type=DICTIONARY_OTHER_TYPE; + return dct; +} + +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect){ + dictionary *dict=yon_dictionary_get_last(old); + dict->next=toconnect; + toconnect->prev=dict; + toconnect->first=dict->first; + return toconnect; +} + +dictionary *yon_dictionary_find(dictionary **dict, char *key){ + dictionary *dct=*dict; + for (dictionary *pointer=dct->first;pointer!=NULL;pointer=pointer->next){ + if (strcmp(pointer->key,key)==0){ + *dict=pointer; + return pointer; + } + } + return NULL; +} + + +dictionary *yon_dictionary_rip(dictionary *dict){ + if (!dict->next){ + dictionary *prev=dict->prev; + if (prev){ + prev->next=NULL; + return prev; + } else return dict; + } + else if (!dict->prev){ + dictionary *next=dict->next; + if (next){ + yon_dictionary_make_first(next); + next->prev=NULL; + return next; + } + else return dict; + } + else { + dictionary *next=dict->next, *prev=dict->prev; + next->prev=prev; + prev->next=next; + return next; + } +} + +dictionary *yon_dictionary_get_nth(dictionary *dict, int place){ + for (int i=0;inext; + return dict; +} + +//char functions + +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; +} + +char *yon_char_new(char *chr){ + char *newchar=malloc(strlen(chr)+1); + memset(newchar,0,strlen(chr)+1); + memcpy(newchar,chr,strlen(chr)); + return newchar; +} + +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; +} + +char *yon_char_divide(char *source, int dividepos){ + char *cut=malloc(dividepos+1); + memset(cut,0,dividepos+1); + memcpy(cut,source,dividepos); + char *left=malloc(strlen(source)-strlen(cut)); + memset(left,0,strlen(source)-strlen(cut)); + memcpy(left,source+dividepos+1,(strlen(source)-dividepos)); + memset(source,0,strlen(source)); + memcpy(source,left,strlen(left)); + return cut; +} + +char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ + char *cut=strstr(source,dividepos); + int leng=strlen(source)-strlen(cut); + cut=yon_char_divide(source,leng); + return cut; +} + +char *yon_char_from_int(int int_to_convert){ + int i=1; + float convert_check=(float)int_to_convert; + for (i=1;convert_check>10;i++){ + convert_check=convert_check/10; + } + char *ch=malloc(i*sizeof(char)+1); + sprintf(ch,"%d",int_to_convert); + return ch; +} + + +//parsing functions + +apps *yon_apps_scan_and_parse_desktops(int *sizef){ + int size=0; + struct apps *applist; + { + DIR *directory=opendir(DesktopPath); + struct dirent *de; + while ((de = readdir(directory))) + { + FILE *file; + char *path=yon_char_get_augumented(DesktopPath,de->d_name); + file=fopen(path,"r"); + if (strlen(de->d_name)>9) + { + char *extension=strstr(path,"."); + if (extension!=NULL) + { + if (strcmp(extension,".desktop")==0) + { + apps tempapp; + GKeyFile *gfile=g_key_file_new(); + g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); + char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); + if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; + tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); + if (tempapp.Name==NULL) continue; + tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); + if (tempapp.Categories==NULL) continue; + tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); + if (tempapp.Exec==NULL) continue; + tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); + if (tempapp.Icon==NULL) continue; + tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); + if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); + if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); + if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) + if (size==0){ + applist=(apps*)malloc(size+1*sizeof(apps)); + applist[0].Name=yon_char_new(tempapp.Name); + applist[0].Categories=yon_char_new(tempapp.Categories); + applist[0].Exec=yon_char_new(tempapp.Exec); + applist[0].Icon=yon_char_new(tempapp.Icon); + applist[0].Type=tempapp.Type; + applist[0].Pluggable=tempapp.Pluggable; + applist[0].DualPluggable=tempapp.DualPluggable; + size++; + } else { + applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); + applist[size].Name=yon_char_new(tempapp.Name); + applist[size].Categories=yon_char_new(tempapp.Categories); + applist[size].Exec=yon_char_new(tempapp.Exec); + applist[size].Icon=yon_char_new(tempapp.Icon); + applist[size].Pluggable=tempapp.Pluggable; + applist[size].DualPluggable=tempapp.DualPluggable; + applist[size].Type=tempapp.Type; + size++; + } + } + } + } + } + } + *sizef=size; + return applist; +}; + + +void yon_apps_sort(apps *applist,int size){ + apps tmp; + if (size>2) + { + for (int i=1;icommand=path; + thread->exitcode=malloc(sizeof(int)); + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void*)yon_launch, thread); + return *thread->exitcode; +}; + + +int yon_launch_app_with_arguments(char *name, char *args){ + char *path=yon_char_get_augumented("/usr/bin/",name); + path=yon_char_get_augumented(path," "); + path=yon_char_get_augumented(path,args); + pthread_t thread_id; + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void*)yon_launch, thread); + return *thread->exitcode; +}; + + +int yon_launch(thread_output *thread){ + int a=0; + a=system(thread->command); + *thread->exitcode=a; + return *thread->exitcode; +} + + +//Gtk functions + +#ifdef __GTK_H__ + + + +GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data){ + GtkWidget *socket; + socket = gtk_socket_new(); + g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(yon_on_plug_added),data); + g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(yon_on_plug_removed),data); + g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(yon_on_plug_removed),data); + gtk_box_pack_start(GTK_BOX(container),socket,1,1,0); + return socket; +}; + +int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment){ + if (icon_view_segment->data_type==DICTIONARY_IVGRAPHICALS_TYPE){ + for (dictionary *icvd=icon_view_segment->first;icvd!=NULL;icvd=icvd->next){ + IVGraphicals *icv=icvd->data; + GtkTreeIter iter; + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){ + gtk_widget_hide(icv->Box); + // gtk_widget_hide(GTK_WIDGET(icv->sep)); + } + } + } +} + +int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding){ + for (dictionary *dct=dict->first; dct!=NULL;dct=dct->next){ + gtk_box_pack_start(GTK_BOX(destination),(GtkWidget*)dct->data,expand,fill,padding); + } + return 1; +} + +int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding){ + for (dictionary *dct=dict->first; dct!=NULL;dct=dct->next){ + gtk_box_pack_end(GTK_BOX(destination),(GtkWidget*)dct->data,expand,fill,padding); + } + return 1; +} + +#endif \ No newline at end of file diff --git a/source/ubl-utils.h b/source/ubl-utils.h new file mode 100644 index 0000000..73de3e8 --- /dev/null +++ b/source/ubl-utils.h @@ -0,0 +1,141 @@ +#ifndef UBL_UTILS +#define UBL_UTILS +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DesktopPath "/usr/share/applications" + +typedef enum { + DICTIONARY_ACTION_WIDGETS_TYPE, + DICTIONARY_IVGRAPHICALS_TYPE, + DICTIONARY_OTHER_TYPE + +} DICT_TYPE; + + +typedef struct { + char *command; + int *exitcode; +} thread_output; + +typedef struct dictionary { + char *key; + void *data; + struct dictionary *next; + struct dictionary *prev; + struct dictionary *first; + DICT_TYPE data_type; +} dictionary; + +typedef struct apps{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; + } apps; + + +//dictionary functions + + +dictionary *yon_dictionary_get_last(dictionary *dict); + +dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); + +void yon_dictionary_make_first(dictionary *dict); + +void yon_dictionary_make_nth(dictionary *dict, int nth); + +dictionary *yon_dictionary_create_with_data(char *key, void *data); + +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); + +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect); + +dictionary *yon_dictionary_find(dictionary **dict, char *key); + +dictionary *yon_dictionary_rip(dictionary *dict); + +dictionary *yon_dictionary_get_nth(dictionary *dict, int place); + +//char functions + +char *yon_char_get_augumented(char *source, char *append); + +char *yon_char_new(char *chr); + +char *yon_cut(char *source, int size, int startpos); + +char *yon_char_divide(char *source, int dividepos); + +char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); + +char *yon_char_from_int(int int_to_convert); + + + +//parsing functions + +apps *yon_apps_scan_and_parse_desktops(int *sizef); + + +void yon_apps_sort(apps *applist,int size); + + +apps *yon_apps_get_by_name(apps *applist,char *name, int size); + + +//terminal-using functions + + + +int yon_launch_app(char *name); + + +int yon_launch_app_with_arguments(char *name, char *args); + + +int yon_launch(thread_output *thread); + +//Gtk functions + +#ifdef __GTK_H__ + +#define yon_gtk_builder_get_widget(obj,obj2) GTK_WIDGET(gtk_builder_get_object(obj,obj2)) +typedef struct IVGrapgicals{ + char *sectionName; + char *categories; + GtkListStore *LV; + GtkWidget *Box; + GtkWidget *IV; + GtkWidget *label; + GtkWidget *sep; + GtkCellRendererPixbuf *iconRender; +} IVGraphicals; + + +GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); + +int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); + +//uninitialised + +void yon_on_plug_added(GtkSocket* self, gpointer user_data); +void yon_on_plug_removed(GtkSocket* self, gpointer user_data); + +int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); +int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); + +#endif +#endif \ No newline at end of file diff --git a/ubl-settings-video-banner.png b/ubl-settings-video-banner.png new file mode 100644 index 0000000000000000000000000000000000000000..8eb67cbc38babeaf498d981356cf7e77e2741f12 GIT binary patch literal 33872 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 z + + + + + + + + + + + + + + + + + + + + + + + + True + False + False + + + True + False + Load from global configuration + True + + + + + + True + False + Load from local configuration + True + + + + + + True + False + False + + + True + False + Save to global an local configuration + True + + + + + + True + False + Save to global configuration + True + + + + + + True + False + Save to local configuration + True + + + + + + + True + False + False + + + True + False + Documentation + True + + + + + + True + False + About + True + + + + + + + False + О Программе + False + True + center + com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + 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-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + + + + True + False + + + 90 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + + True + False + + + True + False + + + True + False + vertical + + + 255 + True + False + Video output configuration + + + + + + + + + True + True + 0 + + + + + False + True + 0 + + + + + True + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + document-edit-symbolic + + + True + False + document-edit-symbolic + + + False + 800 + 600 + com.ublinux.ubl-settings-video + + + True + False + True + vertical + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + + + 81 + True + False + + + True + False + start + + + -1 + + + + + False + True + 0 + + + + + False + True + 1 + + + + + True + False + 5 + 5 + 5 + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + Automatically choose and use driver + True + True + False + start + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + vertical + 5 + + + True + False + start + Proprietary driver: + 0 + + + False + True + 0 + + + + + True + False + start + Failsafe driver nVidia: + 0 + + + False + True + 1 + + + + + True + False + start + Failsafe driver AMD/ATI: + 0 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + + ubm-nvidia-340 + ubm-nvidia-390 + ubm-nvidia-470 + ubm-nvidia-510 + ubm-nvidia-515 + ubm-nvidia-optimus + + + + False + True + 0 + + + + + True + False + + Off + fbdev + + + + False + True + 1 + + + + + True + False + + Off + fbdev + + + + False + True + 2 + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Driver + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + + + 165 + True + True + 12 + 5 + 12 + 5 + external + + + True + False + + + True + False + 5 + 5 + 10 + + + + + + + + + + + + + + True + False + Monitor configuration + + + + + True + True + 0 + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + + + discrete video only (AMD/ATI) + True + True + False + 5 + True + + + False + True + 1 + + + + + + + + + True + False + 0 + Hybrid graphics + + + + + False + True + 2 + + + + + True + False + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + True + False + 5 + + + True + False + vertical + 5 + + + Launch programms through optirun (nVidia): + True + True + False + True + + + False + True + 0 + + + + + Launch programs through primusun (nVidia): + True + True + False + True + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + True + steam + + + True + True + 0 + + + + + True + True + steam + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + vertical + 5 + + + True + False + True + True + image1 + + + False + True + 0 + + + + + True + False + True + True + image2 + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + True + False + Fix frame gap (nVidia): + 0 + + + False + True + 0 + + + + + True + False + + 1st variant + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Extra + + + + + False + True + 3 + + + + + True + True + 2 + + + + + True + True + 0 + + + + + + + True + False + True + + + True + False + start + 5 + 5 + 5 + 5 + False + UBlinux Video Configuration + + + + + + + + True + False + 5 + 5 + 5 + 5 + 32 + com.ublinux.ubl-settings-video + + + + + True + False + + + True + True + False + True + LoadConfigurationMenu + none + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + 1 + + + + + True + False + + + True + True + False + True + True + SaveConfigurationMenu + none + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Save + + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + True + False + True + True + SettingsMenu + none + + + + + + False + True + 1 + + + + + end + 3 + + + + + + + vertical + + + + + + + + + + + + + + + + + + + + + + True + False + open-menu-symbolic + + + + True + False + center + center + 20 + vertical + + + True + False + Monitor + + + + + + + False + True + 0 + + + + + True + False + 1920x1200:60Hz + + + + + + + False + True + 1 + + + + + True + True + True + end + image3 + + + + False + True + 2 + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + + + + + False + com.ublinux.ubl-settings-video + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + start + Monitor: + + + False + True + 0 + + + + + True + False + 0 + + + False + True + 1 + + + + + Main monitor + True + True + False + 15 + 15 + True + True + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Resolution (px): + 0 + + + False + True + 0 + + + + + True + False + center + + + True + True + 1 + + + + + True + False + 5 + + + True + False + Frequency (Hz) + + + False + True + 0 + + + + + True + False + center + + + False + True + 1 + + + + + False + True + 2 + + + + + True + True + 1 + + + + + True + False + 5 + + + True + False + Rotation + 0 + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + True + False + + + + + + False + True + 2 + + + + + False + True + 2 + + + + + True + False + 5 + 5 + + + through parameter line: + True + True + False + True + + + False + True + 0 + + + + + True + True + center + + + True + True + 1 + + + + + False + True + 3 + + + + + True + False + + + False + True + 4 + + + + + True + False + vertical + + + True + False + end + 5 + True + + + Save + True + True + True + image5 + + + False + True + end + 0 + + + + + Cancel + True + True + True + image4 + + + False + True + end + 1 + + + + + False + True + 0 + + + + + False + True + 5 + + + + + True + True + 0 + + + + + + + True + False + + + True + False + 128 + com.ublinux.ubl-settings-video.display + 6 + + + -1 + + + + diff --git a/ubl-settings-video.pot b/ubl-settings-video.pot new file mode 100644 index 0000000..9b44ea9 --- /dev/null +++ b/ubl-settings-video.pot @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-03-27 12:30+0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: source/ubl-settings-video.c:33 +msgid "Monitor: " +msgstr "" + +#: source/ubl-settings-video.c:34 +msgid "Resolution (px): " +msgstr "" + +#: source/ubl-settings-video.c:35 +msgid "Frequency (Hz): " +msgstr "" + +#: source/ubl-settings-video.c:36 +msgid "Rotation: " +msgstr "" + +#: source/ubl-settings-video.c:37 +msgid "Do not switch display off" +msgstr "" + +#: source/ubl-settings-video.c:39 +msgid "Main monitor" +msgstr "" + +#: source/ubl-settings-video.c:40 +msgid "through parameter line:" +msgstr "" + +#: source/ubl-settings-video.c:41 +msgid "DPMS off" +msgstr "" + +#: source/ubl-settings-video.c:125 +msgid "Launch programms through (nVidia)" +msgstr "" + +#: source/ubl-settings-video.c:126 +msgid "Video output configuration" +msgstr "" + +#: source/ubl-settings-video.c:127 +msgid "Proprietary driver: " +msgstr "" + +#: source/ubl-settings-video.c:128 +msgid "Failsafe driver nVidia: " +msgstr "" + +#: source/ubl-settings-video.c:129 +msgid "Failsafe driver AMD/ATI: " +msgstr "" + +#: source/ubl-settings-video.c:130 +msgid "Driver" +msgstr "" + +#: source/ubl-settings-video.c:131 +msgid "Configuration method" +msgstr "" + +#: source/ubl-settings-video.c:132 +msgid "Monitor configuration" +msgstr "" + +#: source/ubl-settings-video.c:133 +msgid "discrete video only (AMD/ATI)" +msgstr "" + +#: source/ubl-settings-video.c:134 +msgid "Hybrid graphics" +msgstr "" + +#: source/ubl-settings-video.c:135 +msgid "Fix frame gap (nVidia)" +msgstr "" + +#: source/ubl-settings-video.c:136 +msgid "Extra" +msgstr "" + +#: source/ubl-settings-video.c:137 +msgid "UBlinux Video Configuration" +msgstr "" + +#: source/ubl-settings-video.c:138 +msgid "Load" +msgstr "" + +#: source/ubl-settings-video.c:139 +msgid "Save" +msgstr "" + +#: source/ubl-settings-video.c:141 +msgid "Manual configuration" +msgstr "" + +#: source/ubl-settings-video.c:142 +msgid "On" +msgstr "" + +#: source/ubl-settings-video.c:143 +msgid "Automatically choose and use driver" +msgstr "" + +#: source/ubl-settings-video.c:145 +msgid "Load from global configuration" +msgstr "" + +#: source/ubl-settings-video.c:146 +msgid "Load from local configuration" +msgstr "" + +#: source/ubl-settings-video.c:147 +msgid "Save to global an local configuration" +msgstr "" + +#: source/ubl-settings-video.c:148 +msgid "Save to global configuration" +msgstr "" + +#: source/ubl-settings-video.c:149 +msgid "Save to local configuration" +msgstr "" + +#: source/ubl-settings-video.c:150 +msgid "Documentation" +msgstr "" + +#: source/ubl-settings-video.c:151 +msgid "About" +msgstr "" + +#: source/ubl-settings-video.c:153 +msgid "Change" +msgstr "" + +#: source/ubl-settings-video.h:16 +msgid "Failed to load global configuration" +msgstr "" + +#: source/ubl-settings-video.h:17 +msgid "Failed to load local configuration" +msgstr "" + +#: source/ubl-settings-video.h:19 +msgid "Saving to global configuration Succeeded" +msgstr "" + +#: source/ubl-settings-video.h:20 +msgid "Saving to local configuration Succeeded" +msgstr "" diff --git a/ubl-settings-video_ru.po b/ubl-settings-video_ru.po new file mode 100644 index 0000000..5ef5750 --- /dev/null +++ b/ubl-settings-video_ru.po @@ -0,0 +1,184 @@ +# Language translations for ubl-settings-manager package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ubl-settings-manager package. +# UBLinux Team , 2022 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: ubl-settings-manager 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-03-27 12:30+0600\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: UBLinux Team \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: source/ubl-settings-video.c:33 +msgid "Monitor: " +msgstr "Монитор: " + +#: source/ubl-settings-video.c:34 +msgid "Resolution (px): " +msgstr "Разрешение (px): " + +#: source/ubl-settings-video.c:35 +msgid "Frequency (Hz): " +msgstr "Обновления (Hz): " + +#: source/ubl-settings-video.c:36 +msgid "Rotation: " +msgstr "Вращение: " + +#: source/ubl-settings-video.c:37 +msgid "Do not switch display off" +msgstr "Не выключать дисплей" + +#: source/ubl-settings-video.c:39 +#, fuzzy +msgid "Main monitor" +msgstr "Основной" + +#: source/ubl-settings-video.c:40 +msgid "through parameter line:" +msgstr "Через строку параметра: " + +#: source/ubl-settings-video.c:41 +msgid "DPMS off" +msgstr "DMPS выключен" + +#: source/ubl-settings-video.c:125 +msgid "Launch programms through (nVidia)" +msgstr "Запуск программ через (nVidia)" + +#: source/ubl-settings-video.c:126 +msgid "Video output configuration" +msgstr "Настройка вывода изображения" + +#: source/ubl-settings-video.c:127 +#, fuzzy +msgid "Proprietary driver: " +msgstr "Проприетарный драйвер: " + +#: source/ubl-settings-video.c:128 +#, fuzzy +msgid "Failsafe driver nVidia: " +msgstr "Отказоучтойчивый драйвер nVidia: " + +#: source/ubl-settings-video.c:129 +#, fuzzy +msgid "Failsafe driver AMD/ATI: " +msgstr "Отказоустойчивый драйвер AMD/ATI: " + +#: source/ubl-settings-video.c:130 +msgid "Driver" +msgstr "Драйвер" + +#: source/ubl-settings-video.c:131 +msgid "Configuration method" +msgstr "Метод настройки: " + +#: source/ubl-settings-video.c:132 +msgid "Monitor configuration" +msgstr "Настройка экрана" + +#: source/ubl-settings-video.c:133 +msgid "discrete video only (AMD/ATI)" +msgstr "Только дискретное видео (AMD/ATI)" + +#: source/ubl-settings-video.c:134 +msgid "Hybrid graphics" +msgstr "Гибридная графика" + +#: source/ubl-settings-video.c:135 +msgid "Fix frame gap (nVidia)" +msgstr "Исправить разрыв кадров (nVidia)" + +#: source/ubl-settings-video.c:136 +msgid "Extra" +msgstr "Дополнительно" + +#: source/ubl-settings-video.c:137 +msgid "UBlinux Video Configuration" +msgstr "Видеокарта/Экран" + +#: source/ubl-settings-video.c:138 +msgid "Load" +msgstr "Загрузить" + +#: source/ubl-settings-video.c:139 +msgid "Save" +msgstr "Сохранить" + +#: source/ubl-settings-video.c:141 +msgid "Manual configuration" +msgstr "Ручная настройка" + +#: source/ubl-settings-video.c:142 +msgid "On" +msgstr "Включить" + +#: source/ubl-settings-video.c:143 +msgid "Automatically choose and use driver" +msgstr "Автоматический выбор и использование драйвера" + +#: source/ubl-settings-video.c:145 +#, fuzzy +msgid "Load from global configuration" +msgstr "Загрузить глобальную конфигурацию" + +#: source/ubl-settings-video.c:146 +#, fuzzy +msgid "Load from local configuration" +msgstr "Загрузить локальную конфигуруцию" + +#: source/ubl-settings-video.c:147 +#, fuzzy +msgid "Save to global an local configuration" +msgstr "Сохранить в глобальную и локальную конфигурацию" + +#: source/ubl-settings-video.c:148 +#, fuzzy +msgid "Save to global configuration" +msgstr "Сохранить в глобальную конфигурацию" + +#: source/ubl-settings-video.c:149 +#, fuzzy +msgid "Save to local configuration" +msgstr "Схоранить в локальную конфигурацию" + +#: source/ubl-settings-video.c:150 +#, fuzzy +msgid "Documentation" +msgstr "Справка" + +#: source/ubl-settings-video.c:151 +msgid "About" +msgstr "О программе" + +#: source/ubl-settings-video.c:153 +msgid "Change" +msgstr "Измеить" + +#: source/ubl-settings-video.h:16 +#, fuzzy +msgid "Failed to load global configuration" +msgstr "Ошибка загрузки глобальной конфигурации" + +#: source/ubl-settings-video.h:17 +#, fuzzy +msgid "Failed to load local configuration" +msgstr "Ошибка загрузки локальной конфигурации" + +#: source/ubl-settings-video.h:19 +#, fuzzy +msgid "Saving to global configuration Succeeded" +msgstr "Успешное сохранение глобальной конфигурации" + +#: source/ubl-settings-video.h:20 +#, fuzzy +msgid "Saving to local configuration Succeeded" +msgstr "Успешное сохранение локальной конфигурации" -- 2.35.1 From b5f436018524db07c60740b06042e51c33b96d0d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 3 Apr 2023 17:27:55 +0000 Subject: [PATCH 02/16] development still in progress --- .gitignore | 3 +- com.ublinux.ubl-settings-video.checked.svg | 327 ++++ com.ublinux.ubl-settings-video.warning.svg | 55 + source/ubl-settings-video.c | 163 +- source/ubl-settings-video.h | 45 + source/ubl-utils.c | 191 ++- source/ubl-utils.h | 49 +- ubl-settings-video.css | 14 +- ubl-settings-video.glade | 1617 +++++++++++++------- 9 files changed, 1804 insertions(+), 660 deletions(-) create mode 100644 com.ublinux.ubl-settings-video.checked.svg create mode 100644 com.ublinux.ubl-settings-video.warning.svg diff --git a/.gitignore b/.gitignore index 6b9beb7..041dc72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/ ubl-settings-video ubl-settings-video.glade~ -*ubl-settings-video.glade# \ No newline at end of file +*ubl-settings-video.glade# +compile/ \ No newline at end of file diff --git a/com.ublinux.ubl-settings-video.checked.svg b/com.ublinux.ubl-settings-video.checked.svg new file mode 100644 index 0000000..e3cab42 --- /dev/null +++ b/com.ublinux.ubl-settings-video.checked.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-video.warning.svg b/com.ublinux.ubl-settings-video.warning.svg new file mode 100644 index 0000000..9a90dba --- /dev/null +++ b/com.ublinux.ubl-settings-video.warning.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 4783211..54d83f8 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -1,13 +1,13 @@ #include "ubl-settings-video.h" #include "ubl-utils.h" -// #include config videoconfig; void yon_on_plug_added(GtkSocket* self, gpointer user_data){ } + void yon_on_plug_removed(GtkSocket* self, gpointer user_data){ } @@ -17,24 +17,127 @@ void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets){ gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel,!state); gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo,!state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverButton,!state); gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel,!state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo,!state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel,!state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo,!state); } -void on_manual_config_moniitors(GtkWidget *self, widgets_dict *widgets){ - int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); +void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors){ + gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); +} + +void on_save_configuration_local(GtkWidget *self){ - gtk_widget_set_sensitive(widgets->mainMonitorVisualConfigurationBox,state); } +void on_save_configuration_global(GtkWidget *self){ + +} +void on_load_configuration_local(GtkWidget *self){ + +} +void on_load_configuration_global(GtkWidget *self){ -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors){ - gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); } -void on_save_configuration(GtkWidget self, MonitorSettings *monitors){ +void on_accept_monitor_settings(GtkWidget *self){ +} +void on_check_optisun(GtkWidget *self){ + +} +void on_check_primusrun(GtkWidget *self){ + +} +void on_check_discrete_only(GtkWidget *self){ + +} + +void yon_parse_monitor(dictionary *monitor,char *string_of_settings){ + char *result=NULL; + if ((strstr(string_of_settings,","))){ + result=yon_char_divide_search(string_of_settings,",",1); + ((monitorconfig*)monitor->data)->resolution=result; + } + char *tmp=NULL; + if (tmp=strstr(string_of_settings,"rotate:")) ((monitorconfig*)monitor->data)->rotation=tmp; + +} + +void yon_setup_config(){ + FILE *videoports = popen(get_ports_command, "r"); + char str[1000]; + while (fgets(str,1000,videoports)){ + printf("%s\n",str); + char *strng=yon_char_divide_search(str,"\n",0); + monitorconfig *monitor=malloc(sizeof(monitorconfig)); + monitor->port=yon_char_new(strng); + if (!videoconfig.monitors) { + videoconfig.monitors=yon_dictionary_create_with_data(strng,monitor);} + else { + videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,strng,monitor); + } + memset(str,0,1000); + } + char *command=load_drivers_local_command; + dictionary *dct; + for_dictionaries(dct,videoconfig.monitors){ + command=yon_char_get_augumented(command,(yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(((monitorconfig*)dct->data)->port,"]")))); + } + FILE *local = popen(command, "r"); + char result[1000]; + memset(result,0,1000); + if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) + videoconfig.failsafenVidia=result; + else videoconfig.failsafenVidia=NULL; + memset(result,0,1000); + if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) + videoconfig.failsafeATI=result; + else videoconfig.failsafeATI=NULL; + memset(result,0,1000); + if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) + videoconfig.optirun=result; + else videoconfig.optirun=NULL; + memset(result,0,1000); + if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) + videoconfig.primusrun=result; + else videoconfig.primusrun=NULL; + for_dictionaries(dct,videoconfig.monitors){ + fgets(result,1000,local); + if (strcmp(result,"(null)\n")!=0){ + char *curmonitor=strstr(result,"=")+1; + yon_parse_monitor(dct,curmonitor); + } + } +} + +void on_apps_chooser_open (GtkWidget *self,widgets_dict *widgets, int mode){ + GtkBuilder *builder=gtk_builder_new_from_file(glade_path);\ + // FILE *output=popen(""); + + printf("not implemented yet\n"); +} + +void yon_fill_ui(widgets_dict *widgets){ + if (!videoconfig.proprietary||strstr(videoconfig.proprietary,"\n")==0) + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverProprietaryDriverCombo),0); + + if (!videoconfig.failsafenVidia||strstr(videoconfig.failsafenVidia,"\n")==0) + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeNvidiaCombo),0); + + if (!videoconfig.failsafeATI||strstr(videoconfig.failsafeATI,"\n")==0) + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo),0); + + if (!videoconfig.optirun||strstr(videoconfig.optirun,"\n")==0) + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry),videoconfig.optirun); + + if (!videoconfig.primusrun||strstr(videoconfig.primusrun,"\n")==0) + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry),videoconfig.primusrun); + + if (videoconfig.gapfix==0) + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainExtraFixGapCombo),0); + } void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ @@ -60,7 +163,7 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ monitors->templateMonitorConfigurationSaveButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationSaveButton")); g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_configuration), monitors); + // g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_configuration), monitors); // if (i!=0) // gtk_radio_button_join_group(GTK_RADIO_BUTTON(monitors[i].templateMonitorConfigurationMainRadio),GTK_RADIO_BUTTON(monitors[i-1].templateMonitorConfigurationMainRadio)); @@ -68,18 +171,24 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel),_("Resolution (px): ")); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel),_("Frequency (Hz): ")); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel),_("Rotation: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); - + // gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio),_("Main monitor")); gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),_("through parameter line:")); gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); gtk_widget_show(monitors->templateMonitorConfigurationWindow); + char *addln=NULL; + if (!monitors->curconfig||!((monitorconfig*)monitors->curconfig->data)->resolution) addln=_("Default Settings"); + else addln=((monitorconfig*)monitors->curconfig->data)->resolution; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),addln); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),_("Default Settings")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),_("Default Settings")); } MonitorSettings *yon_setup_monitor_settings(){ int monitors_n=yon_check_for_monitors(); MonitorSettings *monitors = NULL; monitors=malloc(sizeof(MonitorSettings)*monitors_n); + // videoconfig.videoconfig=videoconfig.videoconfig->first; for (int i=0;idata)->port)); + char *res=yon_char_get_augumented(((monitorconfig*)monitors[i].curconfig->data)->resolution,""); + if (!res) res=_("Default settings"); + gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel),res); gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay),monitors[i].templateMonitorInfoBox); g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); + + if(videoconfig.monitors->next) + videoconfig.monitors=videoconfig.monitors->next; } return monitors; } @@ -118,18 +234,24 @@ dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size){ void yon_setup_widgets(widgets_dict *widgets){ widgets->builder=gtk_builder_new_from_file(glade_path); + widgets->appsPackWindow=yon_gtk_builder_get_widget(widgets->builder,"appsPackWindow"); + widgets->appsPackBox=yon_gtk_builder_get_widget(widgets->builder,"appsPackBox"); widgets->MainWindow=yon_gtk_builder_get_widget(widgets->builder,"MainWindow"); widgets->headBox=yon_gtk_builder_get_widget(widgets->builder,"headBox"); widgets->headInfoLabel=yon_gtk_builder_get_widget(widgets->builder,"headInfoLabel"); widgets->mainPlugBox=yon_gtk_builder_get_widget(widgets->builder,"mainPlugBox"); widgets->mainErrorBox=yon_gtk_builder_get_widget(widgets->builder,"mainErrorBox"); widgets->mainHeadOverlay=yon_gtk_builder_get_widget(widgets->builder,"mainHeadOverlay"); + widgets->extraOptirunChooseAppsButton=yon_gtk_builder_get_widget(widgets->builder,"extraOptirunChooseAppsButton"); + widgets->extraPrimusunChooseAppsButton=yon_gtk_builder_get_widget(widgets->builder,"extraPrimusunChooseAppsButton"); widgets->mainHeadBackgroundImage=yon_gtk_builder_get_widget(widgets->builder,"mainHeadBackgroundImage"); widgets->mainDriverAutomaticallyChooseCheck=yon_gtk_builder_get_widget(widgets->builder,"mainDriverAutomaticallyChooseCheck"); widgets->mainDriverProprietaryDriverLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverLabel"); widgets->mainDriverFailsafeNvidiaLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaLabel"); widgets->mainDriverFailsafeAMDLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDLabel"); widgets->mainDriverProprietaryDriverCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverCombo"); + widgets->mainExtraFixGapCombo=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapCombo"); + widgets->mainDriverProprietaryDriverButton=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverButton"); widgets->mainDriverFailsafeNvidiaCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaCombo"); widgets->mainDriverFailsafeAMDCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDCombo"); widgets->mainDriverFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFrameLabel"); @@ -182,7 +304,8 @@ void yon_setup_widgets(widgets_dict *widgets){ g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); - + g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); + g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel),_("Video output configuration")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel),_("Proprietary driver: ")); @@ -213,15 +336,16 @@ void yon_setup_widgets(widgets_dict *widgets){ gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsAboutMenuItem),_("About")); // gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchThroughButton),_("Change")); + yon_ubl_header_setup(widgets->mainHeadOverlay,widgets->headBox,widgets->mainHeadBackgroundImage, banner_path); + // gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); - gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); - - gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); + // gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); MonitorSettings *monitors = yon_setup_monitor_settings(); - widgets->monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); + videoconfig.monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); widgets->overlays=yon_dictionary_pack_overlays(monitors,yon_check_for_monitors()); yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays,widgets->mainMonitorVisualConfigurationBox,0,0,0); // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->monitors,widgets->mainMonitorConfigurationBox,0,0,0); + } int main(int argc, char *argv[]){ @@ -233,12 +357,13 @@ int main(int argc, char *argv[]){ GError error; // xfconf_init (&error); // display_channel = xfconf_channel_new ("displays"); - - + videoconfig.applist=yon_apps_scan_and_parse_desktops(&videoconfig.appsize); + yon_setup_config(); widgets_dict widgets; yon_setup_widgets(&widgets); gtk_widget_show(widgets.MainWindow); - + yon_fill_ui(&widgets); + yon_ubl_status_box_render(widgets.mainStatusBox,widgets.mainStatusIcon,widgets.mainStatusLabel,"com.ublinux.ubl-settings-video.checked","Configuration has been loaded",BACKGROUND_IMAGE_SUCCESS_TYPE); GtkCssProvider *css=gtk_css_provider_new(); gtk_css_provider_load_from_path(css,CssPath,NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index f329a68..2af67ef 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -5,10 +5,14 @@ #include #include #include +#include +#include #include "ubl-utils.h" #ifndef UBL_SETINGS_VIDEO_H #define UBL_SETINGS_VIDEO_H +#define icon_name "com.ublinux.ubl-settings-video" + #define banner_path "/usr/share/ubl-settings-video/ui/ubl-settings-video-banner.png" #define glade_path "/usr/share/ubl-settings-video/ui/ubl-settings-video.glade" @@ -21,6 +25,18 @@ #define StatusSaveGlobalFailed _("Saving to global configuration Succeeded") #define StatusSaveLocalFailed _("Saving to local configuration Succeeded") +#define get_ports_command "xrandr |grep -E \"^[A-Z0-9]* connected\" |cut -d' ' -f1" + +#define load_drivers_command "/usr/bin/ubconfig --default --source " + +#define load_drivers_global_command "/usr/bin/ubconfig --default --source global get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " + +#define save_drivers_global_command "/usr/bin/ubconfig --default --source global set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " + +#define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " + +#define save_drivers_local_command "/usr/bin/ubconfig --default --source system set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " + char *local; typedef char* string; @@ -32,13 +48,38 @@ string version_application = ""; #define _(String) gettext(String) typedef struct { + int autoChooseDrivers; dictionary *videoconfig; + dictionary *monitors; + char *proprietary; + char *failsafenVidia; + char *failsafeATI; + int descreteOnly; + char *optirun; + char *primusrun; + int gapfix; + int optiorprimus; + apps *applist; + int appsize; } config; +typedef struct { + int main; + char *port; + char *resolution; + char *resolutionCapabilities; + char *frequency; + char *rotation; + char *stringparameters; +} monitorconfig; typedef struct { dictionary *monitors; dictionary *overlays; GtkBuilder *builder; + GtkWidget *appsPackBox; + GtkWidget *appsPackWindow; + GtkWidget *extraOptirunChooseAppsButton; + GtkWidget *extraPrimusunChooseAppsButton; GtkWidget *MainWindow; GtkWidget *headBox; GtkWidget *headInfoLabel; @@ -51,6 +92,8 @@ typedef struct { GtkWidget *mainDriverFailsafeNvidiaLabel; GtkWidget *mainDriverFailsafeAMDLabel; GtkWidget *mainDriverProprietaryDriverCombo; + GtkWidget *mainDriverProprietaryDriverButton; + GtkWidget *mainExtraFixGapCombo; GtkWidget *mainDriverFailsafeNvidiaCombo; GtkWidget *mainDriverFailsafeAMDCombo; GtkWidget *mainDriverFrameLabel; @@ -125,10 +168,12 @@ typedef struct { GtkWidget *templateMonitorInfoNameLabel; GtkWidget *templateMonitorInfoResolutionLabel; GtkWidget *templateMonitorInfoConfigureButton; + dictionary *curconfig; } MonitorSettings; + int yon_check_for_monitors(); MonitorSettings *yon_setup_monitor_settings(); dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size); diff --git a/source/ubl-utils.c b/source/ubl-utils.c index befb9a1..ed01b97 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -49,6 +49,10 @@ typedef struct IVGrapgicals{ //dictionary functions +/** + * yon_dictionary_create_empty: + * Creates and returns empty dictionary +*/ dictionary *yon_dictionary_create_empty(){ dictionary *dict=malloc(sizeof(dictionary)); dict->data=NULL; @@ -66,7 +70,7 @@ void yon_dictionary_switch_to_last(dictionary **dict){ } dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ - yon_dictionary_switch_to_last(&targetdict); + targetdict=yon_dictionary_get_last(targetdict); targetdict->next=yon_dictionary_create_empty(); targetdict->next->prev=targetdict; targetdict->next->first=targetdict->first; @@ -176,7 +180,7 @@ void yon_dictionary_make_nth(dictionary *dict, int nth){ dictionary *yon_dictionary_create_with_data(char *key, void *data){ dictionary *dct=yon_dictionary_create_empty(); - dct->key=key; + dct->key=yon_char_new(key); dct->data=data; dct->data_type=DICTIONARY_OTHER_TYPE; return dct; @@ -184,7 +188,7 @@ dictionary *yon_dictionary_create_with_data(char *key, void *data){ dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ dictionary *dct=yon_dictionary_create_conneced(dict); - dct->key=key; + dct->key=yon_char_new(key); dct->data=data; dct->data_type=DICTIONARY_OTHER_TYPE; return dct; @@ -236,21 +240,36 @@ dictionary *yon_dictionary_rip(dictionary *dict){ } dictionary *yon_dictionary_get_nth(dictionary *dict, int place){ + dict=dict->first; for (int i=0;inext; - return dict; + if(dict) + dict=dict->next; + if (dict) return dict; + else return NULL; } //char functions +/** + * creates new char string by combining two char strings. +*/ char *yon_char_get_augumented(char *source, char *append){ + if (source&&append){ int size=strlen(source)+strlen(append)+1; char *final=malloc(size); memset(final,0,size); - sprintf(final,"%s%s",source,append); + if (strstr(source,"%%")) + sprintf(final,source,append); + else + sprintf(final,"%s%s",source,append); return final; + } else + return NULL; } +/** + * creates new char string by copying another char. +*/ char *yon_char_new(char *chr){ char *newchar=malloc(strlen(chr)+1); memset(newchar,0,strlen(chr)+1); @@ -258,6 +277,9 @@ char *yon_char_new(char *chr){ return newchar; } +/** + * cuts source string by size length from startpos position. +*/ char *yon_cut(char *source, int size, int startpos){ char *cut=NULL; cut=malloc(size+1); @@ -265,7 +287,11 @@ char *yon_cut(char *source, int size, int startpos){ memcpy(cut,source+startpos,size); return cut; } - +/** + * divides source string in dividepos position, + * returning left part of divided string and + * inserting right part to source string. +*/ char *yon_char_divide(char *source, int dividepos){ char *cut=malloc(dividepos+1); memset(cut,0,dividepos+1); @@ -278,13 +304,22 @@ char *yon_char_divide(char *source, int dividepos){ return cut; } +/** + * searches string dividepos in source string and divides it, + * returning left part of divided string and + * inserting right part to source string. + * if delete_divider is 0, left part will contain delete_divider substring, else + * it will stay in right part. +*/ char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ char *cut=strstr(source,dividepos); int leng=strlen(source)-strlen(cut); cut=yon_char_divide(source,leng); return cut; } - +/** + * converts int to char. +*/ char *yon_char_from_int(int int_to_convert){ int i=1; float convert_check=(float)int_to_convert; @@ -319,8 +354,12 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef){ { apps tempapp; GKeyFile *gfile=g_key_file_new(); + GError *err=NULL; g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); - char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); + char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",&err); + if (err){ + printf("%s\n",err->message); + } if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); if (tempapp.Name==NULL) continue; @@ -432,30 +471,96 @@ int yon_launch(thread_output *thread){ #ifdef __GTK_H__ - - -GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data){ - GtkWidget *socket; - socket = gtk_socket_new(); - g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(yon_on_plug_added),data); - g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(yon_on_plug_removed),data); - g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(yon_on_plug_removed),data); - gtk_box_pack_start(GTK_BOX(container),socket,1,1,0); - return socket; -}; - -int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment){ - if (icon_view_segment->data_type==DICTIONARY_IVGRAPHICALS_TYPE){ - for (dictionary *icvd=icon_view_segment->first;icvd!=NULL;icvd=icvd->next){ - IVGraphicals *icv=icvd->data; - GtkTreeIter iter; - if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){ - gtk_widget_hide(icv->Box); - // gtk_widget_hide(GTK_WIDGET(icv->sep)); - } - } - } -} +// dictionary *yon_gtk_app_chooser_create(GtkBuilder *builder){ +// GtkWidget *chooserWindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); +// GtkWidget *Box=gtk_box_new(GTK_ORIENTATION_VERTICAL,5); +// GtkWidget *Frame=gtk_frame_new(""); +// GtkWidget *Scroll=gtk_scrolled_window_new(NULL, gtk_adjustment_new(0,0,10000,1,10,100)); +// GtkWidget *PackBox=gtk_box_new(GTK_ORIENTATION_VERTICAL,5); +// GtkWidget *ButtonsBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); +// GtkWidget *ButtonsPlaceBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + +// GtkWidget *CancelButton=gtk_button_new_with_label("Cancel"); +// GtkWidget *AcceptButton=gtk_button_new_with_label("Accept"); +// gtk_container_add(GTK_CONTAINER(chooserWindow),Box); +// gtk_box_pack_start(GTK_BOX(Box),Frame,1,1,0); +// gtk_container_add(GTK_CONTAINER(Frame),PackBox); +// gtk_box_pack_start(GTK_BOX(Box),ButtonsBox,0,0,0); +// gtk_box_pack_end(GTK_BOX(ButtonsBox),ButtonsPlaceBox,0,0,0); +// gtk_box_pack_end(GTK_BOX(ButtonsPlaceBox),AcceptButton,0,0,0); +// gtk_box_pack_end(GTK_BOX(ButtonsPlaceBox),CancelButton,0,0,0); +// gtk_box_pack_start(GTK_BOX(PackBox),(GtkWidget*)yon_gtk_app_chooser_apps_create(builder),0,0,0); +// gtk_widget_show_all(chooserWindow); +// } + +/** + * yon_iv_segment_create: + * connect_to - dictionary, in the end of which new one will be connected; + * name - name of this segment, renders on label; + * categories - desktop file categories that application NEEDS to have to render in that category; + * segment_icon_name - icon name for this section; + * builder - newly allocated builder with glade file connected where template widgets are stored: + * - templateAppsIconView - setted up icon view; + * - templateAppsPack - setted up container for every template widget; + * - templateAppsImage - image for rendering section image; + * - templateAppsLabel - label for rendering section name; +*/ +// dictionary *yon_iv_segment_create(dictionary *connect_to, char *name, char *categories, char *segment_icon_name){ +// IVSegment *segment=malloc(sizeof(IVSegment)); +// segment->name=name; +// segment->categories=categories; +// GtkBuilder *builder=gtk_builder_new_from_string(return_app_string(),-1); +// GtkWidget *iv=yon_gtk_builder_get_widget(builder,"templateAppsIconView"); +// GtkWidget *expander=yon_gtk_builder_get_widget(builder,"templateAppsPack"); +// GtkWidget *image=yon_gtk_builder_get_widget(builder,"templateAppsImage"); +// GtkWidget *label=yon_gtk_builder_get_widget(builder,"templateAppsLabel"); +// GtkIconTheme *theme=gtk_icon_theme_get_default(); +// gtk_image_set_from_pixbuf(GTK_IMAGE(image),gtk_icon_theme_load_icon_for_scale(theme,segment_icon_name,20,1,GTK_ICON_LOOKUP_FORCE_SVG,NULL)); +// gtk_label_set_text(GTK_LABEL(label),name); +// GtkListStore *ls=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore5")); +// // g_signal_connect(G_OBJECT(iv), "item-activated", G_CALLBACK(on_activate), videoconfig.applist); +// segment->Expander=expander; +// segment->IV=iv; +// segment->LS=ls; +// segment->Image=image; +// dictionary *dict=NULL; +// if (connect_to) { +// // connect_to=yon_dictionary_get_last(connect_to); +// dict=yon_dictionary_create_with_data_connected(connect_to,name,segment); +// } else +// dict=yon_dictionary_create_with_data(name,segment); +// return dict; +// } + +// GtkWidget *yon_gtk_app_chooser_apps_create(){ +// GtkWidget *Box=gtk_box_new(GTK_ORIENTATION_VERTICAL,0); +// dictionary *IVS=yon_iv_segment_create(NULL, "Graphics", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Tools", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Internet", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Multimedia", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Settings", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Education", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Office", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Other", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "Development", "", "dialog-yes-symbolic"); +// yon_iv_segment_create(IVS, "System", "", "dialog-yes-symbolic"); +// dictionary *nd; +// for_dictionaries(nd,IVS){ +// gtk_box_pack_start(GTK_BOX(Box),((IVSegment*)nd->data)->Expander,0,0,0); +// } +// return Box; + +// } + +// GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data){ +// GtkWidget *socket; +// socket = gtk_socket_new(); +// g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(yon_on_plug_added),data); +// g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(yon_on_plug_removed),data); +// g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(yon_on_plug_removed),data); +// gtk_box_pack_start(GTK_BOX(container),socket,1,1,0); +// return socket; +// }; int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding){ for (dictionary *dct=dict->first; dct!=NULL;dct=dct->next){ @@ -471,4 +576,24 @@ int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *de return 1; } +void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path){ + gtk_overlay_add_overlay(GTK_OVERLAY(Overlay),Head); + gtk_image_set_from_file(GTK_IMAGE(Image),image_path); +} + +void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass){ + GtkIconTheme *ictheme=gtk_icon_theme_get_default(); + GError *err=NULL; + gtk_image_set_from_pixbuf(GTK_IMAGE(StatusIcon),gtk_icon_theme_load_icon_for_scale(ictheme,IconName,25,1,GTK_ICON_LOOKUP_FORCE_SIZE,&err)); + if (err){ + printf("%s\n",err->message); + g_error_free(err); + } + gtk_label_set_text(GTK_LABEL(StatusLabel),StatusText); + if (BackgroundClass==BACKGROUND_IMAGE_SUCCESS_TYPE){ + gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessOK"); + } else if (BackgroundClass==BACKGROUND_IMAGE_FAIL_TYPE){ + gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessError"); + } +} #endif \ No newline at end of file diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 73de3e8..444fd93 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -10,8 +10,9 @@ #include #include +#define DesktopPath "/usr/share/applications/" -#define DesktopPath "/usr/share/applications" +#define for_dictionaries(obj,obj1) for(obj=obj1->first;obj!=NULL;obj=obj->next) typedef enum { DICTIONARY_ACTION_WIDGETS_TYPE, @@ -48,6 +49,9 @@ typedef struct apps{ //dictionary functions +dictionary *yon_dictionary_create_empty(); + +dictionary * yon_dictionary_create_conneced(dictionary *targetdict); dictionary *yon_dictionary_get_last(dictionary *dict); @@ -113,29 +117,48 @@ int yon_launch(thread_output *thread); #ifdef __GTK_H__ #define yon_gtk_builder_get_widget(obj,obj2) GTK_WIDGET(gtk_builder_get_object(obj,obj2)) -typedef struct IVGrapgicals{ - char *sectionName; - char *categories; - GtkListStore *LV; - GtkWidget *Box; - GtkWidget *IV; - GtkWidget *label; - GtkWidget *sep; - GtkCellRendererPixbuf *iconRender; -} IVGraphicals; +typedef struct { + GtkWidget *Icon; + GtkWidget *Label; + GtkWidget *IconView; + GtkListStore *List; +} expander_icon_view; + + +// GtkWidget *yon_gtk_app_chooser_apps_create(); + +// dictionary *yon_gtk_app_chooser_create(); + +// expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...); + GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); +int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); +int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); + //uninitialised void yon_on_plug_added(GtkSocket* self, gpointer user_data); void yon_on_plug_removed(GtkSocket* self, gpointer user_data); -int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); -int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); #endif +typedef enum { + BACKGROUND_IMAGE_SUCCESS_TYPE, + BACKGROUND_IMAGE_FAIL_TYPE +} BACKGROUND_IMAGE_TYPE; +#ifdef __cplusplus +#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()),GTK_WIDGET(head.gobj()),GTK_WIDGET(image.gobj()),(char*)imag_path) +#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(GTK_WIDGET(statusbox.gobj()), GTK_WIDGET(statusicon.gobj()), GTK_WIDGET(statuslabel.gobj()), (char*)iconname, (char*)statustext, backgroundclass) +#else +#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay),GTK_WIDGET(head),GTK_WIDGET(image), (char*)imag_path) +#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) +#endif + +void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); +void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); #endif \ No newline at end of file diff --git a/ubl-settings-video.css b/ubl-settings-video.css index 79796fe..499b1e8 100644 --- a/ubl-settings-video.css +++ b/ubl-settings-video.css @@ -5,6 +5,10 @@ margin:0px; padding:0px; } + +.workingbg { + background:@theme_base_color; +} .textoutline { text-shadow: 0.5px 0 0.5px @theme_bg_color, 0 0.5px 0.5px @theme_bg_color, @@ -88,4 +92,12 @@ padding: 3px 10px 5px 5px; background:@theme_selected_bg_color; border-radius:2px; - } \ No newline at end of file + } + + .boxInfoMessError{ + background-color: #ea9999; +} + +.boxInfoMessOK{ + background-color: #f3f0ac; +} \ No newline at end of file diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 0564f91..f6ac563 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -3,24 +3,7 @@ - - - - - - - - - - - - - - - - - - + True False @@ -114,152 +97,9 @@ - - - False - О Программе - False - True - center - com.ublinux.ubl-settings-video - dialog - True - ubl-settings-video - 1.2 - Copyright © 2023 - UBSoft Software LLC - Settings for video output - https://ublinux.ru/ - 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-video - True - gpl-2-0 - - - False - vertical - 2 - - - False - False - top - spread - - - False - False - 0 - - - - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-video - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - vertical - - - 255 - True - False - Video output configuration - - - - - - - - - True - True - 0 - - - - - False - True - 0 - - - - - True - True - 0 - - - - - True - False - - - False - True - 1 - - - - - True - True - 1 - - - - - True - False - document-edit-symbolic - - - True - False - document-edit-symbolic - + 800 + 600 False 800 600 @@ -289,6 +129,7 @@ 5 6 6 + 25 False @@ -360,65 +201,56 @@ - + + 165 True - False + True + 5 + 5 5 5 - 5 - vertical + external - + True False - 0.019999999552965164 - in - + True False - 5 - 5 - 12 - 5 + 5 + 5 + 5 + 5 + 5 + vertical - + True False - vertical - - - Automatically choose and use driver - True - True - False - start - True - - - False - True - 0 - - + 0.019999999552965164 + in - + True False - 5 + 5 + 5 + 12 + 5 - + True False vertical - 5 - + + Automatically choose and use driver True - False + True + False start - Proprietary driver: - 0 + True False @@ -427,12 +259,152 @@ - + True False - start - Failsafe driver nVidia: - 0 + 5 + + + True + False + vertical + 5 + + + True + False + start + Proprietary driver: + 0 + + + False + True + 0 + + + + + True + False + start + Failsafe driver nVidia: + 0 + + + False + True + 1 + + + + + True + False + start + Failsafe driver AMD/ATI: + 0 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + + ubm-nvidia-340 + ubm-nvidia-390 + ubm-nvidia-470 + ubm-nvidia-510 + ubm-nvidia-515 + ubm-nvidia-optimus + + + + True + True + 0 + + + + + True + True + True + image8 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + + Off + fbdev + + + + False + True + 1 + + + + + True + False + + Off + fbdev + + + + False + True + 2 + + + + + True + True + 1 + + False @@ -440,45 +412,54 @@ 1 - - - True - False - start - Failsafe driver AMD/ATI: - 0 - - - False - True - 2 - - - - False - True - 0 - + + + + + True + False + Driver + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 0.019999999552965164 + in - + True False vertical - 5 - + True False - - ubm-nvidia-340 - ubm-nvidia-390 - ubm-nvidia-470 - ubm-nvidia-510 - ubm-nvidia-515 - ubm-nvidia-optimus - + 5 + 5 + 5 + 5 + 5 + 5 + 10 + + + False @@ -486,306 +467,228 @@ 0 - - - True - False - - Off - fbdev - - - - False - True - 1 - - - - - True - False - - Off - fbdev - - - - False - True - 2 - - - - True - True - 1 - + + + + True + False + Monitor configuration + - False + True True - 1 + 0 + + True + True + 1 + - - - - - True - False - Driver - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - 0.019999999552965164 - in - + True False - 5 - 5 + 0.019999999552965164 + in - - 165 + True - True - 12 - 5 - 12 - 5 - external + False + 5 + 5 + 12 + 5 - + True False - + + discrete video only (AMD/ATI) True - False - 5 - 5 - 10 - - - + True + False + 5 + 5 + True + + False + True + 1 + - - - - - True - False - Monitor configuration - - - - - True - True - 0 - - - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - - - discrete video only (AMD/ATI) + + True - True - False - 5 - True + False + 0 + Hybrid graphics - - False - True - 1 - + + False + True + 2 + - - - - - True - False - 0 - Hybrid graphics - - - - - False - True - 2 - - - - - True - False - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - + True False - vertical + 5 + 0.019999999552965164 + in - + True False - 5 - - - True - False - vertical - 5 - - - Launch programms through optirun (nVidia): - True - True - False - True - - - False - True - 0 - - - - - Launch programs through primusun (nVidia): - True - True - False - True - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - True - steam - - - True - True - 0 - - - - - True - True - steam - - - True - True - 1 - - - - - True - True - 1 - - + 5 + 5 + 12 + 5 True False vertical - 5 - + True - False - True - True - image1 + False + 5 + + + True + False + vertical + 5 + + + Launch programms through optirun (nVidia): + True + True + False + True + + + False + True + 0 + + + + + Launch programs through primusun (nVidia): + True + True + False + True + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + True + steam + + + True + True + 0 + + + + + True + False + True + steam + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + vertical + 5 + + + True + False + True + True + image1 + + + False + True + 0 + + + + + True + False + True + True + image2 + + + False + True + 1 + + + + + False + True + 2 + + False @@ -794,12 +697,38 @@ - + True - False - True - True - image2 + False + 5 + 5 + + + True + False + Fix frame gap (nVidia): + 0 + + + False + True + 0 + + + + + True + False + + 1st variant + + + + True + True + 1 + + False @@ -808,76 +737,26 @@ - - False - True - 2 - - - False - True - 0 - - - + + True False - 5 - 5 - - - True - False - Fix frame gap (nVidia): - 0 - - - False - True - 0 - - - - - True - False - - 1st variant - - - - True - True - 1 - - + Extra - - False - True - 1 - + + False + True + 3 + - - - True - False - Extra - - - - False - True - 3 - @@ -1044,54 +923,320 @@ - + + True + True + False + True + True + SettingsMenu + none + + + + + + False + True + 1 + + + + + end + 3 + + + + + + + vertical + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + О Программе + False + True + center + com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + 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-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + + + + False + ubl-settings-video + 800 + 558 + com.ublinux.ubl-settings-video + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + True + external + in + + + True + False + + + True + False + vertical + + + + + + + + + + + True + True + 0 + + + + + True + False + + + + + + True + False + 5 + 5 + True + + + Cancel + True + True + True + + + False + True + 0 + + + + + OK + True + True + True + + + False + True + 1 + + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + True + False + + + 90 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + + True + False + + + True + False + + True - True - False - True - True - SettingsMenu - none + False + vertical - + + 255 + True + False + Video output configuration + + + + + + + + + True + True + 0 + False True - 1 + 0 - end - 3 + True + True + 0 + + + + + True + False + + + False + True + 1 + + True + True + 1 + - - vertical - - - - - - - - - + + True + False + document-edit-symbolic - - - - - - - - - + + True + False + document-edit-symbolic True @@ -1108,13 +1253,16 @@ False center center + 3 + 3 20 vertical True False - Monitor + Monitor + True @@ -1132,6 +1280,8 @@ True False + 5 + 5 1920x1200:60Hz @@ -1176,12 +1326,265 @@ False emblem-ok-symbolic + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + True + False + system-run-symbolic + + + + + + + + + + + + + g89 + Settings + Settings + + + + + True + True + + + True + False + vertical + + + True + True + 15 + 15 + 6 + multiple + horizontal + liststore5 + 1 + True + + + + 0 + + + + + 0 + True + word + + + 1 + + + + + True + True + 0 + + + + + + + True + False + 5 + + + True + False + 25 + applications-system + + + False + True + 0 + + + + + True + False + Settings + + + False + True + 1 + + + + + + + + + + + + + + + + + + argadrh + ssfasfasf + khjgkj + + + + + 450 + 300 + False + com.ublinux.ubl-settings-video + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + liststore6 + True + 2 + + + + + + Driver + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + True + True + 0 + + + + + True + False + 5 + + + + + + True + False + 5 + True + + + Cancel + True + True + True + image6 + + + False + True + 0 + + + + + Accept + True + True + True + image7 + + + False + True + 1 + + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + radiobutton + True + True + False + True + True + False + True com.ublinux.ubl-settings-video @@ -1238,8 +1641,8 @@ False 15 15 - True True + radioMainMonitor False @@ -1273,10 +1676,11 @@ - + True False center + 0 True @@ -1302,7 +1706,7 @@ - + True False center @@ -1322,7 +1726,7 @@ - True + False True 1 @@ -1346,7 +1750,7 @@ - + True False @@ -1400,6 +1804,7 @@ True + False True center @@ -1416,6 +1821,20 @@ 3 + + + True + False + + + + + + True + True + 4 + + True @@ -1424,7 +1843,7 @@ False True - 4 + 5 @@ -1480,7 +1899,7 @@ False True - 5 + 6 @@ -1493,6 +1912,18 @@ + + + + + + + + + + + + True False -- 2.35.1 From a218cf5919056f0c5055c21a528174507504025b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 4 Apr 2023 18:05:15 +0000 Subject: [PATCH 03/16] Version shown in about window is applied from VERSION.md --- VERSION.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 VERSION.md diff --git a/VERSION.md b/VERSION.md new file mode 100644 index 0000000..12ebd01 --- /dev/null +++ b/VERSION.md @@ -0,0 +1 @@ +VERSION 1.0 -- 2.35.1 From 817f54a0ff91fd55eeaaa02689a9ebd6588d2a23 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 4 Apr 2023 18:05:43 +0000 Subject: [PATCH 04/16] Changed and applied README file --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index dd14874..f2222e2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # ubl-settings-video +# Видеокарта/Экран +# Build +In order to build ubl-settings-video you will need: + +- CMake +- C compiler +- GTK+ 3 & dependencies + +Once you have all the necessary dependencies, you can use: +```sh +$ make +``` + +# Installation +After a successful build, just use: +```sh +$ sudo make install clean +``` + +# Uninstallation +After a successful build, just use: +```sh +$ sudo make uninstall +``` + +![alt text](screenshot/screenshot.png) -- 2.35.1 From ef75387c36951ee773bfa3a0889d8db532a670e2 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 4 Apr 2023 18:07:09 +0000 Subject: [PATCH 05/16] Localisation has been updated --- ubl-settings-video.pot | 138 ++++++++++++++++++------------------- ubl-settings-video_ru.po | 145 +++++++++++++++++++++++---------------- 2 files changed, 156 insertions(+), 127 deletions(-) diff --git a/ubl-settings-video.pot b/ubl-settings-video.pot index 9b44ea9..369eeae 100644 --- a/ubl-settings-video.pot +++ b/ubl-settings-video.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-27 12:30+0600\n" +"POT-Creation-Date: 2023-04-04 17:42+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,116 +17,120 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-video.c:33 -msgid "Monitor: " -msgstr "" - -#: source/ubl-settings-video.c:34 -msgid "Resolution (px): " +#: source/ubl-settings-video.c:151 +msgid "About" msgstr "" -#: source/ubl-settings-video.c:35 -msgid "Frequency (Hz): " +#: source/ubl-settings-video.c:143 +msgid "Automatically choose and use driver" msgstr "" -#: source/ubl-settings-video.c:36 -msgid "Rotation: " +#: source/ubl-settings-video.c:153 +msgid "Change" msgstr "" -#: source/ubl-settings-video.c:37 -msgid "Do not switch display off" +#: source/ubl-settings-video.c:131 +msgid "Configuration method" msgstr "" -#: source/ubl-settings-video.c:39 -msgid "Main monitor" +#: source/ubl-settings-video.c:41 +msgid "DPMS off" msgstr "" -#: source/ubl-settings-video.c:40 -msgid "through parameter line:" +#: source/ubl-settings-video.c:37 +msgid "Do not switch display off" msgstr "" -#: source/ubl-settings-video.c:41 -msgid "DPMS off" +#: source/ubl-settings-video.c:150 +msgid "Documentation" msgstr "" -#: source/ubl-settings-video.c:125 -msgid "Launch programms through (nVidia)" +#: source/ubl-settings-video.c:130 +msgid "Driver" msgstr "" -#: source/ubl-settings-video.c:126 -msgid "Video output configuration" +#: source/ubl-settings-video.c:136 +msgid "Extra" msgstr "" -#: source/ubl-settings-video.c:127 -msgid "Proprietary driver: " +#: source/ubl-settings-video.h:16 +msgid "Failed to load global configuration" msgstr "" -#: source/ubl-settings-video.c:128 -msgid "Failsafe driver nVidia: " +#: source/ubl-settings-video.h:17 +msgid "Failed to load local configuration" msgstr "" #: source/ubl-settings-video.c:129 msgid "Failsafe driver AMD/ATI: " msgstr "" -#: source/ubl-settings-video.c:130 -msgid "Driver" -msgstr "" - -#: source/ubl-settings-video.c:131 -msgid "Configuration method" +#: source/ubl-settings-video.c:128 +msgid "Failsafe driver nVidia: " msgstr "" -#: source/ubl-settings-video.c:132 -msgid "Monitor configuration" +#: source/ubl-settings-video.c:135 +msgid "Fix frame gap (nVidia)" msgstr "" -#: source/ubl-settings-video.c:133 -msgid "discrete video only (AMD/ATI)" +#: source/ubl-settings-video.c:35 +msgid "Frequency (Hz): " msgstr "" #: source/ubl-settings-video.c:134 msgid "Hybrid graphics" msgstr "" -#: source/ubl-settings-video.c:135 -msgid "Fix frame gap (nVidia)" +#: source/ubl-settings-video.c:125 +msgid "Launch programms through (nVidia)" msgstr "" -#: source/ubl-settings-video.c:136 -msgid "Extra" +#: source/ubl-settings-video.c:138 +msgid "Load" msgstr "" -#: source/ubl-settings-video.c:137 -msgid "UBlinux Video Configuration" +#: source/ubl-settings-video.c:145 +msgid "Load from global configuration" msgstr "" -#: source/ubl-settings-video.c:138 -msgid "Load" +#: source/ubl-settings-video.c:146 +msgid "Load from local configuration" msgstr "" -#: source/ubl-settings-video.c:139 -msgid "Save" +#: source/ubl-settings-video.c:39 +msgid "Main monitor" msgstr "" #: source/ubl-settings-video.c:141 msgid "Manual configuration" msgstr "" +#: source/ubl-settings-video.c:132 +msgid "Monitor configuration" +msgstr "" + +#: source/ubl-settings-video.c:33 +msgid "Monitor: " +msgstr "" + #: source/ubl-settings-video.c:142 msgid "On" msgstr "" -#: source/ubl-settings-video.c:143 -msgid "Automatically choose and use driver" +#: source/ubl-settings-video.c:127 +msgid "Proprietary driver: " msgstr "" -#: source/ubl-settings-video.c:145 -msgid "Load from global configuration" +#: source/ubl-settings-video.c:34 +msgid "Resolution (px): " msgstr "" -#: source/ubl-settings-video.c:146 -msgid "Load from local configuration" +#: source/ubl-settings-video.c:36 +msgid "Rotation: " +msgstr "" + +#: source/ubl-settings-video.c:139 +msgid "Save" msgstr "" #: source/ubl-settings-video.c:147 @@ -141,30 +145,26 @@ msgstr "" msgid "Save to local configuration" msgstr "" -#: source/ubl-settings-video.c:150 -msgid "Documentation" -msgstr "" - -#: source/ubl-settings-video.c:151 -msgid "About" +#: source/ubl-settings-video.h:19 +msgid "Saving to global configuration Succeeded" msgstr "" -#: source/ubl-settings-video.c:153 -msgid "Change" +#: source/ubl-settings-video.h:20 +msgid "Saving to local configuration Succeeded" msgstr "" -#: source/ubl-settings-video.h:16 -msgid "Failed to load global configuration" +#: source/ubl-settings-video.c:137 +msgid "UBlinux Video Configuration" msgstr "" -#: source/ubl-settings-video.h:17 -msgid "Failed to load local configuration" +#: source/ubl-settings-video.c:126 +msgid "Video output configuration" msgstr "" -#: source/ubl-settings-video.h:19 -msgid "Saving to global configuration Succeeded" +#: source/ubl-settings-video.c:133 +msgid "discrete video only (AMD/ATI)" msgstr "" -#: source/ubl-settings-video.h:20 -msgid "Saving to local configuration Succeeded" +#: source/ubl-settings-video.c:40 +msgid "through parameter line:" msgstr "" diff --git a/ubl-settings-video_ru.po b/ubl-settings-video_ru.po index 5ef5750..f21a5f7 100644 --- a/ubl-settings-video_ru.po +++ b/ubl-settings-video_ru.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ubl-settings-manager 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-27 12:30+0600\n" +"POT-Creation-Date: 2023-04-04 18:00+0000\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" "Language-Team: UBLinux Team \n" @@ -17,168 +17,197 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-video.c:33 +#: source/ubl-settings-video.c:80 source/ubl-settings-video.c:384 +msgid "UBlinux Video Configuration" +msgstr "Видеокарта/Экран" + +#: source/ubl-settings-video.c:82 +msgid "Progect Home Page" +msgstr "Домашняя страница проекта" + +#: source/ubl-settings-video.c:83 +#, fuzzy +msgid "Videocard and monitor configuration manager" +msgstr "Настройка вывода изображения" + +#: source/ubl-settings-video.c:208 msgid "Monitor: " msgstr "Монитор: " -#: source/ubl-settings-video.c:34 +#: source/ubl-settings-video.c:209 msgid "Resolution (px): " msgstr "Разрешение (px): " -#: source/ubl-settings-video.c:35 +#: source/ubl-settings-video.c:210 msgid "Frequency (Hz): " msgstr "Обновления (Hz): " -#: source/ubl-settings-video.c:36 +#: source/ubl-settings-video.c:211 msgid "Rotation: " msgstr "Вращение: " -#: source/ubl-settings-video.c:37 -msgid "Do not switch display off" -msgstr "Не выключать дисплей" - -#: source/ubl-settings-video.c:39 +#: source/ubl-settings-video.c:213 #, fuzzy msgid "Main monitor" msgstr "Основной" -#: source/ubl-settings-video.c:40 +#: source/ubl-settings-video.c:214 msgid "through parameter line:" msgstr "Через строку параметра: " -#: source/ubl-settings-video.c:41 +#: source/ubl-settings-video.c:215 msgid "DPMS off" msgstr "DMPS выключен" -#: source/ubl-settings-video.c:125 -msgid "Launch programms through (nVidia)" -msgstr "Запуск программ через (nVidia)" +#: source/ubl-settings-video.c:218 source/ubl-settings-video.c:223 +#: source/ubl-settings-video.c:225 source/ubl-settings-video.c:228 +#: source/ubl-settings-video.c:230 source/ubl-settings-video.c:250 +msgid "Default settings" +msgstr "По умолчанию" + +#: source/ubl-settings-video.c:366 +msgid "Don't use" +msgstr "Не использовать" + +#: source/ubl-settings-video.c:367 source/ubl-settings-video.c:369 +msgid "Off" +msgstr "Выключить" + +#: source/ubl-settings-video.c:368 source/ubl-settings-video.c:370 +msgid "fbdev" +msgstr "fbdev" -#: source/ubl-settings-video.c:126 +#: source/ubl-settings-video.c:372 +msgid "1st variant. May cause perfomance drops in video games" +msgstr "1 вариант. Может снизить производительность в играх" + +#: source/ubl-settings-video.c:373 +msgid "2nd variant. May not work on specific video cards" +msgstr "2 вариант. Не на каждой карте может сработать" + +#: source/ubl-settings-video.c:374 msgid "Video output configuration" msgstr "Настройка вывода изображения" -#: source/ubl-settings-video.c:127 +#: source/ubl-settings-video.c:375 #, fuzzy msgid "Proprietary driver: " msgstr "Проприетарный драйвер: " -#: source/ubl-settings-video.c:128 +#: source/ubl-settings-video.c:376 #, fuzzy msgid "Failsafe driver nVidia: " msgstr "Отказоучтойчивый драйвер nVidia: " -#: source/ubl-settings-video.c:129 +#: source/ubl-settings-video.c:377 #, fuzzy msgid "Failsafe driver AMD/ATI: " msgstr "Отказоустойчивый драйвер AMD/ATI: " -#: source/ubl-settings-video.c:130 +#: source/ubl-settings-video.c:378 msgid "Driver" msgstr "Драйвер" -#: source/ubl-settings-video.c:131 -msgid "Configuration method" -msgstr "Метод настройки: " - -#: source/ubl-settings-video.c:132 +#: source/ubl-settings-video.c:380 msgid "Monitor configuration" msgstr "Настройка экрана" -#: source/ubl-settings-video.c:133 -msgid "discrete video only (AMD/ATI)" -msgstr "Только дискретное видео (AMD/ATI)" - -#: source/ubl-settings-video.c:134 +#: source/ubl-settings-video.c:381 msgid "Hybrid graphics" msgstr "Гибридная графика" -#: source/ubl-settings-video.c:135 +#: source/ubl-settings-video.c:382 msgid "Fix frame gap (nVidia)" msgstr "Исправить разрыв кадров (nVidia)" -#: source/ubl-settings-video.c:136 +#: source/ubl-settings-video.c:383 msgid "Extra" msgstr "Дополнительно" -#: source/ubl-settings-video.c:137 -msgid "UBlinux Video Configuration" -msgstr "Видеокарта/Экран" - -#: source/ubl-settings-video.c:138 +#: source/ubl-settings-video.c:385 msgid "Load" msgstr "Загрузить" -#: source/ubl-settings-video.c:139 +#: source/ubl-settings-video.c:386 msgid "Save" msgstr "Сохранить" -#: source/ubl-settings-video.c:141 -msgid "Manual configuration" -msgstr "Ручная настройка" - -#: source/ubl-settings-video.c:142 +#: source/ubl-settings-video.c:388 msgid "On" msgstr "Включить" -#: source/ubl-settings-video.c:143 +#: source/ubl-settings-video.c:389 msgid "Automatically choose and use driver" msgstr "Автоматический выбор и использование драйвера" -#: source/ubl-settings-video.c:145 +#: source/ubl-settings-video.c:390 +#, fuzzy +msgid "Launch programms through optirun (nVidia): " +msgstr "Запуск программ через (nVidia)" + +#: source/ubl-settings-video.c:391 +#, fuzzy +msgid "Launch programs through primusun (nVidia): " +msgstr "Запуск программ через (nVidia)" + +#: source/ubl-settings-video.c:392 +msgid "discrete video only (AMD/ATI)" +msgstr "Только дискретное видео (AMD/ATI)" + +#: source/ubl-settings-video.c:394 #, fuzzy msgid "Load from global configuration" msgstr "Загрузить глобальную конфигурацию" -#: source/ubl-settings-video.c:146 +#: source/ubl-settings-video.c:395 #, fuzzy msgid "Load from local configuration" msgstr "Загрузить локальную конфигуруцию" -#: source/ubl-settings-video.c:147 +#: source/ubl-settings-video.c:396 #, fuzzy msgid "Save to global an local configuration" msgstr "Сохранить в глобальную и локальную конфигурацию" -#: source/ubl-settings-video.c:148 +#: source/ubl-settings-video.c:397 #, fuzzy msgid "Save to global configuration" msgstr "Сохранить в глобальную конфигурацию" -#: source/ubl-settings-video.c:149 +#: source/ubl-settings-video.c:398 #, fuzzy msgid "Save to local configuration" msgstr "Схоранить в локальную конфигурацию" -#: source/ubl-settings-video.c:150 +#: source/ubl-settings-video.c:399 #, fuzzy msgid "Documentation" msgstr "Справка" -#: source/ubl-settings-video.c:151 +#: source/ubl-settings-video.c:400 msgid "About" msgstr "О программе" -#: source/ubl-settings-video.c:153 -msgid "Change" -msgstr "Измеить" +#: source/ubl-settings-video.c:430 +msgid "Configuration has been loaded" +msgstr "Конфигурация была загружена" -#: source/ubl-settings-video.h:16 +#: source/ubl-settings-video.h:22 #, fuzzy msgid "Failed to load global configuration" msgstr "Ошибка загрузки глобальной конфигурации" -#: source/ubl-settings-video.h:17 +#: source/ubl-settings-video.h:23 #, fuzzy msgid "Failed to load local configuration" msgstr "Ошибка загрузки локальной конфигурации" -#: source/ubl-settings-video.h:19 +#: source/ubl-settings-video.h:25 #, fuzzy msgid "Saving to global configuration Succeeded" msgstr "Успешное сохранение глобальной конфигурации" -#: source/ubl-settings-video.h:20 +#: source/ubl-settings-video.h:26 #, fuzzy msgid "Saving to local configuration Succeeded" msgstr "Успешное сохранение локальной конфигурации" -- 2.35.1 From ab2553bb085b98906ec705ab036ec0e7dd538122 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 4 Apr 2023 18:08:16 +0000 Subject: [PATCH 06/16] Program development continues --- .gitignore | 4 +- Makefile | 4 +- source/ubl-settings-video.c | 80 +++- source/ubl-settings-video.h | 2 +- source/ubl-utils.c | 27 +- source/ubl-utils.h | 24 + ubl-settings-video.glade | 841 +++++++++++++++++------------------- 7 files changed, 535 insertions(+), 447 deletions(-) diff --git a/.gitignore b/.gitignore index 041dc72..7eaca04 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ ubl-settings-video ubl-settings-video.glade~ *ubl-settings-video.glade# -compile/ \ No newline at end of file +compile/ +ubl-settings-video_ru.po~ +ubl-settings-video-n.pot \ No newline at end of file diff --git a/Makefile b/Makefile index 9b33e6e..42867fb 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,6 @@ all: init build init: @echo "Initialize ..."; \ sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-video.h; \ - gcc source/ubl-settings-video.c source/ubl-utils.c -o ubl-settings-video `pkg-config --cflags --libs gtk+-3.0` -g; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: @@ -113,6 +112,8 @@ install: check uninstall @install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/devices/" "com.ublinux.${PKGNAME}.display.svg" + @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 -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" @install -dm755 "${DESTDIR}${PREFIX}/share/applications" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" @@ -120,6 +121,7 @@ install: check uninstall @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}/ui/" "${PKGNAME}-banner.png" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}-banner.png" @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; \ diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 54d83f8..724558e 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -12,6 +12,25 @@ void yon_on_plug_removed(GtkSocket* self, gpointer user_data){ } +void on_close_subwindow(GtkWidget *self){ + gtk_widget_destroy(gtk_widget_get_toplevel(self)); +} + +void on_proprietary_driver_window_open(GtkWidget *self){ + GtkBuilder *builder=gtk_builder_new_from_file(glade_path); + GtkWidget *window=yon_gtk_builder_get_widget(builder,"ProprietaryDriverChooseWindow"); + GtkWidget *closeButton=yon_gtk_builder_get_widget(builder,"ProprietaryCloseButton"); + gtk_widget_show(window); + g_signal_connect(G_OBJECT(closeButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + +} + +void on_sensitive_change(GtkWidget *self, GtkWidget *toggle){ + int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(toggle,state); +} + void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets){ int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); @@ -54,6 +73,19 @@ void on_check_discrete_only(GtkWidget *self){ } +void on_about(){ + GtkBuilder *builder=gtk_builder_new_from_file(glade_path); + GtkWidget *window=yon_gtk_builder_get_widget(builder,"aboutWindow"); + GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); + gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),_("UBlinux Video Configuration")); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); + gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),_("Progect Home Page")); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),_("Videocard and monitor configuration manager")); + gtk_widget_set_visible(hideButtonBox,0); + gtk_widget_show(window); + +} + void yon_parse_monitor(dictionary *monitor,char *string_of_settings){ char *result=NULL; if ((strstr(string_of_settings,","))){ @@ -65,13 +97,18 @@ void yon_parse_monitor(dictionary *monitor,char *string_of_settings){ } +void yon_default_configs(){ + +} + void yon_setup_config(){ FILE *videoports = popen(get_ports_command, "r"); char str[1000]; while (fgets(str,1000,videoports)){ printf("%s\n",str); char *strng=yon_char_divide_search(str,"\n",0); - monitorconfig *monitor=malloc(sizeof(monitorconfig)); + monitorconfig *monitor=NULL; + monitor=malloc(sizeof(monitorconfig)); monitor->port=yon_char_new(strng); if (!videoconfig.monitors) { videoconfig.monitors=yon_dictionary_create_with_data(strng,monitor);} @@ -90,6 +127,7 @@ void yon_setup_config(){ memset(result,0,1000); if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) videoconfig.failsafenVidia=result; + else if (strcmp(result,"")==0) { yon_default_configs(); return; } else videoconfig.failsafenVidia=NULL; memset(result,0,1000); if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) @@ -105,7 +143,7 @@ void yon_setup_config(){ else videoconfig.primusrun=NULL; for_dictionaries(dct,videoconfig.monitors){ fgets(result,1000,local); - if (strcmp(result,"(null)\n")!=0){ + if (strcmp(result,"(null)\n")!=0||strcmp(result,"")!=0){ char *curmonitor=strstr(result,"=")+1; yon_parse_monitor(dct,curmonitor); } @@ -177,11 +215,20 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); gtk_widget_show(monitors->templateMonitorConfigurationWindow); char *addln=NULL; - if (!monitors->curconfig||!((monitorconfig*)monitors->curconfig->data)->resolution) addln=_("Default Settings"); - else addln=((monitorconfig*)monitors->curconfig->data)->resolution; + if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->resolution) addln=_("Default settings"); + else addln=((monitorconfig*)settings->curconfig->data)->resolution; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),addln); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),_("Default Settings")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),_("Default Settings")); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),0); + + if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->frequency) addln=_("Default settings"); + else addln=((monitorconfig*)settings->curconfig->data)->frequency; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),_("Default settings")); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo),0); + + if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->rotation) addln=_("Default settings"); + else addln=((monitorconfig*)settings->curconfig->data)->rotation; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),_("Default settings")); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo),0); } MonitorSettings *yon_setup_monitor_settings(){ @@ -197,6 +244,7 @@ MonitorSettings *yon_setup_monitor_settings(){ monitors[i].templateMonitorInfoResolutionLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorInfoResolutionLabel")); monitors[i].templateMonitorInfoConfigureButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorInfoConfigureButton")); monitors[i].curconfig=yon_dictionary_get_nth(videoconfig.monitors,i); + printf("%d\n",i); gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",((monitorconfig*)monitors[i].curconfig->data)->port)); char *res=yon_char_get_augumented(((monitorconfig*)monitors[i].curconfig->data)->resolution,""); if (!res) res=_("Default settings"); @@ -302,11 +350,27 @@ void yon_setup_widgets(widgets_dict *widgets){ widgets->templateMonitorConfigurationDoNotSwitchOffCheck=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationDoNotSwitchOffCheck"); g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); + // g_signal_connect(G_OBJECT(widgets->mainHybridGraphicsDiscreteCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets); + g_signal_connect(G_OBJECT(widgets->mainExtraLaunchOptirunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->mainExtraLaunchOptirunEntry); + g_signal_connect(G_OBJECT(widgets->mainExtraLaunchPrismusunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->mainExtraLaunchPrismusunEntry); + g_signal_connect(G_OBJECT(widgets->mainExtraLaunchOptirunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->extraOptirunChooseAppsButton); + g_signal_connect(G_OBJECT(widgets->mainExtraLaunchPrismusunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->extraPrimusunChooseAppsButton); g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(widgets->mainDriverProprietaryDriverButton), "clicked", G_CALLBACK(on_proprietary_driver_window_open), NULL); g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); - + + g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsAboutMenuItem), "activate", G_CALLBACK(on_about), NULL); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo),_("Don't use")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo),_("Off")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo),_("fbdev")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo),_("Off")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo),_("fbdev")); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo),_("1st variant. May cause perfomance drops in video games")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo),_("2nd variant. May not work on specific video cards")); gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel),_("Video output configuration")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel),_("Proprietary driver: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel),_("Failsafe driver nVidia: ")); @@ -363,7 +427,7 @@ int main(int argc, char *argv[]){ yon_setup_widgets(&widgets); gtk_widget_show(widgets.MainWindow); yon_fill_ui(&widgets); - yon_ubl_status_box_render(widgets.mainStatusBox,widgets.mainStatusIcon,widgets.mainStatusLabel,"com.ublinux.ubl-settings-video.checked","Configuration has been loaded",BACKGROUND_IMAGE_SUCCESS_TYPE); + yon_ubl_status_box_render(widgets.mainStatusBox,widgets.mainStatusIcon,widgets.mainStatusLabel,"com.ublinux.ubl-settings-video.checked",_("Configuration has been loaded"),BACKGROUND_IMAGE_SUCCESS_TYPE); GtkCssProvider *css=gtk_css_provider_new(); gtk_css_provider_load_from_path(css,CssPath,NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index 2af67ef..56b9fc6 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -41,7 +41,7 @@ char *local; typedef char* string; -string version_application = ""; +string version_application = "1.0"; diff --git a/source/ubl-utils.c b/source/ubl-utils.c index ed01b97..d2088df 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -241,10 +241,12 @@ dictionary *yon_dictionary_rip(dictionary *dict){ dictionary *yon_dictionary_get_nth(dictionary *dict, int place){ dict=dict->first; - for (int i=0;inext) dict=dict->next; - if (dict) return dict; + else break; + if (i==place) return dict; else return NULL; } @@ -430,6 +432,25 @@ apps *yon_apps_get_by_name(apps *applist,char *name, int size){ return NULL; }; +char *yon_config_load(char *command){ + FILE *output=popen(command,"r"); + char **output_strings=NULL; + output_strings=malloc(sizeof(char)); + int i=0; + char str[1000]; + memset(str,0,1000); + while (fgets(str,1000,output)){ + output_strings=realloc(output_strings,sizeof(char*)*(i+1)); + output_strings[i]=yon_char_new(str); + memset(str,0,1000); + i++; + } +} + +int yon_config_save(char *command){ + FILE *output=popen(command,"r"); + return 1; +} //terminal-using functions diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 444fd93..d0c1049 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -14,6 +14,27 @@ #define for_dictionaries(obj,obj1) for(obj=obj1->first;obj!=NULL;obj=obj->next) +#define yon_ubl_set_global_config_load_command(command) config_commands.global_config_load_command=command +#define yon_ubl_set_global_config_save_command(command) config_commands.global_config_save_command=command +#define yon_ubl_set_local_config_load_command(command) config_commands.local_config_load_command=command +#define yon_ubl_set_local_config_save_command(command) config_commands.local_config_save_command=command + +#define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data=command + +#define yon_ubl_load_global_config() yon_config_load(config_commands.global_config_load_command) +#define yon_ubl_load_local_config() yon_config_load(config_commands.local_config_load_command) +#define yon_ubl_save_global_config() yon_config_save(config_commands.global_config_save_command) +#define yon_ubl_save_local_config() yon_config_save(config_commands.local_config_save_command) + + +struct config_commands{ +char *global_config_load_command; +char *global_config_save_command; +char *local_config_load_command; +char *local_config_save_command; +char **config_save_data; +}; + typedef enum { DICTIONARY_ACTION_WIDGETS_TYPE, DICTIONARY_IVGRAPHICALS_TYPE, @@ -99,6 +120,9 @@ void yon_apps_sort(apps *applist,int size); apps *yon_apps_get_by_name(apps *applist,char *name, int size); +char *yon_config_load(char *command); + +int yon_config_save(char *command); //terminal-using functions diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index f6ac563..5be249b 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -97,6 +97,359 @@ + + + False + О Программе + False + True + center + com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + 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-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + + + + False + ubl-settings-video + 800 + 558 + com.ublinux.ubl-settings-video + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + True + external + in + + + True + False + + + True + False + vertical + + + + + + + + + + + True + True + 0 + + + + + True + False + + + + + + True + False + 5 + 5 + True + + + Cancel + True + True + True + + + False + True + 0 + + + + + OK + True + True + True + + + False + True + 1 + + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + True + False + + + 90 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + + True + False + + + True + False + + + True + False + vertical + + + 255 + True + False + Video output configuration + + + + + + + + + True + True + 0 + + + + + False + True + 0 + + + + + True + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + document-edit-symbolic + + + True + False + document-edit-symbolic + + + True + False + open-menu-symbolic + + + + True + False + center + center + 3 + 3 + 20 + vertical + + + True + False + Monitor + True + + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 1920x1200:60Hz + + + + + + + False + True + 1 + + + + + True + True + True + end + image3 + + + + False + True + 2 + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + True + False + system-run-symbolic + 800 600 @@ -333,14 +686,7 @@ True False - - ubm-nvidia-340 - ubm-nvidia-390 - ubm-nvidia-470 - ubm-nvidia-510 - ubm-nvidia-515 - ubm-nvidia-optimus - + 0 True @@ -372,10 +718,6 @@ True False - - Off - fbdev - False @@ -387,10 +729,6 @@ True False - - Off - fbdev - False @@ -719,9 +1057,6 @@ True False - - 1st variant - True @@ -909,437 +1244,84 @@ False - True - 1 - - - - - - - False - True - 0 - - - - - True - True - False - True - True - SettingsMenu - none - - - - - - False - True - 1 - - - - - end - 3 - - - - - - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - О Программе - False - True - center - com.ublinux.ubl-settings-video - dialog - True - ubl-settings-video - 1.2 - Copyright © 2023 - UBSoft Software LLC - Settings for video output - https://ublinux.ru/ - 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-video - True - gpl-2-0 - - - False - vertical - 2 - - - False - False - top - spread - - - False - False - 0 - - - - - - - - - - False - ubl-settings-video - 800 - 558 - com.ublinux.ubl-settings-video - - - True - False - 5 - 5 - 5 - 5 - vertical - - - True - True - external - in - - - True - False - - - True - False - vertical - - - - - - - - - - - True - True - 0 - - - - - True - False - - - - - - True - False - 5 - 5 - True - - - Cancel - True - True - True - - - False - True - 0 - - - - - OK - True - True - True + True + 1 + + - - False - True - 1 - False True - end - 1 + 0 - - - False - True - 1 - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-video - - - False - True - 0 - - - - - True - False - - - True - False - + True - False - vertical + True + False + True + True + SettingsMenu + none - - 255 - True - False - Video output configuration - - - - - - - - - True - True - 0 - + False True - 0 + 1 - True - True - 0 - - - - - True - False - - - False - True - 1 + end + 3 - - True - True - 1 - - - - - True - False - document-edit-symbolic - - - True - False - document-edit-symbolic - - - True - False - open-menu-symbolic - - - - True - False - center - center - 3 - 3 - 20 - vertical - - - True - False - Monitor - True - - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 1920x1200:60Hz - - - - - - - False - True - 1 - - - - - True - True - True - end - image3 - - - - False - True - 2 - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic + + vertical + + + + + + + + + + + + + + + + + + + - - True - False - system-run-symbolic + + + + + + + + + + + + + + + @@ -1452,15 +1434,8 @@ - - - argadrh - ssfasfasf - khjgkj - - - + 450 300 False @@ -1529,7 +1504,7 @@ 5 True - + Cancel True True -- 2.35.1 From f4a60098e04f07676a588919ec74258e0eaccf8a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 5 Apr 2023 09:56:42 +0000 Subject: [PATCH 07/16] Desktop file translation fixes, ubconfig command edits --- source/ubl-settings-video.h | 4 ++-- ubl-settings-video.desktop | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index 56b9fc6..3f34972 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -31,11 +31,11 @@ #define load_drivers_global_command "/usr/bin/ubconfig --default --source global get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " -#define save_drivers_global_command "/usr/bin/ubconfig --default --source global set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " +#define save_drivers_global_command "/usr/bin/ubconfig --target global set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " #define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " -#define save_drivers_local_command "/usr/bin/ubconfig --default --source system set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " +#define save_drivers_local_command "/usr/bin/ubconfig --target system set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " char *local; diff --git a/ubl-settings-video.desktop b/ubl-settings-video.desktop index 4b2a3ed..b2b9897 100644 --- a/ubl-settings-video.desktop +++ b/ubl-settings-video.desktop @@ -1,11 +1,11 @@ [Desktop Entry] Encoding=UTF-8 Name=ubl-settings-video -Name[ru]=Настройки Видеовывода +Name[ru]=Настройки Видеоадаптера и дисплея GenericName=ubl-settings-video -GenericName[ru]=Настройки Видеовывода -Comment=ubl-settings-video -Comment[ru]=Приложение для управления настройками видеовывода для UBLinux +GenericName[ru]=Настройки Видеоадаптера и дисплея +Comment=Application for managing video adapter and display settings +Comment[ru]=Приложение для управления настройками видеоадаптера и дисплея Type=Application Exec=ubl-settings-video Icon=com.ublinux.ubl-settings-video -- 2.35.1 From 58f8eb3cde47f7cdb474b258f5270d4aa1c835e3 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 5 Apr 2023 10:09:47 +0000 Subject: [PATCH 08/16] Russian localisation editing --- source/ubl-settings-video.c | 10 +++- ubl-settings-video.glade | 21 ++----- ubl-settings-video_ru.po | 109 ++++++++++++++++++++---------------- 3 files changed, 73 insertions(+), 67 deletions(-) diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 724558e..87c8c1a 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -20,6 +20,13 @@ void on_proprietary_driver_window_open(GtkWidget *self){ GtkBuilder *builder=gtk_builder_new_from_file(glade_path); GtkWidget *window=yon_gtk_builder_get_widget(builder,"ProprietaryDriverChooseWindow"); GtkWidget *closeButton=yon_gtk_builder_get_widget(builder,"ProprietaryCloseButton"); + GtkWidget *acceptButton=yon_gtk_builder_get_widget(builder,"ProprietaryAcceptButton"); + GtkWidget *columnDriver=yon_gtk_builder_get_widget(builder,"ProprietaryDriverColumn"); + GtkWidget *columnDescription=yon_gtk_builder_get_widget(builder,"ProprietaryDescriptionColumn"); + gtk_button_set_label(GTK_BUTTON(closeButton),_("Cancel")); + gtk_button_set_label(GTK_BUTTON(acceptButton),_("Accept")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(columnDriver),_("Driver")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(columnDescription),_("Description")); gtk_widget_show(window); g_signal_connect(G_OBJECT(closeButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); @@ -212,7 +219,8 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ // gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio),_("Main monitor")); gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),_("through parameter line:")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); + // gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton),_("Cancel")); gtk_widget_show(monitors->templateMonitorConfigurationWindow); char *addln=NULL; if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->resolution) addln=_("Default settings"); diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 5be249b..2ee72e6 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -1461,7 +1461,7 @@ - + Driver @@ -1472,7 +1472,7 @@ - + Description @@ -1518,7 +1518,7 @@ - + Accept True True @@ -1796,20 +1796,6 @@ 3 - - - True - False - - - - - - True - True - 4 - - True @@ -1874,6 +1860,7 @@ False True + end 6 diff --git a/ubl-settings-video_ru.po b/ubl-settings-video_ru.po index f21a5f7..fc99cdd 100644 --- a/ubl-settings-video_ru.po +++ b/ubl-settings-video_ru.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ubl-settings-manager 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-04 18:00+0000\n" +"POT-Creation-Date: 2023-04-05 10:05+0000\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" "Language-Team: UBLinux Team \n" @@ -17,178 +17,186 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-video.c:80 source/ubl-settings-video.c:384 +#: source/ubl-settings-video.c:26 source/ubl-settings-video.c:223 +msgid "Cancel" +msgstr "Отмена" + +#: source/ubl-settings-video.c:27 +msgid "Accept" +msgstr "Принять" + +#: source/ubl-settings-video.c:28 source/ubl-settings-video.c:386 +msgid "Driver" +msgstr "Драйвер" + +#: source/ubl-settings-video.c:29 +msgid "Description" +msgstr "Описание" + +#: source/ubl-settings-video.c:87 source/ubl-settings-video.c:392 msgid "UBlinux Video Configuration" msgstr "Видеокарта/Экран" -#: source/ubl-settings-video.c:82 +#: source/ubl-settings-video.c:89 msgid "Progect Home Page" msgstr "Домашняя страница проекта" -#: source/ubl-settings-video.c:83 +#: source/ubl-settings-video.c:90 #, fuzzy msgid "Videocard and monitor configuration manager" msgstr "Настройка вывода изображения" -#: source/ubl-settings-video.c:208 +#: source/ubl-settings-video.c:215 msgid "Monitor: " msgstr "Монитор: " -#: source/ubl-settings-video.c:209 +#: source/ubl-settings-video.c:216 msgid "Resolution (px): " msgstr "Разрешение (px): " -#: source/ubl-settings-video.c:210 +#: source/ubl-settings-video.c:217 msgid "Frequency (Hz): " msgstr "Обновления (Hz): " -#: source/ubl-settings-video.c:211 +#: source/ubl-settings-video.c:218 msgid "Rotation: " msgstr "Вращение: " -#: source/ubl-settings-video.c:213 +#: source/ubl-settings-video.c:220 #, fuzzy msgid "Main monitor" msgstr "Основной" -#: source/ubl-settings-video.c:214 +#: source/ubl-settings-video.c:221 msgid "through parameter line:" msgstr "Через строку параметра: " -#: source/ubl-settings-video.c:215 -msgid "DPMS off" -msgstr "DMPS выключен" - -#: source/ubl-settings-video.c:218 source/ubl-settings-video.c:223 -#: source/ubl-settings-video.c:225 source/ubl-settings-video.c:228 -#: source/ubl-settings-video.c:230 source/ubl-settings-video.c:250 +#: source/ubl-settings-video.c:226 source/ubl-settings-video.c:231 +#: source/ubl-settings-video.c:233 source/ubl-settings-video.c:236 +#: source/ubl-settings-video.c:238 source/ubl-settings-video.c:258 msgid "Default settings" msgstr "По умолчанию" -#: source/ubl-settings-video.c:366 +#: source/ubl-settings-video.c:374 msgid "Don't use" msgstr "Не использовать" -#: source/ubl-settings-video.c:367 source/ubl-settings-video.c:369 +#: source/ubl-settings-video.c:375 source/ubl-settings-video.c:377 msgid "Off" msgstr "Выключить" -#: source/ubl-settings-video.c:368 source/ubl-settings-video.c:370 +#: source/ubl-settings-video.c:376 source/ubl-settings-video.c:378 msgid "fbdev" msgstr "fbdev" -#: source/ubl-settings-video.c:372 +#: source/ubl-settings-video.c:380 msgid "1st variant. May cause perfomance drops in video games" msgstr "1 вариант. Может снизить производительность в играх" -#: source/ubl-settings-video.c:373 +#: source/ubl-settings-video.c:381 msgid "2nd variant. May not work on specific video cards" msgstr "2 вариант. Не на каждой карте может сработать" -#: source/ubl-settings-video.c:374 +#: source/ubl-settings-video.c:382 msgid "Video output configuration" msgstr "Настройка вывода изображения" -#: source/ubl-settings-video.c:375 +#: source/ubl-settings-video.c:383 #, fuzzy msgid "Proprietary driver: " msgstr "Проприетарный драйвер: " -#: source/ubl-settings-video.c:376 +#: source/ubl-settings-video.c:384 #, fuzzy msgid "Failsafe driver nVidia: " msgstr "Отказоучтойчивый драйвер nVidia: " -#: source/ubl-settings-video.c:377 +#: source/ubl-settings-video.c:385 #, fuzzy msgid "Failsafe driver AMD/ATI: " msgstr "Отказоустойчивый драйвер AMD/ATI: " -#: source/ubl-settings-video.c:378 -msgid "Driver" -msgstr "Драйвер" - -#: source/ubl-settings-video.c:380 +#: source/ubl-settings-video.c:388 msgid "Monitor configuration" msgstr "Настройка экрана" -#: source/ubl-settings-video.c:381 +#: source/ubl-settings-video.c:389 msgid "Hybrid graphics" msgstr "Гибридная графика" -#: source/ubl-settings-video.c:382 +#: source/ubl-settings-video.c:390 msgid "Fix frame gap (nVidia)" msgstr "Исправить разрыв кадров (nVidia)" -#: source/ubl-settings-video.c:383 +#: source/ubl-settings-video.c:391 msgid "Extra" msgstr "Дополнительно" -#: source/ubl-settings-video.c:385 +#: source/ubl-settings-video.c:393 msgid "Load" msgstr "Загрузить" -#: source/ubl-settings-video.c:386 +#: source/ubl-settings-video.c:394 msgid "Save" msgstr "Сохранить" -#: source/ubl-settings-video.c:388 +#: source/ubl-settings-video.c:396 msgid "On" msgstr "Включить" -#: source/ubl-settings-video.c:389 +#: source/ubl-settings-video.c:397 msgid "Automatically choose and use driver" msgstr "Автоматический выбор и использование драйвера" -#: source/ubl-settings-video.c:390 +#: source/ubl-settings-video.c:398 #, fuzzy msgid "Launch programms through optirun (nVidia): " msgstr "Запуск программ через (nVidia)" -#: source/ubl-settings-video.c:391 +#: source/ubl-settings-video.c:399 #, fuzzy msgid "Launch programs through primusun (nVidia): " msgstr "Запуск программ через (nVidia)" -#: source/ubl-settings-video.c:392 +#: source/ubl-settings-video.c:400 msgid "discrete video only (AMD/ATI)" msgstr "Только дискретное видео (AMD/ATI)" -#: source/ubl-settings-video.c:394 +#: source/ubl-settings-video.c:402 #, fuzzy msgid "Load from global configuration" msgstr "Загрузить глобальную конфигурацию" -#: source/ubl-settings-video.c:395 +#: source/ubl-settings-video.c:403 #, fuzzy msgid "Load from local configuration" msgstr "Загрузить локальную конфигуруцию" -#: source/ubl-settings-video.c:396 +#: source/ubl-settings-video.c:404 #, fuzzy msgid "Save to global an local configuration" msgstr "Сохранить в глобальную и локальную конфигурацию" -#: source/ubl-settings-video.c:397 +#: source/ubl-settings-video.c:405 #, fuzzy msgid "Save to global configuration" msgstr "Сохранить в глобальную конфигурацию" -#: source/ubl-settings-video.c:398 +#: source/ubl-settings-video.c:406 #, fuzzy msgid "Save to local configuration" msgstr "Схоранить в локальную конфигурацию" -#: source/ubl-settings-video.c:399 +#: source/ubl-settings-video.c:407 #, fuzzy msgid "Documentation" msgstr "Справка" -#: source/ubl-settings-video.c:400 +#: source/ubl-settings-video.c:408 msgid "About" msgstr "О программе" -#: source/ubl-settings-video.c:430 +#: source/ubl-settings-video.c:438 msgid "Configuration has been loaded" msgstr "Конфигурация была загружена" @@ -211,3 +219,6 @@ msgstr "Успешное сохранение глобальной конфиг #, fuzzy msgid "Saving to local configuration Succeeded" msgstr "Успешное сохранение локальной конфигурации" + +#~ msgid "DPMS off" +#~ msgstr "DMPS выключен" -- 2.35.1 From b67c090ed412c2ee8efb4e97c847a2e5dbfc190e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 12 Apr 2023 13:56:13 +0000 Subject: [PATCH 09/16] Main interactions done, proprietary drivers management in process --- .gitignore | 3 +- Makefile | 1 + source/CMakeLists.txt | 3 +- source/ubl-settings-video.c | 1052 ++++++++++++++++++++++++----------- source/ubl-settings-video.h | 66 ++- source/ubl-utils.c | 949 ++++++++++++++++++++----------- source/ubl-utils.h | 124 ++--- ubl-settings-video.glade | 587 ++++++++++--------- ubl-settings-video.pot | 178 +++--- video-drivers.csv | 8 + 10 files changed, 1905 insertions(+), 1066 deletions(-) create mode 100644 video-drivers.csv diff --git a/.gitignore b/.gitignore index 7eaca04..1ce2845 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ ubl-settings-video.glade~ *ubl-settings-video.glade# compile/ ubl-settings-video_ru.po~ -ubl-settings-video-n.pot \ No newline at end of file +ubl-settings-video-n.pot +vgcore.* \ No newline at end of file diff --git a/Makefile b/Makefile index 42867fb..99ecc79 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ all: init build init: @echo "Initialize ..."; \ sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-video.h; \ + gcc source/ubl-settings-video.c source/ubl-utils.c -o ubl-settings-video `pkg-config --cflags --libs gtk+-3.0` -g; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0829c09..009e8d4 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -17,9 +17,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES ubl-settings-video.c - ubl-settings-video.h ubl-utils.c - ubl-utils.h) +) set(LIBRARIES ${GTK_LIBRARIES} diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 87c8c1a..b5faa06 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -1,361 +1,770 @@ #include "ubl-settings-video.h" -#include "ubl-utils.h" - config videoconfig; -void yon_on_plug_added(GtkSocket* self, gpointer user_data){ - +void yon_on_plug_added(GtkSocket *self, gpointer user_data) +{ } -void yon_on_plug_removed(GtkSocket* self, gpointer user_data){ - +void yon_on_plug_removed(GtkSocket *self, gpointer user_data) +{ } -void on_close_subwindow(GtkWidget *self){ +void on_close_subwindow(GtkWidget *self) +{ gtk_widget_destroy(gtk_widget_get_toplevel(self)); } -void on_proprietary_driver_window_open(GtkWidget *self){ - GtkBuilder *builder=gtk_builder_new_from_file(glade_path); - GtkWidget *window=yon_gtk_builder_get_widget(builder,"ProprietaryDriverChooseWindow"); - GtkWidget *closeButton=yon_gtk_builder_get_widget(builder,"ProprietaryCloseButton"); - GtkWidget *acceptButton=yon_gtk_builder_get_widget(builder,"ProprietaryAcceptButton"); - GtkWidget *columnDriver=yon_gtk_builder_get_widget(builder,"ProprietaryDriverColumn"); - GtkWidget *columnDescription=yon_gtk_builder_get_widget(builder,"ProprietaryDescriptionColumn"); - gtk_button_set_label(GTK_BUTTON(closeButton),_("Cancel")); - gtk_button_set_label(GTK_BUTTON(acceptButton),_("Accept")); - gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(columnDriver),_("Driver")); - gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(columnDescription),_("Description")); - gtk_widget_show(window); - g_signal_connect(G_OBJECT(closeButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); +void on_save_window_configuration(GtkWidget *self, MonitorSettings *monitor){ + char *freq=NULL; + char *res=NULL; + char *rot=NULL; + char *entr=NULL; + char *def=NULL; + def=_("Default settings"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationMainRadio))==1) + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main=1; + if (strcmp((freq=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationFrequencyCombo)))),def)!=0) + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=freq; + else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=NULL; + if (strcmp((res=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationResolutionCombo)))),def)!=0) + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=res; + else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=NULL; + if (strcmp((rot=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationRotationCombo)))),def)!=0) + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=rot; + else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=NULL; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationParameterLineCheck))){ + entr=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(monitor->templateMonitorConfigurationParameterLineEntry))); + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=entr; + } else { + char *str=NULL; + str = ""; + if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency!=NULL) + str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency,",")); + if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution!=NULL) + str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution,",")); + if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation!=NULL) + if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Right"))==0) + str=yon_char_get_augumented(str,"rotation:right,"); + else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Left"))==0) + str=yon_char_get_augumented(str,"rotation:left,"); + else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Invert"))==0) + str=yon_char_get_augumented(str,"rotation:invert,"); + else + str=yon_char_get_augumented(str,"rotation:normal,"); + + if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main!=0) + str=yon_char_get_augumented(str,"primary,"); + if (strcmp(str,"")!=0) + yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=str; + + } + dictionary *dict=NULL; + for_dictionaries (dict,videoconfig.videoconfig){ + MonitorSettings *monitorsett=yon_dictionary_get_data(dict,MonitorSettings*); + if (monitorsett->curconfig==monitor->curconfig){ + yon_parse_monitor(monitorsett->curconfig,yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters); + gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoResolutionLabel),yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution); + if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==0) + gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitorsett->curconfig->data)->port)); + if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==1) + gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitorsett->curconfig->data)->port,"*"))); + + } + } + on_close_subwindow(self); +}; + +void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ + GtkTreeIter iter; + char *name; + GtkTreeModel *list_s=GTK_TREE_MODEL(videoconfig.list); + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree)); + gtk_tree_selection_get_selected(selection,&list_s,&iter); + gtk_tree_model_get(list_s,&iter,0,&name,-1); + int ret = yon_gtk_combo_box_text_find(widgets->combo,name); + if (ret!=-1) + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->combo),ret); + on_close_subwindow(self); } -void on_sensitive_change(GtkWidget *self, GtkWidget *toggle){ - int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); - - gtk_widget_set_sensitive(toggle,state); +void on_sensitive_change(GtkWidget *self, GtkWidget *toggle) +{ + int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(toggle, state); } -void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets){ - int state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); - - gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel,!state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo,!state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverButton,!state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel,!state); - gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo,!state); - gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel,!state); - gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo,!state); +void on_sensitive_change_reversed(GtkWidget *self, GtkWidget *toggle) +{ + int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(toggle, !state); } -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors){ +void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets) +{ + int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + + gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel, !state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo, !state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverButton, !state); + gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel, !state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo, !state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel, !state); + gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo, !state); +} + +void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors) +{ gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); } -void on_save_configuration_local(GtkWidget *self){ +char *yon_configuration_get_save_command(char *command){ + char *str = NULL; + char *dntus = NULL; + dntus=_("Don't use"); + str=yon_char_new(command); + if (videoconfig.autoChooseDrivers==0){ + if (strcmp(videoconfig.failsafenVidia, dntus)!=0) + str = yon_char_get_augumented(str, yon_char_get_augumented(" FAILSAFENVIDIA=", videoconfig.failsafenVidia)); + if (strcmp(videoconfig.failsafeATI, dntus)!=0) + str = yon_char_get_augumented(str, yon_char_get_augumented(" FAILSAFEATI=", videoconfig.failsafeATI)); + } + if (strcmp(videoconfig.optirun, dntus)!=0&&strcmp(videoconfig.optirun, "")!=0) + str = yon_char_get_augumented(str, yon_char_get_augumented(" OPTIRUN=", videoconfig.optirun)); + if (strcmp(videoconfig.primusrun, dntus)!=0&&strcmp(videoconfig.primusrun, "")!=0) + str = yon_char_get_augumented(str, yon_char_get_augumented(" PRIMUSRUN=", videoconfig.primusrun)); + + dictionary *dict=NULL; + for_dictionaries(dict,videoconfig.monitors){ + if (yon_dictionary_get_data(dict,monitorconfig*)->stringparameters){ + + str=yon_char_get_augumented(str, yon_config_make_save_parameter_with_multiple_arguments(yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[",dict->key),"]"),",")); + + } + } + if (strcmp(str,command)!=0) + return str; + else return NULL; } -void on_save_configuration_global(GtkWidget *self){ +char *yon_configuration_get_remove_command(char *command){ + char *str = NULL; + char *dntus = NULL; + dntus=_("Don't use"); + str=yon_char_new(command); + str = yon_char_get_augumented(str, " FAILSAFENVIDIA"); + str = yon_char_get_augumented(str, " FAILSAFATI"); + str = yon_char_get_augumented(str, " OPTIRUN"); + str = yon_char_get_augumented(str, " PRIMUSRUN"); + dictionary *dict=NULL; + for_dictionaries(dict,videoconfig.monitors){ + str = yon_char_get_augumented(str, yon_char_get_augumented(" XORG_MONITOR[", yon_char_get_augumented(dict->key, "]"))); + } + if (strcmp(str,command)!=0) + return str; + else return NULL; } -void on_load_configuration_local(GtkWidget *self){ +void on_configuration_save_local(GtkWidget *self, widgets_dict *widgets) +{ + yon_update_config(widgets); + char *str=NULL; + char *delstr=NULL; + str=yon_configuration_get_save_command(save_drivers_local_command); + delstr=yon_configuration_get_remove_command(remove_drivers_local_command); + if (delstr){ + yon_config_save(delstr); + } + if (str){ + printf(str); + yon_config_save(str); + yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Local configuration saving succseeded."), BACKGROUND_IMAGE_SUCCESS_TYPE); + } + // else + // yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Local configuration saving failed."), BACKGROUND_IMAGE_FAIL_TYPE); } -void on_load_configuration_global(GtkWidget *self){ +void on_configuration_save_local_global(GtkWidget *self, widgets_dict *widgets) +{ + on_configuration_save_global(self, widgets); + on_configuration_save_local(self, widgets); + yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Local and global configuration saving succseeded."), BACKGROUND_IMAGE_SUCCESS_TYPE); } -void on_accept_monitor_settings(GtkWidget *self){ +void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets) +{ + yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Global configuration saving succseeded."), BACKGROUND_IMAGE_SUCCESS_TYPE); + yon_update_config(widgets); + char *str = NULL; + if (videoconfig.failsafenVidia) + str = yon_char_get_augumented(save_drivers_global_command, yon_char_get_augumented(" ", videoconfig.failsafenVidia)); + if (videoconfig.failsafeATI) + str = yon_char_get_augumented(str, yon_char_get_augumented(" ", videoconfig.failsafeATI)); + if (videoconfig.optirun) + str = yon_char_get_augumented(str, yon_char_get_augumented(" ", videoconfig.optirun)); + if (videoconfig.primusrun) + str = yon_char_get_augumented(str, yon_char_get_augumented(" ", videoconfig.primusrun)); + printf(str); + yon_config_save(str); +} +void yon_update_config(widgets_dict *widgets) +{ + videoconfig.optirun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry))); + videoconfig.primusrun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry))); + // videoconfig.proprietary = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo))); + videoconfig.failsafenVidia = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo))); + videoconfig.failsafeATI = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo))); } -void on_check_optisun(GtkWidget *self){ +void on_configuration_load_local(GtkWidget *self, widgets_dict *widgets) +{ + yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Local configuration loading succseeded."), BACKGROUND_IMAGE_SUCCESS_TYPE); + char *command = load_drivers_local_command; + dictionary *dct; + for_dictionaries(dct, videoconfig.monitors) + { + command = yon_char_get_augumented(command, (yon_char_get_augumented(" XORG_MONITOR[", yon_char_get_augumented(((monitorconfig *)dct->data)->port, "]")))); + } + int size = 0; + char **rtn = yon_ubl_load_global_config(command, &size); + char *param = NULL; + yon_config_init(rtn, size); + on_config_fill_interface(widgets); } -void on_check_primusrun(GtkWidget *self){ +void on_configuration_load_global(GtkWidget *self, widgets_dict *widgets) +{ + yon_ubl_status_box_render(widgets->mainStatusBox, widgets->mainStatusIcon, widgets->mainStatusLabel, _("Global configuration loading succseeded."), BACKGROUND_IMAGE_SUCCESS_TYPE); + char *command = load_drivers_global_command; + dictionary *dct; + for_dictionaries(dct, videoconfig.monitors) + { + command = yon_char_get_augumented(command, (yon_char_get_augumented(" XORG_MONITOR[", yon_char_get_augumented(((monitorconfig *)dct->data)->port, "]")))); + } + int size = 0; + char **rtn = yon_ubl_load_global_config(command, &size); + char *param = NULL; + yon_config_init(rtn, size); + on_config_fill_interface(widgets); } -void on_check_discrete_only(GtkWidget *self){ +int yon_config_init(char **parameters, int size) +{ + char *param = NULL; + dictionary *dct = NULL; + videoconfig.failsafenVidia = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); + videoconfig.failsafeATI = yon_config_get_parameter(parameters, size, "FAILSAFEATI"); + // videoconfig.proprietary = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); + videoconfig.optirun = yon_config_get_parameter(parameters, size, "OPTIRUN"); + videoconfig.primusrun = yon_config_get_parameter(parameters, size, "PRIMUSRUN"); + for_dictionaries(dct, videoconfig.monitors) + { + char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); + param = yon_config_get_parameter(parameters, size, prm); + if (param) + { + yon_parse_monitor(dct, param); + } + else{ + yon_dictionary_get_data(dct,monitorconfig*)->frequency=NULL; + yon_dictionary_get_data(dct,monitorconfig*)->resolution=NULL; + yon_dictionary_get_data(dct,monitorconfig*)->main=0; + yon_dictionary_get_data(dct,monitorconfig*)->rotation=NULL; + yon_dictionary_get_data(dct,monitorconfig*)->stringparameters=NULL; + } + yon_monitor_set_resolutions(dct); + } + if (videoconfig.videoconfig) + for_dictionaries(dct, videoconfig.videoconfig){ + MonitorSettings *settings=yon_dictionary_get_data(dct,MonitorSettings*); + if (((monitorconfig*)settings->curconfig->data)->port){ + if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==0) + gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",((monitorconfig*)settings->curconfig->data)->port)); + if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==1) + gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",yon_char_get_augumented(((monitorconfig*)settings->curconfig->data)->port,"*"))); + } + if (((monitorconfig*)settings->curconfig->data)->resolution) + gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),((monitorconfig*)settings->curconfig->data)->resolution); + else + gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),_("Default settings")); + + } } -void on_about(){ - GtkBuilder *builder=gtk_builder_new_from_file(glade_path); - GtkWidget *window=yon_gtk_builder_get_widget(builder,"aboutWindow"); - GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); - gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),_("UBlinux Video Configuration")); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),_("Progect Home Page")); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),_("Videocard and monitor configuration manager")); - gtk_widget_set_visible(hideButtonBox,0); +void on_about() +{ + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + GtkWidget *window = yon_gtk_builder_get_widget(builder, "aboutWindow"); + GtkWidget *hideButtonBox = yon_gtk_builder_get_widget(builder, "buttonBoxHide"); + gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window), _("UBlinux Video Configuration")); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), version_application); + gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window), _("Progect Home Page")); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window), _("Videocard and monitor configuration manager")); + gtk_widget_set_visible(hideButtonBox, 0); gtk_widget_show(window); +} +void yon_parse_monitor(dictionary *monitor, char *string_of_settings) +{ + int size=0; + yon_dictionary_get_data(monitor,monitorconfig*)->stringparameters=string_of_settings; + char *param_string=yon_char_new(string_of_settings); + yon_char_divide_search(param_string,"=",1); + char **rtn = yon_char_parse(param_string,&size,","); + int check_code=-1; + if ((check_code=yon_char_parsed_check_exist(rtn,size,"primary"))!=-1){ + yon_dictionary_get_data(monitor,monitorconfig*)->main=1; + rtn=yon_char_parsed_shrink(rtn,&size,check_code); + } + else + yon_dictionary_get_data(monitor,monitorconfig*)->main=0; + + if ((check_code=yon_char_parsed_check_exist(rtn,size,"rotation"))!=-1){ + yon_dictionary_get_data(monitor,monitorconfig*)->rotation=rtn[check_code]; + rtn=yon_char_parsed_shrink(rtn,&size,check_code); + } + else + yon_dictionary_get_data(monitor,monitorconfig*)->rotation=0; + + for(int i=0;iresolution=yon_char_new(rtn[i]); + } } -void yon_parse_monitor(dictionary *monitor,char *string_of_settings){ - char *result=NULL; - if ((strstr(string_of_settings,","))){ - result=yon_char_divide_search(string_of_settings,",",1); - ((monitorconfig*)monitor->data)->resolution=result; +void on_config_fill_interface(widgets_dict *widgets) +{ + gtk_widget_grab_focus(widgets->mainHeaderSettingsButton); + char *str = videoconfig.optirun; + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry), ""); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 0); + if (str) + { + yon_char_divide_search((str = yon_char_new(videoconfig.optirun)), "=", 1); + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry), str); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 1); + } + str = videoconfig.primusrun; + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry), ""); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchPrismusunCheck), 0); + if (str) + { + yon_char_divide_search((str = yon_char_new(videoconfig.primusrun)), "=", 1); + gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry), str); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchPrismusunCheck), 1); } - char *tmp=NULL; - if (tmp=strstr(string_of_settings,"rotate:")) ((monitorconfig*)monitor->data)->rotation=tmp; + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo)); + // str = videoconfig.proprietary->key; + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); + int size=0; + char ** rtn = yon_config_load(get_proprietary_drivers_command,&size); + for (int driv=0;drivmainDriverProprietaryDriverCombo),drivr); + } + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverProprietaryDriverCombo), 0); + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo)); + + str = videoconfig.failsafenVidia; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("Don't use")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("fbdev")); + if (str) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeNvidiaCombo), 1); + } + else + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeNvidiaCombo), 0); + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo)); + + str = videoconfig.failsafeATI; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("Don't use")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("fbdev")); + if (str) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo), 1); + } + else + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo), 0); + dictionary *dict = NULL; } -void yon_default_configs(){ +dictionary *yon_proprieary_get(){ + int size=0; + char **rtn = yon_config_load(get_proprietary_drivers_command,&size); + + for (int i=0;ikey,1,(char*)dict->data,-1); + } } -void yon_setup_config(){ +void yon_setup_config() +{ FILE *videoports = popen(get_ports_command, "r"); char str[1000]; - while (fgets(str,1000,videoports)){ - printf("%s\n",str); - char *strng=yon_char_divide_search(str,"\n",0); - monitorconfig *monitor=NULL; - monitor=malloc(sizeof(monitorconfig)); - monitor->port=yon_char_new(strng); - if (!videoconfig.monitors) { - videoconfig.monitors=yon_dictionary_create_with_data(strng,monitor);} - else { - videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,strng,monitor); + while (fgets(str, 1000, videoports)) + { + printf("%s\n", str); + char *strng = yon_char_divide_search(str, "\n", 0); + monitorconfig *monitor = NULL; + monitor = malloc(sizeof(monitorconfig)); + monitor->port = yon_char_new(strng); + monitor->frequency=NULL; + monitor->frequency=NULL; + monitor->main=0; + monitor->resolution=NULL; + monitor->rotation=NULL; + monitor->stringparameters=NULL; + monitor->resolutionCapabilities=NULL; + videoconfig.list=NULL; + if (!videoconfig.monitors) + { + videoconfig.monitors = yon_dictionary_create_with_data(strng, monitor); + } + else + { + videoconfig.monitors = yon_dictionary_create_with_data_connected(videoconfig.monitors, strng, monitor); } - memset(str,0,1000); + memset(str, 0, 1000); } - char *command=load_drivers_local_command; + int size = 0; + + char *command = load_drivers_local_command; dictionary *dct; - for_dictionaries(dct,videoconfig.monitors){ - command=yon_char_get_augumented(command,(yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(((monitorconfig*)dct->data)->port,"]")))); + for_dictionaries(dct, videoconfig.monitors) + { + command = yon_char_get_augumented(command, (yon_char_get_augumented(" XORG_MONITOR[", yon_char_get_augumented(((monitorconfig *)dct->data)->port, "]")))); } - FILE *local = popen(command, "r"); - char result[1000]; - memset(result,0,1000); - if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) - videoconfig.failsafenVidia=result; - else if (strcmp(result,"")==0) { yon_default_configs(); return; } - else videoconfig.failsafenVidia=NULL; - memset(result,0,1000); - if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) - videoconfig.failsafeATI=result; - else videoconfig.failsafeATI=NULL; - memset(result,0,1000); - if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) - videoconfig.optirun=result; - else videoconfig.optirun=NULL; - memset(result,0,1000); - if (fgets(result,1000,local)&&strcmp(result,"(null)\n")!=0) - videoconfig.primusrun=result; - else videoconfig.primusrun=NULL; - for_dictionaries(dct,videoconfig.monitors){ - fgets(result,1000,local); - if (strcmp(result,"(null)\n")!=0||strcmp(result,"")!=0){ - char *curmonitor=strstr(result,"=")+1; - yon_parse_monitor(dct,curmonitor); + char **rtn = yon_ubl_load_global_config(command, &size); + char *param = NULL; + + yon_config_init(rtn, size); + // on_config_fill_interface(widgets); + // (param=yon_config_get_parameter(rtn,size,"OPTIRUN")) + if ((param = yon_config_get_parameter(rtn, size, "FAILSAFENVIDIA"))) + videoconfig.failsafenVidia = yon_char_new(param); + else + videoconfig.failsafenVidia = NULL; + if ((param = yon_config_get_parameter(rtn, size, "FAILSAFEATI"))) + videoconfig.failsafeATI = yon_char_new(param); + else + videoconfig.failsafeATI = NULL; + if ((param = yon_config_get_parameter(rtn, size, "OPTIRUN"))) + videoconfig.optirun = yon_char_new(param); + else + videoconfig.optirun = NULL; + if ((param = yon_config_get_parameter(rtn, size, "PRIMUSRUN"))) + videoconfig.primusrun = yon_char_new(param); + else + videoconfig.primusrun = NULL; + + for_dictionaries(dct, videoconfig.monitors) + { + char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); + param = yon_config_get_parameter(rtn, size, prm); + if (param) + { + yon_parse_monitor(dct, param); } } + yon_proprieary_get(); } -void on_apps_chooser_open (GtkWidget *self,widgets_dict *widgets, int mode){ - GtkBuilder *builder=gtk_builder_new_from_file(glade_path);\ - // FILE *output=popen(""); - +void on_apps_chooser_open(GtkWidget *self, widgets_dict *widgets, int mode) +{ + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); // FILE *output=popen(""); + printf("not implemented yet\n"); } -void yon_fill_ui(widgets_dict *widgets){ - if (!videoconfig.proprietary||strstr(videoconfig.proprietary,"\n")==0) - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverProprietaryDriverCombo),0); - - if (!videoconfig.failsafenVidia||strstr(videoconfig.failsafenVidia,"\n")==0) - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeNvidiaCombo),0); - - if (!videoconfig.failsafeATI||strstr(videoconfig.failsafeATI,"\n")==0) - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverFailsafeAMDCombo),0); - - if (!videoconfig.optirun||strstr(videoconfig.optirun,"\n")==0) - gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry),videoconfig.optirun); - - if (!videoconfig.primusrun||strstr(videoconfig.primusrun,"\n")==0) - gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry),videoconfig.primusrun); - - if (videoconfig.gapfix==0) - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainExtraFixGapCombo),0); - +driver_window *on_driver_window_open(GtkWidget *self, GtkWidget *comboe) +{ + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + driver_window *widgets = NULL; + widgets = malloc(sizeof(driver_window)); + widgets->window = yon_gtk_builder_get_widget(builder, "ProprietaryDriverChooseWindow"); + + widgets->propriearyTreeView = yon_gtk_builder_get_widget(builder, "propriearyTreeView"); + widgets->ProprietaryDriverColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "ProprietaryDriverColumn")); + widgets->ProprietaryDescriptionColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "ProprietaryDescriptionColumn")); + + widgets->ProprietaryCloseButton = yon_gtk_builder_get_widget(builder, "ProprietaryCloseButton"); + widgets->ProprietaryAcceptButton = yon_gtk_builder_get_widget(builder, "ProprietaryAcceptButton"); + if(!videoconfig.list) + videoconfig.list = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststore6")); + gtk_list_store_clear(videoconfig.list); + yon_gtk_list_store_fill_with_proprietaries(videoconfig.list); + gtk_button_set_label(GTK_BUTTON(widgets->ProprietaryCloseButton), _("Cancel")); + gtk_button_set_label(GTK_BUTTON(widgets->ProprietaryAcceptButton), _("Accept")); + gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->propriearyTreeView),GTK_TREE_MODEL(videoconfig.list)); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Driver")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDescriptionColumn), _("Description")); + gtk_widget_show(widgets->window); + g_signal_connect(G_OBJECT(widgets->ProprietaryCloseButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + combo_tree *trcm=NULL; + trcm=malloc(sizeof(combo_tree)); + trcm->combo=comboe; + trcm->tree=widgets->propriearyTreeView; + g_signal_connect(G_OBJECT(widgets->ProprietaryAcceptButton), "clicked", G_CALLBACK(on_save_driver_configuration), trcm); } -void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings){ - int monitors_n=yon_check_for_monitors(); +void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings) +{ + int monitors_n = yon_check_for_monitors(); MonitorSettings *monitors = NULL; - monitors=malloc(sizeof(MonitorSettings)); - GtkBuilder *builder=gtk_builder_new_from_file(glade_path); - monitors->templateMonitorConfigurationWindow=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationWindow")); - monitors->templateMonitorConfigurationBox=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationBox")); - monitors->templateMonitorConfigurationMonitorLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationMonitorLabel")); - monitors->templateMonitorConfigurationResolutionLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationResolutionLabel")); - monitors->templateMonitorConfigurationResolutionCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationResolutionCombo")); - monitors->templateMonitorConfigurationFrequencyLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationFrequencyLabel")); - monitors->templateMonitorConfigurationFrequencyCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationFrequencyCombo")); - monitors->templateMonitorConfigurationRotationCombo=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationRotationCombo")); - monitors->templateMonitorConfigurationRotationLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationRotationLabel")); - monitors->templateMonitorConfigurationMainRadio=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationMainRadio")); - monitors->templateMonitorConfigurationParameterLineCheck=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationParameterLineCheck")); - monitors->templateMonitorConfigurationParameterLineEntry=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationParameterLineEntry")); - monitors->templateMonitorConfigurationDoNotSwitchOffLabel=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationDoNotSwitchOffLabel")); - monitors->templateMonitorConfigurationDoNotSwitchOffCheck=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationDoNotSwitchOffCheck")); - monitors->templateMonitorConfigurationCancelButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationCancelButton")); - monitors->templateMonitorConfigurationSaveButton=GTK_WIDGET(gtk_builder_get_object(builder,"templateMonitorConfigurationSaveButton")); + monitors = malloc(sizeof(MonitorSettings)); + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitors->templateMonitorConfigurationWindow = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationWindow")); + monitors->templateMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationBox")); + monitors->templateMonitorConfigurationMonitorLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMonitorLabel")); + monitors->templateMonitorConfigurationResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionLabel")); + monitors->templateMonitorConfigurationResolutionCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionCombo")); + monitors->templateMonitorConfigurationFrequencyLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyLabel")); + monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); + monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); + monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); + monitors->templateMonitorConfigurationMainRadio = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainRadio")); + monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); + monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); + monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); + monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); + monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); + monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); + monitors->curconfig=settings->curconfig; + + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); - // g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_configuration), monitors); - // if (i!=0) - // gtk_radio_button_join_group(GTK_RADIO_BUTTON(monitors[i].templateMonitorConfigurationMainRadio),GTK_RADIO_BUTTON(monitors[i-1].templateMonitorConfigurationMainRadio)); - - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel),_("Monitor: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel),_("Resolution (px): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel),_("Frequency (Hz): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel),_("Rotation: ")); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_window_configuration), monitors); + + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel), _("Monitor: ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel), _("Resolution (px): ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel), _("Frequency (Hz): ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel), _("Rotation: ")); // gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio),_("Main monitor")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),_("through parameter line:")); - // gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),_("DPMS off")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton),_("Cancel")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio), _("Main monitor")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck), _("through parameter line:")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton), _("Cancel")); gtk_widget_show(monitors->templateMonitorConfigurationWindow); - char *addln=NULL; - if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->resolution) addln=_("Default settings"); - else addln=((monitorconfig*)settings->curconfig->data)->resolution; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),addln); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),0); + char *addln = NULL; + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationMainRadio),((monitorconfig*)settings->curconfig->data)->main); + + addln = _("Default settings"); + int chosen=-1; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo), addln); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo), 0); - if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->frequency) addln=_("Default settings"); - else addln=((monitorconfig*)settings->curconfig->data)->frequency; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),_("Default settings")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo),0); + addln = _("Default settings"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo), _("Default settings")); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo), 0); - if (!settings->curconfig||!((monitorconfig*)settings->curconfig->data)->rotation) addln=_("Default settings"); - else addln=((monitorconfig*)settings->curconfig->data)->rotation; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),_("Default settings")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo),0); + addln = _("Default settings"); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Default settings")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Left")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Right")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Invert")); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo), 0); + + + if (yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities) + for (int res=0;rescurconfig,monitorconfig*)->resolution_size;res++){ + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities[res]); + } + if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters){ + char *entry_text=yon_char_new(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters); + yon_char_divide_search(entry_text,"=",1); + gtk_entry_set_text(GTK_ENTRY(monitors->templateMonitorConfigurationParameterLineEntry),entry_text); + } + if (((monitorconfig *)settings->curconfig->data)->resolution) + if ((chosen=yon_gtk_combo_box_text_find(monitors->templateMonitorConfigurationResolutionCombo,((monitorconfig *)settings->curconfig->data)->resolution))!=-1) + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),chosen); } -MonitorSettings *yon_setup_monitor_settings(){ - int monitors_n=yon_check_for_monitors(); +MonitorSettings *yon_setup_monitor_settings() +{ + int monitors_n = yon_check_for_monitors(); MonitorSettings *monitors = NULL; - monitors=malloc(sizeof(MonitorSettings)*monitors_n); + monitors = malloc(sizeof(MonitorSettings) * monitors_n); // videoconfig.videoconfig=videoconfig.videoconfig->first; - for (int i=0;idata)->port)); - char *res=yon_char_get_augumented(((monitorconfig*)monitors[i].curconfig->data)->resolution,""); - if (!res) res=_("Default settings"); - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel),res); - gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay),monitors[i].templateMonitorInfoBox); + for (int i = 0; i < monitors_n; i++) + { + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); + monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); + monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); + monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); + monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); + monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); + printf("%d\n", i); + if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) + gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitors[i].curconfig->data)->port)); + if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) + gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); + char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); + if (!res) + res = _("Default settings"); + gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); + gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - - if(videoconfig.monitors->next) - videoconfig.monitors=videoconfig.monitors->next; + if (i==0) + videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); + else + videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); + if (videoconfig.monitors->next) + videoconfig.monitors = videoconfig.monitors->next; } return monitors; } -int yon_check_for_monitors(){ - GdkScreen *screen=gdk_screen_get_default(); - int monitors=gdk_display_get_n_monitors(gdk_screen_get_display(screen)); +int yon_char_get_if_resolution(char *parsed_string){ + char *left=NULL, *right=NULL; + right=yon_char_new(parsed_string); + left=yon_char_divide_search(right,"x",1); + if (left&&right) + if (atoi(left)&&atoi(right)) + return 1; + return 0; +} + +int yon_check_for_monitors() +{ + GdkScreen *screen = gdk_screen_get_default(); + int monitors = gdk_display_get_n_monitors(gdk_screen_get_display(screen)); return monitors; } -dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size){ - dictionary *dict=yon_dictionary_create_with_data("0",monitors[0].templateMonitorConfigurationBox); - for (int i=1;ibuilder=gtk_builder_new_from_file(glade_path); - widgets->appsPackWindow=yon_gtk_builder_get_widget(widgets->builder,"appsPackWindow"); - widgets->appsPackBox=yon_gtk_builder_get_widget(widgets->builder,"appsPackBox"); - widgets->MainWindow=yon_gtk_builder_get_widget(widgets->builder,"MainWindow"); - widgets->headBox=yon_gtk_builder_get_widget(widgets->builder,"headBox"); - widgets->headInfoLabel=yon_gtk_builder_get_widget(widgets->builder,"headInfoLabel"); - widgets->mainPlugBox=yon_gtk_builder_get_widget(widgets->builder,"mainPlugBox"); - widgets->mainErrorBox=yon_gtk_builder_get_widget(widgets->builder,"mainErrorBox"); - widgets->mainHeadOverlay=yon_gtk_builder_get_widget(widgets->builder,"mainHeadOverlay"); - widgets->extraOptirunChooseAppsButton=yon_gtk_builder_get_widget(widgets->builder,"extraOptirunChooseAppsButton"); - widgets->extraPrimusunChooseAppsButton=yon_gtk_builder_get_widget(widgets->builder,"extraPrimusunChooseAppsButton"); - widgets->mainHeadBackgroundImage=yon_gtk_builder_get_widget(widgets->builder,"mainHeadBackgroundImage"); - widgets->mainDriverAutomaticallyChooseCheck=yon_gtk_builder_get_widget(widgets->builder,"mainDriverAutomaticallyChooseCheck"); - widgets->mainDriverProprietaryDriverLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverLabel"); - widgets->mainDriverFailsafeNvidiaLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaLabel"); - widgets->mainDriverFailsafeAMDLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDLabel"); - widgets->mainDriverProprietaryDriverCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverCombo"); - widgets->mainExtraFixGapCombo=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapCombo"); - widgets->mainDriverProprietaryDriverButton=yon_gtk_builder_get_widget(widgets->builder,"mainDriverProprietaryDriverButton"); - widgets->mainDriverFailsafeNvidiaCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeNvidiaCombo"); - widgets->mainDriverFailsafeAMDCombo=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFailsafeAMDCombo"); - widgets->mainDriverFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainDriverFrameLabel"); - widgets->monitorConfigurationMethodLabel=yon_gtk_builder_get_widget(widgets->builder,"monitorConfigurationMethodLabel"); - widgets->monitorConfigurationMethodCombo=yon_gtk_builder_get_widget(widgets->builder,"monitorConfigurationMethodCombo"); - widgets->mainMonitorVisualConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorVisualConfigurationBox"); - widgets->mainMonitorConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorConfigurationBox"); - widgets->mainMonitorConfigurationFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainMonitorConfigurationFrameLabel"); - widgets->mainHybridGraphicsDiscreteLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsDiscreteLabel"); - widgets->mainHybridGraphicsDiscreteCheck=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsDiscreteCheck"); - widgets->mainHybridGraphicsFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHybridGraphicsFrameLabel"); - widgets->mainExtraLaunchOptirunCheck=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchOptirunCheck"); - widgets->mainExtraLaunchPrismusunCheck=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchPrismusunCheck"); - widgets->mainExtraFixGapLabel=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapLabel"); - widgets->mainExtraLaunchOptirunEntry=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchOptirunEntry"); - widgets->mainExtraLaunchPrismusunEntry=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchPrismusunEntry"); - widgets->mainExtraFixGapLabelCombo=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFixGapLabelCombo"); - widgets->mainExtraLaunchThroughButton=yon_gtk_builder_get_widget(widgets->builder,"mainExtraLaunchThroughButton"); - widgets->mainExtraFrameLabel=yon_gtk_builder_get_widget(widgets->builder,"mainExtraFrameLabel"); - widgets->mainHeaderTitleLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderTitleLabel"); - widgets->mainHeaderLoadButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadButton"); - widgets->mainHeaderConfigLoadLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderConfigLoadLabel"); - widgets->mainHeaderSaveConfigurationLabel=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveConfigurationLabel"); - widgets->mainHeaderSaveButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveButton"); - widgets->mainHeaderSettingsButton=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsButton"); - widgets->mainHeaderLoadGlobalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadGlobalMenuItem"); - widgets->mainHeaderLoadLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderLoadLocalMenuItem"); - widgets->mainHeaderSaveGlobalLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveGlobalLocalMenuItem"); - widgets->mainHeaderSaveGlobalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveGlobalMenuItem"); - widgets->mainHeaderSaveLocalMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSaveLocalMenuItem"); - widgets->mainHeaderSettingsDocumentationMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsDocumentationMenuItem"); - widgets->mainHeaderSettingsAboutMenuItem=yon_gtk_builder_get_widget(widgets->builder,"mainHeaderSettingsAboutMenuItem"); - widgets->mainStatusBox=yon_gtk_builder_get_widget(widgets->builder,"mainStatusBox"); - widgets->mainStatusIcon=yon_gtk_builder_get_widget(widgets->builder,"mainStatusIcon"); - widgets->mainStatusLabel=yon_gtk_builder_get_widget(widgets->builder,"mainStatusLabel"); - widgets->templateMonitorConfigurationBox=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationBox"); - widgets->templateMonitorConfigurationMonitorLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationMonitorLabel"); - widgets->templateMonitorConfigurationResolutionLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationResolutionLabel"); - widgets->templateMonitorConfigurationResolutionCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationResolutionCombo"); - widgets->templateMonitorConfigurationFrequencyLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationFrequencyLabel"); - widgets->templateMonitorConfigurationFrequencyCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationFrequencyCombo"); - widgets->templateMonitorConfigurationRotationLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationRotationLabel"); - widgets->templateMonitorConfigurationRotationCombo=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationRotationCombo"); - widgets->templateMonitorConfigurationMainRadio=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationMainRadio"); - widgets->templateMonitorConfigurationParameterLineCheck=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationParameterLineCheck"); - widgets->templateMonitorConfigurationParameterLineEntry=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationParameterLineEntry"); - widgets->templateMonitorConfigurationDoNotSwitchOffLabel=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationDoNotSwitchOffLabel"); - widgets->templateMonitorConfigurationDoNotSwitchOffCheck=yon_gtk_builder_get_widget(widgets->builder,"templateMonitorConfigurationDoNotSwitchOffCheck"); +void yon_monitor_set_resolutions(dictionary *dict){ + yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities=malloc(0); + FILE *resolutions = popen(get_resolutions_command, "r"); + char res[1000]; + memset(res,0,1000); + int size=0; + int last_string=0; + while (fgets(res,1000,resolutions)){ + + int string_n = atoi(yon_char_divide_search(res,":",1)); + if (last_string==0) last_string=string_n-1; + if (last_string==string_n-1){ + yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities=realloc(yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities,(sizeof(char*))*(size+2)); + yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities[size]=yon_char_divide_search(yon_char_new(res),"\n",1); + size++; + last_string=string_n; + } else { + yon_dictionary_get_data(dict,monitorconfig*)->resolution_size=size; + break; + } + } +} + +void yon_setup_widgets(widgets_dict *widgets) +{ + widgets->builder = gtk_builder_new_from_file(glade_path); + widgets->appsPackWindow = yon_gtk_builder_get_widget(widgets->builder, "appsPackWindow"); + widgets->appsPackBox = yon_gtk_builder_get_widget(widgets->builder, "appsPackBox"); + widgets->MainWindow = yon_gtk_builder_get_widget(widgets->builder, "MainWindow"); + widgets->headBox = yon_gtk_builder_get_widget(widgets->builder, "headBox"); + widgets->headInfoLabel = yon_gtk_builder_get_widget(widgets->builder, "headInfoLabel"); + widgets->mainPlugBox = yon_gtk_builder_get_widget(widgets->builder, "mainPlugBox"); + widgets->mainErrorBox = yon_gtk_builder_get_widget(widgets->builder, "mainErrorBox"); + widgets->mainHeadOverlay = yon_gtk_builder_get_widget(widgets->builder, "mainHeadOverlay"); + widgets->extraOptirunChooseAppsButton = yon_gtk_builder_get_widget(widgets->builder, "extraOptirunChooseAppsButton"); + widgets->extraPrimusunChooseAppsButton = yon_gtk_builder_get_widget(widgets->builder, "extraPrimusunChooseAppsButton"); + widgets->mainHeadBackgroundImage = yon_gtk_builder_get_widget(widgets->builder, "mainHeadBackgroundImage"); + widgets->mainDriverAutomaticallyChooseCheck = yon_gtk_builder_get_widget(widgets->builder, "mainDriverAutomaticallyChooseCheck"); + widgets->mainDriverProprietaryDriverLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverLabel"); + widgets->mainDriverFailsafeNvidiaLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaLabel"); + widgets->mainDriverFailsafeAMDLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDLabel"); + widgets->mainDriverProprietaryDriverCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverCombo"); + widgets->mainExtraFixGapCombo = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFixGapCombo"); + widgets->mainDriverProprietaryDriverButton = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverButton"); + widgets->mainDriverFailsafeNvidiaCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaCombo"); + widgets->mainDriverFailsafeAMDCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDCombo"); + widgets->mainDriverFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFrameLabel"); + widgets->monitorConfigurationMethodLabel = yon_gtk_builder_get_widget(widgets->builder, "monitorConfigurationMethodLabel"); + widgets->monitorConfigurationMethodCombo = yon_gtk_builder_get_widget(widgets->builder, "monitorConfigurationMethodCombo"); + widgets->mainMonitorVisualConfigurationBox = yon_gtk_builder_get_widget(widgets->builder, "mainMonitorVisualConfigurationBox"); + widgets->mainMonitorConfigurationBox = yon_gtk_builder_get_widget(widgets->builder, "mainMonitorConfigurationBox"); + widgets->mainMonitorConfigurationFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainMonitorConfigurationFrameLabel"); + widgets->mainHybridGraphicsDiscreteLabel = yon_gtk_builder_get_widget(widgets->builder, "mainHybridGraphicsDiscreteLabel"); + widgets->mainHybridGraphicsDiscreteCheck = yon_gtk_builder_get_widget(widgets->builder, "mainHybridGraphicsDiscreteCheck"); + widgets->mainHybridGraphicsFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainHybridGraphicsFrameLabel"); + widgets->mainExtraLaunchOptirunCheck = yon_gtk_builder_get_widget(widgets->builder, "mainExtraLaunchOptirunCheck"); + widgets->mainExtraLaunchPrismusunCheck = yon_gtk_builder_get_widget(widgets->builder, "mainExtraLaunchPrismusunCheck"); + widgets->mainExtraFixGapLabel = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFixGapLabel"); + widgets->mainExtraLaunchOptirunEntry = yon_gtk_builder_get_widget(widgets->builder, "mainExtraLaunchOptirunEntry"); + widgets->mainExtraLaunchPrismusunEntry = yon_gtk_builder_get_widget(widgets->builder, "mainExtraLaunchPrismusunEntry"); + widgets->mainExtraFixGapLabelCombo = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFixGapLabelCombo"); + widgets->mainExtraLaunchThroughButton = yon_gtk_builder_get_widget(widgets->builder, "mainExtraLaunchThroughButton"); + widgets->mainExtraFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFrameLabel"); + widgets->mainHeaderTitleLabel = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderTitleLabel"); + widgets->mainHeaderLoadButton = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderLoadButton"); + widgets->mainHeaderConfigLoadLabel = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderConfigLoadLabel"); + widgets->mainHeaderSaveConfigurationLabel = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSaveConfigurationLabel"); + widgets->mainHeaderSaveButton = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSaveButton"); + widgets->mainHeaderSettingsButton = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSettingsButton"); + widgets->mainHeaderLoadGlobalMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderLoadGlobalMenuItem"); + widgets->mainHeaderLoadLocalMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderLoadLocalMenuItem"); + widgets->mainHeaderSaveGlobalLocalMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSaveGlobalLocalMenuItem"); + widgets->mainHeaderSaveGlobalMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSaveGlobalMenuItem"); + widgets->mainHeaderSaveLocalMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSaveLocalMenuItem"); + widgets->mainHeaderSettingsDocumentationMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSettingsDocumentationMenuItem"); + widgets->mainHeaderSettingsAboutMenuItem = yon_gtk_builder_get_widget(widgets->builder, "mainHeaderSettingsAboutMenuItem"); + widgets->mainStatusBox = yon_gtk_builder_get_widget(widgets->builder, "mainStatusBox"); + widgets->mainStatusIcon = yon_gtk_builder_get_widget(widgets->builder, "mainStatusIcon"); + widgets->mainStatusLabel = yon_gtk_builder_get_widget(widgets->builder, "mainStatusLabel"); + widgets->templateMonitorConfigurationBox = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationBox"); + widgets->templateMonitorConfigurationMonitorLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationMonitorLabel"); + widgets->templateMonitorConfigurationResolutionLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationResolutionLabel"); + widgets->templateMonitorConfigurationResolutionCombo = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationResolutionCombo"); + widgets->templateMonitorConfigurationFrequencyLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationFrequencyLabel"); + widgets->templateMonitorConfigurationFrequencyCombo = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationFrequencyCombo"); + widgets->templateMonitorConfigurationRotationLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationRotationLabel"); + widgets->templateMonitorConfigurationRotationCombo = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationRotationCombo"); + widgets->templateMonitorConfigurationMainRadio = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationMainRadio"); + widgets->templateMonitorConfigurationParameterLineCheck = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationParameterLineCheck"); + widgets->templateMonitorConfigurationParameterLineEntry = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationParameterLineEntry"); + widgets->templateMonitorConfigurationDoNotSwitchOffLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffLabel"); + widgets->templateMonitorConfigurationDoNotSwitchOffCheck = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffCheck"); g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); // g_signal_connect(G_OBJECT(widgets->mainHybridGraphicsDiscreteCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets); @@ -365,82 +774,89 @@ void yon_setup_widgets(widgets_dict *widgets){ g_signal_connect(G_OBJECT(widgets->mainExtraLaunchPrismusunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->extraPrimusunChooseAppsButton); g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect(G_OBJECT(widgets->mainDriverProprietaryDriverButton), "clicked", G_CALLBACK(on_proprietary_driver_window_open), NULL); + g_signal_connect(G_OBJECT(widgets->mainDriverProprietaryDriverButton), "clicked", G_CALLBACK(on_driver_window_open), widgets->mainDriverProprietaryDriverCombo); g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsAboutMenuItem), "activate", G_CALLBACK(on_about), NULL); - - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo),_("Don't use")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo),_("Off")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo),_("fbdev")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo),_("Off")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo),_("fbdev")); - - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo),_("1st variant. May cause perfomance drops in video games")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo),_("2nd variant. May not work on specific video cards")); - gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel),_("Video output configuration")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel),_("Proprietary driver: ")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel),_("Failsafe driver nVidia: ")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeAMDLabel),_("Failsafe driver AMD/ATI: ")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverFrameLabel),_("Driver")); + g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsDocumentationMenuItem), "activate", G_CALLBACK(on_about), NULL); + + g_signal_connect(G_OBJECT(widgets->mainHeaderLoadGlobalMenuItem), "activate", G_CALLBACK(on_configuration_load_global), widgets); + g_signal_connect(G_OBJECT(widgets->mainHeaderLoadLocalMenuItem), "activate", G_CALLBACK(on_configuration_load_local), widgets); + + g_signal_connect(G_OBJECT(widgets->mainHeaderSaveGlobalLocalMenuItem), "activate", G_CALLBACK(on_configuration_save_local_global), widgets); + g_signal_connect(G_OBJECT(widgets->mainHeaderSaveGlobalMenuItem), "activate", G_CALLBACK(on_configuration_save_global), widgets); + g_signal_connect(G_OBJECT(widgets->mainHeaderSaveLocalMenuItem), "activate", G_CALLBACK(on_configuration_save_local), widgets); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("Off")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("fbdev")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("Off")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("fbdev")); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("1st variant. May cause perfomance drops in video games")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("2nd variant. May not work on specific video cards")); + gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel), _("Video output configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel), _("Proprietary driver: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel), _("Failsafe driver nVidia: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeAMDLabel), _("Failsafe driver AMD/ATI: ")); + gtk_label_set_text(GTK_LABEL(widgets->mainDriverFrameLabel), _("Driver")); // gtk_label_set_text(GTK_LABEL(widgets->monitorConfigurationMethodLabel),_("Configuration method")); - gtk_label_set_text(GTK_LABEL(widgets->mainMonitorConfigurationFrameLabel),_("Monitor configuration")); - gtk_label_set_text(GTK_LABEL(widgets->mainHybridGraphicsFrameLabel),_("Hybrid graphics")); - gtk_label_set_text(GTK_LABEL(widgets->mainExtraFixGapLabel),_("Fix frame gap (nVidia)")); - gtk_label_set_text(GTK_LABEL(widgets->mainExtraFrameLabel),_("Extra")); - gtk_label_set_text(GTK_LABEL(widgets->mainHeaderTitleLabel),_("UBlinux Video Configuration")); - gtk_label_set_text(GTK_LABEL(widgets->mainHeaderConfigLoadLabel),_("Load")); - gtk_label_set_text(GTK_LABEL(widgets->mainHeaderSaveConfigurationLabel),_("Save")); - - gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck),_("On")); - gtk_button_set_label(GTK_BUTTON(widgets->mainDriverAutomaticallyChooseCheck),_("Automatically choose and use driver")); - gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchOptirunCheck),_("Launch programms through optirun (nVidia): ")); - gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchPrismusunCheck),_("Launch programs through primusun (nVidia): ")); - gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck),_("discrete video only (AMD/ATI)")); - - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadGlobalMenuItem),_("Load from global configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadLocalMenuItem),_("Load from local configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalLocalMenuItem),_("Save to global an local configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalMenuItem),_("Save to global configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveLocalMenuItem),_("Save to local configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsDocumentationMenuItem),_("Documentation")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsAboutMenuItem),_("About")); - + gtk_label_set_text(GTK_LABEL(widgets->mainMonitorConfigurationFrameLabel), _("Monitor configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainHybridGraphicsFrameLabel), _("Hybrid graphics")); + gtk_label_set_text(GTK_LABEL(widgets->mainExtraFixGapLabel), _("Fix frame gap (nVidia)")); + gtk_label_set_text(GTK_LABEL(widgets->mainExtraFrameLabel), _("Extra")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderTitleLabel), _("UBlinux Video Configuration")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderConfigLoadLabel), _("Load")); + gtk_label_set_text(GTK_LABEL(widgets->mainHeaderSaveConfigurationLabel), _("Save")); + + gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck), _("On")); + gtk_button_set_label(GTK_BUTTON(widgets->mainDriverAutomaticallyChooseCheck), _("Automatically choose and use driver")); + gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchOptirunCheck), _("Launch programms through optirun (nVidia): ")); + gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchPrismusunCheck), _("Launch programs through primusun (nVidia): ")); + gtk_button_set_label(GTK_BUTTON(widgets->mainHybridGraphicsDiscreteCheck), _("discrete video only (AMD/ATI)")); + + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadGlobalMenuItem), _("Load from global configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderLoadLocalMenuItem), _("Load from local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalLocalMenuItem), _("Save to global an local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveGlobalMenuItem), _("Save to global configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSaveLocalMenuItem), _("Save to local configuration")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsDocumentationMenuItem), _("Documentation")); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->mainHeaderSettingsAboutMenuItem), _("About")); // gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchThroughButton),_("Change")); - yon_ubl_header_setup(widgets->mainHeadOverlay,widgets->headBox,widgets->mainHeadBackgroundImage, banner_path); + yon_ubl_header_setup(widgets->mainHeadOverlay, widgets->headBox, widgets->mainHeadBackgroundImage, banner_path); // gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); // gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); MonitorSettings *monitors = yon_setup_monitor_settings(); - videoconfig.monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); - widgets->overlays=yon_dictionary_pack_overlays(monitors,yon_check_for_monitors()); - yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays,widgets->mainMonitorVisualConfigurationBox,0,0,0); + // videoconfig.monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); + widgets->overlays = yon_dictionary_pack_overlays(monitors, yon_check_for_monitors()); + yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays, widgets->mainMonitorVisualConfigurationBox, 0, 0, 0); // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->monitors,widgets->mainMonitorConfigurationBox,0,0,0); - } -int main(int argc, char *argv[]){ +int main(int argc, char *argv[]) +{ - local=setlocale(LC_ALL, ""); - textdomain (LocaleName); + local = setlocale(LC_ALL, ""); + textdomain(LocaleName); gtk_init(&argc, &argv); GError error; // xfconf_init (&error); // display_channel = xfconf_channel_new ("displays"); - videoconfig.applist=yon_apps_scan_and_parse_desktops(&videoconfig.appsize); yon_setup_config(); widgets_dict widgets; yon_setup_widgets(&widgets); gtk_widget_show(widgets.MainWindow); - yon_fill_ui(&widgets); - yon_ubl_status_box_render(widgets.mainStatusBox,widgets.mainStatusIcon,widgets.mainStatusLabel,"com.ublinux.ubl-settings-video.checked",_("Configuration has been loaded"),BACKGROUND_IMAGE_SUCCESS_TYPE); - GtkCssProvider *css=gtk_css_provider_new(); - gtk_css_provider_load_from_path(css,CssPath,NULL); + // yon_fill_ui(&widgets); + yon_ubl_status_box_render(widgets.mainStatusBox, widgets.mainStatusIcon, widgets.mainStatusLabel, _("Configuration has been loaded"), BACKGROUND_IMAGE_SUCCESS_TYPE); + on_config_fill_interface(&widgets); + GtkCssProvider *css = gtk_css_provider_new(); + gtk_css_provider_load_from_path(css, CssPath, NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), - GTK_STYLE_PROVIDER(css), - -1); + GTK_STYLE_PROVIDER(css), + -1); gtk_main(); return 0; } \ No newline at end of file diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index 3f34972..905f35f 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -16,7 +16,7 @@ #define banner_path "/usr/share/ubl-settings-video/ui/ubl-settings-video-banner.png" #define glade_path "/usr/share/ubl-settings-video/ui/ubl-settings-video.glade" -#define LocalePath "/usr/share/locale" +#define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-video" #define CssPath "/usr/share/ubl-settings-video/css/ubl-settings-video.css" #define StatusLoadGlobalFailed _("Failed to load global configuration") @@ -27,31 +27,42 @@ #define get_ports_command "xrandr |grep -E \"^[A-Z0-9]* connected\" |cut -d' ' -f1" +#define get_resolutions_command "xrandr |grep -noP \"\\d+x+\\d+\"" + +#define get_proprietary_drivers_command "" + +#define get_frequences_command "xrandr |grep -v -n \"[a-z][a-z]\" |sed 's/ * / /g' |cut -d' ' -f1,3-" + #define load_drivers_command "/usr/bin/ubconfig --default --source " #define load_drivers_global_command "/usr/bin/ubconfig --default --source global get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " -#define save_drivers_global_command "/usr/bin/ubconfig --target global set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " +#define save_drivers_global_command "/usr/bin/ubconfig --target global set video " #define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN " -#define save_drivers_local_command "/usr/bin/ubconfig --target system set video FAILSAFENVIDIA=%s FAILSAFEATI=%s OPTIRUN=%s PRIMUSRUN=%s " +#define save_drivers_local_command "pkexec /usr/bin/ubconfig --target system set video " -char *local; +#define remove_drivers_global_command "/usr/bin/ubconfig --target system remove video " -typedef char* string; +#define remove_drivers_local_command "/usr/bin/ubconfig --target global remove video " -string version_application = "1.0"; +char *local; + +typedef char *string; +string version_application = "1.0"; #define _(String) gettext(String) -typedef struct { +typedef struct +{ int autoChooseDrivers; dictionary *videoconfig; dictionary *monitors; - char *proprietary; + dictionary *proprietary; + GtkListStore *list; char *failsafenVidia; char *failsafeATI; int descreteOnly; @@ -59,20 +70,27 @@ typedef struct { char *primusrun; int gapfix; int optiorprimus; - apps *applist; - int appsize; } config; -typedef struct { + +typedef struct +{ int main; char *port; char *resolution; - char *resolutionCapabilities; + char **resolutionCapabilities; char *frequency; char *rotation; char *stringparameters; + int resolution_size; } monitorconfig; typedef struct { + GtkWidget *combo; + GtkWidget *tree; +} combo_tree; + +typedef struct +{ dictionary *monitors; dictionary *overlays; GtkBuilder *builder; @@ -145,7 +163,8 @@ typedef struct { GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; } widgets_dict; -typedef struct { +typedef struct +{ GtkWidget *templateMonitorConfigurationWindow; GtkWidget *templateMonitorConfigurationBox; GtkWidget *templateMonitorConfigurationMonitorLabel; @@ -171,8 +190,18 @@ typedef struct { dictionary *curconfig; } MonitorSettings; +typedef struct +{ + GtkWidget *window; + GtkWidget *propriearyTreeView; + GtkTreeViewColumn *ProprietaryDriverColumn; + GtkTreeViewColumn *ProprietaryDescriptionColumn; + GtkListStore *list; + GtkWidget *ProprietaryCloseButton; + GtkWidget *ProprietaryAcceptButton; +} driver_window; int yon_check_for_monitors(); MonitorSettings *yon_setup_monitor_settings(); @@ -180,5 +209,14 @@ dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size); dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size); void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); void on_save_configuration(GtkWidget self, MonitorSettings *monitors); - +int yon_config_init(char **parameters, int size); +void yon_parse_monitor(dictionary *monitor, char *string_of_settings); +void on_config_fill_interface(widgets_dict *widgets); +void yon_update_config(widgets_dict *widgets); +void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets); +void on_configuration_save__local_global(GtkWidget *self, widgets_dict *widgets); +void on_configuration_save__local(GtkWidget *self, widgets_dict *widgets); +void yon_config_monitor_string_parse(char *parameters, int *size); +int yon_char_get_if_resolution(char *parsed_string); +void yon_monitor_set_resolutions(dictionary *dict); #endif \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c index d2088df..b56e513 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1,14 +1,16 @@ #include "ubl-utils.h" #ifndef UBL_UTILS -typedef enum { +typedef enum +{ DICTIONARY_ACTION_WIDGETS_TYPE, DICTIONARY_IVGRAPHICALS_TYPE, DICTIONARY_OTHER_TYPE } DICT_TYPE; -typedef struct dictionary { +typedef struct dictionary +{ char *key; void *data; struct dictionary *next; @@ -17,23 +19,26 @@ typedef struct dictionary { DICT_TYPE data_type; } dictionary; -typedef struct apps{ - char *Name; - int Type; - char *Categories; - char *Exec; - char *Icon; - int Pluggable; - int DualPluggable; - } apps; - -typedef struct { +typedef struct apps +{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; +} apps; + +typedef struct +{ char *command; int *exitcode; } thread_output; #ifdef __GTK_H__ -typedef struct IVGrapgicals{ +typedef struct IVGrapgicals +{ char *sectionName; char *categories; GtkListStore *LV; @@ -46,354 +51,520 @@ typedef struct IVGrapgicals{ #endif #endif - -//dictionary functions - -/** - * yon_dictionary_create_empty: - * Creates and returns empty dictionary -*/ -dictionary *yon_dictionary_create_empty(){ - dictionary *dict=malloc(sizeof(dictionary)); - dict->data=NULL; - dict->key=NULL; - dict->next=NULL; - dict->prev=NULL; - dict->first=dict; - dict->data_type=DICTIONARY_OTHER_TYPE; +// dictionary functions + +/**[EN] + * yon_dictionary_create_empty(): + * Creates and returns empty dictionary + */ +dictionary *yon_dictionary_create_empty() +{ + dictionary *dict = malloc(sizeof(dictionary)); + dict->data = NULL; + dict->key = NULL; + dict->next = NULL; + dict->prev = NULL; + dict->first = dict; + dict->data_type = DICTIONARY_OTHER_TYPE; return dict; } -void yon_dictionary_switch_to_last(dictionary **dict){ - if ((*dict)->next!=NULL) - for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){} +void yon_dictionary_switch_to_last(dictionary **dict) +{ + if ((*dict)->next != NULL) + for ((*dict) = (*dict)->first; (*dict)->next != NULL; (*dict) = (*dict)->next) + { + } } -dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ - targetdict=yon_dictionary_get_last(targetdict); - targetdict->next=yon_dictionary_create_empty(); - targetdict->next->prev=targetdict; - targetdict->next->first=targetdict->first; - targetdict->next->data_type=DICTIONARY_OTHER_TYPE; +dictionary *yon_dictionary_create_conneced(dictionary *targetdict) +{ + targetdict = yon_dictionary_get_last(targetdict); + targetdict->next = yon_dictionary_create_empty(); + targetdict->next->prev = targetdict; + targetdict->next->first = targetdict->first; + targetdict->next->data_type = DICTIONARY_OTHER_TYPE; return targetdict->next; } -dictionary *yon_dictionary_get_last(dictionary *dict){ - dictionary *dct=NULL; - for (dct=dict->first;dct->next!=NULL;dct=dct->next){} +dictionary *yon_dictionary_get_last(dictionary *dict) +{ + dictionary *dct = NULL; + for (dct = dict->first; dct->next != NULL; dct = dct->next) + { + } return dct; } -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim){ - if (aim<0){ - if (dict->prev){ - if (dict->prev->prev){ - dictionary *next = dict->next,*prev=dict->prev,*preprev=prev->prev; - if (next){ - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; +dictionary *yon_dictionary_switch_places(dictionary *dict, int aim) +{ + if (aim < 0) + { + if (dict->prev) + { + if (dict->prev->prev) + { + dictionary *next = dict->next, *prev = dict->prev, *preprev = prev->prev; + if (next) + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; } return prev; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (next){ - yon_dictionary_make_first(dict); - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; } - return prev; + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (next) + { + yon_dictionary_make_first(dict); + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; + } + return prev; } } - } else if (aim>0){ - if (dict->next){ - if (dict->next->next){ - dictionary *next = dict->next,*prev=dict->prev,*afnext=next->next; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; - } else { + } + else if (aim > 0) + { + if (dict->next) + { + if (dict->next->next) + { + dictionary *next = dict->next, *prev = dict->prev, *afnext = next->next; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; + } + else + { yon_dictionary_make_first(next); - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; } return next; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=NULL; - } else { - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=NULL; + } + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = NULL; + } + else + { + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = NULL; } } } } } -void yon_dictionary_make_first(dictionary *dict){ - for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ - dct->first=dict; +void yon_dictionary_make_first(dictionary *dict) +{ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + dct->first = dict; } } -void yon_dictionary_make_nth(dictionary *dict, int nth){ - dictionary *dct=dict->first; - for (int i=0;inext;} +void yon_dictionary_make_nth(dictionary *dict, int nth) +{ + dictionary *dct = dict->first; + for (int i = 0; i < nth; i++) + { + if (dct == NULL) + return; + else + dct = dct->next; + } yon_dictionary_rip(dict); - dictionary *prev=dct->prev; - prev->next=dict; - dict->prev=prev; - dict->next=dct; - dct->prev=dict; -} - -dictionary *yon_dictionary_create_with_data(char *key, void *data){ - dictionary *dct=yon_dictionary_create_empty(); - dct->key=yon_char_new(key); - dct->data=data; - dct->data_type=DICTIONARY_OTHER_TYPE; + dictionary *prev = dct->prev; + prev->next = dict; + dict->prev = prev; + dict->next = dct; + dct->prev = dict; +} + +dictionary *yon_dictionary_create_with_data(char *key, void *data) +{ + dictionary *dct = yon_dictionary_create_empty(); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; return dct; } -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ - dictionary *dct=yon_dictionary_create_conneced(dict); - dct->key=yon_char_new(key); - dct->data=data; - dct->data_type=DICTIONARY_OTHER_TYPE; +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) +{ + dictionary *dct = yon_dictionary_create_conneced(dict); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; return dct; } -dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect){ - dictionary *dict=yon_dictionary_get_last(old); - dict->next=toconnect; - toconnect->prev=dict; - toconnect->first=dict->first; +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) +{ + dictionary *dict = yon_dictionary_get_last(old); + dict->next = toconnect; + toconnect->prev = dict; + toconnect->first = dict->first; return toconnect; } -dictionary *yon_dictionary_find(dictionary **dict, char *key){ - dictionary *dct=*dict; - for (dictionary *pointer=dct->first;pointer!=NULL;pointer=pointer->next){ - if (strcmp(pointer->key,key)==0){ - *dict=pointer; +dictionary *yon_dictionary_find(dictionary **dict, char *key) +{ + dictionary *dct = *dict; + for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next) + { + if (strcmp(pointer->key, key) == 0) + { + *dict = pointer; return pointer; } } return NULL; } - -dictionary *yon_dictionary_rip(dictionary *dict){ - if (!dict->next){ - dictionary *prev=dict->prev; - if (prev){ - prev->next=NULL; - return prev; - } else return dict; +dictionary *yon_dictionary_rip(dictionary *dict) +{ + if (!dict->next) + { + dictionary *prev = dict->prev; + if (prev) + { + prev->next = NULL; + return prev; + } + else + return dict; } - else if (!dict->prev){ - dictionary *next=dict->next; - if (next){ + else if (!dict->prev) + { + dictionary *next = dict->next; + if (next) + { yon_dictionary_make_first(next); - next->prev=NULL; + next->prev = NULL; return next; } - else return dict; + else + return dict; } - else { - dictionary *next=dict->next, *prev=dict->prev; - next->prev=prev; - prev->next=next; + else + { + dictionary *next = dict->next, *prev = dict->prev; + next->prev = prev; + prev->next = next; return next; } } -dictionary *yon_dictionary_get_nth(dictionary *dict, int place){ - dict=dict->first; - int i=0; - for (i=0;inext) - dict=dict->next; - else break; - if (i==place) return dict; - else return NULL; +dictionary *yon_dictionary_get_nth(dictionary *dict, int place) +{ + dict = dict->first; + int i = 0; + for (i = 0; i < place; i++) + if (dict->next) + dict = dict->next; + else + break; + if (i == place) + return dict; + else + return NULL; } -//char functions +// char functions -/** +/**[EN] + * * creates new char string by combining two char strings. -*/ -char *yon_char_get_augumented(char *source, char *append){ - if (source&&append){ - int size=strlen(source)+strlen(append)+1; - char *final=malloc(size); - memset(final,0,size); - if (strstr(source,"%%")) - sprintf(final,source,append); + */ +char *yon_char_get_augumented(char *source, char *append) +{ + if (source && append) + { + int size = strlen(source) + strlen(append) + 1; + char *final = malloc(size); + memset(final, 0, size); + if (strstr(source, "%%")) + sprintf(final, source, append); + else + sprintf(final, "%s%s", source, append); + return final; + } else - sprintf(final,"%s%s",source,append); - return final; - } else return NULL; } -/** +/**[EN] + * * creates new char string by copying another char. -*/ -char *yon_char_new(char *chr){ - char *newchar=malloc(strlen(chr)+1); - memset(newchar,0,strlen(chr)+1); - memcpy(newchar,chr,strlen(chr)); + */ +char *yon_char_new(char *chr) +{ + char *newchar = malloc(strlen(chr) + 1); + memset(newchar, 0, strlen(chr) + 1); + memcpy(newchar, chr, strlen(chr)); return newchar; } -/** +/**[EN] + * * cuts source string by size length from startpos position. -*/ -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); + */ +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; } -/** +/**[EN] + * * divides source string in dividepos position, * returning left part of divided string and * inserting right part to source string. -*/ -char *yon_char_divide(char *source, int dividepos){ - char *cut=malloc(dividepos+1); - memset(cut,0,dividepos+1); - memcpy(cut,source,dividepos); - char *left=malloc(strlen(source)-strlen(cut)); - memset(left,0,strlen(source)-strlen(cut)); - memcpy(left,source+dividepos+1,(strlen(source)-dividepos)); - memset(source,0,strlen(source)); - memcpy(source,left,strlen(left)); + */ +char *yon_char_divide(char *source, int dividepos) +{ + char *cut = malloc(dividepos + 1); + memset(cut, 0, dividepos + 1); + memcpy(cut, source, dividepos); + char *left = malloc(strlen(source) - strlen(cut)); + memset(left, 0, strlen(source) - strlen(cut)); + memcpy(left, source + dividepos + 1, (strlen(source) - dividepos)); + memset(source, 0, strlen(source)); + memcpy(source, left, strlen(left)); return cut; } -/** - * searches string dividepos in source string and divides it, +/**[EN] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * searches string [dividepos] in [source] string and divides it, * returning left part of divided string and - * inserting right part to source string. - * if delete_divider is 0, left part will contain delete_divider substring, else - * it will stay in right part. -*/ -char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ - char *cut=strstr(source,dividepos); - int leng=strlen(source)-strlen(cut); - cut=yon_char_divide(source,leng); - return cut; + * inserting right part to [source] string. + * if [delete_divider] is 0, left part will contain [delete_divider] substring, else + * if [delete_divider] is 1 it will stay in right part, else + * if [delete_divider] is -1 it will be deleted from string. + * + * [RU] + * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * Ищет строку [dividepos] в строке [source] и делит её в этом месте, + * возвращая левую часть разделённой строки и устанавливает в [source] правую часть. + * Если [delete_divider] равен 0, [dividepos] останется в левой строке, иначе + * если [delete_divider] равен 1, [dividepos] останется в правой строке, иначе + * если [delete_divider] равен -1, [dividepos] удаляется из строки. + */ +char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) +{ + if (source&÷pos){ + char *cut = strstr(source, dividepos); + if (cut) + { + int leng = strlen(source) - strlen(cut); + cut = yon_char_divide(source, leng); + return cut; + } + else + return NULL; + } } -/** - * converts int to char. +/**[EN] + * char *yon_char_from_int(int int_to_convert) + * converts int to char*. + * + * [RU] + * char *yon_char_from_int(int int_to_convert) + * Конвертирует int в char* + */ +char *yon_char_from_int(int int_to_convert) +{ + int i = 1; + float convert_check = (float)int_to_convert; + for (i = 1; convert_check > 10; i++) + { + convert_check = convert_check / 10; + } + char *ch = malloc(i * sizeof(char) + 1); + sprintf(ch, "%d", int_to_convert); + return ch; +} + +/**[EN] + * char **yon_char_parse(char *parameters, int *size, char *divider) + * Parses string [parameters], divided by [divider], + * then returns parsed string array and sets [size] to + * size of returned array */ -char *yon_char_from_int(int int_to_convert){ +char **yon_char_parse(char *parameters, int *size, char *divider){ + char **string=NULL; int i=1; - float convert_check=(float)int_to_convert; - for (i=1;convert_check>10;i++){ - convert_check=convert_check/10; + string=malloc(sizeof(char*)); + char *paramline=yon_char_new(parameters); + char *param; + while ((param=yon_char_divide_search(paramline,divider,1))){ + string=realloc(string,sizeof(char*)*i); + string[i-1]=yon_char_new(param); + i++; } - char *ch=malloc(i*sizeof(char)+1); - sprintf(ch,"%d",int_to_convert); - return ch; + string=realloc(string,sizeof(char*)*i); + string[i-1]=yon_char_new(paramline); + i++; + printf("%d\n",i); + *size=i-1; + return string; + } +char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete){ + char **new_char_parsed=NULL; + new_char_parsed=malloc(sizeof(char*)*(*size)-2); + int sz=0; + for (int i=0;i<*size-2;i++){ + if (i!=item_to_delete){ + new_char_parsed[i]=yon_char_new(char_string[i]); + sz++; + } + + } + *size=sz; + return new_char_parsed; +} -//parsing functions +/**[EN] + * + * Checks if [parameters] string array of length [size] + * has [param] element; +*/ +int yon_char_parsed_check_exist(char **parameters, int size, char *param){ + + for (int i=0;id_name); - file=fopen(path,"r"); - if (strlen(de->d_name)>9) + char *path = yon_char_get_augumented(DesktopPath, de->d_name); + file = fopen(path, "r"); + if (strlen(de->d_name) > 9) { - char *extension=strstr(path,"."); - if (extension!=NULL) + char *extension = strstr(path, "."); + if (extension != NULL) { - if (strcmp(extension,".desktop")==0) + if (strcmp(extension, ".desktop") == 0) { apps tempapp; - GKeyFile *gfile=g_key_file_new(); - GError *err=NULL; - g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); - char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",&err); - if (err){ - printf("%s\n",err->message); + GKeyFile *gfile = g_key_file_new(); + GError *err = NULL; + g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); + char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); + if (err) + { + printf("%s\n", err->message); } - if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; - tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); - if (tempapp.Name==NULL) continue; - tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); - if (tempapp.Categories==NULL) continue; - tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); - if (tempapp.Exec==NULL) continue; - tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); - if (tempapp.Icon==NULL) continue; - tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); - if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); - if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); - if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) - if (size==0){ - applist=(apps*)malloc(size+1*sizeof(apps)); - applist[0].Name=yon_char_new(tempapp.Name); - applist[0].Categories=yon_char_new(tempapp.Categories); - applist[0].Exec=yon_char_new(tempapp.Exec); - applist[0].Icon=yon_char_new(tempapp.Icon); - applist[0].Type=tempapp.Type; - applist[0].Pluggable=tempapp.Pluggable; - applist[0].DualPluggable=tempapp.DualPluggable; + if (strcmp(Type, "Application") == 0) + tempapp.Type = 1; + else if (strcmp(Type, "pyApplication") == 0) + tempapp.Type = 2; + else + continue; + tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); + if (tempapp.Name == NULL) + continue; + tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); + if (tempapp.Categories == NULL) + continue; + tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); + if (tempapp.Exec == NULL) + continue; + tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); + if (tempapp.Icon == NULL) + continue; + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); + if (!tempapp.Pluggable) + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); + if (tempapp.Pluggable) + tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); + if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) + if (size == 0) + { + applist = (apps *)malloc(size + 1 * sizeof(apps)); + applist[0].Name = yon_char_new(tempapp.Name); + applist[0].Categories = yon_char_new(tempapp.Categories); + applist[0].Exec = yon_char_new(tempapp.Exec); + applist[0].Icon = yon_char_new(tempapp.Icon); + applist[0].Type = tempapp.Type; + applist[0].Pluggable = tempapp.Pluggable; + applist[0].DualPluggable = tempapp.DualPluggable; size++; - } else { - applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); - applist[size].Name=yon_char_new(tempapp.Name); - applist[size].Categories=yon_char_new(tempapp.Categories); - applist[size].Exec=yon_char_new(tempapp.Exec); - applist[size].Icon=yon_char_new(tempapp.Icon); - applist[size].Pluggable=tempapp.Pluggable; - applist[size].DualPluggable=tempapp.DualPluggable; - applist[size].Type=tempapp.Type; + } + else + { + applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); + applist[size].Name = yon_char_new(tempapp.Name); + applist[size].Categories = yon_char_new(tempapp.Categories); + applist[size].Exec = yon_char_new(tempapp.Exec); + applist[size].Icon = yon_char_new(tempapp.Icon); + applist[size].Pluggable = tempapp.Pluggable; + applist[size].DualPluggable = tempapp.DualPluggable; + applist[size].Type = tempapp.Type; size++; } } @@ -401,94 +572,166 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef){ } } } - *sizef=size; + *sizef = size; return applist; }; - -void yon_apps_sort(apps *applist,int size){ +void yon_apps_sort(apps *applist, int size) +{ apps tmp; - if (size>2) + if (size > 2) { - for (int i=1;icommand=path; - thread->exitcode=malloc(sizeof(int)); +int yon_launch_app(char *name) +{ + char *path = name; + thread_output *thread = malloc(sizeof(thread_output)); + thread->command = path; + thread->exitcode = malloc(sizeof(int)); pthread_t thread_id; - pthread_create(&thread_id, NULL, (void*)yon_launch, thread); + pthread_create(&thread_id, NULL, (void *)yon_launch, thread); return *thread->exitcode; }; - -int yon_launch_app_with_arguments(char *name, char *args){ - char *path=yon_char_get_augumented("/usr/bin/",name); - path=yon_char_get_augumented(path," "); - path=yon_char_get_augumented(path,args); +int yon_launch_app_with_arguments(char *name, char *args) +{ + char *path = yon_char_get_augumented("/usr/bin/", name); + path = yon_char_get_augumented(path, " "); + path = yon_char_get_augumented(path, args); pthread_t thread_id; - thread_output *thread=malloc(sizeof(thread_output)); - thread->command=path; - thread->exitcode=malloc(sizeof(int)); - pthread_create(&thread_id, NULL, (void*)yon_launch, thread); + thread_output *thread = malloc(sizeof(thread_output)); + thread->command = path; + thread->exitcode = malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void *)yon_launch, thread); return *thread->exitcode; }; - -int yon_launch(thread_output *thread){ - int a=0; - a=system(thread->command); - *thread->exitcode=a; +int yon_launch(thread_output *thread) +{ + int a = 0; + a = system(thread->command); + *thread->exitcode = a; return *thread->exitcode; } - -//Gtk functions +// Gtk functions #ifdef __GTK_H__ @@ -500,7 +743,7 @@ int yon_launch(thread_output *thread){ // GtkWidget *PackBox=gtk_box_new(GTK_ORIENTATION_VERTICAL,5); // GtkWidget *ButtonsBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); // GtkWidget *ButtonsPlaceBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); - + // GtkWidget *CancelButton=gtk_button_new_with_label("Cancel"); // GtkWidget *AcceptButton=gtk_button_new_with_label("Accept"); // gtk_container_add(GTK_CONTAINER(chooserWindow),Box); @@ -525,7 +768,7 @@ int yon_launch(thread_output *thread){ * - templateAppsPack - setted up container for every template widget; * - templateAppsImage - image for rendering section image; * - templateAppsLabel - label for rendering section name; -*/ + */ // dictionary *yon_iv_segment_create(dictionary *connect_to, char *name, char *categories, char *segment_icon_name){ // IVSegment *segment=malloc(sizeof(IVSegment)); // segment->name=name; @@ -570,7 +813,7 @@ int yon_launch(thread_output *thread){ // gtk_box_pack_start(GTK_BOX(Box),((IVSegment*)nd->data)->Expander,0,0,0); // } // return Box; - + // } // GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data){ @@ -583,38 +826,64 @@ int yon_launch(thread_output *thread){ // return socket; // }; -int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding){ - for (dictionary *dct=dict->first; dct!=NULL;dct=dct->next){ - gtk_box_pack_start(GTK_BOX(destination),(GtkWidget*)dct->data,expand,fill,padding); + +int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){ + int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); + char *str="-1"; + for (int i=0;strcmp(str,"")!=0;i++){ + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i); + str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box)); + if (!str) return -1; + if (strcmp(text_to_find,str)==0) return i; + } + return -1; +} + +int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) +{ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); } return 1; } -int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding){ - for (dictionary *dct=dict->first; dct!=NULL;dct=dct->next){ - gtk_box_pack_end(GTK_BOX(destination),(GtkWidget*)dct->data,expand,fill,padding); +int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) +{ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + gtk_box_pack_end(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); } return 1; } -void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path){ - gtk_overlay_add_overlay(GTK_OVERLAY(Overlay),Head); - gtk_image_set_from_file(GTK_IMAGE(Image),image_path); +void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path) +{ + gtk_overlay_add_overlay(GTK_OVERLAY(Overlay), Head); + gtk_image_set_from_file(GTK_IMAGE(Image), image_path); } -void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass){ - GtkIconTheme *ictheme=gtk_icon_theme_get_default(); - GError *err=NULL; - gtk_image_set_from_pixbuf(GTK_IMAGE(StatusIcon),gtk_icon_theme_load_icon_for_scale(ictheme,IconName,25,1,GTK_ICON_LOOKUP_FORCE_SIZE,&err)); - if (err){ - printf("%s\n",err->message); +void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass) +{ + GtkIconTheme *ictheme = gtk_icon_theme_get_default(); + GError *err = NULL; + if (err) + { + printf("%s\n", err->message); g_error_free(err); } - gtk_label_set_text(GTK_LABEL(StatusLabel),StatusText); - if (BackgroundClass==BACKGROUND_IMAGE_SUCCESS_TYPE){ - gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessOK"); - } else if (BackgroundClass==BACKGROUND_IMAGE_FAIL_TYPE){ - gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessError"); + gtk_label_set_text(GTK_LABEL(StatusLabel), StatusText); + if (BackgroundClass == BACKGROUND_IMAGE_SUCCESS_TYPE) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(StatusBox), "boxInfoMessError"); + gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox), "boxInfoMessOK"); + gtk_image_set_from_pixbuf(GTK_IMAGE(StatusIcon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); + } + else if (BackgroundClass == BACKGROUND_IMAGE_FAIL_TYPE) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(StatusBox), "boxInfoMessOK"); + gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox), "boxInfoMessError"); + gtk_image_set_from_pixbuf(GTK_IMAGE(StatusIcon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); } } #endif \ No newline at end of file diff --git a/source/ubl-utils.h b/source/ubl-utils.h index d0c1049..ce50a8d 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -12,43 +13,32 @@ #define DesktopPath "/usr/share/applications/" -#define for_dictionaries(obj,obj1) for(obj=obj1->first;obj!=NULL;obj=obj->next) +#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) -#define yon_ubl_set_global_config_load_command(command) config_commands.global_config_load_command=command -#define yon_ubl_set_global_config_save_command(command) config_commands.global_config_save_command=command -#define yon_ubl_set_local_config_load_command(command) config_commands.local_config_load_command=command -#define yon_ubl_set_local_config_save_command(command) config_commands.local_config_save_command=command +#define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data = command -#define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data=command +#define yon_ubl_load_global_config(command, size_pointer) yon_config_load(command, size_pointer) +#define yon_ubl_load_local_config(command, size_pointer) yon_config_load(command, size_pointer) +#define yon_ubl_save_global_config(command) yon_config_save(command) +#define yon_ubl_save_local_config(command) yon_config_save(command) -#define yon_ubl_load_global_config() yon_config_load(config_commands.global_config_load_command) -#define yon_ubl_load_local_config() yon_config_load(config_commands.local_config_load_command) -#define yon_ubl_save_global_config() yon_config_save(config_commands.global_config_save_command) -#define yon_ubl_save_local_config() yon_config_save(config_commands.local_config_save_command) - - -struct config_commands{ -char *global_config_load_command; -char *global_config_save_command; -char *local_config_load_command; -char *local_config_save_command; -char **config_save_data; -}; - -typedef enum { - DICTIONARY_ACTION_WIDGETS_TYPE, - DICTIONARY_IVGRAPHICALS_TYPE, +typedef enum +{ + #ifdef __GTK_H__ + DICTIONARY_GTK_WIDGETS_TYPE, + #endif DICTIONARY_OTHER_TYPE } DICT_TYPE; - -typedef struct { +typedef struct +{ char *command; int *exitcode; } thread_output; -typedef struct dictionary { +typedef struct dictionary +{ char *key; void *data; struct dictionary *next; @@ -57,26 +47,29 @@ typedef struct dictionary { DICT_TYPE data_type; } dictionary; -typedef struct apps{ - char *Name; - int Type; - char *Categories; - char *Exec; - char *Icon; - int Pluggable; - int DualPluggable; - } apps; +typedef struct apps +{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; +} apps; +// dictionary functions -//dictionary functions + +#define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data) dictionary *yon_dictionary_create_empty(); -dictionary * yon_dictionary_create_conneced(dictionary *targetdict); +dictionary *yon_dictionary_create_conneced(dictionary *targetdict); dictionary *yon_dictionary_get_last(dictionary *dict); -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); +dictionary *yon_dictionary_switch_places(dictionary *dict, int aim); void yon_dictionary_make_first(dictionary *dict); @@ -94,7 +87,7 @@ dictionary *yon_dictionary_rip(dictionary *dict); dictionary *yon_dictionary_get_nth(dictionary *dict, int place); -//char functions +// char functions char *yon_char_get_augumented(char *source, char *append); @@ -104,59 +97,62 @@ char *yon_cut(char *source, int size, int startpos); char *yon_char_divide(char *source, int dividepos); -char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); +char *yon_char_divide_search(char *source, char *dividepos, int delete_divider); char *yon_char_from_int(int int_to_convert); +char **yon_char_parse(char *parameters, int *size, char *divider); +char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete); -//parsing functions - -apps *yon_apps_scan_and_parse_desktops(int *sizef); +int yon_char_parsed_check_exist(char **parameters, int size, char *param); +// parsing functions -void yon_apps_sort(apps *applist,int size); +apps *yon_apps_scan_and_parse_desktops(int *sizef); +void yon_apps_sort(apps *applist, int size); -apps *yon_apps_get_by_name(apps *applist,char *name, int size); +apps *yon_apps_get_by_name(apps *applist, char *name, int size); -char *yon_config_load(char *command); +char **yon_config_load(char *command, int *str_len); int yon_config_save(char *command); -//terminal-using functions +char *yon_config_get_parameter(char **parameters, int size, char *param); +char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider); +// terminal-using functions int yon_launch_app(char *name); - int yon_launch_app_with_arguments(char *name, char *args); - int yon_launch(thread_output *thread); -//Gtk functions +// Gtk functions #ifdef __GTK_H__ -#define yon_gtk_builder_get_widget(obj,obj2) GTK_WIDGET(gtk_builder_get_object(obj,obj2)) - +#define yon_gtk_builder_get_widget(obj, obj2) GTK_WIDGET(gtk_builder_get_object(obj, obj2)) -typedef struct { +typedef struct +{ GtkWidget *Icon; GtkWidget *Label; GtkWidget *IconView; GtkListStore *List; } expander_icon_view; - // GtkWidget *yon_gtk_app_chooser_apps_create(); // dictionary *yon_gtk_app_chooser_create(); // expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...); +int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); + GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); @@ -164,25 +160,25 @@ int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); -//uninitialised - -void yon_on_plug_added(GtkSocket* self, gpointer user_data); -void yon_on_plug_removed(GtkSocket* self, gpointer user_data); +// uninitialised +void yon_on_plug_added(GtkSocket *self, gpointer user_data); +void yon_on_plug_removed(GtkSocket *self, gpointer user_data); #endif -typedef enum { +typedef enum +{ BACKGROUND_IMAGE_SUCCESS_TYPE, BACKGROUND_IMAGE_FAIL_TYPE } BACKGROUND_IMAGE_TYPE; #ifdef __cplusplus -#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()),GTK_WIDGET(head.gobj()),GTK_WIDGET(image.gobj()),(char*)imag_path) -#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(GTK_WIDGET(statusbox.gobj()), GTK_WIDGET(statusicon.gobj()), GTK_WIDGET(statuslabel.gobj()), (char*)iconname, (char*)statustext, backgroundclass) +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path) +#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(GTK_WIDGET(statusbox.gobj()), GTK_WIDGET(statusicon.gobj()), GTK_WIDGET(statuslabel.gobj()), (char *)iconname, (char *)statustext, backgroundclass) #else -#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay),GTK_WIDGET(head),GTK_WIDGET(image), (char*)imag_path) -#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) +#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, statustext, backgroundclass) _yon_ubl_status_box_render(statusbox, statusicon, statuslabel, statustext, backgroundclass) #endif void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); -void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); +void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); #endif \ No newline at end of file diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 2ee72e6..8b3dea4 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -342,6 +342,16 @@ False document-edit-symbolic + + True + False + dialog-information-symbolic + + + True + False + user-trash-symbolic + True False @@ -360,7 +370,6 @@ True False - center center 3 3 @@ -408,7 +417,7 @@ True - True + False True end image3 @@ -440,11 +449,6 @@ False process-stop-symbolic - - True - False - emblem-ok-symbolic - True False @@ -1323,6 +1327,187 @@ + + True + False + go-bottom-symbolic + + + 450 + 300 + False + com.ublinux.ubl-settings-video + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + True + liststore6 + 0 + True + 2 + + + + + + Package + + + + + Driver + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Supported Devices + + + + + True + True + 0 + + + + + True + False + center + vertical + 5 + + + True + True + True + image9 + + + False + True + 0 + + + + + True + True + True + image11 + + + False + True + 1 + + + + + True + True + True + image10 + + + False + True + 2 + + + + + False + True + 1 + + + + + True + True + 0 + + + + + True + False + 5 + + + + + + True + False + 5 + True + + + Close + True + True + True + image6 + + + False + True + 0 + + + + + False + True + end + 1 + + + + + False + True + 2 + + + + + @@ -1336,13 +1521,6 @@ - - - g89 - Settings - Settings - - True @@ -1435,120 +1613,6 @@ - - 450 - 300 - False - com.ublinux.ubl-settings-video - - - True - False - 5 - 5 - 5 - 5 - vertical - 5 - - - True - True - liststore6 - True - 2 - - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - True - True - 0 - - - - - True - False - 5 - - - - - - True - False - 5 - True - - - Cancel - True - True - True - image6 - - - False - True - 0 - - - - - Accept - True - True - True - image7 - - - False - True - 1 - - - - - False - True - end - 1 - - - - - False - True - 1 - - - - - radiobutton True @@ -1562,33 +1626,74 @@ True com.ublinux.ubl-settings-video - + True False vertical - + True False - 5 - 5 5 5 5 5 vertical - 5 - + True False + 5 + 5 + vertical 5 - + True False - start - Monitor: + 5 + + + True + False + start + Monitor: + + + False + True + 0 + + + + + True + False + 0 + + + False + True + 1 + + + + + Main monitor + True + True + False + 15 + 15 + True + radioMainMonitor + + + False + True + 2 + + False @@ -1597,82 +1702,90 @@ - - True - False - 0 - - - False - True - 1 - - - - - Main monitor - True - True - False - 15 - 15 - True - radioMainMonitor - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 5 - - + True False - Resolution (px): - 0 + 5 + + + True + False + Resolution (px): + 0 + + + False + True + 0 + + + + + True + False + center + 0 + + + True + True + 1 + + + + + True + False + 5 + + + True + False + Frequency (Hz) + + + False + True + 0 + + + + + True + False + center + + + False + True + 1 + + + + + False + True + 2 + + False True - 0 - - - - - True - False - center - 0 - - - True - True 1 - + True False 5 - + True False - Frequency (Hz) + Rotation + 0 False @@ -1681,17 +1794,30 @@ - + True False - center - False + True True 1 + + + True + False + + + + + + False + True + 2 + + False @@ -1699,67 +1825,29 @@ 2 - - - False - True - 1 - - - - - True - False - 5 - - - True - False - Rotation - 0 - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - + True False - - - False True - 2 + 5 False True - 2 + 0 True False + 5 5 5 @@ -1793,18 +1881,7 @@ False True - 3 - - - - - True - False - - - False - True - 5 + 1 @@ -1861,7 +1938,7 @@ False True end - 6 + 2 diff --git a/ubl-settings-video.pot b/ubl-settings-video.pot index 369eeae..5fd3d71 100644 --- a/ubl-settings-video.pot +++ b/ubl-settings-video.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-04 17:42+0000\n" +"POT-Creation-Date: 2023-04-05 10:05+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,154 +17,188 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-video.c:151 -msgid "About" +#: source/ubl-settings-video.c:26 source/ubl-settings-video.c:223 +msgid "Cancel" msgstr "" -#: source/ubl-settings-video.c:143 -msgid "Automatically choose and use driver" +#: source/ubl-settings-video.c:27 +msgid "Accept" msgstr "" -#: source/ubl-settings-video.c:153 -msgid "Change" +#: source/ubl-settings-video.c:28 source/ubl-settings-video.c:386 +msgid "Driver" msgstr "" -#: source/ubl-settings-video.c:131 -msgid "Configuration method" +#: source/ubl-settings-video.c:29 +msgid "Description" msgstr "" -#: source/ubl-settings-video.c:41 -msgid "DPMS off" +#: source/ubl-settings-video.c:87 source/ubl-settings-video.c:392 +msgid "UBlinux Video Configuration" msgstr "" -#: source/ubl-settings-video.c:37 -msgid "Do not switch display off" +#: source/ubl-settings-video.c:89 +msgid "Progect Home Page" msgstr "" -#: source/ubl-settings-video.c:150 -msgid "Documentation" +#: source/ubl-settings-video.c:90 +msgid "Videocard and monitor configuration manager" msgstr "" -#: source/ubl-settings-video.c:130 -msgid "Driver" +#: source/ubl-settings-video.c:215 +msgid "Monitor: " msgstr "" -#: source/ubl-settings-video.c:136 -msgid "Extra" +#: source/ubl-settings-video.c:216 +msgid "Resolution (px): " msgstr "" -#: source/ubl-settings-video.h:16 -msgid "Failed to load global configuration" +#: source/ubl-settings-video.c:217 +msgid "Frequency (Hz): " msgstr "" -#: source/ubl-settings-video.h:17 -msgid "Failed to load local configuration" +#: source/ubl-settings-video.c:218 +msgid "Rotation: " msgstr "" -#: source/ubl-settings-video.c:129 -msgid "Failsafe driver AMD/ATI: " +#: source/ubl-settings-video.c:220 +msgid "Main monitor" msgstr "" -#: source/ubl-settings-video.c:128 -msgid "Failsafe driver nVidia: " +#: source/ubl-settings-video.c:221 +msgid "through parameter line:" msgstr "" -#: source/ubl-settings-video.c:135 -msgid "Fix frame gap (nVidia)" +#: source/ubl-settings-video.c:226 source/ubl-settings-video.c:231 +#: source/ubl-settings-video.c:233 source/ubl-settings-video.c:236 +#: source/ubl-settings-video.c:238 source/ubl-settings-video.c:258 +msgid "Default settings" msgstr "" -#: source/ubl-settings-video.c:35 -msgid "Frequency (Hz): " +#: source/ubl-settings-video.c:374 +msgid "Don't use" msgstr "" -#: source/ubl-settings-video.c:134 -msgid "Hybrid graphics" +#: source/ubl-settings-video.c:375 source/ubl-settings-video.c:377 +msgid "Off" msgstr "" -#: source/ubl-settings-video.c:125 -msgid "Launch programms through (nVidia)" +#: source/ubl-settings-video.c:376 source/ubl-settings-video.c:378 +msgid "fbdev" msgstr "" -#: source/ubl-settings-video.c:138 -msgid "Load" +#: source/ubl-settings-video.c:380 +msgid "1st variant. May cause perfomance drops in video games" msgstr "" -#: source/ubl-settings-video.c:145 -msgid "Load from global configuration" +#: source/ubl-settings-video.c:381 +msgid "2nd variant. May not work on specific video cards" msgstr "" -#: source/ubl-settings-video.c:146 -msgid "Load from local configuration" +#: source/ubl-settings-video.c:382 +msgid "Video output configuration" msgstr "" -#: source/ubl-settings-video.c:39 -msgid "Main monitor" +#: source/ubl-settings-video.c:383 +msgid "Proprietary driver: " msgstr "" -#: source/ubl-settings-video.c:141 -msgid "Manual configuration" +#: source/ubl-settings-video.c:384 +msgid "Failsafe driver nVidia: " msgstr "" -#: source/ubl-settings-video.c:132 +#: source/ubl-settings-video.c:385 +msgid "Failsafe driver AMD/ATI: " +msgstr "" + +#: source/ubl-settings-video.c:388 msgid "Monitor configuration" msgstr "" -#: source/ubl-settings-video.c:33 -msgid "Monitor: " +#: source/ubl-settings-video.c:389 +msgid "Hybrid graphics" +msgstr "" + +#: source/ubl-settings-video.c:390 +msgid "Fix frame gap (nVidia)" msgstr "" -#: source/ubl-settings-video.c:142 +#: source/ubl-settings-video.c:391 +msgid "Extra" +msgstr "" + +#: source/ubl-settings-video.c:393 +msgid "Load" +msgstr "" + +#: source/ubl-settings-video.c:394 +msgid "Save" +msgstr "" + +#: source/ubl-settings-video.c:396 msgid "On" msgstr "" -#: source/ubl-settings-video.c:127 -msgid "Proprietary driver: " +#: source/ubl-settings-video.c:397 +msgid "Automatically choose and use driver" msgstr "" -#: source/ubl-settings-video.c:34 -msgid "Resolution (px): " +#: source/ubl-settings-video.c:398 +msgid "Launch programms through optirun (nVidia): " msgstr "" -#: source/ubl-settings-video.c:36 -msgid "Rotation: " +#: source/ubl-settings-video.c:399 +msgid "Launch programs through primusun (nVidia): " msgstr "" -#: source/ubl-settings-video.c:139 -msgid "Save" +#: source/ubl-settings-video.c:400 +msgid "discrete video only (AMD/ATI)" +msgstr "" + +#: source/ubl-settings-video.c:402 +msgid "Load from global configuration" msgstr "" -#: source/ubl-settings-video.c:147 +#: source/ubl-settings-video.c:403 +msgid "Load from local configuration" +msgstr "" + +#: source/ubl-settings-video.c:404 msgid "Save to global an local configuration" msgstr "" -#: source/ubl-settings-video.c:148 +#: source/ubl-settings-video.c:405 msgid "Save to global configuration" msgstr "" -#: source/ubl-settings-video.c:149 +#: source/ubl-settings-video.c:406 msgid "Save to local configuration" msgstr "" -#: source/ubl-settings-video.h:19 -msgid "Saving to global configuration Succeeded" +#: source/ubl-settings-video.c:407 +msgid "Documentation" msgstr "" -#: source/ubl-settings-video.h:20 -msgid "Saving to local configuration Succeeded" +#: source/ubl-settings-video.c:408 +msgid "About" msgstr "" -#: source/ubl-settings-video.c:137 -msgid "UBlinux Video Configuration" +#: source/ubl-settings-video.c:438 +msgid "Configuration has been loaded" msgstr "" -#: source/ubl-settings-video.c:126 -msgid "Video output configuration" +#: source/ubl-settings-video.h:22 +msgid "Failed to load global configuration" msgstr "" -#: source/ubl-settings-video.c:133 -msgid "discrete video only (AMD/ATI)" +#: source/ubl-settings-video.h:23 +msgid "Failed to load local configuration" msgstr "" -#: source/ubl-settings-video.c:40 -msgid "through parameter line:" +#: source/ubl-settings-video.h:25 +msgid "Saving to global configuration Succeeded" +msgstr "" + +#: source/ubl-settings-video.h:26 +msgid "Saving to local configuration Succeeded" msgstr "" diff --git a/video-drivers.csv b/video-drivers.csv new file mode 100644 index 0000000..e79c785 --- /dev/null +++ b/video-drivers.csv @@ -0,0 +1,8 @@ +VERSION_ID:DRV_PAСKAGE:DRV_NAME:DRV_DESCRIPTION:DRV_SUPPORT +:ubm-nvidia-340:nvidia-340:Пакет с модулем драйвера и утилиты NVIDIA 340xx:Драйвер видеокарт nVidia серий 8XXX, 9XXX, 1XX, 2XX, 3XX, 4XX, 5XX, 6XX, 7XX +:ubm-nvidia-390:nvidia-390:Пакет с модулем драйвера и утилиты NVIDIA 390xx:Драйвер видеокарт nVidia серий 4XX, 5XX, 6XX, 7XX, 9XX, 10XX +:ubm-nvidia-430:nvidia-430:Пакет с модулем включает в себя драйвер NVIDIA 430xx и утилиты:Драйвер видеокарт nVidia серий 6XX, 7XX, 9XX, 10XX, 16XX +:ubm-nvidia-470:nvidia-470:Пакет с модулем драйвера и утилиты NVIDIA 470xx:Драйвер видеокарт nVidia серий NVS, Quadro Sync, Quadro NVS, Quadro Blade/Embedded, Quadro, Quadro RTX, NVIDIA RTX +:ubm-nvidia-510:nvidia-510:Пакет с модулем драйвера и утилиты NVIDIA 510xx:Драйвер видеокарт nVidia серий NVS, Quadro Sync, Quadro NVS, Quadro Blade/Embedded, Quadro, Quadro RTX, NVIDIA RTX +:ubm-nvidia-515:nvidia-515:Пакет с модулем драйвера и утилиты NVIDIA 515xx:Драйвер видеокарт nVidia серий NVS, Quadro Sync, Quadro NVS, Quadro Blade/Embedded, Quadro, Quadro RTX, NVIDIA RTX +:ubm-nvidia-optimus:nvidia-optimus:Пакет с модулем включает в себя NVIDIA Optimus: -- 2.35.1 From c47eab30d16413398bbee2593028dcebcbe3882e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 19 Apr 2023 18:04:16 +0000 Subject: [PATCH 10/16] New interface - not fully redone yet --- Resolutions.csv | 27 + source/ubl-settings-video.c | 31 +- source/ubl-settings-video.h | 26 +- ubl-settings-video.glade | 2433 ++++++++++++++++++++--------------- 4 files changed, 1449 insertions(+), 1068 deletions(-) create mode 100644 Resolutions.csv diff --git a/Resolutions.csv b/Resolutions.csv new file mode 100644 index 0000000..bff0b8e --- /dev/null +++ b/Resolutions.csv @@ -0,0 +1,27 @@ +640x480 ,4:3,VGA +800x480 ,5:3,WVGA +800x600 ,4:3,SVGA +854x480 ,16:9,FWVGA +960x540 ,19:9,qHD +1024x600,128:75,WSVGA +1024x768,4:3,XGA +1152x864,4:3,XGA+ +1200x600,2:1,WXVGA +1280x720,16:9,HD +1280x768,5:3,WSGA +1280x1024,5:4,SXGA +1440x900,16:10,WXGA+ +1400x1050,4:3,SXGA+ +1440x1080,4:3,HDV 1080 +1536x960,16:10,XJXGA +1536x1024,3:2,WSXGA +1600x900,16:9,HD+ +1600x1024,25:16,WSXGA +1600x1200,4:3,UXGA +1680x1050,16:10,WSXGA+ +1920x1080,16:9,FHD +1920x1200,16:10,WUXGA +2048x1080,19:10,2K DCI +2048x1152,16:9,QWXGA +2560x1080,21:9,UWHD +2560x1440,16:9,QHD diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index b5faa06..5de3e3e 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -541,13 +541,24 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings) monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); - monitors->templateMonitorConfigurationMainRadio = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainRadio")); + monitors->templateMonitorConfigurationMainRadio = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainCheck")); monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); - monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); + // monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); + + monitors->templateMonitorConfigurationEnableCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationEnableCheck")); + monitors->templateMonitorConfigurationPortLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortLabel")); + monitors->templateMonitorConfigurationPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortCombo")); + monitors->templateMonitorConfigurationShowUnsupportedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationShowUnsupportedCheck")); + monitors->templateMonitorConfigurationPositionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionLabel")); + monitors->templateMonitorConfigurationPositionPosCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPosCombo")); + monitors->templateMonitorConfigurationPositionPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPortCombo")); + monitors->templateMonitorConfigurationModelineCVTCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineCVTCheck")); + monitors->templateMonitorConfigurationUseCVTReducedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationUseCVTReducedCheck")); + monitors->templateMonitorConfigurationModelineGTFCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineGTFCheck")); monitors->curconfig=settings->curconfig; g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); @@ -556,7 +567,16 @@ void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings) g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_window_configuration), monitors); + videoconfig.ports = yon_config_load(get_ports_command,&videoconfig.portssize); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel), _("Monitor: ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel), _("Port: ")); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPositionLabel), _("Position: ")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationShowUnsupportedCheck), _("Show unsupported: ")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationEnableCheck), _("Enabled")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineCVTCheck), _("Create modeline for current resolution with CVT")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationUseCVTReducedCheck), _("Use \"CVT Reduced Blanking\" ")); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineGTFCheck), _("Create modeline for current resolution with GTF")); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel), _("Resolution (px): ")); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel), _("Frequency (Hz): ")); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel), _("Rotation: ")); @@ -612,8 +632,11 @@ MonitorSettings *yon_setup_monitor_settings() monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); + monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); + monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); + monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); printf("%d\n", i); if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) @@ -621,11 +644,15 @@ MonitorSettings *yon_setup_monitor_settings() if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); + if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->enable==1) + gtk_widget_set_sensitive(monitors[i].templateMonitorImage,1); if (!res) res = _("Default settings"); gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); + g_signal_connect(G_OBJECT(monitors[i].templateMonitorDeleteButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); + g_signal_connect(G_OBJECT(monitors[i].templateMonitorSwitchButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); if (i==0) videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); else diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index 905f35f..fc35e42 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -25,11 +25,13 @@ #define StatusSaveGlobalFailed _("Saving to global configuration Succeeded") #define StatusSaveLocalFailed _("Saving to local configuration Succeeded") -#define get_ports_command "xrandr |grep -E \"^[A-Z0-9]* connected\" |cut -d' ' -f1" +#define get_ports_command "xrandr |grep -E \"*connected\" |cut -d' ' -f1" #define get_resolutions_command "xrandr |grep -noP \"\\d+x+\\d+\"" -#define get_proprietary_drivers_command "" +#define get_proprietary_drivers_command "cut -d, -f1- video-drivers.csv | grep -E \"-\"" + +#define get_resolutions_supportable_command "cut -d, -f1- Resolutions.csv |sed 's/,/\t/g'" #define get_frequences_command "xrandr |grep -v -n \"[a-z][a-z]\" |sed 's/ * / /g' |cut -d' ' -f1,3-" @@ -70,11 +72,17 @@ typedef struct char *primusrun; int gapfix; int optiorprimus; + char **ports; + int portssize; + char **resolutions; + int resolutionssize; } config; typedef struct { int main; + int enable; + char *position; char *port; char *resolution; char **resolutionCapabilities; @@ -182,11 +190,25 @@ typedef struct GtkWidget *templateMonitorConfigurationCancelButton; GtkWidget *templateMonitorConfigurationSaveButton; + GtkWidget *templateMonitorConfigurationEnableCheck; + GtkWidget *templateMonitorConfigurationPortLabel; + GtkWidget *templateMonitorConfigurationPortCombo; + GtkWidget *templateMonitorConfigurationShowUnsupportedCheck; + GtkWidget *templateMonitorConfigurationPositionLabel; + GtkWidget *templateMonitorConfigurationPositionPosCombo; + GtkWidget *templateMonitorConfigurationPositionPortCombo; + GtkWidget *templateMonitorConfigurationModelineCVTCheck; + GtkWidget *templateMonitorConfigurationUseCVTReducedCheck; + GtkWidget *templateMonitorConfigurationModelineGTFCheck; + GtkWidget *templateMonitorscreenOverlay; + GtkWidget *templateMonitorImage; GtkWidget *templateMonitorInfoBox; GtkWidget *templateMonitorInfoNameLabel; GtkWidget *templateMonitorInfoResolutionLabel; GtkWidget *templateMonitorInfoConfigureButton; + GtkWidget *templateMonitorDeleteButton; + GtkWidget *templateMonitorSwitchButton; dictionary *curconfig; } MonitorSettings; diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 8b3dea4..32faf42 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -3,7 +3,47 @@ + + + + vertical + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True False @@ -97,120 +137,39 @@ - - - False - О Программе - False - True - center - com.ublinux.ubl-settings-video - dialog - True - ubl-settings-video - 1.2 - Copyright © 2023 - UBSoft Software LLC - Settings for video output - https://ublinux.ru/ - 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-video - True - gpl-2-0 - - - False - vertical - 2 - - - False - False - top - spread - - - False - False - 0 - - - - - - - - - + + 800 + 600 False - ubl-settings-video 800 - 558 + 600 com.ublinux.ubl-settings-video - + True False - 5 - 5 - 5 - 5 + True vertical - - - True - True - external - in - - - True - False - - - True - False - vertical - - - - - - - - - - - True - True - 0 - - True False + vertical - - - - + True False - 5 - 5 - True - - Cancel + True - True - True + False + 5 + 5 + 5 + 5 + 6 + 6 + 25 False @@ -219,14 +178,23 @@ - - OK + True - True - True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + - False + True True 1 @@ -235,71 +203,32 @@ False True - end - 1 + 0 - - - False - True - 1 - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-video - - - False - True - 0 - - - - - True - False - - - True - False True False vertical - - 255 + + 81 True False - Video output configuration - - - - - - + + + True + False + start + + + -1 + + - True + False True 0 @@ -308,253 +237,7 @@ False True - 0 - - - - - True - True - 0 - - - - - True - False - - - False - True - 1 - - - - - True - True - 1 - - - - - True - False - document-edit-symbolic - - - True - False - dialog-information-symbolic - - - True - False - user-trash-symbolic - - - True - False - document-edit-symbolic - - - True - False - open-menu-symbolic - - - - True - False - center - 3 - 3 - 20 - vertical - - - True - False - Monitor - True - - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 1920x1200:60Hz - - - - - - - False - True - 1 - - - - - True - False - True - end - image3 - - - - False - True - 2 - - - - - True - False - process-stop-symbolic - - - True - False - emblem-ok-symbolic - - - True - False - process-stop-symbolic - - - True - False - system-run-symbolic - - - 800 - 600 - False - 800 - 600 - com.ublinux.ubl-settings-video - - - True - False - True - vertical - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 25 - - - False - True - 0 - - - - - True - False - start - 5 - 5 - 5 - 5 - 6 - 6 - - - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - - - 81 - True - False - - - True - False - start - - - -1 - - - - - False - True - 0 - - - - - False - True - 1 + 1 @@ -572,67 +255,383 @@ True False - + True - False - 5 - 5 - 5 - 5 - 5 - vertical + True + 5 - + True False - 0.019999999552965164 - in + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + Automatically choose and use driver + True + True + False + start + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + vertical + 5 + + + True + False + start + Proprietary driver: + 0 + + + False + True + 0 + + + + + True + False + start + Failsafe driver nVidia: + 0 + + + False + True + 1 + + + + + True + False + start + Failsafe driver AMD/ATI: + 0 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + 0 + + + True + True + 0 + + + + + True + True + True + image8 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Driver + + + + + False + True + 0 + + - + True False - 5 - 5 - 12 - 5 + vertical - + True False - vertical + 0.019999999552965164 + in - - Automatically choose and use driver + True - True - False - start - True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 10 + + + + + + False + True + 0 + + + + + + + True + False + Monitor configuration + + + + + True + True + 0 + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + + + discrete video only (AMD/ATI) + True + True + False + 5 + 5 + True + + + False + True + 1 + + - - False - True - 0 - + + + + + True + False + 0 + Hybrid graphics + + + + + False + True + 2 + + + + + True + False + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 True False - 5 + vertical - + True False - vertical 5 - + True False - start - Proprietary driver: - 0 + vertical + 5 + + + Launch programms through optirun (nVidia): + True + True + False + True + + + False + True + 0 + + + + + Launch programs through primusun (nVidia): + True + True + False + True + + + False + True + 1 + + False @@ -641,69 +640,71 @@ - + True False - start - Failsafe driver nVidia: - 0 + vertical + 5 + + + True + False + True + steam + + + True + True + 0 + + + + + True + False + True + steam + + + True + True + 1 + + - False + True True 1 - - - True - False - start - Failsafe driver AMD/ATI: - 0 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - 5 True False + vertical 5 - + True - False - 0 + False + True + True + image1 - True + False True 0 - + True + False True True - image8 + image2 False @@ -715,359 +716,425 @@ False True - 0 + 2 + + + False + True + 0 + + + + + True + False + 5 + 5 - + True False + Fix frame gap (nVidia): + 0 False True - 1 + 0 - + True False - False + True True - 2 + 1 - True + False True 1 - - False - True - 1 - + + + True + False + Extra + + + + False + True + 3 + - - - True - False - Driver - - + + + + + True + False + Main Settings - False - True - 0 + False - + True - False - vertical + True + 5 + 5 + 5 + 5 - + True False - 0.019999999552965164 - in + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + 5 + liststore6 + 0 + True + 2 + + + + + + Package + + + + + Driver + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Supported Devices + + + + + True + True + 0 + + True False - vertical + center + 5 - + + Установить True - False - 5 - 5 - 5 - 5 - 5 - 5 - 10 - - - + True + True + image9 False True + end 0 + + + Удалить + True + True + True + image11 + + + False + True + end + 1 + + + + + Подробнее + True + True + True + image10 + + + False + True + end + 2 + + + + False + True + 1 + - - - True - False - Monitor configuration - - + + + + + True + False + Driver Modules - True - True - 0 + False - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - in - + True False - 5 - 5 - 12 - 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + 5 + liststore6 + 0 + True + 2 + + + + + + Package + + + + + Driver + + + + 0 + + + + + + + Description + + + + 1 + + + + + + + Supported Devices + + + + + True + True + 0 + + True False + center + 5 + + + Установить + True + True + True + image6 + + + False + True + end + 0 + + - - discrete video only (AMD/ATI) + + Удалить True True - False - 5 - 5 - True + True + image7 False True + end 1 + + + Подробнее + True + True + True + image12 + + + False + True + end + 2 + + + + False + True + 1 + + + 1 + - - + + True False - 0 - Hybrid graphics + Drivers + + 1 + False + + + + + + + - False - True - 2 + 1 + + + + + True + False + Drivers + + + 1 + False True False + 5 + 5 + 5 5 - 0.019999999552965164 - in + 0 + none True False - 5 - 5 12 - 5 True False - vertical - - - True - False - 5 - - - True - False - vertical - 5 - - - Launch programms through optirun (nVidia): - True - True - False - True - - - False - True - 0 - - - - - Launch programs through primusun (nVidia): - True - True - False - True - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - True - steam - - - True - True - 0 - - - - - True - False - True - steam - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - vertical - 5 - - - True - False - True - True - image1 - - - False - True - 0 - - - - - True - False - True - True - image2 - - - False - True - 1 - - - - - False - True - 2 - - - - - False - True - 0 - - - + True - False - 5 - 5 - - - True - False - Fix frame gap (nVidia): - 0 - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - + False + start + 75 + appointment-new-symbolic + + + False + True + 0 + + + + + True + False + start + start + 10 + 5 + 10 + 10 + label False @@ -1080,17 +1147,27 @@ - + True False - Extra + 5 + Devices and Drivers - False - True - 3 + 2 + + + + + True + False + Information + + + 2 + False @@ -1289,170 +1366,113 @@ - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True + + False - go-bottom-symbolic + О Программе + False + True + center + com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + 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-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + - - 450 - 300 + + True False - com.ublinux.ubl-settings-video - + + 90 True False + 5 + 5 5 5 - 5 - 5 - vertical - 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + + True + False True False - 5 - - - True - True - liststore6 - 0 - True - 2 - - - - - - Package - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Supported Devices - - - - - True - True - 0 - - True False - center vertical - 5 - + + 255 True - True - True - image9 + False + Video output configuration + + + + + + - False + True True 0 - - - True - True - True - image11 - - - False - True - 1 - - - - - True - True - True - image10 - - - False - True - 2 - - False True - 1 + 0 @@ -1463,163 +1483,195 @@ - + True False - 5 - - - - - - True - False - 5 - True - - - Close - True - True - True - image6 - - - False - True - 0 - - - - - False - True - end - 1 - - False True - 2 + 1 + + True + True + 1 + - - - - - - - - - - - - - + + True + False + document-edit-symbolic + + + True + False + dialog-information-symbolic + + + True + False + user-trash-symbolic - + True - True + False + dialog-information-symbolic + + + True + False + system-shutdown-symbolic + + + True + False + user-trash-symbolic + + + True + False + start + 3 + 3 + 10 + 20 + vertical + + + True + False + Monitor + True + + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 1920x1200:60Hz + + + + + + + False + True + 1 + + True False - vertical + 15 - + True True - 15 - 15 - 6 - multiple - horizontal - liststore5 - 1 - True - - - - 0 - - - - - 0 - True - word - - - 1 - - + True + image14 + - True + False True 0 - - - - - True - False - 5 - + True - False - 25 - applications-system + True + True + image13 + False True - 0 + 1 - + True - False - Settings + True + True + end + image3 + False True - 1 + end + 2 + + False + True + 2 + + + + True + False + document-edit-symbolic + + + True + False + open-menu-symbolic - - - - - - - - - + + True + False + process-stop-symbolic - - radiobutton + True - True - False - True - True + False + emblem-ok-symbolic False @@ -1643,8 +1695,6 @@ True False - 5 - 5 vertical 5 @@ -1653,11 +1703,85 @@ False 5 - + + Enabled + True + True + False + True + + + False + True + 0 + + + + + False + True + 0 + + + + + True + False + 5 + + True False - start - Monitor: + Port + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + Main display + True + True + False + True + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Resolution (px): False @@ -1666,39 +1790,70 @@ - + + True + False + + + True + True + 1 + + + + + Show unsupported + True + True + False + True + + + False + True + 2 + + + + + False + True + 2 + + + + + True + False + 5 + + True False - 0 + Frequency (Hz): False True - 1 + 0 - - Main monitor + True - True - False - 15 - 15 - True - radioMainMonitor + False - False + True True - 2 + 1 False True - 0 + 3 @@ -1707,11 +1862,10 @@ False 5 - + True False - Resolution (px): - 0 + Rotation: False @@ -1720,11 +1874,9 @@ - + True False - center - 0 True @@ -1732,97 +1884,126 @@ 1 + + + False + True + 4 + + + + + True + False + 5 + + + True + False + Position: + + + False + True + 0 + + - + True False 5 + True - + True False - Frequency (Hz) - False + True True 0 - + True False - center - False + True True 1 - False + True True - 2 + 1 False True - 1 + 5 - + + Do not switch off display True - False - 5 - - - True - False - Rotation - 0 - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - - - - - - False - True - 2 - - + True + False + True False True - 2 + 6 + + + + + Create modeline for current resolution with CVT + True + True + False + True + + + False + True + 7 + + + + + Use "CVT Reduced Blanking"gshgrbehr + True + True + False + True + + + False + True + 8 + + + + + Create modeline for current resolution with GTF + True + True + False + True + + + False + True + 9 @@ -1833,7 +2014,7 @@ False True - 5 + 10 @@ -1849,10 +2030,11 @@ False 5 5 + vertical 5 - through parameter line: + Configure manually through parameter line: True True False @@ -1870,6 +2052,7 @@ False True center + 1920x1080 True @@ -1951,24 +2134,146 @@ - - - - - + + True + False + go-bottom-symbolic - - - - - + + True + False + user-trash-symbolic + + + True + False + system-run-symbolic + + + True + False + go-bottom-symbolic + + + + + + + + + + + + + + + + + True + True + + + True + False + vertical + + + True + True + 15 + 15 + 6 + multiple + horizontal + liststore5 + 1 + True + + + + 0 + + + + + 0 + True + word + + + 1 + + + + + True + True + 0 + + + + + + + True + False + 5 + + + True + False + 25 + applications-system + + + False + True + 0 + + + + + True + False + Settings + + + False + True + 1 + + + + + + + + + + + + + + + + + + radiobutton + True + True + False + True + True True False - + True + False False 128 com.ublinux.ubl-settings-video.display -- 2.35.1 From 8382fb0914e0db11047b7278020df23403e6025e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 26 Apr 2023 18:15:53 +0000 Subject: [PATCH 11/16] design changes --- README.md | 2 +- Resolutions.csv => resolutions.csv | 0 source/ubl-settings-video-strings.h | 43 + source/ubl-settings-video.c | 1131 +++++--- source/ubl-settings-video.h | 104 +- source/ubl-utils.c | 97 +- source/ubl-utils.h | 15 +- ubl-settings-video.desktop | 2 +- ubl-settings-video.glade | 3681 ++++++++++++++------------- 9 files changed, 2800 insertions(+), 2275 deletions(-) rename Resolutions.csv => resolutions.csv (100%) create mode 100644 source/ubl-settings-video-strings.h diff --git a/README.md b/README.md index f2222e2..457d749 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ubl-settings-video -# Видеокарта/Экран +# Настройки видеоадаптера и дисплея # Build In order to build ubl-settings-video you will need: diff --git a/Resolutions.csv b/resolutions.csv similarity index 100% rename from Resolutions.csv rename to resolutions.csv diff --git a/source/ubl-settings-video-strings.h b/source/ubl-settings-video-strings.h new file mode 100644 index 0000000..f15d6ef --- /dev/null +++ b/source/ubl-settings-video-strings.h @@ -0,0 +1,43 @@ +#define PARAMETER_DEFAULT_LABEL _("Default settings") +#define MONITOR_LABEL _("Monitor ") +#define SETTINGS_VIDEO_TITLE_LABEL _("Video adapter and display settings") +#define MONITOR_PORT_LABEL _("Port: ") +#define MONITOR_RESOLUTION_LABEL _("Resolution (px): ") +#define MONITOR_FREQUENCY_LABEL _("Frequency (Hz): ") +#define MONITOR_ROTATION_LABEL _("Rotation: ") +#define MONITOR_POSITION_LABEL _("Position: ") +#define MONITOR_SWITCH_OFF_LABEL _("Do not switch off display") +#define MONITOR_CVT_LABEL _("Create modeline for current resolution with CVT") +#define MONITOR_REDUCED_LABEL _("Use \"CVT Reduced Blanking\"") +#define MONITOR_GTF_LABEL _("Create modeline for current resolution with GTF") +#define MONITOR_MANUALLY_LABEL _("Configure manually through parameter line: ") +#define MONITOR_MAIN_DISPLAY_LABEL _("Main display") +#define MONITOR_UNSUPPORTED_LABEL _("Show unsupported") +#define MONITOR_ENABLED_LABEL _("Enabled") +#define MONITOR_LEFT_LABEL _("Left") +#define MONITOR_RIGHT_LABEL _("Right") +#define MONITOR_INVERTED_LABEL _("Inverted") +#define MONITOR_LEFT_POS_LABEL _("Left of") +#define MONITOR_RIGHT_POS_LABEL _("Right of") +#define MONITOR_ABOVE_POS_LABEL _("Above") +#define MONITOR_BELOW_POS_LABEL _("Below ") +#define MONITOR_NO_ROTATION_LABEL _("No rotation") +#define MONITOR_SAVE_LABEL _("Save") +#define MONITOR_CANCEL_LABEL _("Cancel") +#define MONITOR_CHOOSE_PORT_LABEL _("Choose port to configure") + + +#define MONITOR_POSITION_LEFT_PARAMETER _("lo:") +#define MONITOR_POSITION_RIGHT_PARAMETER _("ro:") +#define MONITOR_POSITION_ABOVE_PARAMETER _("ab:") +#define MONITOR_POSITION_BELOW_PARAMETER _("be:") + + +#define MONITOR_ROTATE_PARAMETER _("rotate:") +#define MONITOR_ROTATE_NORMAL_PARAMETER _("normal") +#define MONITOR_ROTATE_LEFT_PARAMETER _("left") +#define MONITOR_ROTATE_RIGHT_PARAMETER _("right") +#define MONITOR_ROTATE_INVERTED_PARAMETER _("invert") + +#define MONITOR_PORT_ERROR_LABEL _("Error: Port must be chosen to save") +#define MONITOR_PORT_SUCCESS_LABEL _("Monitor configuration succeedeed") \ No newline at end of file diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 5de3e3e..406d051 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -10,70 +10,130 @@ void yon_on_plug_removed(GtkSocket *self, gpointer user_data) { } -void on_close_subwindow(GtkWidget *self) +void on_subwindow_close(GtkWidget *self) { gtk_widget_destroy(gtk_widget_get_toplevel(self)); } -void on_save_window_configuration(GtkWidget *self, MonitorSettings *monitor){ - char *freq=NULL; - char *res=NULL; - char *rot=NULL; - char *entr=NULL; - char *def=NULL; - def=_("Default settings"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationMainRadio))==1) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main=1; - if (strcmp((freq=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationFrequencyCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=freq; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=NULL; - if (strcmp((res=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationResolutionCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=res; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=NULL; - if (strcmp((rot=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationRotationCombo)))),def)!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=rot; - else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=NULL; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationParameterLineCheck))){ - entr=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(monitor->templateMonitorConfigurationParameterLineEntry))); - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=entr; +void on_monitor_config_save(GtkWidget *self, monitor_edit_window *window){ + monitorconfig *config = yon_dictionary_get_data(window->config,monitorconfig*); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPortCombo))==0){ + _yon_ubl_status_box_render(videoconfig.status_render.box,videoconfig.status_render.icon,videoconfig.status_render.label,MONITOR_PORT_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + config->main=0; + config->enable=0; + config->position=0; + config->rotation=0; + config->dpms=0; + config->cvt=0; + config->reduced=0; + config->position_port=NULL; + config->port=NULL; + config->resolution=NULL; + config->frequency=NULL; + _yon_ubl_status_box_render(videoconfig.status_render.box,videoconfig.status_render.icon,videoconfig.status_render.label,MONITOR_PORT_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + config->port = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPortCombo)); + window->config->key = yon_char_new(config->port); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationParameterLineCheck))==0){ + config->main = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationMainCheck)); + config->enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationEnableCheck)); + config->dpms = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck)); + config->cvt = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck)); + config->reduced = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationUseCVTReducedCheck)); + config->gtf = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineGTFCheck)); + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo))!=0 + &>k_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPortCombo))!=0){ + config->position = gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo)); + config->position_port = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPositionPortCombo)); + + } + int rotation = gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationRotationCombo)); + if (rotation==1) config->rotation=rotation; + else if (rotation==2) config->rotation=rotation; + else if (rotation==3) config->rotation=rotation; + else config->rotation=0; + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo))!=0) { + char *resolution = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo)); + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo))!=0) { + char *frequency = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationFrequencyCombo)); + } + yon_monitor_make_string(config); } else { - char *str=NULL; - str = ""; - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency!=NULL) - str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency,",")); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution!=NULL) - str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution,",")); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation!=NULL) - if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Right"))==0) - str=yon_char_get_augumented(str,"rotation:right,"); - else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Left"))==0) - str=yon_char_get_augumented(str,"rotation:left,"); - else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Invert"))==0) - str=yon_char_get_augumented(str,"rotation:invert,"); - else - str=yon_char_get_augumented(str,"rotation:normal,"); + char *stringparameters = (char*)gtk_entry_get_text(GTK_ENTRY(window->templateMonitorConfigurationParameterLineEntry)); + } + yon_monitor_view_update(); + on_subwindow_close(self); +} + +// void on_save_window_configuration(GtkWidget *self, MonitorSettings *monitor){ +// char *port=NULL; +// port=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationPortCombo)); +// if (!monitor->curconfig){ +// monitorconfig *confi = new(monitorconfig); +// if (!videoconfig.monitors) videoconfig.monitors=yon_dictionary_create_with_data(port,confi); +// else videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,port,confi); +// monitor->curconfig=videoconfig.monitors; +// } +// char *freq=NULL; +// char *res=NULL; +// char *rot=NULL; +// char *entr=NULL; +// char *def=NULL; +// def=_("Default settings"); +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationMainRadio))==1) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main=1; +// if (strcmp((freq=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationFrequencyCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=freq; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency=NULL; +// if (strcmp((res=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationResolutionCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=res; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution=NULL; +// if (strcmp((rot=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(monitor->templateMonitorConfigurationRotationCombo)))),def)!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=rot; +// else yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation=NULL; +// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor->templateMonitorConfigurationParameterLineCheck))){ +// entr=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(monitor->templateMonitorConfigurationParameterLineEntry))); +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=entr; +// } else { +// char *str=NULL; +// str = ""; +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency!=NULL) +// str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->frequency,",")); +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution!=NULL) +// str=yon_char_get_augumented(str,yon_char_get_augumented(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution,",")); +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation!=NULL) +// if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Right"))==0) +// str=yon_char_get_augumented(str,"rotation:right,"); +// else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Left"))==0) +// str=yon_char_get_augumented(str,"rotation:left,"); +// else if (strcmp(yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->rotation,_("Invert"))==0) +// str=yon_char_get_augumented(str,"rotation:invert,"); +// else +// str=yon_char_get_augumented(str,"rotation:normal,"); - if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main!=0) - str=yon_char_get_augumented(str,"primary,"); - if (strcmp(str,"")!=0) - yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=str; +// if (yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->main!=0) +// str=yon_char_get_augumented(str,"primary,"); +// if (strcmp(str,"")!=0) +// yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters=str; - } - dictionary *dict=NULL; - for_dictionaries (dict,videoconfig.videoconfig){ - MonitorSettings *monitorsett=yon_dictionary_get_data(dict,MonitorSettings*); - if (monitorsett->curconfig==monitor->curconfig){ - yon_parse_monitor(monitorsett->curconfig,yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters); - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoResolutionLabel),yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution); - if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitorsett->curconfig->data)->port)); - if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitorsett->curconfig->data)->port,"*"))); +// } +// dictionary *dict=NULL; +// // for_dictionaries (dict,videoconfig.videoconfig){ +// // MonitorSettings *monitorsett=yon_dictionary_get_data(dict,MonitorSettings*); +// // if (monitorsett->curconfig==monitor->curconfig){ +// // yon_parse_monitor(monitorsett->curconfig,yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->stringparameters); +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoResolutionLabel),yon_dictionary_get_data(monitor->curconfig,monitorconfig*)->resolution); +// // if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==0) +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitorsett->curconfig->data)->port)); +// // if (yon_dictionary_get_data(monitorsett->curconfig,monitorconfig*)->main==1) +// // gtk_label_set_text(GTK_LABEL(monitorsett->templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitorsett->curconfig->data)->port,"*"))); - } - } - on_close_subwindow(self); -}; +// // } +// // } +// on_subwindow_close(self); +// }; void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ GtkTreeIter iter; @@ -86,7 +146,7 @@ void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ if (ret!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->combo),ret); - on_close_subwindow(self); + on_subwindow_close(self); } void on_sensitive_change(GtkWidget *self, GtkWidget *toggle) @@ -108,18 +168,15 @@ void on_auto_choose_drivers(GtkWidget *self, widgets_dict *widgets) int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaLabel, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverCombo, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverButton, !state); - gtk_widget_set_sensitive(widgets->mainDriverProprietaryDriverLabel, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDCombo, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeAMDLabel, !state); gtk_widget_set_sensitive(widgets->mainDriverFailsafeNvidiaCombo, !state); } -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors) -{ - gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); -} +// void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors) +// { +// gtk_widget_destroy(monitors->templateMonitorConfigurationWindow); +// } char *yon_configuration_get_save_command(char *command){ char *str = NULL; @@ -141,7 +198,7 @@ char *yon_configuration_get_save_command(char *command){ for_dictionaries(dict,videoconfig.monitors){ if (yon_dictionary_get_data(dict,monitorconfig*)->stringparameters){ - str=yon_char_get_augumented(str, yon_config_make_save_parameter_with_multiple_arguments(yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[",dict->key),"]"),",")); + str=yon_char_get_augumented(str, yon_config_make_save_parameter_with_multiple_arguments(yon_dictionary_get_data(dict,monitorconfig*)->stringparameters,XORG_MONITOR(dict->key),",")); } } @@ -214,11 +271,10 @@ void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets) void yon_update_config(widgets_dict *widgets) { - videoconfig.optirun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry))); - videoconfig.primusrun = yon_char_get_augumented("", (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry))); - // videoconfig.proprietary = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo))); - videoconfig.failsafenVidia = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo))); - videoconfig.failsafeATI = yon_char_get_augumented("", gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo))); + videoconfig.optirun = yon_char_new( (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry))); + videoconfig.primusrun = yon_char_new( (char *)gtk_entry_get_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry))); + videoconfig.failsafenVidia = yon_char_new( gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo))); + videoconfig.failsafeATI = yon_char_new( gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo))); } void on_configuration_load_local(GtkWidget *self, widgets_dict *widgets) @@ -233,7 +289,7 @@ void on_configuration_load_local(GtkWidget *self, widgets_dict *widgets) int size = 0; char **rtn = yon_ubl_load_global_config(command, &size); char *param = NULL; - yon_config_init(rtn, size); + // yon_config_init(rtn, size); on_config_fill_interface(widgets); } @@ -249,53 +305,146 @@ void on_configuration_load_global(GtkWidget *self, widgets_dict *widgets) int size = 0; char **rtn = yon_ubl_load_global_config(command, &size); char *param = NULL; - yon_config_init(rtn, size); + // yon_config_init(rtn, size); on_config_fill_interface(widgets); } -int yon_config_init(char **parameters, int size) -{ - char *param = NULL; - dictionary *dct = NULL; - videoconfig.failsafenVidia = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); - videoconfig.failsafeATI = yon_config_get_parameter(parameters, size, "FAILSAFEATI"); - // videoconfig.proprietary = yon_config_get_parameter(parameters, size, "FAILSAFENVIDIA"); - videoconfig.optirun = yon_config_get_parameter(parameters, size, "OPTIRUN"); - videoconfig.primusrun = yon_config_get_parameter(parameters, size, "PRIMUSRUN"); - for_dictionaries(dct, videoconfig.monitors) - { - char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); - param = yon_config_get_parameter(parameters, size, prm); - if (param) - { - yon_parse_monitor(dct, param); - } - else{ - yon_dictionary_get_data(dct,monitorconfig*)->frequency=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->resolution=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->main=0; - yon_dictionary_get_data(dct,monitorconfig*)->rotation=NULL; - yon_dictionary_get_data(dct,monitorconfig*)->stringparameters=NULL; +/**void on_monitor_delete(GtkWidget *self,monitor_view windowd) + * [EN] +*/ +void on_monitor_delete(GtkWidget *self,monitor_view windowd){ + monitor_window *window = yon_dictionary_get_data(windowd,monitor_window*); + if(window&&window->config){ + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(window->templateMonitorscreenOverlay)),window->templateMonitorscreenOverlay); + yon_dictionary_rip(windowd); + gtk_widget_destroy(window->templateMonitorscreenOverlay); + yon_dictionary_rip(window->config); + free(window); + } +} + +/**void on_monitor_switch(GtkWidget *self,monitor_window *window) + * [EN] +*/ +void on_monitor_switch(GtkWidget *self,monitor_window *window){ + if(window&&window->config){ + int *enable = &yon_dictionary_get_data(window->config,monitorconfig*)->enable; + *enable=!*enable; + gtk_widget_set_sensitive(window->templateMonitorImage,*enable); + } +} + +/**void on_monitor_add(GtkWidget *self,monitor_window *window) + * [EN] +*/ +void on_monitor_add(GtkWidget *self,monitor_window *window){ + if(window){ + videoconfig.monitors = yon_monitor_config_new(PARAMETER_DEFAULT_LABEL); + yon_monitor_view_new(videoconfig.monitors); + yon_monitor_view_draw_all(NULL); + } +} + +void on_monitor_configure(GtkWidget *self,monitor_window *window){ + if(window&&window->config){ + monitor_edit_window *monitors = new(monitor_edit_window); + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitors->templateMonitorConfigurationWindow = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationWindow")); + monitors->mainMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "mainMonitorConfigurationBox")); + monitors->templateMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationBox")); + monitors->templateMonitorConfigurationEnableCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationEnableCheck")); + monitors->templateMonitorConfigurationPortLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortLabel")); + monitors->templateMonitorConfigurationPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortCombo")); + monitors->templateMonitorConfigurationMainCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainCheck")); + monitors->templateMonitorConfigurationResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionLabel")); + monitors->templateMonitorConfigurationResolutionCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionCombo")); + monitors->templateMonitorConfigurationShowUnsupportedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationShowUnsupportedCheck")); + monitors->templateMonitorConfigurationFrequencyLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyLabel")); + monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); + monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); + // monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); + monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); + monitors->templateMonitorConfigurationPositionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionLabel")); + monitors->templateMonitorConfigurationPositionPosCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPosCombo")); + monitors->templateMonitorConfigurationPositionPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPortCombo")); + + monitors->templateMonitorConfigurationModelineCVTCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineCVTCheck")); + monitors->templateMonitorConfigurationUseCVTReducedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationUseCVTReducedCheck")); + monitors->templateMonitorConfigurationModelineGTFCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineGTFCheck")); + monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); + monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); + monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); + monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); + monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); + monitors->config=window->config; + + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_subwindow_close), NULL); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_monitor_config_save), monitors); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationEnableCheck),yon_dictionary_get_data(monitors->config,monitorconfig*)->enable==1); + + + + gtk_window_set_title(GTK_WINDOW(monitors->templateMonitorConfigurationWindow),SETTINGS_VIDEO_TITLE_LABEL); + + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel),MONITOR_PORT_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel),MONITOR_RESOLUTION_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel),MONITOR_FREQUENCY_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel),MONITOR_ROTATION_LABEL); + gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPositionLabel),MONITOR_POSITION_LABEL); + + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationEnableCheck),MONITOR_ENABLED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainCheck),MONITOR_MAIN_DISPLAY_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationShowUnsupportedCheck),MONITOR_UNSUPPORTED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationDoNotSwitchOffCheck),MONITOR_SWITCH_OFF_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineCVTCheck),MONITOR_CVT_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationUseCVTReducedCheck),MONITOR_REDUCED_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineGTFCheck),MONITOR_GTF_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck),MONITOR_MANUALLY_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton),MONITOR_CANCEL_LABEL); + gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationSaveButton),MONITOR_SAVE_LABEL); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPortCombo),MONITOR_CHOOSE_PORT_LABEL); + dictionary *dict=NULL; + for (int i=0;istringparameters) + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPortCombo),videoconfig.ports[i]); + } - yon_monitor_set_resolutions(dct); - } - if (videoconfig.videoconfig) - for_dictionaries(dct, videoconfig.videoconfig){ - MonitorSettings *settings=yon_dictionary_get_data(dct,MonitorSettings*); - if (((monitorconfig*)settings->curconfig->data)->port){ - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",((monitorconfig*)settings->curconfig->data)->port)); - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoNameLabel),yon_char_get_augumented("Monitor ",yon_char_get_augumented(((monitorconfig*)settings->curconfig->data)->port,"*"))); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPortCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_NO_ROTATION_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_LEFT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_RIGHT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo),MONITOR_INVERTED_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_LEFT_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_RIGHT_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_ABOVE_POS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPosCombo),MONITOR_BELOW_POS_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPositionPosCombo),0); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationPositionPortCombo),PARAMETER_DEFAULT_LABEL); + for (int i=0;itemplateMonitorConfigurationPositionPortCombo),videoconfig.ports[i]); } - if (((monitorconfig*)settings->curconfig->data)->resolution) - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),((monitorconfig*)settings->curconfig->data)->resolution); - else - gtk_label_set_text(GTK_LABEL(settings->templateMonitorInfoResolutionLabel),_("Default settings")); - + gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationPositionPortCombo),0); + + yon_monitor_window_update(monitors); + + gtk_widget_show(monitors->templateMonitorConfigurationWindow); } } +/**void on_about() + * [EN] +*/ void on_about() { GtkBuilder *builder = gtk_builder_new_from_file(glade_path); @@ -309,34 +458,247 @@ void on_about() gtk_widget_show(window); } -void yon_parse_monitor(dictionary *monitor, char *string_of_settings) -{ - int size=0; - yon_dictionary_get_data(monitor,monitorconfig*)->stringparameters=string_of_settings; - char *param_string=yon_char_new(string_of_settings); - yon_char_divide_search(param_string,"=",1); - char **rtn = yon_char_parse(param_string,&size,","); - int check_code=-1; - if ((check_code=yon_char_parsed_check_exist(rtn,size,"primary"))!=-1){ - yon_dictionary_get_data(monitor,monitorconfig*)->main=1; - rtn=yon_char_parsed_shrink(rtn,&size,check_code); +void yon_monitor_window_update(monitor_edit_window *window){ + if (window){ + int found = yon_gtk_combo_box_text_find(window->templateMonitorConfigurationPortCombo, window->config->key); + if (found==-1) + found=0; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPortCombo),found); + + found = yon_gtk_combo_box_text_find(window->templateMonitorConfigurationPositionPortCombo, yon_dictionary_get_data(window->config,monitorconfig*)->position_port); + if (found==-1) + found=0; + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPortCombo),found); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPositionPosCombo),yon_dictionary_get_data(window->config,monitorconfig*)->position); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationRotationCombo),yon_dictionary_get_data(window->config,monitorconfig*)->rotation); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationDoNotSwitchOffCheck),yon_dictionary_get_data(window->config,monitorconfig*)->dpms); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationMainCheck),yon_dictionary_get_data(window->config,monitorconfig*)->main); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineCVTCheck),yon_dictionary_get_data(window->config,monitorconfig*)->cvt); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationUseCVTReducedCheck),yon_dictionary_get_data(window->config,monitorconfig*)->reduced); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationModelineGTFCheck),yon_dictionary_get_data(window->config,monitorconfig*)->gtf); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->templateMonitorConfigurationEnableCheck),yon_dictionary_get_data(window->config,monitorconfig*)->enable); + if(yon_dictionary_get_data(window->config,monitorconfig*)->stringparameters) + gtk_entry_set_text(GTK_ENTRY(window->templateMonitorConfigurationParameterLineEntry),yon_dictionary_get_data(window->config,monitorconfig*)->stringparameters); } - else - yon_dictionary_get_data(monitor,monitorconfig*)->main=0; - if ((check_code=yon_char_parsed_check_exist(rtn,size,"rotation"))!=-1){ - yon_dictionary_get_data(monitor,monitorconfig*)->rotation=rtn[check_code]; - rtn=yon_char_parsed_shrink(rtn,&size,check_code); +} + +/**void yon_monitor_view_draw_all(GtkWidget *cnt) + * [EN] +*/ +void yon_monitor_view_draw_all(GtkWidget *cnt){ + monitor_view dict=NULL; + GtkWidget *container=NULL; + if(!container&&cnt) container=cnt; + if(videoconfig.monitor_visuals){ + for_dictionaries(dict,videoconfig.monitor_visuals){ + monitor_window *window = yon_dictionary_get_data(dict,monitor_window*); + if (!container) container = gtk_widget_get_parent(window->templateMonitorscreenOverlay); + if(container){ + g_object_ref(G_OBJECT(window->templateMonitorscreenOverlay)); + gtk_container_remove(GTK_CONTAINER(container),window->templateMonitorscreenOverlay); + } + } + if (container) + for_dictionaries(dict,videoconfig.monitor_visuals){ + monitor_window *window = yon_dictionary_get_data(dict,monitor_window*); + if(dict->first==dict) {} + else gtk_box_pack_start(GTK_BOX(container),window->templateMonitorscreenOverlay,0,0,0); + } + monitor_window *window = yon_dictionary_get_data(videoconfig.monitor_visuals->first,monitor_window*); + gtk_box_pack_start(GTK_BOX(container),window->templateMonitorscreenOverlay,0,0,0); + } + yon_monitor_view_update(); +} + +/**void yon_monitor_view_setup(GtkWidget *container) + * [EN] +*/ +void yon_monitor_view_setup(GtkWidget *container){ + if(container){ + monitor_config config=NULL; + yon_monitor_view_new(NULL); + if (videoconfig.monitors){ + for_dictionaries(config,videoconfig.monitors){ + if (yon_dictionary_get_data(config,monitorconfig*)->stringparameters) + yon_monitor_view_new(config); + } + } + yon_monitor_view_draw_all(container); + } +} + +/**void yon_monitor_view_update() + * [EN] +*/ +void yon_monitor_view_update(){ + monitor_view dict=NULL; + for_dictionaries(dict,videoconfig.monitor_visuals){ + if(dict!=videoconfig.monitor_visuals->first){ + monitor_window *monitor = yon_dictionary_get_data(dict,monitor_window*); + monitorconfig *config = yon_dictionary_get_data(monitor->config,monitorconfig*); + if (strcmp(monitor->config->key,PARAMETER_DEFAULT_LABEL)!=0) + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoNameLabel),yon_char_get_augumented(MONITOR_LABEL,monitor->config->key)); + else + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoNameLabel),yon_char_get_augumented(MONITOR_LABEL,"")); + if (config->resolution) + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoResolutionLabel),config->resolution); + else + gtk_label_set_text(GTK_LABEL(monitor->templateMonitorInfoResolutionLabel),PARAMETER_DEFAULT_LABEL); + } } +} + +/**char *yon_monitor_make_string(monitorconfig* config) + * [EN] +*/ +char *yon_monitor_make_string(monitorconfig* config) +{ + int first=1; + char *main=""; + if (config->main==1){ + main="primary"; + first=0; + } + + char *enable=""; + if (config->enable==1) + if (first==1){ + enable="enable"; + first=0; + }else{ + enable=",enable"; + } else - yon_dictionary_get_data(monitor,monitorconfig*)->rotation=0; + if (first==1){ + enable="disable"; + first=0; + }else{ + enable=",disable"; + } + + char *position=""; + if (config->position==1) + if (first==1){ + position=yon_char_get_augumented("lo:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",lo:",config->position_port); + } + else if (config->position==2) + if (first==1){ + position=yon_char_get_augumented("ro:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",ro:",config->position_port); + } + else if (config->position==3) + if (first==1){ + position=yon_char_get_augumented("ab:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",ab:",config->position_port); + } + else if (config->position==4) + if (first==1){ + position=yon_char_get_augumented("be:",config->position_port); + first=0; + }else{ + position=yon_char_get_augumented(",be:",config->position_port); + } + + char *rotation=""; + if (config->rotation==0) + if (first==1){ + rotation="rotate:normal"; + first=0; + }else{ + rotation=",rotate:normal"; + } + else if (config->rotation==1) + if (first==1){ + rotation="rotate:left"; + first=0; + }else{ + rotation=",rotate:left"; + } + else if (config->rotation==2) + if (first==1){ + rotation="rotate:right"; + first=0; + }else{ + rotation=",rotate:right"; + } + else if (config->rotation==3) + if (first==1){ + rotation="rotate:invert"; + first=0; + }else{ + rotation=",rotate:invert"; + } + + char *dpms=""; + if (config->dpms==1) + if (first==1){ + dpms="dpms"; + first=0; + }else{ + dpms=",dpms"; + } + + char *cvt=""; + if (config->cvt==1) + if (first==1){ + cvt="cvt"; + first=0; + }else{ + cvt=",cvt"; + } + + char *reduced=""; + if (config->reduced==1) + if (first==1){ + reduced="reduced"; + first=0; + }else{ + reduced=",reduced"; + } + + char *gtf=""; + if (config->gtf==1) + if (first==1){ + gtf="gtf"; + first=0; + }else{ + gtf=",gtf"; + } + + char *resolution=""; + if(config->resolution) + if (first==1){ + resolution=config->resolution; + first=0; + }else{ + resolution=yon_char_get_augumented(",",config->resolution); + } + + + char *frequency=""; + if (config->frequency) + if (first==1){ + frequency=config->frequency; + first=0; + }else{ + frequency=yon_char_get_augumented(",",config->frequency); + } - for(int i=0;iresolution=yon_char_new(rtn[i]); - } + char *stringparameters=yon_char_unite("",main,resolution,frequency,enable,position,rotation,dpms,cvt,reduced,gtf,NULL); + config->stringparameters=yon_char_new(stringparameters); } +/**void on_config_fill_interface(widgets_dict *widgets) + * [EN] +*/ void on_config_fill_interface(widgets_dict *widgets) { gtk_widget_grab_focus(widgets->mainHeaderSettingsButton); @@ -345,7 +707,7 @@ void on_config_fill_interface(widgets_dict *widgets) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 0); if (str) { - yon_char_divide_search((str = yon_char_new(videoconfig.optirun)), "=", 1); + yon_char_divide_search((str = yon_char_new(videoconfig.optirun)), "=", -1); gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchOptirunEntry), str); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchOptirunCheck), 1); } @@ -358,19 +720,8 @@ void on_config_fill_interface(widgets_dict *widgets) gtk_entry_set_text(GTK_ENTRY(widgets->mainExtraLaunchPrismusunEntry), str); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->mainExtraLaunchPrismusunCheck), 1); } - gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo)); - // str = videoconfig.proprietary->key; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); - int size=0; - char ** rtn = yon_config_load(get_proprietary_drivers_command,&size); - for (int driv=0;drivmainDriverProprietaryDriverCombo),drivr); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->mainDriverProprietaryDriverCombo), 0); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo)); str = videoconfig.failsafenVidia; @@ -396,103 +747,93 @@ void on_config_fill_interface(widgets_dict *widgets) dictionary *dict = NULL; } +/**dictionary *yon_proprieary_get() + * [EN] +*/ dictionary *yon_proprieary_get(){ int size=0; char **rtn = yon_config_load(get_proprietary_drivers_command,&size); for (int i=0;idata,&size,":"); gtk_list_store_append(list,&iter); - gtk_list_store_set(list,&iter,0,dict->key,1,(char*)dict->data,-1); + gtk_list_store_set(list,&iter,1,str[1],2,str[2],3,str[3],4,str[4],-1); } } -void yon_setup_config() +/**void yon_setup_config(char *configcommand) + * [EN] +*/ +void yon_setup_config(char *configcommand) { - FILE *videoports = popen(get_ports_command, "r"); - char str[1000]; - while (fgets(str, 1000, videoports)) - { - printf("%s\n", str); - char *strng = yon_char_divide_search(str, "\n", 0); - monitorconfig *monitor = NULL; - monitor = malloc(sizeof(monitorconfig)); - monitor->port = yon_char_new(strng); - monitor->frequency=NULL; - monitor->frequency=NULL; - monitor->main=0; - monitor->resolution=NULL; - monitor->rotation=NULL; - monitor->stringparameters=NULL; - monitor->resolutionCapabilities=NULL; - videoconfig.list=NULL; - if (!videoconfig.monitors) - { - videoconfig.monitors = yon_dictionary_create_with_data(strng, monitor); - } - else - { - videoconfig.monitors = yon_dictionary_create_with_data_connected(videoconfig.monitors, strng, monitor); - } - memset(str, 0, 1000); - } + videoconfig.portssize=0; + videoconfig.ports=yon_config_load(get_ports_command,&videoconfig.portssize); + int size = 0; - char *command = load_drivers_local_command; + char *command = configcommand; dictionary *dct; - for_dictionaries(dct, videoconfig.monitors) + for(int i=0; idata)->port, "]")))); + command = yon_char_get_augumented(command, XORG_MONITOR(yon_char_divide_search(yon_char_new(videoconfig.ports[i]),"\n",-1))); } - char **rtn = yon_ubl_load_global_config(command, &size); + videoconfig.configsize=0; + videoconfig.loaded_config = yon_ubl_load_global_config(command, &videoconfig.configsize); char *param = NULL; + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFENVIDIA"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.failsafenVidia=yon_char_new(param); - yon_config_init(rtn, size); - // on_config_fill_interface(widgets); - // (param=yon_config_get_parameter(rtn,size,"OPTIRUN")) - if ((param = yon_config_get_parameter(rtn, size, "FAILSAFENVIDIA"))) - videoconfig.failsafenVidia = yon_char_new(param); - else - videoconfig.failsafenVidia = NULL; - if ((param = yon_config_get_parameter(rtn, size, "FAILSAFEATI"))) - videoconfig.failsafeATI = yon_char_new(param); - else - videoconfig.failsafeATI = NULL; - if ((param = yon_config_get_parameter(rtn, size, "OPTIRUN"))) - videoconfig.optirun = yon_char_new(param); - else - videoconfig.optirun = NULL; - if ((param = yon_config_get_parameter(rtn, size, "PRIMUSRUN"))) - videoconfig.primusrun = yon_char_new(param); - else - videoconfig.primusrun = NULL; + } + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"FAILSAFEATI"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.failsafeATI=yon_char_new(param); - for_dictionaries(dct, videoconfig.monitors) - { - char *prm = yon_char_get_augumented(yon_char_get_augumented("XORG_MONITOR[", dct->key), "]"); - param = yon_config_get_parameter(rtn, size, prm); - if (param) - { - yon_parse_monitor(dct, param); - } } - yon_proprieary_get(); -} + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"OPTIRUN"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.optirun=yon_char_new(param); -void on_apps_chooser_open(GtkWidget *self, widgets_dict *widgets, int mode) -{ - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); // FILE *output=popen(""); + } + param=yon_config_get_parameter(videoconfig.loaded_config,videoconfig.configsize,"PRIMUSRUN"); + if (param){ + yon_char_divide_search(param,"=",-1); + videoconfig.primusrun=yon_char_new(param); - printf("not implemented yet\n"); + } + for (int i=0;iProprietaryAcceptButton), _("Accept")); gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->propriearyTreeView),GTK_TREE_MODEL(videoconfig.list)); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Installed")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Package")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Supported Devices")); gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDriverColumn), _("Driver")); gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->ProprietaryDescriptionColumn), _("Description")); gtk_widget_show(widgets->window); - g_signal_connect(G_OBJECT(widgets->ProprietaryCloseButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + g_signal_connect(G_OBJECT(widgets->ProprietaryCloseButton), "clicked", G_CALLBACK(on_subwindow_close), NULL); combo_tree *trcm=NULL; trcm=malloc(sizeof(combo_tree)); trcm->combo=comboe; @@ -526,143 +870,155 @@ driver_window *on_driver_window_open(GtkWidget *self, GtkWidget *comboe) g_signal_connect(G_OBJECT(widgets->ProprietaryAcceptButton), "clicked", G_CALLBACK(on_save_driver_configuration), trcm); } -void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings) -{ - int monitors_n = yon_check_for_monitors(); - MonitorSettings *monitors = NULL; - monitors = malloc(sizeof(MonitorSettings)); - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); - monitors->templateMonitorConfigurationWindow = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationWindow")); - monitors->templateMonitorConfigurationBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationBox")); - monitors->templateMonitorConfigurationMonitorLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMonitorLabel")); - monitors->templateMonitorConfigurationResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionLabel")); - monitors->templateMonitorConfigurationResolutionCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationResolutionCombo")); - monitors->templateMonitorConfigurationFrequencyLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyLabel")); - monitors->templateMonitorConfigurationFrequencyCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationFrequencyCombo")); - monitors->templateMonitorConfigurationRotationCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationCombo")); - monitors->templateMonitorConfigurationRotationLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationRotationLabel")); - monitors->templateMonitorConfigurationMainRadio = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationMainCheck")); - monitors->templateMonitorConfigurationParameterLineCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineCheck")); - monitors->templateMonitorConfigurationParameterLineEntry = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationParameterLineEntry")); - // monitors->templateMonitorConfigurationDoNotSwitchOffLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffLabel")); - monitors->templateMonitorConfigurationDoNotSwitchOffCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationDoNotSwitchOffCheck")); - monitors->templateMonitorConfigurationCancelButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationCancelButton")); - monitors->templateMonitorConfigurationSaveButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationSaveButton")); - - monitors->templateMonitorConfigurationEnableCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationEnableCheck")); - monitors->templateMonitorConfigurationPortLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortLabel")); - monitors->templateMonitorConfigurationPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPortCombo")); - monitors->templateMonitorConfigurationShowUnsupportedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationShowUnsupportedCheck")); - monitors->templateMonitorConfigurationPositionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionLabel")); - monitors->templateMonitorConfigurationPositionPosCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPosCombo")); - monitors->templateMonitorConfigurationPositionPortCombo = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationPositionPortCombo")); - monitors->templateMonitorConfigurationModelineCVTCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineCVTCheck")); - monitors->templateMonitorConfigurationUseCVTReducedCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationUseCVTReducedCheck")); - monitors->templateMonitorConfigurationModelineGTFCheck = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorConfigurationModelineGTFCheck")); - monitors->curconfig=settings->curconfig; - - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); - - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationCancelButton), "clicked", G_CALLBACK(on_closed_configuration), monitors); - g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_save_window_configuration), monitors); - - videoconfig.ports = yon_config_load(get_ports_command,&videoconfig.portssize); - - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationMonitorLabel), _("Monitor: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel), _("Port: ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPositionLabel), _("Position: ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationShowUnsupportedCheck), _("Show unsupported: ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationEnableCheck), _("Enabled")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineCVTCheck), _("Create modeline for current resolution with CVT")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationUseCVTReducedCheck), _("Use \"CVT Reduced Blanking\" ")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationModelineGTFCheck), _("Create modeline for current resolution with GTF")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationResolutionLabel), _("Resolution (px): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationFrequencyLabel), _("Frequency (Hz): ")); - gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationRotationLabel), _("Rotation: ")); - // gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationDoNotSwitchOffLabel),_("Do not switch display off")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationMainRadio), _("Main monitor")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationParameterLineCheck), _("through parameter line:")); - gtk_button_set_label(GTK_BUTTON(monitors->templateMonitorConfigurationCancelButton), _("Cancel")); - gtk_widget_show(monitors->templateMonitorConfigurationWindow); - char *addln = NULL; - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationMainRadio),((monitorconfig*)settings->curconfig->data)->main); - - addln = _("Default settings"); - int chosen=-1; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo), addln); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo), 0); - - addln = _("Default settings"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationFrequencyCombo), _("Default settings")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationFrequencyCombo), 0); - - addln = _("Default settings"); - - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Default settings")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Left")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Right")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationRotationCombo), _("Invert")); - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationRotationCombo), 0); - - - if (yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities) - for (int res=0;rescurconfig,monitorconfig*)->resolution_size;res++){ - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(monitors->templateMonitorConfigurationResolutionCombo),yon_dictionary_get_data(settings->curconfig,monitorconfig*)->resolutionCapabilities[res]); - } - if(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters){ - char *entry_text=yon_char_new(yon_dictionary_get_data(settings->curconfig,monitorconfig*)->stringparameters); - yon_char_divide_search(entry_text,"=",1); - gtk_entry_set_text(GTK_ENTRY(monitors->templateMonitorConfigurationParameterLineEntry),entry_text); +/** monitor_config yon_monitor_config_new(char *port) + * [EN] +*/ +monitor_config yon_monitor_config_new(char *port){ + if (port){ + monitorconfig *monitor=new(monitorconfig); + monitor->main=0; + monitor->enable=0; + monitor->position=0; + monitor->port=NULL; + monitor->position_port=NULL; + monitor->resolution=NULL; + monitor->resolutionCapabilities=NULL; + monitor->frequency=NULL; + monitor->rotation=0; + monitor->stringparameters=NULL; + monitor->dpms=0; + monitor->resolution_size=0; + monitor->cvt=0; + monitor->reduced=0; + monitor->gtf=0; + + if (videoconfig.monitors) + videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,port,monitor); + else + videoconfig.monitors=yon_dictionary_create_with_data(port,monitor); + return videoconfig.monitors; } - if (((monitorconfig *)settings->curconfig->data)->resolution) - if ((chosen=yon_gtk_combo_box_text_find(monitors->templateMonitorConfigurationResolutionCombo,((monitorconfig *)settings->curconfig->data)->resolution))!=-1) - gtk_combo_box_set_active(GTK_COMBO_BOX(monitors->templateMonitorConfigurationResolutionCombo),chosen); } -MonitorSettings *yon_setup_monitor_settings() -{ - int monitors_n = yon_check_for_monitors(); - MonitorSettings *monitors = NULL; - monitors = malloc(sizeof(MonitorSettings) * monitors_n); - // videoconfig.videoconfig=videoconfig.videoconfig->first; - for (int i = 0; i < monitors_n; i++) - { - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); - monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); - monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); - monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); - monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); - monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); - monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); - monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); - monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); - monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); - printf("%d\n", i); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitors[i].curconfig->data)->port)); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); - char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); - if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->enable==1) - gtk_widget_set_sensitive(monitors[i].templateMonitorImage,1); - if (!res) - res = _("Default settings"); - gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); - gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorDeleteButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - g_signal_connect(G_OBJECT(monitors[i].templateMonitorSwitchButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); - if (i==0) - videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); - else - videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); - if (videoconfig.monitors->next) - videoconfig.monitors = videoconfig.monitors->next; +/**void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string) + * [EN] +*/ +void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string){ + if (port&&config_string){ + monitor->stringparameters=yon_char_new(config_string); + int size=0; + config_str cnf = yon_char_parse(config_string,&size,","); + if (yon_char_parsed_check_exist(cnf,size,"primary")!=-1) + monitor->main=1; + if (yon_char_parsed_check_exist(cnf,size,"enable")!=-1) + monitor->enable=1; + if (yon_char_parsed_check_exist(cnf,size,"disable")!=-1) + monitor->enable=0; + // if (yon_char_parsed_check_exist(cnf,size,"ignore")==1) + // monitor->enable=0; + if (yon_char_parsed_check_exist(cnf,size,"LeftOf:")!=-1) + monitor->position=1; + if (yon_char_parsed_check_exist(cnf,size,"lo:")!=-1) + monitor->position=1; + if (yon_char_parsed_check_exist(cnf,size,"RightOf:")!=-1) + monitor->position=2; + if (yon_char_parsed_check_exist(cnf,size,"ro:")!=-1) + monitor->position=2; + if (yon_char_parsed_check_exist(cnf,size,"Below:")!=-1) + monitor->position=4; + if (yon_char_parsed_check_exist(cnf,size,"be:")!=-1) + monitor->position=4; + if (yon_char_parsed_check_exist(cnf,size,"Above:")!=-1) + monitor->position=3; + if (yon_char_parsed_check_exist(cnf,size,"ab:")!=-1) + monitor->position=3; + if (yon_char_parsed_check_exist(cnf,size,"rotate:")!=-1) + monitor->rotation=0; + if (yon_char_parsed_check_exist(cnf,size,"dpms")!=-1) + monitor->dpms=1; + if (yon_char_parsed_check_exist(cnf,size,"nodpms")!=-1) + monitor->dpms=0; + if (yon_char_parsed_check_exist(cnf,size,"cvt")!=-1) + monitor->cvt=1; + if (yon_char_parsed_check_exist(cnf,size,"reduced")!=-1) + monitor->reduced=1; + if (yon_char_parsed_check_exist(cnf,size,"r")!=-1) + monitor->reduced=1; + if (yon_char_parsed_check_exist(cnf,size,"gtf")!=-1) + monitor->gtf=1; } - return monitors; } +// MonitorSettings *yon_setup_monitor_settings() +// { +// int monitors_n = videoconfig.portssize; +// MonitorSettings *monitors = NULL; +// monitors = malloc(sizeof(MonitorSettings) * (monitors_n+1)); +// // videoconfig.videoconfig=videoconfig.videoconfig->first; +// int i=0; +// if (videoconfig.monitors){ +// for (i = 0; i < monitors_n; i++) +// { +// GtkBuilder *builder = gtk_builder_new_from_file(glade_path); +// monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); +// monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); +// monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); +// monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); +// monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); +// monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); +// monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); +// monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); +// monitors[i].curconfig = yon_dictionary_get_nth(videoconfig.monitors, i); +// printf("%d\n", i); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==0) +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", ((monitorconfig *)monitors[i].curconfig->data)->port)); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->main==1) +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), yon_char_get_augumented("Monitor ", yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->port,"*"))); +// char *res = yon_char_get_augumented(((monitorconfig *)monitors[i].curconfig->data)->resolution, ""); +// if (yon_dictionary_get_data(monitors[i].curconfig,monitorconfig*)->enable==1) +// gtk_widget_set_sensitive(monitors[i].templateMonitorImage,1); +// if (!res) +// res = _("Default settings"); +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), res); +// gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorDeleteButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorSwitchButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// if (i==0) +// videoconfig.videoconfig = yon_dictionary_create_with_data(((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); +// else +// videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,((monitorconfig *)monitors[i].curconfig->data)->port,&monitors[i]); +// if (videoconfig.monitors->next) +// videoconfig.monitors = videoconfig.monitors->next; +// } +// } +// GtkBuilder *builder = gtk_builder_new_from_file(glade_path); +// monitors[i].templateMonitorscreenOverlay = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorscreenOverlay")); +// monitors[i].templateMonitorInfoBox = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoBox")); +// monitors[i].templateMonitorInfoNameLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoNameLabel")); +// monitors[i].templateMonitorImage = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorImage")); +// monitors[i].templateMonitorInfoResolutionLabel = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoResolutionLabel")); +// monitors[i].templateMonitorInfoConfigureButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoConfigureButton")); +// monitors[i].templateMonitorDeleteButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorDeleteButton")); +// monitors[i].templateMonitorSwitchButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorSwitchButton")); +// monitors[i].templateMonitorInfoAddButton = GTK_WIDGET(gtk_builder_get_object(builder, "templateMonitorInfoAddButton")); +// gtk_widget_show(monitors[i].templateMonitorInfoAddButton); +// gtk_widget_hide(monitors[i].templateMonitorSwitchButton); +// gtk_widget_hide(monitors[i].templateMonitorDeleteButton); +// gtk_widget_hide(monitors[i].templateMonitorInfoConfigureButton); +// monitors[i].curconfig = NULL; +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoNameLabel), ""); +// gtk_widget_set_sensitive(monitors[i].templateMonitorImage,0); +// gtk_label_set_text(GTK_LABEL(monitors[i].templateMonitorInfoResolutionLabel), ""); +// gtk_overlay_add_overlay(GTK_OVERLAY(monitors[i].templateMonitorscreenOverlay), monitors[i].templateMonitorInfoBox); +// g_signal_connect(G_OBJECT(monitors[i].templateMonitorInfoAddButton), "clicked", G_CALLBACK(on_confugure_monitor_settings), &monitors[i]); +// if (i==0) +// videoconfig.videoconfig = yon_dictionary_create_with_data("TEMPLATE",&monitors[i]); +// else +// videoconfig.videoconfig = yon_dictionary_create_with_data_connected(videoconfig.videoconfig,"TEMPLATE",&monitors[i]); +// return monitors; +// } + int yon_char_get_if_resolution(char *parsed_string){ char *left=NULL, *right=NULL; right=yon_char_new(parsed_string); @@ -673,31 +1029,38 @@ int yon_char_get_if_resolution(char *parsed_string){ return 0; } -int yon_check_for_monitors() -{ - GdkScreen *screen = gdk_screen_get_default(); - int monitors = gdk_display_get_n_monitors(gdk_screen_get_display(screen)); - return monitors; -} - -dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size) -{ - dictionary *dict = yon_dictionary_create_with_data("0", monitors[0].templateMonitorConfigurationBox); - for (int i = 1; i < size; i++) - { - dict = yon_dictionary_create_with_data_connected(dict, yon_char_from_int(i), monitors[i].templateMonitorConfigurationBox); - } - return dict; -} - -dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size) -{ - dictionary *dict = yon_dictionary_create_with_data("0", monitors[0].templateMonitorscreenOverlay); - for (int i = 1; i < size; i++) - { - dict = yon_dictionary_create_with_data_connected(dict, yon_char_from_int(i), monitors[i].templateMonitorscreenOverlay); +void yon_monitor_view_new(monitor_config monitor){ + GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + monitor_window *window = new(monitor_window); + window->templateMonitorscreenOverlay=yon_gtk_builder_get_widget(builder,"templateMonitorscreenOverlay"); + window->templateMonitorImage=yon_gtk_builder_get_widget(builder,"templateMonitorImage"); + window->templateMonitorInfoBox=yon_gtk_builder_get_widget(builder,"templateMonitorInfoBox"); + window->templateMonitorInfoNameLabel=yon_gtk_builder_get_widget(builder,"templateMonitorInfoNameLabel"); + window->templateMonitorInfoResolutionLabel=yon_gtk_builder_get_widget(builder,"templateMonitorInfoResolutionLabel"); + window->templateMonitorDeleteButton=yon_gtk_builder_get_widget(builder,"templateMonitorDeleteButton"); + window->templateMonitorSwitchButton=yon_gtk_builder_get_widget(builder,"templateMonitorSwitchButton"); + window->templateMonitorInfoConfigureButton=yon_gtk_builder_get_widget(builder,"templateMonitorInfoConfigureButton"); + window->templateMonitorInfoAddButton=yon_gtk_builder_get_widget(builder,"templateMonitorInfoAddButton"); + window->config=NULL; + gtk_overlay_add_overlay(GTK_OVERLAY(window->templateMonitorscreenOverlay),window->templateMonitorInfoBox); + if (monitor){ + window->config=monitor; + gtk_widget_hide(window->templateMonitorInfoAddButton); + g_signal_connect(G_OBJECT(window->templateMonitorInfoConfigureButton), "clicked", G_CALLBACK(on_monitor_configure), window); + if (videoconfig.monitor_visuals) videoconfig.monitor_visuals = yon_dictionary_create_with_data_connected(videoconfig.monitor_visuals, window->config->key,window); + else videoconfig.monitor_visuals = yon_dictionary_create_with_data(window->config->key,window); + + g_signal_connect(G_OBJECT(window->templateMonitorDeleteButton), "clicked", G_CALLBACK(on_monitor_delete), videoconfig.monitor_visuals); + g_signal_connect(G_OBJECT(window->templateMonitorSwitchButton), "clicked", G_CALLBACK(on_monitor_switch), window); + } else { + gtk_widget_show(window->templateMonitorInfoAddButton); + gtk_widget_hide(window->templateMonitorDeleteButton); + gtk_widget_hide(window->templateMonitorSwitchButton); + gtk_widget_hide(window->templateMonitorInfoConfigureButton); + g_signal_connect(G_OBJECT(window->templateMonitorInfoAddButton), "clicked", G_CALLBACK(on_monitor_add), window); + if (videoconfig.monitor_visuals) videoconfig.monitor_visuals = yon_dictionary_create_with_data_connected(videoconfig.monitor_visuals, "GENERIC",window); + else videoconfig.monitor_visuals = yon_dictionary_create_with_data("GENERIC",window); } - return dict; } void yon_monitor_set_resolutions(dictionary *dict){ @@ -723,6 +1086,12 @@ void yon_monitor_set_resolutions(dictionary *dict){ } } +/** void yon_setup_widgets(widgets_dict *widgets) + * [EN] + * Sets up every element on main window + * [RU] + * + * */ void yon_setup_widgets(widgets_dict *widgets) { widgets->builder = gtk_builder_new_from_file(glade_path); @@ -738,12 +1107,9 @@ void yon_setup_widgets(widgets_dict *widgets) widgets->extraPrimusunChooseAppsButton = yon_gtk_builder_get_widget(widgets->builder, "extraPrimusunChooseAppsButton"); widgets->mainHeadBackgroundImage = yon_gtk_builder_get_widget(widgets->builder, "mainHeadBackgroundImage"); widgets->mainDriverAutomaticallyChooseCheck = yon_gtk_builder_get_widget(widgets->builder, "mainDriverAutomaticallyChooseCheck"); - widgets->mainDriverProprietaryDriverLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverLabel"); widgets->mainDriverFailsafeNvidiaLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaLabel"); widgets->mainDriverFailsafeAMDLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDLabel"); - widgets->mainDriverProprietaryDriverCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverCombo"); widgets->mainExtraFixGapCombo = yon_gtk_builder_get_widget(widgets->builder, "mainExtraFixGapCombo"); - widgets->mainDriverProprietaryDriverButton = yon_gtk_builder_get_widget(widgets->builder, "mainDriverProprietaryDriverButton"); widgets->mainDriverFailsafeNvidiaCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeNvidiaCombo"); widgets->mainDriverFailsafeAMDCombo = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFailsafeAMDCombo"); widgets->mainDriverFrameLabel = yon_gtk_builder_get_widget(widgets->builder, "mainDriverFrameLabel"); @@ -793,6 +1159,8 @@ void yon_setup_widgets(widgets_dict *widgets) widgets->templateMonitorConfigurationDoNotSwitchOffLabel = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffLabel"); widgets->templateMonitorConfigurationDoNotSwitchOffCheck = yon_gtk_builder_get_widget(widgets->builder, "templateMonitorConfigurationDoNotSwitchOffCheck"); + videoconfig.list = GTK_LIST_STORE(gtk_builder_get_object(widgets-> builder, "liststore6")); + g_signal_connect(G_OBJECT(widgets->mainDriverAutomaticallyChooseCheck), "toggled", G_CALLBACK(on_auto_choose_drivers), widgets); // g_signal_connect(G_OBJECT(widgets->mainHybridGraphicsDiscreteCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets); g_signal_connect(G_OBJECT(widgets->mainExtraLaunchOptirunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->mainExtraLaunchOptirunEntry); @@ -801,9 +1169,8 @@ void yon_setup_widgets(widgets_dict *widgets) g_signal_connect(G_OBJECT(widgets->mainExtraLaunchPrismusunCheck), "toggled", G_CALLBACK(on_sensitive_change), widgets->extraPrimusunChooseAppsButton); g_signal_connect(G_OBJECT(widgets->MainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect(G_OBJECT(widgets->mainDriverProprietaryDriverButton), "clicked", G_CALLBACK(on_driver_window_open), widgets->mainDriverProprietaryDriverCombo); - g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); - g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); + // g_signal_connect(G_OBJECT(widgets->extraOptirunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); + // g_signal_connect(G_OBJECT(widgets->extraPrimusunChooseAppsButton), "clicked", G_CALLBACK(on_apps_chooser_open), widgets); g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsAboutMenuItem), "activate", G_CALLBACK(on_about), NULL); g_signal_connect(G_OBJECT(widgets->mainHeaderSettingsDocumentationMenuItem), "activate", G_CALLBACK(on_about), NULL); @@ -815,7 +1182,6 @@ void yon_setup_widgets(widgets_dict *widgets) g_signal_connect(G_OBJECT(widgets->mainHeaderSaveGlobalMenuItem), "activate", G_CALLBACK(on_configuration_save_global), widgets); g_signal_connect(G_OBJECT(widgets->mainHeaderSaveLocalMenuItem), "activate", G_CALLBACK(on_configuration_save_local), widgets); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverProprietaryDriverCombo), _("Don't use")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("Off")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeNvidiaCombo), _("fbdev")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainDriverFailsafeAMDCombo), _("Off")); @@ -824,7 +1190,6 @@ void yon_setup_widgets(widgets_dict *widgets) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("1st variant. May cause perfomance drops in video games")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->mainExtraFixGapCombo), _("2nd variant. May not work on specific video cards")); gtk_label_set_text(GTK_LABEL(widgets->headInfoLabel), _("Video output configuration")); - gtk_label_set_text(GTK_LABEL(widgets->mainDriverProprietaryDriverLabel), _("Proprietary driver: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeNvidiaLabel), _("Failsafe driver nVidia: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFailsafeAMDLabel), _("Failsafe driver AMD/ATI: ")); gtk_label_set_text(GTK_LABEL(widgets->mainDriverFrameLabel), _("Driver")); @@ -853,12 +1218,17 @@ void yon_setup_widgets(widgets_dict *widgets) // gtk_button_set_label(GTK_BUTTON(widgets->mainExtraLaunchThroughButton),_("Change")); yon_ubl_header_setup(widgets->mainHeadOverlay, widgets->headBox, widgets->mainHeadBackgroundImage, banner_path); // gtk_overlay_add_overlay(GTK_OVERLAY(widgets->mainHeadOverlay),widgets->headBox); + yon_monitor_view_setup(widgets->mainMonitorVisualConfigurationBox); + yon_monitor_view_update(); + videoconfig.status_render.icon=widgets->mainStatusIcon; + videoconfig.status_render.label=widgets->mainStatusLabel; + videoconfig.status_render.box=widgets->mainStatusBox; // gtk_image_set_from_file(GTK_IMAGE(widgets->mainHeadBackgroundImage),banner_path); - MonitorSettings *monitors = yon_setup_monitor_settings(); + // MonitorSettings *monitors = yon_setup_monitor_settings(); // videoconfig.monitors=yon_dictionary_pack_monitors(monitors,yon_check_for_monitors()); - widgets->overlays = yon_dictionary_pack_overlays(monitors, yon_check_for_monitors()); - yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays, widgets->mainMonitorVisualConfigurationBox, 0, 0, 0); + // widgets->overlays = yon_dictionary_pack_overlays(monitors); + // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->overlays, widgets->mainMonitorVisualConfigurationBox, 0, 0, 0); // yon_dictionary_gtk_pack_start_multiple_widgets(widgets->monitors,widgets->mainMonitorConfigurationBox,0,0,0); } @@ -870,11 +1240,10 @@ int main(int argc, char *argv[]) gtk_init(&argc, &argv); GError error; - // xfconf_init (&error); - // display_channel = xfconf_channel_new ("displays"); - yon_setup_config(); + yon_setup_config(load_drivers_local_command); widgets_dict widgets; yon_setup_widgets(&widgets); + yon_gtk_list_store_fill_with_proprietaries(videoconfig.list); gtk_widget_show(widgets.MainWindow); // yon_fill_ui(&widgets); yon_ubl_status_box_render(widgets.mainStatusBox, widgets.mainStatusIcon, widgets.mainStatusLabel, _("Configuration has been loaded"), BACKGROUND_IMAGE_SUCCESS_TYPE); diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index fc35e42..dccebb3 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -8,6 +8,7 @@ #include #include #include "ubl-utils.h" +#include "ubl-settings-video-strings.h" #ifndef UBL_SETINGS_VIDEO_H #define UBL_SETINGS_VIDEO_H @@ -29,9 +30,9 @@ #define get_resolutions_command "xrandr |grep -noP \"\\d+x+\\d+\"" -#define get_proprietary_drivers_command "cut -d, -f1- video-drivers.csv | grep -E \"-\"" +#define get_proprietary_drivers_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/video-drivers.csv | grep -E \"-\"" -#define get_resolutions_supportable_command "cut -d, -f1- Resolutions.csv |sed 's/,/\t/g'" +#define get_resolutions_supportable_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/resolutions.csv |sed 's/,/\t/g'" #define get_frequences_command "xrandr |grep -v -n \"[a-z][a-z]\" |sed 's/ * / /g' |cut -d' ' -f1,3-" @@ -49,6 +50,8 @@ #define remove_drivers_local_command "/usr/bin/ubconfig --target global remove video " +#define XORG_MONITOR(port) yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(port,"] ")) + char *local; @@ -58,12 +61,25 @@ string version_application = "1.0"; #define _(String) gettext(String) +typedef dictionary* monitor_config; +typedef dictionary* proprietary_config; +typedef dictionary* monitor_view; + + +typedef struct { + GtkWidget *icon; + GtkWidget *box; + GtkWidget *label; +} render_data; + typedef struct { + config_str loaded_config; + int configsize; int autoChooseDrivers; - dictionary *videoconfig; - dictionary *monitors; - dictionary *proprietary; + monitor_view monitor_visuals; + monitor_config monitors; + proprietary_config proprietary; GtkListStore *list; char *failsafenVidia; char *failsafeATI; @@ -71,25 +87,30 @@ typedef struct char *optirun; char *primusrun; int gapfix; - int optiorprimus; - char **ports; + config_str ports; int portssize; - char **resolutions; + config_str resolutions; int resolutionssize; + render_data status_render; } config; typedef struct { int main; int enable; - char *position; + int position; + char *position_port; char *port; char *resolution; - char **resolutionCapabilities; + config_str resolutionCapabilities; char *frequency; - char *rotation; + int rotation; char *stringparameters; + int dpms; int resolution_size; + int cvt; + int reduced; + int gtf; } monitorconfig; typedef struct { @@ -174,43 +195,46 @@ typedef struct typedef struct { GtkWidget *templateMonitorConfigurationWindow; + GtkWidget *mainMonitorConfigurationBox; GtkWidget *templateMonitorConfigurationBox; - GtkWidget *templateMonitorConfigurationMonitorLabel; + GtkWidget *templateMonitorConfigurationEnableCheck; + GtkWidget *templateMonitorConfigurationPortLabel; + GtkWidget *templateMonitorConfigurationPortCombo; + GtkWidget *templateMonitorConfigurationMainCheck; GtkWidget *templateMonitorConfigurationResolutionLabel; GtkWidget *templateMonitorConfigurationResolutionCombo; + GtkWidget *templateMonitorConfigurationShowUnsupportedCheck; GtkWidget *templateMonitorConfigurationFrequencyLabel; GtkWidget *templateMonitorConfigurationFrequencyCombo; - GtkWidget *templateMonitorConfigurationRotationCombo; GtkWidget *templateMonitorConfigurationRotationLabel; - GtkWidget *templateMonitorConfigurationMainRadio; - GtkWidget *templateMonitorConfigurationParameterLineCheck; - GtkWidget *templateMonitorConfigurationParameterLineEntry; - GtkWidget *templateMonitorConfigurationDoNotSwitchOffLabel; - GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; - GtkWidget *templateMonitorConfigurationCancelButton; - GtkWidget *templateMonitorConfigurationSaveButton; - - GtkWidget *templateMonitorConfigurationEnableCheck; - GtkWidget *templateMonitorConfigurationPortLabel; - GtkWidget *templateMonitorConfigurationPortCombo; - GtkWidget *templateMonitorConfigurationShowUnsupportedCheck; + GtkWidget *templateMonitorConfigurationRotationCombo; GtkWidget *templateMonitorConfigurationPositionLabel; GtkWidget *templateMonitorConfigurationPositionPosCombo; GtkWidget *templateMonitorConfigurationPositionPortCombo; + GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; GtkWidget *templateMonitorConfigurationModelineCVTCheck; GtkWidget *templateMonitorConfigurationUseCVTReducedCheck; GtkWidget *templateMonitorConfigurationModelineGTFCheck; + GtkWidget *templateMonitorConfigurationParameterLineCheck; + GtkWidget *templateMonitorConfigurationParameterLineEntry; + GtkWidget *templateMonitorConfigurationCancelButton; + GtkWidget *templateMonitorConfigurationSaveButton; + + dictionary *config; +} monitor_edit_window; +typedef struct { GtkWidget *templateMonitorscreenOverlay; GtkWidget *templateMonitorImage; GtkWidget *templateMonitorInfoBox; GtkWidget *templateMonitorInfoNameLabel; GtkWidget *templateMonitorInfoResolutionLabel; - GtkWidget *templateMonitorInfoConfigureButton; GtkWidget *templateMonitorDeleteButton; GtkWidget *templateMonitorSwitchButton; - dictionary *curconfig; -} MonitorSettings; + GtkWidget *templateMonitorInfoConfigureButton; + GtkWidget *templateMonitorInfoAddButton; + monitor_config config; +} monitor_window; typedef struct { @@ -225,14 +249,10 @@ typedef struct GtkWidget *ProprietaryAcceptButton; } driver_window; -int yon_check_for_monitors(); -MonitorSettings *yon_setup_monitor_settings(); -dictionary *yon_dictionary_pack_monitors(MonitorSettings *monitors, int size); -dictionary *yon_dictionary_pack_overlays(MonitorSettings *monitors, int size); -void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); -void on_save_configuration(GtkWidget self, MonitorSettings *monitors); -int yon_config_init(char **parameters, int size); -void yon_parse_monitor(dictionary *monitor, char *string_of_settings); + +// void on_closed_configuration(GtkWidget *self, MonitorSettings *monitors); +// void on_save_configuration(GtkWidget self, MonitorSettings *monitors); +void yon_parse_monitor(); void on_config_fill_interface(widgets_dict *widgets); void yon_update_config(widgets_dict *widgets); void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets); @@ -241,4 +261,16 @@ void on_configuration_save__local(GtkWidget *self, widgets_dict *widgets); void yon_config_monitor_string_parse(char *parameters, int *size); int yon_char_get_if_resolution(char *parsed_string); void yon_monitor_set_resolutions(dictionary *dict); +monitor_config yon_monitor_config_new(char *port); +void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string); +void yon_monitor_view_new(monitor_config monitor); +// void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings); +void yon_monitor_view_draw_all(GtkWidget *cnt); +void on_monitor_configure(GtkWidget *self,monitor_window *window); +void on_monitor_add(GtkWidget *self,monitor_window *window); +void on_monitor_switch(GtkWidget *self,monitor_window *window); +void on_monitor_delete(GtkWidget *self,monitor_view windowd); +void yon_monitor_view_update(); +void yon_monitor_window_update(monitor_edit_window *window); +char *yon_monitor_make_string(monitorconfig* config); #endif \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c index b56e513..2870909 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -300,17 +300,19 @@ dictionary *yon_dictionary_rip(dictionary *dict) dictionary *yon_dictionary_get_nth(dictionary *dict, int place) { - dict = dict->first; - int i = 0; - for (i = 0; i < place; i++) - if (dict->next) - dict = dict->next; + if (dict){ + dict = dict->first; + int i = 0; + for (i = 0; i < place; i++) + if (dict->next) + dict = dict->next; + else + break; + if (i == place) + return dict; else - break; - if (i == place) - return dict; - else - return NULL; + return NULL; + } else return NULL; } // char functions @@ -342,10 +344,30 @@ char *yon_char_get_augumented(char *source, char *append) */ char *yon_char_new(char *chr) { - char *newchar = malloc(strlen(chr) + 1); - memset(newchar, 0, strlen(chr) + 1); - memcpy(newchar, chr, strlen(chr)); - return newchar; + if (chr){ + char *newchar = malloc(strlen(chr) + 1); + memset(newchar, 0, strlen(chr) + 1); + memcpy(newchar, chr, strlen(chr)); + return newchar; + } else + return NULL; +} + +// char *yon_char_unite(char *source, ...) + +char *yon_char_unite(char *source, ...){ + va_list arglist; + char *new_char=NULL; + char *unite_char=NULL; + new_char=yon_char_new(source); + va_start(arglist,source); + unite_char = va_arg(arglist,char*); + while(unite_char){ + new_char = yon_char_get_augumented(new_char,unite_char); + unite_char = va_arg(arglist,char*); + } + va_end(arglist); + return new_char; } /**[EN] @@ -407,7 +429,7 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) return cut; } else - return NULL; + return source; } } /**[EN] @@ -447,6 +469,7 @@ char **yon_char_parse(char *parameters, int *size, char *divider){ string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(param); i++; + if (strcmp(param,paramline)==0) break; } string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(paramline); @@ -606,7 +629,7 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size) return NULL; }; -char **yon_config_load(char *command, int *str_len) +config_str yon_config_load(char *command, int *str_len) { FILE *output = popen(command, "r"); char **output_strings = NULL; @@ -626,8 +649,13 @@ char **yon_config_load(char *command, int *str_len) i++; } } + if (i>0){ *str_len = i; return output_strings; + } else{ + *str_len=-1; + return NULL; + } } @@ -643,13 +671,17 @@ int yon_config_save(char *command) } /**[EN] - * char *yon_config_get_parameter(char **parameters, int size, char *param) + * char *yon_config_get_parameter(config parameters, int size, char *param) * Gets parameter from parameter list; * * [RU] */ -char *yon_config_get_parameter(char **parameters, int size, char *param) +char *yon_config_get_parameter(config_str parameters, int size, char *param) { + if (param[0]==' ') + yon_char_divide_search(param," ",-1); + param=yon_char_divide_search(yon_char_new(param)," ",-1); + char *str = NULL; for (int j = 0; j < size; j++) { @@ -828,24 +860,27 @@ int yon_launch(thread_output *thread) int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){ - int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); - char *str="-1"; - for (int i=0;strcmp(str,"")!=0;i++){ - gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i); - str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box)); - if (!str) return -1; - if (strcmp(text_to_find,str)==0) return i; - } - return -1; + if (combo_box&&text_to_find){ + int active=gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); + char *str="-1"; + for (int i=0;strcmp(str,"")!=0;i++){ + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box),i); + str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box)); + if (!str) return -1; + if (strcmp(text_to_find,str)==0) return i; + } + } return -1; } int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) { - for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) - { - gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); - } + if (dict){ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); + } return 1; + }else return 0; } int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) diff --git a/source/ubl-utils.h b/source/ubl-utils.h index ce50a8d..6efd808 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -15,6 +15,9 @@ #define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) +#define new(type) malloc(sizeof(type)) +#define new_arr(type,size) malloc(sizeof(type)*size) + #define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data = command #define yon_ubl_load_global_config(command, size_pointer) yon_config_load(command, size_pointer) @@ -58,6 +61,7 @@ typedef struct apps int DualPluggable; } apps; +typedef char** config_str; // dictionary functions @@ -93,6 +97,8 @@ char *yon_char_get_augumented(char *source, char *append); char *yon_char_new(char *chr); +char *yon_char_unite(char *source, ...); + char *yon_cut(char *source, int size, int startpos); char *yon_char_divide(char *source, int dividepos); @@ -107,6 +113,8 @@ char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete) int yon_char_parsed_check_exist(char **parameters, int size, char *param); + + // parsing functions apps *yon_apps_scan_and_parse_desktops(int *sizef); @@ -115,11 +123,11 @@ void yon_apps_sort(apps *applist, int size); apps *yon_apps_get_by_name(apps *applist, char *name, int size); -char **yon_config_load(char *command, int *str_len); +config_str yon_config_load(char *command, int *str_len); int yon_config_save(char *command); -char *yon_config_get_parameter(char **parameters, int size, char *param); +char *yon_config_get_parameter(config_str parameters, int size, char *param); char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider); @@ -165,7 +173,7 @@ int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *de void yon_on_plug_added(GtkSocket *self, gpointer user_data); void yon_on_plug_removed(GtkSocket *self, gpointer user_data); -#endif + typedef enum { BACKGROUND_IMAGE_SUCCESS_TYPE, @@ -181,4 +189,5 @@ typedef enum void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); +#endif #endif \ No newline at end of file diff --git a/ubl-settings-video.desktop b/ubl-settings-video.desktop index b2b9897..f12dc01 100644 --- a/ubl-settings-video.desktop +++ b/ubl-settings-video.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Encoding=UTF-8 Name=ubl-settings-video -Name[ru]=Настройки Видеоадаптера и дисплея +Name[ru]=Настройки видеоадаптера и дисплея GenericName=ubl-settings-video GenericName[ru]=Настройки Видеоадаптера и дисплея Comment=Application for managing video adapter and display settings diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 32faf42..d69248f 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -6,44 +6,6 @@ - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True False @@ -137,99 +99,105 @@ - - 800 - 600 + + False - 800 - 600 + О Программе + False + True + center com.ublinux.ubl-settings-video + dialog + True + ubl-settings-video + 1.2 + Copyright © 2023 - UBSoft Software LLC + Settings for video output + https://ublinux.ru/ + 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-video + True + gpl-2-0 + + + False + vertical + 2 + + + False + False + top + spread + + + False + False + 0 + + + + + + + + + + True + False - + + 90 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + com.ublinux.ubl-settings-video + + + False + True + 0 + + + + True False - True - vertical True False - vertical - + True False + vertical - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 25 - - - False - True - 0 - - - - + + 255 True False - start - 5 - 5 - 5 - 5 - 6 - 6 + Video output configuration + - + + True True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - - - 81 - True - False - - - True - False - start - - - -1 - - - - - False - True 0 @@ -237,1242 +205,694 @@ False True - 1 + 0 - - - 165 - True - True - 5 - 5 - 5 - 5 - external - - - True - False - - - True - True - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - vertical - - - Automatically choose and use driver - True - True - False - start - True - - - False - True - 0 - - - - - True - False - 5 - - - True - False - vertical - 5 - - - True - False - start - Proprietary driver: - 0 - - - False - True - 0 - - - - - True - False - start - Failsafe driver nVidia: - 0 - - - False - True - 1 - - - - - True - False - start - Failsafe driver AMD/ATI: - 0 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - False - 0 - - - True - True - 0 - - - - - True - True - True - image8 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - False - True - 1 - - - - - True - False - - - False - True - 2 - - - - - True - True - 1 - - - - - False - True - 1 - - - - - - - - - True - False - Driver - - - - - False - True - 0 - - - - - True - False - vertical - - - True - False - 0.019999999552965164 - in - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 10 - - - - - - False - True - 0 - - - - - - - True - False - Monitor configuration - - - - - True - True - 0 - - - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - - - discrete video only (AMD/ATI) - True - True - False - 5 - 5 - True - - - False - True - 1 - - - - - - - - - True - False - 0 - Hybrid graphics - - - - - False - True - 2 - - - - - True - False - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 12 - 5 - - - True - False - vertical - - - True - False - 5 - - - True - False - vertical - 5 - - - Launch programms through optirun (nVidia): - True - True - False - True - - - False - True - 0 - - - - - Launch programs through primusun (nVidia): - True - True - False - True - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - True - steam - - - True - True - 0 - - - - - True - False - True - steam - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - vertical - 5 - - - True - False - True - True - image1 - - - False - True - 0 - - - - - True - False - True - True - image2 - - - False - True - 1 - - - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 5 - 5 - - - True - False - Fix frame gap (nVidia): - 0 - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - False - True - 1 - - - - - - - - - True - False - Extra - - - - - False - True - 3 - - - - - - - True - False - Main Settings - - - False - - - - - True - True - 5 - 5 - 5 - 5 - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - 5 - - - True - True - 5 - liststore6 - 0 - True - 2 - - - - - - Package - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Supported Devices - - - - - True - True - 0 - - - - - True - False - center - 5 - - - Установить - True - True - True - image9 - - - False - True - end - 0 - - - - - Удалить - True - True - True - image11 - - - False - True - end - 1 - - - - - Подробнее - True - True - True - image10 - - - False - True - end - 2 - - - - - False - True - 1 - - - - - - - True - False - Driver Modules - - - False - - - - - True - False - 5 - 5 - 5 - 5 - 5 - vertical - 5 - - - True - True - 5 - liststore6 - 0 - True - 2 - - - - - - Package - - - - - Driver - - - - 0 - - - - - - - Description - - - - 1 - - - - - - - Supported Devices - - - - - True - True - 0 - - - - - True - False - center - 5 - - - Установить - True - True - True - image6 - - - False - True - end - 0 - - - - - Удалить - True - True - True - image7 - - - False - True - end - 1 - - - - - Подробнее - True - True - True - image12 - - - False - True - end - 2 - - - - - False - True - 1 - - - - - 1 - - - - - True - False - Drivers - - - 1 - False - - - - - - - - + + + True + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + document-edit-symbolic + + + True + False + dialog-information-symbolic + + + True + False + user-trash-symbolic + + + True + False + dialog-information-symbolic + + + True + False + system-shutdown-symbolic + + + True + False + user-trash-symbolic + + + False + value-increase-symbolic + + + True + False + document-edit-symbolic + + + True + False + open-menu-symbolic + + + + True + False + start + 3 + 3 + 10 + 20 + vertical + + + True + False + True + + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + + + + + False + True + 1 + + + + + True + False + 15 + + + True + True + True + image14 + + + + False + True + 0 + + + + + True + True + True + image13 + + + + False + True + 1 + + + + + True + True + True + end + image3 + + + + False + True + end + 2 + + + + + True + True + True + image15 + + + + False + True + 3 + + + + + False + True + 2 + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + False + True + com.ublinux.ubl-settings-video + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + False + 5 + + + Enabled + True + True + False + True + + + False + True + 0 + + + + + False + True + 1 + + + + + True + False + vertical + + + True + False + end + 5 + True + + + Save + True + True + True + image5 + + + False + True + end + 0 + + + + + Cancel + True + True + True + image4 + + + False + True + end + 1 + + + + + False + True + 0 + + + + + False + True + end + 2 + + + + + True + False + vertical + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Port - 1 + False + True + 0 - - + + True False - Drivers + 0 + True + True 1 - False - + + Main display True - False - 5 - 5 - 5 - 5 - 0 - none - - - True - False - 12 - - - True - False - - - True - False - start - 75 - appointment-new-symbolic - - - False - True - 0 - - - - - True - False - start - start - 10 - 5 - 10 - 10 - label - - - False - True - 1 - - - - - - - - - True - False - 5 - Devices and Drivers - - + True + False + True + False + True 2 - - + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Resolution (px): + + + False + True + 0 + + + + True False - Information + 0 + + + True + True + 1 + + + + + Show unsupported + True + True + False + True + False + True 2 - False + + False + True + 2 + + + + + True + False + 5 + + + True + False + Frequency (Hz): + + + False + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + Rotation: + + + False + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + False + True + 4 + - - - - - True - True - 2 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - start - 5 - 5 - 5 - 5 - False - UBlinux Video Configuration - - - - - - - - True - False - 5 - 5 - 5 - 5 - 32 - com.ublinux.ubl-settings-video - - - - - True - False - - - True - True - False - True - LoadConfigurationMenu - none - - - True - False - + True False - 5 - 5 - 5 - 5 - Load + 5 + + + True + False + Position: + + + False + True + 0 + + + + + True + False + 5 + True + + + True + False + 0 + + + True + True + 0 + + + + + True + False + 0 + + + True + True + 1 + + + + + True + True + 1 + + False True - 0 + 5 - + + Do not switch off display True - False - pan-down-symbolic + True + False + True False True - 1 + 6 - - - - - False - True - 0 - - - - - 1 - - - - - True - False - - - True - True - False - True - True - SaveConfigurationMenu - none - - - True - False - + + Create modeline for current resolution with CVT True - False - 5 - 5 - 5 - 5 - Save - + True + False + True False True - 0 + 7 - + + Use "CVT Reduced Blanking"gshgrbehr True - False - pan-down-symbolic + True + False + True False True - 1 + 8 - - - - - False - True - 0 - - - - - True - True - False - True - True - SettingsMenu - none - - - - - - False - True - 1 - - - - - end - 3 - - - - - - - - False - О Программе - False - True - center - com.ublinux.ubl-settings-video - dialog - True - ubl-settings-video - 1.2 - Copyright © 2023 - UBSoft Software LLC - Settings for video output - https://ublinux.ru/ - 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-video - True - gpl-2-0 - - - False - vertical - 2 - - - False - False - top - spread - - - False - False - 0 - - - - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 69 - com.ublinux.ubl-settings-video - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - vertical + + + Create modeline for current resolution with GTF + True + True + False + True + + + False + True + 9 + + + + + True + False + + + False + True + 10 + + + + + False + True + 0 + + - - 255 + True False - Video output configuration - - - - - - + 5 + 5 + vertical + 5 + + + Configure manually through parameter line: + True + True + False + True + + + False + True + 0 + + + + + True + False + True + center + 1920x1080 + + + True + True + 1 + + - True + False True - 0 + 1 False True - 0 + 3 @@ -1482,240 +902,169 @@ 0 - - - True - False - - - False - True - 1 - - - - True - True - 1 - + + + - - True - False - document-edit-symbolic - - + True False - dialog-information-symbolic + go-bottom-symbolic - + True False user-trash-symbolic - - True - False - dialog-information-symbolic - - + True False - system-shutdown-symbolic + go-bottom-symbolic - - True - False - user-trash-symbolic + + + + + + + + + + + + + - + True - False - start - 3 - 3 - 10 - 20 - vertical - - - True - False - Monitor - True - - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 1920x1200:60Hz - - - - - - - False - True - 1 - - + True True False - 15 + vertical - + True True - True - image14 - + 15 + 15 + 6 + multiple + horizontal + liststore5 + 1 + True + + + + 0 + + + + + 0 + True + word + + + 1 + + - False + True True 0 + + + + + True + False + 5 - + True - True - True - image13 - + False + 25 + applications-system False True - 1 + 0 - + True - True - True - end - image3 - + False + Settings False True - end - 2 + 1 - - False - True - 2 - - - - True - False - document-edit-symbolic - - - True - False - open-menu-symbolic - - - True - False - process-stop-symbolic + + - - True - False - emblem-ok-symbolic + + + + + + + + + + + + + - + + 800 + 600 False - True + 800 + 600 com.ublinux.ubl-settings-video - + True False + True vertical - + True False - 5 - 5 - 5 - 5 vertical - + True False - vertical - 5 - + True False - 5 - - - Enabled - True - True - False - True - - - False - True - 0 - - + 5 + 5 + 5 + 5 + 6 + 6 + 25 False @@ -1724,200 +1073,828 @@ - + True False - 5 - - - True - False - Port - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - Main display - True - True - False - True - - - False - True - 2 - - + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + - False + True True 1 + + + False + True + 0 + + + + + True + False + vertical - + + 81 True False - 5 - + True False - Resolution (px): + start - False - True - 0 + -1 + + + False + True + 0 + + + + + False + True + 1 + + + + + True + True + 5 + + + 165 + True + True + 5 + 5 + 5 + 5 + external - + True False + + + True + False + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + Automatically choose and use driver + True + True + False + start + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + vertical + 5 + + + True + False + start + Failsafe driver nVidia: + 0 + + + False + True + 1 + + + + + True + False + start + Failsafe driver AMD/ATI: + 0 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + + + False + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Driver + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 0.019999999552965164 + in + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 10 + + + + + + False + True + 0 + + + + + + + True + False + Monitor configuration + + + + + True + True + 0 + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + + + discrete video only (AMD/ATI) + True + True + False + 5 + 5 + True + + + False + True + 1 + + + + + + + + + True + False + 0 + Hybrid graphics + + + + + False + True + 2 + + + + + True + False + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 12 + 5 + + + True + False + vertical + + + True + False + 5 + + + True + False + vertical + 5 + + + Launch programms through optirun (nVidia): + True + True + False + True + + + False + True + 0 + + + + + Launch programs through primusun (nVidia): + True + True + False + True + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + True + steam + + + True + True + 0 + + + + + True + False + True + steam + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + vertical + 5 + + + True + False + True + True + image1 + + + False + True + 0 + + + + + True + False + True + True + image2 + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + True + False + Fix frame gap (nVidia): + 0 + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + Extra + + + + + False + True + 3 + + + + - - True - True - 1 - - - - - Show unsupported - True - True - False - True - - - False - True - 2 - - - False - True - 2 - - - + + True False - 5 - - - True - False - Frequency (Hz): - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - + Main Settings - False - True - 3 + False - + True - False - 5 - - - True - False - Rotation: - - - False - True - 0 - - + True + 5 + 5 + 5 + 5 + 5 + 5 - + True False + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + + + True + True + 5 + liststore6 + 1 + True + + + + + + Installed + + + + 0 + + + + + + + Package + + + + 1 + + + + + + + Driver + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + Supported Devices + + + + 4 + + + + + + + + + True + True + 0 + + + + + True + False + center + 5 + + + Установить + True + True + True + image9 + + + False + True + end + 0 + + + + + Удалить + True + True + True + image11 + + + False + True + end + 1 + + + + + Подробнее + True + True + True + image10 + + + False + True + end + 2 + + + + + False + True + 1 + + - - True - True - 1 - - - - False - True - 4 - - - - - True - False - 5 - - + + True False - Position: + Driver Modules - False - True - 0 + False True False + 5 + 5 + 5 + 5 + 5 + vertical 5 - True - + True - False + True + + + True + True + 5 + liststore6 + 0 + True + 2 + + + + + + Installed + + + + 0 + + + + + + + Package + + + + 1 + + + + + + + Driver + + + + 2 + + + + + + + Description + + + + 3 + + + + + + + Supported Devices + + + + 4 + + + + + + True @@ -1926,338 +1903,398 @@ - + True False + center + 5 + + + Установить + True + True + True + image6 + + + False + True + end + 0 + + + + + Удалить + True + True + True + image7 + + + False + True + end + 1 + + + + + Подробнее + True + True + True + image12 + + + False + True + end + 2 + + - True + False True 1 - True - True 1 + + + True + False + Drivers + + + 1 + False + + + + + + + + - False - True - 5 - - - - - Do not switch off display - True - True - False - True - - - False - True - 6 - - - - - Create modeline for current resolution with CVT - True - True - False - True - - - False - True - 7 + 1 - - - Use "CVT Reduced Blanking"gshgrbehr + + True - True - False - True + False + Drivers - False - True - 8 + 1 + False - - Create modeline for current resolution with GTF + True - True - False - True + False + 5 + 5 + 5 + 5 + 5 + 5 + 0 + none + + + True + False + 12 + + + True + False + + + True + False + start + 75 + appointment-new-symbolic + + + False + True + 0 + + + + + True + False + start + start + 10 + 5 + 10 + 5 + 10 + 10 + label + + + False + True + 1 + + + + + + + + + True + False + 5 + 5 + Devices and Drivers + + - False - True - 9 + 2 - - + + True False + Information - False - True - 10 + 2 + False - False + True True - 0 + 2 + + + True + True + 0 + + + + + + + True + False + True + + + True + False + start + 5 + 5 + 5 + 5 + False + UBlinux Video Configuration + + + + + + + + True + False + 5 + 5 + 5 + 5 + 32 + com.ublinux.ubl-settings-video + + + + + True + False - + True - False - 5 - 5 - vertical - 5 - - - Configure manually through parameter line: - True - True - False - True - - - False - True - 0 - - + True + False + True + LoadConfigurationMenu + none - + True - False - True - center - 1920x1080 + False + + + True + False + 5 + 5 + 5 + 5 + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + - - True - True - 1 - False True - 1 + 0 + + + 1 + + + + + True + False - + True - False - vertical + True + False + True + True + SaveConfigurationMenu + none True False - end - 5 - True - - Save + True - True - True - image5 + False + 5 + 5 + 5 + 5 + Save + False True - end 0 - - Cancel + True - True - True - image4 + False + pan-down-symbolic False True - end 1 - - False - True - 0 - False True - end - 2 + 0 - - - True - True - 0 - - - - - - - True - False - go-bottom-symbolic - - - True - False - user-trash-symbolic - - - True - False - system-run-symbolic - - - True - False - go-bottom-symbolic - - - - - - - - - - - - - - - - - True - True - - - True - False - vertical - - - True - True - 15 - 15 - 6 - multiple - horizontal - liststore5 - 1 - True - - - - 0 - - - - 0 - True - word + + True + True + False + True + True + SettingsMenu + none + + + - - 1 - + + False + True + 1 + - True - True - 0 - - - - - - - True - False - 5 - - - True - False - 25 - applications-system - - - False - True - 0 - - - - - True - False - Settings - - - False - True - 1 + end + 3 - - - - - - - - - - + + vertical + + + + + + + + + + + + + + + + + + + radiobutton -- 2.35.1 From ac2fa32f55c7a2b81418bb0ee300600d90938ec2 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 27 Apr 2023 22:44:56 +0600 Subject: [PATCH 12/16] Monitor configuration design changes are completed --- source/ubl-settings-video.c | 134 +++++++++++++++++++++++++++--------- source/ubl-settings-video.h | 12 +++- source/ubl-utils.c | 9 +++ source/ubl-utils.h | 4 ++ ubl-settings-video.glade | 92 ------------------------- 5 files changed, 126 insertions(+), 125 deletions(-) diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index 406d051..4161d57 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -48,6 +48,7 @@ void on_monitor_config_save(GtkWidget *self, monitor_edit_window *window){ config->position_port = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPositionPortCombo)); } + config->resolution=yon_char_divide_search(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo))," ",-1); int rotation = gtk_combo_box_get_active(GTK_COMBO_BOX(window->templateMonitorConfigurationRotationCombo)); if (rotation==1) config->rotation=rotation; else if (rotation==2) config->rotation=rotation; @@ -135,6 +136,39 @@ void on_monitor_config_save(GtkWidget *self, monitor_edit_window *window){ // on_subwindow_close(self); // }; +void on_port_chosen_changed(GtkWidget *self, monitor_edit_window *window){ + monitorconfig* config = yon_dictionary_get_data(window->config,monitorconfig*); + dictionary *dict=NULL; + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo),0); + char *combo_text=yon_char_new((char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationPortCombo))); + char *resolution = yon_char_divide_search(combo_text," ",-1); + if (combo_text) + if (strcmp(combo_text,MONITOR_CHOOSE_PORT_LABEL)!=0){ + dict=yon_dictionary_find(&videoconfig.supported_resolutions,resolution); + if (dict){ + resolution_supported *res = yon_dictionary_get_data(dict,resolution_supported*); + int found_size=0; + for (int i=0;isize;i++){ + char *check_line; + for (int j=0;jline[i])){ + found_size++; + if(!config->resolutionCapabilities) config->resolutionCapabilities=new(char*); + else config->resolutionCapabilities=realloc(config->resolutionCapabilities,sizeof(char*)*found_size); + config->resolutionCapabilities[found_size-1]=videoconfig.resolutions[j]; + config->resolution_size=found_size; + } + } + } + yon_gtk_combo_box_fill(window->templateMonitorConfigurationResolutionCombo,config->resolutionCapabilities, config->resolution_size); + } + } +} + void on_save_driver_configuration(GtkWidget *self,combo_tree *widgets){ GtkTreeIter iter; char *name; @@ -208,6 +242,19 @@ char *yon_configuration_get_save_command(char *command){ else return NULL; } +void on_resolutions_unsupported_show(GtkWidget *self, monitor_edit_window *window){ + ((monitorconfig*)window->config->data)->show_usupported = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->templateMonitorConfigurationResolutionCombo),PARAMETER_DEFAULT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo),0); + if (((monitorconfig*)window->config->data)->show_usupported==1){ + yon_gtk_combo_box_fill(window->templateMonitorConfigurationResolutionCombo,videoconfig.resolutions,videoconfig.resolutionssize); + } else { + yon_gtk_combo_box_fill(window->templateMonitorConfigurationResolutionCombo,((monitorconfig*)window->config->data)->resolutionCapabilities,((monitorconfig*)window->config->data)->resolution_size); + + } +} + char *yon_configuration_get_remove_command(char *command){ char *str = NULL; char *dntus = NULL; @@ -382,11 +429,11 @@ void on_monitor_configure(GtkWidget *self,monitor_window *window){ g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationSaveButton), "clicked", G_CALLBACK(on_monitor_config_save), monitors); g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change_reversed), monitors->templateMonitorConfigurationBox); g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationParameterLineCheck), "toggled", G_CALLBACK(on_sensitive_change), monitors->templateMonitorConfigurationParameterLineEntry); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationShowUnsupportedCheck), "toggled", G_CALLBACK(on_resolutions_unsupported_show),monitors); + g_signal_connect(G_OBJECT(monitors->templateMonitorConfigurationPortCombo), "changed", G_CALLBACK(on_port_chosen_changed),monitors); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitors->templateMonitorConfigurationEnableCheck),yon_dictionary_get_data(monitors->config,monitorconfig*)->enable==1); - - gtk_window_set_title(GTK_WINDOW(monitors->templateMonitorConfigurationWindow),SETTINGS_VIDEO_TITLE_LABEL); gtk_label_set_text(GTK_LABEL(monitors->templateMonitorConfigurationPortLabel),MONITOR_PORT_LABEL); @@ -464,6 +511,7 @@ void yon_monitor_window_update(monitor_edit_window *window){ if (found==-1) found=0; gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationPortCombo),found); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->templateMonitorConfigurationResolutionCombo),found); found = yon_gtk_combo_box_text_find(window->templateMonitorConfigurationPositionPortCombo, yon_dictionary_get_data(window->config,monitorconfig*)->position_port); if (found==-1) @@ -561,6 +609,15 @@ char *yon_monitor_make_string(monitorconfig* config) first=0; } + char *resolution=""; + if(config->resolution) + if (first==1){ + resolution=config->resolution; + first=0; + }else{ + resolution=yon_char_get_augumented(",",config->resolution); + } + char *enable=""; if (config->enable==1) if (first==1){ @@ -672,15 +729,6 @@ char *yon_monitor_make_string(monitorconfig* config) }else{ gtf=",gtf"; } - - char *resolution=""; - if(config->resolution) - if (first==1){ - resolution=config->resolution; - first=0; - }else{ - resolution=yon_char_get_augumented(",",config->resolution); - } char *frequency=""; @@ -833,6 +881,9 @@ void yon_setup_config(char *configcommand) } videoconfig.resolutions=yon_config_load(get_resolutions_supportable_command,&videoconfig.resolutionssize); + for (int i=0;icvt=0; monitor->reduced=0; monitor->gtf=0; - if (videoconfig.monitors) videoconfig.monitors=yon_dictionary_create_with_data_connected(videoconfig.monitors,port,monitor); else @@ -1063,27 +1113,48 @@ void yon_monitor_view_new(monitor_config monitor){ } } -void yon_monitor_set_resolutions(dictionary *dict){ - yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities=malloc(0); - FILE *resolutions = popen(get_resolutions_command, "r"); - char res[1000]; - memset(res,0,1000); - int size=0; - int last_string=0; - while (fgets(res,1000,resolutions)){ - - int string_n = atoi(yon_char_divide_search(res,":",1)); - if (last_string==0) last_string=string_n-1; - if (last_string==string_n-1){ - yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities=realloc(yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities,(sizeof(char*))*(size+2)); - yon_dictionary_get_data(dict,monitorconfig*)->resolutionCapabilities[size]=yon_char_divide_search(yon_char_new(res),"\n",1); - size++; - last_string=string_n; - } else { - yon_dictionary_get_data(dict,monitorconfig*)->resolution_size=size; - break; +void yon_monitor_set_resolutions(){ + dictionary *dact=NULL; + int size_connected=0; + config_str connected_ports = yon_config_load(get_resolution_ports_command,&size_connected); + int resolutions_size=0; + config_str resolutions = yon_config_load(get_resolutions_command,&resolutions_size); + for (int i=0;iline=resol; + supported->size=0; + yon_dictionary_add_or_create_if_exists_with_data(videoconfig.supported_resolutions,connected_ports[i],supported); + } + config_str final=NULL; + for(int i=0;idata)){ + equals=1; + port_for_res=NULL; + } + if (cur_pos>*((int*)dct->data)&&equals==0) + port_for_res=yon_char_new(dct->key); + } + if(port_for_res){ + dct=yon_dictionary_find(&videoconfig.supported_resolutions,port_for_res); + resolution_supported *sup=yon_dictionary_get_data(dct,resolution_supported*); + sup->size++; + sup->line=realloc(sup->line,sizeof(char*)*sup->size); + sup->line[sup->size-1]=yon_char_new(yon_char_divide_search(resolutions[i],"\n",-1)); } } + } /** void yon_setup_widgets(widgets_dict *widgets) @@ -1248,6 +1319,7 @@ int main(int argc, char *argv[]) // yon_fill_ui(&widgets); yon_ubl_status_box_render(widgets.mainStatusBox, widgets.mainStatusIcon, widgets.mainStatusLabel, _("Configuration has been loaded"), BACKGROUND_IMAGE_SUCCESS_TYPE); on_config_fill_interface(&widgets); + yon_monitor_set_resolutions(); GtkCssProvider *css = gtk_css_provider_new(); gtk_css_provider_load_from_path(css, CssPath, NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index dccebb3..a02998b 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -29,10 +29,11 @@ #define get_ports_command "xrandr |grep -E \"*connected\" |cut -d' ' -f1" #define get_resolutions_command "xrandr |grep -noP \"\\d+x+\\d+\"" +#define get_resolution_ports_command "xrandr |grep -nwP \"connected\" |grep -oE \"[0-9a-zA-Z:]{1,10} connected\" |grep -oE \"[0-9a-zA-Z:]{1,10} \"" #define get_proprietary_drivers_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/video-drivers.csv | grep -E \"-\"" -#define get_resolutions_supportable_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/resolutions.csv |sed 's/,/\t/g'" +#define get_resolutions_supportable_command "cut -d, -f1- /usr/share/ubl-settings-video/csv/resolutions.csv |sed 's/,/ /g'" #define get_frequences_command "xrandr |grep -v -n \"[a-z][a-z]\" |sed 's/ * / /g' |cut -d' ' -f1,3-" @@ -72,6 +73,11 @@ typedef struct { GtkWidget *label; } render_data; +typedef struct { + config_str line; + int size; +} resolution_supported; + typedef struct { config_str loaded_config; @@ -80,6 +86,7 @@ typedef struct monitor_view monitor_visuals; monitor_config monitors; proprietary_config proprietary; + dictionary *supported_resolutions; GtkListStore *list; char *failsafenVidia; char *failsafeATI; @@ -111,6 +118,7 @@ typedef struct int cvt; int reduced; int gtf; + int show_usupported; } monitorconfig; typedef struct { @@ -260,7 +268,7 @@ void on_configuration_save__local_global(GtkWidget *self, widgets_dict *widgets) void on_configuration_save__local(GtkWidget *self, widgets_dict *widgets); void yon_config_monitor_string_parse(char *parameters, int *size); int yon_char_get_if_resolution(char *parsed_string); -void yon_monitor_set_resolutions(dictionary *dict); +void yon_monitor_set_resolutions(); monitor_config yon_monitor_config_new(char *port); void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string); void yon_monitor_view_new(monitor_config monitor); diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 2870909..fd78093 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -858,6 +858,15 @@ int yon_launch(thread_output *thread) // return socket; // }; +int yon_gtk_combo_box_fill(GtkWidget *combo, config_str parameters,int size){ + if (combo&¶meters){ + for (int i=0;idata) +#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) if (!dict) dict=yon_dictionary_create_with_data(key,data); \ + else dict=yon_dictionary_create_with_data_connected(dict,key,data); dictionary *yon_dictionary_create_empty(); @@ -159,6 +161,8 @@ typedef struct // expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...); +int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); + int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index d69248f..dcdaae5 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -904,9 +904,6 @@ - - - True @@ -937,87 +934,6 @@ - - True - True - - - True - False - vertical - - - True - True - 15 - 15 - 6 - multiple - horizontal - liststore5 - 1 - True - - - - 0 - - - - - 0 - True - word - - - 1 - - - - - True - True - 0 - - - - - - - True - False - 5 - - - True - False - 25 - applications-system - - - False - True - 0 - - - - - True - False - Settings - - - False - True - 1 - - - - - - @@ -2296,14 +2212,6 @@ - - radiobutton - True - True - False - True - True - True False -- 2.35.1 From b547aeb869c8649ada43f65aae9d2cf4670e3774 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 28 Apr 2023 12:26:10 +0600 Subject: [PATCH 13/16] Translation description fixes --- ubl-settings-video.pot | 24 ++++++++++++------------ ubl-settings-video_ru.po | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ubl-settings-video.pot b/ubl-settings-video.pot index 5fd3d71..3bc82af 100644 --- a/ubl-settings-video.pot +++ b/ubl-settings-video.pot @@ -1,20 +1,20 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Language translations for ubl-settings-manager package. +# Copyright (C) 2022, UBTech LLC +# This file is distributed under the same license as the ubl-settings-manager package. +# UBLinux Team , 2022 # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-05 10:05+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ubl-settings-manager 1.0\n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-04-21 12:33+0000\n" +"PO-Revision-Date: 2023-01-01 00:00+0600\n" +"Last-Translator: UBLinux Team \n" +"Language-Team: Russian - UBLinux Team \n" +"Language: Russian\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: source/ubl-settings-video.c:26 source/ubl-settings-video.c:223 diff --git a/ubl-settings-video_ru.po b/ubl-settings-video_ru.po index fc99cdd..c4ea148 100644 --- a/ubl-settings-video_ru.po +++ b/ubl-settings-video_ru.po @@ -1,4 +1,4 @@ -# Language translations for ubl-settings-manager package. +# Russian translations for ubl-settings-manager package. # Copyright (C) 2022, UBTech LLC # This file is distributed under the same license as the ubl-settings-manager package. # UBLinux Team , 2022 @@ -7,12 +7,12 @@ msgid "" msgstr "" "Project-Id-Version: ubl-settings-manager 1.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-05 10:05+0000\n" +"Report-Msgid-Bugs-To: info@ublinux.com\n" +"POT-Creation-Date: 2023-04-21 12:33+0000\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" -"Language-Team: UBLinux Team \n" -"Language: \n" +"Language-Team: Russian - UBLinux Team \n" +"Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -- 2.35.1 From d37a44bd2ef8d0b9060b9aad62d95d0f2d9a854d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 28 Apr 2023 12:38:26 +0600 Subject: [PATCH 14/16] Makefile fixes --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 99ecc79..cdfeb0e 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,6 @@ all: init build init: @echo "Initialize ..."; \ sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-video.h; \ - gcc source/ubl-settings-video.c source/ubl-utils.c -o ubl-settings-video `pkg-config --cflags --libs gtk+-3.0` -g; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: @@ -100,29 +99,31 @@ 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 -dm655 "${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}"; \ done @for SIZE in 16 32 48; do \ - install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \ + install -dm655 "${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 -dm655 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/devices/" "com.ublinux.${PKGNAME}.display.svg" @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 -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" - @install -dm755 "${DESTDIR}${PREFIX}/share/applications" + @install -Dm655 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" + @install -dm655 "${DESTDIR}${PREFIX}/share/applications" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" - @install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images} + @install -dm655 "${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}/ui/" "${PKGNAME}-banner.png" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}-banner.png" + @install -Dm744 -d "${DESTDIR}${PREFIX}/share/${PKGNAME}/images" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "${PKGNAME}-banner.png" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/csv/" "resolutions.csv" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/csv/" "video-drivers.csv" @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; \ -- 2.35.1 From 0d78edd63a31a4ab4c2cebc6f841f5843de6db6c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 28 Apr 2023 12:40:33 +0600 Subject: [PATCH 15/16] Fixed banner path; Added commands for proprietary drivers installing, deleting and viewing information --- source/ubl-settings-video.h | 39 +++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index a02998b..f286018 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -14,7 +14,7 @@ #define icon_name "com.ublinux.ubl-settings-video" -#define banner_path "/usr/share/ubl-settings-video/ui/ubl-settings-video-banner.png" +#define banner_path "/usr/share/ubl-settings-video/images/ubl-settings-video-banner.png" #define glade_path "/usr/share/ubl-settings-video/ui/ubl-settings-video.glade" #define LocalePath "/usr/share/locale" @@ -51,6 +51,14 @@ #define remove_drivers_local_command "/usr/bin/ubconfig --target global remove video " +#define install_proprietary_command "pkexec pacman -Sy --noconfirm " + +#define delete_proprietary_command "pkexec pacman -R --noconfirm " + +#define get_info_proprietary_command "pamac-manager --details=" + +#define get_version_proprietary_command "grep \"VERSION_ID=\" /etc/os-release | cut -d= -f2" + #define XORG_MONITOR(port) yon_char_get_augumented(" XORG_MONITOR[",yon_char_get_augumented(port,"] ")) @@ -67,11 +75,7 @@ typedef dictionary* proprietary_config; typedef dictionary* monitor_view; -typedef struct { - GtkWidget *icon; - GtkWidget *box; - GtkWidget *label; -} render_data; + typedef struct { config_str line; @@ -198,6 +202,29 @@ typedef struct GtkWidget *templateMonitorConfigurationParameterLineEntry; GtkWidget *templateMonitorConfigurationDoNotSwitchOffLabel; GtkWidget *templateMonitorConfigurationDoNotSwitchOffCheck; + + GtkWidget *proprietaryTreeView; + GtkWidget *proprietaryInfoButton; + GtkWidget *proprietaryDeleteButton; + GtkWidget *proprietaryInstallButton; + GtkTreeSelection *proprietaryTreeSelection; + GtkWidget *driversTreeView; + GtkWidget *driversInfoButton; + GtkWidget *driversDeleteButton; + GtkWidget *driversInstallButton; + GtkTreeSelection *driversTreeSelection; + + GtkTreeViewColumn *proprietartInstalledColumn; + GtkTreeViewColumn *ProprietaryPackageColumn; + GtkTreeViewColumn *ProprietaryDriverColumn; + GtkTreeViewColumn *ProprietaryDescriptionColumn; + GtkTreeViewColumn *ProprietarySupportedColumn; + + GtkTreeViewColumn *driverInstalledColumn; + GtkTreeViewColumn *driverPackageColumn; + GtkTreeViewColumn *driverDriverColumn; + GtkTreeViewColumn *driverDescriptionColumn; + GtkTreeViewColumn *driverSupportedColumn; } widgets_dict; typedef struct -- 2.35.1 From 30cc4f3232df461192eafb2ffac084cf5d45d0d4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 28 Apr 2023 12:46:44 +0600 Subject: [PATCH 16/16] Makefile fixes --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cdfeb0e..b83b2ea 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,7 @@ uninstall: @$(RM) "${DESTDIR}/etc/xdg/${PKGNAME}/${PKGNAME}.conf" @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" + @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}/images" @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ @@ -120,7 +121,7 @@ install: check uninstall @install -dm655 "${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 -Dm744 -d "${DESTDIR}${PREFIX}/share/${PKGNAME}/images" + @install -dm655 "${DESTDIR}${PREFIX}/share/${PKGNAME}/images" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "${PKGNAME}-banner.png" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/csv/" "resolutions.csv" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/csv/" "video-drivers.csv" -- 2.35.1