From b3ce14cf25ba9ea7d7a6f297c1cd479d26f64894 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Mon, 11 Dec 2000 15:47:01 +0000 Subject: Changes to the HTML file to add an entry box. Changed to use the new BonoboPropertyControl methods, and changed executive-summary-html-view to use the same idea. Added rdf-summary to the .cvsignore, and put a timeout so that it can return imediatly if there is a hold up on the connection. svn path=/trunk/; revision=6905 --- executive-summary/ChangeLog | 21 ++++++++ executive-summary/component/Makefile.am | 1 + executive-summary/component/e-summary-url.c | 2 +- executive-summary/component/e-summary.c | 3 +- .../executive-summary-html-view.c | 58 +++++++++++++++++++--- .../executive-summary-html-view.h | 5 ++ executive-summary/summary.html | 2 +- executive-summary/test-service/.cvsignore | 3 +- executive-summary/test-service/rdf-summary.c | 18 +++++-- 9 files changed, 98 insertions(+), 15 deletions(-) diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog index 82e6eb5772..dc8d3d1382 100644 --- a/executive-summary/ChangeLog +++ b/executive-summary/ChangeLog @@ -1,3 +1,24 @@ +2000-12-11 Iain Holmes + + * evolution-services/executive-summary-html-view.h: Add a define + for the "html_changed" signal to name space it. Change the function + declarations to fit with the below change too. + + * evolution-services/executive-summary-html-view.c + (executive_summary_html_view_new): Create a default BonoboEventSource + and use the new _full function. + (executive_summary_html_view_new_full): Creates a new HtmlView with + the given BonoboEventSource. + (executive_summary_html_view_get_event_source): Returns the + BonoboEventSource for the view. + (executive_summary_html_view_set_html): Use the new #define for the event + name. + + * test-service/rdf-summary.c (create_view): Share the BonoboEventSource + between the HtmlView and the BonoboPropertyControl. + + * component/e-summary.c (html_event): Use the name spaced #define. + 2000-12-08 Iain Holmes * summary.html: Don't hardcode the image paths. diff --git a/executive-summary/component/Makefile.am b/executive-summary/component/Makefile.am index 9c0a375f68..c9931b19c0 100644 --- a/executive-summary/component/Makefile.am +++ b/executive-summary/component/Makefile.am @@ -67,6 +67,7 @@ evolution_executive_summary_LDADD = \ $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \ $(BONOBO_VFS_GNOME_LIBS) \ $(EXTRA_GNOME_LIBS) \ + -lgal \ $(GTKHTML_LIBS) \ $(UNICODE_LIBS) diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c index d53b21ec4c..dd3f6deb4e 100644 --- a/executive-summary/component/e-summary-url.c +++ b/executive-summary/component/e-summary-url.c @@ -359,7 +359,7 @@ property_event (BonoboListener *listener, gpointer user_data) { PropertyDialog *data = (PropertyDialog *) user_data; - if (strcmp (event_name, "property_box_changed") == 0) { + if (strcmp (event_name, BONOBO_PROPERTY_CONTROL_CHANGED) == 0) { gnome_property_box_changed (GNOME_PROPERTY_BOX (data->dialog)); return; } diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c index 587b063e6a..925f4501fe 100644 --- a/executive-summary/component/e-summary.c +++ b/executive-summary/component/e-summary.c @@ -44,6 +44,7 @@ #include #include +#include #define PARENT_TYPE (gtk_vbox_get_type ()) @@ -568,7 +569,7 @@ html_event (BonoboListener *listener, ESummaryWindow *window = (ESummaryWindow *) user_data; g_print ("Event: %s\n", event_name); - if (strcmp (event_name, "html_changed") != 0) { + if (strcmp (event_name, EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED) != 0) { return; } diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c index ebc3ae9b23..3e34ccb5c1 100644 --- a/executive-summary/evolution-services/executive-summary-html-view.c +++ b/executive-summary/evolution-services/executive-summary-html-view.c @@ -161,17 +161,18 @@ E_MAKE_TYPE (executive_summary_html_view, "ExecutiveSummaryHtmlView", static void executive_summary_html_view_construct (ExecutiveSummaryHtmlView *view, + BonoboEventSource *event_source, GNOME_Evolution_Summary_HTMLView corba_object) { ExecutiveSummaryHtmlViewPrivate *priv; g_return_if_fail (view != NULL); + g_return_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view)); g_return_if_fail (corba_object != CORBA_OBJECT_NIL); priv = view->private; - priv->event_source = bonobo_event_source_new (); - g_warning ("new event source: %p", priv->event_source); + priv->event_source = event_source; bonobo_object_add_interface (BONOBO_OBJECT (view), BONOBO_OBJECT (priv->event_source)); @@ -180,7 +181,9 @@ executive_summary_html_view_construct (ExecutiveSummaryHtmlView *view, /*** Public API ***/ /** - * executive_summary_html_view_new: + * executive_summary_html_view_new_full: + * @event_source: A BonoboEventSource that will be aggregated onto the + * interface. * * Creates a new BonoboObject that implements * the HTMLView.idl interface. @@ -188,12 +191,15 @@ executive_summary_html_view_construct (ExecutiveSummaryHtmlView *view, * Returns: A BonoboObject. */ BonoboObject * -executive_summary_html_view_new (void) +executive_summary_html_view_new_full (BonoboEventSource *event_source) { ExecutiveSummaryHtmlView *view; POA_GNOME_Evolution_Summary_HTMLView *servant; GNOME_Evolution_Summary_HTMLView corba_object; + g_return_val_if_fail (event_source != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_EVENT_SOURCE (event_source), NULL); + servant = create_servant (); if (servant == NULL) return NULL; @@ -201,11 +207,32 @@ executive_summary_html_view_new (void) view = gtk_type_new (executive_summary_html_view_get_type ()); corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (view), servant); - executive_summary_html_view_construct (view, corba_object); + + bonobo_object_ref (BONOBO_OBJECT (event_source)); + executive_summary_html_view_construct (view, event_source, corba_object); return BONOBO_OBJECT (view); } +/** + * executive_summary_html_view_new: + * + * Creates a new BonoboObject that implements + * the HTMLView.idl interface. + * Creates a default Bonobo::EventSource interface that will be aggregated onto + * the interface. + * + * Returns: A BonoboObject. + */ +BonoboObject * +executive_summary_html_view_new (void) +{ + BonoboEventSource *event_source; + + event_source = bonobo_event_source_new (); + return executive_summary_html_view_new_full (event_source); +} + /** * executive_summary_html_view_set_html: * @view: The ExecutiveSummaryHtmlView to operate on, @@ -240,10 +267,11 @@ executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view, any._type = (CORBA_TypeCode) TC_short; any._value = &s; - g_warning ("Notifying event source: %p", priv->event_source); bonobo_event_source_notify_listeners (BONOBO_EVENT_SOURCE (priv->event_source), - "html_changed", &any, NULL); + EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED, + &any, NULL); } + /** * executive_summary_html_view_get_html: * @view: The ExecutiveSummaryHtmlView to operate on. @@ -267,3 +295,19 @@ executive_summary_html_view_get_html (ExecutiveSummaryHtmlView *view) return priv->html; } +/** + * executive_summary_html_view_get_event_source: + * @view: The ExecutiveSummaryHtmlView to operate on. + * + * Retrieves the BonoboEventSource that is used in this view. + * + * Returns: A BonoboEventSource pointer. + */ +BonoboEventSource * +executive_summary_html_view_get_event_source (ExecutiveSummaryHtmlView *view) +{ + g_return_val_if_fail (view != NULL, NULL); + g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view), NULL); + + return view->private->event_source; +} diff --git a/executive-summary/evolution-services/executive-summary-html-view.h b/executive-summary/evolution-services/executive-summary-html-view.h index 19e40cb2b8..3c8895167d 100644 --- a/executive-summary/evolution-services/executive-summary-html-view.h +++ b/executive-summary/evolution-services/executive-summary-html-view.h @@ -25,6 +25,9 @@ #define _EXECUTIVE_SUMMARY_HTML_VIEW_H__ #include +#include + +#define EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED "GNOME:Evolution:Summary:HTMLView:html_changed" #define EXECUTIVE_SUMMARY_HTML_VIEW_TYPE (executive_summary_html_view_get_type ()) #define EXECUTIVE_SUMMARY_HTML_VIEW(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE, ExecutiveSummaryHtmlView)) @@ -47,11 +50,13 @@ struct _ExecutiveSummaryHtmlViewClass { }; GtkType executive_summary_html_view_get_type (void); +BonoboObject *executive_summary_html_view_new_full (BonoboEventSource *event_source); BonoboObject *executive_summary_html_view_new (void); void executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view, const char *html); const char *executive_summary_html_view_get_html (ExecutiveSummaryHtmlView *view); +BonoboEventSource *executive_summary_html_view_get_event_source (ExecutiveSummaryHtmlView *view); #endif diff --git a/executive-summary/summary.html b/executive-summary/summary.html index 649777d1c6..bec3417476 100644 --- a/executive-summary/summary.html +++ b/executive-summary/summary.html @@ -13,7 +13,7 @@ E V O L U T I O N   -Use this to search for something on Google +
Search on Google:
  diff --git a/executive-summary/test-service/.cvsignore b/executive-summary/test-service/.cvsignore index 2473a602c4..24785c988a 100644 --- a/executive-summary/test-service/.cvsignore +++ b/executive-summary/test-service/.cvsignore @@ -3,4 +3,5 @@ Makefile core .deps .libs -test-service \ No newline at end of file +test-service +rdf-summary diff --git a/executive-summary/test-service/rdf-summary.c b/executive-summary/test-service/rdf-summary.c index 9596472a58..48b4b8ece0 100644 --- a/executive-summary/test-service/rdf-summary.c +++ b/executive-summary/test-service/rdf-summary.c @@ -300,6 +300,7 @@ download (RdfSummary *summary) /* Then parse it */ /* The update it */ + g_print ("Starting download\n"); view = EXECUTIVE_SUMMARY_HTML_VIEW (summary->view); result = gnome_vfs_open (&handle, summary->location, GNOME_VFS_OPEN_READ); @@ -353,6 +354,8 @@ download (RdfSummary *summary) tree_walk (doc->root, summary, html); executive_summary_html_view_set_html (view, html->str); g_string_free (html, TRUE); + + g_print ("Finished Download\n"); return FALSE; } @@ -495,7 +498,7 @@ create_view (ExecutiveSummaryComponentFactory *_factory, void *closure) { RdfSummary *summary; - BonoboObject *component, *view, *bag, *property; + BonoboObject *component, *view, *bag, *property, *event_source; char *html = "Loading RDF file. . .
Please wait
"; summary = g_new (RdfSummary, 1); @@ -510,7 +513,12 @@ create_view (ExecutiveSummaryComponentFactory *_factory, summary->component = component; - view = executive_summary_html_view_new (); + /* Share the event source between the ExecutiveSummaryHtmlView and the + BonoboPropertyControl as we can only have one Bonobo::EventSource + interface aggregated */ + event_source = bonobo_event_source_new (); + + view = executive_summary_html_view_new_full (BONOBO_EVENT_SOURCE (event_source)); summary->view = view; executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view), html); @@ -528,7 +536,9 @@ create_view (ExecutiveSummaryComponentFactory *_factory, "The icon for this component's window", 0); bonobo_object_add_interface (component, bag); - property = bonobo_property_control_new (property_control, 1, summary); + property = bonobo_property_control_new_full (property_control, 1, + BONOBO_EVENT_SOURCE (event_source), + summary); summary->property_control = property; gtk_signal_connect (GTK_OBJECT (property), "action", @@ -537,7 +547,7 @@ create_view (ExecutiveSummaryComponentFactory *_factory, bonobo_object_add_interface (component, property); running_views++; - g_idle_add (download, summary); + gtk_timeout_add (5000, download, summary); return component; } -- cgit v1.2.3