[monkey-bubble: 48/753] I need automake help: I can not get the signames.h file in programs/gtop/proc to be generated (this



commit bfde5a28856228e8b91737f5be78ec3b6cc1425a
Author: Arturo Espinosa <unammx src gnome org>
Date:   Mon Jan 19 17:42:04 1998 +0000

    I need automake help: I can not get the signames.h file in
    programs/gtop/proc to be generated (this depends on /usr/signal
    contents, and a simple script in the Makefile should create it).
    
    Tom, could you help me?
    
    libgnome/score-helper: fixes as posted from Horacio
    libgnomeui: Add gnome-scores from Horacio
    programs/gnomine: fixes from horacio + score support
    programs/same-gnome: most of the todo implemented
    programs/gtop: Add AUTHORS file
    
    Miguel.

 libgnomeui/.cvsignore             |    6 -
 libgnomeui/Makefile.am            |   47 --
 libgnomeui/gnome-actionarea.c     |   51 --
 libgnomeui/gnome-actionarea.h     |   35 -
 libgnomeui/gnome-app-helper.c     |  118 ----
 libgnomeui/gnome-app-helper.h     |   58 --
 libgnomeui/gnome-app.c            |  478 -------------
 libgnomeui/gnome-app.h            |   72 --
 libgnomeui/gnome-color-selector.c |  310 ---------
 libgnomeui/gnome-color-selector.h |   53 --
 libgnomeui/gnome-colors.c         |  133 ----
 libgnomeui/gnome-colors.h         |   57 --
 libgnomeui/gnome-font-selector.c  | 1327 -------------------------------------
 libgnomeui/gnome-font-selector.h  |  105 ---
 libgnomeui/gnome-ice.c            |   59 --
 libgnomeui/gnome-ice.h            |   13 -
 libgnomeui/gnome-messagebox.c     |  299 ---------
 libgnomeui/gnome-messagebox.h     |   84 ---
 libgnomeui/gnome-pixmap.c         |  184 -----
 libgnomeui/gnome-pixmap.h         |   40 --
 libgnomeui/gnome-properties.c     |   76 ---
 libgnomeui/gnome-properties.h     |   34 -
 libgnomeui/gnome-scores.c         |  235 +++++++
 libgnomeui/gnome-scores.h         |   59 ++
 libgnomeui/gnome-session.c        |  336 ----------
 libgnomeui/gnome-session.h        |  139 ----
 libgnomeui/gnome-stock.c          |  301 ---------
 libgnomeui/gnome-stock.h          |  163 -----
 libgnomeui/gnome-ui-init.c        |   98 ---
 libgnomeui/gtk-clock.c            |  189 ------
 libgnomeui/gtk-clock.h            |   60 --
 libgnomeui/libgnomeui.h           |   22 -
 32 files changed, 294 insertions(+), 4947 deletions(-)
---
diff --git a/libgnomeui/gnome-scores.c b/libgnomeui/gnome-scores.c
new file mode 100644
index 0000000..59b713e
--- /dev/null
+++ b/libgnomeui/gnome-scores.c
@@ -0,0 +1,235 @@
+/*
+ * G(NOME|TK) Scores Widget by Horacio J. Peña <horape compendium com ar>
+ *
+ * Free software (under the terms of the GNU Library General Public License)
+ */
+
+#include "gnome-scores.h"
+#include "libgnome/gnome-defs.h"
+#include "libgnome/gnome-util.h"
+#include "libgnome/gnome-config.h"
+#include "libgnome/gnome-i18n.h"
+
+#include "gtk/gtk.h"
+
+#include "time.h"
+
+static void gnome_scores_class_init (GnomeScoresClass *klass);
+static void gnome_scores_init       (GnomeScores      *scores);
+
+guint
+gnome_scores_get_type ()
+{
+  static guint scores_type = 0;
+
+  if (!scores_type)
+    {
+      GtkTypeInfo scores_info =
+      {
+	"GnomeScores",
+	sizeof (GnomeScores),
+	sizeof (GnomeScoresClass),
+	(GtkClassInitFunc) gnome_scores_class_init,
+	(GtkObjectInitFunc) gnome_scores_init,
+	(GtkArgSetFunc) NULL,
+	(GtkArgGetFunc) NULL,
+      };
+
+      scores_type = gtk_type_unique (gtk_window_get_type (), &scores_info);
+    }
+
+  return scores_type;
+}
+
+static void 
+gnome_scores_init (GnomeScores *gs) {}
+
+static void
+gnome_scores_class_init (GnomeScoresClass *class) {}
+
+GtkWidget * 
+gnome_scores_new (  guint n_scores, 
+		  gchar **names, 
+		  gfloat *scores ,
+                  time_t *times,
+                  guint clear)
+{
+   GtkWidget *retval = gtk_type_new(gnome_scores_get_type());
+   GnomeScores  *gs = GNOME_SCORES(retval); 
+   GtkTable	*table;
+   GtkWidget	*hor_table;
+   GtkWidget	*label;
+   GtkWidget	*hSep;
+   GtkWidget	*button1;
+   gchar     	tmp[10];
+   gchar     	*tmp2;
+   int i;
+
+   gs->logo = 0;
+   gs->but_clear = 0;
+   gs->n_scores = n_scores;
+
+  table    = GTK_TABLE( gtk_table_new (n_scores+1, 3, FALSE) );
+  gtk_table_set_col_spacings (table, 30);
+  gtk_table_set_row_spacings (table,  5);
+
+  label = gtk_label_new ( _("User") );
+  gtk_widget_show (label);
+  gtk_table_attach_defaults ( table, label, 0, 1, 0, 1);
+  label = gtk_label_new ( _("Score") );
+  gtk_widget_show (label);
+  gtk_table_attach_defaults ( table, label, 1, 2, 0, 1);
+  label = gtk_label_new ( _("Date") );
+  gtk_widget_show (label);
+  gtk_table_attach_defaults ( table, label, 2, 3, 0, 1);
+
+  gs->label_names  = g_malloc(sizeof(GtkWidget*)*n_scores);
+  gs->label_scores = g_malloc(sizeof(GtkWidget*)*n_scores);
+  gs->label_times  = g_malloc(sizeof(GtkWidget*)*n_scores);
+
+  for(i=0; i < n_scores; i++) {
+  	gs->label_names[i] = gtk_label_new ( names[i] );
+  	gtk_widget_show ( gs->label_names[i] );
+  	gtk_table_attach_defaults ( table, gs->label_names[i], 0, 1, i+1, i+2);
+
+	snprintf(tmp,10,"%5.2f", scores[i]);
+  	gs->label_scores[i] = gtk_label_new ( tmp );
+  	gtk_widget_show ( gs->label_scores[i] );
+  	gtk_table_attach_defaults ( table, gs->label_scores[i], 1, 2, i+1, i+2);
+
+	tmp2 = ctime( &(times[i]) );
+	tmp2[strlen(tmp2)-1]=0;
+  	gs->label_times[i] = gtk_label_new ( tmp2 );
+  	gtk_widget_show ( gs->label_times[i] );
+  	gtk_table_attach_defaults ( table, gs->label_times[i], 2, 3, i+1, i+2);
+  	}
+  gtk_widget_show (GTK_WIDGET(table));
+
+  button1 = gtk_button_new_with_label ( _("OK") );
+  gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
+                               GTK_SIGNAL_FUNC (gtk_widget_destroy),
+                               GTK_OBJECT (gs));
+  gtk_widget_show (button1);
+  hor_table     = gtk_table_new (1, clear?5:3, TRUE); 
+  gtk_table_attach_defaults ( GTK_TABLE(hor_table), button1, 1, 2, 0, 1);
+  gtk_widget_show (hor_table);
+
+  if(clear) {
+  	gs->but_clear = gtk_button_new_with_label ( _("Clear") );
+  	gtk_widget_show (gs->but_clear);
+  	gtk_table_attach_defaults ( GTK_TABLE(hor_table), gs->but_clear, 3, 4, 0, 1);
+  	}
+
+  gs->vbox = gtk_vbox_new (FALSE, 5);
+  gtk_widget_show (gs->vbox);
+  gtk_box_pack_end (GTK_BOX(gs->vbox), hor_table, TRUE, TRUE, 0);
+  hSep = gtk_hseparator_new ();
+  gtk_widget_show (hSep);
+  gtk_box_pack_end (GTK_BOX(gs->vbox), hSep, TRUE, TRUE, 0);
+  gtk_box_pack_end (GTK_BOX(gs->vbox), GTK_WIDGET(table), TRUE, TRUE, 0);
+  hSep = gtk_hseparator_new ();
+  gtk_widget_show (hSep);
+  gtk_box_pack_end (GTK_BOX(gs->vbox), hSep, TRUE, TRUE, 0);
+
+  gtk_container_add( GTK_CONTAINER(gs), gs->vbox);
+  gtk_window_set_title (GTK_WINDOW (gs), _("Top Ten") );
+  gtk_container_border_width (GTK_CONTAINER (gs), 5);
+
+  return retval;
+}
+
+void
+gnome_scores_set_color(GnomeScores *gs, guint n, GdkColor *col)
+{
+GtkStyle *s = gtk_style_new(); /* 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->label_names[n]), s);
+gtk_widget_set_style(GTK_WIDGET(gs->label_scores[n]), s);
+gtk_widget_set_style(GTK_WIDGET(gs->label_times[n]), s);
+/* Can i free s?, how? */
+}
+
+void
+gnome_scores_set_def_color(GnomeScores *gs, GdkColor *col)
+{
+int i;
+
+for(i=0;i<gs->n_scores;i++) {
+	gnome_scores_set_color(gs, i, col);
+	}
+}
+
+void
+gnome_scores_set_colors(GnomeScores *gs, GdkColor *col)
+{
+int i;
+
+for(i=0;i<gs->n_scores;i++) {
+	gnome_scores_set_color(gs, i, col+i);
+	}
+}
+
+void gnome_scores_set_logo_label (GnomeScores *gs, gchar *txt, 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;
+gchar *fo;
+
+if(gs->logo) {
+	g_print("Warning: gnome_scores_set_logo_* can be called only once\n");
+	return;
+	}
+
+if(col)
+	memcpy((void *) &s->fg[0], col, sizeof(GdkColor) );
+
+if( font ) fo = font;
+else fo = "-freefont-garamond-*-*-*-*-30-170-*-*-*-*-iso8859-1";
+
+if( f = gdk_fontset_load ( fo ) )
+	s->font = f;
+
+gs->logo = gtk_label_new(txt);
+gtk_widget_set_style(GTK_WIDGET(gs->logo), s);
+gtk_box_pack_end (GTK_BOX(gs->vbox), gs->logo, TRUE, TRUE, 0);
+gtk_widget_show (gs->logo);
+}
+
+void gnome_scores_set_logo_widget (GnomeScores *gs, GtkWidget *w)
+{
+
+if(gs->logo) {
+	g_print("Warning: gnome_scores_set_logo_* can be called only once\n");
+	return;
+	}
+
+gs->logo = w;
+gtk_box_pack_end (GTK_BOX(gs->vbox), gs->logo, TRUE, TRUE, 0);
+}
+
+void gnome_scores_set_logo_pixmap (GnomeScores *gs, gchar *pix_name)
+{
+GdkPixmap *pixmap;
+GtkStyle *style;
+GdkBitmap *mask;
+
+if(gs->logo) {
+	g_print("Warning: gnome_scores_set_logo_* can be called only once\n");
+	return;
+	}
+
+style = gtk_widget_get_style( GTK_WIDGET(gs) );
+
+pixmap = gdk_pixmap_create_from_xpm ( GTK_WIDGET(gs)->window, &mask,
+		&style->bg[GTK_STATE_NORMAL],
+		pix_name);
+gs->logo = gtk_pixmap_new (pixmap, mask);
+
+gtk_box_pack_end (GTK_BOX(gs->vbox), gs->logo, TRUE, TRUE, 0);
+gtk_widget_show (gs->logo);
+}
+
diff --git a/libgnomeui/gnome-scores.h b/libgnomeui/gnome-scores.h
new file mode 100644
index 0000000..b16d7f1
--- /dev/null
+++ b/libgnomeui/gnome-scores.h
@@ -0,0 +1,59 @@
+/* 
+ * G(NOME|TK) Scores Widget by Horacio J. Peña <horape compendium com ar>
+ * 
+ * Free software (under the terms of the GNU Library General Public License)
+ */
+
+
+#ifndef GNOME_SCORES_H
+#define GNOME_SCORES_H
+#include <gtk/gtkwindow.h>
+#include <libgnome/gnome-defs.h>
+#include <time.h>
+
+BEGIN_GNOME_DECLS
+
+#define GNOME_SCORES(obj)          GTK_CHECK_CAST (obj, gnome_scores_get_type (), GnomeScores)
+#define GNOME_SCORES_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gnome_scores_get_type (), GnomeScoresClass)
+#define GNOME_IS_SCORES(obj)       GTK_CHECK_TYPE (obj, gnome_scores_get_type ())
+
+typedef struct _GnomeScores        GnomeScores;
+typedef struct _GnomeScoresClass   GnomeScoresClass;
+
+struct _GnomeScores
+{
+  GtkWindow window;
+
+  GtkWidget *but_clear;
+  guint	    n_scores;
+
+  GtkWidget *logo;
+  GtkWidget *vbox;
+  GtkWidget **label_names;
+  GtkWidget **label_scores;
+  GtkWidget **label_times;
+};
+
+struct _GnomeScoresClass
+{
+  GtkWindowClass parent_class;
+};
+
+guint      gnome_scores_get_type (void);
+GtkWidget* gnome_scores_new (guint n_scores, gchar **names, gfloat *scores,
+				time_t *times, guint clear);
+
+void	   gnome_scores_set_logo_label  (GnomeScores *, gchar *, gchar *, GdkColor *);
+void	   gnome_scores_set_logo_pixmap (GnomeScores *, gchar *);
+void	   gnome_scores_set_logo_widget (GnomeScores *, GtkWidget *);
+
+void	   gnome_scores_set_color       (GnomeScores *, guint, GdkColor*);
+void	   gnome_scores_set_def_color   (GnomeScores *, GdkColor*); 
+
+		/* Warning: in gnome_scores_set_colors GdkColor* is an
+		   array, not a pointer as in [set|def]_color */
+void	   gnome_scores_set_colors      (GnomeScores *, GdkColor*); 
+
+END_GNOME_DECLS
+
+#endif /* GNOME_SCORES_H */



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