Enlightenment CVS committal
Author : sarajervi
Project : misc
Module : erss
Dir : misc/erss/src
Modified Files:
Makefile.am erss.c erss.h parse.c
Log Message:
New feature (not working for real yet): tooltip description when the feed has
item_description defined in it's config file. Erss now depends on etox.
Still needs work!
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 15 Jan 2004 14:46:46 -0000 1.3
+++ Makefile.am 23 Jan 2004 00:22:53 -0000 1.4
@@ -1,9 +1,9 @@
## Process this file with automake to produce Makefile.in
-INCLUDES = @edje_cflags@ @esmart_cflags@ @ewd_cflags@ @xml2_cflags@
+INCLUDES = @edje_cflags@ @esmart_cflags@ @ewd_cflags@ @etox_cflags@ @xml2_cflags@
bin_PROGRAMS = erss
erss_SOURCES = erss.c parse.c parse_config.c
-erss_LDADD = @edje_libs@ @esmart_libs@ @ewd_libs@ @xml2_libs@
+erss_LDADD = @edje_libs@ @esmart_libs@ @ewd_libs@ @etox_libs@ @xml2_libs@
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- erss.c 22 Jan 2004 23:18:28 -0000 1.24
+++ erss.c 23 Jan 2004 00:22:57 -0000 1.25
@@ -17,6 +17,15 @@
int waiting_for_reply = FALSE;
int total_connects = 0;
+Erss_Tooltip *tt = NULL;
+
+
+void erss_xml_error_handler (void *ctx, const char *msg, ...)
+{
+ fprintf (stderr, "%s xml report: %s\n", PACKAGE, msg);
+
+ return;
+}
int erss_connect (void *data)
{
@@ -177,7 +186,8 @@
ecore_con_server_send (server, c, strlen (c));
snprintf (c, sizeof (c), "Host: %s \r\n", cfg->hostname);
ecore_con_server_send (server, c, strlen (c));
- snprintf (c, sizeof (c), "User-Agent: ERSS/"VERSION"\r\n\r\n");
+ snprintf (c, sizeof (c), "User-Agent: %s/%s\r\n\r\n",
+ PACKAGE, VERSION);
ecore_con_server_send (server, c, strlen (c));
waiting_for_reply = TRUE;
@@ -301,21 +311,101 @@
ecore_exe_run (c, NULL);
}
+
+int erss_tooltip_timer (void *data)
+{
+ Article *item = data;
+ int x, y, w, h;
+
+ tt->timer = NULL;
+
+ if (!item->description)
+ return FALSE;
+
+ printf ("Opening tooltip after %lf secs\n", 1.5);
+
+
+ if (!tt->ee) {
+ tt->ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, 350, 200);
+ ecore_evas_borderless_set (tt->ee, TRUE);
+ ecore_evas_shaped_set (tt->ee, TRUE);
+ tt->win = ecore_evas_software_x11_window_get(ee);
+ ecore_x_window_prop_window_type_utility_set (tt->win);
+ ecore_evas_geometry_get (tt->ee, &x, &y, &w, &h);
+
+ tt->evas = ecore_evas_get (tt->ee);
+ evas_font_path_append (tt->evas, PACKAGE_DATA_DIR"/fonts/");
+
+
+ tt->bg = esmart_trans_x11_new (tt->evas);
+ evas_object_move (tt->bg, 0, 0);
+ evas_object_layer_set (tt->bg, -5);
+ evas_object_resize (tt->bg, w, h);
+ evas_object_name_set(tt->bg, "root_background");
+ evas_object_show (tt->bg);
+
+ tt->bg = evas_object_rectangle_add(tt->evas);
+ evas_object_move (tt->bg, 0, 0);
+ evas_object_layer_set (tt->bg, -6);
+ evas_object_resize (tt->bg, w, h);
+ evas_object_color_set(tt->bg, 255, 255, 255, 0);
+ evas_object_name_set(tt->bg, "background");
+ evas_object_show (tt->bg);
+
+ tt->etox = etox_new_all(tt->evas, x, y, w, h , 255, ETOX_ALIGN_LEFT);
+ etox_context_set_align(etox_get_context(tt->etox), ETOX_ALIGN_LEFT);
+ etox_context_set_font(etox_get_context(tt->etox), "Vera", 10);
+ etox_context_set_style(etox_get_context(tt->etox), "shadow");
+ etox_context_set_color(etox_get_context(tt->etox), 225, 225, 225, 255);
+ etox_set_soft_wrap(tt->etox, 1);
+ etox_set_alpha(tt->etox, 255);
+ evas_object_layer_set(tt->etox, 1000);
+ etox_set_text (tt->etox, item->description);
+ evas_object_show (tt->etox);
+
+
+ ecore_evas_callback_move_set (tt->ee, erss_window_move);
+ ecore_evas_callback_resize_set(tt->ee, erss_window_resize);
+ }
+
+ ecore_evas_show (tt->ee);
+
+ return FALSE;
+}
+
void cb_mouse_in (void *data, Evas *e, Evas_Object *obj,
void *event_info)
{
- Ecore_X_Window win;
- win = ecore_evas_software_x11_window_get(ee);
- if (cfg->item_url)
- ecore_x_cursor_shape_set(win, ECORE_X_CURSOR_HAND1);
+ Evas_Event_Mouse_In *event = event_info;
+ Article *item = data;
+ Ecore_X_Window win;
+
+ /*
+ printf ("x: %d y: %d\n", event->output.x, event->output.y);
+ */
+
+ tt->timer = ecore_timer_add (1.5, erss_tooltip_timer, item);
+
+ win = ecore_evas_software_x11_window_get(ee);
+ if (cfg->item_url)
+ ecore_x_cursor_shape_set(win, ECORE_X_CURSOR_HAND2);
}
void cb_mouse_out (void *data, Evas *e, Evas_Object *obj,
void *event_info)
{
Ecore_X_Window win;
- win = ecore_evas_software_x11_window_get(ee);
- ecore_x_cursor_set(win, 0);
+
+ if (tt->ee)
+ ecore_evas_hide (tt->ee);
+
+ if (tt->timer) {
+ ecore_timer_del (tt->timer);
+ tt->timer = NULL;
+ }
+
+ win = ecore_evas_software_x11_window_get(ee);
+ ecore_x_cursor_set(win, 0);
}
@@ -441,6 +531,11 @@
struct stat statbuf;
cfg = NULL;
+
+ /*
+ * Disable this for now..
+ * xmlSetGenericErrorFunc (NULL, erss_xml_error_handler);
+ */
while ((c = getopt (argc, argv, "cvhlt")) != -1)
{
@@ -530,8 +625,11 @@
ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, width, height);
win = ecore_evas_software_x11_window_get(ee);
- ecore_x_window_prop_window_type_desktop_set(win);
+ ecore_x_window_prop_window_type_desktop_set(win);
+ tt = malloc (sizeof (Erss_Tooltip));
+ memset(tt, 0, sizeof (Erss_Tooltip));
+
if (!ee)
return -1;
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- erss.h 22 Jan 2004 23:18:44 -0000 1.8
+++ erss.h 23 Jan 2004 00:22:57 -0000 1.9
@@ -11,6 +11,7 @@
#include <Ewd.h>
#include <Esmart/Esmart_Trans.h>
#include <Esmart/container.h>
+#include <Etox.h>
#include <math.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
@@ -26,10 +27,23 @@
#include <time.h>
#include <libxml2/libxml/xmlmemory.h>
+#include <libxml2/libxml/xmlerror.h>
#include <libxml2/libxml/parser.h>
#include "config.h"
+typedef struct _erss_tooltip Erss_Tooltip;
+
+struct _erss_tooltip {
+ Evas *evas;
+ Ecore_Evas *ee;
+ Ecore_X_Window win;
+ Evas_Object *bg;
+ Evas_Object *etox;
+
+ Ecore_Timer *timer;
+};
+
extern Evas *evas;
extern Ecore_Evas *ee;
extern Ewd_List *list;
@@ -37,6 +51,7 @@
extern Ewd_List *config_files;
+void erss_xml_error_handler (void *ctx, const char *msg, ...);
int erss_connect (void *data);
int erss_alphasort (const void *a, const void *b);
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- parse.c 22 Jan 2004 23:18:47 -0000 1.20
+++ parse.c 23 Jan 2004 00:22:57 -0000 1.21
@@ -51,9 +51,9 @@
evas_object_show (item->obj);
evas_object_event_callback_add (item->obj,
- EVAS_CALLBACK_MOUSE_IN, cb_mouse_in, ee);
+ EVAS_CALLBACK_MOUSE_IN, cb_mouse_in, item);
evas_object_event_callback_add (item->obj,
- EVAS_CALLBACK_MOUSE_OUT, cb_mouse_out, ee);
+ EVAS_CALLBACK_MOUSE_OUT, cb_mouse_out, item);
e_container_element_append(cont, item->obj);
edje_object_part_text_set (item->obj, "article", text);
@@ -79,6 +79,7 @@
if (cfg->item_description) {
if (!strcmp(cur->name, cfg->item_description) && item) {
str = xmlNodeListGetString(doc, cur->xmlChildrenNode,
1);
+
item->description = strdup (str);
xmlFree (str);
}
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs