[monkey-bubble: 697/753] Merge with foo-branch.



commit c9afb9867afb7414988808ba77e0ae351c23fc5b
Author: Anders Carlsson <andersca src gnome org>
Date:   Sun Sep 2 19:21:19 2001 +0000

    Merge with foo-branch.

 .cvsignore                                      |   37 -
 ChangeLog                                       |  162 -
 Makefile.am                                     |    4 -
 NEWS                                            |   13 -
 acconfig.h                                      |    6 -
 autogen.sh                                      |   52 -
 components/.cvsignore                           |   11 -
 components/ChangeLog                            |   58 -
 components/GNOME_UI_Components.oaf.in           |   11 -
 components/Makefile.am                          |   51 -
 components/libgnomeui-components.c              |   57 -
 configure.in                                    |  102 -
 demos/.cvsignore                                |   11 -
 demos/ChangeLog                                 |   73 -
 demos/Makefile.am                               |   34 -
 demos/animator_demo.c                           |   75 -
 demos/mdi_demo.c                                |  268 -
 demos/test-file-saver.c                         |   53 -
 demos/test-recently-used.c                      |  202 -
 demos/winhints_demo.c                           |  418 -
 doc/.cvsignore                                  |    2 -
 doc/ChangeLog                                   |    5 -
 doc/Makefile.am                                 |    1 -
 doc/Porting-1.0-2.0.txt                         |  276 -
 glade/glade-gnome.c                             | 2121 -----
 images/.cvsignore                               |    3 -
 images/Makefile.am                              |   10 -
 images/gnome-default-dlg.png                    |  Bin 2923 -> 0 bytes
 images/gnome-error.png                          |  Bin 2684 -> 0 bytes
 images/gnome-info.png                           |  Bin 3504 -> 0 bytes
 images/gnome-question.png                       |  Bin 1302 -> 0 bytes
 images/gnome-warning.png                        |  Bin 1968 -> 0 bytes
 libgnomeui/.cvsignore                           |   16 -
 libgnomeui/AUTHORS                              |   24 -
 libgnomeui/ChangeLog                            | 4178 ----------
 libgnomeui/ChangeLog-19990928                   | 9823 -----------------------
 libgnomeui/DEPENDS.libgnomeui                   |    6 -
 libgnomeui/Makefile.am                          |  207 -
 libgnomeui/gnome-about.c                        |   27 -
 libgnomeui/gnome-about.h                        |   58 -
 libgnomeui/gnome-app-helper.c                   | 2689 -------
 libgnomeui/gnome-app-helper.h                   |  742 --
 libgnomeui/gnome-app-util.c                     |  902 ---
 libgnomeui/gnome-app-util.h                     |  147 -
 libgnomeui/gnome-app.c                          |  828 --
 libgnomeui/gnome-app.h                          |  172 -
 libgnomeui/gnome-appbar.c                       |  759 --
 libgnomeui/gnome-appbar.h                       |  138 -
 libgnomeui/gnome-boxed.defs                     |    6 -
 libgnomeui/gnome-canvas-init.c                  |  229 -
 libgnomeui/gnome-canvas-init.h                  |   38 -
 libgnomeui/gnome-client.c                       | 2695 -------
 libgnomeui/gnome-client.h                       |  453 --
 libgnomeui/gnome-color-picker.c                 | 1095 ---
 libgnomeui/gnome-color-picker.h                 |  113 -
 libgnomeui/gnome-component-widget.c             |  273 -
 libgnomeui/gnome-component-widget.h             |   70 -
 libgnomeui/gnome-dateedit.c                     | 1012 ---
 libgnomeui/gnome-dateedit.h                     |   95 -
 libgnomeui/gnome-dialog-util.c                  |  543 --
 libgnomeui/gnome-dialog-util.h                  |  145 -
 libgnomeui/gnome-dialog.c                       | 1170 ---
 libgnomeui/gnome-dialog.h                       |  201 -
 libgnomeui/gnome-druid-page-edge.c              |  739 --
 libgnomeui/gnome-druid-page-edge.h              |  122 -
 libgnomeui/gnome-druid-page-standard.c          |  837 --
 libgnomeui/gnome-druid-page-standard.h          |  109 -
 libgnomeui/gnome-druid-page.c                   |  400 -
 libgnomeui/gnome-druid-page.h                   |   85 -
 libgnomeui/gnome-druid.c                        | 1054 ---
 libgnomeui/gnome-druid.h                        |   93 -
 libgnomeui/gnome-entry.c                        |  735 --
 libgnomeui/gnome-entry.h                        |   98 -
 libgnomeui/gnome-file-entry.c                   |  869 --
 libgnomeui/gnome-file-entry.h                   |  128 -
 libgnomeui/gnome-font-picker.c                  | 1043 ---
 libgnomeui/gnome-font-picker.h                  |  116 -
 libgnomeui/gnome-gconf-ui.c                     |  174 -
 libgnomeui/gnome-gconf-ui.h                     |   41 -
 libgnomeui/gnome-href.c                         |  508 --
 libgnomeui/gnome-href.h                         |   84 -
 libgnomeui/gnome-i18nP.h                        |   57 -
 libgnomeui/gnome-ice.c                          |  144 -
 libgnomeui/gnome-ice.h                          |   44 -
 libgnomeui/gnome-icon-entry.c                   | 1162 ---
 libgnomeui/gnome-icon-entry.h                   |  119 -
 libgnomeui/gnome-icon-list.c                    | 2594 ------
 libgnomeui/gnome-icon-list.h                    |  179 -
 libgnomeui/gnome-icon-sel.c                     |  595 --
 libgnomeui/gnome-icon-sel.h                     |   98 -
 libgnomeui/gnome-image-entry.c                  |  283 -
 libgnomeui/gnome-image-entry.h                  |   74 -
 libgnomeui/gnome-image-selector.c               |  169 -
 libgnomeui/gnome-image-selector.h               |   71 -
 libgnomeui/gnome-macros.h                       |   74 -
 libgnomeui/gnome-messagebox.c                   |  351 -
 libgnomeui/gnome-messagebox.h                   |   82 -
 libgnomeui/gnome-scores.c                       |  570 ++
 libgnomeui/gnome-scores.h                       |  178 +
 libgnomeui/gnome-stock-icons.c                  |  164 -
 libgnomeui/gnome-stock-icons.h                  |   79 -
 libgnomeui/gnome-types.h                        |   53 -
 libgnomeui/gnome-ui-init.c                      |  555 --
 libgnomeui/gnome-ui-init.h                      |   51 -
 libgnomeui/gnome-uidefs.h                       |  107 -
 libgnomeui/gnome-vfs-util.c                     |  293 -
 libgnomeui/gnome-vfs-util.h                     |   71 -
 libgnomeui/gnome-window.c                       |  184 -
 libgnomeui/gnome-window.h                       |   45 -
 libgnomeui/gnome-winhints.c                     |  749 --
 libgnomeui/gnome-winhints.h                     |  196 -
 libgnomeui/gnome.defs                           |  289 -
 libgnomeui/gnome_segv.c                         |  203 -
 libgnomeui/gnometypebuiltins.h                  |   30 -
 libgnomeui/gnometypebuiltins_evals.c            |  249 -
 libgnomeui/gnometypebuiltins_ids.c              |   54 -
 libgnomeui/gnometypebuiltins_vars.c             |   28 -
 libgnomeui/gnometypes.c                         |   16 -
 libgnomeui/libgnomeui-2.0.pc.in                 |   11 -
 libgnomeui/libgnomeui.h                         |   76 -
 libgnomeui/libgnomeui.schemas                   |   42 -
 libgnomeui/libgnomeuiP.h                        |   46 -
 libgnomeui/pixmaps/.cvsignore                   |    5 -
 libgnomeui/pixmaps/Makefile.am                  |   51 -
 libgnomeui/pixmaps/calculator-font.png          |  Bin 1449 -> 0 bytes
 libgnomeui/pixmaps/copyright.txt                |   14 -
 libgnomeui/pixmaps/stock_attach.png             |  Bin 169 -> 0 bytes
 libgnomeui/pixmaps/stock_book_blue.png          |  Bin 572 -> 0 bytes
 libgnomeui/pixmaps/stock_book_green.png         |  Bin 562 -> 0 bytes
 libgnomeui/pixmaps/stock_book_open.png          |  Bin 589 -> 0 bytes
 libgnomeui/pixmaps/stock_book_red.png           |  Bin 567 -> 0 bytes
 libgnomeui/pixmaps/stock_book_yellow.png        |  Bin 571 -> 0 bytes
 libgnomeui/pixmaps/stock_line_in.png            |  Bin 403 -> 0 bytes
 libgnomeui/pixmaps/stock_mail.png               |  Bin 803 -> 0 bytes
 libgnomeui/pixmaps/stock_mail_compose.png       |  Bin 841 -> 0 bytes
 libgnomeui/pixmaps/stock_mail_forward.png       |  Bin 883 -> 0 bytes
 libgnomeui/pixmaps/stock_mail_receive.png       |  Bin 929 -> 0 bytes
 libgnomeui/pixmaps/stock_mail_reply.png         |  Bin 914 -> 0 bytes
 libgnomeui/pixmaps/stock_mail_send.png          |  Bin 948 -> 0 bytes
 libgnomeui/pixmaps/stock_menu_about.png         |  Bin 641 -> 0 bytes
 libgnomeui/pixmaps/stock_menu_blank.png         |  Bin 253 -> 0 bytes
 libgnomeui/pixmaps/stock_mic.png                |  Bin 391 -> 0 bytes
 libgnomeui/pixmaps/stock_midi.png               |  Bin 629 -> 0 bytes
 libgnomeui/pixmaps/stock_multiple_file.png      |  Bin 1843 -> 0 bytes
 libgnomeui/pixmaps/stock_not.png                |  Bin 331 -> 0 bytes
 libgnomeui/pixmaps/stock_scores.png             |  Bin 311 -> 0 bytes
 libgnomeui/pixmaps/stock_table_borders.png      |  Bin 135 -> 0 bytes
 libgnomeui/pixmaps/stock_table_fill.png         |  Bin 601 -> 0 bytes
 libgnomeui/pixmaps/stock_text_bulleted_list.png |  Bin 142 -> 0 bytes
 libgnomeui/pixmaps/stock_text_indent.png        |  Bin 208 -> 0 bytes
 libgnomeui/pixmaps/stock_text_numbered_list.png |  Bin 173 -> 0 bytes
 libgnomeui/pixmaps/stock_text_unindent.png      |  Bin 227 -> 0 bytes
 libgnomeui/pixmaps/stock_timer.png              |  Bin 893 -> 0 bytes
 libgnomeui/pixmaps/stock_timer_stopped.png      |  Bin 963 -> 0 bytes
 libgnomeui/pixmaps/stock_trash_full.png         |  Bin 992 -> 0 bytes
 libgnomeui/pixmaps/stock_volume.png             |  Bin 447 -> 0 bytes
 message-of-doom                                 |   24 -
 po/.cvsignore                                   |   12 -
 po/ChangeLog                                    |  112 -
 po/POTFILES.in                                  |   12 -
 po/az.po                                        |  813 --
 po/es.po                                        |  651 --
 po/fr.po                                        |  817 --
 po/it.po                                        |  502 --
 po/nn.po                                        |  438 -
 po/no.po                                        | 1208 ---
 po/sv.po                                        |  712 --
 po/ta.po                                        |  923 ---
 po/tr.po                                        |  425 -
 po/wa.po                                        |  763 --
 test-gnome/.cvsignore                           |    7 -
 test-gnome/ChangeLog                            |  465 --
 test-gnome/Makefile.am                          |   46 -
 test-gnome/bomb.xpm                             |   39 -
 test-gnome/testdruid.c                          |   46 -
 test-gnome/testgnome.c                          | 1041 ---
 test-gnome/testgnome.h                          |   20 -
 test-gnome/testgnome.xml                        |   33 -
 178 files changed, 748 insertions(+), 59071 deletions(-)
---
diff --git a/libgnomeui/gnome-scores.c b/libgnomeui/gnome-scores.c
new file mode 100644
index 0000000..ca2e256
--- /dev/null
+++ b/libgnomeui/gnome-scores.c
@@ -0,0 +1,570 @@
+/*
+ * 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@
+ */
+
+/*
+ * G(NOME|TK) Scores Widget by Horacio J. Peña <horape compendium com ar>
+ *
+ */
+
+#include <config.h>
+#include "gnome-macros.h"
+
+#include <string.h>
+#include <time.h>
+#include <gtk/gtk.h>
+
+#include "gnome-i18nP.h"
+
+#include <libgnome/gnome-util.h>
+#include <libgnome/gnome-config.h>
+#include <libgnome/gnome-score.h>
+#include <libgnome/gnome-i18n.h>
+
+#include "gnome-scores.h"
+
+struct _GnomeScoresPrivate
+{
+  GtkWidget  *but_clear;
+  GtkTable   *table;
+
+  GtkWidget  *logo_container;
+  GtkWidget  *logo;
+  GtkWidget **label_names;
+  GtkWidget **label_scores;
+  GtkWidget **label_times;
+
+  guint	      n_scores;
+};
+
+static void gnome_scores_class_init (GnomeScoresClass *klass);
+static void gnome_scores_init       (GnomeScores      *scores);
+static void gnome_scores_destroy    (GtkObject        *object);
+static void gnome_scores_finalize   (GObject          *object);
+
+/**
+ * gnome_scores_get_type:
+ *
+ * Returns the GtkType for the GnomeScores widget
+ */
+GNOME_CLASS_BOILERPLATE (GnomeScores, gnome_scores,
+			 GtkDialog, gtk_dialog);
+
+static void 
+gnome_scores_init (GnomeScores *gs)
+{
+	GtkWidget *label;
+
+	gs->_priv = g_new0(GnomeScoresPrivate, 1);
+
+	gtk_window_set_title (GTK_WINDOW (gs), _("Top Ten"));
+
+	gtk_dialog_add_button (GTK_DIALOG (gs),
+			       GTK_STOCK_OK,
+			       GTK_RESPONSE_OK);
+
+	gs->_priv->logo = NULL;
+	gs->_priv->but_clear = NULL;
+
+	gs->_priv->table    = GTK_TABLE( gtk_table_new (0, 3, FALSE) );
+	gtk_table_set_col_spacings (gs->_priv->table, 30);
+	gtk_table_set_row_spacings (gs->_priv->table,  5);
+
+	label = gtk_label_new ( _("User") );
+	gtk_widget_show (label);
+	gtk_table_attach_defaults ( gs->_priv->table, label, 0, 1, 0, 1);
+	label = gtk_label_new ( _("Score") );
+	gtk_widget_show (label);
+	gtk_table_attach_defaults ( gs->_priv->table, label, 1, 2, 0, 1);
+	label = gtk_label_new ( _("Date") );
+	gtk_widget_show (label);
+	gtk_table_attach_defaults ( gs->_priv->table, label, 2, 3, 0, 1);
+
+	gtk_widget_show(GTK_WIDGET(gs->_priv->table));
+
+	gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gs)->vbox),
+			  GTK_WIDGET (gs->_priv->table),
+			  TRUE, TRUE, 0);
+
+	gtk_container_set_border_width (GTK_CONTAINER (gs), 5);
+
+	gtk_signal_connect_object (GTK_OBJECT (gs), "response",
+				   GTK_SIGNAL_FUNC (gtk_widget_destroy),
+				   GTK_OBJECT (gs));
+
+	gs->_priv->logo_container = gtk_hbox_new(FALSE, 0);
+	gtk_widget_show(gs->_priv->logo_container);
+
+	gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gs)->vbox),
+			  gs->_priv->logo_container,
+			  FALSE, FALSE, 0);
+}
+
+static void
+gnome_scores_class_init (GnomeScoresClass *class)
+{
+	GtkObjectClass *object_class;
+	GObjectClass *gobject_class;
+
+	object_class = (GtkObjectClass *) class;
+	gobject_class = (GObjectClass *) class;
+
+	object_class->destroy = gnome_scores_destroy;
+	gobject_class->finalize = gnome_scores_finalize;
+}
+
+static void
+gnome_scores_destroy(GtkObject *object)
+{
+	GnomeScores *gs = GNOME_SCORES(object);
+
+	/* remember, destroy can be run multiple times! */
+
+	g_free(gs->_priv->label_names);
+	gs->_priv->label_names = NULL;
+	g_free(gs->_priv->label_scores);
+	gs->_priv->label_scores = NULL;
+	g_free(gs->_priv->label_times);
+	gs->_priv->label_times = NULL;
+
+	if(GTK_OBJECT_CLASS(parent_class)->destroy)
+		(* GTK_OBJECT_CLASS(parent_class)->destroy) (object);
+}
+
+static void
+gnome_scores_finalize(GObject *object)
+{
+	GnomeScores *gs = GNOME_SCORES(object);
+
+	g_free(gs->_priv);
+	gs->_priv = NULL;
+
+	if(G_OBJECT_CLASS(parent_class)->finalize)
+		(* G_OBJECT_CLASS(parent_class)->finalize) (object);
+}
+
+/**
+ * gnome_scores_construct:
+ * @n_scores: Number of positions.
+ * @names: Names of the players.
+ * @scores: Scores
+ * @times: Time in which the scores were done
+ * @clear: Add a "Clear" Button?
+ *
+ * Description: useful for language bindings and subclassing, not to be used by itself,
+ * see #gnome_scores_new
+ *
+ * Returns:
+ */
+void
+gnome_scores_construct (  GnomeScores *gs,
+			  guint n_scores, 
+			  gchar **names, 
+			  gfloat *scores,
+			  time_t *times,
+			  gboolean clear)
+{
+	gchar     	tmp[10];
+	gchar     	tmp2[256];
+	guint           i;
+
+	gs->_priv->n_scores = n_scores;
+
+	gs->_priv->label_names  = g_malloc(sizeof(GtkWidget*) * n_scores);
+	gs->_priv->label_scores = g_malloc(sizeof(GtkWidget*) * n_scores);
+	gs->_priv->label_times  = g_malloc(sizeof(GtkWidget*) * n_scores);
+
+	for(i=0; i < n_scores; i++) {
+		gs->_priv->label_names[i] = gtk_label_new ( names[i] );
+		gtk_widget_show ( gs->_priv->label_names[i] );
+		gtk_table_attach_defaults ( gs->_priv->table, gs->_priv->label_names[i], 0, 1, i+1, i+2);
+
+		g_snprintf(tmp,sizeof(tmp),"%5.2f", scores[i]);
+		gs->_priv->label_scores[i] = gtk_label_new ( tmp );
+		gtk_widget_show ( gs->_priv->label_scores[i] );
+		gtk_table_attach_defaults ( gs->_priv->table, gs->_priv->label_scores[i], 1, 2, i+1, i+2);
+
+		/* the localized string should fit (after replacing the %a %b
+		   etc) in ~18 chars.
+		   %a is abbreviated weekday, %A is full weekday,
+		   %b %B are abbreviated and full monthname, %Y is year,
+		   %d is day of month, %m is month number, %T full hour,
+		   %H hours, %M minutes, %S seconds
+		*/
+		if(strftime(tmp2, sizeof(tmp2), _("%a %b %d %T %Y"),
+			    localtime( &(times[i]) )) == 0) {
+			/* according to docs, if the string does not fit, the
+			 * contents of tmp2 are undefined, thus just use
+			 * ??? */
+			strcpy(tmp2, "???");
+		}
+		tmp2[sizeof(tmp2)-1] = '\0'; /* just for sanity */
+		gs->_priv->label_times[i] = gtk_label_new ( tmp2 );
+		gtk_widget_show ( gs->_priv->label_times[i] );
+		gtk_table_attach_defaults ( gs->_priv->table, gs->_priv->label_times[i], 2, 3, i+1, i+2);
+  	}
+
+	/* 
+	if(clear) {
+	  gs->_priv->but_clear = gtk_button_new_with_label ( _("Clear") );
+	  gtk_widget_show (gs->_priv->but_clear);
+	  gtk_table_attach_defaults ( GTK_TABLE(hor_table), gs->_priv->but_clear, 3, 4, 0, 1);
+  	}
+	*/
+}
+
+/**
+ * gnome_scores_new:
+ * @n_scores: Number of positions.
+ * @names: Names of the players.
+ * @scores: Scores
+ * @times: Time in which the scores were done
+ * @clear: Add a "Clear" Button?
+ *
+ * Description: Creates the high-scores window.
+ *
+ * Returns: A new #GnomeScores widget
+ */
+GtkWidget * 
+gnome_scores_new (  guint n_scores, 
+		    gchar **names, 
+		    gfloat *scores,
+		    time_t *times,
+		    gboolean clear)
+{
+	GtkWidget *retval = gtk_type_new(gnome_scores_get_type());
+
+	gnome_scores_construct(GNOME_SCORES(retval), n_scores, names, scores, times, clear);
+
+	return retval;
+}
+
+/**
+ * gnome_scores_set_color:
+ * @gs: A #GnomeScores widget
+ * @n: Entry to be changed.
+ * @col: Color.
+ *
+ * Description: Set the color of one entry.
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_color(GnomeScores *gs, guint n, GdkColor *col)
+{
+	GtkStyle *s = gtk_style_new();
+
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(col != NULL);
+	g_return_if_fail(n < gs->_priv->n_scores);
+
+	/* i believe that i should copy the default style
+	   and change only the fg field, how? */
+
+	memcpy((void *) &s->fg[0], col, sizeof(GdkColor) );
+	gtk_widget_set_style(GTK_WIDGET(gs->_priv->label_names[n]), s);
+	gtk_widget_set_style(GTK_WIDGET(gs->_priv->label_scores[n]), s);
+	gtk_widget_set_style(GTK_WIDGET(gs->_priv->label_times[n]), s);
+
+	gtk_style_unref(s);
+}
+
+/**
+ * gnome_scores_set_def_color:
+ * @gs: A #GnomeScores widget
+ * @col: Color
+ *
+ * Description: Set the default color of the entries.
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_def_color(GnomeScores *gs, GdkColor *col)
+{
+	unsigned int i;
+
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(col != NULL);
+
+	for(i=0;i<gs->_priv->n_scores;i++) {
+		gnome_scores_set_color(gs, i, col);
+	}
+}
+
+/**
+ * gnome_scores_set_colors:
+ * @gs: A #GnomeScores widget
+ * @col: Array of colors.
+ *
+ * Description: Set the color of all the entries.
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_colors(GnomeScores *gs, GdkColor *col)
+{
+	unsigned int i;
+
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(col != NULL);
+
+	for(i=0;i<gs->_priv->n_scores;i++) {
+		gnome_scores_set_color(gs, i, col+i);
+	}
+}
+
+/**
+ * gnome_scores_set_current_player:
+ * @gs: A #GnomeScores widget
+ * @i: Index of the current(from 0 to 9).
+ *
+ * Description: Set the index of the current player in top ten.
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_current_player (GnomeScores *gs, gint i)
+{
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(i < gs->_priv->n_scores);
+
+	gtk_widget_set_name(GTK_WIDGET(gs->_priv->label_names[i]), "CurrentPlayer");
+	gtk_widget_set_name(GTK_WIDGET(gs->_priv->label_scores[i]), "CurrentPlayer");
+	gtk_widget_set_name(GTK_WIDGET(gs->_priv->label_times[i]), "CurrentPlayer");
+}
+
+/**
+ * gnome_scores_set_logo_label_title:
+ * @gs: A #GnomeScores widget
+ * @txt: Name of the logo.
+ *
+ * Description: Creates a label to be the logo
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_logo_label_title (GnomeScores *gs, const gchar *txt)
+{
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(txt != NULL);
+
+	if(gs->_priv->logo) {
+		gtk_widget_destroy(gs->_priv->logo);
+		gs->_priv->logo = NULL;
+	}
+
+	gs->_priv->logo = gtk_label_new(txt);
+	gtk_widget_set_name(GTK_WIDGET(gs->_priv->logo), "Logo");
+	gtk_container_add(GTK_CONTAINER(gs->_priv->logo_container), gs->_priv->logo);
+	gtk_widget_show (gs->_priv->logo);
+}
+
+
+/**
+ * gnome_scores_set_logo_label:
+ * @gs: A #GnomeScores widget
+ * @txt: Text in the label.
+ * @font: Font to use in the label.
+ * @col: Color to use in the label.
+ *
+ * Description: Creates a label to be the logo
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_logo_label (GnomeScores *gs,
+			     const gchar *txt,
+			     const gchar *font,
+			     GdkColor *col)
+{
+	GtkStyle *s = gtk_style_new(); /* i believe that i should copy the default style
+					  and change only the fg & font fields, how? */
+	GdkFont *f;
+	const gchar *fo;
+
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+
+	if(gs->_priv->logo) {
+		gtk_widget_destroy(gs->_priv->logo);
+		gs->_priv->logo = NULL;
+	}
+
+	if(col)
+		memcpy((void *) &s->fg[0], col, sizeof(GdkColor) );
+
+	if( font ) 
+		fo = font;
+	else 
+		fo = _("-freefont-garamond-*-*-*-*-30-170-*-*-*-*-*-*,*-r-*");
+
+	if(( f = gdk_fontset_load ( fo ) ))
+		s->font = f;
+
+	gs->_priv->logo = gtk_label_new(txt);
+	gtk_widget_set_style(GTK_WIDGET(gs->_priv->logo), s);
+	gtk_style_unref(s);
+	gtk_container_add(GTK_CONTAINER(gs->_priv->logo_container), gs->_priv->logo);
+	gtk_widget_show (gs->_priv->logo);
+}
+
+/**
+ * gnome_scores_set_logo_widget:
+ * @gs: A #GnomeScores widget
+ * @w: Widget to be used as logo.
+ *
+ * Description:  Set an arbitrary widget to be the logo.
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_logo_widget (GnomeScores *gs, GtkWidget *w)
+{
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(w != NULL);
+	g_return_if_fail(GTK_IS_WIDGET(w));
+
+	if(gs->_priv->logo) {
+		gtk_widget_destroy(gs->_priv->logo);
+		gs->_priv->logo = NULL;
+	}
+
+	gs->_priv->logo = w;
+	gtk_container_add(GTK_CONTAINER(gs->_priv->logo_container), gs->_priv->logo);
+
+	gtk_widget_show(w);
+}
+
+/**
+ * gnome_scores_set_logo_pixmap:
+ * @gs: A #GnomeScores widget
+ * @pix_name: filename of a pixmap
+ *
+ * Description:  Sets the logo on the scores dialog box to a pixmap
+ *
+ * Returns:
+ */
+void
+gnome_scores_set_logo_pixmap (GnomeScores *gs, const gchar *pix_name)
+{
+	g_return_if_fail(gs != NULL);
+	g_return_if_fail(GNOME_IS_SCORES(gs));
+	g_return_if_fail(pix_name != NULL);
+
+	if(gs->_priv->logo) {
+		gtk_widget_destroy(gs->_priv->logo);
+		gs->_priv->logo = NULL;
+	}
+
+	gs->_priv->logo = gtk_image_new_from_file (pix_name);
+	if (gs->_priv->logo != NULL) {
+		gtk_container_add(GTK_CONTAINER(gs->_priv->logo_container),
+				  gs->_priv->logo);
+		gtk_widget_show (gs->_priv->logo);
+	}
+}
+
+/**
+ * gnome_scores_display:
+ * @title: Title of the app to be displayed as logo
+ * @app_name: Name of the application, as in gnome_score_init.
+ * @level: Level of the game or %NULL.
+ * @pos: Position in the top ten of the current player, as returned by gnome_score_log.
+ *
+ * Description:  Does all the work of displaying the best scores. 
+ * It calls gnome_score_get_notables to retrieve the info, creates the window,
+ * and show it.
+ *
+ * Returns:  If a dialog is displayed return it's pointer.  It can also
+ * be %NULL if no dialog is displayed
+ */
+GtkWidget *
+gnome_scores_display (const gchar *title, const gchar *app_name, const gchar *level, int pos)
+{
+	GtkWidget *hs = NULL;
+	gchar **names = NULL;
+	gfloat *scores = NULL;
+	time_t *scoretimes = NULL;
+	gint top;
+
+	top = gnome_score_get_notable(app_name, level, &names, &scores, &scoretimes);
+	if (top > 0) {
+		hs = gnome_scores_new(top, names, scores, scoretimes, 0);
+		gnome_scores_set_logo_label_title (GNOME_SCORES(hs), title);
+		if(pos)
+ 			gnome_scores_set_current_player(GNOME_SCORES(hs), pos-1);
+		
+		gtk_widget_show (hs);
+		g_strfreev(names);
+		g_free(scores);
+		g_free(scoretimes);
+	} 
+
+	return hs;
+}
+
+/**
+ * gnome_scores_display_with_pixmap:
+ * @pixmap_logo: Filename of a logo pixmap to display
+ * @app_name: Name of the application, as in gnome_score_init.
+ * @level: Level of the game or %NULL.
+ * @pos: Position in the top ten of the current player, as returned by gnome_score_log.
+ *
+ * Description:  Does all the work of displaying the best scores. 
+ * It calls gnome_score_get_notables to retrieve the info, creates the window,
+ * and show it.
+ *
+ * Returns:  If a dialog is displayed return it's pointer.  It can also
+ * be %NULL if no dialog is displayed
+ */
+GtkWidget *
+gnome_scores_display_with_pixmap (const gchar *pixmap_logo, const gchar *app_name, const gchar *level, int pos)
+{
+	GtkWidget *hs = NULL;
+	gchar **names = NULL;
+	gfloat *scores = NULL;
+	time_t *scoretimes = NULL;
+	gint top;
+
+	top = gnome_score_get_notable(app_name, level, &names, &scores, &scoretimes);
+	if (top > 0) {
+		hs = gnome_scores_new(top, names, scores, scoretimes, 0);
+		gnome_scores_set_logo_pixmap (GNOME_SCORES(hs), pixmap_logo);
+		if(pos)
+ 			gnome_scores_set_current_player(GNOME_SCORES(hs), pos-1);
+		
+		gtk_widget_show (hs);
+		g_strfreev(names);
+		g_free(scores);
+		g_free(scoretimes);
+	} 
+
+	return hs;
+}
diff --git a/libgnomeui/gnome-scores.h b/libgnomeui/gnome-scores.h
new file mode 100644
index 0000000..b275cc1
--- /dev/null
+++ b/libgnomeui/gnome-scores.h
@@ -0,0 +1,178 @@
+/*
+ * 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@
+ */
+
+/* 
+ * "High Scores" Widget 
+ *
+ * AUTHOR: 
+ * Horacio J. Peña <horape compendium com ar>
+ *
+ * This is free software (under the terms of the GNU LGPL)
+ *
+ * USAGE:
+ * Use the gnome_scores_display. The other functions are going to be
+ * discontinued... (ok, i should add pixmap support to *_display 
+ * before)
+ *
+ * DESCRIPTION:
+ * A specialized widget to display "High Scores" for games. It's 
+ * very integrated with the gnome-score stuff so you only need to
+ * call one function to do all the work...
+ *
+ */
+
+#ifndef GNOME_SCORES_H
+#define GNOME_SCORES_H
+
+#include <time.h>
+#include <gtk/gtk.h>
+
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_SCORES            (gnome_scores_get_type ())
+#define GNOME_SCORES(obj)            (GTK_CHECK_CAST ((obj), GNOME_TYPE_SCORES, GnomeScores))
+#define GNOME_SCORES_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SCORES, GnomeScoresClass))
+#define GNOME_IS_SCORES(obj)         (GTK_CHECK_TYPE ((obj), GNOME_TYPE_SCORES))
+#define GNOME_IS_SCORES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SCORES))
+#define GNOME_SCORES_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_SCORES, GnomeScoresClass))
+
+typedef struct _GnomeScores        GnomeScores;
+typedef struct _GnomeScoresPrivate GnomeScoresPrivate;
+typedef struct _GnomeScoresClass   GnomeScoresClass;
+
+struct _GnomeScores
+{
+  GtkDialog dialog;
+
+  /*< private >*/
+  GnomeScoresPrivate *_priv;
+};
+
+struct _GnomeScoresClass
+{
+  GtkDialogClass parent_class;
+};
+
+guint      gnome_scores_get_type (void) G_GNUC_CONST;
+
+/* Does all the work of displaying the best scores. 
+
+   It calls gnome_score_get_notables to retrieve the info,
+   creates the window, and show it.
+
+   USAGE:
+
+   pos = gnome_score_log(score, level, TRUE);
+   gnome_scores_display (_("Mi game"), "migame", level, pos);
+   */
+GtkWidget *       /* returns the pointer to the displayed window */
+	gnome_scores_display (
+		const gchar *title,    /* Title. */
+		const gchar *app_name, /* Name of the application, as in 
+				    gnome_score_init. */
+		const gchar *level, 	 /* Level of the game or NULL. */
+		int pos		 /* Position in the top ten of the
+				    current player, as returned by
+				    gnome_score_log. */
+		);
+/* Same as above, but with a pixmap logo instead of just text */
+GtkWidget *
+	gnome_scores_display_with_pixmap (const gchar *pixmap_logo,
+					  const gchar *app_name,
+					  const gchar *level,
+					  int pos);
+
+/* Creates the high-scores window. */
+GtkWidget* gnome_scores_new (
+		guint n_scores, 	/* Number of positions. */
+		gchar **names,  	/* Names of the players. */
+		gfloat *scores,		/* Scores */
+		time_t *times, 		/* Time in which the scores were done */
+		gboolean clear		/* Add a "Clear" Button? */
+		);
+
+/* Constructor for bindings / subclassing */
+void gnome_scores_construct (GnomeScores *gs,
+			     guint n_scores, 
+			     gchar **names, 
+			     gfloat *scores,
+			     time_t *times,
+			     gboolean clear);
+
+/* Creates a label to be the logo */
+void gnome_scores_set_logo_label (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		const gchar *txt,	/* Text in the label. */
+		const gchar *font,	/* Font to use in the label. */
+		GdkColor *color		/* Color to use in the label. */
+		);
+
+/* Creates a pixmap to be the logo */
+void gnome_scores_set_logo_pixmap (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		const gchar *logo	/* Name of the .xpm. */
+		);
+
+/* Set an arbitrary widget to be the logo. */
+void gnome_scores_set_logo_widget (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		GtkWidget *w 		/* Widget to be used as logo. */
+		);
+
+/* Set the color of one entry. */
+void gnome_scores_set_color (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		guint pos,		/* Entry to be changed. */
+		GdkColor *col		/* Color. */
+		);
+
+/* Set the default color of the entries. */
+void gnome_scores_set_def_color (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		GdkColor *col		/* Color. */
+		); 
+
+/* Set the color of all the entries. */
+void gnome_scores_set_colors (
+		GnomeScores *gs,	
+		GdkColor *col		/* Array of colors. */
+		);
+
+
+/* Creates a label to be the logo */
+void gnome_scores_set_logo_label_title (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		const gchar *txt	/* Name of the logo. */
+		);
+
+/* Set the index of the current player in top ten. */
+void gnome_scores_set_current_player (
+		GnomeScores *gs,	/* GNOME Scores widget. */
+		gint i			/* Index of the current(from 0 to 9). */
+		);
+G_END_DECLS
+
+#endif /* GNOME_SCORES_H */



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