aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2000-12-30 09:34:04 +0800
committerIain Holmes <iain@src.gnome.org>2000-12-30 09:34:04 +0800
commit058a550c571b3e77b0cef25bb287618b630a811e (patch)
tree988bf9949b20812607d950e793ba7eea185589cc
parentebe0fd91cffde48584020466763c521003ea2d4b (diff)
downloadgsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar.gz
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar.bz2
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar.lz
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar.xz
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.tar.zst
gsoc2013-evolution-058a550c571b3e77b0cef25bb287618b630a811e.zip
More bonobo property bag updates and stuff.
svn path=/trunk/; revision=7194
-rw-r--r--executive-summary/ChangeLog11
-rw-r--r--executive-summary/component/e-summary-url.c63
-rw-r--r--executive-summary/component/e-summary.c92
-rw-r--r--executive-summary/component/e-summary.h6
-rw-r--r--executive-summary/evolution-services/executive-summary-component.c17
-rw-r--r--executive-summary/evolution-services/executive-summary-html-view.c1
-rw-r--r--executive-summary/summary.html28
-rw-r--r--executive-summary/test-service/rdf-summary.c49
8 files changed, 101 insertions, 166 deletions
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog
index 7a6085a55d..acae529466 100644
--- a/executive-summary/ChangeLog
+++ b/executive-summary/ChangeLog
@@ -1,3 +1,14 @@
+2000-12-29 Iain Holmes <iain@helixcode.com>
+
+ * test-service/rdf-summary.c (view_destroyed): Cancel all pending
+ async downloads.
+ (load_from_stream): Check if the XML was correctly loaded.
+ (read_callback):
+ (close_callback):
+ (open_callback): Add a cast to remove warnings
+
+ * component/e-summary.c (listener_event): Check for the correct event names.
+
2000-12-28 Iain Holmes <iain@helixcode.com>
* test-service/rdf-summary.c (create_view): Aggregate a
diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c
index a997184e42..ab7dacc52d 100644
--- a/executive-summary/component/e-summary-url.c
+++ b/executive-summary/component/e-summary-url.c
@@ -75,7 +75,8 @@ static char *descriptions[] = {
typedef struct _PropertyDialog {
BonoboListener *listener;
- Bonobo_Listener corba_listener;
+ int listener_id;
+
Bonobo_EventSource eventsource;
GtkWidget *dialog;
} PropertyDialog;
@@ -85,8 +86,6 @@ typedef struct _PropertyDialog {
static ESummaryCache *image_cache = NULL;
#endif
-#define USE_ASYNC
-
gboolean e_summary_url_mail_compose (ESummary *esummary,
const char *url);
gboolean e_summary_url_exec (const char *exec);
@@ -100,8 +99,6 @@ struct _DownloadInfo {
};
typedef struct _DownloadInfo DownloadInfo;
-#ifdef USE_ASYNC
-
static void
close_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
@@ -157,7 +154,6 @@ open_callback (GnomeVFSAsyncHandle *handle,
info->buffer = g_new (char, 4096);
gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info);
}
-#endif
void
e_summary_url_request (GtkHTML *html,
@@ -165,14 +161,10 @@ e_summary_url_request (GtkHTML *html,
GtkHTMLStream *stream)
{
char *filename;
-#ifndef USE_ASYNC
- GnomeVFSHandle *handle = NULL;
- GnomeVFSResult result;
-#else
GnomeVFSAsyncHandle *handle;
DownloadInfo *info;
-#endif
+ g_print ("url: %s\n", url);
if (strncasecmp (url, "file:", 5) == 0) {
url += 5;
filename = e_pixmap_file (url);
@@ -187,42 +179,7 @@ e_summary_url_request (GtkHTML *html,
}
g_print ("Filename: %s\n", filename);
-#ifndef USE_ASYNC
- result = gnome_vfs_open (&handle, filename, GNOME_VFS_OPEN_READ);
-
- if (result != GNOME_VFS_OK) {
- g_warning ("%s: %s", filename,
- gnome_vfs_result_to_string (result));
- g_free (filename);
- gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
- return;
- }
-
- g_free (filename);
- while (1) {
- char buffer[4096];
- GnomeVFSFileSize size;
-
- /* Clear buffer */
- memset (buffer, 0x00, 4096);
-
- result = gnome_vfs_read (handle, buffer, 4096, &size);
- if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
- g_warning ("Error reading data: %s",
- gnome_vfs_result_to_string (result));
- gnome_vfs_close (handle);
- gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
- }
- if (size == 0)
- break; /* EOF */
-
- gtk_html_stream_write (stream, buffer, size);
- }
-
- gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
- gnome_vfs_close (handle);
-#else
info = g_new (DownloadInfo, 1);
info->stream = stream;
info->uri = filename;
@@ -230,8 +187,6 @@ e_summary_url_request (GtkHTML *html,
gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ,
(GnomeVFSAsyncOpenCallback) open_callback, info);
-#endif
-
}
static char *
@@ -463,13 +418,12 @@ dialog_destroyed (GtkObject *object,
CORBA_exception_init (&ev);
Bonobo_EventSource_removeListener (dialog->eventsource,
- dialog->corba_listener, &ev);
+ dialog->listener_id, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error: %s", CORBA_exception_id (&ev));
}
bonobo_object_unref (BONOBO_OBJECT (dialog->listener));
- bonobo_object_release_unref (dialog->eventsource, &ev);
CORBA_exception_free (&ev);
g_free (dialog);
}
@@ -484,6 +438,7 @@ e_summary_url_click (GtkWidget *widget,
int address;
ESummaryWindow *window;
Bonobo_Control control;
+ Bonobo_Listener corba_listener;
GtkWidget *prefsbox, *control_widget;
CORBA_Environment ev;
PropertyDialog *data;
@@ -533,11 +488,11 @@ e_summary_url_click (GtkWidget *widget,
data->dialog = prefsbox;
CORBA_exception_init (&ev);
- data->eventsource = bonobo_object_dup_ref (window->event_source, &ev);
+ data->eventsource = window->event_source;
data->listener = bonobo_listener_new (property_event, data);
- data->corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener));
- Bonobo_EventSource_addListener (data->eventsource,
- data->corba_listener, &ev);
+ corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (data->listener));
+ data->listener_id = Bonobo_EventSource_addListener (data->eventsource,
+ corba_listener, &ev);
gtk_signal_connect (GTK_OBJECT (prefsbox), "apply",
GTK_SIGNAL_FUNC (property_apply),
diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c
index 12ed32376e..4172b7ce0f 100644
--- a/executive-summary/component/e-summary.c
+++ b/executive-summary/component/e-summary.c
@@ -572,44 +572,31 @@ e_summary_queue_rebuild (ESummary *esummary)
}
static void
-html_event (BonoboListener *listener,
- char *event_name,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data)
+listener_event (BonoboListener *listener,
+ char *event_name,
+ BonoboArg *event_data,
+ CORBA_Environment *ev,
+ gpointer user_data)
{
ESummaryWindow *window = (ESummaryWindow *) user_data;
- g_print ("Event: %s\n", event_name);
- if (strcmp (event_name, EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED) != 0) {
- return;
- }
-
- e_summary_queue_rebuild (window->esummary);
-}
-
-static void
-prop_changed_cb (BonoboListener *listener,
- char *name,
- BonoboArg *arg,
- CORBA_Environment *ev,
- ESummaryWindow *window)
-{
- if (strcmp (name, "window_title") == 0) {
+ if (strcmp (event_name, "Bonobo/Property:change:window_title") == 0) {
if (window->title != NULL)
g_free (window->title);
- window->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
- e_summary_queue_rebuild (window->esummary);
- return;
- }
- if (strcmp (name, "window_icon") == 0) {
+ window->title = g_strdup (BONOBO_ARG_GET_STRING (event_data));
+ e_summary_queue_rebuild (window->esummary);
+ } else if (strcmp (event_name, "Bonobo/Property:change:window_icon") == 0) {
if (window->icon != NULL)
g_free (window->icon);
- window->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
+
+ window->icon = g_strdup (BONOBO_ARG_GET_STRING (event_data));
+ e_summary_queue_rebuild (window->esummary);
+ } else if (strcmp (event_name, EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED) == 0) {
e_summary_queue_rebuild (window->esummary);
- return;
}
+
+ return;
}
ESummaryWindow *
@@ -620,6 +607,7 @@ e_summary_add_service (ESummary *esummary,
ESummaryWindow *window;
ESummaryPrivate *priv;
Bonobo_Unknown unknown = CORBA_OBJECT_NIL;
+ Bonobo_Listener listener;
CORBA_Environment ev;
g_return_val_if_fail (esummary != NULL, NULL);
@@ -669,25 +657,11 @@ e_summary_add_service (ESummary *esummary,
return NULL;
}
- if (window->html != CORBA_OBJECT_NIL) {
- Bonobo_Listener listener;
- CORBA_Environment ev2;
-
- /* If HTML view, then set up the listeners. */
- window->event_source = Bonobo_Unknown_queryInterface (window->html,
- "IDL:Bonobo/EventSource:1.0",
- &ev);
- window->html_listener = bonobo_listener_new (html_event,
- window);
- listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->html_listener));
- window->html_corba_listener = listener;
-
- CORBA_exception_init (&ev2);
- Bonobo_EventSource_addListener (window->event_source,
- listener, &ev2);
- /* Catch error? FIXME */
- CORBA_exception_free (&ev2);
- }
+ window->listener = bonobo_listener_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (window->listener), "event_notify",
+ GTK_SIGNAL_FUNC (listener_event), window);
+ listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->listener));
+ window->listener_id = Bonobo_EventSource_addListener (window->event_source, listener, &ev);
unknown = Bonobo_Unknown_queryInterface (component,
"IDL:Bonobo/PropertyBag:1.0",
@@ -712,20 +686,6 @@ e_summary_add_service (ESummary *esummary,
window->icon = g_strdup (bonobo_property_bag_client_get_value_string (
window->propertybag,
"window_icon", NULL));
- /* Listen to changes */
- if (window->propertycontrol != CORBA_OBJECT_NIL) {
- Bonobo_Listener listener;
- CORBA_Environment ev2;
-
- window->listener = bonobo_listener_new (NULL, NULL);
- listener = bonobo_object_corba_objref (BONOBO_OBJECT (window->html_listener));
-
- Bonobo_EventSource_addListener (window->event_source,
- listener, &ev);
-
- gtk_signal_connect (GTK_OBJECT (window->listener), "event_notify",
- GTK_SIGNAL_FUNC (prop_changed_cb), window);
- }
CORBA_exception_free (&ev);
priv->window_list = g_list_append (priv->window_list, window);
@@ -774,7 +734,7 @@ e_summary_window_free (ESummaryWindow *window)
if (window->event_source != CORBA_OBJECT_NIL) {
Bonobo_EventSource_removeListener (window->event_source,
- window->html_corba_listener,
+ window->listener_id,
&ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("CORBA ERROR: %s", CORBA_exception_id (&ev));
@@ -782,10 +742,6 @@ e_summary_window_free (ESummaryWindow *window)
bonobo_object_release_unref (window->event_source, &ev);
}
- if (window->html != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->html, &ev);
- }
-
if (window->propertybag != CORBA_OBJECT_NIL) {
bonobo_object_release_unref (window->propertybag, &ev);
}
@@ -802,8 +758,8 @@ e_summary_window_free (ESummaryWindow *window)
bonobo_object_unref (BONOBO_OBJECT (window->listener));
}
- if (window->html_listener) {
- bonobo_object_unref (BONOBO_OBJECT (window->html_listener));
+ if (window->html != CORBA_OBJECT_NIL) {
+ bonobo_object_release_unref (window->html, &ev);
}
bonobo_object_release_unref (window->component, &ev);
diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h
index 3ac6b1eaeb..470863a9f5 100644
--- a/executive-summary/component/e-summary.h
+++ b/executive-summary/component/e-summary.h
@@ -54,13 +54,11 @@ struct _ESummaryWindow {
Bonobo_PersistStream persiststream;
Bonobo_PropertyBag propertybag;
Bonobo_PropertyControl propertycontrol;
- Bonobo_EventSource property_event_source;
Bonobo_EventSource event_source;
-
+ /* Listener for the event_source */
BonoboListener *listener;
- BonoboListener *html_listener;
- Bonobo_Listener html_corba_listener;
+ int listener_id;
char *iid;
char *title;
diff --git a/executive-summary/evolution-services/executive-summary-component.c b/executive-summary/evolution-services/executive-summary-component.c
index 96c50b1acb..d2dab70947 100644
--- a/executive-summary/evolution-services/executive-summary-component.c
+++ b/executive-summary/evolution-services/executive-summary-component.c
@@ -91,17 +91,6 @@ executive_summary_component_destroy (GtkObject *object)
if (priv == NULL)
return;
- CORBA_exception_init (&ev);
-
-#if 0
- if (priv->owner_client != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
- priv->owner_client = NULL;
- }
-#endif
-
- CORBA_exception_free (&ev);
-
g_free (priv);
component->private = NULL;
@@ -230,7 +219,6 @@ impl_GNOME_Evolution_Summary_ComponentFactory_createView (PortableServer_Servant
ExecutiveSummaryComponentFactory *factory;
ExecutiveSummaryComponentFactoryPrivate *priv;
GNOME_Evolution_Summary_Component component, component_dup;
- CORBA_Environment ev2;
bonobo_object = bonobo_object_from_servant (servant);
factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (bonobo_object);
@@ -240,9 +228,8 @@ impl_GNOME_Evolution_Summary_ComponentFactory_createView (PortableServer_Servant
g_return_val_if_fail (view != NULL, CORBA_OBJECT_NIL);
component = bonobo_object_corba_objref (BONOBO_OBJECT (view));
- CORBA_exception_init (&ev2);
- component_dup = CORBA_Object_duplicate (component, &ev2);
- CORBA_exception_free (&ev2);
+
+ component_dup = CORBA_Object_duplicate (component, ev);
return component_dup;
}
diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c
index 3e34ccb5c1..1792a5a53e 100644
--- a/executive-summary/evolution-services/executive-summary-html-view.c
+++ b/executive-summary/evolution-services/executive-summary-html-view.c
@@ -101,6 +101,7 @@ executive_summary_html_view_destroy (GtkObject *object)
if (priv == NULL)
return;
+ bonobo_object_unref (BONOBO_OBJECT (priv->event_source));
g_free (priv->html);
g_free (priv);
diff --git a/executive-summary/summary.html b/executive-summary/summary.html
index d7e68d7921..79542b87dd 100644
--- a/executive-summary/summary.html
+++ b/executive-summary/summary.html
@@ -4,7 +4,7 @@
</head>
<body bgcolor="#ffffff" background="executive-summary-bg.png">
-<table cellpadding="0" cellspacing="0" numcols="3" width="100%" height="100%">
+<table cellpadding="0" cellspacing="0" numcols="3" width="100%" height="100%" border="0">
<tr>
<td bgcolor="#9aadbf" height="102">
<img src="butterfly.png"></td>
@@ -12,26 +12,30 @@
E V O L U T I O N
</td></tr>
<tr><td bgcolor="#9aadbf">&nbsp;</td>
-<td><img src="executive-summary-curve.png"></td>
-<td width="100%" align="left">
-<table>
+<td valign="top" width="100"><img src="executive-summary-curve.png"></td>
+<td width="95%">
+
+<table border="0" align="middle">
<tr>
-<td valign="middle">Search on Google: </td>
-<td valign="middle"><form method="get" action="/search" name="f"><input type="text" size="15" name=q></form></td>
-</tr>
-</table>
+<td align="left">
+ <form method="get" action="/search" name="f">
+ <b>Search On Google</b>
+ <input type="text" size="15" name=q>
+ <input type="submit" name"submit">
+ </form>
</td>
</tr>
-<tr height="100%">
-<td height="100%" bgcolor="#9aadbf">&nbsp;</td>
-<td colspan="2"><table width="100%" height="100%">
<tr>
-<td>
+<td colspan="2">
<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->
</td>
</tr>
+
</table>
+
+</td>
</tr>
+
</table>
</body>
</html>
diff --git a/executive-summary/test-service/rdf-summary.c b/executive-summary/test-service/rdf-summary.c
index 9e4c699c2d..961115e6eb 100644
--- a/executive-summary/test-service/rdf-summary.c
+++ b/executive-summary/test-service/rdf-summary.c
@@ -54,6 +54,8 @@ struct _RdfSummary {
GString *str;
char *buffer;
+
+ GnomeVFSAsyncHandle *handle;
};
typedef struct _RdfSummary RdfSummary;
@@ -225,11 +227,10 @@ tree_walk (xmlNodePtr root,
g_string_append (html, "<br clear=all><FONT size=\"-1\" face=\"helvetica\"><P><UL>\n");
+ items = MIN (limit, items);
for (i = 0; i < items; i++) {
char *p = layer_find (item[i]->childs, "title", "No information");
- if(i == limit)
- g_string_append (html, "--\n");
if (wipe_trackers) {
char *p = layer_find_url (item[i]->childs, "link", "");
char *x = strchr (p, '?');
@@ -277,6 +278,9 @@ view_destroyed (GtkObject *object,
{
RdfSummary *summary = (RdfSummary *) data;
+ if (summary->handle)
+ gnome_vfs_async_cancel (summary->handle);
+
g_free (summary->title);
g_free (summary->icon);
g_free (summary);
@@ -317,6 +321,13 @@ load_from_stream (BonoboPersistStream *ps,
g_print ("Hydrating with %s\n", str);
doc = xmlParseDoc ((xmlChar *) str);
+
+ if (doc == NULL) {
+ g_warning ("Bad data: %s!", str);
+ g_free (str);
+ return;
+ }
+
g_free (str);
root = doc->root;
@@ -418,6 +429,7 @@ close_callback (GnomeVFSAsyncHandle *handle,
if (summary == NULL)
return;
+ summary->handle = NULL;
g_free (summary->buffer);
xml = summary->str->str;
g_string_free (summary->str, FALSE);
@@ -475,16 +487,23 @@ read_callback (GnomeVFSAsyncHandle *handle,
summary->location);
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view), emsg);
g_free (emsg);
- gnome_vfs_async_close (handle, close_callback, NULL);
+ gnome_vfs_async_close (handle,
+ (GnomeVFSAsyncCloseCallback) close_callback,
+ NULL);
+ g_print ("NULLING\n");
+ summary->handle = NULL;
}
if (bytes_read == 0) {
/* EOF */
- gnome_vfs_async_close (handle, close_callback, summary);
+ gnome_vfs_async_close (handle,
+ (GnomeVFSAsyncCloseCallback) close_callback,
+ summary);
} else {
*((char *) buffer + bytes_read) = 0;
g_string_append (summary->str, (const char *) buffer);
- gnome_vfs_async_read (handle, buffer, 4095, read_callback,
+ gnome_vfs_async_read (handle, buffer, 4095,
+ (GnomeVFSAsyncReadCallback) read_callback,
summary);
}
}
@@ -513,24 +532,32 @@ open_callback (GnomeVFSAsyncHandle *handle,
summary->location);
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view), emsg);
g_free (emsg);
+ summary->handle = NULL;
return;
}
summary->str = g_string_new ("");
summary->buffer = g_new (char, 4096);
- gnome_vfs_async_read (handle, summary->buffer, 4095, read_callback, summary);
+ gnome_vfs_async_read (handle, summary->buffer, 4095,
+ (GnomeVFSAsyncReadCallback) read_callback,
+ summary);
}
static int
download (RdfSummary *summary)
{
GnomeVFSAsyncHandle *handle;
+ char *html = "<b>Loading RDF file. . .<br>Please wait</b>";
+
+ executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view),
+ html);
gnome_vfs_async_open (&handle, summary->location, GNOME_VFS_OPEN_READ,
(GnomeVFSAsyncOpenCallback) open_callback,
summary);
+ summary->handle = handle;
return FALSE;
}
@@ -570,6 +597,7 @@ set_prop (BonoboPropertyBag *bag,
g_free (summary->title);
summary->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ g_print ("Notify listener!\n");
bonobo_property_bag_notify_listeners (bag, "window_title",
arg, NULL);
break;
@@ -579,6 +607,7 @@ set_prop (BonoboPropertyBag *bag,
g_free (summary->icon);
summary->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
+ g_print ("Notify listener 2\n");
bonobo_property_bag_notify_listeners (bag, "window_icon",
arg, NULL);
break;
@@ -678,7 +707,6 @@ create_view (ExecutiveSummaryComponentFactory *_factory,
BonoboPersistStream *stream;
BonoboPropertyBag *bag;
BonoboPropertyControl *property;
- char *html = "<b>Loading RDF file. . .<br>Please wait</b>";
summary = g_new (RdfSummary, 1);
summary->icon = g_strdup ("apple-green.png");
@@ -696,13 +724,11 @@ create_view (ExecutiveSummaryComponentFactory *_factory,
BonoboPropertyControl as we can only have one Bonobo::EventSource
interface aggregated */
event_source = bonobo_event_source_new ();
-
+ bonobo_object_ref (BONOBO_OBJECT (event_source));
/* Summary::HtmlView */
view = executive_summary_html_view_new_full (event_source);
summary->view = view;
- executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view),
- html);
bonobo_object_add_interface (component, view);
/* Bonobo::PropertyBag */
@@ -781,9 +807,6 @@ main (int argc,
factory_init ();
bonobo_main ();
- if (factory != NULL)
- bonobo_object_unref (BONOBO_OBJECT (factory));
-
return 0;
}