Enlightenment CVS committal
Author : devilhorns
Project : e_modules
Module : tclock
Dir : e_modules/tclock
Modified Files:
e_mod_main.h e_mod_main.c e_mod_config.c tclock.edc
Log Message:
Tclock can now support new-line's in the format string.
Do Not Use strftime's %n, use <br> instead. (%c<br>%H)
NOTE: You will need to remove old tclock config (modules.tclock.cfg)
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_mod_main.h 5 Apr 2006 17:48:50 -0000 1.8
+++ e_mod_main.h 16 May 2006 05:21:46 -0000 1.9
@@ -9,8 +9,6 @@
#define TIME_BUF 1024
#define FORMAT_BUF_SIZE 1024
#define TCLOCK_DEBUG(X) (printf("tclock_debug: %s\n",X))
-#undef TCLOCK_DEBUG
-#define TCLOCK_DEBUG(X)
typedef struct _Config
{
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_mod_main.c 5 Apr 2006 17:48:50 -0000 1.15
+++ e_mod_main.c 16 May 2006 05:21:46 -0000 1.16
@@ -50,13 +50,11 @@
TClock *tclock;
if (module->config_menu)
- module->config_menu = NULL;
+ module->config_menu = NULL;
tclock = module->data;
if (tclock)
- {
- _tclock_shutdown(tclock);
- }
+ _tclock_shutdown(tclock);
return 1;
}
@@ -135,10 +133,10 @@
#define T Config_Face
#define D conf_face_edd
E_CONFIG_VAL(D, T, enabled, UCHAR);
- E_CONFIG_VAL(D, T, resolution, UINT);
+ E_CONFIG_VAL(D, T, resolution, INT);
E_CONFIG_VAL(D, T, format, STR);
- E_CONFIG_VAL(D, T, userformat, UINT);
-
+ E_CONFIG_VAL(D, T, userformat, UCHAR);
+
conf_edd = E_CONFIG_DD_NEW("TClock_Config", Config);
#undef T
@@ -149,14 +147,14 @@
E_CONFIG_VAL(D, T, poll_time, DOUBLE);
tclock->conf = e_config_domain_load("module.tclock", conf_edd);
-
if (!tclock->conf)
{
tclock->conf = E_NEW(Config, 1);
-
tclock->conf->poll_time = 60.0;
}
+ E_CONFIG_LIMIT(tclock->conf->poll_time, 1.0, 60.0);
+
_tclock_config_menu_new(tclock);
managers = e_manager_list();
@@ -187,11 +185,9 @@
face->conf->enabled = 1;
face->conf->resolution = RESOLUTION_MINUTE;
face->conf->userformat = 0;
+ face->conf->format = (char *)evas_stringshare_add("%c");
- const char *format;
-
- format =
edje_object_part_state_get(face->tclock_object, "tclock_format", NULL);
- face->conf->format = (char
*)evas_stringshare_add(format);
+ E_CONFIG_LIMIT(face->conf->resolution, 0, 1);
tclock->conf->faces =
evas_list_append(tclock->conf->faces, face->conf);
}
@@ -199,22 +195,13 @@
{
face->conf = cl->data;
cl = cl->next;
- }
+ }
- if (face->conf->resolution == RESOLUTION_SECOND)
- {
- E_CONFIG_LIMIT(tclock->conf->poll_time, 0.1, 1.0);
- tclock->tclock_check_timer =
ecore_timer_add(tclock->conf->poll_time, _tclock_cb_check, tclock);
- TCLOCK_DEBUG("RES_SEC");
- }
- else
- {
- E_CONFIG_LIMIT(tclock->conf->poll_time, 60.0, 60.0);
- tclock->tclock_check_timer =
ecore_timer_add(tclock->conf->poll_time, _tclock_cb_check, tclock);
- TCLOCK_DEBUG("RES_MIN");
- /* to avoid the long display of "Starting the clock..."
*/
- _tclock_cb_check(tclock);
- }
+ printf("Format: %s\n", face->conf->format);
+
+ /* to avoid the long display of "Starting the clock..." */
+ _tclock_cb_check(tclock);
+ tclock->tclock_check_timer =
ecore_timer_add(tclock->conf->poll_time, _tclock_cb_check, tclock);
/* Menu */
/* This menu must be initialized after conf */
@@ -246,10 +233,10 @@
for (list = tclock->faces; list; list = list->next)
_tclock_face_free(list->data);
- evas_list_free(tclock->faces);
e_object_del(E_OBJECT(tclock->config_menu));
+ evas_list_free(tclock->faces);
evas_list_free(tclock->conf->faces);
free(tclock->conf);
free(tclock);
@@ -306,17 +293,14 @@
e_gadman_client_domain_set(face->gmc, "module.tclock", _tclock_count++);
e_gadman_client_policy_set(face->gmc,
E_GADMAN_POLICY_ANYWHERE |
- E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE |
E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VSIZE);
+ E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_VMOVE |
+ E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VSIZE);
e_gadman_client_min_size_set(face->gmc, 4, 4);
e_gadman_client_max_size_set(face->gmc, 512, 512);
e_gadman_client_auto_size_set(face->gmc, 40 + (face->inset.l +
face->inset.r), 40 + (face->inset.t + face->inset.b));
-
e_gadman_client_align_set(face->gmc, 1.0, 1.0);
- //e_gadman_client_aspect_set(face->gmc, 1.0, 1.0);
e_gadman_client_padding_set(face->gmc, face->inset.l, face->inset.r,
face->inset.t, face->inset.b);
-
e_gadman_client_resize(face->gmc, 40 + (face->inset.l + face->inset.r), 40
+ (face->inset.t + face->inset.b));
-
e_gadman_client_change_func_set(face->gmc, _tclock_face_cb_gmc_change,
face);
e_gadman_client_load(face->gmc);
@@ -336,6 +320,7 @@
if (face->conf->format)
evas_stringshare_del(face->conf->format);
+
free(face->conf);
free(face);
_tclock_count--;
@@ -360,24 +345,8 @@
TClock_Face *face;
face = l->data;
-
- const char *format;
-
- /* Load the default format string from the module.edj-file
- * when the user defineable format string shouldn't be used
- * otherwise use the user defined format string */
- if (!face->conf->userformat)
- {
- format = edje_object_part_state_get(face->tclock_object,
"tclock_format", NULL);
- }
- else
- format = face->conf->format;
-
- strftime(buf, TIME_BUF, format, local_time);
-
- TCLOCK_DEBUG(face->conf->format);
+ strftime(buf, TIME_BUF, face->conf->format, local_time);
edje_object_part_text_set(face->tclock_object, "tclock_text", buf);
- e_config_save_queue();
}
return 1;
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/e_mod_config.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- e_mod_config.c 5 Apr 2006 17:48:50 -0000 1.14
+++ e_mod_config.c 16 May 2006 05:21:46 -0000 1.15
@@ -4,7 +4,7 @@
struct _E_Config_Dialog_Data
{
- unsigned int resolution;
+ int resolution;
char *format;
int userformat;
};
@@ -35,9 +35,9 @@
static void
_fill_data(TClock_Face *f, E_Config_Dialog_Data *cfdata)
{
+ printf("Cfg Format: %s\n", f->conf->format);
cfdata->resolution = f->conf->resolution;
- if (f->conf->format)
- cfdata->format = strdup(f->conf->format);
+ cfdata->format = strdup(f->conf->format);
cfdata->userformat = f->conf->userformat;
}
@@ -75,19 +75,24 @@
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
- of = e_widget_frametable_add(evas, D_("Time Format"), 0);
+ of = e_widget_frametable_add(evas, D_("Time Format"), 1);
checked = e_widget_check_add(evas, D_("User format String"),
&(cfdata->userformat));
if (cfdata->userformat)
e_widget_check_checked_set(checked, 1);
e_widget_frametable_object_append(of, checked, 0, 0, 1, 1, 1, 0, 1, 0);
- ob = e_widget_label_add(evas, D_("Consult strftime(3) for format syntax"));
- e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
- entry = e_widget_entry_add(evas, &(cfdata->format));
+
+ entry = e_widget_entry_add(evas, &cfdata->format);
e_widget_disabled_set(entry, !cfdata->userformat);
- e_widget_min_size_set(entry, 150, 1);
+ //e_widget_min_size_set(entry, 150, 1);
e_widget_frametable_object_append(of, entry, 0, 1, 1, 1, 1, 0, 1, 0);
- ob = e_widget_label_add(evas, "");
- e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
+
+ ob = e_widget_label_add(evas, D_("Consult strftime(3) for format syntax"));
+ e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
+ ob = e_widget_label_add(evas, D_("If you wish to insert %n use <br>
instead"));
+ e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 0, 1, 0);
+
+// ob = e_widget_label_add(evas, "");
+// e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
e_widget_on_change_hook_set(checked, onCheckChange, entry);
@@ -100,29 +105,30 @@
TClock_Face *f;
f = cfd->data;
- e_border_button_bindings_ungrab_all();
if (cfdata->resolution != f->conf->resolution)
{
if (cfdata->resolution == RESOLUTION_MINUTE)
f->tclock->conf->poll_time = 60.0;
else
f->tclock->conf->poll_time = 1.0;
- ecore_timer_interval_set(f->tclock->tclock_check_timer,
f->tclock->conf->poll_time);
+ ecore_timer_interval_set(f->tclock->tclock_check_timer,
f->tclock->conf->poll_time);
}
f->conf->resolution = cfdata->resolution;
f->conf->userformat = cfdata->userformat;
/* update the format string with the format string given by the user
* when the userformat is true and the string(typed by the user) isn't
empty */
- if (strlen(cfdata->format) > 0 && cfdata->userformat)
- {
- if (f->conf->format)
- evas_stringshare_del(f->conf->format);
- f->conf->format = (char *)evas_stringshare_add(cfdata->format);
- }
+ if (f->conf->format)
+ evas_stringshare_del(f->conf->format);
+ if (cfdata->userformat && (strlen(cfdata->format) > 0))
+ f->conf->format = (char *)evas_stringshare_add(cfdata->format);
+ else
+ f->conf->format = (char *)evas_stringshare_add("%c");
+
e_config_save_queue();
- e_border_button_bindings_grab_all();
+ printf("Cfg Format: %s\n", f->conf->format);
+
return 1;
}
@@ -130,6 +136,5 @@
onCheckChange(void *data, Evas_Object *obj)
{
int checked = e_widget_check_checked_get(obj);
-
e_widget_disabled_set(data, !checked);
}
===================================================================
RCS file: /cvs/e/e_modules/tclock/tclock.edc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- tclock.edc 30 Mar 2006 06:02:16 -0000 1.3
+++ tclock.edc 16 May 2006 05:21:46 -0000 1.4
@@ -1,73 +1,81 @@
// Sample EDC
-images {
- image, "background.png" COMP;
+images
+{
+ image: "background.png" COMP;
}
-collections {
- group {
- name, "modules/tclock/main";
- min, 32 32;
- max, 1024 768;
-
- parts {
- part {
- name, "background";
- type, IMAGE;
- mouse_events, 0;
- description {
- state, "default" 0.0;
- rel1 {
- relative, 0.0 0.0;
- offset, 0 0;
- }
- rel2 {
- relative, 1.0 1.0;
- offset, -1 -1;
- }
- image {
- normal, "background.png";
- }
-
- }
- }
-
-part {
- name: "tclock_format";
- type: TEXT;
- mouse_events, 0;
- description {
- state: " %c" 0.0;
- }
+styles
+{
+ style
+ {
+ name: "tclock_style";
+ base: "font=Edje-Vera font_size=12 text_class=tb_plain align=center
style=soft_shadow color=#fff shadow_color=#00000020 valign=center";
+ tag: "br" "\n";
+ }
}
-part {
- name: "tclock_text";
- type: TEXT;
- effect: SOFT_SHADOW;
- mouse_events, 0;
-
- description {
- state, "default" 0.0;
- rel1 {
- relative, 0.0 0.0;
- offset, 0 0;
- }
+collections
+{
+ group
+ {
+ name: "modules/tclock/main";
+ min: 32 32;
+ max: 1024 768;
- rel2 {
- relative, 1.0 1.0;
- offset, -1 -1;
- }
- color: 255 255 255 230;
- //color2: 0 0 255 155;
- color3: 0 0 0 50;
- text {
- text, "Starting the clock...";
- font, "vera";
- size, 12;
- align, 0.5 0.5;
- }
-}
-}
-} /* Close Parts */
+ parts
+ {
+ part
+ {
+ name: "background";
+ type: IMAGE;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ rel1
+ {
+ relative: 0.0 0.0;
+ offset: 0 0;
+ }
+ rel2
+ {
+ relative: 1.0 1.0;
+ offset: -1 -1;
+ }
+ image
+ {
+ normal: "background.png";
+ }
+ }
+ }
-} /* Close Group */
-} /* Close Coll */
+ part
+ {
+ name: "tclock_text";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ rel1
+ {
+ relative: 0.0 0.0;
+ offset: 0 0;
+ }
+ rel2
+ {
+ relative: 1.0 1.0;
+ offset: -1 -1;
+ }
+ text
+ {
+ style: "tclock_style";
+ min: 1 1;
+ }
+ }
+ }
+ }
+ /* Close Parts */
+ }
+ /* Close Group */
+}
+/* Close Coll */
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs