[monkey-bubble: 696/753] With shaking hands he wrote cvs commit to merge the branch.



commit 24dd01f758af61d45e22f1a8d716b016f74cb0e0
Author: Anders Carlsson <andersca src gnome org>
Date:   Sun Sep 2 18:39:52 2001 +0000

    With shaking hands he wrote cvs commit to merge the branch.
    
    (Please forgive me if this doesn't work :)

 .cvsignore                                         |   44 -
 ChangeLog                                          |  338 --
 Makefile.am                                        |    4 -
 NEWS                                               |   61 -
 acconfig.h                                         |   10 -
 autogen.sh                                         |   52 -
 configure.in                                       |  104 -
 doc/.cvsignore                                     |    2 -
 doc/ChangeLog                                      |   14 -
 doc/Makefile.am                                    |    1 -
 doc/Porting-1.0-2.0.txt                            |  193 -
 help-converters/docbook/AUTHORS                    |    1 -
 help-converters/docbook/Makefile.am                |   17 -
 help-converters/docbook/README                     |    6 -
 help-converters/docbook/docbook/.cvsignore         |    2 -
 help-converters/docbook/docbook/Makefile.am        |    7 -
 help-converters/docbook/docbook/README             |  107 -
 help-converters/docbook/docbook/VERSION            |    6 -
 help-converters/docbook/docbook/common/.cvsignore  |    2 -
 help-converters/docbook/docbook/common/Makefile.am |   36 -
 help-converters/docbook/docbook/common/ca.xml      |  100 -
 help-converters/docbook/docbook/common/common.xsl  | 1929 ----------
 help-converters/docbook/docbook/common/cs.xml      |  108 -
 help-converters/docbook/docbook/common/da.xml      |   98 -
 help-converters/docbook/docbook/common/de.xml      |   99 -
 help-converters/docbook/docbook/common/el.xml      |  104 -
 help-converters/docbook/docbook/common/en.xml      |  102 -
 help-converters/docbook/docbook/common/es.xml      |   98 -
 help-converters/docbook/docbook/common/et.xml      |  104 -
 help-converters/docbook/docbook/common/fi.xml      |   98 -
 help-converters/docbook/docbook/common/fr.xml      |   99 -
 help-converters/docbook/docbook/common/hu.xml      |   94 -
 help-converters/docbook/docbook/common/id.xml      |  104 -
 help-converters/docbook/docbook/common/it.xml      |  103 -
 help-converters/docbook/docbook/common/ja.xml      |  104 -
 help-converters/docbook/docbook/common/ko.xml      |   96 -
 help-converters/docbook/docbook/common/l10n.dtd    |   25 -
 help-converters/docbook/docbook/common/l10n.xml    |   59 -
 help-converters/docbook/docbook/common/l10n.xsl    |  244 --
 help-converters/docbook/docbook/common/nl.xml      |  105 -
 help-converters/docbook/docbook/common/no.xml      |   97 -
 help-converters/docbook/docbook/common/pl.xml      |   96 -
 help-converters/docbook/docbook/common/pt.xml      |   98 -
 help-converters/docbook/docbook/common/pt_br.xml   |   98 -
 help-converters/docbook/docbook/common/ro.xml      |  104 -
 help-converters/docbook/docbook/common/ru.xml      |  113 -
 help-converters/docbook/docbook/common/sk.xml      |  104 -
 help-converters/docbook/docbook/common/sl.xml      |  104 -
 help-converters/docbook/docbook/common/sv.xml      |   99 -
 help-converters/docbook/docbook/common/zh_cn.xml   |   95 -
 help-converters/docbook/docbook/common/zh_tw.xml   |   98 -
 help-converters/docbook/docbook/html/.cvsignore    |    2 -
 help-converters/docbook/docbook/html/Makefile.am   |   40 -
 help-converters/docbook/docbook/html/admon.xsl     |  149 -
 help-converters/docbook/docbook/html/autotoc.xsl   |  511 ---
 help-converters/docbook/docbook/html/biblio.xsl    |  948 -----
 help-converters/docbook/docbook/html/block.xsl     |  323 --
 help-converters/docbook/docbook/html/callout.xsl   |  127 -
 .../docbook/docbook/html/changebars.xsl            |   73 -
 .../docbook/docbook/html/chunk-common.xsl          |  755 ----
 help-converters/docbook/docbook/html/chunk.xsl     |   67 -
 help-converters/docbook/docbook/html/component.xsl |  277 --
 help-converters/docbook/docbook/html/division.xsl  |  130 -
 help-converters/docbook/docbook/html/docbook.xsl   |  190 -
 help-converters/docbook/docbook/html/ebnf.xsl      |  350 --
 help-converters/docbook/docbook/html/footnote.xsl  |  138 -
 help-converters/docbook/docbook/html/formal.xsl    |   89 -
 help-converters/docbook/docbook/html/glossary.xsl  |  198 -
 help-converters/docbook/docbook/html/graphics.xsl  |  315 --
 help-converters/docbook/docbook/html/html.xsl      |   56 -
 help-converters/docbook/docbook/html/index.xsl     |  478 ---
 help-converters/docbook/docbook/html/info.xsl      |   53 -
 help-converters/docbook/docbook/html/inline.xsl    |  683 ----
 help-converters/docbook/docbook/html/keywords.xsl  |   38 -
 help-converters/docbook/docbook/html/lists.xsl     |  609 ----
 help-converters/docbook/docbook/html/math.xsl      |   22 -
 help-converters/docbook/docbook/html/param.xsl     |  947 -----
 help-converters/docbook/docbook/html/pi.xsl        |  191 -
 help-converters/docbook/docbook/html/qandaset.xsl  |  202 -
 help-converters/docbook/docbook/html/refentry.xsl  |  212 --
 help-converters/docbook/docbook/html/sections.xsl  |  236 --
 help-converters/docbook/docbook/html/synop.xsl     |  939 -----
 help-converters/docbook/docbook/html/table.xsl     |  625 ----
 .../docbook/docbook/html/titlepage.templates.xsl   | 1986 ----------
 help-converters/docbook/docbook/html/titlepage.xsl |  598 ---
 help-converters/docbook/docbook/html/toc.xsl       |   31 -
 help-converters/docbook/docbook/html/verbatim.xsl  |  280 --
 help-converters/docbook/docbook/html/xref.xsl      |  633 ----
 help-converters/docbook/docbook/html/xtchunk.xsl   |   36 -
 help-converters/docbook/docbook/lib/.cvsignore     |    2 -
 help-converters/docbook/docbook/lib/Makefile.am    |    5 -
 help-converters/docbook/docbook/lib/lib.xsl        |  242 --
 .../docbook/gnome-customization/.cvsignore         |    2 -
 .../docbook/gnome-customization/Makefile.am        |    6 -
 .../gnome-customization/gnome-customization.xsl    |  155 -
 help-converters/docbook/gnome-db2html3.c           |  160 -
 help-converters/info/Makefile.am                   |   11 -
 help-converters/info/data.h                        |   56 -
 help-converters/info/html.c                        |  920 -----
 help-converters/info/html.h                        |   25 -
 help-converters/info/main.c                        |  288 --
 help-converters/info/parse.c                       |  523 ---
 help-converters/info/parse.h                       |   27 -
 help-converters/info/utils.c                       |  275 --
 help-converters/info/utils.h                       |   17 -
 help-converters/info/version.h                     |    6 -
 help-converters/man/Makefile.am                    |   10 -
 help-converters/man/README                         |  284 --
 help-converters/man/gnome-man2html.c               | 3846 --------------------
 help-converters/man/man2html.8                     |  259 --
 idl/.cvsignore                                     |    2 -
 idl/ChangeLog                                      |  144 -
 idl/Gnome.idl                                      |   45 -
 idl/Makefile.am                                    |    9 -
 libgnome/.cvsignore                                |   27 -
 libgnome/ChangeLog                                 | 1463 --------
 libgnome/ChangeLog-19991006                        | 2082 -----------
 libgnome/DEPENDS.libgnome                          |    3 -
 libgnome/Makefile.am                               |  176 -
 libgnome/gnome-exec.c                              |  503 ---
 libgnome/gnome-exec.h                              |   78 -
 libgnome/gnome-i18n.h                              |   69 -
 libgnome/gnome-init.c                              |  531 ---
 libgnome/gnome-init.h                              |   66 -
 libgnome/gnome-macros.h                            |   74 -
 libgnome/gnome-marshal-main.c                      |   33 -
 libgnome/gnome-marshal.list                        |    6 -
 libgnome/gnome-preferences.c                       |  130 -
 libgnome/gnome-preferences.h                       |   74 -
 libgnome/gnome-program.c                           | 1331 -------
 libgnome/gnome-program.h                           |  211 --
 libgnome/gnome-score.c                             |  457 +++
 libgnome/gnome-score.h                             |   62 +
 libgnome/gnome-url.c                               |  499 ---
 libgnome/gnome-url.h                               |   90 -
 libgnome/gnome-util.c                              |  210 --
 libgnome/gnome-util.h                              |   78 -
 libgnome/libgnome-2.0.pc.in                        |   11 -
 libgnome/libgnome-boxed.defs                       |    6 -
 libgnome/libgnome.h                                |   44 -
 libgnome/libgnometypes.c                           |   51 -
 libgnome/test-libgnome.c                           |  211 --
 message-of-doom                                    |   24 -
 monikers/.cvsignore                                |   19 -
 monikers/ChangeLog                                 |  198 -
 monikers/Foo.idl                                   |   46 -
 monikers/Makefile.am-50588                         |   78 -
 monikers/foo-dist.desktop                          |   59 -
 monikers/foo-dist.xml                              |   12 -
 monikers/test-ditem.c                              |  243 --
 po/.cvsignore                                      |   11 -
 po/ChangeLog                                       |   63 -
 po/POTFILES.in                                     |    4 -
 po/az.po                                           |   84 -
 po/es.po                                           |  124 -
 po/fr.po                                           |  134 -
 po/it.po                                           |  130 -
 po/nn.po                                           |   88 -
 po/no.po                                           |  134 -
 po/sk.po                                           |   84 -
 po/sv.po                                           |  128 -
 po/ta.po                                           |  143 -
 po/tr.po                                           |  130 -
 po/zh_TW.po                                        |   83 -
 tests/.cvsignore                                   |    9 -
 tests/Makefile.am                                  |   17 -
 tests/test-moniker.c                               |   39 -
 tests/test-storage.c                               |  534 ---
 168 files changed, 519 insertions(+), 37517 deletions(-)
---
diff --git a/libgnome/gnome-score.c b/libgnome/gnome-score.c
new file mode 100644
index 0000000..5e109ad
--- /dev/null
+++ b/libgnome/gnome-score.c
@@ -0,0 +1,457 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+/*
+ * gnome-score.c
+ * originally by Elliot Lee, subsequently bashed around by Nathan Bryant
+ */
+
+#include <config.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <locale.h>
+#ifdef HAVE_SYS_FSUID_H
+#ifdef HAVE_SETFSGID
+#include <sys/fsuid.h>
+#endif
+#endif
+
+#include "gnome-i18nP.h"
+
+#include "gnome-score.h"
+#include "gnome-util.h"
+
+#ifndef NSCORES
+#define NSCORES 10
+#endif
+
+#define SCORE_PATH LIBGNOME_LOCALSTATEDIR "/games"
+
+struct command
+{
+   gfloat score;
+   int level;			/* length of level arg to gnome_score_log
+				 * including null term */
+   gboolean ordering;
+};
+
+struct ascore_t
+{
+   gchar *username;
+   time_t scoretime;
+   gfloat score;
+};
+
+static int outfd = -1, infd = -1;
+static const gchar *defgamename;
+
+/********************** internal functions ***********************************/
+
+static gchar *
+gnome_get_score_file_name (const gchar * progname, const gchar * level)
+{
+   if (level)
+     return g_strconcat (SCORE_PATH "/",
+			    progname, ".", level, ".scores", NULL);
+   else
+     return g_strconcat (SCORE_PATH "/", progname, ".scores", NULL);
+}
+
+/* This must be wrapped in push_c_locale on the caller */
+static void
+print_ascore (struct ascore_t *ascore, FILE * outfile)
+{
+	/* make sure we write values to files in a consistent manner */
+	fprintf (outfile, "%f %ld %s\n", ascore->score,
+		 (long int) ascore->scoretime, ascore->username);
+}
+
+static void
+free_ascore(struct ascore_t *data)
+{
+   g_free(data->username);
+   g_free(data);
+}
+
+/**** log_score
+      Inputs: 'progname' - the program to log a score for
+              'level' - the freeform level identifier
+	      'username' - the username that this score is logged under
+	      'score' - the game score
+	      'ordering' - whether lower scores are better.
+      Outputs: 'retval' - Whether the score got onto the highscore list
+
+      Description: Loads all the existing scores into the 'scores'
+                   list.  Goes through and finds out whether there's a
+                   place for the new score on the high-score list, and
+                   if so, inserts it. Writes out the new high-score list.
+ */
+static gint
+log_score (const gchar * progname, const gchar * level, gchar * username,
+	   gfloat score, gboolean ordering)
+{
+   FILE *infile;
+   FILE *outfile;
+   gchar buf[512], name[512];
+   GList *scores = NULL, *anode;
+   gchar *game_score_file;
+   gfloat ascore;
+   struct ascore_t *anitem, *curscore;
+   int i;
+   gint retval = 1;
+   gint pos;
+
+   game_score_file = gnome_get_score_file_name (progname, level);
+
+   infile = fopen (game_score_file, "r");
+   if (infile)
+     {
+       /* make sure we read values from files in a consistent manner */
+       gnome_i18n_push_c_numeric_locale ();
+       while(fgets(buf, sizeof(buf), infile))
+	 {
+	     long ltime;
+	     i = strlen (buf) - 1;	/* Chomp */
+	     while (isspace (buf[i]))
+	       buf[i--] = '\0';
+
+	     if(sscanf(buf, "%f %ld %s", &ascore, &ltime, name) != 3)
+	       break;
+
+	     anitem = g_new(struct ascore_t, 1);
+	     anitem->score = ascore;
+	     anitem->username = g_strdup (name);
+	     anitem->scoretime = (time_t)ltime;
+	     scores = g_list_append (scores, (gpointer) anitem);
+	  }
+        gnome_i18n_pop_c_numeric_locale ();
+
+	fclose (infile);
+     }
+   
+   anitem = g_new(struct ascore_t, 1);
+   anitem->score = score;
+   anitem->username = g_strdup (username);
+   anitem->scoretime = time (NULL);
+
+   for (pos = 0, anode = scores;
+	pos < NSCORES && anode;
+	pos++, anode = anode->next)
+     {
+	curscore = anode->data;
+	if (ordering)
+	  {
+	     if (curscore->score < anitem->score)
+	       break;
+	  }
+	else
+	  {
+	     if (curscore->score > anitem->score)
+	       break;
+	  }
+     }
+   
+   if (pos < NSCORES)
+     {
+	scores = g_list_insert (scores, anitem, pos);
+	if ((anode = g_list_nth (scores, NSCORES)))
+	  {
+	     free_ascore (anode->data);
+	     scores =
+	       g_list_remove_link (scores, g_list_nth (scores, NSCORES));
+	  }
+	retval = pos + 1;
+     }
+   else
+     retval = 0;
+   
+   /* we dont create the file; it must already exist */
+   truncate (game_score_file, 0);
+   outfile = fopen (game_score_file, "r+");
+   
+   if (outfile)
+     {
+	gnome_i18n_push_c_numeric_locale ();
+	g_list_foreach (scores, (GFunc) print_ascore, outfile);
+	gnome_i18n_pop_c_numeric_locale ();
+	fclose (outfile);
+     }
+   else
+     perror (game_score_file);
+
+   g_free (game_score_file);
+   
+   g_list_foreach (scores, (GFunc) free_ascore, NULL);
+   g_list_free (scores);
+   
+   return retval;
+}
+
+static int
+gnome_score_child (void)
+{
+   struct command cmd;
+   gchar *level;
+   struct passwd *pwd;
+   gint retval;
+#ifdef HAVE_SETFSGID
+   gid_t gid;
+   
+   gid = getegid ();
+   setgid (getgid ());
+   setfsgid (gid);
+#endif
+   pwd = getpwuid (getuid ());
+
+   while (read (STDIN_FILENO, &cmd, sizeof cmd) == sizeof(cmd))
+     {
+	level = g_new (char, cmd.level);
+	if (read (STDIN_FILENO, level, cmd.level) != cmd.level)
+	  return EXIT_FAILURE;
+	if (!*level) {
+	   g_free(level);
+	   level = NULL;
+	}
+	retval = log_score (defgamename, level, pwd->pw_name, cmd.score,
+			    cmd.ordering);
+	if (write(STDOUT_FILENO, &retval, sizeof retval) != sizeof retval)
+	  return EXIT_FAILURE;
+	if (level)
+	  g_free(level);
+     }
+   return EXIT_SUCCESS;
+}
+
+static void 
+drop_perms (void)
+{
+   gid_t gid = getegid ();
+   
+   setregid (getgid (), getgid ());	/* on some os'es (eg linux) this
+					 * incantation will also drop the
+					 * saved gid */
+   /* see if we can set it back -- if we can, saved id wasnt dropped */
+   if (gid != getgid() && !setgid (gid))
+     {
+	if (getuid())
+	  g_warning ("losing saved gid implementation detected, "
+		     "get a real OS :)\n");
+	setgid (getgid ());
+     }
+}
+
+/*********************** external functions **********************************/
+
+/**
+ * gnome_score_init:
+ * @gamename: Identifies the game name.
+ *
+ * GNOME Games should call this routine as the first statement
+ * in main () if they have been installed setgid to the games() group.
+ * 
+ * Returns: 0 on success, returns -1 on failure.
+ *
+ * group privileges are dropped regardless of the status returned.
+ */
+
+gint
+gnome_score_init (const gchar * gamename)
+{
+   int inpipe[2], outpipe[2];
+   
+   /*
+    *creates a child process with which we communicate through a pair of pipes,
+    * then drops privileges.
+    */
+   if (!gamename)
+     gamename = "";
+   if (!(defgamename = g_strdup (gamename)) ||
+       pipe(inpipe))
+     {
+	drop_perms();
+	return -1;
+     }
+   if (pipe (outpipe))
+     {
+	close (inpipe[0]);
+	close (inpipe[1]);
+	drop_perms ();
+	return -1;
+     }
+   outfd = outpipe[1];
+   infd = inpipe[0];
+   switch (fork ())
+     {
+      case 0:
+	if (dup2 (outpipe[0], STDIN_FILENO) == -1 ||
+	    dup2 (inpipe[1], STDOUT_FILENO) == -1)
+	  exit (EXIT_FAILURE);
+	close(inpipe[0]);
+	close(inpipe[1]);
+	close(outpipe[0]);
+	close(outpipe[1]);
+	exit (gnome_score_child ());
+      case -1:
+	close (inpipe[0]);
+	close (inpipe[1]);
+	close (outpipe[0]);
+	close (outpipe[1]);
+	infd = outfd = -1;
+	drop_perms ();
+	return -1;
+     }
+   close(outpipe[0]);
+   close(inpipe[1]);
+   drop_perms ();
+   return 0;
+}
+
+/**
+ * gnome_score_log:
+ * @score: the score achieved by the user in this game
+ * @level: level on which the score was obtained
+ * @higher_to_lower_score_order: biggers is better or not
+ *
+ * Logs a score entry for the user.
+ *
+ * Returns 0 on failure or the status from the gnome-score helper
+ * program.
+ */
+gint
+gnome_score_log (gfloat score,
+		 const gchar * level,
+		 gboolean higher_to_lower_score_order)
+{
+   struct command cmd;
+   gint retval;
+   
+   if (getgid () != getegid ())
+     {
+	g_error ("gnome_score_init must be called first thing in main()\n");
+	abort ();
+     }
+   if (infd == -1 || outfd == -1)
+     return 0;
+   
+   cmd.score = score;
+   if (!level)
+     level = "";
+   cmd.level = strlen (level) + 1;
+   cmd.ordering = higher_to_lower_score_order;
+   
+   if (write (outfd, &cmd, sizeof cmd) != sizeof(cmd) ||
+       write (outfd, level, cmd.level) != cmd.level ||
+       read (infd, &retval, sizeof retval) != sizeof(retval))
+     {
+	close (outfd);
+	close (infd);
+	infd = outfd = -1;
+	return 0;
+     }
+   return retval;
+}
+
+/**
+ * gnome_score_get_notable:
+ * @gamename:   the name of the game we want to fetch information from.
+ * @level:      the level from which we want to pull information.
+ * @names:      an array of strings is returned at the address pointed here
+ * @scores:     an array of gfloats is returned at the address pointed here
+ * @scoretimes: an array of time_t is returned at the address pointed here
+ *
+ * Fetches the most notable players on @gamename at level @level.
+ *
+ * Returns the number of scores returned.  @names, @scores and @scoretime
+ * point to regions that were allocated with g_malloc() with the contents.
+ */
+gint
+gnome_score_get_notable (const gchar * gamename,
+			 const gchar * level,
+			 gchar *** names,
+			 gfloat ** scores,
+			 time_t ** scoretimes)
+{
+   const gchar *realname;
+   gchar buf[512], *buf2;
+   gchar *infile_name;
+   FILE *infile;
+   gint retval;
+   
+   g_return_val_if_fail (names != NULL, 0);
+   g_return_val_if_fail (scores != NULL, 0);
+   
+   if (gamename == NULL)
+     realname = defgamename;
+   else
+     realname = gamename;
+   
+   infile_name = gnome_get_score_file_name (realname, level);
+   
+   infile = fopen (infile_name, "r");
+   g_free (infile_name);
+   
+   if (infile)
+     {
+	*names = g_malloc ((NSCORES + 1) * sizeof (gchar *));
+	*scores = g_malloc ((NSCORES + 1) * sizeof (gfloat));
+	*scoretimes = g_malloc ((NSCORES + 1) * sizeof (time_t));
+	
+        gnome_i18n_push_c_numeric_locale ();
+
+	for (retval = 0;
+	     fgets (buf, sizeof (buf), infile) && retval < NSCORES;
+	     retval++)
+	  {
+	     char *tokp;
+
+	     buf[strlen (buf) - 1] = 0;
+	     buf2 = strtok_r (buf, " ", &tokp);
+	     (*scores)[retval] = atof (buf2);
+	     buf2 = strtok_r (NULL, " ", &tokp);
+	     (*scoretimes)[retval] = atoi (buf2);
+	     buf2 = strtok_r (NULL, "\n", &tokp);
+	     (*names)[retval] = g_strdup (buf2);
+	  }
+	(*names)[retval] = NULL;
+	(*scores)[retval] = 0.0;
+
+        gnome_i18n_pop_c_numeric_locale ();
+
+	fclose (infile);
+     }
+   else
+     {
+	*names = NULL;
+	*scores = NULL;
+	retval = 0;
+     }
+   return retval;
+}
diff --git a/libgnome/gnome-score.h b/libgnome/gnome-score.h
new file mode 100644
index 0000000..3f200f7
--- /dev/null
+++ b/libgnome/gnome-score.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
+ * All rights reserved.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+#ifndef __GNOME_SCORE_H__
+#define __GNOME_SCORE_H__ 1
+
+#include <time.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+/*
+ * gnome_score_init()
+ * creates a child process with which we communicate through a pair of pipes,
+ * then drops privileges.
+ * this should be called as the first statement in main().
+ * returns 0 on success, drops privs and returns -1 on failure
+ */
+
+gint
+gnome_score_init (const gchar * gamename);
+
+/* Returns the position in the top-ten starting from 1, or 0 if it isn't in the table */
+gint
+gnome_score_log(gfloat score,
+		const gchar *level, /* Pass in NULL unless you want to keep
+				       per-level scores for the game */
+		/* Pass in TRUE if higher scores are "better"
+		   in the game */
+		gboolean higher_to_lower_score_order);
+
+
+gint /* Returns number of items in the arrays */
+gnome_score_get_notable(const gchar *gamename, /* Will be auto-determined if NULL */
+			const gchar *level,
+			gchar ***names,
+			gfloat **scores,
+			time_t **scoretimes);
+G_END_DECLS
+
+#endif /* __GNOME_SCORE_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]