]> git.draconx.ca Git - rrace.git/blobdiff - src/motif_ui.c
motif: Optimize widget string table a bit.
[rrace.git] / src / motif_ui.c
index c6500311a8264017fd638490e44bd84cffd02cd1..e1b523a0088cae77603c4e204c9318fc1d0b1764 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * X11 GUI for slide puzzle game
- * Copyright © 2022 Nick Bowler
+ * Copyright © 2022-2023 Nick Bowler
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@
 #include "xcounter.h"
 #include "version.h"
 
+#define tree_strtab strtab
+
 /* XXX generate this list? */
 enum {
        widgetMainWindow,
@@ -267,13 +269,13 @@ void ui_initialize(struct app_state *state, Widget shell)
 
        construct_widgets(mainwin, shell, 0);
 
-       menubar = XtNameToWidget(shell, "*menuBar");
+       menubar = XtNameToWidget(shell, &strtab[glob_menuBar]);
        construct_menu(mainmenu, menubar, 0);
 
-       help = XtNameToWidget(menubar, "helpMenu");
+       help = XtNameToWidget(menubar, tree_strtab+helpMenu);
        XtVaSetValues(menubar, XmNmenuHelpWidget, help, (char *)NULL);
 
-       configure_mainwin(state, XtNameToWidget(shell, "*game"));
+       configure_mainwin(state, XtNameToWidget(shell, &strtab[glob_game]));
 
        XtAddCallback(state->game, XmNresizeCallback, resize, state);
        XtAddCallback(state->game, XmNexposeCallback, expose, state);
@@ -304,7 +306,7 @@ void ui_show_about(struct app_state *state, Widget shell)
 
        construct_widgets(dialog, shell, 0);
 
-       w = XtNameToWidget(shell, "*aboutDialog");
+       w = XtNameToWidget(shell, &strtab[glob_aboutDialog]);
        XtUnmanageChild(XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON));
 
        XtAddCallback(w, XmNunmapCallback, dialog_close, NULL);
@@ -322,7 +324,7 @@ void ui_show_about(struct app_state *state, Widget shell)
                         (char *)NULL);
        free(msg);
 
-       l = XtNameToWidget(w, "*licenseBlurb");
+       l = XtNameToWidget(w, &strtab[glob_licenseBlurb]);
        XmTextSetString(l,
 "This program is free software: you can redistribute it and/or modify\n"
 "it under the terms of the GNU General Public License as published by\n"