This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository edi.

View the commit online.

commit 3f748938699cb43c4509280176f5e53e842a5c09
Author: Alastair Poole <[email protected]>
AuthorDate: Thu Apr 16 13:22:16 2026 +0100

    about: scrollz like the oldz
---
 NEWS                        |   1 +
 src/bin/screens/edi_about.c | 203 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 184 insertions(+), 20 deletions(-)

diff --git a/NEWS b/NEWS
index def6752..538a8a2 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Edi 0.9
  * edi_scm_ui logger shows latest commit first.
  * SCM log browser with selectable commits and dedicated commit-change viewer.
  * SCM log browser is searchable by title, author and e-mail.
+ * Make our about window scrolling, rolling, bowling.
  * ...
 
 =======
diff --git a/src/bin/screens/edi_about.c b/src/bin/screens/edi_about.c
index a423d85..d90bca4 100644
--- a/src/bin/screens/edi_about.c
+++ b/src/bin/screens/edi_about.c
@@ -4,9 +4,92 @@
 
 #include <Elementary.h>
 #include <Ecore.h>
+#include <stdio.h>
 
 #include "edi_private.h"
 
+static const char *_EDI_ABOUT_GPLV2_TEXT =
+"GNU GENERAL PUBLIC LICENSE\n"
+"Version 2, June 1991\n"
+"\n"
+"Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n"
+"51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n"
+"\n"
+"This program is free software; you can redistribute it and/or modify\n"
+"it under the terms of the GNU General Public License as published by\n"
+"the Free Software Foundation; version 2 of the License.\n"
+"\n"
+"This program is distributed in the hope that it will be useful,\n"
+"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+"GNU General Public License for more details.\n"
+"\n"
+"You should have received a copy of the GNU General Public License\n"
+"along with this program; if not, write to the Free Software Foundation,\n"
+"Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n"
+"\n"
+"Source: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt\n";
+
+typedef struct _Edi_About_Scroll_Data
+{
+   Evas_Object *scroller;
+   Evas_Object *top_spacer;
+   Evas_Object *bottom_spacer;
+   Ecore_Animator *animator;
+   double pos;
+} Edi_About_Scroll_Data;
+
+static Eina_Bool
+_edi_about_scroll_animate_cb(void *data)
+{
+   Edi_About_Scroll_Data *sd = data;
+   Evas_Coord x, y, w, h, cw, ch;
+   double max_y;
+
+   if (!sd || !sd->scroller) return ECORE_CALLBACK_CANCEL;
+
+   elm_scroller_region_get(sd->scroller, &x, &y, &w, &h);
+   elm_scroller_child_size_get(sd->scroller, &cw, &ch);
+
+   if (h <= 0 || ch <= h)
+     return ECORE_CALLBACK_RENEW;
+
+   max_y = ch - h;
+   sd->pos += 24.0 * ecore_animator_frametime_get();
+   if (sd->pos > max_y)
+     sd->pos = 0.0;
+
+   elm_scroller_region_show(sd->scroller, 0, (int) sd->pos, w, h);
+   return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_edi_about_scroll_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+                            void *event_info EINA_UNUSED)
+{
+   Edi_About_Scroll_Data *sd = data;
+   Evas_Coord h;
+
+   if (!sd || !sd->scroller) return;
+
+   evas_object_geometry_get(sd->scroller, NULL, NULL, NULL, &h);
+   if (h <= 0) return;
+
+   evas_object_size_hint_min_set(sd->top_spacer, 0, h);
+   evas_object_size_hint_min_set(sd->bottom_spacer, 0, h);
+}
+
+static void
+_edi_about_scroll_data_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+                              void *event_info EINA_UNUSED)
+{
+   Edi_About_Scroll_Data *sd = data;
+
+   if (!sd) return;
+   if (sd->animator) ecore_animator_del(sd->animator);
+   free(sd);
+}
+
 static void
 _edi_about_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -21,12 +104,56 @@ _edi_about_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info E
    evas_object_del(win);
 }
 
