| [Freeciv-Dev]  Client options / Xaw and GTK code sharing[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 Hi all,
I was looking into adding another clientside option, and found that
the Xaw and GTK option dialogs share no code (or data), that I could
find.  Would it not be easier to change the list of options in the
future, if it was shared code?
I was thinking something along the lines of
  struct client_option {
    char *name,
    char *description,  // for the popup dialog
    void (*handler)(char *name, int selected);
  };
  struct client_option  options[] = {
    { "solid_bg", "Solid unit background", default_option_handler },
    { "wom", "Show Workers-on-map for new cities", default_option_handler },
    ...
  };
  
  void default_option_handler (char *name, int selected)
  {
        // this knows the mapping from names to global variables
  }
Any thoughts?  Should I just stop rambling and go to bed?
Is support for options other than on/off (drop downs come
to mind, as one)?
Sune Kirkeby
 
[Freeciv-Dev]  Client options / Xaw and GTK code sharing,
Sune Kirkeby <=
 
 |  |