diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7eaca04 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.vscode/ +ubl-settings-video +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 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..42867fb --- /dev/null +++ b/Makefile @@ -0,0 +1,159 @@ +#!/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; \ + 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 -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" + @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" + @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/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) 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 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.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/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/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..724558e --- /dev/null +++ b/source/ubl-settings-video.c @@ -0,0 +1,438 @@ +#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_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)); + + 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){ + +} +void on_save_configuration_global(GtkWidget *self){ + +} +void on_load_configuration_local(GtkWidget *self){ + +} +void on_load_configuration_global(GtkWidget *self){ + +} + +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 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,","))){ + 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_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=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); + } + 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 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); + } + } +} + +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){ + 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); + 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); + + 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(){ + 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; +} + +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"); + + 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: ")); + 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")); + 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); + // 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"); + 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(), + 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..56b9fc6 --- /dev/null +++ b/source/ubl-settings-video.h @@ -0,0 +1,184 @@ +#include +#include +#include +#include +#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" +#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") + +#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; + +string version_application = "1.0"; + + + +#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; + GtkWidget *mainPlugBox; + GtkWidget *mainErrorBox; + GtkWidget *mainHeadOverlay; + GtkWidget *mainHeadBackgroundImage; + GtkWidget *mainDriverAutomaticallyChooseCheck; + GtkWidget *mainDriverProprietaryDriverLabel; + GtkWidget *mainDriverFailsafeNvidiaLabel; + GtkWidget *mainDriverFailsafeAMDLabel; + GtkWidget *mainDriverProprietaryDriverCombo; + GtkWidget *mainDriverProprietaryDriverButton; + GtkWidget *mainExtraFixGapCombo; + 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; + dictionary *curconfig; +} 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..d2088df --- /dev/null +++ b/source/ubl-utils.c @@ -0,0 +1,620 @@ +#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 + +/** + * 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){} +} + +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){} + 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=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; + 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){ + dict=dict->first; + int i=0; + for (i=0;inext) + dict=dict->next; + else break; + if (i==place) 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); + 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); + memcpy(newchar,chr,strlen(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); + memset(cut,0,size+1); + 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); + 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, + * 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; + 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(); + 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; + 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__ + +// 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){ + 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; +} + +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 new file mode 100644 index 0000000..d0c1049 --- /dev/null +++ b/source/ubl-utils.h @@ -0,0 +1,188 @@ +#ifndef UBL_UTILS +#define UBL_UTILS +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DesktopPath "/usr/share/applications/" + +#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, + 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_create_empty(); + +dictionary * yon_dictionary_create_conneced(dictionary *targetdict); + +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); + +char *yon_config_load(char *command); + +int yon_config_save(char *command); + +//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 { + 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); + + +#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-banner.png b/ubl-settings-video-banner.png new file mode 100644 index 0000000..8eb67cb Binary files /dev/null and b/ubl-settings-video-banner.png differ diff --git a/ubl-settings-video.css b/ubl-settings-video.css new file mode 100644 index 0000000..499b1e8 --- /dev/null +++ b/ubl-settings-video.css @@ -0,0 +1,103 @@ +.noborder { + border:none; +} +.thin { + 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, +-0.5px 0 0.5px @theme_bg_color, +0 -0.5px 0.5px @theme_bg_color; +} +.nobackground { + background: none; +} +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + + .menuitemtop{ + margin-bottom:0px; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop *{ + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + border:transparent; + } + .menuitemmiddle *{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitembottom *{ + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + } + .menuitemtop:hover { + background:@theme_bg_color; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle:hover { + background:@theme_bg_color; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitembottom:hover { + background:@theme_bg_color; + border-color:inherit; + border-bottom-width:0px; + border-left-width:inherit; + border-right-width:inherit; + + } + .menuitemtop:hover* { + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitemmiddle:hover* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitembottom:hover* { + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + + .boxInfoMessError{ + background-color: #ea9999; +} + +.boxInfoMessOK{ + background-color: #f3f0ac; +} \ No newline at end of file diff --git a/ubl-settings-video.desktop b/ubl-settings-video.desktop new file mode 100644 index 0000000..4b2a3ed --- /dev/null +++ b/ubl-settings-video.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=ubl-settings-video +Name[ru]=Настройки Видеовывода +GenericName=ubl-settings-video +GenericName[ru]=Настройки Видеовывода +Comment=ubl-settings-video +Comment[ru]=Приложение для управления настройками видеовывода для UBLinux +Type=Application +Exec=ubl-settings-video +Icon=com.ublinux.ubl-settings-video +Terminal=false +X-XfcePluggable=true +X-UBLPluggable=true +Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade new file mode 100644 index 0000000..5be249b --- /dev/null +++ b/ubl-settings-video.glade @@ -0,0 +1,1918 @@ + + + + + + + + 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 + + + + + + + + + + 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 + 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 + + + + + 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 + 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 + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + 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 + + + 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 + radioMainMonitor + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 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 + 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 + False + True + center + + + True + True + 1 + + + + + False + True + 3 + + + + + True + False + + + + + + True + True + 4 + + + + + True + False + + + False + True + 5 + + + + + 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 + 6 + + + + + 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..369eeae --- /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-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" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: source/ubl-settings-video.c:151 +msgid "About" +msgstr "" + +#: source/ubl-settings-video.c:143 +msgid "Automatically choose and use driver" +msgstr "" + +#: source/ubl-settings-video.c:153 +msgid "Change" +msgstr "" + +#: source/ubl-settings-video.c:131 +msgid "Configuration method" +msgstr "" + +#: source/ubl-settings-video.c:41 +msgid "DPMS off" +msgstr "" + +#: source/ubl-settings-video.c:37 +msgid "Do not switch display off" +msgstr "" + +#: source/ubl-settings-video.c:150 +msgid "Documentation" +msgstr "" + +#: source/ubl-settings-video.c:130 +msgid "Driver" +msgstr "" + +#: source/ubl-settings-video.c:136 +msgid "Extra" +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.c:129 +msgid "Failsafe driver AMD/ATI: " +msgstr "" + +#: source/ubl-settings-video.c:128 +msgid "Failsafe driver nVidia: " +msgstr "" + +#: source/ubl-settings-video.c:135 +msgid "Fix frame gap (nVidia)" +msgstr "" + +#: 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:125 +msgid "Launch programms through (nVidia)" +msgstr "" + +#: source/ubl-settings-video.c:138 +msgid "Load" +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: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:127 +msgid "Proprietary driver: " +msgstr "" + +#: source/ubl-settings-video.c:34 +msgid "Resolution (px): " +msgstr "" + +#: source/ubl-settings-video.c:36 +msgid "Rotation: " +msgstr "" + +#: source/ubl-settings-video.c:139 +msgid "Save" +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.h:19 +msgid "Saving to global configuration Succeeded" +msgstr "" + +#: source/ubl-settings-video.h:20 +msgid "Saving to local configuration Succeeded" +msgstr "" + +#: source/ubl-settings-video.c:137 +msgid "UBlinux Video Configuration" +msgstr "" + +#: source/ubl-settings-video.c:126 +msgid "Video output configuration" +msgstr "" + +#: source/ubl-settings-video.c:133 +msgid "discrete video only (AMD/ATI)" +msgstr "" + +#: 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 new file mode 100644 index 0000000..f21a5f7 --- /dev/null +++ b/ubl-settings-video_ru.po @@ -0,0 +1,213 @@ +# 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-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" +"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: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:209 +msgid "Resolution (px): " +msgstr "Разрешение (px): " + +#: source/ubl-settings-video.c:210 +msgid "Frequency (Hz): " +msgstr "Обновления (Hz): " + +#: source/ubl-settings-video.c:211 +msgid "Rotation: " +msgstr "Вращение: " + +#: source/ubl-settings-video.c:213 +#, fuzzy +msgid "Main monitor" +msgstr "Основной" + +#: source/ubl-settings-video.c:214 +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 +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: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:375 +#, fuzzy +msgid "Proprietary driver: " +msgstr "Проприетарный драйвер: " + +#: source/ubl-settings-video.c:376 +#, fuzzy +msgid "Failsafe driver nVidia: " +msgstr "Отказоучтойчивый драйвер nVidia: " + +#: source/ubl-settings-video.c:377 +#, fuzzy +msgid "Failsafe driver AMD/ATI: " +msgstr "Отказоустойчивый драйвер AMD/ATI: " + +#: source/ubl-settings-video.c:378 +msgid "Driver" +msgstr "Драйвер" + +#: source/ubl-settings-video.c:380 +msgid "Monitor configuration" +msgstr "Настройка экрана" + +#: source/ubl-settings-video.c:381 +msgid "Hybrid graphics" +msgstr "Гибридная графика" + +#: source/ubl-settings-video.c:382 +msgid "Fix frame gap (nVidia)" +msgstr "Исправить разрыв кадров (nVidia)" + +#: source/ubl-settings-video.c:383 +msgid "Extra" +msgstr "Дополнительно" + +#: source/ubl-settings-video.c:385 +msgid "Load" +msgstr "Загрузить" + +#: source/ubl-settings-video.c:386 +msgid "Save" +msgstr "Сохранить" + +#: source/ubl-settings-video.c:388 +msgid "On" +msgstr "Включить" + +#: source/ubl-settings-video.c:389 +msgid "Automatically choose and use driver" +msgstr "Автоматический выбор и использование драйвера" + +#: 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:395 +#, fuzzy +msgid "Load from local configuration" +msgstr "Загрузить локальную конфигуруцию" + +#: source/ubl-settings-video.c:396 +#, fuzzy +msgid "Save to global an local configuration" +msgstr "Сохранить в глобальную и локальную конфигурацию" + +#: source/ubl-settings-video.c:397 +#, fuzzy +msgid "Save to global configuration" +msgstr "Сохранить в глобальную конфигурацию" + +#: source/ubl-settings-video.c:398 +#, fuzzy +msgid "Save to local configuration" +msgstr "Схоранить в локальную конфигурацию" + +#: source/ubl-settings-video.c:399 +#, fuzzy +msgid "Documentation" +msgstr "Справка" + +#: source/ubl-settings-video.c:400 +msgid "About" +msgstr "О программе" + +#: source/ubl-settings-video.c:430 +msgid "Configuration has been loaded" +msgstr "Конфигурация была загружена" + +#: source/ubl-settings-video.h:22 +#, fuzzy +msgid "Failed to load global configuration" +msgstr "Ошибка загрузки глобальной конфигурации" + +#: source/ubl-settings-video.h:23 +#, fuzzy +msgid "Failed to load local configuration" +msgstr "Ошибка загрузки локальной конфигурации" + +#: source/ubl-settings-video.h:25 +#, fuzzy +msgid "Saving to global configuration Succeeded" +msgstr "Успешное сохранение глобальной конфигурации" + +#: source/ubl-settings-video.h:26 +#, fuzzy +msgid "Saving to local configuration Succeeded" +msgstr "Успешное сохранение локальной конфигурации"