[SHR-Testing] 12-hour clock

Joel Newkirk freerunner at newkirk.us
Mon Feb 2 00:28:23 CET 2009


On Sun, 1 Feb 2009 15:13:47 -0600, The Digital Pioneer
<digitalpioneer at gmail.com> wrote:
> Hi, guys. Does anyone know how to set the phone to use a 12-hour clock?
I'm
> one of those weird Americans who don't like 24-hour clocks. :P
> 

{applies to all non-qtopia distros AFAIK}

The clock is laid out in the illume theme, such as
/usr/share/enlightenement/data/themes/illume.edj - I've been working on
customizing the theme to suit my tastes, one of the things I did was add
the date below the time.  I experimented with AM/PM but felt it used too
much valuable space, given that the same space is being competed for by GSM
widget, battery widget, left/right arrows, taskname, etc.  (or, I had to
make the font for the time too small)

If you extract the theme with "edge_decc illume.edj"[1]  then look through
the .edc file to find "MOD: CLOCK".  There's a script within the clock
module section that includes lines like these:

            timer(60.0 - second, "clock_cb", 1);
            if ((hour < 10) && (minute < 10))
              {snprintf(buf, 10, "0%i:0%i", hour, minute);}
            else if ((hour < 10) && (minute >= 10))
              {snprintf(buf, 10, "0%i:%i", hour, minute);}
            else if ((hour >= 10) && (minute < 10))
              {snprintf(buf, 10, "%i:0%i", hour, minute);}
            else if ((hour >= 10) && (minute >= 10))
              {snprintf(buf, 10, "%i:%i", hour, minute);}
            set_text(PART:"e.text.label", buf);  

(the appropriate changes are left as an exercise for the reader ;)

recompile the theme with './build.sh' inside the theme dir, move the
created .edj file (presuming no errors) up one folder to replace the
original (note that enlightenment is quite prone to segfaulting when you do
this, so do it via SSH!!) then restart enlightenment with "killall -HUP
enlightenment" and it will reload with the altered theme.  (note that
unless you use a different name and change enlightenment config to use the
'new' theme, it will be overwritten by package upgrades)

I'm planning to revisit the clock soon, I want to try to incorporate
external flags that are honored to determine whether to display day, and
whether to use 12- or 24-hour format.  If successful I'll post the full
clock module group for anybody who wants to incorporate it in their edje
theme.

j

[1] or whichever theme you're using - note that if 'default.edj' is present
it is normally overridden by the actual selected theme, so changing the
clock there [which is the analog one with 120+ png files] likely won't make
any change to your clock.  You may need to "opkg install edje-utils" to
have edje_decc & edje_cc. (the latter is used by build.sh to rebuild the
.edj)

-- 
Joel Newkirk
http://jthinks.com      (blog)
http://newkirk.us/om (FR stuff)





More information about the community mailing list