packages.subr (83822902c26f2ef68b0532b163574ee0a166e08f) packages.subr (b5bd0bacd6c7fb453431ffb73c595b4ecb9e8e40)
1if [ ! "$_PACKAGES_PACKAGES_SUBR" ]; then _PACKAGES_PACKAGES_SUBR=1
2#
3# Copyright (c) 2013 Devin Teske
4# All Rights Reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 346 unchanged lines hidden (view full) ---

355
356# f_package_menu_select $category [$page [$defaultitem]]
357#
358# Display list of packages for $category, optionally $page N and with a default
359# item selected. If $page is omitted, the first page is displayed (but this
360# only matters if there are multiple pages; which is determined by the global
361# maximum $PACKAGE_MENU_PAGESIZE).
362#
1if [ ! "$_PACKAGES_PACKAGES_SUBR" ]; then _PACKAGES_PACKAGES_SUBR=1
2#
3# Copyright (c) 2013 Devin Teske
4# All Rights Reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 346 unchanged lines hidden (view full) ---

355
356# f_package_menu_select $category [$page [$defaultitem]]
357#
358# Display list of packages for $category, optionally $page N and with a default
359# item selected. If $page is omitted, the first page is displayed (but this
360# only matters if there are multiple pages; which is determined by the global
361# maximum $PACKAGE_MENU_PAGESIZE).
362#
363# On success, if the user doesn't press ESC or choose Cancel, the environment
364# variable $DIALOG_MENUITEM_$$ will hold the item associated with the chosen
365# tag (accessible through f_dialog_menutag_fetch()).
363# On success, if the user doesn't press ESC or choose Cancel, use
364# f_dialog_menuitem_fetch() to populate a local variable with the item (not
365# tag) corresponding to the user's selection. The tag portion of the user's
366# selection is available through f_dialog_menutag_fetch().
366#
367f_package_menu_select()
368{
369 local category="$1" page="${2:-1}"
370 local prompt= # Calculated below
371 local menu_list # Calculated below
372 local defaultitem="$3"
373 local hline="$hline_arrows_tab_punc_enter"

--- 120 unchanged lines hidden (view full) ---

494 local retval=$?
495 f_dialog_data_sanitize menu_choice
496 f_dialog_menutag_store "$menu_choice"
497
498 if [ $retval -eq $SUCCESS ]; then
499 local item
500 item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \
501 \"\$menu_choice\" $menu_list )
367#
368f_package_menu_select()
369{
370 local category="$1" page="${2:-1}"
371 local prompt= # Calculated below
372 local menu_list # Calculated below
373 local defaultitem="$3"
374 local hline="$hline_arrows_tab_punc_enter"

--- 120 unchanged lines hidden (view full) ---

495 local retval=$?
496 f_dialog_data_sanitize menu_choice
497 f_dialog_menutag_store "$menu_choice"
498
499 if [ $retval -eq $SUCCESS ]; then
500 local item
501 item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \
502 \"\$menu_choice\" $menu_list )
502 setvar DIALOG_MENUITEM_$$ "$item"
503 f_dialog_menuitem_store "$item"
503 fi
504
505 return $retval
506}
507
508# f_package_menu_deselect $package
509#
510# Display a menu, asking the user what they would like to do with $package

--- 223 unchanged lines hidden (view full) ---

734 continue ;; # Do not treat as a package
735 *)
736 setvar _defaultitem_$varcat "$defaultitem"
737 esac
738
739 # Treat any other selection as a package
740 package="${menu_choice# }" # Trim leading space
741 f_str2varname $package varpkg
504 fi
505
506 return $retval
507}
508
509# f_package_menu_deselect $package
510#
511# Display a menu, asking the user what they would like to do with $package

--- 223 unchanged lines hidden (view full) ---

735 continue ;; # Do not treat as a package
736 *)
737 setvar _defaultitem_$varcat "$defaultitem"
738 esac
739
740 # Treat any other selection as a package
741 package="${menu_choice# }" # Trim leading space
742 f_str2varname $package varpkg
742 f_getvar DIALOG_MENUITEM_$$ mark
743 f_dialog_menuitem_fetch mark
743 mark="${mark#?}"
744 mark="${mark%%\] *}"
745 case "$mark" in
746 "I")
747 mark=" "
748 f_package_deselect $package
749 ;;
750 " "|"D")

--- 33 unchanged lines hidden ---
744 mark="${mark#?}"
745 mark="${mark%%\] *}"
746 case "$mark" in
747 "I")
748 mark=" "
749 f_package_deselect $package
750 ;;
751 " "|"D")

--- 33 unchanged lines hidden ---