Re: gnome-about



Fri, Dec 06, 2002 at 01:14:06AM +1300, Mark McLoughlin escribió:

>	So the recent discuss about gnome-about brought
>home how cruft it was looking. So I took Glynn's code
>and did a bit of work on it and committed it to the
>new-gnome-about branch. Its a start. Comments welcome.

	Hi Mark. Some comments here:

	 The foundation logos are displayed in alphabetical order. I think
the companies should prefer a random order (Attached patch)

	The Contributors name is now in a very second place. It's okey that
GNOME is now supported by big companies, but it's wroten by people.
Also the Credits dialog in gnome2 is really horrible (scrolling in both
directions in ugly!). Maybe the old "Brought to you by" code (really
beautiful, and the one you want to show to your mother saying "Ey Mum, I'm
here!") could be merged.

<secret mode>
	And what about the ee?, that puppet...
</secret mode>

Salu2


-- 
Fernando Herrera de las Heras
Onírica: análisis, diseño e implantación de soluciones informáticas
http://www.onirica.com
Index: gnome-about.c
===================================================================
RCS file: /cvs/gnome/gnome-desktop/gnome-about/gnome-about.c,v
retrieving revision 1.45.2.1
diff -u -r1.45.2.1 gnome-about.c
--- gnome-about.c	5 Dec 2002 11:52:03 -0000	1.45.2.1
+++ gnome-about.c	6 Dec 2002 14:24:46 -0000
@@ -87,21 +87,23 @@
 	GnomeCanvas     *canvas;
 } AnimationData;
 
+
 static struct {
 	char *file;
 	char *text;
+	gboolean displayed;
 } foundation_logos [] = {
-	{ "compaq.gif", N_("Compaq") },
-	{ "debian.gif", N_("Debian") },
-	{ "fsf.gif", N_("The Free Software Foundation") },
-	{ "hp.gif", N_("Hewlett-Packard") },
-	{ "ibm.gif", N_("IBM") },
-	{ "mandrakesoft.gif", N_("MandrakeSoft") },
-	{ "osdn.gif", N_("Open Source\nDevelopment Network") },
-	{ "redflag.gif", N_("Red Flag") },
-	{ "redhat.gif", N_("Red Hat") },
-	{ "sun.gif", N_("Sun Microsystems") },
-	{ "ximian.jpg", N_("Ximian") }
+	{ "compaq.gif", N_("Compaq") ,FALSE },
+	{ "debian.gif", N_("Debian"), FALSE },
+	{ "fsf.gif", N_("The Free Software Foundation"), FALSE },
+	{ "hp.gif", N_("Hewlett-Packard"), FALSE },
+	{ "ibm.gif", N_("IBM"), FALSE },
+	{ "mandrakesoft.gif", N_("MandrakeSoft"), FALSE },
+	{ "osdn.gif", N_("Open Source\nDevelopment Network"), FALSE },
+	{ "redflag.gif", N_("Red Flag"), FALSE },
+	{ "redhat.gif", N_("Red Hat"), FALSE },
+	{ "sun.gif", N_("Sun Microsystems"), FALSE },
+	{ "ximian.jpg", N_("Ximian"), FALSE }
 };
 
 static PangoLayout  *global_layout = NULL;
@@ -178,44 +180,40 @@
 }
 
 static GdkPixbuf *
