box_yesno 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. #libstardust
  3. #
  4. #This box shows two button (Yes / No), one icon, and textstring(s)
  5. #markup/span is valid
  6. #
  7. #usage :
  8. # box_yesno HEADING "textstring1" "textstring2" "..."
  9. #
  10. # HEADING is a short description. Maybe the app-name of the sender.
  11. # MSG-TYPE sets icon of icon and window. one of the following: complete, info, error or warning
  12. # ICON is a svg file. If path is not defined, /usr/share/pixmaps/puppy/ will be used
  13. #
  14. #Sigmund Berglund, apr 2014
  15. #GPL
  16. export TEXTDOMAIN=libstardust
  17. HEADING="$1"
  18. S='
  19. <window title="'$HEADING'" icon-name="'$ICON_WM'">
  20. <vbox space-expand="true" space-fill="true">
  21. <frame '$HEADING'>
  22. <hbox homogeneous="true">
  23. '"`/usr/lib/gtkdialog/xml_pixmap "dialog-question" popup`"'
  24. </hbox>
  25. <hbox border-width="10" homogeneous="true">
  26. <vbox space-expand="false" space-fill="false">'
  27. [ "$2" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$2'"</label></text>'
  28. [ "$3" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$3'"</label></text>'
  29. [ "$4" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$4'"</label></text>'
  30. [ "$5" ] && S=$S'<text xalign="0" use-markup="true"><label>"'$5'"</label></text>'
  31. S=$S'</vbox>
  32. </hbox>
  33. </frame>
  34. <hbox space-expand="false" space-fill="false">
  35. <button>
  36. '"`/usr/lib/gtkdialog/xml_button-icon no`"'
  37. <label>" '$(gettext 'No')' "</label>
  38. <action>EXIT:no</action>
  39. </button>
  40. <button>
  41. '"`/usr/lib/gtkdialog/xml_button-icon yes`"'
  42. <label>" '$(gettext 'Yes')' "</label>
  43. <action>EXIT:yes</action>
  44. </button>
  45. </hbox>
  46. </vbox>
  47. </window>'
  48. export box_yesno="$S"
  49. gtkdialog --center -p box_yesno