+static char *
+_edi_about_file_read(const char *path)
+{
+   FILE *f;
+   long len;
+   char *buf;
+
+   f = fopen(path, "rb");
+   if (!f) return NULL;
+   if (fseek(f, 0, SEEK_END) != 0)
+     {
+        fclose(f);
+        return NULL;
+     }
+
+   len = ftell(f);
+   if (len < 0 || fseek(f, 0, SEEK_SET) != 0)
+     {
+        fclose(f);
+        return NULL;
+     }
+
+   buf = calloc(1, len + 1);
+   if (!buf)
+     {
+        fclose(f);
+        return NULL;
+     }
+
+   if (len > 0 && fread(buf, 1, len, f) != (size_t) len)
+     {
+        free(buf);
+        fclose(f);
+        return NULL;
+     }
+
+   fclose(f);
+   return buf;
+}
+
 Evas_Object *
 edi_about_show(Evas_Object *mainwin)
 {
    Evas_Object *win, *vbox, *box, *table, *bg;
-   Evas_Object *text, *title, *authors, *buttonbox, *button, *space;
+   Evas_Object *text, *credits, *credits_box, *buttonbox, *button, *space;
+   Evas_Object *top_spacer, *bottom_spacer;
+   Edi_About_Scroll_Data *scroll;
    const char *title_text;
+   char *authors_text, *markup;
+   Eina_Strbuf *combined;
    int alpha, r, g, b;
    char buf[PATH_MAX];
 
@@ -92,26 +219,62 @@ edi_about_show(Evas_Object *mainwin)
    elm_box_pack_end(box, text);
    evas_object_show(text);
 
-   title = elm_entry_add(box);
-   elm_object_text_set(title, _("<hilight>EDI's lovely authors</hilight>"));
-   elm_entry_editable_set(title, EINA_FALSE);
-   elm_object_focus_allow_set(title, EINA_FALSE);
-   evas_object_size_hint_weight_set(title, EVAS_HINT_EXPAND, 0.0);
-   evas_object_size_hint_align_set(title, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_box_pack_end(box, title);
-   evas_object_show(title);
+   credits = elm_scroller_add(box);
+   elm_scroller_policy_set(credits, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+   elm_scroller_bounce_set(credits, EINA_FALSE, EINA_FALSE);
+   evas_object_size_hint_weight_set(credits, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(credits, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(box, credits);
+   evas_object_show(credits);
 
-   /* Authors screen */
-   authors = elm_entry_add(box);
-   elm_entry_line_wrap_set(authors, EINA_FALSE);
-   elm_entry_text_style_user_push(authors, "DEFAULT='font=Mono')");
-   elm_entry_file_set(authors, PACKAGE_DOC_DIR "/AUTHORS", ELM_TEXT_FORMAT_PLAIN_UTF8);
-   elm_entry_editable_set(authors, EINA_FALSE);
-   elm_object_focus_allow_set(authors, EINA_FALSE);
-   evas_object_size_hint_weight_set(authors, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_size_hint_align_set(authors, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_box_pack_end(box, authors);
-   evas_object_show(authors);
+   credits_box = elm_box_add(credits);
+   evas_object_size_hint_weight_set(credits_box, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(credits_box, EVAS_HINT_FILL, 0.0);
+   elm_object_content_set(credits, credits_box);
+   evas_object_show(credits_box);
+
+   top_spacer = elm_box_add(credits_box);
+   evas_object_size_hint_weight_set(top_spacer, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(top_spacer, EVAS_HINT_FILL, 0.0);
+   elm_box_pack_end(credits_box, top_spacer);
+   evas_object_show(top_spacer);
+
+   text = elm_entry_add(credits_box);
+   elm_entry_line_wrap_set(text, EINA_FALSE);
+   elm_entry_text_style_user_push(text, "DEFAULT='font=Mono')");
+   elm_entry_editable_set(text, EINA_FALSE);
+   elm_object_focus_allow_set(text, EINA_FALSE);
+   evas_object_size_hint_weight_set(text, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(text, EVAS_HINT_FILL, 0.0);
+
+   authors_text = _edi_about_file_read(PACKAGE_DOC_DIR "/AUTHORS");
+   combined = eina_strbuf_new();
+   eina_strbuf_append(combined, "AUTHORS\n\n");
+   eina_strbuf_append(combined, authors_text ? authors_text : "");
+   eina_strbuf_append(combined, "\n\nGPLv2 LICENSE\n\n");
+   eina_strbuf_append(combined, _EDI_ABOUT_GPLV2_TEXT);
+   markup = elm_entry_utf8_to_markup(eina_strbuf_string_get(combined));
+   elm_object_text_set(text, markup);
+   free(markup);
+   eina_strbuf_free(combined);
+   free(authors_text);
+   elm_box_pack_end(credits_box, text);
+   evas_object_show(text);
+
+   bottom_spacer = elm_box_add(credits_box);
+   evas_object_size_hint_weight_set(bottom_spacer, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bottom_spacer, EVAS_HINT_FILL, 0.0);
+   elm_box_pack_end(credits_box, bottom_spacer);
+   evas_object_show(bottom_spacer);
+
+   scroll = calloc(1, sizeof(*scroll));
+   scroll->scroller = credits;
+   scroll->top_spacer = top_spacer;
+   scroll->bottom_spacer = bottom_spacer;
+   scroll->pos = 0.0;
+   scroll->animator = ecore_animator_add(_edi_about_scroll_animate_cb, scroll);
+   evas_object_event_callback_add(credits, EVAS_CALLBACK_RESIZE, _edi_about_scroll_resize_cb, scroll);
+   evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _edi_about_scroll_data_del_cb, scroll);
 
    buttonbox = elm_box_add(box);
    elm_box_horizontal_set(buttonbox, EINA_TRUE);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to