Enlightenment CVS committal
Author : sarajervi
Project : misc
Module : erss
Dir : misc/erss/src
Modified Files:
erss.c parse.c parse.h
Log Message:
Made text encoding optional from the rc file.
Added 4 new config files from 'creepy'.
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- erss.c 10 Jan 2004 19:34:00 -0000 1.10
+++ erss.c 11 Jan 2004 14:02:24 -0000 1.11
@@ -504,10 +504,8 @@
}
- if (parse_rc_file ()) {
- printf ("Found the rc file\n");
+ if (parse_rc_file ())
got_rc_file = TRUE;
- }
if(!got_config_file) {
@@ -580,13 +578,13 @@
width = 300;
- height = 15 * cfg->num_stories;
+ height = 16 * cfg->num_stories;
if (cfg->header)
- height += 25;
+ height += 26;
if (cfg->clock)
- height += 25;
+ height += 26;
ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, width, height);
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- parse.c 10 Jan 2004 23:00:26 -0000 1.7
+++ parse.c 11 Jan 2004 14:02:24 -0000 1.8
@@ -116,7 +116,7 @@
char *c;
char *text;
int i;
-
+
/*
* Some of the feeds may have "garbage" in their titles
* we want to remove it.
@@ -125,7 +125,7 @@
"<![CDATA[",
"]]>"
};
-
+
if (!buf || !*buf)
return;
@@ -168,40 +168,38 @@
if ((c = get_element (&buf, cfg->item_title)) != NULL)
{
-
for (i = 0; i < 2; i++)
c = remove_garbage (c, garbage[i]);
-
- c = ecore_txt_convert ("iso-8859-1", "utf8", c);
-
+
+ c = ecore_txt_convert (rc->enc_to, rc->enc_from, c);
+
i = strlen(c) + 3 + strlen(cfg->prefix);
-
text = malloc (i);
-
+
snprintf (text, i, " %s %s", cfg->prefix, c);
-
+
item->obj = edje_object_add (evas);
edje_object_file_set (item->obj,
cfg->theme, "erss_item");
-
+
if (text)
edje_object_part_text_set (item->obj, "article", text);
-
+
evas_object_show (item->obj);
-
+
evas_object_event_callback_add (item->obj,
EVAS_CALLBACK_MOUSE_IN, cb_mouse_in, NULL);
evas_object_event_callback_add (item->obj,
EVAS_CALLBACK_MOUSE_OUT, cb_mouse_out, NULL);
-
+
e_container_element_append(cont, item->obj);
-
+
free (c);
free (text);
-
+
return;
}
-
+
if ((c = get_element (&buf, cfg->item_url)) != NULL)
{
item->url = strdup (c);
@@ -214,7 +212,7 @@
free (c);
return;
}
-
+
if ((c = get_element (&buf, cfg->item_description)) != NULL)
{
item->description = strdup (c);
@@ -222,7 +220,6 @@
free (c);
return;
}
-
}
@@ -276,8 +273,6 @@
fp = fopen (file, "r");
- if (!fp)
- return FALSE;
while (fp && (line = get_next_line (fp)) != NULL)
{
@@ -305,6 +300,18 @@
continue;
}
+ if ((c = get_element (&line, "enc_from")) != NULL)
+ {
+ rc->enc_from = strdup (c);
+ continue;
+ }
+
+ if ((c = get_element (&line, "enc_to")) != NULL)
+ {
+ rc->enc_to = strdup (c);
+ continue;
+ }
+
if ((c = get_element (&line, "proxy_port")) != NULL)
{
rc->proxy_port = atoi (c);
@@ -313,8 +320,6 @@
free(line);
}
- if (fp)
- fclose (fp);
/*
* Set sane defaults for unspecified config options.
@@ -328,6 +333,19 @@
rc->browser = strdup(getenv("BROWSER"));
if (!rc->browser)
rc->browser = strdup("mozilla");
+
+ if (!rc->enc_from)
+ rc->enc_from = strdup("utf8");
+ if (!rc->enc_to)
+ rc->enc_from = strdup("iso-8859-1");
+
+ /*
+ * If there is no rc file return false for us to know
+ */
+ if (!fp)
+ return FALSE;
+
+ fclose (fp);
return TRUE;
}
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- parse.h 9 Jan 2004 23:00:08 -0000 1.4
+++ parse.h 11 Jan 2004 14:02:24 -0000 1.5
@@ -36,6 +36,8 @@
char *browser;
char *proxy;
int proxy_port;
+ char *enc_from;
+ char *enc_to;
} Rc_Config;
int parse_rc_file ();
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs