+static void
+make_demo_dialog (Widget toplevel_shell, prefs_pair *pair)
+{
+ saver_preferences *p = pair->a;
+ /* saver_preferences *p2 = pair->b; */
+ Widget parent = toplevel_shell;
+#ifdef HAVE_MOTIF
+ screenhack **hacks = p->screenhacks;
+#endif /* HAVE_MOTIF */
+
+ create_demo_dialog (parent,
+ DefaultVisualOfScreen (widget_screen (parent)),
+ DefaultColormapOfScreen (widget_screen (parent)));
+
+ format_into_label (label1, short_version);
+ add_button_callback (next, next_cb, (POINTER) p);
+ add_button_callback (prev, prev_cb, (POINTER) p);
+ add_button_callback (done, quit_cb, (POINTER) p);
+ if (restart)
+ add_button_callback(restart,restart_cb, (POINTER) p);
+ add_button_callback (edit, preferences_cb, (POINTER) pair);
+
+#ifdef HAVE_MOTIF
+ XtAddCallback (demo_list, XmNbrowseSelectionCallback,
+ select_cb, (POINTER) p);
+ XtAddCallback (demo_list, XmNdefaultActionCallback,
+ select_cb, (POINTER) p);
+ XtAddCallback (text_line, XmNactivateCallback, text_cb, (POINTER) p);
+
+ if (hacks)
+ for (; *hacks; hacks++)
+ {
+ char *hs = format_hack (*hacks, False);
+ XmString xmstr = XmStringCreate (hs, XmSTRING_DEFAULT_CHARSET);
+ XmListAddItem (demo_list, xmstr, 0);
+ XmStringFree (xmstr);
+ free (hs);
+ }
+
+#elif defined(HAVE_ATHENA)
+
+ /* Hook up the text line. */
+
+ XtAppAddActions(XtWidgetToApplicationContext(text_line),
+ actions, XtNumber(actions));
+ XtOverrideTranslations(text_line, XtParseTranslationTable(translations));
+
+
+ /* Must realize the widget before populating the list, or the dialog
+ will be as wide as the longest string.
+ */
+ XtRealizeWidget (demo_dialog);
+
+ set_hack_list (demo_list, p);
+ XtAddCallback (demo_list, XtNcallback, select_cb, p);
+
+ /* Now that we've populated the list, make sure that the list is as
+ wide as the dialog itself.
+ */
+ {
+ Widget viewport = XtParent(demo_list);
+ Widget subform = XtParent(viewport);
+ Widget box = XtNameToWidget(demo_dialog, "*box");
+ Widget label1 = XtNameToWidget(demo_dialog, "*label1");
+ Widget label2 = XtNameToWidget(demo_dialog, "*label2");
+ Dimension x=0, y=0, w=0, h=0, bw=0, w2=0;
+ XtVaGetValues(subform,
+ XtNwidth, &w, XtNheight, &h, XtNborderWidth, &bw, 0);
+ XtVaGetValues(box, XtNwidth, &w2, 0);
+ if (w2 != w)
+ XtResizeWidget(subform, w2, h, bw);
+
+ /* Why isn't the viewport getting centered? */
+ XtVaGetValues(viewport,
+ XtNx, &x, XtNy, &y, XtNheight, &h, XtNborderWidth, &bw, 0);
+ XtConfigureWidget(viewport, x, y, w2-x-x, h, bw);
+
+ /* And the text line, too. */
+ XtVaGetValues(text_line,
+ XtNwidth, &w, XtNheight, &h, XtNborderWidth, &bw, 0);
+ XtVaGetValues(viewport, XtNwidth, &w2, 0);
+ if (w2 != w)
+ XtResizeWidget(text_line, w2, h, bw);
+
+ /* And the labels too. */
+ XtVaGetValues(label1,
+ XtNwidth, &w, XtNheight, &h, XtNborderWidth, &bw, 0);
+ if (w2 != w)
+ XtResizeWidget(label1, w2, h, bw);
+
+ XtVaGetValues(label2,
+ XtNwidth, &w, XtNheight, &h, XtNborderWidth, &bw, 0);
+ if (w2 != w)
+ XtResizeWidget(label2, w2, h, bw);
+
+ }
+
+#endif /* HAVE_ATHENA */
+
+ scroll_to_current_hack (demo_dialog);
+
+ pop_up_dialog_box(demo_dialog, demo_form);
+
+#if defined(HAVE_ATHENA)
+ /* For Athena and Gtk, have to do this after the dialog is managed. */
+ ensure_selected_item_visible (demo_list);
+#endif /* HAVE_ATHENA */