From 2fb3703a51b3da5b833fe9a77b0bdc7778ef7876 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sun, 28 Oct 2001 05:54:51 +0000 Subject: Distribute credit equally. 2001-10-28 Jon Trowbridge * e-shell-about-box.c: Distribute credit equally. svn path=/trunk/; revision=14280 --- shell/ChangeLog | 4 ++++ shell/e-shell-about-box.c | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index b6c57ee787..685ca245e7 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,7 @@ +2001-10-28 Jon Trowbridge + + * e-shell-about-box.c: Distribute credit equally. + 2001-10-27 * evolution-storage.c (impl_Storage_async_xfer_folder): We want diff --git a/shell/e-shell-about-box.c b/shell/e-shell-about-box.c index c21275fa12..e3da343d14 100644 --- a/shell/e-shell-about-box.c +++ b/shell/e-shell-about-box.c @@ -86,6 +86,7 @@ struct _EShellAboutBoxPrivate { GdkGC *clipped_gc; int text_y_offset; int timeout_id; + const gchar **permuted_text; }; @@ -102,6 +103,26 @@ struct _EShellAboutBoxPrivate { #define IMAGE_PATH EVOLUTION_IMAGES "/about-box.png" + +static void +permute_names (EShellAboutBox *about_box) +{ + EShellAboutBoxPrivate *priv = about_box->priv; + gint i, j; + + srandom (time (NULL)); + + for (i = 6; i < NUM_TEXT_LINES-1; ++i) { + const gchar *tmp; + j = i + random () % (NUM_TEXT_LINES - i); + if (i != j) { + tmp = priv->permuted_text[i]; + priv->permuted_text[i] = priv->permuted_text[j]; + priv->permuted_text[j] = tmp; + } + } +} + /* The callback. */ static int @@ -142,10 +163,10 @@ timeout_callback (void *data) if (first_line + i >= NUM_TEXT_LINES) break; - if (*text[first_line + i] == '\0') + if (*priv->permuted_text[first_line + i] == '\0') line = ""; else - line = _(text[first_line + i]); + line = _(priv->permuted_text[first_line + i]); x = TEXT_X_OFFSET + (TEXT_WIDTH - gdk_string_width (widget->style->font, line)) / 2; @@ -161,8 +182,10 @@ timeout_callback (void *data) gtk_widget_draw (widget, &redraw_rect); priv->text_y_offset ++; - if (priv->text_y_offset > line_height * NUM_TEXT_LINES + TEXT_HEIGHT) + if (priv->text_y_offset > line_height * NUM_TEXT_LINES + TEXT_HEIGHT) { priv->text_y_offset = 0; + permute_names (about_box); + } return TRUE; } @@ -199,6 +222,8 @@ impl_destroy (GtkObject *object) priv->timeout_id = -1; } + g_free (priv->permuted_text); + g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -339,6 +364,7 @@ static void init (EShellAboutBox *shell_about_box) { EShellAboutBoxPrivate *priv; + gint i; priv = g_new (EShellAboutBoxPrivate, 1); priv->pixmap = NULL; @@ -347,7 +373,14 @@ init (EShellAboutBox *shell_about_box) priv->timeout_id = -1; priv->text_y_offset = 0; + priv->permuted_text = g_new (const gchar *, NUM_TEXT_LINES); + for (i = 0; i < NUM_TEXT_LINES; ++i) { + priv->permuted_text[i] = text[i]; + } + shell_about_box->priv = priv; + + permute_names (shell_about_box); } -- cgit v1.2.3