diff options
author | Iain Holmes <iain@helixcode.com> | 2000-10-10 08:03:25 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2000-10-10 08:03:25 +0800 |
commit | 31f7447f6cef8ea08fd323e4d56e76a1999431a5 (patch) | |
tree | 944d4845786e9d96b764291b431c0a0f78392770 /executive-summary | |
parent | 24926636e65df9318a9e688f885b34fccdb77cd6 (diff) | |
download | gsoc2013-evolution-31f7447f6cef8ea08fd323e4d56e76a1999431a5.tar.gz gsoc2013-evolution-31f7447f6cef8ea08fd323e4d56e76a1999431a5.tar.zst gsoc2013-evolution-31f7447f6cef8ea08fd323e4d56e76a1999431a5.zip |
Added an icon parameter to the create_view methods.
2000-10-09 Iain Holmes <iain@helixcode.com>
* idl/SummaryComponent.idl: Added an icon parameter to the
create_view methods.
* evolution-services/executive-summary-component.c: Implement
the icon parameter.
* evolution-services/executive-summary-component-client.c: Ditto
* component/e-summary.c: Draw the specified icon.
* component/e-summary-factory.c: Use the icon parameter
svn path=/trunk/; revision=5805
Diffstat (limited to 'executive-summary')
10 files changed, 80 insertions, 29 deletions
diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog index 9e2e5546a5..fe5e4cb314 100644 --- a/executive-summary/ChangeLog +++ b/executive-summary/ChangeLog @@ -1,3 +1,22 @@ +2000-10-09 Iain Holmes <iain@helixcode.com> + + * idl/SummaryComponent.idl: Added an icon parameter to the + create_view methods. + + * evolution-services/executive-summary-component.c: Implement + the icon parameter. + + * evolution-services/executive-summary-component-client.c: Ditto + + * component/e-summary.c: Draw the specified icon. + + * component/e-summary-factory.c: Use the icon parameter. + +2000-10-09 Iain Holmes <iain@helixcode.com> + + * evolution-services/Makefile.am: Added $(EXTRA_GNOME_CFLAGS) to + find gnomesupport.h + 2000-10-06 Iain Holmes <iain@helixcode.com> * component/e-summary.c (request_cb): Use gnome-vfs to retrieve diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c index 355432f338..c0d0dd5ed4 100644 --- a/executive-summary/component/e-summary-factory.c +++ b/executive-summary/component/e-summary-factory.c @@ -190,6 +190,7 @@ embed_service (GtkWidget *widget, NULL}; char *obj_id; char *title; + char *icon; char *html; obj_id = bonobo_selector_select_id ("Select a service", @@ -207,8 +208,8 @@ embed_service (GtkWidget *widget, executive_summary_component_client_set_owner (client, summary); /* Create view */ - html = executive_summary_component_client_create_html_view (client, &title); - e_summary_add_html_service (esummary, summary, client, html, title); + html = executive_summary_component_client_create_html_view (client, &title, &icon); + e_summary_add_html_service (esummary, summary, client, html, title, icon); g_free (html); e_summary_rebuild_page (esummary); diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c index 2c6f8e9f62..1ece837ada 100644 --- a/executive-summary/component/e-summary.c +++ b/executive-summary/component/e-summary.c @@ -65,6 +65,7 @@ typedef struct _ESummaryWindow { ExecutiveSummary *summary; ExecutiveSummaryComponentClient *client; char *title; + char *icon; ESummaryWindowType type; @@ -245,7 +246,7 @@ static void e_summary_end_load (ESummary *summary) { ESummaryPrivate *priv; - char *footer = "<hr></body></html>"; + char *footer = "</body></html>"; priv = summary->private; gtk_html_write (GTK_HTML (priv->html), priv->stream, @@ -358,15 +359,15 @@ e_summary_display_window (ESummary *esummary, /** FIXME: Make this faster by caching it? */ title_cid = g_strdup_printf ("<table cellspacing=\"0\" " - "cellpadding=\"0\" border=\"0\" " - "height=\"100%%\" width=\"100%%\">" + "cellpadding=\"0\" border=\"0\" width=\"100%%\" height=\"100%%\">" "<tr><td bgcolor=\"#%s\">" - "<table><tr><td>" - "<img src=\"envelope.png\"></td>" - "<td nowrap align=\"center\">" + "<table width=\"100%%\"><tr><td>" + "<img src=\"%s\"></td>" + "<td nowrap align=\"center\" width=\"100%%\">" "<b>%s</b></td></tr></table></td></tr><tr>" - "<td bgcolor=\"#%s\" width=\"100%%\" height=\"100%%\">", + "<td bgcolor=\"#%s\" height=\"100%%\">", title_colour[col % 2], + window->icon, window->title, colour[col % 2]); @@ -399,7 +400,7 @@ e_summary_rebuild_page (ESummary *esummary) { ESummaryPrivate *priv; GList *windows; - char *service_table = "<table numcols=\"3\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; + char *service_table = "<table numcols=\"3\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" height=\"100%\">"; int loc; g_return_val_if_fail (esummary != NULL, FALSE); @@ -418,7 +419,7 @@ e_summary_rebuild_page (ESummary *esummary) loc = 0; for (windows = priv->window_list; windows; windows = windows->next) { ESummaryWindow *window; - char *td = "<td height=\"100%%\" width=\"33%%\" valign=\"top\">"; + char *td = "<td height=\"100%\" width=\"33%\" valign=\"top\">"; window = windows->data; @@ -428,7 +429,7 @@ e_summary_rebuild_page (ESummary *esummary) priv->stream, "</tr>", 5); } gtk_html_write (GTK_HTML (priv->html), - priv->stream, "<tr>", 4); + priv->stream, "<tr height=\"100%\">", 18); } gtk_html_write (GTK_HTML (priv->html), priv->stream, @@ -454,7 +455,8 @@ e_summary_add_html_service (ESummary *esummary, ExecutiveSummary *summary, ExecutiveSummaryComponentClient *client, const char *html, - const char *title) + const char *title, + const char *icon) { ESummaryWindow *window; ESummaryPrivate *priv; @@ -463,6 +465,8 @@ e_summary_add_html_service (ESummary *esummary, window->type = E_SUMMARY_WINDOW_HTML; window->html = g_strdup (html); window->title = g_strdup (title); + window->icon = icon ? g_strdup (icon) : NULL; + window->client = client; window->summary = summary; priv = esummary->private; @@ -476,7 +480,8 @@ e_summary_add_bonobo_service (ESummary *esummary, ExecutiveSummary *summary, ExecutiveSummaryComponentClient *client, GtkWidget *control, - const char *title) + const char *title, + const char *icon) { ESummaryWindow *window; ESummaryPrivate *priv; @@ -489,7 +494,8 @@ e_summary_add_bonobo_service (ESummary *esummary, window->title = g_strdup (title); window->summary = summary; - + window->icon = icon ? g_strdup (icon): NULL; + priv = esummary->private; priv->window_list = g_list_append (priv->window_list, window); @@ -501,6 +507,7 @@ e_summary_window_free (ESummaryWindow *window, ESummaryPrivate *priv) { g_free (window->title); + g_free (window->icon); if (window->type == E_SUMMARY_WINDOW_BONOBO) gtk_widget_unref (window->control); else diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h index 24d0bf7d4e..02deb8c7a8 100644 --- a/executive-summary/component/e-summary.h +++ b/executive-summary/component/e-summary.h @@ -59,12 +59,14 @@ void e_summary_add_html_service (ESummary *esummary, ExecutiveSummary *summary, ExecutiveSummaryComponentClient *client, const char *html, - const char *title); + const char *title, + const char *icon); void e_summary_add_bonobo_service (ESummary *esummary, ExecutiveSummary *summary, ExecutiveSummaryComponentClient *client, GtkWidget *control, - const char *title); + const char *title, + const char *icon); void e_summary_update_window (ESummary *esummary, ExecutiveSummary *summary, const char *html); diff --git a/executive-summary/evolution-services/executive-summary-component-client.c b/executive-summary/evolution-services/executive-summary-component-client.c index b33a876450..7702785692 100644 --- a/executive-summary/evolution-services/executive-summary-component-client.c +++ b/executive-summary/evolution-services/executive-summary-component-client.c @@ -199,7 +199,8 @@ executive_summary_component_client_supports (ExecutiveSummaryComponentClient *cl Bonobo_Control executive_summary_component_client_create_bonobo_view (ExecutiveSummaryComponentClient *client, - char **title) + char **title, + char **icon) { Bonobo_Control control; Evolution_SummaryComponent component; @@ -211,7 +212,7 @@ executive_summary_component_client_create_bonobo_view (ExecutiveSummaryComponent CORBA_exception_init (&ev); component = bonobo_object_corba_objref (BONOBO_OBJECT (client)); - control = Evolution_SummaryComponent_create_bonobo_view (component, title, &ev); + control = Evolution_SummaryComponent_create_bonobo_view (component, title, icon, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("Error creating view"); @@ -226,7 +227,8 @@ executive_summary_component_client_create_bonobo_view (ExecutiveSummaryComponent char * executive_summary_component_client_create_html_view (ExecutiveSummaryComponentClient *client, - char **title) + char **title, + char **icon) { CORBA_char *ret_html; Evolution_SummaryComponent component; @@ -239,9 +241,8 @@ executive_summary_component_client_create_html_view (ExecutiveSummaryComponentCl CORBA_exception_init (&ev); component = bonobo_object_corba_objref (BONOBO_OBJECT (client)); - g_print ("Here\n"); - ret_html = Evolution_SummaryComponent_create_html_view (component, title, &ev); - g_print ("Not here - %s\n", ret_html); + ret_html = Evolution_SummaryComponent_create_html_view (component, title, icon, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("Error creating HTML view"); CORBA_exception_free (&ev); diff --git a/executive-summary/evolution-services/executive-summary-component-client.h b/executive-summary/evolution-services/executive-summary-component-client.h index bfb3ea1939..d38f860430 100644 --- a/executive-summary/evolution-services/executive-summary-component-client.h +++ b/executive-summary/evolution-services/executive-summary-component-client.h @@ -58,10 +58,12 @@ void executive_summary_component_client_supports (ExecutiveSummaryComponentClien gboolean *bonobo, gboolean *html); Bonobo_Control executive_summary_component_client_create_bonobo_view (ExecutiveSummaryComponentClient *client, - char **title); + char **title, + char **icon); char *executive_summary_component_client_create_html_view (ExecutiveSummaryComponentClient *client, - char **title); + char **title, + char **icon); void executive_summary_component_client_configure (ExecutiveSummaryComponentClient *client); diff --git a/executive-summary/evolution-services/executive-summary-component.c b/executive-summary/evolution-services/executive-summary-component.c index 97e1d6ec97..596a780033 100644 --- a/executive-summary/evolution-services/executive-summary-component.c +++ b/executive-summary/evolution-services/executive-summary-component.c @@ -142,29 +142,35 @@ impl_Evolution_SummaryComponent_unset_owner (PortableServer_Servant servant, static Bonobo_Control impl_Evolution_SummaryComponent_create_bonobo_view (PortableServer_Servant servant, CORBA_char **title, + CORBA_char **icon, CORBA_Environment *ev) { BonoboObject *bonobo_object; ExecutiveSummaryComponent *component; ExecutiveSummaryComponentPrivate *priv; BonoboControl *control; - char *initial_title; + char *initial_title, *initial_icon; bonobo_object = bonobo_object_from_servant (servant); component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object); priv = component->private; control = (* priv->create_bonobo_view) (component, &initial_title, + &initial_icon, priv->closure); *title = CORBA_string_dup (initial_title ? initial_title:""); + *icon = CORBA_string_dup (initial_icon ? initial_icon:""); g_free (initial_title); + g_free (initial_icon); + return bonobo_object_corba_objref (BONOBO_OBJECT (control)); } static CORBA_char * impl_Evolution_SummaryComponent_create_html_view (PortableServer_Servant servant, CORBA_char **title, + CORBA_char **icon, CORBA_Environment *ev) { BonoboObject *bonobo_object; @@ -172,17 +178,20 @@ impl_Evolution_SummaryComponent_create_html_view (PortableServer_Servant servant ExecutiveSummaryComponentPrivate *priv; CORBA_char *ret_str; char *ret_html; - char *initial_title; + char *initial_title, *initial_icon; bonobo_object = bonobo_object_from_servant (servant); component = EXECUTIVE_SUMMARY_COMPONENT (bonobo_object); priv = component->private; ret_html = (* priv->create_html_view) (component, &initial_title, + &initial_icon, priv->closure); *title = CORBA_string_dup (initial_title ? initial_title:""); + *icon = CORBA_string_dup (initial_icon ? initial_icon:""); g_free (initial_title); + g_free (initial_icon); ret_str = CORBA_string_dup (ret_html ? ret_html:""); g_free (ret_html); diff --git a/executive-summary/evolution-services/executive-summary-component.h b/executive-summary/evolution-services/executive-summary-component.h index 75c1e23eb7..3cf5dade19 100644 --- a/executive-summary/evolution-services/executive-summary-component.h +++ b/executive-summary/evolution-services/executive-summary-component.h @@ -39,9 +39,11 @@ typedef struct _ExecutiveSummaryComponentClass ExecutiveSummaryComponentClass; typedef BonoboObject *(* EvolutionServicesCreateBonoboViewFn) (ExecutiveSummaryComponent *component, char **title, + char **icon, void *closure); typedef char *(* EvolutionServicesCreateHtmlViewFn) (ExecutiveSummaryComponent *component, char **title, + char **icon, void *closure); typedef void (* EvolutionServicesConfigureFn) (ExecutiveSummaryComponent *component, void *closure); diff --git a/executive-summary/idl/SummaryComponent.idl b/executive-summary/idl/SummaryComponent.idl index 4282a91f2b..55f7b6426d 100644 --- a/executive-summary/idl/SummaryComponent.idl +++ b/executive-summary/idl/SummaryComponent.idl @@ -49,9 +49,11 @@ module Evolution { * Creates a summary of the data that the component has. * Returns: A @BonoboControl of the view. */ - Bonobo::Control create_bonobo_view (out string title); + Bonobo::Control create_bonobo_view (out string title, + out string icon); - string create_html_view (out string title); + string create_html_view (out string title, + out string icon); /** * configure: diff --git a/executive-summary/test-service/main.c b/executive-summary/test-service/main.c index 626f179289..2f2fcb32b0 100644 --- a/executive-summary/test-service/main.c +++ b/executive-summary/test-service/main.c @@ -44,12 +44,15 @@ view_destroyed (GtkWidget *widget, static BonoboObject* create_view (ExecutiveSummaryComponent *component, char **title, + char **icon, void *closure) { BonoboControl *control; GtkWidget *button; *title = g_strdup ("This is the test bonobo service"); + *icon = g_strdup ("gnome-clock.png"); + button = gtk_button_new_with_label ("A test service with a whole button"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (clicked_cb), NULL); @@ -68,9 +71,12 @@ create_view (ExecutiveSummaryComponent *component, static char * create_html (ExecutiveSummaryComponent *component, char **title, + char **icon, void *closure) { *title = g_strdup ("The Magic Counter"); + *icon = g_strdup ("gnome-clock.png"); + gtk_timeout_add (1000, clicked_cb, component); return g_strdup ("Since you started this service<br><center>0</center><br>seconds have passed."); } |