-get_logo_pixbuf (int *iter)
+get_logo_pixbuf (int iter)
 {
 	GdkPixbuf *retval = NULL;
 
-	while (!retval) {
-		GError *error = NULL;
-		char   *image;
-		char   *tmp;
-
-		if (*iter >= G_N_ELEMENTS (foundation_logos))
-			break;
-
-		tmp = g_strdup_printf ("gnome-about/%s",
-				       foundation_logos [*iter].file);
-		image = gnome_program_locate_file (
-				NULL, GNOME_FILE_DOMAIN_PIXMAP,
-				tmp, TRUE, NULL);	
-		g_free (tmp);
-		if (!image) {
-			g_warning (_("Unable to locate '%s'"),
-				   foundation_logos [*iter].file);
-			(*iter)++;
-			continue;
-		}
+	GError *error = NULL;
+	char   *image;
+	char   *tmp;
+
+	if (iter >= G_N_ELEMENTS (foundation_logos))
+		return retval;
+
+	tmp = g_strdup_printf ("gnome-about/%s",
+			       foundation_logos [iter].file);
+	image = gnome_program_locate_file (
+			NULL, GNOME_FILE_DOMAIN_PIXMAP,
+			tmp, TRUE, NULL);	
+	g_free (tmp);
+	if (!image) {
+		g_warning (_("Unable to locate '%s'"),
+			   foundation_logos [iter].file);
+		return retval;
+	}
 	
-		retval = gdk_pixbuf_new_from_file (image, &error);
-		if (error) {
-			g_warning (_("Unable to load '%s': %s"),
-				   foundation_logos [*iter].file,
-				   error->message);
-			g_error_free (error);
-			g_free (image);
-			(*iter)++;
-			continue;
-		}
+	retval = gdk_pixbuf_new_from_file (image, &error);
+	if (error) {
+		g_warning (_("Unable to load '%s': %s"),
+			   foundation_logos [iter].file,
+			   error->message);
+		g_error_free (error);
 		g_free (image);
+		return retval;
 	}
-
+	g_free (image);
+	
 	return retval;
 }
 
@@ -228,15 +226,46 @@
 	int                     logo_width;
 	int                     logo_height;
 	static GnomeCanvasItem *logo = NULL;
-	static int              i = 0;
+	int			showed_logos_count = 0;
+	int			random;
+	int 			logo_num = 0;
+	int			i;
+	int 			aux;
+		                   
+	for (i=0;i < G_N_ELEMENTS (foundation_logos);i++) {
+		if (foundation_logos[i].displayed)
+			showed_logos_count++;
+	}
+	
+	if (showed_logos_count >= G_N_ELEMENTS (foundation_logos)) {
+                gtk_object_destroy (GTK_OBJECT (anim_data->item));
+	        g_free (anim_data);
+		return FALSE;
+	}
+
+        random = rand() % (G_N_ELEMENTS (foundation_logos) - showed_logos_count);
+
+	aux=0;
+	for (i=0;i < G_N_ELEMENTS (foundation_logos);i++) {
+		if (!foundation_logos[i].displayed)
+			aux++;
+		if (aux==random+1) {
+			logo_num = i;
+			break;
+		}
+
+	}
 
-	if (i >= G_N_ELEMENTS (foundation_logos)) {
+	if (logo_num >= G_N_ELEMENTS (foundation_logos)) {
 		gtk_object_destroy (GTK_OBJECT (anim_data->item));
 		g_free (anim_data);
 		return FALSE;
 	}
 
-	pixbuf = get_logo_pixbuf (&i);
+	pixbuf = get_logo_pixbuf (logo_num);
+	foundation_logos[logo_num].displayed = TRUE;
+	showed_logos_count++;
+
 	if (!pixbuf) {
 		gtk_object_destroy (GTK_OBJECT (anim_data->item));
 		g_free (anim_data);
@@ -270,13 +299,11 @@
 	logo_data->item        = logo;
 	logo_data->canvas      = anim_data->canvas;
 	logo_data->header_item = anim_data->item;
-	logo_data->text        = foundation_logos [i].text;
+	logo_data->text        = foundation_logos [logo_num].text;
 	logo_data->x           = CANVAS_MAX_X / 2 + logo_width / 2 + 10.0;
 	logo_data->y           = 170.0;
 
 	g_timeout_add (50, animate_logo, logo_data); 
-
-	i++;
 
 	g_free (anim_data);
 


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