Complete.Org: Mailing Lists: Archives: freeciv-dev: April 1999:
[Freeciv-Dev] Client options / Xaw and GTK code sharing
Home

[Freeciv-Dev] Client options / Xaw and GTK code sharing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Client options / Xaw and GTK code sharing
From: Sune Kirkeby <sune@xxxxxxxxxxxxx>
Date: Thu, 22 Apr 1999 23:12:28 +0200

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


[Prev in Thread] Current Thread [Next in Thread]