box_help 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. #
  3. #This box shows text in /tmp/box_help
  4. #markup/span is valid
  5. #
  6. #usage :
  7. # box_help HEADING [URL|ICON]
  8. #
  9. # HEADING is a short description. Maybe the app-name of the sender.
  10. # URL is a link to a html-page (local or web), or a clean text file.
  11. # ICON is a svg file. If path is not defined, /usr/share/pixmaps/puppy/ will be used
  12. #
  13. #Sigmund Berglund, dec 2013
  14. #GPL
  15. export TEXTDOMAIN=libstardust
  16. ICON=help.svg
  17. ICON_WM=gtk-help
  18. HEADING="$(gettext 'Puppy Help')"
  19. if [ "`grep "svg$" <<< "$2"`" ]; then
  20. ICON="$2"
  21. elif [ "`grep "svg$" <<< "$3"`" ]; then
  22. ICON="$3"
  23. elif [ "$2" ]; then
  24. XML_URL='
  25. <vbox space-expand="false" space-fill="false">
  26. <hbox border-width="10" space-expand="true" space-fill="true">
  27. <text space-expand="true" space-fill="true"><label>""</label></text>
  28. <eventbox space-expand="false" space-fill="false">
  29. <text use-markup="true" space-expand="false" space-fill="false">
  30. <variable>URL</variable>
  31. <label>"<b><u><span color='"'#004BDD'"'>'$(gettext 'Further reading')'</span></u></b>"</label>
  32. </text>
  33. <action signal="enter-notify-event">disable:URL</action>
  34. <action signal="leave-notify-event">enable:URL</action>
  35. <action signal="button-release-event">defaulthtmlviewer '$2'</action>
  36. </eventbox>
  37. </hbox>
  38. </vbox>'
  39. fi
  40. if [ "`grep -F 'info.svg' <<< "$ICON"`" ]; then
  41. ICON_WM=gtk-file
  42. HEADING="$(gettext 'Puppy Info')"
  43. fi
  44. export Help='
  45. <window title="'$HEADING'" icon-name="'$ICON_WM'" default-height="500" default-width="500">
  46. <vbox space-expand="true" space-fill="true">
  47. '"`/usr/lib/gtkdialog/xml_info fixed $ICON 60 "<b>$HEADING</b>" "$1"`"'
  48. '$XML_URL'
  49. <vbox space-expand="true" space-fill="true">
  50. <vbox scrollable="true" shadow-type="3" space-expand="true" space-fill="true">
  51. <vbox space-expand="false" space-fill="false">
  52. <text xpad="10" ypad="15" use-markup="true"><input file>/tmp/box_help</input></text>
  53. </vbox>
  54. </vbox>
  55. </vbox>
  56. <hbox space-expand="false" space-fill="false">
  57. <button>
  58. '"`/usr/lib/gtkdialog/xml_button-icon ok`"'
  59. <label>'$(gettext 'Ok')'</label>
  60. </button>
  61. </hbox>
  62. </vbox>
  63. </window>'
  64. . /usr/lib/gtkdialog/xml_info gtk
  65. gtkdialog --center -p Help