Skip to content

Commit

Permalink
Fixed bug in GUI when going back from empty list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxbud committed Apr 24, 2021
1 parent 0d5260a commit 9efa73e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 24 deletions.
2 changes: 1 addition & 1 deletion aerman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Constants.

_VERSION="1.0.0"
_VERSION="1.0.1"

_SCRIPT="$(readlink -f "$(which "$0")")"
_SCRIPTNAME="$(basename "$_SCRIPT")"
Expand Down
80 changes: 57 additions & 23 deletions bin/gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ _mod_install_dialog() {
}

_mod_uninstall_dialog() {
_AERMAN_OUT="$(_list_mods)"
if [ -z "$_AERMAN_OUT" ]; then
_warning_popup "There are no mods."
echo "_mod_menu_dialog"
return
fi
_INPUT="$(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
Expand All @@ -485,7 +491,7 @@ _mod_uninstall_dialog() {
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_mods) \
$_AERMAN_OUT \
)"
if [ ! $? -eq 0 ]; then
echo "_mod_menu_dialog"
Expand All @@ -507,6 +513,12 @@ _mod_uninstall_dialog() {
}

_mod_status_dialog() {
_AERMAN_OUT="$(_list_mods)"
if [ -z "$_AERMAN_OUT" ]; then
_warning_popup "There are no mods."
echo "_mod_menu_dialog"
return
fi
_INPUT="$(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
Expand All @@ -518,7 +530,7 @@ _mod_status_dialog() {
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_mods) \
$_AERMAN_OUT \
)"
if [ ! $? -eq 0 ]; then
echo "_mod_menu_dialog"
Expand Down Expand Up @@ -593,24 +605,28 @@ _modpack_create_dialog() {
echo "_modpack_menu_dialog"
return
fi
_MODS=($(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
--ok-label="$_GO" \
--cancel-label="$_BACK" \
--text="$(_dialog_display "Modpack Create" \
"Which mod(s) would you like to include in \"$_PACKNAME\"?")" \
--multiple \
--separator=" " \
--hide-header \
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_mods) \
))
if [ ! $? -eq 0 ]; then
echo "_modpack_menu_dialog"
return
_AERMAN_OUT="$(_list_mods)"
_MODS=()
if [ -n "$_AERMAN_OUT" ]; then
_MODS=($(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
--ok-label="$_GO" \
--cancel-label="$_BACK" \
--text="$(_dialog_display "Modpack Create" \
"Which mod(s) would you like to include in \"$_PACKNAME\"?")" \
--multiple \
--separator=" " \
--hide-header \
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_mods) \
))
if [ ! $? -eq 0 ]; then
echo "_modpack_menu_dialog"
return
fi
fi
_INC_AMOUNT=$((100 / (${#_MODS[@]} + 1)))
_CUR_AMOUNT=0
Expand Down Expand Up @@ -655,6 +671,12 @@ _modpack_create_dialog() {
}

_modpack_uninstall_dialog() {
_AERMAN_OUT="$(_list_modpacks)"
if [ -z "$_AERMAN_OUT" ]; then
_warning_popup "There are no modpacks."
echo "_modpack_menu_dialog"
return
fi
_INPUT="$(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
Expand All @@ -668,7 +690,7 @@ _modpack_uninstall_dialog() {
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_modpacks) \
$_AERMAN_OUT \
)"
if [ ! $? -eq 0 ]; then
echo "_modpack_menu_dialog"
Expand All @@ -690,6 +712,12 @@ _modpack_uninstall_dialog() {
}

_modpack_edit_dialog() {
_AERMAN_OUT="$(_list_modpacks)"
if [ -z "$_AERMAN_OUT" ]; then
_warning_popup "There are no modpacks."
echo "_modpack_menu_dialog"
return
fi
_INPUT="$(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
Expand All @@ -701,7 +729,7 @@ _modpack_edit_dialog() {
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_modpacks) \
$_AERMAN_OUT \
)"
if [ ! $? -eq 0 ]; then
echo "_modpack_menu_dialog"
Expand Down Expand Up @@ -731,6 +759,12 @@ _modpack_edit_dialog() {
}

_modpack_run_dialog() {
_AERMAN_OUT="$(_list_modpacks)"
if [ -z "$_AERMAN_OUT" ]; then
_warning_popup "There are no modpacks."
echo "_modpack_menu_dialog"
return
fi
_INPUT="$(zenity \
--title="$_TITLE" --width="$_WIDTH" --height="$_HEIGHT" \
--list \
Expand All @@ -742,7 +776,7 @@ _modpack_run_dialog() {
--hide-column=1 \
--column="key" \
--column="desc" \
$(_list_modpacks) \
$_AERMAN_OUT \
)"
if [ ! $? -eq 0 ]; then
echo "_modpack_menu_dialog"
Expand Down

0 comments on commit 9efa73e

Please sign in to comment.