From 11eefbc594c73b7d45f95904414db82ac7d02ae3 Mon Sep 17 00:00:00 2001 From: Htylol Date: Wed, 24 Jul 2024 18:39:17 +0500 Subject: [PATCH] Added gui_edit_db_file --- data_from_portwine/scripts/functions_helper | 31 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 01710fd..be8ada1 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -1375,7 +1375,7 @@ pw_init_db () { else if [[ "${PW_DISABLED_CREATE_DB}" != 1 ]] ; then if [[ ! -z "${PORTWINE_DB}" ]] ; then - export PORTWINE_DB_FILE=$(grep -il "\#${PORTWINE_DB}.exe" "${PORT_SCRIPTS_PATH}/portwine_db"/*) + export PORTWINE_DB_FILE=$(grep -il "#${PORTWINE_DB}.exe" "${PORT_SCRIPTS_PATH}/portwine_db"/*) if [[ -z "${PORTWINE_DB_FILE}" ]] ; then { echo "#!/usr/bin/env bash" @@ -3538,7 +3538,10 @@ gui_edit_db () { if check_wayland_session ; then rm_from_var PW_EDIT_DB_LIST "PW_USE_US_LAYOUT" + else + rm_from_var PW_EDIT_DB_LIST "PW_USE_NATIVE_WAYLAND" fi + if check_flatpak ; then rm_from_var PW_EDIT_DB_LIST "PW_USE_RUNTIME" fi @@ -3770,8 +3773,8 @@ A brief instruction: exit 0 ;; 150) - xdg-open "${PORTWINE_DB_FILE}" & - exit 0 + print_info "Restarting PP after update ppdb file..." + gui_edit_db_file ;; esac } @@ -5230,6 +5233,28 @@ gui_open_user_conf () { } export -f gui_open_user_conf +gui_edit_db_file () { + GUI_EDIT_DB_FILE="$("${pw_yad}" --title="$(gettext "EDIT DB")" \ + --text-info --editable --width=800 --height=600 \ + --window-icon="$PW_GUI_ICON_PATH/portproton.svg" \ + --button="$(gettext "SETTINGS")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"":1 \ + --button="$(gettext "SAVE")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"":2 \ + --filename="${PORTWINE_DB_FILE}" 2>/dev/null)" + YAD_STATUS="$?" + + case "$YAD_STATUS" in + 1|252) + /usr/bin/env bash -c ${pw_full_command_line[*]} & + exit 0 + ;; + 2) + echo "${GUI_EDIT_DB_FILE}" > "${PORTWINE_DB_FILE}" + /usr/bin/env bash -c ${pw_full_command_line[*]} & + exit 0 + ;; + esac +} + gui_open_scripts_from_backup () { cd "${PORT_WINE_TMP_PATH}/scripts_backup/" || fatal PW_SCRIPT_FROM_BACKUP=$("${pw_yad}" --file --width=650 --height=500 \