Removed; this code has not been used since pre-1.0.

* executive-summary/*: Removed; this code has not been used since
	pre-1.0.

	* my-evolution/*: Removed; gone in evolution 2.0.

	* notes/*: Removed; never finished and no one is working on it.

	* configure.in (E_UTIL_{CFLAGS,LIBS}): Remove soup-2.0 since
	e-proxy is gone.
	(EVOLUTION_MAIL_{CFLAGS,LIBS}): Remove soup-2.0 since the mailer
	uses CamelHTTPStream now.
	(EVOLUTION_EXECUTIVE_SUMMARY_{CFLAGS,LIBS}): Gone
	(AC_OUTPUT): Remove my-evolution/Makefile

	* README: evolution no longer depends on soup

svn path=/trunk/; revision=22976
This commit is contained in:
Dan Winship 2003-10-22 14:12:47 +00:00
parent 31be44baaa
commit 27e6d3cb39
121 changed files with 20 additions and 30405 deletions

View File

@ -1,3 +1,21 @@
2003-10-22 Dan Winship <danw@ximian.com>
* executive-summary/*: Removed; this code has not been used since
pre-1.0.
* my-evolution/*: Removed; gone in evolution 2.0.
* notes/*: Removed; never finished and no one is working on it.
* configure.in (E_UTIL_{CFLAGS,LIBS}): Remove soup-2.0 since
e-proxy is gone.
(EVOLUTION_MAIL_{CFLAGS,LIBS}): Remove soup-2.0 since the mailer
uses CamelHTTPStream now.
(EVOLUTION_EXECUTIVE_SUMMARY_{CFLAGS,LIBS}): Gone
(AC_OUTPUT): Remove my-evolution/Makefile
* README: evolution no longer depends on soup
2003-10-21 Dan Winship <danw@ximian.com>
* configure.in (GNOME_COMPILE_WARNINGS): Turn off the annoying

4
README
View File

@ -68,10 +68,6 @@ dependencies should be compiled in the order they are listed here):
If you have a GNOME 2.0 installation, libgnomecanvas 2.0 is
safe to use.
* libsoup 1.99.12 or later
ftp://ftp.gnome.org/pub/gnome/sources/libsoup
* gtkhtml 3.0.1 or later
ftp://ftp.gnome.org/pub/gnome/sources/gtkhtml

View File

@ -1109,7 +1109,7 @@ EVO_SET_COMPILE_FLAGS(E_NAME, libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQ
AC_SUBST(E_NAME_CFLAGS)
AC_SUBST(E_NAME_LIBS)
EVO_SET_COMPILE_FLAGS(E_UTIL, gthread-2.0 gconf-2.0 libxml-2.0 libbonoboui-2.0 libglade-2.0 gal-2.2 >= $GAL_REQUIRED libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 soup-2.0 $mozilla_nspr, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS)
EVO_SET_COMPILE_FLAGS(E_UTIL, gthread-2.0 gconf-2.0 libxml-2.0 libbonoboui-2.0 libglade-2.0 gal-2.2 >= $GAL_REQUIRED libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 $mozilla_nspr, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS)
AC_SUBST(E_UTIL_CFLAGS)
AC_SUBST(E_UTIL_LIBS)
@ -1146,12 +1146,6 @@ AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
fi
dnl -- evolution-executive-summary flags
EVO_SET_COMPILE_FLAGS(EVOLUTION_EXECUTIVE_SUMMARY, libbonoboui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libgnomeui-2.0 libglade-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 soup-2.0 libgtkhtml-3.1 >= $GTKHTML_REQUIRED)
AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS)
AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_LIBS)
dnl --- evolution-calendar flags
EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
@ -1166,7 +1160,7 @@ fi
dnl --- evolution-mail flags
EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-module-2.0 soup-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED libxml-2.0 bonobo-activation-2.0 gthread-2.0 gconf-2.0 $mozilla_nss)
EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.2 >= $GAL_REQUIRED libglade-2.0 gnome-vfs-module-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libgtkhtml-3.1 >= $GTKHTML_REQUIRED libxml-2.0 bonobo-activation-2.0 gthread-2.0 gconf-2.0 $mozilla_nss)
AC_SUBST(EVOLUTION_MAIL_CFLAGS)
AC_SUBST(EVOLUTION_MAIL_LIBS)
@ -1397,7 +1391,6 @@ shell/Makefile
shell/evolution-nognome
shell/glade/Makefile
shell/importer/Makefile
my-evolution/Makefile
ui/Makefile
views/Makefile
views/addressbook/Makefile

View File

@ -1,4 +0,0 @@
core
Makefile.in
Makefile
GNOME_Evolution_Summary.oaf

View File

@ -1,913 +0,0 @@
2003-02-06 Ettore Perazzoli <ettore@ximian.com>
* component/e-summary-factory.c (control_activate): Get
evolution-executive-summary.xml from EVOLUTION_UI_DIRECTORY.
2001-09-14 Ettore Perazzoli <ettore@ximian.com>
[Automake 1.5 fixes pointed out by Richard Boulton
<richard@tartarus.org>, as per #9258.]
* executive-summary/component/Makefile.am (CLEANFILE): Assign
directly with `=', not `+='.
* executive-summary/evolution-services/Makefile.am: Likewise.
2001-07-21 Ettore Perazzoli <ettore@ximian.com>
* component/component-factory.c: Make the "executive-summary"
folders non-user-creatable by setting `user_creatable' to %FALSE
in the `EvolutionShellComponentFolderType's.
2001-06-18 Dan Winship <danw@ximian.com>
* test-service/Makefile.am (test_service_LDADD): Remove DB3_LDADD
* component/Makefile.am (evolution_executive_summary_LDADD):
Remove DB3_LDADD
2001-06-04 Ettore Perazzoli <ettore@ximian.com>
* component/Makefile.am (evolution_executive_summary_LDADD): Move
`libevolution-services.la' on top.
2001-06-03 Ettore Perazzoli <ettore@ximian.com>
* test-service/Makefile.am (rdf_summary_LDADD): Move
`$(DB3_LDADD)' before the shared libraries.
* component/Makefile.am (evolution_executive_summary_LDADD): Move
`$(DB3_LDADD)' before libeutil.
2001-06-01 Ettore Perazzoli <ettore@ximian.com>
* component/Makefile.am (evolution_executive_summary_LDADD): Add
`$(DB3_LDADD)'.
* test-service/Makefile.am (test_service_LDADD): Likewise.
(rdf_summary_LDADD): Likewise.
2001-05-27 Dan Winship <danw@ximian.com>
* component/e-summary-factory.c: #include
"evolution-shell-component-utils.h" rather than "e-gui-utils.h"
for e_pixmaps_update.
* component/Makefile.am (evolution_executive_summary_LDADD): Use
libeshell.la, not libeshell.a (Did Peter forget to commit this?)
2001-05-25 Peter Williams <peterw@ximian.com>
* component/Makefile.am: Reference libeshell.la instead of libeshell.a.
2001-05-23 Kjartan Maraas <kmaraas@gnome.org>
* component/e-summary-url.c: Mark a string for translation.
2001-05-10 Iain Holmes <iain@ximian.com>
* test-service/rdf-summary.c (load_from_stream): Set the time, not the
timeout id. (duh!)
(summary_to_string): Get the time, not the timeout id. (DUH!)
(property_control): Connect the spin button to the item_changed callback.
2001-05-10 Iain Holmes <iain@ximian.com>
* test-service/rdf-summary.c (property_control): Don't let the spinner
be set to 0
2001-05-10 Iain Holmes <iain@ximian.com>
* test-service/rdf-summary.c (download_cb): Proxy clicked events to
download.
(property_control): Connect the Update Now button to the download_cb
instead of download to prevent a crash.
2001-05-05 Gediminas Paulauskas <menesis@delfi.lt>
* component/Makefile.am, evolution-services/Makefile.am: no need of
-DEVOLUTION_VERSION
* component/e-summary-callbacks.c: translate window title.
* component/e-summary-url.c (e_summary_url_describe): contents are in
utf-8, convert to locale.
* test-service/Makefile.am: define EVOLUTION_LOCALEDIR.
* test-service/rdf-summary.c: init gettext.
2001-05-02 Gediminas Paulauskas <menesis@delfi.lt>
* component/e-summary.c: set default content type of html to
"text/html; charset=utf-8".
2001-04-25 Dan Winship <danw@ximian.com>
* idl/Makefile.am (INCLUDES): Remove this section, which doesn't
apply to anything since there are no targets in this directory.
* test-service/Makefile.am:
* evolution-services/Makefile.am:
* component/Makefile.am: Remove UNICODE_LIBS/UNICODE_CFLAGS
2001-04-14 Michael Meeks <michael@ximian.com>
* idl/Makefile.am: Remove stale build cruftiness.
2001-04-10 Gediminas Paulauskas <menesis@delfi.lt>
* widgets/e-summary-subwindow.c: added some missing includes.
* widgets/e-summary-title-button.h: same.
2001-04-04 Gediminas Paulauskas <menesis@delfi.lt>
* component/component-factory.c: last time I've broken shortcut view.
renamed icons properly.
2001-04-01 Gediminas Paulauskas <menesis@delfi.lt>
* component/component-factory.c: Changed folder type icon to tiny
executive summary icon.
* component/e-summary-factory.c: replaced set_pixmap with new EPixmap
cache.
2001-03-29 Kjartan Maraas <kmaraas@gnome.org>
* *.*: Clean up includes. Remove/replace <gnome.h>, <bonobo.h>
and <gtk/gtk.h>.
2001-03-08 Ettore Perazzoli <ettore@ximian.com>
* component/component-factory.c (factory_fn): Specify a NULL
`EvolutionShellComponentGetDndSelectionFn'.
2001-02-14 Iain Holmes <iain@ximian.com>
* component/e-summary-url.c (e_summary_url_click): Remove the new
OTHER uri stuff.
2001-02-14 Christopher James Lahey <clahey@ximian.com>
* component/component-factory.c (component_destroy_cb): Removed
this unused function.
* evolution-services/executive-summary-html-view.c
(impl_GNOME_Evolution_Summary_HTMLView_handleURI): Changed the
declaration of this function to match the signature in the
generated header file.
* test-service/rdf-summary.c (property_control): Added a cast here.
2001-02-14 Iain Holmes <iain@ximian.com>
* evolution-services/executive-summary-html-view.c
(executive_summary_html_view_destroy): Don't unref the event source.
(impl_GNOME_Evolution_Summary_HTMLView_handleURI): Emit the signal.
(corba_class_init): Hook up the handleURI method.
(executive_summary_html_view_class_init): Create the signal.
* idl/HTMLView.idl: Add the handleURI method.
2001-02-13 Iain Holmes <iain@ximian.com>
* test-service/rdf-summary.c (property_control): Add an update now button.
2001-02-12 Iain Holmes <iain@ximian.com>
* test-service/rdf-summary.c (property_control): Add a "Update" spinner.
(property_action): Only download a new RDF if the URL changed. Use a cached
version otherwise.
2001-02-08 Iain Holmes <iain@ximian.com>
* component/e-summary-url.c (e_summary_url_click): Close and remove the
window on an idle, so that the whole desktop isn't locked by a
GNOME-VFS bug.
2001-02-13 Kjartan Maraas <kmaraas@gnome.org>
* Makefile.am: xml-i18n-tools setup for .oaf.in files.
* GNOME_Evolution_Summary.oaf.in: Mark strings for translation.
* test-service/Makefile.am: xml-i18n-tools setup for .oaf.in files.
* test-service/*.oaf.in: Mark strings for translation.
2001-01-23 Iain Holmes <iain@ximian.com>
* component/e-summary.c (e_summary_load_page): Don't strdup the NULL.
2001-01-20 Iain Holmes <iain@ximian.com>
* component/e-summary.c (e_summary_display_window): Free the html
variable and the header too.
2001-01-22 Christopher James Lahey <clahey@helixcode.com>
* component/e-summary-url.c: Change the callbacks in this file to
match the callback function types. Fixes warnings.
2001-01-12 Ettore Perazzoli <ettore@helixcode.com>
* component/component-factory.c (factory_fn): Pass NULL as the
@copy_folder_fn arg to `evolution_shell_component_new()'.
* evolution-services/executive-summary-component.c
(executive_summary_component_destroy): Remove unused variable.
2001-01-12 Iain Holmes <iain@ximian.com>
* component/e-summary-util.c (e_summary_rm_dir): If base == NULL return;
Closes bug #37077
2000-12-30 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): The number of columns
is no longer hardcoded.
* component/e-summary-prefs.[ch]: Add a columns member, and all the
necessary code to support it.
* component/e-summary-callbacks.c: Set the columns member.
* test-service/rdf-summary.c: Add a "Show title" button for turning off
the title if it is taking up too much room.
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
Bonobo::PersistStream interface.
(load_from_stream):
(summary_to_string):
(save_to_stream):
(content_types): Functions to load and save an XML document.
2000-12-26 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (make_control_html): Neatened the code.
(e_summary_add_service): Get the event source that is shared
between everything.
* component/e-summary-url.c (e_summary_url_click): Use the shared
event source.
* test-service/rdf-summary.c (create_view): Use the EventSource when
creating the BonoboPropertyBag.
* test-service/main.c (create_view): Create a shared BonoboEventSource.
2000-12-21 Iain Holmes <iain@helixcode.com>
* test-service/rdf-summary.c (download): Split this function into
many callbacks, for async action.
* component/e-summary-url.c (e_summary_url_request): Split this
into async callbacks too.
2000-12-13 Christopher James Lahey <clahey@helixcode.com>
* component/e-summary-callbacks.c (configure_summary): Added a
cast.
2000-12-13 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): Display all the windows
correctly.
(e_summary_save_state): Remove the whole of the Executive-Summary dir.
* component/e-summary-util.[ch]: Add e_summary_rm_dir, a function to reove
everything in the path. RC people have a function to do it too, but I can't
remember how to get RC :)
* component/e-summary-callbacks.c: (configure_summary): Put an HTML
explanation into the configure dialog.
2000-12-13 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): Count the number
of rows correctly.
2000-12-12 Christopher James Lahey <clahey@helixcode.com>
* component/e-summary-callbacks.c: Added #include
<e-summary-callbacks.h>.
(destroy_prefs_cb): Added a cast.
(configure_summary): Added a cast.
* component/e-summary-callbacks.h: Added #include "e-summary.h"
* component/e-summary-url.c (e_summary_url_click): Removed an
unused variable.
* component/e-summary-util.c: Added #include <e-summary-util.h>
* component/e-summary.c: Added #include <gtkhtml/htmlselection.h>.
(e_summary_queue_rebuild): Added a cast.
* component/main.c: Added #include <glade/glade.h>.
* test-service/main.c: Changed some variable types to make casting
easier.
* test-service/rdf-summary.c: Changed some variable types to make
casting easier.
2000-12-12 Dan Winship <danw@helixcode.com>
* Makefile.am (EXTRA_DIST): Add stuff. (From campd.)
2000-12-11 Iain Holmes <iain@helixcode.com>
* 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.
(e_summary_start_load): Add a new hack to set the border width of the
GtkHTML widget to 0.
(e_summary_rebuild_page): Redid the way the tables are drawn. Made the
title icon be constrained to 48.
* evolution-services/executive-summary-component.c
(impl_GNOME_Evolution_Summary_ComponentFactory_createViw): Fixed a warning.
* component/e-summary-util (e_pixmap_file): Free the edir.
2000-12-08 Iain Holmes <iain@helixcode.com>
* summary.html: Don't hardcode the image paths.
2000-12-08 JP Rosevear <jpr@helixcode.com>
* component/Makefile.am (evolution-executive-summary.pure): Add purify
options for the build
2000-12-08 JP Rosevear <jpr@helixcode.com>
* Makefile.am: Remove files from extra_dist since they are already
listed
2000-12-07 Iain Holmes <iain@helixcode.com>
* summary.html: Prettier HTML summary.
* Makefile.am: Install the new summary.html
* component/e-summary.c (load_component): Free corba_subdir and
corba_stream.
(save_component): Free corba stuff.
2000-12-06 Iain Holmes <iain@helixcode.com>
* e-summary-callbacks.c (new_mail): Update COMPOSER_IID to the new
style IIDs.
(configure_summary): Set up to do stuff when preferences are changed.
* e-summary-prefs.c (e_summary_prefs_save): Sync and drop the config file
so that changes are written to disk.
* e-summary.c (e_summary_reconfigure): Change the summary to the new
preferences.
2000-12-04 Iain Holmes <iain@helixcode.com>
* test-service/rdf-summary.c (entry_changed): Add a NULL for opt_ev.
* idl/HtmlView.idl: Inherit from Bonobo::Unknown and not
Bonobo::EventSource.
* evolution-services/executive-summary-html-view.[ch]: Change
implementation of the EventSource so that it is aggregated onto
the HtmlView object and not inherited.
* component/e-summary.c (e_summary_window_free): Free the event_source.
(e_summary_add_service): query for the EventSource interface.
2000-12-01 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_load_state): Fix memory leak.
(everywhere): Fixed memory leaks, and unref problems.
2000-11-30 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_window_free): remove the
event listener before destruction.
* component/e-summary-url.c (e_summary_url_click): Handle the
new PropertyControl api. Add a listener to detect when the page
is changed, and adjust the property box accordingly.
* test-service/main.c (create_view): Increment running view.
2000-11-29 Iain Holmes <iain@helixcode.com>
* component/e-summary.c: Big memory leak cleanup.
2000-11-28 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_display_window): If the HTML
control dies, then just close the open tags.
* component/e-summary-url (e_summary_url_click): Put the control
into a GnomePropertyBox.
* evolution-services/executive-summary-component.c
(impl_GNOME_Evolution_Summary_ComponentFactory_createView):
Duplicate the component.
2000-11-27 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_window_free): Free all the
interfaces and the component.
(e_summary_load_state): Fix typos.
* component/e-summary-prefs.c: Fix some typos.
* component/e-summary-url.c: If configure is pressed, retrieve
the control and embed it in a window.
* test-services/main.c (component_destroyed): assign ud from data
not from ud!
* test-services/rdf-summary.c (view_destroyed): Connect this
callback and free the summary.
(property_control): Made a simple configuration dialog.
2000-11-25 Iain Holmes <iain@helixcode.com>
* component/e-summary-prefs.[ch]: New files to handle loading,
saving, copying and freeing preferences.
* component/e-summary.c (e_summary_save_state): Use the new
prefs stuff to save.
(e_summary_load_state): Use the new prefs stuff to load.
* component/e-summary-factory.c (set_pixmap): Use e_pixmap_file
to find the pixbuf.
2000-11-24 Iain Holmes <iain@helixcode.com>
* idl/SummaryComponent.idl: Removed the setOwner and unsetOwner
methods from the Component interface.
* evolution-services/executive-summary.[ch]
evolution-services/executive-summary-client.[ch]
evolution-services/executive-summary-component-client.[ch]
evolution-services/executive-summary-component-view.[ch]:
Removed.
* component/main.c (main): Stopped ignoring the signals.
* component/executive-summary-config.glade: Glade file for the
prefs dialog.
2000-11-23 Iain Holmes <iain@helixcode.com>
* component/e-summary-factory.c (embed-service): Moved to
e-summary-callbacks.c.
(e_summary_factory_embed_from_id): Moved to e-summary.c and renamed
e_summary_embed_from_id.
Added a New Mail button.
* component/e-summary-callbacks.c: New file.
2000-11-22 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_save_state): removed the #if 0s
and changed the save type to fs.
2000-11-21 Iain Holmes <iain@helixcode.com>
* test-services/rdf-summary.c: Rewrote to use the new services code.
* idl/HtmlView.idl: Inherit from Bonobo::EventSource instead of
Bonobo::Unknown.
2000-11-20 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_save_state): #if 0'd out the
PersistStream code till it is fixed.
(e_summary_window_free): Only Bonobo_Unknown_unref the component,
not all the other interfaces.
(e_summary_remove_window): Function to remove the window from the
window list and free it.
(make_control_html): Make "id" the address of the window structure.
* component/e-summary-url.c: Reimplemented all the functions that the
Executive Summary had before the big code change.
2000-11-18 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_save_state): Use Persist stream to
save the state of all the components.
(e_summary_load_state): Use Persist stream to load the components again.
(e_summary_add_service): Add a Property Listener to the property bag to
be notified of changes to the title or icon.
2000-12-07 Dave Camp <dave@helixcode.com>
* evolution-services/evolution-summary-component.c: Don't include
executive-summary-client.h.
2000-12-07 Dave Camp <dave@helixcode.com>
* idl/Makefile.am (IDLS): Include HtmlView.idl
2000-11-29 Dan Winship <danw@helixcode.com>
* component/main.c (main): Remove no-longer-needed e_unicode_init.
2000-17-10 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (make_control_html): Set the configure button
active if there is a Bonobo_PropertyControl object associated with the
window.
* Makefile.am: Remove the widgets subdirectory.
2000-16-10 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_display_window): Use the property
bag to get the window title and icon.
* test-service/main.c: (create_view): Add a PropertyBag to the object.
(set_property): Set the properties.
(get_property): Get the properties.
2000-15-10 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component-factory-client.[ch]:
A client for the factory stuff.
2000-14-10 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-html-view.[ch]: Implementation
of the HtmlView interface.
* component/e-summary-factory.c
(e_summary_factory_embed_service_from_id): Rewrote to use the new
component_factory.
* component/e-summary.c (e_summary_add_service): Rewrote to use
the new component stuff. Lots of queryInterfaces :)
(e_summary_window_free): Rewrote.
* test-service/main.c: Rewrote completely as an example of the
new services.
2000-13-10 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component.c:
Created the ExecutiveSummaryComponentFactory type, that implements
GNOME/Evolution/Summary/ComponentFactory. Changed the way
GNOME/Evolution/Summary/Component is implemented.
* idl/SummaryComponent.idl: Removed all methods from Component
execpt setOwner and unsetOwner. Added ComponentFactory interface
with a createView method.
* idl/HtmlView.idl: New interface for HTML services. One method
getHtml.
2000-11-10 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component-view.c
(executive_summary_component_view_set_title): Removed the
"wrong side" warning.
* component/e-summary-factory.c (set_icon): Change the view's
icon.
(e_summary_factory_embed_service_from_id): Connect to the set_icon
signal.
2000-11-09 Iain Holmes <iain@helixcode.com>
* test-service/rdf-summary.c: Made Alan Cox's rdf-engine.c from
Portaloo into a summary component.
2000-11-08 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_window_free): Remove the view
from the id_to_view hash table.
(make_control_html): Fix the bottom row comparison.
2000-11-07 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_load_state): Load the HTML
page for the background.
(load_html_page): Use GnomeVFS to load this page, and split it
into a header and footer.
(e_summary_rebuild_page): If a header and footer exist, use them
otherwise just load the default.
2000-11-06 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (on_object_requested): Load a bonobo
service and try to get it to display (Not working yet).
2000-11-04 Iain Holmes <iain@helixcode.com>
* test-service/test-bonobo.c: New file to test Bonobo control
based services.
* test-service/test-service.oafinfo: Added the details for the
test-bonobo service.
2000-11-03 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (make_control_html): Make a neater
function to create the window controls. Check if a window can
be moved in a certain direction before making a link.
* evolution-services/executive-summary-component-view.c: Added a
GtkWidget to the private structure to store the control's widget.
2000-11-03 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component-view.c:
(executive_summary_component_view_class_init): Add a "configure"
signal.
* evolution-services/executive-summary-component-view.h: Add the
default handler in the class type.
* idl/SummaryComponent.idl: Add an id to the configure method.
* evolution-services/executive-summary-component-client.[ch]:
executive_summary_component_client_configure: Takes a View param.
* component/e-summary-factory.c: Connect to the configure signal
of the created view and call the configure method.
* component/e-summary-url.c: When the [?] is clicked, emit the
configure signal.
* test-service/main.c: Connect the configure signal to something.
2000-11-21 Radek Doulik <rodo@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): use html_engine_is_selection_active
added some includes
2000-11-11 Matt Bissiri <bissiri@eecs.umich.edu>
* component/e-summary-factory.c: (control_activate_cb),
(embed_service):
* evolution-executive-summary.oafinfo:
* test-service/test-service.oafinfo:
Update the remaining "IDL:Evolution*" to "IDL:GNOME/Evolution*"
to sync up with yesterday's IDL re-scoping.
2000-11-10 Matt Bissiri <bissiri@eecs.umich.edu>
* component/Makefile.am: Regenerate the idl-generated files
if composer idl changes.
2000-11-03 Federico Mena Quintero <federico@helixcode.com>
* evolution-services/Makefile.am: Clean the idl-generated files
properly.
2000-11-01 Iain Holmes <iain@helixcode.com>
* component/e-summary.c:
component/e-summary-factory.c:
component/e-summary-url.c: Warning's cleanup.
2000-11-01 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_rebuild_page): Requeue the redraw
if there is a selection on the widget.
2000-11-01 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_display_window): Draw the window
controls to move, close and configure the window.
(e_summary_window_move_(left|right|up|down)): Move the window around the
window list.
* component/e-summary-url.c (e_summary_url_click): Add handlers for the
window control URIs (close:// configure:// up:// down:// left:// and
right://).
(get_protocol): Add support for the new protocols.
(parse_uri): Ditto.
(e_summary_url_describe): ditto.
2000-10-30 Iain Holmes <iain@helixcode.com>
* component/e-summary-factory.c (embed_service): Generate the uid here
and pass it into the create_view method.
* evolution-services/executive-summary-component-client.c
(executive_summary_component_client_create_view): Use the passed in UID
to generate a view.
* evolution-services/executive-summary-component.c
(impl_Evolution_SummaryComponent_create_view): Don't generate the id here
but use the passed in one instead.
* idl/SummaryComponent.idl: create_view now takes an ID parameter.
2000-10-26 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (load_default): Neaten the Report bug link.
(e_summary_end_load): Put in a <hr> and a mailto to me.
(e_summary_new): Create an EvolutionShellClient from the Evolution_Shell.
(e_summary_get_shell_client): Retrieve the shell-client.
* component/e-summary-url.c (e_summary_url_click): On a PROTOCOL_VIEW
change the current view to the one specified in the URL.
2000-10-28 Ettore Perazzoli <ettore@helixcode.com>
* component/Makefile.am (INCLUDES): Add
`-I$(top_builddir)/executive-summary/evolution-services' and
`-I$(top_srcdir)/executive-summary/evolution-services'.
2000-10-25 Iain Holmes <iain@helixcode.com>
* component/e-summary-url.c (e_summary_url_exec): Execute a program
specified in the format "exec://program args".
(e_summary_url_mail_compose): Run the mail composer when a mailto:
URL is clicked.
2000-10-25 Iain Holmes <iain@helixcode.com>
* component/e-summary.c (e_summary_start_load): Add a hack to stop the
GtkHTML widget returning to the top when it is redrawn.
* component/e-summary-url.[ch]
* component/e-summary-util.[ch]: Split some functions out of e-summary.c
* component/Makefile.am: Added the new files, and run orbit-idl on the
mail composer idl.
2000-10-25 <jpr@helixcode.com>
* component/e-summary-factory.c (control_activate): User
bonobo_control_get_remote_uid_container, not the old version
2000-10-25 Iain Holmes <iain@helixcode.com>
* test-service/main.c: Store each individual views data with the view.
Add comments to explain everything.
* evolution-services/executive-summary-component.c
(impl_Evolution_SummaryComponent_create_view): Only try to create a
control if the returned control != NULL.
2000-10-25 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary-component.c
(impl_Evolution_SummaryComponent_create_view): Set the UID of the view
before passing it to the create_view method.
2000-10-25 Iain Holmes <iain@helixcode.com>
* idl/Summary.idl: Added set_icon method, and changed update_html_component
to update_component. Made all methods take a long ID instead of an
SummaryComponent.
* idl/SummaryComponent.idl: Combined the create_bonobo_view and
create_html_view into create_view.
Added a destroy_view method.
* evolution-services/Makefile.am: Added the 2 new files.
* evolution-services/executive-summary-component-view.[ch]: New
files implementing a view of an ExecutiveSummaryComponent.
* evolution-services/executive-summary.[ch]
* evolution-services/executive-summary-client.[ch]
* evolution-services/executive-summary-component.[ch]
* evolution-services/executive-summary-component-client.[ch]:
* component/e-summary-factory.c
* component/e-summary.c
* test-service/main.c:
Updated to use new methods and the new ExecutiveSummaryComponentView
object.
2000-10-16 Iain Holmes <iain@helixcode.com>
* evolution-services/executive-summary.c (executive_summary_class_init):
Implement the update, set_title and flash functionality as signals
instead of methods.
(impl_Evolution_Summary_set_title): Emit signal.
(impl_Evolution_Summary_flash): Emit signal.
(impl_Evolution_Summary_update_html_component): Emit signal.
(executive_summary_new): Don't need the methods anymore.
(executive_summary_construct): Same.
(executive_summary_init): Remove the private initialisation.
2000-10-23 Dan Winship <danw@helixcode.com>
* idl/Makefile.am (INCLUDES):
* evolution-services/Makefile.am (INCLUDES):
* component/Makefile.am (INCLUDES): Update EVOLUTION_LOCALEDIR
2000-10-14 Ettore Perazzoli <ettore@helixcode.com>
* evolution-executive-summary.oafinfo: Added
"evolution:shell-component-icon" property.
2000-10-10 Jacob "Ulysses" Berkman <jacob@helixcode.com>
* evolution-services/Makefile.am (IDLS): make the built sources
depend on the idl files
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
the requested files. Allows services to specify remote urls.
(load_default, e_summary_display_window, e_summary_rebuild_page):
Change the html to match TigerT's lovely design.
(e_summary_add_html_service, e_summary_add_html_service): Add
the client argument so we can destroy it when we've quit.
(e_summary_window_update): Only do an update if there isn't one
pending.
* component/e-summary-factory.c (embed_service): upd.
* test-service/main.c: Made the test service be really silly and count
the number of seconds since it was started.
2000-10-06 Ettore Perazzoli <ettore@helixcode.com>
* component/Makefile.am (INCLUDES): Fix builddir != srcdir.
2000-10-05 Chris Toshok <toshok@helixcode.com>
* widgets/.cvsignore: ignore more stuff.
* .cvsignore: ignore more stuff.
* idl/.cvsignore: ignore more stuff.
* evolution-services/.cvsignore: ignore more stuff.
* component/.cvsignore: ignore more stuff.
* .cvsignore: add Makefile
2000-10-05 Chris Toshok <toshok@helixcode.com>
* component/component-factory.c: include
<gal/widgets/e-gui-utils.h> instead of "e-util/e-gui-utils.h" to
clear up e_notice declaration, and #include <gnome.h> to get "_".
2000-10-05 Michael Meeks <michael@helixcode.com>
* component/e-summary-factory.c (control_activate): upd.
(set_pixmap): upd. (update_pixmaps): upd.
(control_activate_cb): upd.
(control_deactivate): upd.
2000-10-04 Iain Holmes <iain@helixcode.com>
* idl/SummaryComponent.idl: Added a title argument to the
create_view methods.
2000-09-13 Iain Holmes <iain@helixcode.com>
* Started the Executive Summary

View File

@ -1,12 +0,0 @@
SUBDIRS = idl evolution-services component test-service
oafdir = $(datadir)/oaf
oaf_in_files = GNOME_Evolution_Summary.oaf.in
oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
@XML_I18N_MERGE_OAF_RULE@
htmldir = $(datadir)/evolution
html_DATA = summary.html
EXTRA_DIST = $(oaf_in_files) $(oaf_DATA) $(html_DATA)

View File

@ -1,10 +0,0 @@
core
Makefile.in
Makefile
.deps
.libs
evolution-executive-summary
Composer-common.c
Composer.h
Composer-stubs.c
Composer-skels.c

View File

@ -1,88 +0,0 @@
bin_PROGRAMS = evolution-executive-summary
INCLUDES = \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/e-text \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_builddir)/executive-summary \
-I$(top_srcdir)/executive-summary \
-I$(top_builddir)/executive-summary/evolution-services \
-I$(top_srcdir)/executive-summary/evolution-services \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(GTKHTML_CFLAGS) \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"evolution-executive-summary\"
COMPOSER_GENERATED = \
Composer.h \
Composer-common.c \
Composer-skels.c \
Composer-stubs.c
Composer-impl.o: Composer.h
selectnamesdir = $(top_srcdir)/addressbook/gui/component/select-names
IDLS = \
$(selectnamesdir)/Evolution-Addressbook-SelectNames.idl \
$(top_srcdir)/composer/Evolution-Composer.idl \
$(top_srcdir)/composer/Composer.idl
$(COMPOSER_GENERATED): $(IDLS)
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
$(top_srcdir)/composer/Composer.idl
evolution_executive_summary_SOURCES = \
$(COMPOSER_GENERATED) \
component-factory.c \
component-factory.h \
e-summary.c \
e-summary.h \
e-summary-callbacks.c \
e-summary-callbacks.h \
e-summary-factory.c \
e-summary-factory.h \
e-summary-prefs.c \
e-summary-prefs.h \
e-summary-url.c \
e-summary-url.h \
e-summary-util.c \
e-summary-util.h \
main.c
evolution_executive_summary_LDADD = \
$(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/e-util/libeutil.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
-lgal \
$(GTKHTML_LIBS)
gladedir = $(datadir)/evolution-$(BASE_VERSION)/glade
glade_DATA = executive-summary-config.glade
if ENABLE_PURIFY
PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
all-local: evolution-executive-summary.pure
evolution-executive-summary.pure: evolution-executive-summary
@rm -f evolution-executive-summary.pure
$(PLINK) $(evolution_executive_summary_OBJECTS) $(evolution_executive_summary_LDADD) $(LIBS)
endif
EXTRA_DIST = $(glade_DATA)
CLEANFILES = $(COMPOSER_GENERATED)
BUILT_SOURCES = $(COMPOSER_GENERATED)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)

View File

@ -1,154 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.c
*
* Authors: Ettore Perazzoli <ettore@ximian.com>
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
#include "Evolution.h"
#include "evolution-storage.h"
#include "evolution-shell-component.h"
#include <gal/widgets/e-gui-utils.h>
#include "component-factory.h"
#include "e-summary-factory.h"
#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Summary_ShellComponentFactory"
static BonoboGenericFactory *factory = NULL;
static gint running_objects = 0;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "executive-summary", "evolution-today.png", FALSE, NULL, NULL },
{ NULL, NULL }
};
char *evolution_dir;
/* EvolutionShellComponent methods and signals */
static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell_component,
const char *physical_uri,
const char *folder_type,
BonoboControl **control_return,
void *closure)
{
EvolutionShellClient *shell_client;
GNOME_Evolution_Shell corba_shell;
BonoboControl *control;
if (g_strcasecmp (folder_type, "executive-summary") != 0)
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
shell_client = evolution_shell_component_get_owner (shell_component);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
control = e_summary_factory_new_control (physical_uri, corba_shell);
if (!control)
return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
*control_return = control;
return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
owner_set_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient *shell_client,
const char *evolution_homedir,
gpointer user_data)
{
GNOME_Evolution_Shell corba_shell;
evolution_dir = g_strdup (evolution_homedir);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
gtk_main_quit ();
}
static void
factory_destroy (BonoboObject *component,
gpointer dummy)
{
running_objects--;
if (running_objects > 0)
return;
if (factory)
bonobo_object_unref (BONOBO_OBJECT (factory));
else
g_warning ("Serious ref counting error");
factory = NULL;
gtk_main_quit ();
}
static BonoboObject *
factory_fn (BonoboGenericFactory *factory,
void *closure)
{
EvolutionShellComponent *shell_component;
running_objects++;
shell_component = evolution_shell_component_new (folder_types,
create_view,
NULL, NULL, NULL, NULL, NULL,
NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
GTK_SIGNAL_FUNC (factory_destroy), NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
GTK_SIGNAL_FUNC (owner_set_cb), NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
return BONOBO_OBJECT (shell_component);
}
void
component_factory_init (void)
{
if (factory != NULL)
return;
factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
factory_fn, NULL);
if (factory == NULL) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's Executive Summary component."));
exit (1);
}
}

View File

@ -1,30 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.h
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Ettore Perazzoli
*/
#ifndef COMPONENT_FACTORY_H
#define COMPONENT_FACTORY_H
void component_factory_init (void);
#endif

View File

@ -1,320 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-callbacks.c
*
* Author:
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libgnomeui/gnome-propertybox.h>
#include <libgnomeui/gnome-file-entry.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-selector.h>
#include <stdlib.h> /* For atoi */
#include <liboaf/liboaf.h>
#include <glade/glade.h>
#include <gtkhtml/gtkhtml.h>
#include <e-util/e-html-utils.h>
#include "e-summary.h"
#include "e-summary-callbacks.h"
#include "Composer.h"
#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer"
typedef struct _PropertyData {
ESummary *esummary;
GnomePropertyBox *box;
GladeXML *xml;
} PropertyData;
/* HTML helper functions from mail/mail-config-gui.c */
static void
html_size_req (GtkWidget *widget,
GtkRequisition *requisition)
{
requisition->height = GTK_LAYOUT (widget)->height;
}
/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If
* @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame.
*/
static GtkWidget *
html_new (gboolean white)
{
GtkWidget *html, *scrolled, *frame;
GtkStyle *style;
html = gtk_html_new ();
GTK_LAYOUT (html)->height = 0;
gtk_signal_connect (GTK_OBJECT (html), "size_request",
GTK_SIGNAL_FUNC (html_size_req), NULL);
gtk_html_set_editable (GTK_HTML (html), FALSE);
style = gtk_rc_get_style (html);
if (style) {
gtk_html_set_default_background_color (GTK_HTML (html),
white ? &style->white:
&style->bg[0]);
}
gtk_widget_set_sensitive (html, FALSE);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
gtk_container_add (GTK_CONTAINER (scrolled), html);
if (white) {
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame),
GTK_SHADOW_ETCHED_IN);
gtk_container_add (GTK_CONTAINER (frame), scrolled);
gtk_widget_show_all (frame);
} else {
gtk_widget_show_all (scrolled);
}
return html;
}
static void
put_html (GtkHTML *html,
const char *text)
{
GtkHTMLStream *handle;
char *htmltext;
htmltext = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL);
handle = gtk_html_begin (html);
gtk_html_write (html, handle, "<HTML><BODY>", 12);
gtk_html_write (html, handle, text, strlen (text));
gtk_html_write (html, handle, "</BODY></HTML>", 14);
g_free (htmltext);
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
}
void
embed_service (GtkWidget *widget,
ESummary *esummary)
{
char *required_interfaces[2] = {"IDL:GNOME/Evolution:Summary:ComponentFactory:1.0",
NULL};
char *obj_id;
obj_id = bonobo_selector_select_id (_("Select a service"),
(const char **) required_interfaces);
if (obj_id == NULL)
return;
e_summary_embed_service_from_id (esummary, obj_id);
}
void
new_mail (GtkWidget *widget,
ESummary *esummary)
{
GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc;
CORBA_char *subject;
CORBA_Object composer;
CORBA_Environment ev;
CORBA_exception_init (&ev);
composer = oaf_activate_from_id ((char *)COMPOSER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION || composer == NULL) {
CORBA_exception_free (&ev);
g_warning ("Unable to start composer component!");
return;
}
CORBA_exception_free (&ev);
to = GNOME_Evolution_Composer_RecipientList__alloc ();
to->_length = 0;
to->_maximum = 0;
to->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
cc = GNOME_Evolution_Composer_RecipientList__alloc ();
cc->_length = 0;
cc->_maximum = 0;
cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
bcc = GNOME_Evolution_Composer_RecipientList__alloc ();
bcc->_length = 0;
bcc->_maximum = 0;
bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (0);
subject = CORBA_string_dup ("");
CORBA_exception_init (&ev);
GNOME_Evolution_Composer_setHeaders (composer, to, cc,
bcc, subject, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
CORBA_free (to);
CORBA_free (cc);
CORBA_free (bcc);
CORBA_free (subject);
g_warning ("Error setting headers!");
return;
}
CORBA_free (to);
CORBA_free (cc);
CORBA_free (bcc);
CORBA_free (subject);
GNOME_Evolution_Composer_show (composer, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("Error showing composer");
return;
}
CORBA_exception_free (&ev);
return;
}
static void
destroy_prefs_cb (GtkObject *object,
PropertyData *data)
{
gtk_object_unref (GTK_OBJECT(data->xml));
g_free (data);
}
static void
html_page_changed_cb (GtkEntry *entry,
PropertyData *data)
{
ESummaryPrefs *prefs;
/* Change the tmp prefs so that we can restore if the user cancels */
prefs = data->esummary->tmp_prefs;
if (prefs->page)
g_free (prefs->page);
prefs->page = g_strdup (gtk_entry_get_text (entry));
gnome_property_box_changed (data->box);
}
static void
column_spinner_changed_cb (GtkEntry *entry,
PropertyData *data)
{
ESummaryPrefs *prefs;
char *value;
prefs = data->esummary->tmp_prefs;
gnome_property_box_changed (data->box);
value = gtk_entry_get_text (entry);
if (value == NULL || *value == '\0')
return;
prefs->columns = atoi (value);
}
static void
apply_prefs_cb (GnomePropertyBox *property_box,
int page,
ESummary *esummary)
{
g_print ("Applying\n");
if (page != -1)
return;
esummary->prefs = e_summary_prefs_copy (esummary->tmp_prefs);
e_summary_reconfigure (esummary);
}
void
configure_summary (GtkWidget *widget,
ESummary *esummary)
{
static GtkWidget *prefs = NULL;
PropertyData *data;
GtkWidget *html_page;
GtkWidget *vbox, *html, *spinner;
char *tmp;
if (prefs != NULL) {
g_assert (GTK_WIDGET_REALIZED (prefs));
gdk_window_show (prefs->window);
gdk_window_raise (prefs->window);
return;
}
data = g_new (PropertyData, 1);
data->esummary = esummary;
if (esummary->tmp_prefs != NULL) {
e_summary_prefs_free (esummary->tmp_prefs);
}
esummary->tmp_prefs = e_summary_prefs_copy (esummary->prefs);
data->xml = glade_xml_new (EVOLUTION_GLADEDIR
"/executive-summary-config.glade", NULL);
prefs = glade_xml_get_widget (data->xml, "summaryprefs");
data->box = GNOME_PROPERTY_BOX(prefs);
vbox = glade_xml_get_widget (data->xml, "vbox");
html = html_new (TRUE);
put_html (GTK_HTML(html),
_("You can select a different HTML page for the background "
"of the Executive Summary.\n\nJust leave it blank for the "
"default"));
gtk_box_pack_start (GTK_BOX (vbox), html->parent->parent, TRUE, TRUE, 0);
gtk_box_reorder_child (GTK_BOX (vbox), html->parent->parent, 0);
html_page = glade_xml_get_widget (data->xml, "htmlpage");
if (esummary->prefs->page != NULL)
gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))), esummary->prefs->page);
gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (html_page))),
"changed", GTK_SIGNAL_FUNC (html_page_changed_cb),
data);
spinner = glade_xml_get_widget (data->xml, "columnspinner");
tmp = g_strdup_printf ("%d", esummary->prefs->columns);
gtk_entry_set_text (GTK_ENTRY (spinner), tmp);
g_free (tmp);
gtk_signal_connect (GTK_OBJECT (spinner), "changed",
GTK_SIGNAL_FUNC (column_spinner_changed_cb), data);
gtk_signal_connect (GTK_OBJECT (prefs), "apply",
GTK_SIGNAL_FUNC (apply_prefs_cb), esummary);
gtk_signal_connect (GTK_OBJECT (prefs), "destroy",
GTK_SIGNAL_FUNC (destroy_prefs_cb), data);
gtk_signal_connect (GTK_OBJECT (prefs), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed), &prefs);
}

View File

@ -1,12 +0,0 @@
#ifndef __E_SUMMARY_CALLBACKS_H__
#define __E_SUMMARY_CALLBACKS_H__
#include "e-summary.h"
void embed_service (GtkWidget *widget,
ESummary *esummary);
void new_mail (GtkWidget *widget,
ESummary *esummary);
void configure_summary (GtkWidget *widget,
ESummary *esummary);
#endif

View File

@ -1,185 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-factory.c
*
* Authors: Ettore Perazzoli <ettore@ximian.com>
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-ui-util.h>
#include <liboaf/liboaf.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gal/util/e-util.h>
#include "evolution-shell-component-utils.h"
#include "e-summary-factory.h"
#include "e-summary.h"
#include "e-summary-util.h"
#include "e-summary-callbacks.h"
#include "Evolution.h"
#include <evolution-services/Executive-Summary.h>
#include <evolution-services/executive-summary-component.h>
#include <evolution-services/executive-summary-component-factory-client.h>
static GList *control_list = NULL;
BonoboUIVerb verbs[] = {
BONOBO_UI_UNSAFE_VERB ("AddService", embed_service),
BONOBO_UI_UNSAFE_VERB ("NewMail", new_mail),
BONOBO_UI_UNSAFE_VERB ("ESummarySettings", configure_summary),
BONOBO_UI_VERB_END
};
static EPixmap pixmaps [] = {
E_PIXMAP ("/Toolbar/AddService", "buttons/add-service.png"),
E_PIXMAP ("/Toolbar/NewMail", "buttons/compose-message.png"),
E_PIXMAP_END
};
static void
control_activate (BonoboControl *control,
BonoboUIComponent *ui_component,
ESummary *esummary)
{
Bonobo_UIContainer container;
container = bonobo_control_get_remote_ui_container (control);
bonobo_ui_component_set_container (ui_component, container);
bonobo_object_release_unref (container, NULL);
bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, esummary);
bonobo_ui_component_freeze (ui_component, NULL);
bonobo_ui_util_set_ui (ui_component, EVOLUTION_DATADIR,
EVOLUTION_UI_DIRECTORY "/evolution-executive-summary.xml",
"evolution-executive-summary");
e_pixmaps_update (ui_component, pixmaps);
bonobo_ui_component_thaw (ui_component, NULL);
}
static void
control_deactivate (BonoboControl *control,
BonoboUIComponent *ui_component,
ESummary *esummary)
{
e_summary_unset_message (esummary);
bonobo_ui_component_unset_container (ui_component);
}
static void
control_activate_cb (BonoboControl *control,
gboolean activate,
gpointer user_data)
{
ESummary *summary;
BonoboUIComponent *ui_component;
Bonobo_ControlFrame control_frame;
GNOME_Evolution_ShellView shell_view_interface;
CORBA_Environment ev;
ui_component = bonobo_control_get_ui_component (control);
g_assert (ui_component != NULL);
if (gtk_object_get_data (GTK_OBJECT (control), "shell_view_interface") == NULL) {
control_frame = bonobo_control_get_control_frame (control);
if (control_frame == NULL) {
goto out;
}
CORBA_exception_init (&ev);
shell_view_interface = Bonobo_Unknown_queryInterface (control_frame,
"IDL:GNOME/Evolution/ShellView:1.0",
&ev);
CORBA_exception_free (&ev);
if (shell_view_interface != CORBA_OBJECT_NIL) {
gtk_object_set_data (GTK_OBJECT (control),
"shell_view_interface",
shell_view_interface);
} else {
g_warning ("Control frame doesn't have Evolution/ShellView.");
}
summary = E_SUMMARY (user_data);
e_summary_set_shell_view_interface (summary,
shell_view_interface);
}
out:
if (activate)
control_activate (control, ui_component, user_data);
else
control_deactivate (control, ui_component, user_data);
}
static void
control_destroy_cb (BonoboControl *control,
gpointer user_data)
{
GtkWidget *esummary = user_data;
control_list = g_list_remove (control_list, control);
gtk_object_destroy (GTK_OBJECT (esummary));
}
BonoboControl *
e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell)
{
BonoboControl *control;
GtkWidget *esummary;
esummary = e_summary_new (shell);
if (esummary == NULL)
return NULL;
gtk_widget_show (esummary);
control = bonobo_control_new (esummary);
if (control == NULL) {
gtk_object_destroy (GTK_OBJECT (esummary));
return NULL;
}
gtk_signal_connect (GTK_OBJECT (control), "activate",
control_activate_cb, esummary);
gtk_signal_connect (GTK_OBJECT (control), "destroy",
control_destroy_cb, esummary);
control_list = g_list_prepend (control_list, control);
return control;
}

View File

@ -1,34 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-factory.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_FACTORY_H__
#define _E_SUMMARY_FACTORY_H__
#include <Evolution.h>
#include "e-summary.h"
BonoboControl *e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell);
ESummaryWindow *e_summary_factory_embed_service_from_id (ESummary *esummary,
const char *obj_id);
#endif

View File

@ -1,122 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-prefs.c: Preference handling routines.
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include "e-summary-prefs.h"
#include "e-summary.h"
void
e_summary_prefs_free (ESummaryPrefs *prefs)
{
g_return_if_fail (prefs != NULL);
g_free (prefs->page);
g_free (prefs);
}
ESummaryPrefs *
e_summary_prefs_new (void)
{
ESummaryPrefs *prefs;
prefs = g_new0 (ESummaryPrefs, 1);
return prefs;
}
ESummaryPrefs *
e_summary_prefs_copy (ESummaryPrefs *prefs)
{
ESummaryPrefs *copy;
g_return_val_if_fail (prefs != NULL, NULL);
copy = e_summary_prefs_new ();
copy->page = g_strdup (prefs->page);
copy->columns = prefs->columns;
return copy;
}
gboolean
e_summary_prefs_compare (ESummaryPrefs *p1,
ESummaryPrefs *p2)
{
if (p1 == p2)
return TRUE;
if (strcmp (p1->page, p2->page) == 0)
return TRUE;
if (p1->columns == p2->columns)
return TRUE;
return FALSE;
}
ESummaryPrefs *
e_summary_prefs_load (const char *path)
{
ESummaryPrefs *prefs;
char *item;
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (*path != '\0', NULL);
prefs = e_summary_prefs_new ();
item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path);
prefs->page = gnome_config_get_string (item);
g_free (item);
item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns=3", path);
prefs->columns = gnome_config_get_int (item);
g_free (item);
return prefs;
}
void
e_summary_prefs_save (ESummaryPrefs *prefs,
const char *path)
{
char *item;
g_return_if_fail (prefs != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (*path != '\0');
item = g_strdup_printf ("=%s/e-summary=/executive-summary/page", path);
gnome_config_set_string (item, prefs->page);
g_free (item);
item = g_strdup_printf ("=%s/e-summary=/executive-summary/columns", path);
gnome_config_set_int (item, prefs->columns);
g_free (item);
gnome_config_sync ();
gnome_config_drop_all ();
}

View File

@ -1,45 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-prefs.h: Preference handling routines.
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_SUMMARY_PREFS_H__
#define __E_SUMMARY_PREFS_H__
typedef struct _ESummaryPrefs ESummaryPrefs;
struct _ESummaryPrefs {
char *page; /* Background HTML page URL */
int columns; /* Number of components per row (Default = 3) */
/* If anything is added here, don't forget to add
copy, compare, load and save routines to the appropriate
functions. */
};
ESummaryPrefs *e_summary_prefs_new (void);
void e_summary_prefs_free (ESummaryPrefs *prefs);
ESummaryPrefs *e_summary_prefs_copy (ESummaryPrefs *prefs);
gboolean e_summary_prefs_compare (ESummaryPrefs *p1,
ESummaryPrefs *p2);
ESummaryPrefs *e_summary_prefs_load (const char *path);
void e_summary_prefs_save (ESummaryPrefs *prefs,
const char *path);
#endif

View File

@ -1,851 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-url.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-property-control.h>
#include <bonobo/bonobo-event-source.h>
#include <bonobo/bonobo-widget.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-url.h>
#include <libgnome/gnome-exec.h>
#include <libgnomeui/gnome-propertybox.h>
#include <stdlib.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <liboaf/liboaf.h>
#include <libgnomevfs/gnome-vfs.h>
#include "e-summary.h"
#include "e-summary-url.h"
#include "e-summary-util.h"
#include "Composer.h"
typedef enum _ESummaryProtocol {
PROTOCOL_NONE,
PROTOCOL_HTTP,
PROTOCOL_MAILTO,
PROTOCOL_VIEW,
PROTOCOL_EXEC,
PROTOCOL_FILE,
PROTOCOL_CLOSE,
PROTOCOL_LEFT,
PROTOCOL_RIGHT,
PROTOCOL_UP,
PROTOCOL_DOWN,
PROTOCOL_CONFIGURE,
PROTOCOL_OTHER
} ESummaryProtocol;
static char *descriptions[] = {
N_("Open %s with the default GNOME application"),
N_("Open %s with the default GNOME web browser"),
N_("Send an email to %s"),
N_("Change the view to %s"),
N_("Run %s"),
N_("Open %s with the default GNOME application"),
N_("Close %s"),
N_("Move %s to the left"),
N_("Move %s to the right"),
N_("Move %s into the previous row"),
N_("Move %s into the next row"),
N_("Configure %s"),
N_("Open %s with the default GNOME application")
};
typedef struct _PropertyDialog {
BonoboListener *listener;
int listener_id;
Bonobo_EventSource eventsource;
GtkWidget *dialog;
} PropertyDialog;
#define COMPOSER_IID "OAFIID:GNOME_Evolution_Mail_Composer"
#if HAVECACHE
static ESummaryCache *image_cache = NULL;
#endif
gboolean e_summary_url_mail_compose (ESummary *esummary,
const char *url);
gboolean e_summary_url_exec (const char *exec);
struct _DownloadInfo {
GtkHTMLStream *stream;
char *uri;
char *buffer;
gboolean error;
};
typedef struct _DownloadInfo DownloadInfo;
static void
close_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
gpointer data)
{
DownloadInfo *info = data;
if (info->error) {
gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR);
} else {
gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK);
}
g_free (info->uri);
g_free (info->buffer);
g_free (info);
}
static void
read_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
gpointer buffer,
GnomeVFSFileSize bytes_requested,
GnomeVFSFileSize bytes_read,
gpointer data)
{
DownloadInfo *info = data;
if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
g_warning ("Read error");
info->error = TRUE;
gnome_vfs_async_close (handle, close_callback, info);
}
if (bytes_read == 0) {
info->error = FALSE;
gnome_vfs_async_close (handle, close_callback, info);
} else {
gtk_html_stream_write (info->stream, buffer, bytes_read);
gnome_vfs_async_read (handle, buffer, 4095, read_callback,
info);
}
}
static void
open_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
DownloadInfo *info)
{
if (result != GNOME_VFS_OK) {
gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR);
g_free (info->uri);
g_free (info);
return;
}
info->buffer = g_new (char, 4096);
gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info);
}
void
e_summary_url_request (GtkHTML *html,
const gchar *url,
GtkHTMLStream *stream)
{
char *filename;
GnomeVFSAsyncHandle *handle;
DownloadInfo *info;
g_print ("url: %s\n", url);
if (strncasecmp (url, "file:", 5) == 0) {
url += 5;
filename = e_pixmap_file (url);
} else if (strchr (url, ':') >= strchr (url, '/')) {
filename = e_pixmap_file (url);
} else
filename = g_strdup (url);
if (filename == NULL) {
gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
return;
}
g_print ("Filename: %s\n", filename);
info = g_new (DownloadInfo, 1);
info->stream = stream;
info->uri = filename;
info->error = FALSE;
gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ,
(GnomeVFSAsyncOpenCallback) open_callback, info);
}
static char *
parse_uri (const char *uri,
ESummaryProtocol protocol,
ESummary *esummary)
{
char *parsed;
char *p;
int address;
ESummaryWindow *window;
switch (protocol) {
case PROTOCOL_HTTP:
/* "http://" == 7 */
parsed = g_strdup (uri + 7);
break;
case PROTOCOL_EXEC:
/* "exec://" == 7 */
parsed = g_strdup (uri + 7);
break;
case PROTOCOL_VIEW:
/* "view://" == 7 */
parsed = g_strdup (uri + 7);
break;
case PROTOCOL_MAILTO:
/* Fun. Mailto's might be "mailto:" or "mailto://" */
if (strstr (uri, "mailto://") == NULL) {
parsed = (char *) (uri + 7);
} else {
parsed = (char *) (uri + 9);
}
/* Now strip anything after a question mark,
as it is a parameter (that we ignore for the time being) */
if ( (p = strchr (parsed, '?')) != NULL) {
parsed = g_strndup (parsed, p - parsed);
} else {
parsed = g_strdup (parsed);
}
break;
case PROTOCOL_CLOSE:
address = atoi (uri + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_LEFT:
address = atoi (uri + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_RIGHT:
address = atoi (uri + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_UP:
address = atoi (uri + 5);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_DOWN:
address = atoi (uri + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_CONFIGURE:
address = atoi (uri + 12);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
parsed = g_strdup (window->title);
break;
case PROTOCOL_NONE:
case PROTOCOL_OTHER:
default:
/* Just return the uneditted uri. */
parsed = g_strdup (uri);
break;
}
return parsed;
}
static ESummaryProtocol
get_protocol (const char *url)
{
char *lowerurl;
ESummaryProtocol protocol = PROTOCOL_OTHER;
lowerurl = g_strdup (url);
g_strdown (lowerurl);
/* Check for no :/ */
if (strstr (lowerurl, "://") == NULL) {
/* Annoying alternative for mailto URLs */
if (strncmp (lowerurl, "mailto:", 6) != 0) {
g_free (lowerurl);
return PROTOCOL_NONE;
} else {
g_free (lowerurl);
return PROTOCOL_MAILTO;
}
}
switch (lowerurl[0]) {
case 'c':
switch (lowerurl[1]) {
case 'l':
if (strncmp (lowerurl + 2, "ose", 3) == 0)
protocol = PROTOCOL_CLOSE;
break;
case 'o':
if (strncmp (lowerurl + 2, "nfigure", 7) == 0)
protocol = PROTOCOL_CONFIGURE;
break;
}
case 'd':
if (strncmp (lowerurl + 1, "own", 3) == 0)
protocol = PROTOCOL_DOWN;
break;
case 'e':
if (strncmp (lowerurl + 1, "xec", 3) == 0)
protocol = PROTOCOL_EXEC;
break;
case 'f':
if (strncmp (lowerurl + 1, "ile", 3) == 0)
protocol = PROTOCOL_FILE;
break;
case 'h':
if (strncmp (lowerurl + 1, "ttp", 3) == 0)
protocol = PROTOCOL_HTTP;
break;
case 'l':
if (strncmp (lowerurl + 1, "eft", 3) == 0)
protocol = PROTOCOL_LEFT;
break;
case 'm':
if (strncmp (lowerurl + 1, "ailto", 5) == 0)
protocol = PROTOCOL_MAILTO;
break;
case 'r':
if (strncmp (lowerurl + 1, "ight", 4) == 0)
protocol = PROTOCOL_RIGHT;
break;
case 'u':
if (lowerurl[1] == 'p')
protocol = PROTOCOL_UP;
break;
case 'v':
if (strncmp (lowerurl + 1, "iew", 3) == 0)
protocol = PROTOCOL_VIEW;
break;
default:
break;
}
g_free (lowerurl);
return protocol;
}
static void
property_apply (GnomePropertyBox *propertybox,
gint page_num,
Bonobo_PropertyControl control)
{
CORBA_Environment ev;
g_print ("page_num: %d\n", page_num);
CORBA_exception_init (&ev);
Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_APPLY, &ev);
CORBA_exception_free (&ev);
}
static void
property_help (GnomePropertyBox *propertybox,
gint page_num,
Bonobo_PropertyControl control)
{
CORBA_Environment ev;
CORBA_exception_init (&ev);
Bonobo_PropertyControl_notifyAction (control, page_num, Bonobo_PropertyControl_HELP, &ev);
CORBA_exception_free (&ev);
}
static void
property_event (BonoboListener *listener,
char *event_name,
CORBA_any *any,
CORBA_Environment *ev,
gpointer user_data)
{
PropertyDialog *data = (PropertyDialog *) user_data;
if (strcmp (event_name, BONOBO_PROPERTY_CONTROL_CHANGED) == 0) {
gnome_property_box_changed (GNOME_PROPERTY_BOX (data->dialog));
return;
}
}
static void
dialog_destroyed (GtkObject *object,
PropertyDialog *dialog)
{
CORBA_Environment ev;
CORBA_exception_init (&ev);
Bonobo_EventSource_removeListener (dialog->eventsource,
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));
CORBA_exception_free (&ev);
g_free (dialog);
}
struct _idle_data {
ESummary *esummary;
ESummaryWindow *window;
};
static gboolean
idle_remove_window (gpointer data)
{
struct _idle_data *id = data;
e_summary_remove_window (id->esummary, id->window);
e_summary_queue_rebuild (id->esummary);
g_free (id);
return FALSE;
}
void
e_summary_url_click (GtkWidget *widget,
const char *url,
ESummary *esummary)
{
ESummaryProtocol protocol;
char *parsed;
int address;
ESummaryWindow *window;
struct _idle_data *id;
Bonobo_Control control;
Bonobo_Listener corba_listener;
GtkWidget *prefsbox, *control_widget;
CORBA_Environment ev;
PropertyDialog *data;
int num_pages, i;
protocol = get_protocol (url);
parsed = parse_uri (url, protocol, esummary);
switch (protocol) {
case PROTOCOL_MAILTO:
/* Open a composer window */
e_summary_url_mail_compose (esummary, parsed);
break;
case PROTOCOL_VIEW:
/* Change the EShellView's current uri */
e_summary_change_current_view (esummary, parsed);
break;
case PROTOCOL_EXEC:
/* Execute the rest of the url */
e_summary_url_exec (parsed);
break;
case PROTOCOL_CLOSE:
/* Close the window. */
address = atoi (url + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
id = g_new (struct _idle_data, 1);
id->window = window;
id->esummary = esummary;
/* Close the window on an idle to work around a bug in
gnome-vfs which locks the e_summary_remove_window function
and as gtkhtml has a pointer grab on, this locks the whole
display. GAH! */
g_idle_add (idle_remove_window, id);
break;
case PROTOCOL_CONFIGURE:
/* Configure the window. . . */
address = atoi (url + 12);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
data = g_new (PropertyDialog, 1);
/* Create the property box */
prefsbox = gnome_property_box_new ();
data->dialog = prefsbox;
CORBA_exception_init (&ev);
data->eventsource = window->event_source;
data->listener = bonobo_listener_new (property_event, data);
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),
window->propertycontrol);
gtk_signal_connect (GTK_OBJECT (prefsbox), "help",
GTK_SIGNAL_FUNC (property_help),
window->propertycontrol);
gtk_signal_connect (GTK_OBJECT (prefsbox), "destroy",
GTK_SIGNAL_FUNC (dialog_destroyed), data);
num_pages = Bonobo_PropertyControl__get_pageCount (window->propertycontrol, &ev);
for (i = 0; i < num_pages; i++) {
control = Bonobo_PropertyControl_getControl (window->propertycontrol, i, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Unable to get property control.");
CORBA_exception_free (&ev);
break;
}
control_widget = bonobo_widget_new_control_from_objref (control,
CORBA_OBJECT_NIL);
gnome_property_box_append_page (GNOME_PROPERTY_BOX (prefsbox),
control_widget,
gtk_label_new (_("page")));
}
gtk_widget_show_all (prefsbox);
break;
case PROTOCOL_LEFT:
/* Window left */
address = atoi (url + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
e_summary_window_move_left (esummary, window);
e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_RIGHT:
address = atoi (url + 8);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
e_summary_window_move_right (esummary, window);
e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_UP:
address = atoi (url + 5);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
e_summary_window_move_up (esummary, window);
e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_DOWN:
address = atoi (url + 7);
window = (ESummaryWindow *) GINT_TO_POINTER (address);
if (window->iid == NULL)
break;
e_summary_window_move_down (esummary, window);
e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_OTHER:
case PROTOCOL_NONE:
case PROTOCOL_HTTP:
case PROTOCOL_FILE:
default:
/* Let browser handle it */
gnome_url_show (url);
break;
}
g_free (parsed);
}
static void
parse_mail_url (char *url,
GList **cc,
GList **bcc,
char **subject)
{
char **options;
int i = 0;
options = g_strsplit (url, "&", 0);
while (options[i] != NULL) {
char **params;
params = g_strsplit (options[i], "=", 2);
if (strcmp (params[0], "subject") == 0) {
*subject = g_strdup (params[1]);
} else if (strcmp (params[0], "cc") == 0) {
*cc = g_list_prepend (*cc, g_strdup (params[1]));
} else if (strcmp (params[1], "bcc") == 0) {
*bcc = g_list_prepend (*bcc, g_strdup (params[1]));
}
g_strfreev (params);
i++;
}
g_strfreev (options);
/* Reverse the list so it's in the correct order */
*cc = g_list_reverse (*cc);
*bcc = g_list_reverse (*bcc);
}
static void
recipients_from_list (GNOME_Evolution_Composer_RecipientList *recipients,
GList *list)
{
GList *t;
int i;
for (i = 0, t = list; t; i++, t = t->next) {
GNOME_Evolution_Composer_Recipient *recipient;
char *address = (char *)t->data;
recipient = recipients->_buffer + i;
recipient->name = CORBA_string_dup ("");
recipient->address = CORBA_string_dup (address ? address : "");
}
}
static void
free_list (GList *list)
{
for (; list; list = list->next) {
g_free (list->data);
}
}
gboolean
e_summary_url_mail_compose (ESummary *esummary,
const char *url)
{
CORBA_Object composer;
CORBA_Environment ev;
char *full_address, *address, *proto, *q;
GNOME_Evolution_Composer_RecipientList *to, *cc, *bcc;
GNOME_Evolution_Composer_Recipient *recipient;
CORBA_char *subject;
GList *gcc = NULL, *gbcc = NULL;
char *gsubject = NULL;
CORBA_exception_init (&ev);
/* FIXME: Query for IIDs? */
composer = oaf_activate_from_id ((char *)COMPOSER_IID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("Unable to start composer component!");
return FALSE;
}
if ( (proto = strstr (url, "://")) != NULL){
full_address = proto + 3;
} else {
if (strncmp (url, "mailto:", 7) == 0)
full_address = (char *) (url + 7);
else
full_address = (char *) url;
}
q = strchr (full_address, '?');
if (q != NULL) {
address = g_strndup (full_address, q - full_address);
parse_mail_url (q + 1, &gcc, &gbcc, &gsubject);
} else {
address = g_strdup (full_address);
}
to = GNOME_Evolution_Composer_RecipientList__alloc ();
to->_length = 1;
to->_maximum = 1;
to->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (to->_maximum);
recipient = to->_buffer;
recipient->name = CORBA_string_dup ("");
recipient->address = CORBA_string_dup (address?address:"");
g_free (address);
/* FIXME: Get these out of the URL */
cc = GNOME_Evolution_Composer_RecipientList__alloc ();
cc->_length = g_list_length (gcc);
cc->_maximum = cc->_length;
cc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (cc->_maximum);
recipients_from_list (cc, gcc);
free_list (gcc);
g_list_free (gcc);
bcc = GNOME_Evolution_Composer_RecipientList__alloc ();
bcc->_length = g_list_length (gbcc);
bcc->_maximum = bcc->_length;
bcc->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (bcc->_maximum);
recipients_from_list (bcc, gbcc);
free_list (gbcc);
g_list_free (gbcc);
subject = CORBA_string_dup (gsubject ? gsubject : "");
g_free (gsubject);
CORBA_exception_init (&ev);
GNOME_Evolution_Composer_setHeaders (composer, to, cc, bcc, subject, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
CORBA_free (to);
CORBA_free (cc);
CORBA_free (bcc);
CORBA_free (subject);
g_warning ("%s(%d): Error setting headers", __FUNCTION__, __LINE__);
return FALSE;
}
CORBA_free (to);
CORBA_free (cc);
CORBA_free (bcc);
CORBA_free (subject);
CORBA_exception_init (&ev);
GNOME_Evolution_Composer_show (composer, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("%s(%d): Error showing composer", __FUNCTION__, __LINE__);
return FALSE;
}
CORBA_exception_free (&ev);
/* FIXME: Free the composer? */
return TRUE;
}
gboolean
e_summary_url_exec (const char *exec)
{
gchar **exec_array;
int argc;
exec_array = g_strsplit (exec, " ", 0);
argc = 0;
while (exec_array[argc] != NULL) {
argc++;
}
gnome_execute_async (NULL, argc, exec_array);
g_strfreev (exec_array);
return TRUE;
}
static char *
e_summary_url_describe (const char *uri,
ESummary *esummary)
{
ESummaryProtocol protocol;
char *contents, *description, *tmp;
protocol = get_protocol (uri);
contents = parse_uri (uri, protocol, esummary);
tmp = e_utf8_to_locale_string (contents);
description = g_strdup_printf (_(descriptions[protocol]), tmp);
g_free (tmp);
g_free (contents);
return description;
}
void
e_summary_url_over (GtkHTML *html,
const char *uri,
ESummary *esummary)
{
char *description;
if (uri != NULL) {
description = e_summary_url_describe (uri, esummary);
e_summary_set_message (esummary, description, FALSE);
g_free (description);
} else {
e_summary_unset_message (esummary);
}
}
/* Cache stuff */
#if HAVECACHE
void
e_summary_url_init_cache (void)
{
if (image_cache != NULL)
return;
image_cache = e_summary_cache_new ();
}
void
e_summary_url_cache_destroy (void)
{
if (image_cache == NULL)
return;
gtk_object_unref (GTK_OBJECT (image_cache));
image_cache = NULL;
}
#endif

View File

@ -1,36 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-url.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_URL_H__
#define _E_SUMMARY_URL_H__
void e_summary_url_request (GtkHTML *html,
const gchar *url,
GtkHTMLStream *stream);
void e_summary_url_click (GtkWidget *widget,
const char *url,
ESummary *esummary);
void e_summary_url_over (GtkHTML *html,
const char *uri,
ESummary *esummary);
#endif

View File

@ -1,131 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-url.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <e-summary-util.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <glib.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
/**
* e_pixmap_file:
* @filename: Filename of pixmap.
*
* Finds @filename in the Evolution or GNOME installation dir.
*
* Returns: A newly allocated absolute path to @filename, or NULL
* if it cannot be found.
*/
char *
e_pixmap_file (const char *filename)
{
char *ret;
char *edir;
if (g_file_exists (filename)) {
ret = g_strdup (filename);
return ret;
}
/* Try the evolution images dir */
edir = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution",
filename);
if (g_file_exists (edir)) {
ret = g_strdup (edir);
g_free (edir);
return ret;
}
g_free (edir);
/* Try the evolution button images dir */
edir = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons",
filename);
if (g_file_exists (edir)) {
ret = g_strdup (edir);
g_free (edir);
return ret;
}
g_free (edir);
/* Fall back to the gnome_pixmap_file */
return gnome_pixmap_file (filename);
}
/**
* e_summary_rm_dir:
* @path: Full path to the directory or file to be removed.
*
* Deletes everything in fullpath.
*/
void
e_summary_rm_dir (const char *path)
{
DIR *base;
struct stat statbuf;
struct dirent *contents;
stat (path, &statbuf);
if (!S_ISDIR (statbuf.st_mode)) {
/* Not a directory */
g_warning ("Removing: %s", path);
unlink (path);
return;
} else {
g_warning ("Opening: %s", path);
base = opendir (path);
if (base == NULL)
return;
contents = readdir (base);
while (contents != NULL) {
char *fullpath;
if (strcmp (contents->d_name, ".") == 0||
strcmp (contents->d_name, "..") ==0) {
contents = readdir (base);
continue;
}
fullpath = g_concat_dir_and_file (path, contents->d_name);
e_summary_rm_dir (fullpath);
g_free (fullpath);
contents = readdir (base);
}
closedir (base);
rmdir (path);
}
}

View File

@ -1,29 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-util.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_UTIL_H__
#define _E_SUMMARY_UTIL_H__
char *e_pixmap_file (const char *filename);
void e_summary_rm_dir (const char *filename);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,115 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_H__
#define _E_SUMMARY_H__
#include <gtk/gtkvbox.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-listener.h>
#include <bonobo/bonobo-event-source.h>
#include <Evolution.h>
#include <evolution-services/Executive-Summary.h>
#include "e-summary-prefs.h"
#define E_SUMMARY_TYPE (e_summary_get_type ())
#define E_SUMMARY(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TYPE, ESummary))
#define E_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TYPE, ESummaryClass))
#define IS_E_SUMMARY(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_TYPE))
#define IS_E_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SUMMARY_TYPE))
typedef struct _ESummaryPrivate ESummaryPrivate;
typedef struct _ESummary ESummary;
typedef struct _ESummaryClass ESummaryClass;
typedef struct _ESummaryWindow ESummaryWindow;
struct _ESummaryWindow {
GNOME_Evolution_Summary_Component component;
Bonobo_Control control;
GNOME_Evolution_Summary_HTMLView html;
Bonobo_PersistStream persiststream;
Bonobo_PropertyBag propertybag;
Bonobo_PropertyControl propertycontrol;
Bonobo_EventSource event_source;
/* Listener for the event_source */
BonoboListener *listener;
int listener_id;
char *iid;
char *title;
char *icon;
ESummary *esummary;
};
struct _ESummary {
GtkVBox parent;
ESummaryPrefs *prefs;
ESummaryPrefs *tmp_prefs;
ESummaryPrivate *private;
};
struct _ESummaryClass {
GtkVBoxClass parent_class;
};
GtkType e_summary_get_type (void);
GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell);
void e_summary_queue_rebuild (ESummary *esummary);
void e_summary_window_free (ESummaryWindow *window);
void e_summary_remove_window (ESummary *esummary,
ESummaryWindow *window);
ESummaryWindow *e_summary_add_service (ESummary *esummary,
GNOME_Evolution_Summary_Component component,
const char *iid);
ESummaryWindow * e_summary_embed_service_from_id (ESummary *esummary,
const char *obj_id);
void e_summary_set_shell_view_interface (ESummary *summary,
GNOME_Evolution_ShellView svi);
void e_summary_set_message (ESummary *esummary,
const char *message,
gboolean busy);
void e_summary_unset_message (ESummary *esummary);
void e_summary_change_current_view (ESummary *esummary,
const char *uri);
void e_summary_set_title (ESummary *esummary,
const char *title);
void e_summary_window_move_left (ESummary *esummary,
ESummaryWindow *window);
void e_summary_window_move_right (ESummary *esummary,
ESummaryWindow *window);
void e_summary_window_move_up (ESummary *esummary,
ESummaryWindow *window);
void e_summary_window_move_down (ESummary *esummary,
ESummaryWindow *window);
void e_summary_reconfigure (ESummary *esummary);
#endif

View File

@ -1,223 +0,0 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Project1</name>
<program_name>project1</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<translatable_strings_file></translatable_strings_file>
</project>
<widget>
<class>GnomePropertyBox</class>
<name>summaryprefs</name>
<cxx_use_heap>True</cxx_use_heap>
<widget>
<class>GtkNotebook</class>
<child_name>GnomePropertyBox:notebook</child_name>
<name>notebook1</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<label>Appearance</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Background:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GnomeFileEntry</class>
<name>htmlpage</name>
<cxx_use_heap>True</cxx_use_heap>
<max_saved>10</max_saved>
<directory>False</directory>
<modal>False</modal>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>combo-entry1</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<border_width>2</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Number of columns:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkSpinButton</class>
<name>columnspinner</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>True</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<lower>1</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>Label</name>
<cxx_use_heap>True</cxx_use_heap>
<label>General</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</GTK-Interface>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,79 +0,0 @@
/*
* main.c: The core of the executive summary component.
*
* Copyright (C) 2000 Ximian, Inc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-init.h>
#include <bonobo/bonobo-main.h>
#include <liboaf/liboaf.h>
#include <glade/glade.h>
#ifdef GTKHTML_HAVE_GCONF
#include <gconf/gconf.h>
#endif
#include "gal/widgets/e-gui-utils.h"
#include "gal/widgets/e-cursors.h"
#include <libgnomevfs/gnome-vfs.h>
#include "component-factory.h"
int
main (int argc,
char **argv)
{
CORBA_ORB orb;
bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
textdomain (PACKAGE);
gnome_init_with_popt_table ("evolution-executive-summary", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
gdk_rgb_init ();
glade_gnome_init ();
if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error (_("Executive summary component could not initialize Bonobo.\n"
"If there was a warning message about the "
"RootPOA, it probably means\nyou compiled "
"Bonobo against GOAD instead of OAF."));
}
#ifdef GTKHTML_HAVE_GCONF
gconf_init (argc, argv, NULL);
#endif
e_cursors_init ();
component_factory_init ();
gnome_vfs_init ();
bonobo_main ();
return 0;
}

View File

@ -1,14 +0,0 @@
<html>
<head>
<title>Evolution - Executive Summary</title>
</head>
<body bgcolor="#ffffff">
<table>
<tr valign="center">
<td align="right"><img src="executive-summary.png"></td>
</tr>
</table>
</body>
</html>

View File

@ -1,11 +0,0 @@
Executive-Summary.h
Executive-Summary-common.c
Executive-Summary-skels.c
Executive-Summary-stubs.c
Makefile.in
Makefile
core
.deps
.libs
*.lo
*.la

View File

@ -1,55 +0,0 @@
lib_LTLIBRARIES = libevolution-services.la
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/executive-summary \
-I$(top_builddir)/executive-summary \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(GTKHTML_CFLAGS) \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"evolution-services\"
IDL_GENERATED = \
Executive-Summary.h \
Executive-Summary-common.c \
Executive-Summary-skels.c \
Executive-Summary-stubs.c
Executive-Summary-impl.o: Executive-Summary.h
IDLS = \
$(srcdir)/../idl/Executive-Summary.idl \
$(srcdir)/../idl/Summary.idl \
$(srcdir)/../idl/SummaryComponent.idl \
$(srcdir)/../idl/HtmlView.idl
$(IDL_GENERATED): $(IDLS)
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
$(srcdir)/../idl/Executive-Summary.idl
libevolution_services_la_SOURCES = \
$(IDL_GENERATED) \
executive-summary-component.c \
executive-summary-component.h \
executive-summary-component-factory-client.c \
executive-summary-component-factory-client.h \
executive-summary-html-view.c \
executive-summary-html-view.h
libevolution_services_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
$(GTKHTML_LIBS)
BUILT_SOURCES = $(IDL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)

View File

@ -1,171 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-client.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include "Executive-Summary.h"
#include "executive-summary-client.h"
#include "executive-summary-component.h"
#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
static BonoboObjectClass *parent_class = NULL;
struct _ExecutiveSummaryClientPrivate {
int dummy;
};
static void
executive_summary_client_destroy (GtkObject *object)
{
ExecutiveSummaryClient *client;
ExecutiveSummaryClientPrivate *priv;
client = EXECUTIVE_SUMMARY_CLIENT (object);
priv = client->private;
if (priv == NULL)
return;
g_free (priv);
client->private = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
executive_summary_client_init (ExecutiveSummaryClient *client)
{
ExecutiveSummaryClientPrivate *priv;
priv = g_new0 (ExecutiveSummaryClientPrivate, 1);
client->private = priv;
}
static void
executive_summary_client_class_init (ExecutiveSummaryClientClass *client)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (client);
parent_class = gtk_type_class (PARENT_TYPE);
object_class->destroy = executive_summary_client_destroy;
}
void
executive_summary_client_construct (ExecutiveSummaryClient *client,
CORBA_Object corba_object)
{
g_return_if_fail (client != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_CLIENT (client));
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (client), corba_object);
}
E_MAKE_TYPE (executive_summary_client, "ExecutiveSummaryClient",
ExecutiveSummaryClient, executive_summary_client_class_init,
executive_summary_client_init, PARENT_TYPE);
void
executive_summary_client_set_title (ExecutiveSummaryClient *client,
int id,
const char *title)
{
GNOME_Evolution_Summary_ViewFrame summary;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
GNOME_Evolution_Summary_ViewFrame_setTitle (summary, id, title, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error setting title to %s:%s", title, CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
}
void
executive_summary_client_set_icon (ExecutiveSummaryClient *client,
int id,
const char *icon)
{
GNOME_Evolution_Summary_ViewFrame summary;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
GNOME_Evolution_Summary_ViewFrame_setIcon (summary, id, icon, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error setting icon to %s:%s", icon, CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
}
void
executive_summary_client_flash (ExecutiveSummaryClient *client,
int id)
{
GNOME_Evolution_Summary_ViewFrame summary;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
GNOME_Evolution_Summary_ViewFrame_flash (summary, id, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error flashing");
}
CORBA_exception_free (&ev);
}
void
executive_summary_client_update (ExecutiveSummaryClient *client,
int id,
const char *html)
{
GNOME_Evolution_Summary_ViewFrame summary;
CORBA_Environment ev;
CORBA_exception_init (&ev);
summary = bonobo_object_corba_objref (BONOBO_OBJECT (client));
GNOME_Evolution_Summary_ViewFrame_updateComponent (summary, id, html, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error updating the component");
}
CORBA_exception_free (&ev);
}

View File

@ -1,64 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-client.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_CLIENT_H__
#define _EXECUTIVE_SUMMARY_CLIENT_H__
#include <bonobo/bonobo-object.h>
#include <evolution-services/executive-summary-component.h>
#define EXECUTIVE_SUMMARY_CLIENT_TYPE (executive_summary_client_get_type ())
#define EXECUTIVE_SUMMARY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_CLIENT_TYPE, ExecutiveSummaryClient))
#define EXECUTIVE_SUMMARY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_CLIENT_TYPE, ExecutiveSummaryClientClass))
#define IS_EXECUTIVE_SUMMARY_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_CLIENT_TYPE))
#define IS_EXECUTIVE_SUMMARY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_CLIENT_TYPE))
typedef struct _ExecutiveSummaryClientPrivate ExecutiveSummaryClientPrivate;
typedef struct _ExecutiveSummaryClient ExecutiveSummaryClient;
typedef struct _ExecutiveSummaryClientClass ExecutiveSummaryClientClass;
struct _ExecutiveSummaryClient {
BonoboObjectClient parent;
ExecutiveSummaryClientPrivate *private;
};
struct _ExecutiveSummaryClientClass {
BonoboObjectClientClass parent_class;
};
GtkType executive_summary_client_get_type (void);
void executive_summary_client_construct (ExecutiveSummaryClient *client,
CORBA_Object object);
void executive_summary_client_set_title (ExecutiveSummaryClient *client,
int id,
const char *title);
void executive_summary_client_set_icon (ExecutiveSummaryClient *client,
int id,
const char *icon);
void executive_summary_client_flash (ExecutiveSummaryClient *client,
int id);
void executive_summary_client_update (ExecutiveSummaryClient *client,
int id,
const char *html);
#endif

View File

@ -1,177 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component-client.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include <liboaf/liboaf.h>
#include <Executive-Summary.h>
#include "executive-summary-component-client.h"
#include "executive-summary.h"
#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
static BonoboObjectClass *parent_class = NULL;
struct _ExecutiveSummaryComponentClientPrivate {
int dummy;
};
static void
executive_summary_component_client_destroy (GtkObject *object)
{
ExecutiveSummaryComponentClient *client;
ExecutiveSummaryComponentClientPrivate *priv;
client = EXECUTIVE_SUMMARY_COMPONENT_CLIENT (object);
priv = client->private;
if (priv == NULL)
return;
g_free (priv);
client->private = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
executive_summary_component_client_init (ExecutiveSummaryComponentClient *client)
{
ExecutiveSummaryComponentClientPrivate *priv;
priv = g_new0 (ExecutiveSummaryComponentClientPrivate, 1);
client->private = priv;
}
static void
executive_summary_component_client_class_init (ExecutiveSummaryComponentClientClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = executive_summary_component_client_destroy;
parent_class = gtk_type_class (PARENT_TYPE);
}
void
executive_summary_component_client_construct (ExecutiveSummaryComponentClient *client,
CORBA_Object corba_object)
{
g_return_if_fail (client != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (client), corba_object);
}
ExecutiveSummaryComponentClient*
executive_summary_component_client_new (const char *id)
{
ExecutiveSummaryComponentClient *client;
CORBA_Environment ev;
CORBA_Object corba_object;
g_return_val_if_fail (id != NULL, NULL);
CORBA_exception_init (&ev);
corba_object = oaf_activate_from_id ((char *)id, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("Could not start %s\n", id);
return NULL;
}
CORBA_exception_free (&ev);
if (corba_object == CORBA_OBJECT_NIL) {
g_warning ("Could not activate %s\n", id);
return NULL;
}
client = gtk_type_new (executive_summary_component_client_get_type ());
executive_summary_component_client_construct (client, corba_object);
return client;
}
/* External API */
void
executive_summary_component_client_set_owner (ExecutiveSummaryComponentClient *client,
ExecutiveSummary *summary)
{
GNOME_Evolution_Summary_Component component;
GNOME_Evolution_Summary_ViewFrame corba_object;
CORBA_Environment ev;
g_return_if_fail (client != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY (summary));
CORBA_exception_init (&ev);
component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (summary));
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
GNOME_Evolution_Summary_Component_setOwner (component, corba_object, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error setting owner");
}
CORBA_exception_free (&ev);
return;
}
void
executive_summary_component_client_unset_owner (ExecutiveSummaryComponentClient *client)
{
GNOME_Evolution_Summary_Component component;
CORBA_Environment ev;
g_return_if_fail (client != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT (client));
CORBA_exception_init (&ev);
component = bonobo_object_corba_objref (BONOBO_OBJECT (client));
GNOME_Evolution_Summary_Component_unsetOwner (component, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error unsetting owner");
}
CORBA_exception_free (&ev);
return;
}
E_MAKE_TYPE (executive_summary_component_client,
"ExecutiveSummaryComponentClient",
ExecutiveSummaryComponentClient,
executive_summary_component_client_class_init,
executive_summary_component_client_init, PARENT_TYPE)

View File

@ -1,67 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component-client.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_COMPONENT_CLIENT_H__
#define _EXECUTIVE_SUMMARY_COMPONENT_CLIENT_H__
#include <bonobo/bonobo-object.h>
#include <evolution-services/executive-summary.h>
#include <evolution-services/executive-summary-component-view.h>
#define EXECUTIVE_SUMMARY_COMPONENT_CLIENT_TYPE (executive_summary_component_client_get_type ())
#define EXECUTIVE_SUMMARY_COMPONENT_CLIENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_CLIENT_TYPE, ExecutiveSummaryComponentClient))
#define EXECUTIVE_SUMMARY_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_CLIENT_TYPE, ExecutiveSummaryComponentClientClass))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_CLIENT_TYPE))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_CLIENT_TYPE))
typedef struct _ExecutiveSummaryComponentClientPrivate ExecutiveSummaryComponentClientPrivate;
typedef struct _ExecutiveSummaryComponentClient ExecutiveSummaryComponentClient;
typedef struct _ExecutiveSummaryComponentClientClass ExecutiveSummaryComponentClientClass;
struct _ExecutiveSummaryComponentClient {
BonoboObjectClient parent;
ExecutiveSummaryComponentClientPrivate *private;
};
struct _ExecutiveSummaryComponentClientClass {
BonoboObjectClientClass parent_class;
};
GtkType executive_summary_component_client_get_type (void);
ExecutiveSummaryComponentClient *executive_summary_component_client_new (const char *id);
void executive_summary_component_client_set_owner (ExecutiveSummaryComponentClient *client,
ExecutiveSummary *summary);
void executive_summary_component_client_unset_owner (ExecutiveSummaryComponentClient *client);
void executive_summary_component_client_supports (ExecutiveSummaryComponentClient *client,
gboolean *bonobo,
gboolean *html);
void executive_summary_component_client_configure (ExecutiveSummaryComponentClient *client,
ExecutiveSummaryComponentView *view);
void executive_summary_component_client_destroy_view (ExecutiveSummaryComponentClient *client,
ExecutiveSummaryComponentView *view);
#endif

View File

@ -1,177 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component-factory-client.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include <liboaf/liboaf.h>
#include <Executive-Summary.h>
#include "executive-summary-component-factory-client.h"
#define PARENT_TYPE BONOBO_OBJECT_CLIENT_TYPE
static BonoboObjectClass *parent_class = NULL;
struct _ExecutiveSummaryComponentFactoryClientPrivate {
int dummy;
};
static void
executive_summary_component_factory_client_destroy (GtkObject *object)
{
ExecutiveSummaryComponentFactoryClient *client;
ExecutiveSummaryComponentFactoryClientPrivate *priv;
client = EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (object);
priv = client->private;
if (priv == NULL)
return;
g_free (priv);
client->private = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
executive_summary_component_factory_client_init (ExecutiveSummaryComponentFactoryClient *client)
{
ExecutiveSummaryComponentFactoryClientPrivate *priv;
priv = g_new0 (ExecutiveSummaryComponentFactoryClientPrivate, 1);
client->private = priv;
}
static void
executive_summary_component_factory_client_class_init (ExecutiveSummaryComponentFactoryClientClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = executive_summary_component_factory_client_destroy;
parent_class = gtk_type_class (PARENT_TYPE);
}
E_MAKE_TYPE (executive_summary_component_factory_client,
"ExecutiveSummaryComponentFactoryClient",
ExecutiveSummaryComponentFactoryClient,
executive_summary_component_factory_client_class_init,
executive_summary_component_factory_client_init, PARENT_TYPE)
/*** Public API ***/
/**
* executive_summary_component_factory_client_construct:
* @client: The ExecutiveSummaryComponentFactoryClient to construct.
* @corba_object: The CORBA_Object to construct it from.
*
* Constructs a client from the given CORBA_Object.
*/
void
executive_summary_component_factory_client_construct (ExecutiveSummaryComponentFactoryClient *client,
CORBA_Object corba_object)
{
g_return_if_fail (client != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (client));
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_client_construct (BONOBO_OBJECT_CLIENT (client), corba_object);
}
/**
* executive_summary_component_factory_client_new:
* @id: The OAFIID of the component to activate.
*
* Activates the component specified by @id, and creates a server side client
* for that object.
*
* Returns: A pointer to an ExecutiveSummaryComponentFactoryClient object.
*/
ExecutiveSummaryComponentFactoryClient *
executive_summary_component_factory_client_new (const char *id)
{
ExecutiveSummaryComponentFactoryClient *client;
CORBA_Environment ev;
CORBA_Object corba_object;
g_return_val_if_fail (id != NULL, NULL);
CORBA_exception_init (&ev);
corba_object = oaf_activate_from_id ((char *)id, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
g_warning ("Could not start %s\n", id);
return NULL;
}
CORBA_exception_free (&ev);
if (corba_object == CORBA_OBJECT_NIL) {
g_warning ("Could not activate %s\n", id);
return NULL;
}
client = gtk_type_new (executive_summary_component_factory_client_get_type ());
executive_summary_component_factory_client_construct (client,
corba_object);
return client;
}
/**
* executive_summary_component_factory_client_create_view:
* @client: The client on which to create the view.
*
* Creates a new view of a remote component.
*
* Returns: A GNOME_Evolution_Summary_Component.
*/
GNOME_Evolution_Summary_Component
executive_summary_component_factory_client_create_view (ExecutiveSummaryComponentFactoryClient *client)
{
GNOME_Evolution_Summary_ComponentFactory factory;
GNOME_Evolution_Summary_Component component;
CORBA_Environment ev;
g_return_val_if_fail (client != NULL, CORBA_OBJECT_NIL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT (client),
CORBA_OBJECT_NIL);
CORBA_exception_init (&ev);
factory = bonobo_object_corba_objref (BONOBO_OBJECT (client));
component = GNOME_Evolution_Summary_ComponentFactory_createView (factory, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Error creating view: %s", CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return CORBA_OBJECT_NIL;
}
CORBA_exception_free (&ev);
return component;
}

View File

@ -1,56 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component-factory-client.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_H__
#define _EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_H__
#include <bonobo/bonobo-object-client.h>
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE (executive_summary_component_factory_client_get_type ())
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE, ExecutiveSummaryComponentFactoryClient))
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE, ExecutiveSummaryComponentFactoryClientClass))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLIENT_TYPE))
typedef struct _ExecutiveSummaryComponentFactoryClientPrivate ExecutiveSummaryComponentFactoryClientPrivate;
typedef struct _ExecutiveSummaryComponentFactoryClient ExecutiveSummaryComponentFactoryClient;
typedef struct _ExecutiveSummaryComponentFactoryClientClass ExecutiveSummaryComponentFactoryClientClass;
struct _ExecutiveSummaryComponentFactoryClient {
BonoboObjectClient parent;
ExecutiveSummaryComponentFactoryClientPrivate *private;
};
struct _ExecutiveSummaryComponentFactoryClientClass {
BonoboObjectClientClass parent_class;
};
GtkType executive_summary_component_factory_client_get_type (void);
void executive_summary_component_factory_client_construct (ExecutiveSummaryComponentFactoryClient *client,
CORBA_Object corba_object);
ExecutiveSummaryComponentFactoryClient *executive_summary_component_factory_client_new (const char *id);
CORBA_Object executive_summary_component_factory_client_create_view (ExecutiveSummaryComponentFactoryClient *client);
#endif

View File

@ -1,400 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component.c - Bonobo implementation of
* SummaryComponent.idl
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include <evolution-services/executive-summary-component.h>
#include <evolution-services/executive-summary-component-view.h>
struct _ExecutiveSummaryComponentViewPrivate {
ExecutiveSummaryComponent *component;
BonoboControl *control;
Bonobo_Control objref;
char *html;
char *title;
char *icon;
int id;
};
static GtkObjectClass *parent_class = NULL;
#define PARENT_TYPE (gtk_object_get_type ())
enum {
CONFIGURE,
LAST_SIGNAL
};
static gint32 view_signals[LAST_SIGNAL] = { 0 };
static void
executive_summary_component_view_destroy (GtkObject *object)
{
ExecutiveSummaryComponentView *view;
ExecutiveSummaryComponentViewPrivate *priv;
view = EXECUTIVE_SUMMARY_COMPONENT_VIEW (object);
priv = view->private;
if (priv == NULL)
return;
if (priv->component)
bonobo_object_unref (BONOBO_OBJECT (priv->component));
if (priv->control)
bonobo_object_unref (BONOBO_OBJECT (priv->control));
g_free (priv->html);
g_free (priv->title);
g_free (priv->icon);
g_free (priv);
view->private = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
executive_summary_component_view_class_init (ExecutiveSummaryComponentViewClass *view_class)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (view_class);
object_class->destroy = executive_summary_component_view_destroy;
view_signals[CONFIGURE] = gtk_signal_new ("configure",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryComponentViewClass, configure),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, view_signals, LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
}
static void
executive_summary_component_view_init (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
priv = g_new (ExecutiveSummaryComponentViewPrivate, 1);
view->private = priv;
priv->control = NULL;
priv->objref = NULL;
priv->html = NULL;
priv->title = NULL;
priv->icon = NULL;
priv->id = -1;
}
E_MAKE_TYPE (executive_summary_component_view, "ExecutiveSummaryComponentView",
ExecutiveSummaryComponentView,
executive_summary_component_view_class_init,
executive_summary_component_view_init, PARENT_TYPE);
void
executive_summary_component_view_construct (ExecutiveSummaryComponentView *view,
ExecutiveSummaryComponent *component,
BonoboControl *control,
const char *html,
const char *title,
const char *icon)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
g_return_if_fail (control != NULL || html != NULL);
priv = view->private;
if (component != NULL) {
bonobo_object_ref (BONOBO_OBJECT (component));
priv->component = component;
} else {
priv->component = NULL;
}
if (control != NULL) {
bonobo_object_ref (BONOBO_OBJECT (control));
priv->control = control;
} else {
priv->control = NULL;
}
if (html) {
priv->html = g_strdup (html);
} else {
priv->html = NULL;
}
if (title) {
priv->title = g_strdup (title);
} else {
priv->title = NULL;
}
if (icon) {
priv->icon = g_strdup (icon);
} else {
priv->icon = NULL;
}
}
ExecutiveSummaryComponentView *
executive_summary_component_view_new (ExecutiveSummaryComponent *component,
BonoboControl *control,
const char *html,
const char *title,
const char *icon)
{
ExecutiveSummaryComponentView *view;
g_return_val_if_fail (control != NULL || html != NULL, NULL);
view = gtk_type_new (executive_summary_component_view_get_type ());
executive_summary_component_view_construct (view, component, control,
html, title, icon);
return view;
}
void
executive_summary_component_view_set_title (ExecutiveSummaryComponentView *view,
const char *title)
{
ExecutiveSummaryComponentViewPrivate *priv;
ExecutiveSummaryComponent *component;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
if (priv->title)
g_free (priv->title);
priv->title = g_strdup (title);
component = priv->component;
if (component == NULL) {
return;
}
executive_summary_component_set_title (component, view);
}
const char *
executive_summary_component_view_get_title (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
priv = view->private;
return priv->title;
}
void
executive_summary_component_view_set_icon (ExecutiveSummaryComponentView *view,
const char *icon)
{
ExecutiveSummaryComponentViewPrivate *priv;
ExecutiveSummaryComponent *component;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
if (priv->icon)
g_free (priv->icon);
priv->icon = g_strdup (icon);
component = priv->component;
if (component == NULL) {
return;
}
executive_summary_component_set_icon (component, view);
}
const char *
executive_summary_component_view_get_icon (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
priv = view->private;
return priv->icon;
}
void
executive_summary_component_view_flash (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
ExecutiveSummaryComponent *component;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
component = priv->component;
if (component == NULL) {
g_warning ("Calling %s from the wrong side of the CORBA interface", __FUNCTION__);
return;
}
executive_summary_component_flash (component, view);
}
void
executive_summary_component_view_set_html (ExecutiveSummaryComponentView *view,
const char *html)
{
ExecutiveSummaryComponentViewPrivate *priv;
ExecutiveSummaryComponent *component;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
if (priv->html)
g_free (priv->html);
priv->html = g_strdup (html);
component = priv->component;
if (component == NULL) {
return;
}
executive_summary_component_update (component, view);
}
void
executive_summary_component_view_configure (ExecutiveSummaryComponentView *view)
{
gtk_signal_emit (GTK_OBJECT (view), view_signals[CONFIGURE]);
}
const char *
executive_summary_component_view_get_html (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
priv = view->private;
return priv->html;
}
BonoboObject *
executive_summary_component_view_get_control (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
priv = view->private;
return (BonoboObject *)priv->control;
}
void
executive_summary_component_view_set_id (ExecutiveSummaryComponentView *view,
int id)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
priv->id = id;
}
int
executive_summary_component_view_get_id (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, -1);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), -1);
priv = view->private;
return priv->id;
}
void
executive_summary_component_view_set_objref (ExecutiveSummaryComponentView *view,
Bonobo_Control objref)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view));
priv = view->private;
if (priv->objref) {
g_warning ("View already has an objref.");
return;
}
priv->objref = objref;
}
GtkWidget *
executive_summary_component_view_get_widget (ExecutiveSummaryComponentView *view)
{
ExecutiveSummaryComponentViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW (view), NULL);
priv = view->private;
if (priv->objref == NULL) {
g_warning ("View has no objref.");
return NULL;
}
return bonobo_widget_new_control_from_objref (priv->objref, NULL);
}

View File

@ -1,92 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __EXECUTIVE_SUMMARY_COMPONENT_VIEW_H__
#define __EXECUTIVE_SUMMARY_COMPONENT_VIEW_H__
#include <bonobo/bonobo-control.h>
#include <evolution-services/executive-summary-component.h>
#define EXECUTIVE_SUMMARY_COMPONENT_VIEW_TYPE (executive_summary_component_view_get_type ())
#define EXECUTIVE_SUMMARY_COMPONENT_VIEW(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_VIEW_TYPE, ExecutiveSummaryComponentView))
#define EXECUTIVE_SUMMARY_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_VIEW_TYPE, ExecutiveSummaryComponentClass))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_VIEW_TYPE))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_VIEW_CLASS_TYPE))
typedef struct _ExecutiveSummaryComponentViewPrivate ExecutiveSummaryComponentViewPrivate;
typedef struct _ExecutiveSummaryComponentView ExecutiveSummaryComponentView;
typedef struct _ExecutiveSummaryComponentViewClass ExecutiveSummaryComponentViewClass;
struct _ExecutiveSummaryComponentView {
GtkObject object;
ExecutiveSummaryComponentViewPrivate *private;
};
struct _ExecutiveSummaryComponentViewClass {
GtkObjectClass parent_class;
/* Signals */
void (* configure) (ExecutiveSummaryComponentView *view);
};
GtkType executive_summary_component_view_get_type (void);
void
executive_summary_component_view_construct (ExecutiveSummaryComponentView *view,
ExecutiveSummaryComponent *component,
BonoboControl *control,
const char *html,
const char *title,
const char *icon);
ExecutiveSummaryComponentView *
executive_summary_component_view_new (ExecutiveSummaryComponent *component,
BonoboControl *control,
const char *html,
const char *title,
const char *icon);
void executive_summary_component_view_set_title (ExecutiveSummaryComponentView *view,
const char *title);
const char *executive_summary_component_view_get_title (ExecutiveSummaryComponentView *view);
void executive_summary_component_view_set_icon (ExecutiveSummaryComponentView *view,
const char *icon);
const char *executive_summary_component_view_get_icon (ExecutiveSummaryComponentView *view);
void executive_summary_component_view_flash (ExecutiveSummaryComponentView *view);
void executive_summary_component_view_set_html (ExecutiveSummaryComponentView *view,
const char *html);
const char *executive_summary_component_view_get_html (ExecutiveSummaryComponentView *view);
BonoboObject *executive_summary_component_view_get_control (ExecutiveSummaryComponentView *view);
int executive_summary_component_view_get_id (ExecutiveSummaryComponentView *view);
void executive_summary_component_view_set_id (ExecutiveSummaryComponentView *view,
int id);
void executive_summary_component_view_configure (ExecutiveSummaryComponentView *view);
void executive_summary_component_view_set_objref (ExecutiveSummaryComponentView *view,
Bonobo_Control objref);
GtkWidget *executive_summary_component_view_get_widget (ExecutiveSummaryComponentView *view);
#endif

View File

@ -1,353 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component.c - Bonobo implementation of
* SummaryComponent.idl
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include "Executive-Summary.h"
#include "executive-summary-component.h"
static void executive_summary_component_destroy (GtkObject *object);
static void executive_summary_component_init (ExecutiveSummaryComponent *component);
static void executive_summary_component_class_init (ExecutiveSummaryComponentClass *esc_class);
#define PARENT_TYPE (bonobo_object_get_type ())
#define FACTORY_PARENT_TYPE (bonobo_object_get_type ())
static BonoboObjectClass *parent_class;
static BonoboObjectClass *factory_parent_class;
struct _ExecutiveSummaryComponentPrivate {
int dummy;
};
struct _ExecutiveSummaryComponentFactoryPrivate {
EvolutionServicesCreateViewFn create_view;
void *closure;
};
/* CORBA interface */
static POA_GNOME_Evolution_Summary_Component__vepv SummaryComponent_vepv;
static POA_GNOME_Evolution_Summary_ComponentFactory__vepv ComponentFactory_vepv;
static POA_GNOME_Evolution_Summary_Component *
create_servant (void)
{
POA_GNOME_Evolution_Summary_Component *servant;
CORBA_Environment ev;
servant = (POA_GNOME_Evolution_Summary_Component *)g_new0 (BonoboObjectServant, 1);
servant->vepv = &SummaryComponent_vepv;
CORBA_exception_init (&ev);
POA_GNOME_Evolution_Summary_Component__init ((PortableServer_Servant) servant, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_free (servant);
CORBA_exception_free (&ev);
return NULL;
}
CORBA_exception_free (&ev);
return servant;
}
static void
executive_summary_component_destroy (GtkObject *object)
{
ExecutiveSummaryComponent *component;
ExecutiveSummaryComponentPrivate *priv;
component = EXECUTIVE_SUMMARY_COMPONENT (object);
priv = component->private;
if (priv == NULL)
return;
g_free (priv);
component->private = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/* Init */
static void
corba_class_init (void)
{
POA_GNOME_Evolution_Summary_Component__vepv *vepv;
POA_GNOME_Evolution_Summary_Component__epv *epv;
PortableServer_ServantBase__epv *base_epv;
base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
base_epv->_private = NULL;
base_epv->finalize = NULL;
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Summary_Component__epv, 1);
vepv = &SummaryComponent_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
vepv->GNOME_Evolution_Summary_Component_epv = epv;
}
static void
executive_summary_component_class_init (ExecutiveSummaryComponentClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = executive_summary_component_destroy;
parent_class = gtk_type_class (PARENT_TYPE);
corba_class_init ();
}
static void
executive_summary_component_init (ExecutiveSummaryComponent *component)
{
ExecutiveSummaryComponentPrivate *priv;
priv = g_new (ExecutiveSummaryComponentPrivate, 1);
component->private = priv;
}
E_MAKE_TYPE (executive_summary_component, "ExecutiveSummaryComponent",
ExecutiveSummaryComponent, executive_summary_component_class_init,
executive_summary_component_init, PARENT_TYPE);
static void
executive_summary_component_construct (ExecutiveSummaryComponent *component,
GNOME_Evolution_Summary_Component corba_object)
{
g_return_if_fail (component != NULL);
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_construct (BONOBO_OBJECT (component), corba_object);
}
/*** Public API ***/
/**
* executive_summary_component_new:
*
* Creates a BonoboObject that implements the Summary::Component interface.
*
* Returns: A pointer to a BonoboObject.
*/
BonoboObject *
executive_summary_component_new (void)
{
ExecutiveSummaryComponent *component;
POA_GNOME_Evolution_Summary_Component *servant;
GNOME_Evolution_Summary_Component corba_object;
servant = create_servant ();
if (servant == NULL)
return NULL;
component = gtk_type_new (executive_summary_component_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (component),
servant);
executive_summary_component_construct (component, corba_object);
return BONOBO_OBJECT (component);
}
/**** ComponentFactory implementation ****/
static POA_GNOME_Evolution_Summary_ComponentFactory *
create_factory_servant (void)
{
POA_GNOME_Evolution_Summary_ComponentFactory *servant;
CORBA_Environment ev;
servant = (POA_GNOME_Evolution_Summary_ComponentFactory *)g_new0 (BonoboObjectServant, 1);
servant->vepv = &ComponentFactory_vepv;
CORBA_exception_init (&ev);
POA_GNOME_Evolution_Summary_ComponentFactory__init ((PortableServer_Servant) servant, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_free (servant);
CORBA_exception_free (&ev);
return NULL;
}
CORBA_exception_free (&ev);
return servant;
}
static GNOME_Evolution_Summary_Component
impl_GNOME_Evolution_Summary_ComponentFactory_createView (PortableServer_Servant servant,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
BonoboObject *view;
ExecutiveSummaryComponentFactory *factory;
ExecutiveSummaryComponentFactoryPrivate *priv;
GNOME_Evolution_Summary_Component component, component_dup;
bonobo_object = bonobo_object_from_servant (servant);
factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (bonobo_object);
priv = factory->private;
view = (* priv->create_view) (factory, priv->closure);
g_return_val_if_fail (view != NULL, CORBA_OBJECT_NIL);
component = bonobo_object_corba_objref (BONOBO_OBJECT (view));
component_dup = CORBA_Object_duplicate (component, ev);
return component_dup;
}
static void
corba_factory_init (void)
{
POA_GNOME_Evolution_Summary_ComponentFactory__vepv *vepv;
POA_GNOME_Evolution_Summary_ComponentFactory__epv *epv;
PortableServer_ServantBase__epv *base_epv;
base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
base_epv->_private = NULL;
base_epv->finalize = NULL;
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Summary_ComponentFactory__epv, 1);
epv->createView = impl_GNOME_Evolution_Summary_ComponentFactory_createView;
vepv = &ComponentFactory_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
vepv->GNOME_Evolution_Summary_ComponentFactory_epv = epv;
}
/* GtkObject methods */
static void
executive_summary_component_factory_destroy (GtkObject *object)
{
ExecutiveSummaryComponentFactory *factory;
ExecutiveSummaryComponentFactoryPrivate *priv;
factory = EXECUTIVE_SUMMARY_COMPONENT_FACTORY (object);
priv = factory->private;
if (priv == NULL)
return;
g_free (priv);
factory->private = NULL;
(* GTK_OBJECT_CLASS (factory_parent_class)->destroy) (object);
}
static void
executive_summary_component_factory_class_init (ExecutiveSummaryComponentFactoryClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = executive_summary_component_factory_destroy;
factory_parent_class = gtk_type_class (FACTORY_PARENT_TYPE);
corba_factory_init ();
}
static void
executive_summary_component_factory_init (ExecutiveSummaryComponentFactory *factory)
{
ExecutiveSummaryComponentFactoryPrivate *priv;
priv = g_new (ExecutiveSummaryComponentFactoryPrivate, 1);
priv->create_view = NULL;
priv->closure = NULL;
factory->private = priv;
}
E_MAKE_TYPE (executive_summary_component_factory,
"ExecutiveSummaryComponentFactory",
ExecutiveSummaryComponentFactory,
executive_summary_component_factory_class_init,
executive_summary_component_factory_init, FACTORY_PARENT_TYPE);
static void
executive_summary_component_factory_construct (ExecutiveSummaryComponentFactory *factory,
GNOME_Evolution_Summary_ComponentFactory corba_object,
EvolutionServicesCreateViewFn create_view,
void *closure)
{
ExecutiveSummaryComponentFactoryPrivate *priv;
g_return_if_fail (factory != NULL);
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
bonobo_object_construct (BONOBO_OBJECT (factory), corba_object);
priv = factory->private;
priv->create_view = create_view;
priv->closure = closure;
}
/*** Public API ***/
/**
* executive_summary_component_factory_new:
* @create_view: A pointer to the function to create a new view.
* @closure: The data to be passed to the @create_view function when it is
* called.
*
* Creates a BonoboObject that implements the Summary::ComponentFactory
* interface.
*
* Returns: A pointer to a BonoboObject.
*/
BonoboObject *
executive_summary_component_factory_new (EvolutionServicesCreateViewFn create_view,
void *closure)
{
ExecutiveSummaryComponentFactory *factory;
POA_GNOME_Evolution_Summary_ComponentFactory *servant;
GNOME_Evolution_Summary_ComponentFactory corba_object;
servant = create_factory_servant ();
if (servant == NULL)
return NULL;
factory = gtk_type_new (executive_summary_component_factory_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (factory),
servant);
executive_summary_component_factory_construct (factory, corba_object,
create_view, closure);
return BONOBO_OBJECT (factory);
}

View File

@ -1,83 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-component.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_COMPONENT_H__
#define _EXECUTIVE_SUMMARY_COMPONENT_H__
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-object.h>
#define EXECUTIVE_SUMMARY_COMPONENT_TYPE (executive_summary_component_get_type ())
#define EXECUTIVE_SUMMARY_COMPONENT(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_TYPE, ExecutiveSummaryComponent))
#define EXECUTIVE_SUMMARY_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_TYPE, ExecutiveSummaryComponentClass))
#define IS_EXECUTIVE_SUMMARY_COMPONENT(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_TYPE))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_TYPE))
typedef struct _ExecutiveSummaryComponentPrivate ExecutiveSummaryComponentPrivate;
typedef struct _ExecutiveSummaryComponent ExecutiveSummaryComponent;
typedef struct _ExecutiveSummaryComponentClass ExecutiveSummaryComponentClass;
struct _ExecutiveSummaryComponent {
BonoboObject parent;
ExecutiveSummaryComponentPrivate *private;
};
struct _ExecutiveSummaryComponentClass {
BonoboObjectClass parent_class;
};
GtkType executive_summary_component_get_type (void);
BonoboObject *executive_summary_component_new (void);
/* Factory */
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE (executive_summary_component_factory_get_type ())
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE, ExecutiveSummaryComponentFactory))
#define EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE, ExecutiveSummaryComponentFactoryClass))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE))
#define IS_EXECUTIVE_SUMMARY_COMPONENT_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_COMPONENT_FACTORY_TYPE))
typedef struct _ExecutiveSummaryComponentFactoryPrivate ExecutiveSummaryComponentFactoryPrivate;
typedef struct _ExecutiveSummaryComponentFactory ExecutiveSummaryComponentFactory;
typedef struct _ExecutiveSummaryComponentFactoryClass ExecutiveSummaryComponentFactoryClass;
typedef BonoboObject *(* EvolutionServicesCreateViewFn) (ExecutiveSummaryComponentFactory *factory,
void *closure);
struct _ExecutiveSummaryComponentFactory {
BonoboObject parent;
ExecutiveSummaryComponentFactoryPrivate *private;
};
struct _ExecutiveSummaryComponentFactoryClass {
BonoboObjectClass parent_class;
};
GtkType executive_summary_component_factory_get_type (void);
BonoboObject *executive_summary_component_factory_new (EvolutionServicesCreateViewFn create_view,
void *closure);
#endif

View File

@ -1,340 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-html-view.c - Bonobo implementation of
* HtmlView.idl
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-event-source.h>
#include <gal/util/e-util.h>
#include "Executive-Summary.h"
#include "executive-summary-html-view.h"
static void executive_summary_html_view_destroy (GtkObject *object);
static void executive_summary_html_view_init (ExecutiveSummaryHtmlView *component);
static void executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClass *klass);
#define PARENT_TYPE (bonobo_object_get_type ())
static BonoboObjectClass *parent_class;
enum {
HANDLE_URI,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
struct _ExecutiveSummaryHtmlViewPrivate {
BonoboEventSource *event_source;
char *html;
};
/* CORBA interface */
static POA_GNOME_Evolution_Summary_HTMLView__vepv HTMLView_vepv;
static POA_GNOME_Evolution_Summary_HTMLView *
create_servant (void)
{
POA_GNOME_Evolution_Summary_HTMLView *servant;
CORBA_Environment ev;
servant = (POA_GNOME_Evolution_Summary_HTMLView *)g_new0 (BonoboObjectServant, 1);
servant->vepv = &HTMLView_vepv;
CORBA_exception_init (&ev);
POA_GNOME_Evolution_Summary_HTMLView__init ((PortableServer_Servant) servant, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_free (servant);
CORBA_exception_free (&ev);
return NULL;
}
CORBA_exception_free (&ev);
return servant;
}
static CORBA_char *
impl_GNOME_Evolution_Summary_HTMLView_getHtml (PortableServer_Servant servant,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ExecutiveSummaryHtmlView *view;
ExecutiveSummaryHtmlViewPrivate *priv;
bonobo_object = bonobo_object_from_servant (servant);
view = EXECUTIVE_SUMMARY_HTML_VIEW (bonobo_object);
priv = view->private;
return CORBA_string_dup (priv->html? priv->html: "");
}
static void
impl_GNOME_Evolution_Summary_HTMLView_handleURI (PortableServer_Servant servant,
const CORBA_char *uri,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
bonobo_object = bonobo_object_from_servant (servant);
gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[HANDLE_URI], uri);
}
/* GtkObject methods */
static void
executive_summary_html_view_destroy (GtkObject *object)
{
ExecutiveSummaryHtmlView *view;
ExecutiveSummaryHtmlViewPrivate *priv;
g_print ("BANG!");
view = EXECUTIVE_SUMMARY_HTML_VIEW (object);
priv = view->private;
if (priv == NULL)
return;
g_free (priv->html);
g_free (priv);
view->private = NULL;
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
corba_class_init (void)
{
POA_GNOME_Evolution_Summary_HTMLView__vepv *vepv;
POA_GNOME_Evolution_Summary_HTMLView__epv *epv;
PortableServer_ServantBase__epv *base_epv;
base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
base_epv->_private = NULL;
base_epv->finalize = NULL;
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Summary_HTMLView__epv, 1);
epv->getHtml = impl_GNOME_Evolution_Summary_HTMLView_getHtml;
epv->handleURI = impl_GNOME_Evolution_Summary_HTMLView_handleURI;
vepv = &HTMLView_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
vepv->GNOME_Evolution_Summary_HTMLView_epv = epv;
}
static void
executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClass *klass)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = executive_summary_html_view_destroy;
signals[HANDLE_URI] = gtk_signal_new ("handle_uri", GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryHtmlViewClass, handle_uri),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
corba_class_init ();
}
static void
executive_summary_html_view_init (ExecutiveSummaryHtmlView *view)
{
ExecutiveSummaryHtmlViewPrivate *priv;
priv = g_new (ExecutiveSummaryHtmlViewPrivate, 1);
priv->html = NULL;
priv->event_source = NULL;
view->private = priv;
}
E_MAKE_TYPE (executive_summary_html_view, "ExecutiveSummaryHtmlView",
ExecutiveSummaryHtmlView, executive_summary_html_view_class_init,
executive_summary_html_view_init, PARENT_TYPE);
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 = event_source;
bonobo_object_add_interface (BONOBO_OBJECT (view),
BONOBO_OBJECT (priv->event_source));
bonobo_object_construct (BONOBO_OBJECT (view), corba_object);
}
/*** Public API ***/
/**
* 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.
*
* Returns: A BonoboObject.
*/
BonoboObject *
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;
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, 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,
* @html: The HTML as a string.
*
* Sets the HTML string in @view to @html. @html is copied into @view,
* so after this call you are free to do what you want with @html.
*/
void
executive_summary_html_view_set_html (ExecutiveSummaryHtmlView *view,
const char *html)
{
ExecutiveSummaryHtmlViewPrivate *priv;
CORBA_any any;
CORBA_short s;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view));
priv = view->private;
if (priv->html)
g_free (priv->html);
if (html != NULL)
priv->html = g_strdup (html);
else
priv->html = NULL;
/* Notify any listeners */
s = 0;
any._type = (CORBA_TypeCode) TC_short;
any._value = &s;
bonobo_event_source_notify_listeners (BONOBO_EVENT_SOURCE (priv->event_source),
EXECUTIVE_SUMMARY_HTML_VIEW_HTML_CHANGED,
&any, NULL);
}
/**
* executive_summary_html_view_get_html:
* @view: The ExecutiveSummaryHtmlView to operate on.
*
* Retrieves the HTML stored in @view. This return value is not duplicated
* before returning, so you should not free it. Instead, if you want to free
* the HTML stored in @view, you should use
* executive_summary_html_view_set_html (view, NULL);.
*
* Returns: A pointer to the HTML stored in @view.
*/
const char *
executive_summary_html_view_get_html (ExecutiveSummaryHtmlView *view)
{
ExecutiveSummaryHtmlViewPrivate *priv;
g_return_val_if_fail (view != NULL, NULL);
g_return_val_if_fail (IS_EXECUTIVE_SUMMARY_HTML_VIEW (view), NULL);
priv = view->private;
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;
}

View File

@ -1,64 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary-html-view.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_HTML_VIEW_H__
#define _EXECUTIVE_SUMMARY_HTML_VIEW_H__
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-event-source.h>
#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))
#define EXECUTIVE_SUMMARY_HTML_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE, ExecutiveSummaryHtmlViewClass))
#define IS_EXECUTIVE_SUMMARY_HTML_VIEW(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE))
#define IS_EXECUTIVE_SUMMARY_HTML_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_HTML_VIEW_TYPE))
typedef struct _ExecutiveSummaryHtmlViewPrivate ExecutiveSummaryHtmlViewPrivate;
typedef struct _ExecutiveSummaryHtmlView ExecutiveSummaryHtmlView;
typedef struct _ExecutiveSummaryHtmlViewClass ExecutiveSummaryHtmlViewClass;
struct _ExecutiveSummaryHtmlView {
BonoboObject parent;
ExecutiveSummaryHtmlViewPrivate *private;
};
struct _ExecutiveSummaryHtmlViewClass {
BonoboObjectClass parent_class;
void (* handle_uri) (ExecutiveSummaryHtmlView *view,
char *uri);
};
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

View File

@ -1,266 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary.c - Bonobo implementation of Summary.idl
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include "Executive-Summary.h"
#include "executive-summary.h"
static void executive_summary_destroy (GtkObject *object);
static void executive_summary_class_init (ExecutiveSummaryClass *es_class);
static void executive_summary_init (ExecutiveSummary *es);
#define PARENT_TYPE (bonobo_object_get_type ())
enum {
UPDATE,
SET_TITLE,
SET_ICON,
FLASH,
LAST_SIGNAL
};
static guint32 summary_signals [LAST_SIGNAL] = { 0 };
static BonoboObjectClass *parent_class;
struct _ExecutiveSummaryPrivate {
int dummy;
};
/* CORBA interface implementation */
static POA_GNOME_Evolution_Summary_ViewFrame__vepv Summary_vepv;
static POA_GNOME_Evolution_Summary_ViewFrame *
create_servant (void)
{
POA_GNOME_Evolution_Summary_ViewFrame *servant;
CORBA_Environment ev;
servant = (POA_GNOME_Evolution_Summary_ViewFrame *)g_new0 (BonoboObjectServant, 1);
servant->vepv = &Summary_vepv;
CORBA_exception_init (&ev);
POA_GNOME_Evolution_Summary_ViewFrame__init ((PortableServer_Servant) servant, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_free (servant);
CORBA_exception_free (&ev);
return NULL;
}
CORBA_exception_free (&ev);
return servant;
}
#if 0
static void
impl_GNOME_Evolution_Summary_ViewFrame_setTitle (PortableServer_Servant servant,
CORBA_long id,
const CORBA_char *title,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ExecutiveSummary *summary;
bonobo_object = bonobo_object_from_servant (servant);
summary = EXECUTIVE_SUMMARY (bonobo_object);
gtk_signal_emit (GTK_OBJECT (summary), summary_signals[SET_TITLE],
id, title);
}
static void
impl_GNOME_Evolution_Summary_ViewFrame_setIcon (PortableServer_Servant servant,
CORBA_long id,
const CORBA_char *title,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ExecutiveSummary *summary;
bonobo_object = bonobo_object_from_servant (servant);
summary = EXECUTIVE_SUMMARY (bonobo_object);
gtk_signal_emit (GTK_OBJECT (summary), summary_signals[SET_ICON],
id, title);
}
static void
impl_GNOME_Evolution_Summary_ViewFrame_flash (PortableServer_Servant servant,
CORBA_long id,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ExecutiveSummary *summary;
bonobo_object = bonobo_object_from_servant (servant);
summary = EXECUTIVE_SUMMARY (bonobo_object);
gtk_signal_emit (GTK_OBJECT (summary), summary_signals[FLASH], id);
}
static void
impl_GNOME_Evolution_Summary_ViewFrame_updateComponent (PortableServer_Servant servant,
const CORBA_long id,
const CORBA_char *html,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
ExecutiveSummary *summary;
bonobo_object = bonobo_object_from_servant (servant);
summary = EXECUTIVE_SUMMARY (bonobo_object);
gtk_signal_emit (GTK_OBJECT (summary), summary_signals[UPDATE],
id, html);
}
#endif
/* GtkObject methods */
static void
executive_summary_destroy (GtkObject *object)
{
ExecutiveSummary *es;
ExecutiveSummaryPrivate *priv;
es = EXECUTIVE_SUMMARY (object);
priv = es->private;
if (priv == NULL)
return;
g_free (priv);
es->private = NULL;
}
/* Initialisation */
static void
corba_class_init (void)
{
POA_GNOME_Evolution_Summary_ViewFrame__vepv *vepv;
POA_GNOME_Evolution_Summary_ViewFrame__epv *epv;
PortableServer_ServantBase__epv *base_epv;
base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
base_epv->_private = NULL;
base_epv->finalize = NULL;
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_Summary_ViewFrame__epv, 1);
vepv = &Summary_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
vepv->GNOME_Evolution_Summary_ViewFrame_epv = epv;
}
static void
executive_summary_class_init (ExecutiveSummaryClass *es_class)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) es_class;
object_class->destroy = executive_summary_destroy;
parent_class = gtk_type_class (PARENT_TYPE);
summary_signals[UPDATE] = gtk_signal_new ("update",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryClass, update),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
summary_signals[SET_TITLE] = gtk_signal_new ("set_title",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryClass, set_title),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
summary_signals[SET_ICON] = gtk_signal_new ("set_icon",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryClass, set_icon),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
summary_signals[FLASH] = gtk_signal_new ("flash",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ExecutiveSummaryClass, flash),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, summary_signals, LAST_SIGNAL);
corba_class_init ();
}
static void
executive_summary_init (ExecutiveSummary *es)
{
ExecutiveSummaryPrivate *priv;
priv = g_new (ExecutiveSummaryPrivate, 1);
es->private = priv;
}
E_MAKE_TYPE (executive_summary, "ExecutiveSummary", ExecutiveSummary,
executive_summary_class_init, executive_summary_init, PARENT_TYPE);
void
executive_summary_construct (ExecutiveSummary *es,
GNOME_Evolution_Summary_ViewFrame corba_object)
{
bonobo_object_construct (BONOBO_OBJECT (es), corba_object);
}
BonoboObject *
executive_summary_new (void)
{
POA_GNOME_Evolution_Summary_ViewFrame *servant;
GNOME_Evolution_Summary_ViewFrame corba_object;
ExecutiveSummary *es;
servant = create_servant ();
if (servant == NULL)
return NULL;
es = gtk_type_new (executive_summary_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (es),
servant);
executive_summary_construct (es, corba_object);
return BONOBO_OBJECT (es);
}

View File

@ -1,67 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* executive-summary.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _EXECUTIVE_SUMMARY_H__
#define _EXECUTIVE_SUMMARY_H__
#include <gtk/gtksignal.h>
#include <bonobo.h>
#include "Executive-Summary.h"
#define EXECUTIVE_SUMMARY_TYPE (executive_summary_get_type ())
#define EXECUTIVE_SUMMARY(obj) (GTK_CHECK_CAST ((obj), EXECUTIVE_SUMMARY_TYPE, ExecutiveSummary))
#define EXECUTIVE_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EXECUTIVE_SUMMARY_TYPE, ExecutiveSummaryClass))
#define IS_EXECUTIVE_SUMMARY(obj) (GTK_CHECK_TYPE ((obj), EXECUTIVE_SUMMARY_TYPE))
#define IS_EXECUTIVE_SUMMARY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EXECUTIVE_SUMMARY_TYPE))
typedef struct _ExecutiveSummaryPrivate ExecutiveSummaryPrivate;
typedef struct _ExecutiveSummary ExecutiveSummary;
typedef struct _ExecutiveSummaryClass ExecutiveSummaryClass;
struct _ExecutiveSummary {
BonoboObject parent;
ExecutiveSummaryPrivate *private;
};
struct _ExecutiveSummaryClass {
BonoboObjectClass parent_class;
void (* update) (ExecutiveSummary *summary,
const GNOME_Evolution_Summary_Component component,
const char *html);
void (* set_title) (ExecutiveSummary *summary,
const GNOME_Evolution_Summary_Component component,
const char *title);
void (* set_icon) (ExecutiveSummary *summary,
const GNOME_Evolution_Summary_Component component,
const char *icon);
void (* flash) (ExecutiveSummary *summary,
const GNOME_Evolution_Summary_Component component);
};
GtkType executive_summary_get_type (void);
void executive_summary_construct (ExecutiveSummary *es,
GNOME_Evolution_Summary_ViewFrame corba_object);
BonoboObject *executive_summary_new (void);
#endif

View File

@ -1,2 +0,0 @@
Makefile.in
Makefile

View File

@ -1,4 +0,0 @@
#include <Bonobo.idl>
#include <SummaryComponent.idl>
#include <Summary.idl>
#include <HtmlView.idl>

View File

@ -1,25 +0,0 @@
/*-*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* CORBA interface for an HTML view.
*
* Authors:
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*/
#include <Bonobo.idl>
module GNOME {
module Evolution {
module Summary {
interface HTMLView : Bonobo::Unknown {
string getHtml ();
void handleURI (in string uri);
};
};
};
};

View File

@ -1,7 +0,0 @@
EXTRA_DIST = $(IDLS)
IDLS = \
Executive-Summary.idl \
HtmlView.idl \
Summary.idl \
SummaryComponent.idl

View File

@ -1,20 +0,0 @@
/*-*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* CORBA interface for the Evolution shell.
*
* Authors:
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*/
#include <Bonobo.idl>
module GNOME {
module Evolution {
module Summary {
interface ViewFrame: Bonobo::Unknown {
};
};
};
};

View File

@ -1,36 +0,0 @@
/*-*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* CORBA interface for the Evolution Executive Summary Components.
*
* Authors:
* Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*/
/* TODO: Needs Exceptions */
#include <Bonobo.idl>
#include <oaf-factory.idl>
module GNOME {
module Evolution {
module Summary {
interface ViewFrame;
interface Component: Bonobo::Unknown {
};
interface ComponentFactory: Bonobo::Unknown {
/**
* createView:
*
* Creates a new Component object.
*
* Returns: A Component object.
**/
Component createView ();
};
};
};
};

View File

@ -1,45 +0,0 @@
<html>
<head>
<Title>Evolution Executive Summary</title>
</head>
<body bgcolor="#ffffff" background="executive-summary-bg.png">
<table cellpadding="0" cellspacing="0" numcols="3" width="100%" height="100%" border="0">
<tr>
<td bgcolor="#9aadbf" height="102">
<img src="butterfly.png"></td>
<td width="100%" colspan="2" align="middle" bgcolor="#9aadbf">
E V O L U T I O N
</td></tr>
<!-- Hmmmm.
<tr><td bgcolor="#9aadbf">&nbsp;</td>
<td valign="top" width="100"><img src="executive-summary-curve.png"></td>
<td width="95%">
<table border="0" align="middle">
<tr>
<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>
<td colspan="2">
<!-- EVOLUTION EXECUTIVE SUMMARY SERVICES DO NOT REMOVE -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -1,9 +0,0 @@
Makefile.in
Makefile
core
.deps
.libs
test-service
rdf-summary
GNOME_Evolution_Summary_test.oaf
GNOME_Evolution_Summary_rdf.oaf

View File

@ -1,43 +0,0 @@
bin_PROGRAMS = test-service rdf-summary
CFLAGS += -g
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/executive-summary \
$(EXTRA_GNOME_CFLAGS) \
$(BONOBO_HTML_GNOME_CFLAGS) \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\"
test_service_SOURCES = \
main.c
test_service_LDADD = \
$(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS)
#test_bonobo_service_SOURCES = \
# test-bonobo.c
#test_bonobo_service_LDADD = \
# $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
# $(BONOBO_VFS_GNOME_LIBS) \
# $(EXTRA_GNOME_LIBS)
rdf_summary_SOURCES = \
rdf-summary.c
rdf_summary_LDADD = \
$(top_builddir)/executive-summary/evolution-services/libevolution-services.la \
$(BONOBO_VFS_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS)
oafdir = $(datadir)/oaf
oaf_in_files = \
GNOME_Evolution_Summary_test.oaf.in \
GNOME_Evolution_Summary_rdf.oaf.in
oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
@XML_I18N_MERGE_OAF_RULE@
EXTRA_DIST = $(oaf_in_files) $(oaf_DATA)

View File

@ -1,296 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* main.c
* Test Service that counts the number of seconds since it was started.
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-persist-stream.h>
#include <bonobo/bonobo-property-bag.h>
#include <evolution-services/executive-summary-component.h>
#include <evolution-services/executive-summary-html-view.h>
#include <liboaf/liboaf.h>
enum {
PROPERTY_TITLE,
PROPERTY_ICON
};
struct _UserData {
char *title;
char *icon;
};
typedef struct _UserData UserData;
static int running_views = 0;
#define TEST_SERVICE_ID "OAFIID:GNOME_Evolution_Summary_test_ComponentFactory"
static BonoboGenericFactory *factory = NULL;
/* PersistStream callbacks */
static void
load_from_stream (BonoboPersistStream *ps,
Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
gpointer data,
CORBA_Environment *ev)
{
char *str;
if (*type && g_strcasecmp (type, "application/x-test-service") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
bonobo_stream_client_read_string (stream, &str, ev);
if (ev->_major != CORBA_NO_EXCEPTION || str == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
g_print ("Restoring with :%s\n", str);
g_free (str);
}
static void
save_to_stream (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
gpointer data,
CORBA_Environment *ev)
{
if (*type && g_strcasecmp (type, "application/x-test-service") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
bonobo_stream_client_printf (stream, TRUE, ev, "Yo yo yo");
if (ev->_major != CORBA_NO_EXCEPTION)
return;
}
static Bonobo_Persist_ContentTypeList *
content_types (BonoboPersistStream *ps,
void *closure,
CORBA_Environment *ev)
{
return bonobo_persist_generate_content_types (1, "application/x-test-service");
}
/* PropertyControl callback */
/* Propertybag set/get functions */
static void
set_property (BonoboPropertyBag *bag,
const BonoboArg *arg,
guint arg_id,
CORBA_Environment *ev,
gpointer user_data)
{
switch (arg_id) {
case PROPERTY_TITLE:
g_print ("Setting title.\n");
break;
case PROPERTY_ICON:
g_print ("Setting icon.\n");
break;
default:
break;
}
}
static void
get_property (BonoboPropertyBag *bag,
BonoboArg *arg,
guint arg_id,
CORBA_Environment *ev,
gpointer user_data)
{
UserData *ud = (UserData *) user_data;
switch (arg_id) {
case PROPERTY_TITLE:
BONOBO_ARG_SET_STRING (arg, ud->title);
break;
case PROPERTY_ICON:
BONOBO_ARG_SET_STRING (arg, ud->icon);
break;
default:
break;
}
}
static void
component_destroyed (GtkObject *object,
gpointer data)
{
UserData *ud = (UserData *) data;
/* Free the UserData structure */
g_free (ud->title);
g_free (ud->icon);
g_free (ud);
running_views--;
g_print ("Destroy!\n");
if (running_views <= 0) {
bonobo_object_unref (BONOBO_OBJECT (factory));
gtk_main_quit ();
}
}
static BonoboObject *
create_view (ExecutiveSummaryComponentFactory *_factory,
void *closure)
{
BonoboObject *component, *view;
BonoboPersistStream *stream;
BonoboPropertyBag *bag;
BonoboEventSource *event_source;
UserData *ud;
/* Create the component object */
component = executive_summary_component_new ();
/* Create the UserData structure and fill it */
ud = g_new (UserData, 1);
ud->title = g_strdup ("Hello World!");
ud->icon = g_strdup ("apple-red.png");
gtk_signal_connect (GTK_OBJECT (component), "destroy",
GTK_SIGNAL_FUNC (component_destroyed), ud);
/* Now create the aggregate objects. For a "service"
either a Summary::HTMLView or Bonobo::Control are required.
Other supported agreggate objects are
PersistStream: For saving and restoring the component.
PropertyBag: To set the icon and title and other properties
PropertyControl: To produce a control to configure the service.
To aggregate the objects
i) Create the objects using their creation functions
ii) Use bonobo_object_add_interface ().
*/
/* Create an event source to share with all the interfaces,
as we can only aggregate one onto the ExecutiveSummaryComponent */
event_source = bonobo_event_source_new ();
/* The Summary::HTMLView interface */
view = executive_summary_html_view_new_full (event_source);
/* Set the default HTML */
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view),
"<B>Hello World</b>");
bonobo_object_add_interface (component, view);
/* Add the Bonobo::PropertyBag interface */
bag = bonobo_property_bag_new_full (get_property, set_property,
event_source, ud);
/* Add the properties. There should be 2:
window_title: For the window title.
window_icon: For the window icon.
*/
bonobo_property_bag_add (bag,
"window_title", PROPERTY_TITLE,
BONOBO_ARG_STRING,
NULL,
"The title of this components window", 0);
bonobo_property_bag_add (bag,
"window_icon", PROPERTY_ICON,
BONOBO_ARG_STRING,
NULL,
"The icon for this component's window", 0);
/* Now add the interface */
bonobo_object_add_interface (component, BONOBO_OBJECT(bag));
/* Add the Bonobo::PersistStream interface */
stream = bonobo_persist_stream_new (load_from_stream, save_to_stream,
NULL, content_types, NULL);
bonobo_object_add_interface (component, BONOBO_OBJECT(stream));
running_views++;
/* Return the ExecutiveSummaryComponent object */
return component;
}
static BonoboObject *
factory_fn (BonoboGenericFactory *generic_factory,
void *closure)
{
BonoboObject *_factory;
/* Create an executive summary component factory */
_factory = executive_summary_component_factory_new (create_view, NULL);
return _factory;
}
void
test_service_factory_init (void)
{
if (factory != NULL)
return;
/* Register the factory creation function and the IID */
factory = bonobo_generic_factory_new (TEST_SERVICE_ID, factory_fn, NULL);
if (factory == NULL) {
g_warning ("Cannot initialize test service");
exit (0);
}
}
int
main (int argc, char **argv)
{
CORBA_ORB orb;
/* Init GNOME, oaf and bonobo */
gnome_init_with_popt_table ("Test service", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error ("Could not initialize Bonobo");
}
/* Register the factory */
test_service_factory_init ();
/* Enter main */
bonobo_main ();
return 0;
}

View File

@ -1,984 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* RDF viewer Evolution Executive Summary Component.
* Bonoboised by Iain Holmes <iain@ximian.com>
* Copyright (C) 2000 Ximian, Inc.
*
* Based on code from Portaloo
* Channel retrieval tool
*
* (C) 1998 Alan Cox.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/xmlmemory.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-persist-stream.h>
#include <bonobo/bonobo-property.h>
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-property-control.h>
#include <evolution-services/executive-summary-component.h>
#include <evolution-services/executive-summary-html-view.h>
#include <liboaf/liboaf.h>
#include <libgnomevfs/gnome-vfs.h>
int xmlSubstituteEntitiesDefaultValue = 1; /* DV thinks of everything */
static int wipe_trackers = FALSE;
static int running_views = 0;
static BonoboGenericFactory *factory = NULL;
#define RDF_SUMMARY_ID "OAFIID:GNOME_Evolution_Summary_rdf_SummaryComponentFactory"
enum {
PROPERTY_TITLE,
PROPERTY_ICON
};
struct _RdfSummary {
BonoboObject *component;
BonoboObject *view;
BonoboPropertyBag *bag;
BonoboPropertyControl *property_control;
GtkWidget *rdf;
GtkWidget *g_limit;
GtkWidget *g_title;
GtkWidget *g_update;
GtkWidget *g_update_container;
GtkAdjustment *adjustment;
char *title;
char *icon;
char *location;
int limit;
gboolean showtitle;
gboolean usetimer;
int time;
int timer;
GString *str;
char *buffer;
GnomeVFSAsyncHandle *handle;
xmlDocPtr cache;
};
typedef struct _RdfSummary RdfSummary;
/************ RDF Parser *******************/
static char *
layer_find (xmlNodePtr node,
char *match,
char *fail)
{
while (node!=NULL) {
#ifdef RDF_DEBUG
xmlDebugDumpNode (stdout, node, 32);
printf("%s.\n", node->name);
#endif
if (strcasecmp (node->name, match)==0) {
if (node->childs != NULL && node->childs->content != NULL) {
return node->childs->content;
} else {
return fail;
}
}
node = node->next;
}
return fail;
}
static char *
layer_find_url (xmlNodePtr node,
char *match,
char *fail)
{
char *p = layer_find (node, match, fail);
char *r = p;
static char *wb = NULL;
char *w;
if (wb) {
free (wb);
}
wb = w = malloc (3 * strlen (p));
if (w == NULL) {
fprintf(stderr, "Out of memory\n");
exit(1);
}
if (*r == ' ') r++; /* Fix UF bug */
while (*r) {
if (memcmp (r, "&amp;", 5) == 0) {
*w++ = '&';
r += 5;
continue;
}
if (memcmp (r, "&lt;", 4) == 0) {
*w++ = '<';
r += 4;
continue;
}
if (memcmp (r, "&gt;", 4) == 0) {
*w++ = '>';
r += 4;
continue;
}
if (*r == '"' || *r == ' '){
*w++ = '%';
*w++ = "0123456789ABCDEF"[*r/16];
*w++ = "0123456789ABCDEF"[*r&15];
r++;
continue;
}
*w++ = *r++;
}
*w = 0;
return wb;
}
static void
tree_walk (xmlNodePtr root,
RdfSummary *summary,
GString *html)
{
BonoboArg *arg;
xmlNodePtr walk;
xmlNodePtr rewalk = root;
xmlNodePtr channel = NULL;
xmlNodePtr image = NULL;
xmlNodePtr item[16];
int items = 0;
int limit = summary->limit;
int i;
char *t;
char n[512];
char *tmp;
do {
walk = rewalk;
rewalk = NULL;
while (walk!=NULL){
#ifdef RDF_DEBUG
printf ("%p, %s\n", walk, walk->name);
#endif
if (strcasecmp (walk->name, "rdf") == 0) {
rewalk = walk->childs;
walk = walk->next;
continue;
}
if (strcasecmp (walk->name, "rss") == 0){
rewalk = walk->childs;
walk = walk->next;
continue;
}
/* This is the channel top level */
#ifdef RDF_DEBUG
printf ("Top level '%s'.\n", walk->name);
#endif
if (strcasecmp (walk->name, "channel") == 0) {
channel = walk;
rewalk = channel->childs;
}
if (strcasecmp (walk->name, "image") == 0) {
image = walk;
g_print ("Image\n");
}
if (strcasecmp (walk->name, "item") == 0 && items < 16) {
item[items++] = walk;
}
walk = walk->next;
}
}
while (rewalk);
if (channel == NULL) {
fprintf(stderr, "No channel definition.\n");
exit(1);
}
t = layer_find(channel->childs, "title", "No title");
arg = bonobo_arg_new (BONOBO_ARG_STRING);
if (summary->showtitle) {
BONOBO_ARG_SET_STRING (arg, t);
} else {
BONOBO_ARG_SET_STRING (arg, "");
}
bonobo_property_bag_set_value (summary->bag,
"window_title",
(const BonoboArg *) arg, NULL);
bonobo_arg_release (arg);
if (image && !wipe_trackers) {
char *icon;
icon = layer_find_url (image->childs, "url", "apple-red.png");
arg = bonobo_arg_new (BONOBO_ARG_STRING);
BONOBO_ARG_SET_STRING (arg, icon);
bonobo_property_bag_set_value (summary->bag,
"window_icon",
(const BonoboArg *) arg, NULL);
bonobo_arg_release (arg);
}
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 (wipe_trackers) {
char *p = layer_find_url (item[i]->childs, "link", "");
char *x = strchr (p, '?');
unsigned char *r, *w;
int n;
if (x == NULL)
continue;
x++;
r = x;
w = x;
while (*r) {
if (*r == '+') {
*w++ = ' ';
} else if (*r == '%') {
sscanf (r+1, "%02x", &n);
*w++ = n;
r += 2;
} else {
*w++ = *r;
}
r++;
}
*w = 0;
tmp = g_strdup_printf ("<LI><A href=\"%s\">\n", x+4);
g_string_append (html, tmp);
g_free (tmp);
}
else {
tmp = g_strdup_printf ("<LI><A href=\"%s\">\n", layer_find_url(item[i]->childs, "link", ""));
g_string_append (html, tmp);
g_free (tmp);
}
tmp = g_strdup_printf ("%s\n</A>\n", p);
g_string_append (html, tmp);
g_free (tmp);
}
g_string_append (html, "</UL></FONT>\n");
}
/********* ExecutiveSummaryComponent section **************/
static void
view_destroyed (GtkObject *object,
gpointer data)
{
RdfSummary *summary = (RdfSummary *) data;
g_warning ("RDF: Point 1");
if (summary->handle)
gnome_vfs_async_cancel (summary->handle);
g_warning ("RDF: Point 2");
if (summary->cache != NULL)
xmlFreeDoc (summary->cache);
g_free (summary->title);
g_free (summary->icon);
g_free (summary);
running_views--;
g_print ("Running_views: %d\n", running_views);
if (running_views <= 0) {
gtk_main_quit ();
}
g_warning ("RDF: Point 3");
}
/* PersistStream callbacks */
static void
load_from_stream (BonoboPersistStream *ps,
Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
gpointer data,
CORBA_Environment *ev)
{
RdfSummary *summary = (RdfSummary *) data;
char *str;
xmlChar *xml_str;
xmlDocPtr doc;
xmlNodePtr root, children;
if (*type && g_strcasecmp (type, "application/x-rdf-summary") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
bonobo_stream_client_read_string (stream, &str, ev);
if (ev->_major != CORBA_NO_EXCEPTION || str == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
doc = xmlParseDoc ((xmlChar *) str);
if (doc == NULL) {
g_warning ("Bad data: %s!", str);
g_free (str);
return;
}
g_free (str);
root = doc->root;
children = root->childs;
while (children) {
if (strcasecmp (children->name, "location") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->location = g_strdup (xml_str);
xmlFree (xml_str);
children = children->next;
continue;
}
if (strcasecmp (children->name, "limit") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->limit = atoi (xml_str);
xmlFree (xml_str);
children = children->next;
continue;
}
if (strcasecmp (children->name, "showtitle") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->showtitle = atoi (xml_str);
xmlFree (xml_str);
children = children->next;
continue;
}
if (strcasecmp (children->name, "usetimer") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->usetimer = atoi (xml_str);
xmlFree (xml_str);
children = children->next;
continue;
}
if (strcasecmp (children->name, "timer") == 0) {
xml_str = xmlNodeListGetString (doc, children->childs, 1);
summary->time = atoi (xml_str);
xmlFree (xml_str);
children = children->next;
continue;
}
g_print ("Unknown name: %s\n", children->name);
children = children->next;
}
xmlFreeDoc (doc);
}
static char *
summary_to_string (RdfSummary *summary)
{
xmlChar *out_str;
int out_len = 0;
xmlDocPtr doc;
xmlNodePtr root;
xmlNsPtr ns;
char *tmp_str;
doc = xmlNewDoc ("1.0");
ns = xmlNewGlobalNs (doc, "www.ximian.com", "rdf");
doc->root = xmlNewDocNode (doc, ns, "rdf-summary", NULL);
xmlNewChild (doc->root, ns, "location", summary->location);
tmp_str = g_strdup_printf ("%d", summary->limit);
xmlNewChild (doc->root, ns, "limit", tmp_str);
g_free (tmp_str);
tmp_str = g_strdup_printf ("%d", summary->showtitle);
xmlNewChild (doc->root, ns, "showtitle", tmp_str);
g_free (tmp_str);
tmp_str = g_strdup_printf ("%d", summary->usetimer);
xmlNewChild (doc->root, ns, "usetimer", tmp_str);
g_free (tmp_str);
tmp_str = g_strdup_printf ("%d", summary->time);
xmlNewChild (doc->root, ns, "timer", tmp_str);
g_free (tmp_str);
xmlDocDumpMemory (doc, &out_str, &out_len);
return out_str;
}
static void
save_to_stream (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
gpointer data,
CORBA_Environment *ev)
{
RdfSummary *summary = (RdfSummary *) data;
char *str;
if (*type && g_strcasecmp (type, "application/x-rdf-summary") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
str = summary_to_string (summary);
if (str)
bonobo_stream_client_printf (stream, TRUE, ev, str);
xmlFree (str);
return;
}
static Bonobo_Persist_ContentTypeList *
content_types (BonoboPersistStream *ps,
void *closure,
CORBA_Environment *ev)
{
return bonobo_persist_generate_content_types (1, "application/x-rdf-summary");
}
static void
display_doc (RdfSummary *summary)
{
GString *html;
html = g_string_new ("");
tree_walk (summary->cache->root, summary, html);
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view), html->str);
g_string_free (html, TRUE);
}
static void
close_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
RdfSummary *summary)
{
xmlDocPtr doc;
char *xml;
if (summary == NULL)
return;
summary->handle = NULL;
g_free (summary->buffer);
xml = summary->str->str;
g_string_free (summary->str, FALSE);
if (summary->cache != NULL)
xmlFreeDoc (summary->cache);
doc = xmlParseMemory (xml, strlen (xml));
if (doc == NULL) {
char *emsg;
BonoboArg *arg;
arg = bonobo_arg_new (BONOBO_ARG_STRING);
BONOBO_ARG_SET_STRING (arg, _("Error"));
bonobo_property_bag_set_value (summary->bag,
"window_title",
(const BonoboArg *) arg,
NULL);
bonobo_arg_release (arg);
emsg = g_strdup_printf ("<b>Cannot open location:<br>%s</b>",
summary->location);
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view), emsg);
g_free (emsg);
g_free (xml);
return;
}
g_free (xml);
/* Cache it for later */
summary->cache = doc;
/* Draw it */
display_doc (summary);
}
static void
read_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
gpointer buffer,
GnomeVFSFileSize bytes_requested,
GnomeVFSFileSize bytes_read,
RdfSummary *summary)
{
if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
char *emsg;
BonoboArg *arg;
arg = bonobo_arg_new (BONOBO_ARG_STRING);
BONOBO_ARG_SET_STRING (arg, _("Error"));
bonobo_property_bag_set_value (summary->bag,
"window_title",
(const BonoboArg *) arg,
NULL);
bonobo_arg_release (arg);
emsg = g_strdup_printf ("<b>Cannot open location:<br>%s</b>",
summary->location);
executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (summary->view), emsg);
g_free (emsg);
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,
(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,
(GnomeVFSAsyncReadCallback) read_callback,
summary);
}
}
static void
open_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
RdfSummary *summary)
{
GList *uri;
char *buffer;
if (result != GNOME_VFS_OK) {
char *emsg;
BonoboArg *arg;
arg = bonobo_arg_new (BONOBO_ARG_STRING);
BONOBO_ARG_SET_STRING (arg, _("Error"));
bonobo_property_bag_set_value (summary->bag,
"window_title",
(const BonoboArg *) arg,
NULL);
bonobo_arg_release (arg);
emsg = g_strdup_printf ("<b>Cannot open location:<br>%s</b>",
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,
(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;
}
static void
download_cb (GtkWidget *w,
RdfSummary *summary)
{
download (summary);
}
static void
get_prop (BonoboPropertyBag *bag,
BonoboArg *arg,
guint arg_id,
CORBA_Environment *ev,
gpointer user_data)
{
RdfSummary *summary = (RdfSummary *) user_data;
switch (arg_id) {
case PROPERTY_TITLE:
BONOBO_ARG_SET_STRING (arg, summary->title);
break;
case PROPERTY_ICON:
BONOBO_ARG_SET_STRING (arg, summary->icon);
break;
default:
break;
}
}
static void
set_prop (BonoboPropertyBag *bag,
const BonoboArg *arg,
guint arg_id,
CORBA_Environment *ev,
gpointer user_data)
{
RdfSummary *summary = (RdfSummary *) user_data;
switch (arg_id) {
case PROPERTY_TITLE:
if (summary->title)
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;
case PROPERTY_ICON:
if (summary->icon)
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;
default:
break;
}
}
static void
item_changed (GtkWidget *widget,
RdfSummary *summary)
{
if (widget == summary->g_update) {
summary->usetimer = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
gtk_widget_set_sensitive (summary->g_update_container,
summary->usetimer);
}
bonobo_property_control_changed (summary->property_control, NULL);
}
static BonoboControl *
property_control (BonoboPropertyControl *property_control,
int page_num,
gpointer user_data)
{
BonoboControl *control;
RdfSummary *summary = (RdfSummary *) user_data;
GtkWidget *container, *label, *hbox, *spinner, *button;
char *climit;
container = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (container), 2);
hbox = gtk_hbox_new (FALSE, 2);
label = gtk_label_new ("Location:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
summary->rdf = gtk_entry_new ();
if (summary->location)
gtk_entry_set_text (GTK_ENTRY (summary->rdf), summary->location);
gtk_signal_connect (GTK_OBJECT (summary->rdf), "changed",
GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->rdf, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 2);
label = gtk_label_new ("Maximum number of entries:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
summary->g_limit = gtk_entry_new ();
climit = g_strdup_printf ("%d", summary->limit);
gtk_entry_set_text (GTK_ENTRY (summary->g_limit), climit);
g_free (climit);
gtk_signal_connect (GTK_OBJECT (summary->g_limit), "changed",
GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->g_limit, TRUE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 2);
/* FIXME: Do this better? */
label = gtk_label_new ("Show window title");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
summary->g_title = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (summary->g_title),
summary->showtitle);
gtk_signal_connect (GTK_OBJECT (summary->g_title), "toggled",
GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->g_title, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 2);
/* Update */
hbox = gtk_hbox_new (FALSE, 2);
label = gtk_label_new (_("Update automatically"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
summary->g_update = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (summary->g_update),
summary->usetimer);
gtk_signal_connect (GTK_OBJECT (summary->g_update), "toggled",
GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), summary->g_update, TRUE, TRUE, 0);
button = gtk_button_new_with_label (_("Update now"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (download_cb), summary);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
/* Timer */
hbox = gtk_hbox_new (FALSE, 2);
summary->g_update_container = hbox;
label = gtk_label_new (_("Update every "));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
summary->adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (summary->time / 1000 / 60,
1.0, 1000.0, 1.0, 10.0, 1.0));
spinner = gtk_spin_button_new (summary->adjustment, 1.0, 0);
gtk_signal_connect (GTK_OBJECT (spinner), "changed",
GTK_SIGNAL_FUNC (item_changed), summary);
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
label = gtk_label_new (_("minutes"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0);
gtk_widget_set_sensitive (hbox, summary->usetimer);
gtk_widget_show_all (container);
control = bonobo_control_new (container);
return control;
}
static void
property_action (GtkObject *property_control,
int page_num,
Bonobo_PropertyControl_Action action,
RdfSummary *summary)
{
gboolean changed = FALSE;
char *old_location;
switch (action) {
case Bonobo_PropertyControl_APPLY:
old_location = summary->location;
summary->showtitle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (summary->g_title));
summary->location = g_strdup (gtk_entry_get_text (GTK_ENTRY (summary->rdf)));
if (strcmp (old_location, summary->location) != 0)
changed = TRUE;
summary->limit = atoi (gtk_entry_get_text (GTK_ENTRY (summary->g_limit)));
summary->time = summary->adjustment->value * 60 * 1000;
if (summary->timer)
gtk_timeout_remove (summary->timer);
summary->timer = gtk_timeout_add (summary->time,
(GSourceFunc)download, summary);
if (changed)
g_idle_add ((GSourceFunc) download, summary);
else
g_idle_add ((GSourceFunc) display_doc, summary);
g_free (old_location);
break;
case Bonobo_PropertyControl_HELP:
g_print ("HELP: Page %d!\n", page_num);
break;
default:
break;
}
}
static BonoboObject *
create_view (ExecutiveSummaryComponentFactory *_factory,
void *closure)
{
RdfSummary *summary;
BonoboObject *component, *view;
BonoboEventSource *event_source;
BonoboPersistStream *stream;
BonoboPropertyBag *bag;
BonoboPropertyControl *property;
summary = g_new (RdfSummary, 1);
summary->icon = g_strdup ("apple-green.png");
summary->title = g_strdup ("Downloading...");
summary->location = g_strdup ("http://news.gnome.org/gnome-news/rdf");
summary->limit = 10;
summary->showtitle = TRUE;
summary->cache = NULL;
summary->usetimer = TRUE;
summary->time = 600000; /* 10 minutes */
summary->timer = gtk_timeout_add (summary->time, (GSourceFunc) download,
summary);
component = executive_summary_component_new ();
gtk_signal_connect (GTK_OBJECT (component), "destroy",
GTK_SIGNAL_FUNC (view_destroyed), summary);
summary->component = component;
/* 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 ();
/* Summary::HtmlView */
view = executive_summary_html_view_new_full (event_source);
summary->view = view;
bonobo_object_add_interface (component, view);
/* Bonobo::PropertyBag */
bag = bonobo_property_bag_new_full (get_prop, set_prop,
event_source, summary);
summary->bag = bag;
bonobo_property_bag_add (bag,
"window_title", PROPERTY_TITLE,
BONOBO_ARG_STRING, NULL,
"The title of this component's window", 0);
bonobo_property_bag_add (bag,
"window_icon", PROPERTY_ICON,
BONOBO_ARG_STRING, NULL,
"The icon for this component's window", 0);
bonobo_object_add_interface (component, BONOBO_OBJECT(bag));
/* Bonobo::PropertyControl */
property = bonobo_property_control_new_full (property_control, 1,
event_source,
summary);
summary->property_control = property;
gtk_signal_connect (GTK_OBJECT (property), "action",
GTK_SIGNAL_FUNC (property_action), summary);
bonobo_object_add_interface (component, BONOBO_OBJECT(property));
/* Bonobo::PersistStream */
stream = bonobo_persist_stream_new (load_from_stream, save_to_stream,
NULL, content_types, summary);
bonobo_object_add_interface (component, BONOBO_OBJECT (stream));
running_views++;
gtk_idle_add ((GSourceFunc) download, summary);
return component;
}
static BonoboObject *
factory_fn (BonoboGenericFactory *_factory,
void *closure)
{
BonoboObject *component_factory;
component_factory = executive_summary_component_factory_new (create_view, NULL);
return component_factory;
}
static void
factory_init (void)
{
if (factory != NULL) {
return;
}
factory = bonobo_generic_factory_new (RDF_SUMMARY_ID, factory_fn, NULL);
if (factory == NULL) {
g_error ("Cannot initialize factory");
}
}
int
main (int argc,
char *argv[])
{
CORBA_ORB orb;
bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
textdomain (PACKAGE);
gnome_init_with_popt_table ("RDF-Summary", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
gnome_vfs_init ();
if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error ("Could not initialize Bonobo");
}
factory_init ();
bonobo_main ();
return 0;
}

View File

@ -1,5 +0,0 @@
Makefile.in
Makefile
.deps
.libs
esummary-window-test

View File

@ -1,32 +0,0 @@
INCLUDES = \
-I$(top_srcdir) \
-I$(includedir) \
$(GNOME_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"Executive-Summary-Widgets\" \
-g \
-Wall \
-Wmissing-prototypes \
-Wmissing-declarations
noinst_LIBRARIES = libesummary-widgets.a
libesummary_widgets_a_SOURCES = \
e-summary-subwindow.c \
e-summary-subwindow.h \
e-summary-titlebar.c \
e-summary-titlebar.h \
e-summary-title-button.c \
e-summary-title-button.h
noinst_PROGRAMS = \
esummary-window-test
esummary_window_test_SOURCES = \
esummary-window-test.c
esummary_window_test_LDADD = \
$(EXTRA_GNOME_LIBS) \
libesummary-widgets.a \
$(BONOBO_GNOME_LIBS) \
$(top_builddir)/e-util/libeutil.la

View File

@ -1,300 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtkframe.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-font.h>
#include <gal/e-text/e-text.h>
#include <libgnomeui/gnome-canvas.h>
#include <libgnomeui/gnome-canvas-widget.h>
#include "e-summary-subwindow.h"
#include "e-summary-titlebar.h"
#define PARENT_TYPE (gnome_canvas_group_get_type ())
#define TITLEBAR_BORDER_WIDTH 2
static void e_summary_subwindow_destroy (GtkObject *object);
static void e_summary_subwindow_class_init (GtkObjectClass *object_class);
static void e_summary_subwindow_init (GtkObject *object);
static GnomeCanvasGroupClass *parent_class;
struct _ESummarySubwindowPrivate {
GnomeCanvasItem *titlebar;
GnomeCanvasItem *contents;
GtkWidget *container;
char *title;
};
enum {
ARG_0,
ARG_X,
ARG_Y,
ARG_WIDTH,
ARG_HEIGHT,
ARG_STATE
};
enum {
CLOSE_CLICKED,
SHADE_CLICKED,
EDIT_CLICKED,
LAST_SIGNAL
};
static guint32 e_summary_subwindow_signals[LAST_SIGNAL] = { 0 };
static void
e_summary_subwindow_destroy (GtkObject *object)
{
ESummarySubwindow *subwindow = E_SUMMARY_SUBWINDOW (object);
ESummarySubwindowPrivate *priv;
priv = subwindow->private;
if (priv == NULL)
return;
if (priv->container) {
gtk_widget_destroy (priv->container);
priv->container = NULL;
}
if (priv->title) {
g_free (priv->title);
priv->title = NULL;
}
g_free (subwindow->private);
subwindow->private = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
e_summary_subwindow_realize (GnomeCanvasItem *item)
{
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) (item);
}
static void
e_summary_subwindow_unrealize (GnomeCanvasItem *item)
{
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
}
static void
e_summary_subwindow_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class;
item_class = (GnomeCanvasItemClass *) object_class;
object_class->destroy = e_summary_subwindow_destroy;
item_class->realize = e_summary_subwindow_realize;
item_class->unrealize = e_summary_subwindow_unrealize;
parent_class = gtk_type_class (PARENT_TYPE);
}
static void
e_summary_subwindow_init (GtkObject *object)
{
ESummarySubwindow *subwindow = E_SUMMARY_SUBWINDOW (object);
ESummarySubwindowPrivate *priv;
subwindow->private = g_new0 (ESummarySubwindowPrivate, 1);
priv = subwindow->private;
priv->title = NULL;
}
E_MAKE_TYPE (e_summary_subwindow, "ESummarySubwindow", ESummarySubwindow,
e_summary_subwindow_class_init, e_summary_subwindow_init,
PARENT_TYPE);
static void
container_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
ESummarySubwindow *subwindow)
{
ESummarySubwindowPrivate *priv;
g_return_if_fail (subwindow != NULL);
g_return_if_fail (IS_E_SUMMARY_SUBWINDOW (subwindow));
priv = subwindow->private;
gnome_canvas_item_set (priv->titlebar,
"width", (double) allocation->width - 1,
NULL);
}
static void
edit_cb (GnomeCanvasItem *item,
ESummarySubwindow *subwindow)
{
g_print ("EDIT!\n");
}
static void
shade_cb (GnomeCanvasItem *item,
ESummarySubwindow *subwindow)
{
g_print ("SHADE!\n");
}
static void
close_cb (GnomeCanvasItem *item,
ESummarySubwindow *subwindow)
{
g_print ("CLOSE!\n");
gtk_object_destroy (GTK_OBJECT (subwindow));
}
void
e_summary_subwindow_construct (GnomeCanvasItem *item)
{
GnomeCanvasGroup *group;
ESummarySubwindow *subwindow;
ESummarySubwindowPrivate *priv;
EFont *font;
int titlebar_height;
g_return_if_fail (item != NULL);
g_return_if_fail (IS_E_SUMMARY_SUBWINDOW (item));
subwindow = E_SUMMARY_SUBWINDOW (item);
priv = subwindow->private;
group = GNOME_CANVAS_GROUP (item);
font = e_font_from_gdk_font ( ((GtkWidget *) item->canvas)->style->font);
titlebar_height = 18 + 2 * TITLEBAR_BORDER_WIDTH; /* FIXME: Not hardcoded */
priv->titlebar = gnome_canvas_item_new (group,
e_summary_titlebar_get_type (),
"text", "Titlebar",
"width", 100.0,
NULL);
gtk_signal_connect (GTK_OBJECT (priv->titlebar), "edit",
GTK_SIGNAL_FUNC (edit_cb), subwindow);
gtk_signal_connect (GTK_OBJECT (priv->titlebar), "shade",
GTK_SIGNAL_FUNC (shade_cb), subwindow);
gtk_signal_connect (GTK_OBJECT (priv->titlebar), "close",
GTK_SIGNAL_FUNC (close_cb), subwindow);
priv->container = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (priv->container), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (priv->container);
priv->contents = gnome_canvas_item_new (group,
gnome_canvas_widget_get_type (),
"x", (double) 0,
"y", (double) titlebar_height + 1,
"widget", priv->container,
NULL);
gtk_signal_connect (GTK_OBJECT (priv->container), "size_allocate",
GTK_SIGNAL_FUNC (container_size_allocate), subwindow);
}
GnomeCanvasItem *
e_summary_subwindow_new (GnomeCanvasGroup *parent,
double x,
double y)
{
GnomeCanvasItem *item;
item = gnome_canvas_item_new (parent, e_summary_subwindow_get_type (),
"x", x,
"y", y,
NULL);
e_summary_subwindow_construct (item);
return item;
}
/* These functions mimic the GtkContainer methods */
void
e_summary_subwindow_add (ESummarySubwindow *subwindow,
GtkWidget *widget)
{
ESummarySubwindowPrivate *priv;
g_return_if_fail (subwindow != NULL);
g_return_if_fail (IS_E_SUMMARY_SUBWINDOW (subwindow));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
priv = subwindow->private;
gtk_container_add (GTK_CONTAINER (priv->container), widget);
}
void
e_summary_subwindow_remove (ESummarySubwindow *subwindow,
GtkWidget *widget)
{
ESummarySubwindowPrivate *priv;
g_return_if_fail (subwindow != NULL);
g_return_if_fail (IS_E_SUMMARY_SUBWINDOW (subwindow));
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
priv = subwindow->private;
gtk_container_remove (GTK_CONTAINER (priv->container), widget);
}
void
e_summary_subwindow_set_title (ESummarySubwindow *subwindow,
const char *title)
{
ESummarySubwindowPrivate *priv;
g_return_if_fail (subwindow != NULL);
g_return_if_fail (IS_E_SUMMARY_SUBWINDOW (subwindow));
g_return_if_fail (title != NULL);
priv = subwindow->private;
if (priv->title)
g_free (priv->title);
priv->title = g_strdup (title);
}

View File

@ -1,67 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-subwindow.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_SUBWINDOW_H__
#define _E_SUMMARY_SUBWINDIW_H__
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-canvas.h>
#define E_SUMMARY_SUBWINDOW_TYPE (e_summary_subwindow_get_type ())
#define E_SUMMARY_SUBWINDOW(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_SUBWINDOW_TYPE, ESummarySubwindow))
#define E_SUMMARY_SUBWINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_SUBWINDOW_TYPE, ESummarySubwindowClass))
#define IS_E_SUMMARY_SUBWINDOW(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_SUBWINDOW_TYPE))
#define IS_E_SUMMARY_SUBWINDOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SUMMARY_SUBWINDOW_TYPE))
typedef struct _ESummarySubwindowPrivate ESummarySubwindowPrivate;
typedef struct _ESummarySubwindow ESummarySubwindow;
typedef struct _ESummarySubwindowClass ESummarySubwindowClass;
struct _ESummarySubwindow {
GnomeCanvasGroup parent;
ESummarySubwindowPrivate *private;
};
struct _ESummarySubwindowClass {
GnomeCanvasGroupClass parent_class;
void (*close_clicked) (ESummarySubwindow *window);
void (*shade_clicked) (ESummarySubwindow *window);
void (*edit_clicked) (ESummarySubwindow *window);
};
GtkType e_summary_subwindow_get_type (void);
void e_summary_subwindow_construct (GnomeCanvasItem *subwindow);
GnomeCanvasItem *e_summary_subwindow_new (GnomeCanvasGroup *parent,
double x,
double y);
void e_summary_subwindow_add (ESummarySubwindow *subwindow,
GtkWidget *widget);
void e_summary_subwindow_remove (ESummarySubwindow *subwindow,
GtkWidget *widget);
void e_summary_subwindow_set_title (ESummarySubwindow *subwindow,
const char *title);
#endif

View File

@ -1,402 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-title-buttons.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <gal/util/e-util.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "e-summary-title-button.h"
#define PARENT_TYPE (gnome_canvas_rect_get_type ())
enum {
ARG_0,
ARG_PIXBUF,
ARG_X,
ARG_Y
};
enum {
CLICKED,
LAST_SIGNAL
};
static void e_summary_title_button_destroy (GtkObject *object);
static void e_summary_title_button_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void e_summary_title_button_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void e_summary_title_button_class_init (ESummaryTitleButtonClass *estb_class);
static void e_summary_title_button_init (ESummaryTitleButton *estb);
static double e_summary_title_button_point (GnomeCanvasItem *item,
double x,
double y,
int cx,
int cy,
GnomeCanvasItem **actual_item);
static void e_summary_title_button_update (GnomeCanvasItem *item,
double affine[6],
ArtSVP *clip_path,
gint flags);
static void e_summary_title_button_draw (GnomeCanvasItem *item,
GdkDrawable *drawable,
int x, int y,
int width, int height);
static gint e_summary_title_button_event (GnomeCanvasItem *item,
GdkEvent *event);
static GnomeCanvasRectClass *parent_class;
static guint estb_signals[LAST_SIGNAL] = { 0 };
struct _ESummaryTitleButtonPrivate {
GdkPixbuf *pixbuf;
double x, y;
int width, height;
int in_button : 1;
int button_down : 1;
};
static void
e_summary_title_button_destroy (GtkObject *object)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
estb = E_SUMMARY_TITLE_BUTTON (object);
priv = estb->private;
if (priv == NULL)
return;
gdk_pixbuf_unref (priv->pixbuf);
g_free (priv);
estb->private = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
e_summary_title_button_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
gboolean update = FALSE;
estb = E_SUMMARY_TITLE_BUTTON (object);
priv = estb->private;
switch (arg_id) {
case ARG_PIXBUF:
if (priv->pixbuf)
gdk_pixbuf_unref (priv->pixbuf);
priv->pixbuf = GTK_VALUE_POINTER (*arg);
gdk_pixbuf_ref (priv->pixbuf);
priv->width = gdk_pixbuf_get_width (priv->pixbuf);
priv->height = gdk_pixbuf_get_height (priv->pixbuf);
update = TRUE;
break;
case ARG_X:
priv->x = GTK_VALUE_DOUBLE (*arg);
break;
case ARG_Y:
priv->y = GTK_VALUE_DOUBLE (*arg);
break;
default:
break;
}
if (update)
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (estb));
}
static void
e_summary_title_button_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
estb = E_SUMMARY_TITLE_BUTTON (object);
priv = estb->private;
switch (arg_id) {
case ARG_PIXBUF:
GTK_VALUE_POINTER (*arg) = priv->pixbuf;
break;
case ARG_X:
GTK_VALUE_DOUBLE (*arg) = priv->x;
break;
case ARG_Y:
GTK_VALUE_DOUBLE (*arg) = priv->y;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
static void
e_summary_title_button_init (ESummaryTitleButton *estb)
{
estb->private = g_new0 (ESummaryTitleButtonPrivate, 1);
}
static void
e_summary_title_button_class_init (ESummaryTitleButtonClass *estb_class)
{
GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
object_class = (GtkObjectClass *) estb_class;
item_class = (GnomeCanvasItemClass *) estb_class;
object_class->destroy = e_summary_title_button_destroy;
object_class->set_arg = e_summary_title_button_set_arg;
object_class->get_arg = e_summary_title_button_get_arg;
item_class->draw = e_summary_title_button_draw;
item_class->point = e_summary_title_button_point;
item_class->update = e_summary_title_button_update;
item_class->event = e_summary_title_button_event;
gtk_object_add_arg_type ("ESummaryTitleButton::pixbuf",
GTK_TYPE_POINTER,
GTK_ARG_READWRITE,
ARG_PIXBUF);
gtk_object_add_arg_type ("ESummaryTitleButton::x",
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_X);
gtk_object_add_arg_type ("ESummaryTitleButton::y",
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_Y);
estb_signals[CLICKED] = gtk_signal_new ("clicked", GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ESummaryTitleButtonClass,
clicked),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, estb_signals, LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
}
E_MAKE_TYPE (e_summary_title_button, "ESummaryTitleButton",
ESummaryTitleButton, e_summary_title_button_class_init,
e_summary_title_button_init, PARENT_TYPE);
static double
e_summary_title_button_point (GnomeCanvasItem *item,
double x,
double y,
int cx,
int cy,
GnomeCanvasItem **actual_item)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
double d = 1.0;
estb = E_SUMMARY_TITLE_BUTTON (item);
priv = estb->private;
if (x >= priv->x && x <= priv->x + gdk_pixbuf_get_width (priv->pixbuf)
&& y >= priv->y && y <= priv->y + gdk_pixbuf_get_height (priv->pixbuf)) {
d = 0.0;
*actual_item = item;
}
return d;
}
static void
get_bounds (ESummaryTitleButton *estb,
double *px1, double *py1,
double *px2, double *py2)
{
GnomeCanvasItem *item;
ESummaryTitleButtonPrivate *priv;
double x1, y1, x2, y2;
int cx1, cy1, cx2, cy2;
item = GNOME_CANVAS_ITEM (estb);
priv = estb->private;
x1 = priv->x;
y1 = priv->y;
x2 = x1 + priv->width;
y2 = y1 + priv->height;
gnome_canvas_item_i2w (item, &x1, &y1);
gnome_canvas_item_i2w (item, &x2, &x2);
gnome_canvas_w2c (item->canvas, x1, y1, &cx1, &cy1);
gnome_canvas_w2c (item->canvas, x2, y2, &cx2, &cy2);
*px1 = cx1;
*py1 = cy1;
*px2 = cx2;
*py2 = cy2;
}
static void
e_summary_title_button_update (GnomeCanvasItem *item,
double affine[6],
ArtSVP *clip_path,
gint flags)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
double x1, y1, x2, y2;
estb = E_SUMMARY_TITLE_BUTTON (item);
priv = estb->private;
get_bounds (estb, &x1, &y1, &x2, &y2);
gnome_canvas_update_bbox (item, (int) x1, (int) y1, (int) x2, (int) y2);
}
static void
e_summary_title_button_draw (GnomeCanvasItem *item,
GdkDrawable *drawable,
int x, int y,
int width, int height)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
double i2w[6], w2c[6], i2c[6];
int x1, x2, y1, y2;
ArtPoint i1, i2;
ArtPoint c1, c2;
GdkGC *gc;
estb = E_SUMMARY_TITLE_BUTTON (item);
priv = estb->private;
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->draw)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->draw) (item, drawable, x, y, width, height);
gnome_canvas_item_i2w_affine (item, i2w);
gnome_canvas_w2c_affine (item->canvas, w2c);
art_affine_multiply (i2c, i2w, w2c);
i1.x = priv->x;
i1.y = priv->y;
i2.x = i1.x + priv->width + 4;
i2.y = i1.y + priv->height + 4;
art_affine_point (&c1, &i1, i2c);
art_affine_point (&c2, &i2, i2c);
x1 = c1.x;
y1 = c1.y;
x2 = c2.x;
y2 = c2.y;
gc = gdk_gc_new (item->canvas->layout.bin_window);
gdk_draw_rectangle (drawable, gc,
FALSE, x1 - x,
y1 - y,
x2 - x1,
y2 - y1);
gdk_gc_unref (gc);
gdk_pixbuf_render_to_drawable_alpha (priv->pixbuf,
drawable,
0, 0,
x1 + 2, y1 + 2,
priv->width, priv->height,
GDK_PIXBUF_ALPHA_BILEVEL,
127,
GDK_RGB_DITHER_NORMAL,
0, 0);
}
static gint
e_summary_title_button_event (GnomeCanvasItem *item,
GdkEvent *event)
{
ESummaryTitleButton *estb;
ESummaryTitleButtonPrivate *priv;
estb = E_SUMMARY_TITLE_BUTTON (item);
priv = estb->private;
switch (event->type) {
case GDK_ENTER_NOTIFY:
priv->in_button = TRUE;
break;
case GDK_LEAVE_NOTIFY:
priv->in_button = FALSE;
break;
case GDK_BUTTON_PRESS:
if (priv->in_button) {
priv->button_down = TRUE;
gnome_canvas_item_grab (item,
GDK_LEAVE_NOTIFY_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, event->button.time);
}
break;
case GDK_BUTTON_RELEASE:
priv->button_down = FALSE;
gnome_canvas_item_ungrab (item, event->button.time);
if (priv->in_button) {
gtk_signal_emit (GTK_OBJECT (estb), estb_signals[CLICKED]);
}
break;
default:
return TRUE;
}
return FALSE;
}

View File

@ -1,54 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-title-button.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_TITLE_BUTTON_H__
#define _E_SUMMARY_TITLE_BUTTON_H__
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-canvas.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#define E_SUMMARY_TITLE_BUTTON_TYPE (e_summary_title_button_get_type ())
#define E_SUMMARY_TITLE_BUTTON(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TITLE_BUTTON_TYPE, ESummaryTitleButton))
#define E_SUMMARY_TITLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TITLE_BUTTON_TYPE, ESummaryTitleButtonClass))
#define IS_E_SUMMARY_TITLE_BUTTON(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_TITLE_BUTTON_TYPE))
#define IS_E_SUMMARY_TITLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SUMMARY_TITLE_BUTTON_TYPE))
typedef struct _ESummaryTitleButtonPrivate ESummaryTitleButtonPrivate;
typedef struct _ESummaryTitleButton ESummaryTitleButton;
typedef struct _ESummaryTitleButtonClass ESummaryTitleButtonClass;
struct _ESummaryTitleButton {
GnomeCanvasRect parent;
ESummaryTitleButtonPrivate *private;
};
struct _ESummaryTitleButtonClass {
GnomeCanvasRectClass parent_class;
void (*clicked) (ESummaryTitleButton *estb);
};
GtkType e_summary_title_button_get_type (void);
#endif

View File

@ -1,411 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-titlebar.c
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/util/e-util.h>
#include <gal/widgets/e-font.h>
#include <gal/e-text/e-text.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "e-summary-titlebar.h"
#include "e-summary-title-button.h"
/* XPMS */
#include "edit.xpm"
#include "x.xpm"
#include "shade.xpm"
#define PARENT_TYPE (gnome_canvas_group_get_type ())
#define TITLEBAR_BORDER_WIDTH 2
enum {
ARG_0,
ARG_TEXT,
ARG_WIDTH,
ARG_HEIGHT
};
enum {
EDIT,
SHADE,
CLOSE,
LAST_SIGNAL
};
static void e_summary_titlebar_destroy (GtkObject *object);
static void e_summary_titlebar_class_init (GtkObjectClass *object_class);
static void e_summary_titlebar_init (GtkObject *object);
static GnomeCanvasGroupClass *parent_class;
static guint titlebar_signals[LAST_SIGNAL] = { 0 };
struct _ESummaryTitlebarPrivate {
GnomeCanvasItem *rect;
GnomeCanvasItem *titletext;
GnomeCanvasItem *edit;
GnomeCanvasItem *shade;
GnomeCanvasItem *close;
char *text;
double width, height;
};
static void
e_summary_titlebar_destroy (GtkObject *object)
{
ESummaryTitlebar *titlebar;
ESummaryTitlebarPrivate *priv;
titlebar = E_SUMMARY_TITLEBAR (object);
priv = titlebar->private;
if (priv == NULL)
return;
g_free (priv);
titlebar->private = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
edit_cb (GnomeCanvasItem *item,
ESummaryTitlebar *titlebar)
{
gtk_signal_emit (GTK_OBJECT (titlebar), titlebar_signals[EDIT]);
}
static void
shade_cb (GnomeCanvasItem *item,
ESummaryTitlebar *titlebar)
{
gtk_signal_emit (GTK_OBJECT (titlebar), titlebar_signals[SHADE]);
}
static void
close_cb (GnomeCanvasItem *item,
ESummaryTitlebar *titlebar)
{
gtk_signal_emit (GTK_OBJECT (titlebar), titlebar_signals[CLOSE]);
}
static void
e_summary_titlebar_realize (GnomeCanvasItem *item)
{
GnomeCanvasGroup *group;
ESummaryTitlebar *titlebar;
ESummaryTitlebarPrivate *priv;
GdkPixbuf *pb;
EFont *font;
int font_height;
group = GNOME_CANVAS_GROUP (item);
titlebar = E_SUMMARY_TITLEBAR (item);
priv = titlebar->private;
font = e_font_from_gdk_font (GTK_WIDGET (item->canvas)->style->font);
font_height = e_font_height (font);
priv->height = 18 + 2 * TITLEBAR_BORDER_WIDTH; /* FIXME: Not hardcoded */
priv->rect = gnome_canvas_item_new (group,
gnome_canvas_rect_get_type (),
"x1", 0.0,
"y1", 0.0,
"y2", (double) priv->height,
"x2", priv->width,
"fill_color_rgba", 0x88AAFFFF,
NULL);
pb = gdk_pixbuf_new_from_xpm_data ((const char**) x_xpm);
priv->close = gnome_canvas_item_new (group,
e_summary_title_button_get_type (),
"x", (double) priv->width - TITLEBAR_BORDER_WIDTH - 18,
"y", (double) TITLEBAR_BORDER_WIDTH,
"pixbuf", pb,
NULL);
gdk_pixbuf_unref (pb);
gtk_signal_connect (GTK_OBJECT (priv->close), "clicked",
GTK_SIGNAL_FUNC (close_cb), titlebar);
pb = gdk_pixbuf_new_from_xpm_data ((const char**) shade_xpm);
priv->shade = gnome_canvas_item_new (group,
e_summary_title_button_get_type (),
"x", (double) priv->width - (TITLEBAR_BORDER_WIDTH * 2) - 36,
"y", (double) TITLEBAR_BORDER_WIDTH,
"pixbuf", pb,
NULL);
gdk_pixbuf_unref (pb);
gtk_signal_connect (GTK_OBJECT (priv->shade), "clicked",
GTK_SIGNAL_FUNC (shade_cb), titlebar);
pb = gdk_pixbuf_new_from_xpm_data ((const char**) edit_xpm);
priv->edit = gnome_canvas_item_new (group,
e_summary_title_button_get_type (),
"x", (double) priv->width - (TITLEBAR_BORDER_WIDTH * 3) - 54,
"y", (double) TITLEBAR_BORDER_WIDTH,
"pixbuf", pb,
NULL);
gdk_pixbuf_unref (pb);
gtk_signal_connect (GTK_OBJECT (priv->edit), "clicked",
GTK_SIGNAL_FUNC (edit_cb), titlebar);
priv->titletext = gnome_canvas_item_new (group,
e_text_get_type (),
"text", priv->text,
"font_gdk", GTK_WIDGET (item->canvas)->style->font,
"clip_width", (double) priv->width -
(TITLEBAR_BORDER_WIDTH*4)- 50,
"clip_height", (double) e_font_height (font),
"clip", TRUE,
"use_ellipsis", TRUE,
"fill_color", "black",
"anchor", GTK_ANCHOR_NW,
"draw_background", FALSE,
NULL);
gnome_canvas_item_move (priv->titletext, TITLEBAR_BORDER_WIDTH,
(priv->height - font_height) / 2);
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) (item);
}
static void
e_summary_titlebar_unrealize (GnomeCanvasItem *item)
{
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
}
static void
e_summary_titlebar_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
ESummaryTitlebar *titlebar;
ESummaryTitlebarPrivate *priv;
titlebar = E_SUMMARY_TITLEBAR (object);
priv = titlebar->private;
switch (arg_id) {
case ARG_TEXT:
if (priv->text)
g_free (priv->text);
priv->text = g_strdup (GTK_VALUE_STRING (*arg));
if (priv->titletext)
gnome_canvas_item_set (priv->titletext,
"text", priv->text,
NULL);
break;
case ARG_WIDTH:
priv->width = GTK_VALUE_DOUBLE (*arg);
if (priv->rect)
gnome_canvas_item_set (priv->rect,
"x2", priv->width,
NULL);
if (priv->titletext)
gnome_canvas_item_set (priv->titletext,
"clip_width", priv->width -
(TITLEBAR_BORDER_WIDTH* 4) - 42,
NULL);
break;
default:
break;
}
}
static void
e_summary_titlebar_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
ESummaryTitlebar *titlebar;
ESummaryTitlebarPrivate *priv;
titlebar = E_SUMMARY_TITLEBAR (object);
priv = titlebar->private;
switch (arg_id) {
case ARG_TEXT:
GTK_VALUE_STRING (*arg) = priv->text;
break;
case ARG_WIDTH:
GTK_VALUE_DOUBLE (*arg) = priv->width;
break;
case ARG_HEIGHT:
GTK_VALUE_DOUBLE (*arg) = priv->height;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
static gint
e_summary_titlebar_event (GnomeCanvasItem *item,
GdkEvent *event)
{
if (event->type == GDK_2BUTTON_PRESS &&
event->button.button == 1) {
gtk_signal_emit (GTK_OBJECT (item), titlebar_signals[SHADE]);
return FALSE;
} else {
return TRUE;
}
}
static double
e_summary_titlebar_point (GnomeCanvasItem *item,
double x,
double y,
int cx,
int cy,
GnomeCanvasItem **actual_item)
{
ESummaryTitlebar *est;
ESummaryTitlebarPrivate *priv;
GnomeCanvasItem *ret_item;
double d;
est = E_SUMMARY_TITLEBAR (item);
priv = est->private;
d = (* GNOME_CANVAS_ITEM_CLASS
(GTK_OBJECT (priv->edit)->klass)->point) (priv->edit,
x, y,
cx, cy,
&ret_item);
if (d == 0.0) {
*actual_item = ret_item;
return 0.0;
}
d = (* GNOME_CANVAS_ITEM_CLASS
(GTK_OBJECT (priv->shade)->klass)->point) (priv->shade,
x, y,
cx, cy,
&ret_item);
if (d == 0.0) {
*actual_item = ret_item;
return 0.0;
}
d = (* GNOME_CANVAS_ITEM_CLASS
(GTK_OBJECT (priv->close)->klass)->point) (priv->close,
x, y,
cx, cy,
&ret_item);
if (d == 0.0) {
*actual_item = ret_item;
return 0.0;
}
*actual_item = item;
return 0.0;
}
static void
e_summary_titlebar_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class;
item_class = (GnomeCanvasItemClass *) object_class;
object_class->destroy = e_summary_titlebar_destroy;
object_class->set_arg = e_summary_titlebar_set_arg;
object_class->get_arg = e_summary_titlebar_get_arg;
item_class->realize = e_summary_titlebar_realize;
item_class->unrealize = e_summary_titlebar_unrealize;
item_class->event = e_summary_titlebar_event;
item_class->point = e_summary_titlebar_point;
gtk_object_add_arg_type ("ESummaryTitlebar::text",
GTK_TYPE_STRING, GTK_ARG_READWRITE,
ARG_TEXT);
gtk_object_add_arg_type ("ESummaryTitlebar::width",
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
ARG_WIDTH);
gtk_object_add_arg_type ("ESummaryTitlebar::height",
GTK_TYPE_DOUBLE, GTK_ARG_READABLE,
ARG_HEIGHT);
titlebar_signals[EDIT] = gtk_signal_new ("edit", GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ESummaryTitlebarClass,
edit),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
titlebar_signals[SHADE] = gtk_signal_new ("shade", GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ESummaryTitlebarClass,
shade),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
titlebar_signals[CLOSE] = gtk_signal_new ("close", GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ESummaryTitlebarClass,
close),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, titlebar_signals,
LAST_SIGNAL);
parent_class = gtk_type_class (PARENT_TYPE);
}
static void
e_summary_titlebar_init (GtkObject *object)
{
ESummaryTitlebar *titlebar;
ESummaryTitlebarPrivate *priv;
titlebar = E_SUMMARY_TITLEBAR (object);
titlebar->private = g_new0 (ESummaryTitlebarPrivate, 1);
priv = titlebar->private;
priv->width = 100.0;
priv->text = NULL;
gdk_rgb_init ();
}
E_MAKE_TYPE (e_summary_titlebar, "ESummaryTitlebar", ESummaryTitlebar,
e_summary_titlebar_class_init, e_summary_titlebar_init,
PARENT_TYPE);

View File

@ -1,55 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-titlebar.h
*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright (C) 2000 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _E_SUMMARY_TITLEBAR_H__
#define _E_SUMMARY_TITLEBAR_H__
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-canvas.h>
#define E_SUMMARY_TITLEBAR_TYPE (e_summary_titlebar_get_type ())
#define E_SUMMARY_TITLEBAR(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TITLEBAR_TYPE, ESummaryTitlebar))
#define E_SUMMARY_TITLEBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TITLEBAR_TYPE, ESummaryTitlebarClass))
#define IS_E_SUMMARY_TITLEBAR(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_TITLEBAR_TYPE))
#define IS_E_SUMMARY_TITLEBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SUMMARY_TITLEBAR_TYPE))
typedef struct _ESummaryTitlebarPrivate ESummaryTitlebarPrivate;
typedef struct _ESummaryTitlebar ESummaryTitlebar;
typedef struct _ESummaryTitlebarClass ESummaryTitlebarClass;
struct _ESummaryTitlebar {
GnomeCanvasGroup parent;
ESummaryTitlebarPrivate *private;
};
struct _ESummaryTitlebarClass {
GnomeCanvasGroupClass parent_class;
void (*close) (ESummaryTitlebar *window);
void (*shade) (ESummaryTitlebar *window);
void (*edit) (ESummaryTitlebar *window);
};
GtkType e_summary_titlebar_get_type (void);
#endif

View File

@ -1,19 +0,0 @@
/* XPM */
static char * edit_xpm[] = {
"14 14 2 1",
" g None",
". g #000000",
" ",
" ",
" ... ",
" . . ",
" . . ",
" . ",
" . ",
" .. ",
" .. ",
" .. ",
" ",
" .. ",
" .. ",
" "};

View File

@ -1,45 +0,0 @@
#include <gal/widgets/e-canvas.h>
#include "e-summary-subwindow.h"
#include "e-summary-titlebar.h"
void close_test (GtkWidget *widget, gpointer data);
void
close_test (GtkWidget *widget,
gpointer data)
{
gtk_main_quit ();
}
int
main (int argc,
char **argv)
{
GtkWidget *window, *canvas;
ESummarySubwindow *subwindow;
GtkWidget *control;
gnome_init ("Executive Summary Subwindow Test", "1.0", argc, argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (close_test), NULL);
canvas = e_canvas_new ();
subwindow = e_summary_subwindow_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (canvas)->root), 100, 100);
control = gtk_button_new_with_label ("A big button");
gtk_widget_set_usize (control, 400, 200);
e_summary_subwindow_add (subwindow, control);
gtk_widget_show (control);
gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 1000.0, 1300.0);
gtk_container_add (GTK_CONTAINER (window), canvas);
gtk_widget_show_all (window);
gtk_main ();
exit(0);
}

View File

@ -1,19 +0,0 @@
/* XPM */
static char * shade_xpm[] = {
"14 14 2 1",
" g None",
". g #000000",
" ",
" ............ ",
" ............ ",
" ............ ",
" ............ ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" ............ ",
" "};

View File

@ -1,19 +0,0 @@
/* XPM */
static char * x_xpm[] = {
"14 14 2 1",
" g None",
". g #000000",
" ",
" .. .. ",
" ... ... ",
" ... ... ",
" ... ... ",
" ...... ",
" .... ",
" .... ",
" ...... ",
" ... ... ",
" ... ... ",
" ... ... ",
" .. .. ",
" "};

View File

@ -1,13 +0,0 @@
.deps
.libs
.pure
Makefile
Makefile.in
Mailer-stubs.c
Mailer-skels.c
Mailer-common.c
Mailer.h
evolution-executive-summary
evolution-executive-summary.pure
GNOME_Evolution_Summary.server
GNOME_Evolution_Summary.server.in

View File

@ -1,85 +0,0 @@
2003-10-09 Jeffrey Stedfast <fejj@ximian.com>
* Makefile.am: INCLUDE path fixes for changes made to libical
build.
* e-summary-calendar.h: #include <libical/ical.h>
* e-summary.h: #include <libical/ical.h>
2003-09-08 Calvin Liu <calvin.liu@sun.com>
** For bug #48175
* e-summary-tasks.c: set default value for colour if it's empty
2003-08-26 Rodrigo Moya <rodrigo@ximian.com>
* e-summary-tasks.c:
* e-summary-calendar.c (uids_to_array): use correct type for arguments
to cal_client_get_object.
2003-08-19 Harry Lu <harry.lu@sun.com>
** For bug #47461.
* e-summary-calendar.c: (generate_html): Change "%P" to "%p" so that
strftime() can work under solaris.
2003-08-12 Jack Jia <jack.jia@sun.com>
[Fixed bug #47563]
* e-summary-tasks.c (setup_task_folder) : set a default value for
the tasks->due_today_colour and tasks->overdue_colour, if the key
in gconf is NULL. and change the key name from TasksDueTodayi to
due_today, from TasksOverdue to overdue, in order to coincide with
the key in e-summary-tasks.c (setup_task_folder).In this way, it
can avoid crash on solaris.
2003-08-11 Ettore Perazzoli <ettore@ximian.com>
Patch from Lorenzo Gil Sanchez <lgs@sicem.biz>
* Locations: Added Bermuda to the list of countries under the
'Central and South America' region. [#21879]
2003-07-23 Dan Winship <danw@ximian.com>
* e-summary-factory.c (e_summary_factory_new_control): Fix a
warning.
* e-summary-rdf.c (tree_walk): Fix a warning
* e-summary-weather.c (e_summary_weather_get_html): Remove an
unused variable.
(weather_make_html): Likewise.
2003-06-23 Dan Winship <danw@ximian.com>
* e-summary-calendar.c (setup_gconf_client): Don't call
setup_calendar from here, since e_summary_calendar_init will call
it immediately after setup_gconf_client, which will result in a
calendar being quickly created and destroyed.
2003-06-19 Ettore Perazzoli <ettore@ximian.com>
* e-summary.c (do_summary_print): Do not destroy preview_widget
when returning from gtk_dialog_run() since it's unset at that
point. [#44798]
2003-06-13 Larry Ewing <lewing@ximian.com>
* e-summary.c (e_summary_url_requested): free the filename.
2003-06-05 Not Zed <NotZed@Ximian.com>
** For #42691.
* Makefile.am (%.server.in): use implicit rule.
(BUILT_SOURCES): added server_DATA
2003-06-09 Ettore Perazzoli <ettore@ximian.com>
* e-summary-mail.c (e_summary_mail_get_info): Protect against
folder_store being NULL. [#44111]

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +0,0 @@
<oaf_info>
<oaf_server iid="OAFIID:GNOME_Evolution_Summary_ComponentFactory"
type="shlib"
location="@COMPONENTDIR@/libevolution-executive-summary.so">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string"
_value="Evolution Summary"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Summary_ShellComponent"
type="factory"
location="OAFIID:GNOME_Evolution_Summary_ComponentFactory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Evolution/ShellComponent:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string"
_value="Evolution Summary component"/>
<oaf_attribute name="evolution:shell_component_icon" type="string"
value="evolution-today.png"/>
<oaf_attribute name="evolution:shell_component_launch_order" type="number"
value="4"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Summary_ConfigControl"
type="factory"
location="OAFIID:GNOME_Evolution_Summary_ComponentFactory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
</oaf_attribute>
<oaf_attribute name="evolution:config_item:title" type="string"
_value="Summary Preferences"/>
<oaf_attribute name="evolution:config_item:description" type="string"
_value="Configure the appearance of the Evolution Summary here"/>
<oaf_attribute name="evolution:config_item:icon_name" type="string"
value="evolution-today.png"/>
<oaf_attribute name="evolution:config_item:type" type="stringv">
<item value="summary"/>
</oaf_attribute>
<oaf_attribute name="evolution:config_item:priority" type="string" value="-5"/>
<oaf_attribute name="name" type="string"
_value="Evolution Summary configuration control"/>
</oaf_server>
</oaf_info>

View File

@ -1,8 +0,0 @@
#!/bin/bash
grep name Locations | cut -b 6- > Locations.h
grep loc Locations | sed "s/ .... ...... ...$//"| sed "s/ .... :...... ...$//" | cut -d = -f 2 | sed "s/\\\\//g" >> Locations.h
sed -e "s/^/N_(\"/" -e "s/$/\")/" Locations.h > Locations.h.tmp
sort Locations.h.tmp | uniq > Locations.h
rm Locations.h.tmp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +0,0 @@
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
-I$(top_srcdir)/calendar \
-I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/libical/src \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
-DLOCATIONDIR=\""$(Locationdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DG_LOG_DOMAIN=\"evolution-executive-summary\" \
$(EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS)
IDLS = \
$(top_srcdir)/mail/Mailer.idl
IDL_GENERATED_H = \
Mailer.h
IDL_GENERATED_C = \
Mailer-common.c \
Mailer-skels.c \
Mailer-stubs.c
IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H)
$(IDL_GENERATED_H): $(IDLS)
$(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(top_srcdir)/mail/Mailer.idl
$(IDL_GENERATED_C): $(IDL_GENERATED_H)
summary_sources = \
$(IDL_GENERATED) \
component-factory.c \
component-factory.h \
e-cell-tri.c \
e-cell-tri.h \
e-summary.c \
e-summary.h \
e-summary-calendar.c \
e-summary-calendar.h \
e-summary-factory.c \
e-summary-factory.h \
e-summary-mail.c \
e-summary-mail.h \
e-summary-offline-handler.c \
e-summary-offline-handler.h \
e-summary-preferences.c \
e-summary-preferences.h \
e-summary-rdf.c \
e-summary-rdf.h \
e-summary-shown.c \
e-summary-shown.h \
e-summary-table.c \
e-summary-table.h \
e-summary-tasks.c \
e-summary-tasks.h \
e-summary-type.h \
e-summary-weather.c \
e-summary-weather.h \
metar.c \
metar.h \
my-evolution-html.h \
weather.h
summary_libs = \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/calendar/cal-client/libcal-client.la \
$(top_builddir)/calendar/cal-util/libcal-util.la \
$(EVOLUTION_EXECUTIVE_SUMMARY_LIBS)
component_LTLIBRARIES = libevolution-executive-summary.la
libevolution_executive_summary_la_SOURCES = $(summary_sources)
libevolution_executive_summary_la_LIBADD = $(summary_libs)
libevolution_executive_summary_la_LDFLAGS = -module -avoid-version
Locationdir = $(privdatadir)
Location_DATA = Locations
# .server files
server_in_files = GNOME_Evolution_Summary.server.in.in
server_DATA = $(server_in_files:.server.in.in=.server)
%.server.in: %.server.in.in
sed -e "s|\@COMPONENTDIR\@|$(componentdir)|" $< > $@
@INTLTOOL_SERVER_RULE@
# Glade
glade_DATA = my-evolution.glade
# GConf schemas
schemadir = $(GCONF_SCHEMA_FILE_DIR)
schema_DATA = apps_evolution_summary.schemas
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schema_DATA) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
done \
fi
# Extra
EXTRA_DIST = \
$(schema_DATA) \
$(summary_sources) \
$(server_in_files) \
$(server_DATA) \
$(Location_DATA) \
$(glade_DATA) \
ChangeLog.pre-1-4 \
Locations.h \
Location-translation-script \
check-empty.xpm \
check-filled.xpm \
check-none.xpm
BUILT_SOURCES = $(IDL_GENERATED) $(server_DATA)
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)

View File

@ -1,141 +0,0 @@
<gconfschemafile>
<schemalist>
<!-- Mail section -->
<schema>
<key>/schemas/apps/evolution/summary/mail/folder_evolution_uris</key>
<applyto>/apps/evolution/summary/mail/folder_evolution_uris</applyto>
<owner>evolution</owner>
<type>list</type>
<list_type>string</list_type>
<default>[]</default>
<locale name="C">
<short>evolution: URIs of the folders to display in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/mail/folder_physical_uris</key>
<applyto>/apps/evolution/summary/mail/folder_physical_uris</applyto>
<owner>evolution</owner>
<type>list</type>
<list_type>string</list_type>
<default>[]</default>
<locale name="C">
<short>Physical URIs of the folders to display in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/mail/show_full_paths</key>
<applyto>/apps/evolution/summary/mail/show_full_paths</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether to show the full paths to the mail folders displayed in the summary</short>
</locale>
</schema>
<!-- Calendar section -->
<schema>
<key>/schemas/apps/evolution/summary/calendar/days_shown</key>
<applyto>/apps/evolution/summary/calendar/days_shown</applyto>
<owner>evolution</owner>
<type>int</type>
<default>0</default>
<locale name="C">
<short>Number of days shown in the calendar section</short>
<long>Use '0' to display one day, '1' to display five days, '2' to display a full week, '3' to display a full month.</long>
</locale>
</schema>
<!-- Tasks section -->
<schema>
<key>/schemas/apps/evolution/summary/tasks/show_all</key>
<applyto>/apps/evolution/summary/tasks/show_all</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Whether to display all pending tasks instead of only today's tasks</short>
</locale>
</schema>
<!-- RDF section -->
<schema>
<key>/schemas/apps/evolution/summary/rdf/uris</key>
<applyto>/apps/evolution/summary/rdf/uris</applyto>
<owner>evolution</owner>
<type>list</type>
<list_type>string</list_type>
<default>[http://linuxtoday.com/backend/my-netscape.rdf,http://www.salon.com/feed/RDF/salon_use.rdf]</default>
<locale name="C">
<short>URIs of the RDF feeds to display in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/rdf/refresh_time</key>
<applyto>/apps/evolution/summary/rdf/refresh_time</applyto>
<owner>evolution</owner>
<type>int</type>
<default>600</default>
<locale name="C">
<short>Number of seconds between updates of the RDF feeds in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/rdf/max_items</key>
<applyto>/apps/evolution/summary/rdf/max_items</applyto>
<owner>evolution</owner>
<type>int</type>
<default>10</default>
<locale name="C">
<short>Maximum number of recent items to display for each RDF feed</short>
</locale>
</schema>
<!-- Weather section -->
<schema>
<key>/schemas/apps/evolution/summary/weather/stations</key>
<applyto>/apps/evolution/summary/weather/stations</applyto>
<owner>evolution</owner>
<type>list</type>
<list_type>string</list_type>
<default>[KBOS]</default>
<locale name="C">
<short>List of weather stations to display in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/weather/use_metric</key>
<applyto>/apps/evolution/summary/weather/use_metric</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Whether to use metric (instead of imperial) units in the summary</short>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/summary/weather/refresh_time</key>
<applyto>/apps/evolution/summary/weather/refresh_time</applyto>
<owner>evolution</owner>
<type>int</type>
<default>600</default>
<locale name="C">
<short>Number of seconds between updates of the weather section of the summary</short>
</locale>
</schema>
</schemalist>
</gconfschemafile>

View File

@ -1,21 +0,0 @@
/* XPM */
static const char * check_empty_xpm[] = {
"16 16 2 1",
" c None",
". c #000000",
" ",
" ",
" ............ ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" ............ ",
" ",
" "};

View File

@ -1,21 +0,0 @@
/* XPM */
static const char * check_filled_xpm[] = {
"16 16 2 1",
" c None",
". c #000000",
" ",
" ",
" ............ ",
" . . ",
" . . . ",
" . .. . ",
" . ... . ",
" . . ... . ",
" . .. ... . ",
" . ..... . ",
" . ... . ",
" . . . ",
" . . ",
" ............ ",
" ",
" "};

View File

@ -1,20 +0,0 @@
/* XPM */
static const char * check_none_xpm[] = {
"16 16 1 1",
" c None",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,168 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.c
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-shlib-factory.h>
#include <bonobo/bonobo-main.h>
#include <shell/evolution-shell-component.h>
#include <shell/Evolution.h>
#include <gal/widgets/e-gui-utils.h>
#include "e-summary-factory.h"
#include "e-summary-offline-handler.h"
#include "e-summary.h"
#include "e-summary-preferences.h"
#include "component-factory.h"
#define FACTORY_ID "OAFIID:GNOME_Evolution_Summary_ComponentFactory"
#define COMPONENT_ID "OAFIID:GNOME_Evolution_Summary_ShellComponent"
#define PREFERENCES_CONTROL_ID "OAFIID:GNOME_Evolution_Summary_ConfigControl"
static gint running_objects = 0;
static ESummaryPrefs *global_preferences = NULL;
static const EvolutionShellComponentFolderType folder_types[] = {
{ "summary", "evolution-today.png", N_("Summary"), N_("Folder containing the Evolution Summary"), FALSE, NULL, NULL },
{ NULL, NULL }
};
static char *evolution_dir = NULL;
/* EvolutionShellComponent methods and signals */
static EvolutionShellComponentResult
create_view (EvolutionShellComponent *shell,
const char *physical_uri,
const char *folder_type,
const char *view_info,
BonoboControl **control_return,
void *closure)
{
EvolutionShellClient *shell_client;
ESummaryOfflineHandler *offline_handler;
GNOME_Evolution_Shell corba_shell;
BonoboControl *control;
if (g_strcasecmp (folder_type, "Summary") != 0) {
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
}
offline_handler = g_object_get_data (G_OBJECT (shell), "offline-handler");
shell_client = evolution_shell_component_get_owner (shell);
corba_shell = evolution_shell_client_corba_objref (shell_client);
control = e_summary_factory_new_control (physical_uri, corba_shell,
offline_handler, global_preferences);
if (!control)
return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
*control_return = control;
return EVOLUTION_SHELL_COMPONENT_OK;
}
static void
owner_set_cb (EvolutionShellComponent *shell_component,
EvolutionShellClient *shell_client,
const char *evolution_homedir,
gpointer user_data)
{
GNOME_Evolution_Shell corba_shell;
if (evolution_dir != NULL) {
evolution_dir = g_strdup (evolution_homedir);
}
corba_shell = evolution_shell_client_corba_objref (shell_client);
e_summary_folder_init_folder_store (corba_shell);
e_summary_preferences_init_control (corba_shell);
}
static void
owner_unset_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
g_free (evolution_dir);
evolution_dir = NULL;
e_summary_folder_clear_folder_store ();
}
static BonoboObject *
create_shell_component (void)
{
EvolutionShellComponent *shell_component;
ESummaryOfflineHandler *offline_handler;
running_objects++;
if (global_preferences == NULL) {
global_preferences = e_summary_preferences_init ();
}
shell_component = evolution_shell_component_new (folder_types,
NULL,
create_view,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL);
g_signal_connect (shell_component, "owner_set", G_CALLBACK (owner_set_cb), NULL);
g_signal_connect (shell_component, "owner_unset", G_CALLBACK (owner_unset_cb), NULL);
offline_handler = e_summary_offline_handler_new ();
g_object_set_data (G_OBJECT (shell_component), "offline-handler", offline_handler);
bonobo_object_add_interface (BONOBO_OBJECT (shell_component), BONOBO_OBJECT (offline_handler));
return BONOBO_OBJECT (shell_component);
}
static BonoboObject *
factory (BonoboGenericFactory *this,
const char *object_id,
void *data)
{
if (strcmp (object_id, COMPONENT_ID) == 0)
return create_shell_component ();
if (strcmp (object_id, PREFERENCES_CONTROL_ID) == 0)
return e_summary_preferences_create_control ();
g_warning (FACTORY_ID ": Don't know anything about %s", object_id);
return NULL;
}
BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Summary component factory", factory, NULL)

View File

@ -1,28 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* component-factory.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifndef __COMPONENT_FACTORY_H__
#define __COMPONENT_FACTORY_H__
void component_factory_init (void);
#endif

View File

@ -1,119 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gal/util/e-util.h>
#include <gal/e-table/e-table-item.h>
#include "e-cell-tri.h"
#include "check-none.xpm"
#include "check-empty.xpm"
#include "check-filled.xpm"
#define PARENT_TYPE e_cell_toggle_get_type ()
static GdkPixbuf *checks[3];
static void
set_value (ECellView *view,
int model_col,
int view_col,
int row,
int value)
{
ECell *ecell = view->ecell;
ECellToggle *toggle = E_CELL_TOGGLE (ecell);
if (value >= toggle->n_states)
value = 1;
e_table_model_set_value_at (view->e_table_model,
model_col, row, GINT_TO_POINTER (value));
}
static gint
event (ECellView *ecell_view,
GdkEvent *event,
int model_col,
int view_col,
int row,
ECellFlags flags,
ECellActions *actions)
{
void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
const int value = GPOINTER_TO_INT (_value);
switch (event->type) {
case GDK_KEY_PRESS:
if (event->key.keyval != GDK_space) {
return FALSE;
}
/* Fall through */
case GDK_BUTTON_PRESS:
if (e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row) == FALSE) {
return FALSE;
}
if (value == 0) {
return FALSE;
}
set_value (ecell_view, model_col, view_col, row, value + 1);
return TRUE;
default:
return FALSE;
}
return TRUE;
}
static void
e_cell_tri_class_init (GtkObjectClass *object_class)
{
ECellClass *e_cell_class = E_CELL_CLASS (object_class);
e_cell_class->event = event;
checks[0] = gdk_pixbuf_new_from_xpm_data (check_none_xpm);
checks[1] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm);
checks[2] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm);
}
E_MAKE_TYPE (e_cell_tri, "ECellTri", ECellTri, e_cell_tri_class_init, NULL, PARENT_TYPE);
ECell *
e_cell_tri_new (void)
{
ECellTri *ect = gtk_type_new (e_cell_tri_get_type ());
e_cell_toggle_construct (E_CELL_TOGGLE (ect), 2, 3, checks);
return (ECell *) ect;
}

View File

@ -1,39 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __E_CELL_TRI_H__
#define __E_CELL_TRI_H__
#include <gal/e-table/e-cell-toggle.h>
typedef struct _ECellTri {
ECellToggle parent;
} ECellTri;
typedef struct _ECellTriClass {
ECellToggleClass parent_class;
} ECellTriClass;
GtkType e_cell_tri_get_type (void);
ECell *e_cell_tri_new (void);
#endif

View File

@ -1,633 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-calendar.c
*
* Copyright (C) 2001, 2002, 2003 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gnome.h>
#include <gal/widgets/e-unicode.h>
#include "e-summary-calendar.h"
#include "e-summary.h"
#include <cal-client/cal-client.h>
#include <cal-util/timeutil.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <gconf/gconf-client.h>
#include <libical/ical.h>
#define MAX_RELOAD_TRIES 10
struct _ESummaryCalendar {
CalClient *client;
char *html;
gboolean wants24hr;
char *default_uri;
GConfClient *gconf_client;
int gconf_value_changed_handler_id;
int cal_open_reload_timeout_id;
int reload_count;
};
const char *
e_summary_calendar_get_html (ESummary *summary)
{
if (summary->calendar == NULL) {
return NULL;
}
return summary->calendar->html;
}
typedef struct {
char *uid;
CalComponent *comp;
CalComponentDateTime dt;
icaltimezone *zone;
} ESummaryCalEvent;
/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */
static gboolean
cal_component_compare_tzid (const char *tzid1, const char *tzid2)
{
gboolean retval = TRUE;
if (tzid1) {
if (!tzid2 || strcmp (tzid1, tzid2))
retval = FALSE;
} else {
if (tzid2)
retval = FALSE;
}
return retval;
}
static gboolean
compare_event_timezones (CalComponent *comp,
CalClient *client,
icaltimezone *zone)
{
CalClientGetStatus status;
CalComponentDateTime start_datetime, end_datetime;
const char *tzid;
gboolean retval = FALSE;
icaltimezone *start_zone, *end_zone;
int offset1, offset2;
tzid = icaltimezone_get_tzid (zone);
cal_component_get_dtstart (comp, &start_datetime);
cal_component_get_dtend (comp, &end_datetime);
/* If either the DTSTART or the DTEND is a DATE value, we return TRUE.
Maybe if one was a DATE-TIME we should check that, but that should
not happen often. */
if ((start_datetime.value && start_datetime.value->is_date)
|| (end_datetime.value && end_datetime.value->is_date)) {
retval = TRUE;
goto out;
}
/* If the event uses UTC for DTSTART & DTEND, return TRUE. Outlook
will send single events as UTC, so we don't want to mark all of
these. */
if ((!start_datetime.value || start_datetime.value->is_utc)
&& (!end_datetime.value || end_datetime.value->is_utc)) {
retval = TRUE;
goto out;
}
/* If the event uses floating time for DTSTART & DTEND, return TRUE.
Imported vCalendar files will use floating times, so we don't want
to mark all of these. */
if (!start_datetime.tzid && !end_datetime.tzid) {
retval = TRUE;
goto out;
}
/* FIXME: DURATION may be used instead. */
if (cal_component_compare_tzid (tzid, start_datetime.tzid)
&& cal_component_compare_tzid (tzid, end_datetime.tzid)) {
/* If both TZIDs are the same as the given zone's TZID, then
we know the timezones are the same so we return TRUE. */
retval = TRUE;
} else {
/* If the TZIDs differ, we have to compare the UTC offsets
of the start and end times, using their own timezones and
the given timezone. */
status = cal_client_get_timezone (client,
start_datetime.tzid,
&start_zone);
if (status != CAL_CLIENT_GET_SUCCESS)
goto out;
if (start_datetime.value) {
offset1 = icaltimezone_get_utc_offset (start_zone,
start_datetime.value,
NULL);
offset2 = icaltimezone_get_utc_offset (zone,
start_datetime.value,
NULL);
if (offset1 != offset2)
goto out;
}
status = cal_client_get_timezone (client,
end_datetime.tzid,
&end_zone);
if (status != CAL_CLIENT_GET_SUCCESS)
goto out;
if (end_datetime.value) {
offset1 = icaltimezone_get_utc_offset (end_zone,
end_datetime.value,
NULL);
offset2 = icaltimezone_get_utc_offset (zone,
end_datetime.value,
NULL);
if (offset1 != offset2)
goto out;
}
retval = TRUE;
}
out:
cal_component_free_datetime (&start_datetime);
cal_component_free_datetime (&end_datetime);
return retval;
}
static int
e_summary_calendar_event_sort_func (const void *e1,
const void *e2)
{
ESummaryCalEvent *event1, *event2;
event1 = *(ESummaryCalEvent **) e1;
event2 = *(ESummaryCalEvent **) e2;
if (event1->dt.value == NULL || event2->dt.value == NULL) {
return 0;
}
return icaltime_compare (*(event1->dt.value), *(event2->dt.value));
}
struct _RecurData {
ESummary *summary;
GPtrArray *array;
ESummaryCalEvent *event;
};
static gboolean
add_recurrances (CalComponent *comp,
time_t start,
time_t end,
gpointer data)
{
struct _RecurData *recur = data;
struct icaltimetype v, *p;
ESummaryCalEvent *event;
event = g_new (ESummaryCalEvent, 1);
v = icaltime_from_timet_with_zone (start, FALSE, recur->summary->tz);
p = g_new (struct icaltimetype, 1);
event->dt.value = p;
p->year = v.year;
p->month = v.month;
p->day = v.day;
p->hour = v.hour;
p->minute = v.minute;
p->second = v.second;
p->is_utc = v.is_utc;
p->is_date = v.is_date;
p->is_daylight = v.is_daylight;
p->zone = v.zone;
event->dt.tzid = recur->summary->timezone;
event->comp = comp;
event->uid = g_strdup (recur->event->uid);
event->zone = recur->summary->tz;
g_object_ref (comp);
g_ptr_array_add (recur->array, event);
return TRUE;
}
static GPtrArray *
uids_to_array (ESummary *summary,
CalClient *client,
GList *uids,
time_t begin,
time_t end)
{
GList *p;
GPtrArray *array;
g_return_val_if_fail (IS_E_SUMMARY (summary), NULL);
g_return_val_if_fail (client != NULL, NULL);
g_return_val_if_fail (uids != NULL, NULL);
array = g_ptr_array_new ();
for (p = uids; p; p = p->next) {
ESummaryCalEvent *event;
CalClientGetStatus status;
icalcomponent *icalcomp;
event = g_new (ESummaryCalEvent, 1);
event->uid = g_strdup (p->data);
status = cal_client_get_object (client, p->data, &icalcomp);
if (status != CAL_CLIENT_GET_SUCCESS) {
g_free (event);
continue;
}
event->comp = cal_component_new ();
cal_component_set_icalcomponent (event->comp, icalcomp);
if (cal_component_has_recurrences (event->comp) == TRUE) {
struct _RecurData *recur;
recur = g_new (struct _RecurData, 1);
recur->event = event;
recur->array = array;
recur->summary = summary;
cal_recur_generate_instances (event->comp, begin, end,
add_recurrances, recur,
cal_client_resolve_tzid_cb, client,
recur->summary->tz);
g_free (recur);
g_free (event->uid);
g_free (event);
} else {
cal_component_get_dtstart (event->comp, &event->dt);
status = cal_client_get_timezone (client, event->dt.tzid, &event->zone);
if (status != CAL_CLIENT_GET_SUCCESS) {
g_object_unref (event->comp);
g_free (event);
continue;
}
icaltimezone_convert_time (event->dt.value, event->zone, summary->tz);
g_ptr_array_add (array, event);
}
}
qsort (array->pdata, array->len, sizeof (ESummaryCalEvent *), e_summary_calendar_event_sort_func);
return array;
}
static void
free_event_array (GPtrArray *array)
{
int i;
for (i = 0; i < array->len; i++) {
ESummaryCalEvent *event;
event = array->pdata[i];
g_free (event->uid);
g_object_unref (event->comp);
}
g_ptr_array_free (array, TRUE);
}
static gboolean
generate_html (gpointer data)
{
ESummary *summary = data;
ESummaryCalendar *calendar = summary->calendar;
GList *uids;
GString *string;
char *tmp;
time_t t, begin, end, f;
if (cal_client_get_load_state (calendar->client) != CAL_CLIENT_LOAD_LOADED)
return FALSE;
/* Set the default timezone on the server. */
if (summary->tz) {
cal_client_set_default_timezone (calendar->client,
summary->tz);
}
t = time (NULL);
begin = time_day_begin_with_zone (t, summary->tz);
switch (summary->preferences->days) {
case E_SUMMARY_CALENDAR_ONE_DAY:
end = time_day_end_with_zone (t, summary->tz);
break;
case E_SUMMARY_CALENDAR_FIVE_DAYS:
f = time_add_day_with_zone (t, 5, summary->tz);
end = time_day_end_with_zone (f, summary->tz);
break;
case E_SUMMARY_CALENDAR_ONE_WEEK:
f = time_add_week_with_zone (t, 1, summary->tz);
end = time_day_end_with_zone (f, summary->tz);
break;
case E_SUMMARY_CALENDAR_ONE_MONTH:
default:
f = time_add_month_with_zone (t, 1, summary->tz);
end = time_day_end_with_zone (f, summary->tz);
break;
}
uids = cal_client_get_objects_in_range (calendar->client,
CALOBJ_TYPE_EVENT, begin, end);
string = g_string_new ("<dl><dt><img src=\"myevo-appointments.png\" align=\"middle\" "
"alt=\"\" width=\"48\" height=\"48\"> <b>");
if (calendar->default_uri != NULL)
g_string_append_printf (string, "<a href=\"%s\">", calendar->default_uri);
g_string_append (string, _("Appointments"));
if (calendar->default_uri != NULL)
g_string_append (string, "</a>");
g_string_append (string, "</b></dt><dd>");
if (uids == NULL) {
g_string_append (string, _("No appointments."));
} else {
GPtrArray *uidarray;
int i;
uidarray = uids_to_array (summary, calendar->client, uids, begin, end);
for (i = 0; i < uidarray->len; i++) {
ESummaryCalEvent *event;
CalComponentText text;
struct tm start_tm;
char start_str[64], *start_str_utf, *img;
event = uidarray->pdata[i];
cal_component_get_summary (event->comp, &text);
start_tm = icaltimetype_to_tm (event->dt.value);
if (calendar->wants24hr == TRUE) {
strftime (start_str, sizeof start_str, _("%k:%M %d %B"), &start_tm);
} else {
strftime (start_str, sizeof start_str, _("%l:%M%p %d %B"), &start_tm);
}
if (cal_component_has_alarms (event->comp)) {
img = "es-appointments.png";
} else if (compare_event_timezones (event->comp,
calendar->client,
summary->tz) == FALSE) {
img = "timezone-16.xpm";
} else {
img = "new_appointment.xpm";
}
start_str_utf = e_utf8_from_locale_string (start_str);
tmp = g_strdup_printf ("<img align=\"middle\" src=\"%s\" "
"alt=\"\" width=\"16\" height=\"16\"> &#160; "
"<font size=\"-1\"><a href=\"calendar:/%s\">%s, %s</a></font><br>",
img,
event->uid, start_str_utf, text.value ? text.value : _("No description"));
g_free (start_str_utf);
g_string_append (string, tmp);
g_free (tmp);
}
free_event_array (uidarray);
}
g_string_append (string, "</dd></dl>");
if (calendar->html) {
g_free (calendar->html);
}
calendar->html = string->str;
g_string_free (string, FALSE);
e_summary_draw (summary);
return FALSE;
}
static gboolean
cal_open_reload_timeout (void *data)
{
ESummary *summary = (ESummary *) data;
summary->calendar->cal_open_reload_timeout_id = 0;
if (++ summary->calendar->reload_count >= MAX_RELOAD_TRIES) {
summary->calendar->reload_count = 0;
return FALSE;
}
cal_client_open_default_calendar (summary->calendar->client, FALSE);
return FALSE;
}
static void
cal_opened_cb (CalClient *client,
CalClientOpenStatus status,
ESummary *summary)
{
if (status == CAL_CLIENT_OPEN_SUCCESS) {
g_idle_add (generate_html, summary);
} else {
summary->calendar->cal_open_reload_timeout_id = g_timeout_add (1000,
cal_open_reload_timeout,
summary);
}
}
static void
obj_changed_cb (CalClient *client,
const char *uid,
gpointer data)
{
g_idle_add (generate_html, data);
}
static void
e_summary_calendar_protocol (ESummary *summary,
const char *uri,
void *closure)
{
ESummaryCalendar *calendar;
CORBA_Environment ev;
const char *comp_uri;
GNOME_Evolution_Calendar_CompEditorFactory factory;
calendar = (ESummaryCalendar *) closure;
comp_uri = cal_client_get_uri (calendar->client);
/* Get the factory */
CORBA_exception_init (&ev);
factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", 0, NULL, &ev);
if (BONOBO_EX (&ev)) {
g_message ("%s: Could not activate the component editor factory (%s)",
G_GNUC_FUNCTION, CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return;
}
GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, comp_uri, (char *)uri + 10, &ev);
if (BONOBO_EX (&ev)) {
g_message ("%s: Execption while editing the component (%s)", G_GNUC_FUNCTION,
CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
bonobo_object_release_unref (factory, NULL);
}
static void
setup_calendar (ESummary *summary)
{
ESummaryCalendar *calendar;
calendar = summary->calendar;
g_assert (calendar != NULL);
if (calendar->cal_open_reload_timeout_id != 0) {
g_source_remove (calendar->cal_open_reload_timeout_id);
calendar->cal_open_reload_timeout_id = 0;
calendar->reload_count = 0;
}
if (calendar->client != NULL)
g_object_unref (calendar->client);
calendar->client = cal_client_new ();
g_signal_connect (calendar->client, "cal-opened", G_CALLBACK (cal_opened_cb), summary);
g_signal_connect (calendar->client, "obj-updated", G_CALLBACK (obj_changed_cb), summary);
g_signal_connect (calendar->client, "obj-removed", G_CALLBACK (obj_changed_cb), summary);
if (! cal_client_open_default_calendar (calendar->client, FALSE))
g_message ("Open calendar failed");
calendar->wants24hr = gconf_client_get_bool (calendar->gconf_client,
"/apps/evolution/calendar/display/use_24h_format", NULL);
calendar->default_uri = gconf_client_get_string (calendar->gconf_client,
"/apps/evolution/shell/default_folders/calendar_path",
NULL);
}
static void
gconf_client_value_changed_cb (GConfClient *client,
const char *key,
GConfValue *value,
void *user_data)
{
setup_calendar (E_SUMMARY (user_data));
generate_html (user_data);
}
static void
setup_gconf_client (ESummary *summary)
{
ESummaryCalendar *calendar;
calendar = summary->calendar;
g_assert (calendar != NULL);
calendar->gconf_client = gconf_client_get_default ();
calendar->gconf_value_changed_handler_id
= g_signal_connect (calendar->gconf_client, "value_changed",
G_CALLBACK (gconf_client_value_changed_cb), summary);
gconf_client_add_dir (calendar->gconf_client, "/apps/evolution/calendar", FALSE, NULL);
gconf_client_add_dir (calendar->gconf_client, "/apps/evolution/shell/default_folders", FALSE, NULL);
}
void
e_summary_calendar_init (ESummary *summary)
{
ESummaryCalendar *calendar;
g_return_if_fail (summary != NULL);
calendar = g_new0 (ESummaryCalendar, 1);
summary->calendar = calendar;
calendar->html = NULL;
setup_gconf_client (summary);
setup_calendar (summary);
e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar);
}
void
e_summary_calendar_reconfigure (ESummary *summary)
{
setup_calendar (summary);
generate_html (summary);
}
void
e_summary_calendar_free (ESummary *summary)
{
ESummaryCalendar *calendar;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
calendar = summary->calendar;
if (calendar->cal_open_reload_timeout_id != 0)
g_source_remove (calendar->cal_open_reload_timeout_id);
g_object_unref (calendar->client);
g_free (calendar->html);
g_free (calendar->default_uri);
if (calendar->gconf_value_changed_handler_id != 0)
g_signal_handler_disconnect (calendar->gconf_client,
calendar->gconf_value_changed_handler_id);
g_object_unref (calendar->gconf_client);
g_free (calendar);
summary->calendar = NULL;
}

View File

@ -1,46 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-calendar.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifndef __E_SUMMARY_CALENDAR_H__
#define __E_SUMMARY_CALENDAR_H__
#include "e-summary-type.h"
typedef enum _ESummaryCalendarDays {
E_SUMMARY_CALENDAR_ONE_DAY,
E_SUMMARY_CALENDAR_FIVE_DAYS,
E_SUMMARY_CALENDAR_ONE_WEEK,
E_SUMMARY_CALENDAR_ONE_MONTH
} ESummaryCalendarDays;
typedef enum _ESummaryCalendarNumTasks {
E_SUMMARY_CALENDAR_ALL_TASKS,
E_SUMMARY_CALENDAR_TODAYS_TASKS
} ESummaryCalendarNumTasks;
typedef struct _ESummaryCalendar ESummaryCalendar;
const char *e_summary_calendar_get_html (ESummary *summary);
void e_summary_calendar_init (ESummary *summary);
void e_summary_calendar_reconfigure (ESummary *summary);
void e_summary_calendar_free (ESummary *summary);
#endif

View File

@ -1,137 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-factory.c
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-ui-util.h>
#include "e-util/e-gui-utils.h"
#include "e-summary.h"
#include "e-summary-factory.h"
#include "e-summary-offline-handler.h"
#include "e-summary-preferences.h"
#include "evolution-shell-component-utils.h" /* For E_PIXMAP */
static BonoboUIVerb summary_verbs[] = {
BONOBO_UI_VERB ("PrintMyEvolution", e_summary_print),
BONOBO_UI_VERB ("Reload", e_summary_reload),
BONOBO_UI_VERB_END
};
static EPixmap pixmaps [] = {
E_PIXMAP ("/commands/PrintMyEvolution", "print.xpm"),
E_PIXMAP ("/Toolbar/PrintMyEvolution", "buttons/print.png"),
E_PIXMAP_END
};
static void
control_activate (BonoboControl *control,
BonoboUIComponent *ui_component,
ESummary *summary)
{
Bonobo_UIContainer container;
container = bonobo_control_get_remote_ui_container (control, NULL);
bonobo_ui_component_set_container (ui_component, container, NULL);
bonobo_object_release_unref (container, NULL);
bonobo_ui_component_add_verb_list_with_data (ui_component, summary_verbs, summary);
bonobo_ui_component_freeze (ui_component, NULL);
bonobo_ui_util_set_ui (ui_component, PREFIX,
EVOLUTION_UIDIR "/my-evolution.xml", "my-evolution", NULL);
e_pixmaps_update (ui_component, pixmaps);
bonobo_ui_component_thaw (ui_component, NULL);
}
static void
control_deactivate (BonoboControl *control,
BonoboUIComponent *ui_component,
ESummary *summary)
{
bonobo_ui_component_unset_container (ui_component, NULL);
}
static void
control_activate_cb (BonoboControl *control,
gboolean activate,
ESummary *summary)
{
BonoboUIComponent *ui_component;
ui_component = bonobo_control_get_ui_component (control);
if (activate)
control_activate (control, ui_component, summary);
else
control_deactivate (control, ui_component, summary);
}
static void
control_destroy_cb (BonoboControl *control,
ESummary *summary)
{
gtk_widget_destroy (GTK_WIDGET (summary));
}
BonoboControl *
e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell,
ESummaryOfflineHandler *handler,
ESummaryPrefs *global_preferences)
{
BonoboControl *control;
GtkWidget *summary;
summary = e_summary_new (global_preferences);
if (summary == NULL) {
return NULL;
}
e_summary_offline_handler_add_summary (handler, E_SUMMARY (summary));
gtk_widget_show (summary);
control = bonobo_control_new (summary);
if (control == NULL) {
gtk_widget_destroy (summary);
return NULL;
}
e_summary_set_control (E_SUMMARY (summary), control);
g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), summary);
g_signal_connect (control, "destroy", G_CALLBACK (control_destroy_cb), summary);
/* FIXME: We register the factory here as it needs the summary object.
Sigh, this is really wrong. */
return control;
}

View File

@ -1,34 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-factory.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifndef __E_SUMMARY_FACTORY_H__
#define __E_SUMMARY_FACTORY_H__
#include "e-summary-offline-handler.h"
#include "e-summary.h"
BonoboControl *e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell,
ESummaryOfflineHandler *handler,
ESummaryPrefs *preferences);
#endif

View File

@ -1,783 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-mail.c
*
* Copyright (C) 2001, 2002, 2003 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gal/widgets/e-unicode.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-listener.h>
#include <bonobo/bonobo-property-bag-client.h>
#include <Evolution.h>
#include <evolution-storage-listener.h>
#include <string.h>
#include "Mailer.h"
#include "e-summary.h"
#include "e-summary-mail.h"
#include "e-summary-table.h"
#include "e-summary-preferences.h"
#include "e-util/e-path.h"
#define MAIL_IID "OAFIID:GNOME_Evolution_FolderInfo"
typedef struct _FolderStore {
GNOME_Evolution_Shell shell;
GNOME_Evolution_FolderInfo folder_info;
GNOME_Evolution_StorageRegistry registry;
BonoboListener *registry_listener;
BonoboListener *listener;
EvolutionStorageListener *storage_listener;
GSList *storage_list;
GHashTable *path_to_folder;
GHashTable *physical_uri_to_folder;
GList *shown;
} FolderStore;
struct _ESummaryMail {
char *html;
};
typedef struct _StorageInfo {
char *name;
char *toplevel;
GNOME_Evolution_Storage storage;
EvolutionStorageListener *listener;
GList *folders;
} StorageInfo;
typedef struct _ESummaryMailFolder {
char *path;
char *uri;
char *physical_uri;
char *display_name;
int count;
int unread;
gboolean init; /* Has this folder been initialised? */
StorageInfo *si;
} ESummaryMailFolder;
static FolderStore *folder_store = NULL;
static char *
make_pretty_foldername (ESummary *summary,
const ESummaryMailFolder *folder)
{
GString *pretty_path;
const char *p, *previous_p;
char *retval;
if (! summary->preferences->show_full_path)
return g_strdup (folder->display_name);
g_assert (folder->path[0] == '/');
pretty_path = g_string_new ("");
previous_p = folder->path;
while (previous_p != NULL) {
const ESummaryMailFolder *ancestor_folder;
char *path;
g_string_append (pretty_path, "/");
p = strchr (previous_p + 1, '/');
if (p == NULL)
path = g_strdup (folder->path);
else
path = g_strndup (folder->path, p - folder->path);
ancestor_folder = g_hash_table_lookup (folder_store->path_to_folder, path);
if (ancestor_folder != NULL) {
g_string_append (pretty_path, ancestor_folder->display_name);
} else {
char *path_element;
if (p == NULL)
path_element = g_strdup (previous_p + 1);
else
path_element = g_strndup (previous_p + 1, p - (previous_p + 1));
g_string_append (pretty_path, path_element);
g_free (path_element);
}
g_free (path);
previous_p = p;
}
retval = pretty_path->str;
g_string_free (pretty_path, FALSE);
return retval;
}
static void
folder_gen_html (ESummary *summary,
ESummaryMailFolder *folder,
GString *string)
{
char *str, *pretty_name;
pretty_name = make_pretty_foldername (summary, folder);
str = g_strdup_printf ("<tr><td><a href=\"%s\">"
"<pre>%s</pre></a></td><td align=\"Left\">"
"<pre>%d/%d</pre>"
"</td></tr>",
folder->uri, pretty_name,
folder->unread, folder->count);
g_string_append (string, str);
g_free (pretty_name);
g_free (str);
}
static void
e_summary_mail_generate_html (ESummary *summary)
{
ESummaryMail *mail;
GString *string;
GList *p;
char *old;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
mail = summary->mail;
string = g_string_new ("<dl><dt><img src=\"myevo-mail-summary.png\" "
"align=\"middle\" alt=\"\" width=\"48\" "
"height=\"48\"> <b><a href=\"evolution:/local/Inbox\">");
g_string_append (string, _("Mail summary"));
g_string_append (string, "</a></b></dt><dd><table numcols=\"2\" width=\"100%\">");
for (p = folder_store->shown; p; p = p->next) {
ESummaryMailFolder *mail_folder = p->data;
folder_gen_html (summary, mail_folder, string);
}
g_string_append (string, "</table></dd></dl>");
old = mail->html;
mail->html = string->str;
g_free (old);
g_string_free (string, FALSE);
}
const char *
e_summary_mail_get_html (ESummary *summary)
{
/* Only regenerate HTML when it's needed */
e_summary_mail_generate_html (summary);
if (summary->mail == NULL) {
return NULL;
}
return summary->mail->html;
}
static void
e_summary_mail_get_info (const char *uri)
{
CORBA_Environment ev;
if (folder_store == NULL)
return;
g_return_if_fail (folder_store->folder_info != CORBA_OBJECT_NIL);
CORBA_exception_init (&ev);
GNOME_Evolution_FolderInfo_getInfo (folder_store->folder_info, uri ? uri : "",
BONOBO_OBJREF (folder_store->listener), &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting info for %s:\n%s", uri,
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return;
}
CORBA_exception_free (&ev);
return;
}
static gboolean
e_summary_mail_idle_get_info (gpointer user_data)
{
char *uri = user_data;
e_summary_mail_get_info (uri);
g_free (uri);
return FALSE;
}
static void
new_folder_cb (EvolutionStorageListener *listener,
const char *path,
const GNOME_Evolution_Folder *folder,
StorageInfo *si)
{
ESummaryPrefs *global_preferences;
ESummaryMailFolder *mail_folder;
GSList *p;
if (strcmp (folder->type, "mail") != 0)
return;
if (strncmp (folder->evolutionUri, "evolution:", 10) != 0)
return;
mail_folder = g_new (ESummaryMailFolder, 1);
mail_folder->si = si;
mail_folder->uri = g_strdup (folder->evolutionUri);
mail_folder->physical_uri = g_strdup (folder->physicalUri);
mail_folder->path = g_strdup (path);
mail_folder->display_name = g_strdup (folder->displayName);
mail_folder->count = -1;
mail_folder->unread = -1;
mail_folder->init = FALSE;
g_hash_table_insert (folder_store->path_to_folder, mail_folder->path, mail_folder);
g_hash_table_insert (folder_store->physical_uri_to_folder, mail_folder->physical_uri, mail_folder);
si->folders = g_list_prepend (si->folders, mail_folder);
global_preferences = e_summary_preferences_get_global ();
for (p = global_preferences->display_folders; p; p = p->next) {
ESummaryPrefsFolder *f = p->data;
if (strcmp (f->physical_uri, folder->physicalUri) == 0) {
folder_store->shown = g_list_append (folder_store->shown, mail_folder);
g_idle_add (e_summary_mail_idle_get_info,
g_strdup (mail_folder->physical_uri));
}
}
}
static void
update_folder_cb (EvolutionStorageListener *listener,
const char *path,
int unread_count,
StorageInfo *si)
{
ESummaryMailFolder *mail_folder;
GList *p;
mail_folder = g_hash_table_lookup (folder_store->path_to_folder, path);
if (mail_folder == NULL) {
return;
}
for (p = folder_store->shown; p; p = p->next) {
if (p->data == mail_folder) {
g_idle_add (e_summary_mail_idle_get_info,
g_strdup (mail_folder->physical_uri));
return;
}
}
}
static void
remove_folder_cb (EvolutionStorageListener *listener,
const char *path,
StorageInfo *si)
{
ESummaryMailFolder *mail_folder;
GList *p;
mail_folder = g_hash_table_lookup (folder_store->path_to_folder, path);
if (mail_folder == NULL) {
return;
}
/* Check if we're displaying it, because we can't display it if it
doesn't exist :) */
for (p = folder_store->shown; p; p = p->next) {
if (p->data == mail_folder) {
folder_store->shown = g_list_remove_link (folder_store->shown, p);
g_list_free (p);
}
}
g_hash_table_remove (folder_store->path_to_folder, path);
g_free (mail_folder->path);
g_free (mail_folder->uri);
g_free (mail_folder->physical_uri);
g_free (mail_folder->display_name);
g_free (mail_folder);
}
static void
mail_change_notify (BonoboListener *listener,
const char *name,
const BonoboArg *arg,
CORBA_Environment *ev,
gpointer data)
{
GNOME_Evolution_FolderInfo_MessageCount *count;
ESummaryMailFolder *folder;
ESummaryPrefs *global_preferences;
GSList *p;
count = arg->_value;
folder = g_hash_table_lookup (folder_store->physical_uri_to_folder, count->path);
if (folder == NULL) {
return;
}
folder->count = count->count;
folder->unread = count->unread;
folder->init = TRUE;
/* Are we displaying this folder? */
global_preferences = e_summary_preferences_get_global ();
for (p = global_preferences->display_folders; p; p = p->next) {
ESummaryPrefsFolder *f = p->data;
if (strcmp (f->physical_uri, folder->physical_uri) == 0) {
e_summary_redraw_all (); /* All summaries should be redrawn, not just this one */
return;
}
}
}
static void
e_summary_mail_protocol (ESummary *summary,
const char *uri,
void *closure)
{
}
static gboolean
e_summary_folder_register_storage (const char *name,
GNOME_Evolution_Storage corba_storage)
{
GNOME_Evolution_StorageListener corba_listener;
StorageInfo *si;
CORBA_Environment ev;
si = g_new (StorageInfo, 1);
si->name = g_strdup (name);
si->toplevel = NULL;
si->storage = corba_storage;
si->listener = evolution_storage_listener_new ();
si->folders = NULL;
folder_store->storage_list = g_slist_prepend (folder_store->storage_list, si);
g_signal_connect (si->listener, "new-folder", G_CALLBACK (new_folder_cb), si);
g_signal_connect (si->listener, "removed-folder", G_CALLBACK (remove_folder_cb), si);
g_signal_connect (si->listener, "update_folder", G_CALLBACK (update_folder_cb), si);
corba_listener = evolution_storage_listener_corba_objref (si->listener);
CORBA_exception_init (&ev);
GNOME_Evolution_Storage_addListener (corba_storage, corba_listener, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Exception adding listener: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return FALSE;
}
CORBA_exception_free (&ev);
return TRUE;
}
static gboolean
e_summary_folder_unregister_storage (StorageInfo *si, gboolean remove)
{
GNOME_Evolution_StorageListener corba_listener;
CORBA_Environment ev;
g_free (si->name);
corba_listener = evolution_storage_listener_corba_objref (si->listener);
CORBA_exception_init (&ev);
GNOME_Evolution_Storage_removeListener (si->storage, corba_listener, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Exception removing listener: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return FALSE;
}
CORBA_exception_free (&ev);
g_signal_handlers_disconnect_matched (si->listener, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, si);
g_object_unref (si->listener);
bonobo_object_release_unref (si->storage, NULL);
/* FIXME Folders */
if (remove)
folder_store->storage_list = g_slist_remove (folder_store->storage_list, si);
g_free (si);
return TRUE;
}
static void
e_summary_folder_register_local_storage (void)
{
GNOME_Evolution_Storage local_storage;
CORBA_Environment ev;
CORBA_exception_init (&ev);
local_storage = GNOME_Evolution_Shell_getLocalStorage (folder_store->shell, &ev);
if (BONOBO_EX (&ev) || local_storage == CORBA_OBJECT_NIL) {
g_warning ("Error getting local storage: %s", CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return;
}
CORBA_exception_free (&ev);
e_summary_folder_register_storage (_("Local Folders"), local_storage);
}
static void
storage_notify (BonoboListener *listener,
const char *name,
const BonoboArg *arg,
CORBA_Environment *ev,
gpointer data)
{
GNOME_Evolution_StorageRegistry_NotifyResult *nr;
GNOME_Evolution_Storage corba_storage;
CORBA_Environment ev2;
nr = arg->_value;
switch (nr->type) {
case GNOME_Evolution_StorageRegistry_STORAGE_CREATED:
/* These need to be special cased because they're special */
if (strcmp (nr->name, "summary") == 0) {
break;
}
if (strcmp (nr->name, "local") == 0) {
e_summary_folder_register_local_storage ();
break;
}
CORBA_exception_init (&ev2);
corba_storage = GNOME_Evolution_StorageRegistry_getStorageByName (folder_store->registry,
nr->name, &ev2);
if (BONOBO_EX (&ev2) || corba_storage == CORBA_OBJECT_NIL) {
g_warning ("Error getting storage %s\n%s", nr->name,
CORBA_exception_id (&ev2));
CORBA_exception_free (&ev2);
return;
}
CORBA_exception_free (&ev2);
e_summary_folder_register_storage (nr->name, corba_storage);
break;
case GNOME_Evolution_StorageRegistry_STORAGE_DESTROYED:
g_print ("%s removed\n", nr->name);
break;
default:
g_print ("Unknown response %d\n", nr->type);
break;
}
}
static gboolean
e_summary_folder_register_storages (GNOME_Evolution_Shell corba_shell)
{
Bonobo_Listener corba_listener;
CORBA_Environment ev;
CORBA_exception_init (&ev);
folder_store->registry = Bonobo_Unknown_queryInterface (corba_shell,
"IDL:GNOME/Evolution/StorageRegistry:1.0",
&ev);
if (BONOBO_EX (&ev) || folder_store->registry == NULL) {
g_warning ("No storage registry: %s", CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return FALSE;
}
folder_store->registry_listener = bonobo_listener_new (NULL, NULL);
g_signal_connect (folder_store->registry_listener, "event-notify", G_CALLBACK (storage_notify), NULL);
corba_listener = BONOBO_OBJREF (folder_store->registry_listener);
/* Storages will be added whenever the listener gets an event. */
GNOME_Evolution_StorageRegistry_addListener (folder_store->registry, corba_listener, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Cannot add listener\n%s", CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return FALSE;
}
CORBA_exception_free (&ev);
return TRUE;
}
void
e_summary_mail_init (ESummary *summary)
{
ESummaryMail *mail;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
g_return_if_fail (folder_store != NULL);
mail = g_new0 (ESummaryMail, 1);
summary->mail = mail;
mail->html = NULL;
e_summary_add_protocol_listener (summary, "mail", e_summary_mail_protocol, mail);
return;
}
void
e_summary_mail_reconfigure (void)
{
ESummaryPrefs *preferences;
GList *old;
GSList *p;
old = folder_store->shown;
folder_store->shown = NULL;
preferences = e_summary_preferences_get_global ();
for (p = preferences->display_folders; p; p = p->next) {
ESummaryMailFolder *folder;
ESummaryPrefsFolder *f = p->data;
char *uri;
#if 0
if (strncmp (p->data, "file://", 7) == 0 ||
strncmp (p->data, "vfolder:", 8) == 0) {
uri = g_strdup (p->data);
} else {
uri = g_strconcat ("file://", p->data, NULL);
}
#endif
uri = g_strdup (f->physical_uri);
folder = g_hash_table_lookup (folder_store->physical_uri_to_folder, uri);
if (folder != NULL) {
if (folder->init == FALSE) {
e_summary_mail_get_info (folder->physical_uri);
}
folder_store->shown = g_list_append (folder_store->shown, folder);
}
g_free (uri);
}
/* Free the old list */
g_list_free (old);
/* e_summary_redraw_all (); */
}
void
e_summary_mail_free (ESummary *summary)
{
ESummaryMail *mail;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
mail = summary->mail;
#if 0
g_hash_table_foreach (mail->folders, free_folder, NULL);
g_hash_table_destroy (mail->folders);
#endif
g_free (mail->html);
#if 0
g_signal_handlers_disconnect_by_func (mail->storage_listener, G_CALLBACK (new_folder_cb), summary);
g_signal_handlers_disconnect_by_func (mail->storage_listener, G_CALLBACK (remove_folder_cb), summary);
g_signal_handlers_disconnect_by_func (mail->storage_listener, G_CALLBACK (update_folder_cb), summary);
#endif
g_free (mail);
summary->mail = NULL;
}
static void
folder_info_pb_changed (BonoboListener *listener,
const char *name,
const BonoboArg *arg,
CORBA_Environment *ev,
gpointer data)
{
e_summary_folder_register_storages (folder_store->shell);
bonobo_object_unref (listener);
}
static void
lazy_register_storages (void)
{
Bonobo_PropertyBag pb;
Bonobo_EventSource event;
BonoboListener *listener;
CORBA_Environment ev;
gboolean ready;
/* Get the PropertyBag */
CORBA_exception_init (&ev);
pb = Bonobo_Unknown_queryInterface (folder_store->folder_info,
"IDL:Bonobo/PropertyBag:1.0", &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting propertybag interface: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return;
}
/* Check the initial value */
ready = bonobo_property_bag_client_get_value_gboolean (pb,
"folder-info-ready",
NULL);
if (ready == TRUE) {
/* Register storages */
e_summary_folder_register_storages (folder_store->shell);
bonobo_object_release_unref (pb, NULL);
return;
}
/* Get thh event source for the bag */
event = Bonobo_Unknown_queryInterface (pb,
"IDL:Bonobo/EventSource:1.0", &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting event source interface: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
bonobo_object_release_unref (pb, NULL);
return;
}
/* Connect a listener to it */
listener = bonobo_listener_new (NULL, NULL);
g_signal_connect (listener, "event-notify", G_CALLBACK (folder_info_pb_changed), NULL);
Bonobo_EventSource_addListener (event, BONOBO_OBJREF (listener), &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error adding listener: %s\n",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
bonobo_object_unref (BONOBO_OBJECT (listener));
}
bonobo_object_release_unref (pb, NULL);
bonobo_object_release_unref (event, NULL);
}
gboolean
e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell)
{
CORBA_Environment ev;
if (folder_store != NULL) {
return TRUE;
}
folder_store = g_new0 (FolderStore, 1);
folder_store->shell = shell;
CORBA_exception_init (&ev);
folder_store->folder_info = bonobo_activation_activate_from_id (MAIL_IID, 0, NULL, &ev);
if (BONOBO_EX (&ev) || folder_store->folder_info == NULL) {
g_warning ("Exception creating folderinfo: %s\n",
CORBA_exception_id (&ev) ? CORBA_exception_id (&ev) : "(null)");
CORBA_exception_free (&ev);
return FALSE;
}
CORBA_exception_free (&ev);
folder_store->listener = bonobo_listener_new (NULL, NULL);
g_signal_connect (folder_store->listener, "event-notify", G_CALLBACK (mail_change_notify), NULL);
/* Create a hash table for the folders */
folder_store->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal);
folder_store->physical_uri_to_folder = g_hash_table_new (g_str_hash, g_str_equal);
/* Wait for the mailer to tell us we're ready to register */
lazy_register_storages ();
return TRUE;
}
gboolean
e_summary_folder_clear_folder_store (void)
{
GSList *l;
if (folder_store == NULL) {
return TRUE;
}
bonobo_object_release_unref (folder_store->folder_info, NULL);
bonobo_object_release_unref (folder_store->registry, NULL);
bonobo_object_unref (folder_store->registry_listener);
bonobo_object_unref (folder_store->listener);
for (l = folder_store->storage_list; l != NULL; l = l->next)
e_summary_folder_unregister_storage (l->data, FALSE);
g_slist_free (folder_store->storage_list);
g_free (folder_store);
folder_store = NULL;
return TRUE;
}

View File

@ -1,55 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-mail.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes <iain@ximian.com>
*/
#ifndef __E_SUMMARY_MAIL_H__
#define __E_SUMMARY_MAIL_H__
#include <Evolution.h>
#include "e-summary-type.h"
#include "e-summary-table.h"
typedef enum _ESummaryMailMode ESummaryMailMode;
enum _ESummaryMailMode {
E_SUMMARY_MAIL_MODE_ONLY,
E_SUMMARY_MAIL_MODE_EXCLUDING
};
typedef struct _ESummaryMailRowData ESummaryMailRowData;
typedef struct _ESummaryMail ESummaryMail;
struct _ESummaryMailRowData {
char *name;
char *uri;
};
const char *e_summary_mail_get_html (ESummary *summary);
void e_summary_mail_init (ESummary *summary);
void e_summary_mail_reconfigure (void);
void e_summary_mail_free (ESummary *summary);
const char *e_summary_mail_uri_to_name (const char *uri);
void e_summary_mail_fill_list (ESummaryTable *est);
/* Folder stuff */
gboolean e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell);
gboolean e_summary_folder_clear_folder_store (void);
#endif

View File

@ -1,286 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-offline-handler.c
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Ettore Perazzoli <ettore@ximian.com>
* Dan Winship <danw@ximian.com>
* Iain Holmes <iain@ximian.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "e-summary-offline-handler.h"
#include "e-summary.h"
#include <bonobo/bonobo-exception.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
struct _ESummaryOfflineHandlerPriv {
GSList *summaries;
GNOME_Evolution_OfflineProgressListener listener_interface;
};
/* ::destroy handler for the bookkeeping of the list of summary views. */
static void
summary_destroy_callback (GtkObject *object,
void *data)
{
ESummaryOfflineHandler *offline_handler;
ESummaryOfflineHandlerPriv *priv;
ESummary *summary;
summary = E_SUMMARY (object);
offline_handler = E_SUMMARY_OFFLINE_HANDLER (data);
priv = offline_handler->priv;
priv->summaries = g_slist_remove (priv->summaries, summary);
}
static GNOME_Evolution_ConnectionList *
create_connection_list (GSList *summaries)
{
GNOME_Evolution_ConnectionList *list;
GList *connections, *p;
GSList *sp;
list = GNOME_Evolution_ConnectionList__alloc ();
list->_length = 0;
list->_maximum = 0;
/* Count the total number of connections first to make CORBA happy. */
for (sp = summaries; sp != NULL; sp = sp->next)
list->_maximum += e_summary_count_connections (E_SUMMARY (sp->data));
list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum);
for (sp = summaries; sp != NULL; sp = sp->next) {
ESummary *summary;
summary = E_SUMMARY (sp->data);
connections = e_summary_add_connections (summary);
for (p = connections; p != NULL; p = p->next) {
ESummaryConnectionData *data;
data = p->data;
list->_buffer[list->_length].hostName = CORBA_string_dup (data->hostname);
list->_buffer[list->_length].type = CORBA_string_dup (data->type);
list->_length++;
g_free (data->hostname);
g_free (data->type);
g_free (data);
}
g_list_free (connections);
}
return list;
}
/* GNOME::Evolution::Offline methods. */
static CORBA_boolean
impl__get_isOffline (PortableServer_Servant servant,
CORBA_Environment *ev)
{
ESummaryOfflineHandler *offline_handler;
GSList *sp;
offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
/* We are offline if all of the views are offline. */
for (sp = offline_handler->priv->summaries; sp != NULL; sp = sp->next) {
ESummary *summary;
summary = E_SUMMARY (sp->data);
if (summary->online)
return FALSE;
}
return TRUE;
}
static void
impl_prepareForOffline (PortableServer_Servant servant,
GNOME_Evolution_ConnectionList **active_connection_list,
CORBA_Environment *ev)
{
ESummaryOfflineHandler *offline_handler;
ESummaryOfflineHandlerPriv *priv;
offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
priv = offline_handler->priv;
*active_connection_list = create_connection_list (priv->summaries);
}
static void
went_offline (ESummary *summary,
void *data)
{
ESummaryOfflineHandler *offline_handler = data;
ESummaryOfflineHandlerPriv *priv;
CORBA_Environment ev;
GNOME_Evolution_ConnectionList *connection_list;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
g_return_if_fail (offline_handler != NULL);
priv = offline_handler->priv;
connection_list = create_connection_list (priv->summaries);
CORBA_exception_init (&ev);
g_warning ("Went offline");
GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, connection_list, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error updating offline progress: %s",
CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
}
static void
impl_goOffline (PortableServer_Servant servant,
const GNOME_Evolution_OfflineProgressListener progress_listener,
CORBA_Environment *ev)
{
ESummaryOfflineHandler *offline_handler;
ESummaryOfflineHandlerPriv *priv;
GSList *sp;
offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
priv = offline_handler->priv;
/* FIXME: If we have a progress already, then something is wrong and we
should raise an exception. */
priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev);
for (sp = priv->summaries; sp != NULL; sp = sp->next) {
ESummary *summary;
summary = E_SUMMARY (sp->data);
e_summary_set_online (summary, CORBA_OBJECT_NIL, FALSE, went_offline, offline_handler);
}
}
static void
impl_goOnline (PortableServer_Servant servant,
CORBA_Environment *ev)
{
ESummaryOfflineHandler *offline_handler;
GSList *sp;
offline_handler = E_SUMMARY_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
for (sp = offline_handler->priv->summaries; sp != NULL; sp = sp->next) {
ESummary *summary;
summary = E_SUMMARY (sp->data);
e_summary_set_online (summary, CORBA_OBJECT_NIL, TRUE, NULL, NULL);
}
}
/* GObject methods */
static void
impl_finalize (GObject *object)
{
ESummaryOfflineHandler *offline_handler;
ESummaryOfflineHandlerPriv *priv;
offline_handler = E_SUMMARY_OFFLINE_HANDLER (object);
priv = offline_handler->priv;
if (priv->listener_interface != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
CORBA_Object_release (priv->listener_interface, &ev);
CORBA_exception_free (&ev);
}
g_slist_free (priv->summaries);
g_free (priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
e_summary_offline_handler_class_init (ESummaryOfflineHandlerClass *klass)
{
GObjectClass *object_class;
POA_GNOME_Evolution_Offline__epv *epv;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = impl_finalize;
epv = &klass->epv;
epv->_get_isOffline = impl__get_isOffline;
epv->prepareForOffline = impl_prepareForOffline;
epv->goOffline = impl_goOffline;
epv->goOnline = impl_goOnline;
parent_class = gtk_type_class (PARENT_TYPE);
}
static void
e_summary_offline_handler_init (ESummaryOfflineHandler *offline_handler)
{
ESummaryOfflineHandlerPriv *priv;
priv = g_new0 (ESummaryOfflineHandlerPriv, 1);
offline_handler->priv = priv;
}
ESummaryOfflineHandler *
e_summary_offline_handler_new (void)
{
ESummaryOfflineHandler *new;
new = g_object_new (e_summary_offline_handler_get_type (), NULL);
return new;
}
void
e_summary_offline_handler_add_summary (ESummaryOfflineHandler *handler,
ESummary *summary)
{
g_return_if_fail (handler != NULL);
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
handler->priv->summaries = g_slist_prepend (handler->priv->summaries,
summary);
g_signal_connect (summary, "destroy", G_CALLBACK (summary_destroy_callback), handler);
}
BONOBO_TYPE_FUNC_FULL (ESummaryOfflineHandler, GNOME_Evolution_Offline, PARENT_TYPE, e_summary_offline_handler);

View File

@ -1,74 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-offline-handler.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authors:
* Ettore Perazzoli <ettore@ximian.com>
* Dan Winship <danw@ximian.com>
* Iain Holmes <iain@ximian.com>
*/
#ifndef __E_SUMMARY_OFFLINE_HANDLER_H__
#define __E_SUMMARY_OFFLINE_HANDLER_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <bonobo/bonobo-object.h>
#include "e-summary.h"
#include "Evolution.h"
#ifdef __cplusplus
extern "C" {
#pragma }
#endif
#define E_SUMMARY_TYPE_OFFLINE_HANDLER (e_summary_offline_handler_get_type ())
#define E_SUMMARY_OFFLINE_HANDLER(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TYPE_OFFLINE_HANDLER, ESummaryOfflineHandler))
#define E_SUMMARY_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TYPE_OFFLINE_HANDLER, ESummaryOfflineHandlerClass))
typedef struct _ESummaryOfflineHandler ESummaryOfflineHandler;
typedef struct _ESummaryOfflineHandlerPriv ESummaryOfflineHandlerPriv;
typedef struct _ESummaryOfflineHandlerClass ESummaryOfflineHandlerClass;
struct _ESummaryOfflineHandler {
BonoboObject parent;
ESummaryOfflineHandlerPriv *priv;
};
struct _ESummaryOfflineHandlerClass {
BonoboObjectClass parent_class;
POA_GNOME_Evolution_Offline__epv epv;
};
GtkType e_summary_offline_handler_get_type (void);
ESummaryOfflineHandler *e_summary_offline_handler_new (void);
void e_summary_offline_handler_add_summary (ESummaryOfflineHandler *handler,
ESummary *summary);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-preferences.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifndef __E_SUMMARY_PREFERENCES_H__
#define __E_SUMMARY_PREFERENCES_H__
#include <bonobo/bonobo-ui-component.h>
#include <Evolution.h>
gboolean e_summary_preferences_restore (ESummaryPrefs *prefs);
void e_summary_preferences_save (ESummaryPrefs *prefs);
void e_summary_preferences_free (ESummaryPrefs *prefs);
ESummaryPrefs *e_summary_preferences_copy (ESummaryPrefs *prefs);
ESummaryPrefs *e_summary_preferences_init (void);
ESummaryPrefs *e_summary_preferences_get_global (void);
BonoboObject *e_summary_preferences_create_control (void);
void e_summary_preferences_init_control (GNOME_Evolution_Shell shell);
#endif

View File

@ -1,651 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-rdf.c
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtkmain.h>
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
#include <libgnome/gnome-i18n.h>
#include <gal/widgets/e-unicode.h>
#include <libsoup/soup.h>
#include <string.h>
#include "e-summary.h"
struct _ESummaryRDF {
ESummaryConnection *connection;
GList *rdfs;
char *html;
guint32 timeout;
gboolean online;
};
typedef struct _RDF {
char *uri;
char *html;
xmlDocPtr cache;
ESummary *summary;
gboolean shown;
/* Soup stuff */
SoupMessage *message;
} RDF;
extern int xmlSubstituteEntitiesDefaultValue;
char *
e_summary_rdf_get_html (ESummary *summary)
{
GList *rdfs;
char *html;
GString *string;
if (summary->rdf == NULL) {
return NULL;
}
string = g_string_new ("");
for (rdfs = summary->rdf->rdfs; rdfs; rdfs = rdfs->next) {
if (((RDF *)rdfs->data)->html == NULL) {
continue;
}
g_string_append (string, ((RDF *)rdfs->data)->html);
}
html = string->str;
g_string_free (string, FALSE);
return html;
}
/************ RDF Parser *******************/
static char *
layer_find (xmlNodePtr node,
char *match,
char *fail)
{
while (node!=NULL) {
#ifdef RDF_DEBUG
xmlDebugDumpNode (stdout, node, 32);
printf("%s.\n", node->name);
#endif
if (strcasecmp (node->name, match)==0) {
if (node->children != NULL && node->children->content != NULL) {
return node->children->content;
} else {
return fail;
}
}
node = node->next;
}
return fail;
}
static char *
layer_find_url (xmlNodePtr node,
char *match,
char *fail)
{
char *p = layer_find (node, match, fail);
char *r = p;
static char *wb = NULL;
char *w;
if (wb) {
g_free (wb);
}
wb = w = g_malloc (3 * strlen (p));
if (w == NULL) {
return fail;
}
if (*r == ' ') r++; /* Fix UF bug */
while (*r) {
if (strncmp (r, "&amp;", 5) == 0) {
*w++ = '&';
r += 5;
continue;
}
if (strncmp (r, "&lt;", 4) == 0) {
*w++ = '<';
r += 4;
continue;
}
if (strncmp (r, "&gt;", 4) == 0) {
*w++ = '>';
r += 4;
continue;
}
if (*r == '"' || *r == ' '){
*w++ = '%';
*w++ = "0123456789ABCDEF"[*r/16];
*w++ = "0123456789ABCDEF"[*r&15];
r++;
continue;
}
*w++ = *r++;
}
*w = 0;
return wb;
}
static void
tree_walk (xmlNodePtr root,
RDF *r,
GString *html)
{
xmlNodePtr walk;
xmlNodePtr rewalk = root;
xmlNodePtr channel = NULL;
xmlNodePtr image = NULL;
xmlNodePtr item[16];
int items = 0;
int limit;
int i;
char *t, *u;
char *tmp;
char *charset;
if (r->summary->preferences == NULL) {
limit = 10;
} else {
limit = r->summary->preferences->limit;
}
/* check in-memory encoding first, fallback to transport encoding, which may or may not be correct */
if (r->cache->charset == XML_CHAR_ENCODING_UTF8
|| r->cache->charset == XML_CHAR_ENCODING_ASCII) {
charset = NULL;
} else {
/* bad/missing encoding, fallback to latin1 (locale?) */
charset = r->cache->encoding ? (char *)r->cache->encoding : "iso-8859-1";
}
/* FIXME: Need arrows */
if (r->shown == FALSE) {
char *p;
/* FIXME: Hash table & UID */
p = g_strdup_printf ("<a href=\"rdf://%d\" style=\"text-decoration: none; color: black\">&#x25b6;</a>", GPOINTER_TO_INT (r));
g_string_append (html, p);
g_free (p);
} else {
char *p;
/* FIXME: Hash table & UID */
p = g_strdup_printf ("<a href=\"rdf://%d\" style=\"text-decoration: none; color: black\">&#x25BC;</a>", GPOINTER_TO_INT (r));
g_string_append (html, p);
g_free (p);
}
do {
walk = rewalk;
rewalk = NULL;
while (walk!=NULL){
#ifdef RDF_DEBUG
printf ("%p, %s\n", walk, walk->name);
#endif
if (strcasecmp (walk->name, "rdf") == 0) {
rewalk = walk->children;
walk = walk->next;
continue;
}
if (strcasecmp (walk->name, "rss") == 0){
rewalk = walk->children;
walk = walk->next;
continue;
}
/* This is the channel top level */
#ifdef RDF_DEBUG
printf ("Top level '%s'.\n", walk->name);
#endif
if (strcasecmp (walk->name, "channel") == 0) {
channel = walk;
rewalk = channel->children;
}
if (strcasecmp (walk->name, "image") == 0) {
image = walk;
}
if (strcasecmp (walk->name, "item") == 0 && items < 16) {
item[items++] = walk;
}
walk = walk->next;
}
}
while (rewalk);
if (channel == NULL) {
fprintf(stderr, "No channel definition.\n");
return;
}
t = layer_find(channel->children, "title", "");
u = layer_find(channel->children, "link", "");
if (*u != '\0')
g_string_sprintfa (html, "<a href=\"%s\" style=\"text-decoration: none; color: black;\"><b>", u);
if (charset) {
char *tmp = e_utf8_from_charset_string (charset, t);
g_string_append (html, tmp);
g_free (tmp);
} else {
g_string_append (html, t);
}
if (*u != '\0')
g_string_append (html, "</a>");
g_string_append (html, "</b></dt>");
if (r->shown == FALSE) {
g_string_append (html, "</dl>");
return;
}
g_string_append (html, "<ul>");
items = MIN (limit, items);
for (i = 0; i < items; i++) {
char *p = layer_find (item[i]->children, "title", "No information");
tmp = g_strdup_printf ("<LI><font size=\"-1\"><A href=\"%s\" style=\"text-decoration: none; color: black;\">\n", layer_find_url(item[i]->children, "link", ""));
g_string_append (html, tmp);
g_free (tmp);
if (charset) {
char *tmp = e_utf8_from_charset_string (charset, p);
g_string_append (html, tmp);
g_free (tmp);
} else {
g_string_append (html, p);
}
g_string_append (html, "\n</A></font></li>");
}
g_string_append (html, "</UL>");
}
static void
display_doc (RDF *r)
{
GString *html;
html = g_string_new ("<dl><dt><img src=\"ico-rdf.png\" align=\"middle\" "
"width=\"48\" height=\"48\">");
if (r->cache == NULL) {
g_string_append_printf (html, "<b>%s:</b><br>%s</dt>",
_("Error downloading RDF"),
r->uri);
} else {
tree_walk (xmlDocGetRootElement (r->cache), r, html);
}
g_free (r->html);
g_string_append (html, "</dl>");
r->html = html->str;
g_string_free (html, FALSE);
e_summary_draw (r->summary);
}
static void
message_finished (SoupMessage *msg,
gpointer userdata)
{
xmlDocPtr doc;
RDF *r = (RDF *) userdata;
if (SOUP_MESSAGE_IS_ERROR (msg)) {
g_warning ("Message failed: %d\n%s", msg->errorcode,
msg->errorphrase);
r->cache = NULL;
r->message = NULL;
display_doc (r);
return;
}
if (r->cache != NULL) {
xmlFreeDoc (r->cache);
r->cache = NULL;
}
xmlSubstituteEntitiesDefaultValue = 1;
doc = xmlParseMemory (msg->response.body, msg->response.length);
r->cache = doc;
r->message = NULL;
/* Display it */
display_doc (r);
}
gboolean
e_summary_rdf_update (ESummary *summary)
{
GList *r;
if (summary->rdf->online == FALSE) {
g_warning ("%s: Repolling but offline", G_GNUC_FUNCTION);
return TRUE;
}
for (r = summary->rdf->rdfs; r; r = r->next) {
SoupContext *context;
RDF *rdf = r->data;
if (rdf->message) {
continue;
}
context = soup_context_get (rdf->uri);
if (context == NULL) {
g_warning ("Invalid URL: %s", rdf->uri);
soup_context_unref (context);
continue;
}
rdf->message = soup_message_new (context, SOUP_METHOD_GET);
soup_context_unref (context);
soup_message_queue (rdf->message, message_finished, rdf);
}
return TRUE;
}
static void
e_summary_rdf_add_uri (ESummary *summary,
const char *uri)
{
RDF *r;
r = g_new0 (RDF, 1);
r->summary = summary;
r->uri = g_strdup (uri);
r->shown = TRUE;
summary->rdf->rdfs = g_list_append (summary->rdf->rdfs, r);
}
static void
e_summary_rdf_protocol (ESummary *summary,
const char *uri,
void *closure)
{
RDF *r;
int a;
a = atoi (uri + 6);
if (a == 0) {
g_warning ("A == 0");
return;
}
r = (RDF *) GINT_TO_POINTER (a);
r->shown = !r->shown;
display_doc (r);
}
static int
e_summary_rdf_count (ESummary *summary,
void *data)
{
ESummaryRDF *rdf;
GList *p;
int count = 0;
rdf = summary->rdf;
for (p = rdf->rdfs; p; p = p->next) {
RDF *r = p->data;
if (r->message != NULL) {
count++;
}
}
return count;
}
static ESummaryConnectionData *
make_connection (RDF *r)
{
ESummaryConnectionData *d;
d = g_new (ESummaryConnectionData, 1);
d->hostname = g_strdup (r->uri);
d->type = g_strdup (_("News Feed"));
return d;
}
static GList *
e_summary_rdf_add (ESummary *summary,
void *data)
{
ESummaryRDF *rdf;
GList *p, *connections = NULL;
rdf = summary->rdf;
for (p = rdf->rdfs; p; p = p->next) {
RDF *r = p->data;
if (r->message != NULL) {
ESummaryConnectionData *d;
d = make_connection (r);
connections = g_list_prepend (connections, d);
}
}
return connections;
}
static void
rdf_free (RDF *r)
{
/* Stop the download */
if (r->message) {
soup_message_cancel (r->message);
}
g_free (r->uri);
g_free (r->html);
if (r->cache) {
xmlFreeDoc (r->cache);
}
g_free (r);
}
static void
e_summary_rdf_set_online (ESummary *summary,
GNOME_Evolution_OfflineProgressListener progress,
gboolean online,
void *data)
{
ESummaryRDF *rdf;
GList *p;
rdf = summary->rdf;
if (rdf->online == online) {
return;
}
if (online == TRUE) {
e_summary_rdf_update (summary);
if (summary->preferences->rdf_refresh_time != 0)
rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000,
(GtkFunction) e_summary_rdf_update,
summary);
} else {
for (p = rdf->rdfs; p; p = p->next) {
RDF *r;
r = p->data;
if (r->message) {
soup_message_cancel (r->message);
r->message = NULL;
}
}
gtk_timeout_remove (rdf->timeout);
rdf->timeout = 0;
}
rdf->online = online;
}
void
e_summary_rdf_init (ESummary *summary)
{
ESummaryPrefs *prefs;
ESummaryRDF *rdf;
ESummaryConnection *connection;
GSList *p;
int timeout;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
prefs = summary->preferences;
g_assert (prefs != NULL);
rdf = g_new0 (ESummaryRDF, 1);
summary->rdf = rdf;
connection = g_new (ESummaryConnection, 1);
connection->count = e_summary_rdf_count;
connection->add = e_summary_rdf_add;
connection->set_online = e_summary_rdf_set_online;
connection->closure = NULL;
connection->callback = NULL;
connection->callback_closure = NULL;
rdf->connection = connection;
rdf->online = TRUE;
e_summary_add_online_connection (summary, connection);
e_summary_add_protocol_listener (summary, "rdf", e_summary_rdf_protocol, rdf);
for (p = prefs->rdf_urls; p; p = p->next) {
e_summary_rdf_add_uri (summary, p->data);
}
timeout = prefs->rdf_refresh_time;
e_summary_rdf_update (summary);
if (rdf->timeout == 0)
rdf->timeout = 0;
else
rdf->timeout = gtk_timeout_add (timeout * 1000,
(GtkFunction) e_summary_rdf_update, summary);
return;
}
void
e_summary_rdf_reconfigure (ESummary *summary)
{
ESummaryRDF *rdf;
GList *old, *p;
GSList *sp;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
rdf = summary->rdf;
/* Stop timeout */
if (rdf->timeout != 0) {
gtk_timeout_remove (rdf->timeout);
rdf->timeout = 0;
}
old = rdf->rdfs;
rdf->rdfs = NULL;
for (p = old; p; p = p->next) {
RDF *r;
r = p->data;
rdf_free (r);
}
g_list_free (old);
for (sp = summary->preferences->rdf_urls; sp; sp = sp->next) {
e_summary_rdf_add_uri (summary, sp->data);
}
if (summary->preferences->rdf_refresh_time != 0)
rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000,
(GtkFunction) e_summary_rdf_update, summary);
e_summary_rdf_update (summary);
}
void
e_summary_rdf_free (ESummary *summary)
{
ESummaryRDF *rdf;
GList *p;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
rdf = summary->rdf;
if (rdf->timeout != 0)
gtk_timeout_remove (rdf->timeout);
for (p = rdf->rdfs; p; p = p->next) {
RDF *r = p->data;
rdf_free (r);
}
g_list_free (rdf->rdfs);
g_free (rdf->html);
e_summary_remove_online_connection (summary, rdf->connection);
g_free (rdf->connection);
g_free (rdf);
summary->rdf = NULL;
}

View File

@ -1,36 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-rdf.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifndef __E_SUMMARY_RDF_H__
#define __E_SUMMARY_RDF_H__
#include "e-summary-type.h"
typedef struct _ESummaryRDF ESummaryRDF;
char *e_summary_rdf_get_html (ESummary *summary);
void e_summary_rdf_init (ESummary *summary);
void e_summary_rdf_reconfigure (ESummary *summary);
void e_summary_rdf_free (ESummary *summary);
gboolean e_summary_rdf_update (ESummary *summary);
#endif

View File

@ -1,663 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximian, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkenums.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkimage.h>
#include <gtk/gtklabel.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkvbox.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/e-table/e-table-header.h>
#include <gal/e-table/e-table-header-item.h>
#include <gal/e-table/e-table-item.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-tree.h>
#include <gal/e-table/e-table.h>
#include <gal/e-table/e-tree.h>
#include <gal/e-table/e-tree-scrolled.h>
#include <gal/e-table/e-tree-memory.h>
#include <gal/e-table/e-tree-memory-callbacks.h>
#include <gal/e-table/e-tree-table-adapter.h>
#include <libgnome/gnome-i18n.h>
#include "e-summary-shown.h"
#define COLS 1
/* Needs to be filled in before use */
#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-focus=\"true\"> \
<ETableColumn model_col=\"0\" _title=\"%s\" resizable=\"true\" cell=\"tree-string\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping><leaf column=\"0\" ascending=\"true\"/></grouping> \
</ETableState> \
</ETableSpecification>"
#define PARENT_TYPE (gtk_hbox_get_type ())
static GtkObjectClass *e_summary_shown_parent_class;
enum {
ITEM_CHANGED,
SELECTION_CHANGED,
LAST_SIGNAL
};
static guint32 shown_signals[LAST_SIGNAL] = { 0 };
typedef struct _TableData {
ETreeModel *etm;
ETreePath *root;
GtkWidget *etable;
GSList *contents;
} TableData;
struct _ESummaryShownPrivate {
TableData *all, *shown;
GtkWidget *add, *remove;
};
static GdkPixbuf *
icon_at (ETreeModel *etm,
ETreePath path,
void *model_data)
{
return NULL;
}
static int
column_count (ETreeModel *etm,
void *data)
{
return COLS;
}
static void *
duplicate_value (ETreeModel *etm,
int col,
const void *value,
void *data)
{
return g_strdup (value);
}
static void
free_value (ETreeModel *etm,
int col,
void *value,
void *data)
{
g_free (value);
}
static void *
initialise_value (ETreeModel *etm,
int col,
void *data)
{
return g_strdup ("");
}
static gboolean
value_is_empty (ETreeModel *etm,
int col,
const void *value,
void *data)
{
return !(value && *(char *)value);
}
static char *
value_to_string (ETreeModel *etm,
int col,
const void *value,
void *data)
{
return g_strdup (value);
}
static void *
value_at (ETreeModel *etm,
ETreePath path,
int col,
void *model_data)
{
GHashTable *model = model_data;
ESummaryShownModelEntry *entry;
if (e_tree_model_node_is_root (etm, path)) {
return "<Root>";
}
entry = g_hash_table_lookup (model, path);
if (entry == NULL) {
return "<None>";
} else {
return entry->name;
}
}
static gboolean
is_editable (ETreeModel *etm,
ETreePath path,
int col,
void *model_data)
{
return FALSE;
}
static void
destroy (GtkObject *object)
{
ESummaryShown *shown;
ESummaryShownPrivate *priv;
shown = E_SUMMARY_SHOWN (object);
priv = shown->priv;
if (priv == NULL) {
return;
}
g_free (priv);
shown->priv = NULL;
e_summary_shown_parent_class->destroy (object);
}
static void
e_summary_shown_class_init (GtkObjectClass *object_class)
{
object_class->destroy = destroy;
e_summary_shown_parent_class = gtk_type_class (PARENT_TYPE);
shown_signals[ITEM_CHANGED] = gtk_signal_new ("item-changed",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (ESummaryShownClass, item_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
shown_signals[SELECTION_CHANGED] = gtk_signal_new ("selection-changed",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (ESummaryShownClass, selection_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
}
static gboolean
is_location_in_shown (ESummaryShown *shown,
const char *location)
{
GSList *p;
for (p = shown->priv->shown->contents; p; p = p->next) {
ESummaryShownModelEntry *entry = p->data;
if (entry->location == NULL) {
continue;
}
if (strcmp (entry->location, location) == 0) {
return TRUE;
}
}
return FALSE;
}
struct _CountData {
ESummaryShown *shown;
GList *selected_list;
int count;
};
static void
real_selected_count (ETreePath path,
gpointer data)
{
ESummaryShownModelEntry *entry;
struct _CountData *cd = data;
entry = g_hash_table_lookup (cd->shown->all_model, path);
g_return_if_fail (entry != NULL);
cd->selected_list = g_list_prepend (cd->selected_list, path);
if (entry->showable == FALSE) {
return;
}
if (is_location_in_shown (cd->shown, entry->location)) {
return;
}
cd->count++;
}
static void
all_selection_changed (ETree *et,
ESummaryShown *shown)
{
ESelectionModel *esm;
int count;
esm = e_tree_get_selection_model (et);
count = e_selection_model_selected_count (esm);
if (count == 0) {
gtk_widget_set_sensitive (shown->priv->add, FALSE);
gtk_signal_emit (GTK_OBJECT (shown), shown_signals[SELECTION_CHANGED], 0, NULL);
} else {
struct _CountData *cd;
cd = g_new (struct _CountData, 1);
cd->shown = shown;
cd->selected_list = NULL;
cd->count = 0;
e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
real_selected_count, cd);
if (cd->count != 0) {
gtk_widget_set_sensitive (shown->priv->add, TRUE);
} else {
gtk_widget_set_sensitive (shown->priv->add, FALSE);
}
gtk_signal_emit (GTK_OBJECT (shown), shown_signals[SELECTION_CHANGED], cd->selected_list);
g_list_free (cd->selected_list);
g_free (cd);
}
}
static void
shown_selection_changed (ETree *et,
ESummaryShown *shown)
{
ESelectionModel *esm;
int count;
esm = e_tree_get_selection_model (et);
count = e_selection_model_selected_count (esm);
if (count == 0) {
gtk_widget_set_sensitive (shown->priv->remove, FALSE);
} else {
gtk_widget_set_sensitive (shown->priv->remove, TRUE);
}
}
static void
maybe_move_to_shown (ETreePath path,
gpointer closure)
{
gpointer *pair = closure;
ESummaryShown *shown = pair[0];
GList **list = pair[1];
ESummaryShownModelEntry *entry, *new_entry;
entry = g_hash_table_lookup (shown->all_model, path);
g_return_if_fail (entry != NULL);
/* Check is the entry can be shown */
if (entry->showable == FALSE) {
return;
}
/* check if the entry is already in the shown list */
if (is_location_in_shown (shown, entry->location) == TRUE) {
return;
}
new_entry = g_new (ESummaryShownModelEntry, 1);
new_entry->name = g_strdup (entry->name);
new_entry->location = g_strdup (entry->location);
new_entry->showable = entry->showable;
new_entry->ref_count = 0;
*list = g_list_prepend (*list, new_entry);
}
static void
add_clicked (GtkWidget *button,
ESummaryShown *shown)
{
ESelectionModel *esm;
ETree *et;
gpointer pair[2];
GList *list = NULL;
GList *iterator;
et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->all->etable));
esm = e_tree_get_selection_model (et);
pair[0] = shown;
pair[1] = &list;
e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
maybe_move_to_shown, pair);
for (iterator = list; iterator; iterator = iterator->next) {
ESummaryShownModelEntry *new_entry = iterator->data;
e_summary_shown_add_node (shown, FALSE, new_entry, NULL, FALSE, NULL);
}
g_list_free (list);
gtk_signal_emit (GTK_OBJECT (shown), shown_signals[ITEM_CHANGED]);
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
}
static void
remove_from_shown (ETreePath path,
gpointer closure)
{
gpointer *pair = closure;
ESummaryShown *shown = pair[0];
GList **list = pair[1];
ESummaryShownModelEntry *entry;
entry = g_hash_table_lookup (shown->shown_model, path);
g_return_if_fail (entry != NULL);
*list = g_list_prepend (*list, entry);
}
static void
remove_clicked (GtkWidget *button,
ESummaryShown *shown)
{
ESelectionModel *esm;
ETree *et;
gpointer pair[2];
GList *list = NULL;
GList *iterator;
et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->shown->etable));
esm = e_tree_get_selection_model (et);
pair[0] = shown;
pair[1] = &list;
e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
remove_from_shown, pair);
list = g_list_reverse (list);
for (iterator = list; iterator; iterator = iterator->next) {
ESummaryShownModelEntry *entry = iterator->data;
e_summary_shown_remove_node (shown, FALSE, entry);
}
g_list_free (list);
gtk_signal_emit (GTK_OBJECT (shown), shown_signals[ITEM_CHANGED]);
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
}
static TableData *
make_table (GHashTable *data_model,
const char *title,
GtkSignalFunc callback,
gpointer closure)
{
TableData *td;
ETreeMemory *etmm;
ETree *tree;
char *real_spec;
td = g_new (TableData, 1);
td->etm = e_tree_memory_callbacks_new (icon_at,
column_count,
NULL,
NULL,
NULL,
NULL,
value_at,
NULL,
is_editable,
duplicate_value,
free_value,
initialise_value,
value_is_empty,
value_to_string,
data_model);
etmm = E_TREE_MEMORY (td->etm);
e_tree_memory_set_expanded_default (etmm, FALSE);
td->root = e_tree_memory_node_insert (etmm, NULL, 0, NULL);
real_spec = g_strdup_printf (SPEC, title);
td->etable = e_tree_scrolled_new (td->etm, NULL, real_spec, NULL);
g_free (real_spec);
tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (td->etable));
e_tree_root_node_set_visible (tree, FALSE);
g_signal_connect (tree, "selection-change", callback, closure);
td->contents = NULL;
return td;
}
static void
e_summary_shown_init (ESummaryShown *shown)
{
ESummaryShownPrivate *priv;
GtkWidget *vbox;
GtkWidget *align;
gtk_box_set_spacing (GTK_BOX (shown), 3);
shown->shown_model = g_hash_table_new (NULL, NULL);
shown->all_model = g_hash_table_new (NULL, NULL);
priv = g_new (ESummaryShownPrivate, 1);
shown->priv = priv;
priv->all = make_table (shown->all_model, _("All"), G_CALLBACK (all_selection_changed), shown);
gtk_box_pack_start (GTK_BOX (shown), priv->all->etable, TRUE, TRUE, 2);
gtk_widget_show (priv->all->etable);
vbox = gtk_vbox_new (TRUE, 9);
align = gtk_alignment_new (.5, .5, .5, 0.0);
gtk_container_add (GTK_CONTAINER (align), vbox);
gtk_box_pack_start (GTK_BOX (shown), align, FALSE, FALSE, 3);
/* Fixme: nice GFX version */
priv->add = gtk_button_new_from_stock (GTK_STOCK_ADD);
gtk_widget_set_sensitive (priv->add, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), priv->add, TRUE, FALSE, 0);
g_signal_connect (priv->add, "clicked", G_CALLBACK (add_clicked), shown);
/* Fixme: Ditto */
priv->remove = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
gtk_widget_set_sensitive (priv->remove, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), priv->remove, TRUE, FALSE, 0);
g_signal_connect (priv->remove, "clicked", G_CALLBACK (remove_clicked), shown);
gtk_widget_show_all (align);
priv->shown = make_table (shown->shown_model, _("Shown"), G_CALLBACK (shown_selection_changed), shown);
gtk_box_pack_start (GTK_BOX (shown), priv->shown->etable, TRUE, TRUE, 2);
gtk_widget_show (priv->shown->etable);
}
E_MAKE_TYPE (e_summary_shown, "ESummaryShown", ESummaryShown,
e_summary_shown_class_init, e_summary_shown_init, PARENT_TYPE);
GtkWidget *
e_summary_shown_new (void)
{
ESummaryShown *shown;
shown = gtk_type_new (e_summary_shown_get_type ());
return GTK_WIDGET (shown);
}
ETreePath
e_summary_shown_add_node (ESummaryShown *shown,
gboolean all,
ESummaryShownModelEntry *entry,
ETreePath parent,
gboolean expanded,
gpointer data)
{
TableData *td;
ETreePath path;
ETreeMemory *etmm;
ETree *tree;
GHashTable *model;
g_return_val_if_fail (IS_E_SUMMARY_SHOWN (shown), NULL);
if (all == TRUE) {
td = shown->priv->all;
model = shown->all_model;
} else {
td = shown->priv->shown;
model = shown->shown_model;
}
if (parent == NULL) {
parent = td->root;
}
etmm = E_TREE_MEMORY (td->etm);
path = e_tree_memory_node_insert (etmm, parent, -1, data);
tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (td->etable));
if (e_tree_model_get_expanded_default (E_TREE_MODEL(etmm)) != expanded)
e_tree_node_set_expanded (tree, path, expanded);
entry->path = path;
g_hash_table_insert (model, path, entry);
if (all == FALSE) {
/* Add the location to the list */
td->contents = g_slist_prepend (td->contents, entry);
}
return path;
}
void
e_summary_shown_remove_node (ESummaryShown *shown,
gboolean all,
ESummaryShownModelEntry *entry)
{
TableData *td;
GHashTable *model;
ETreeMemory *etmm;
g_return_if_fail (IS_E_SUMMARY_SHOWN (shown));
if (all == TRUE) {
td = shown->priv->all;
model = shown->all_model;
} else {
td = shown->priv->shown;
model = shown->shown_model;
}
etmm = E_TREE_MEMORY (td->etm);
e_tree_memory_node_remove (etmm, entry->path);
g_hash_table_remove (model, entry->path);
if (all == FALSE) {
td->contents = g_slist_remove (td->contents, entry);
}
}
void
e_summary_shown_freeze (ESummaryShown *shown)
{
g_return_if_fail (IS_E_SUMMARY_SHOWN (shown));
e_tree_memory_freeze (E_TREE_MEMORY (shown->priv->all->etm));
e_tree_memory_freeze (E_TREE_MEMORY (shown->priv->shown->etm));
}
void
e_summary_shown_thaw (ESummaryShown *shown)
{
g_return_if_fail (IS_E_SUMMARY_SHOWN (shown));
e_tree_memory_thaw (E_TREE_MEMORY (shown->priv->all->etm));
e_tree_memory_thaw (E_TREE_MEMORY (shown->priv->shown->etm));
}
static void
make_list (ETreePath path,
gpointer data)
{
GList **list = data;
*list = g_list_prepend (*list, path);
}
GList *
e_summary_shown_get_selection (ESummaryShown *shown,
gboolean all)
{
ETree *et;
ESelectionModel *esm;
GList *list = NULL;
if (all) {
et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->all->etable));
} else {
et = e_tree_scrolled_get_tree (E_TREE_SCROLLED (shown->priv->shown->etable));
}
esm = e_tree_get_selection_model (et);
e_tree_selection_model_foreach (E_TREE_SELECTION_MODEL (esm),
make_list, &list);
return list;
}

View File

@ -1,83 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __E_SUMMARY_SHOWN_H__
#define __E_SUMMARY_SHOWN_H__
#include <gtk/gtkhbox.h>
#include <glib.h>
#include <gal/e-table/e-tree-memory.h>
#define E_SUMMARY_SHOWN_TYPE (e_summary_shown_get_type ())
#define E_SUMMARY_SHOWN(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_SHOWN_TYPE, ESummaryShown))
#define E_SUMMARY_SHOWN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_SHOWN_TYPE, ESummaryShownClass))
#define IS_E_SUMMARY_SHOWN(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_SHOWN_TYPE))
#define IS_E_SUMMARY_SHOWN_CLASS(klass) (GTK_CHECK_TYPE ((klass), E_SUMMARY_SHOWN_TYPE))
typedef struct _ESummaryShownPrivate ESummaryShownPrivate;
typedef struct _ESummaryShownClass ESummaryShownClass;
typedef struct _ESummaryShown ESummaryShown;
typedef struct _ESummaryShownModelEntry {
ETreePath path;
char *name;
char *location;
gboolean showable;
int ref_count;
gpointer data;
} ESummaryShownModelEntry;
struct _ESummaryShown {
GtkHBox parent;
GHashTable *all_model;
GHashTable *shown_model;
ESummaryShownPrivate *priv;
};
struct _ESummaryShownClass {
GtkHBoxClass parent_class;
void (* item_changed) (ESummaryShown *shown);
void (* selection_changed) (ESummaryShown *shown,
GList *rows);
};
GtkType e_summary_shown_get_type (void);
GtkWidget *e_summary_shown_new (void);
ETreePath e_summary_shown_add_node (ESummaryShown *shown,
gboolean all,
ESummaryShownModelEntry *entry,
ETreePath parent,
gboolean expanded,
gpointer data);
void e_summary_shown_remove_node (ESummaryShown *shown,
gboolean all,
ESummaryShownModelEntry *entry);
void e_summary_shown_freeze (ESummaryShown *shown);
void e_summary_shown_thaw (ESummaryShown *shown);
GList *e_summary_shown_get_selection (ESummaryShown *shown,
gboolean all);
#endif

View File

@ -1,440 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkenums.h>
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/e-table/e-table-header.h>
#include <gal/e-table/e-table-header-item.h>
#include <gal/e-table/e-table-item.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-tree.h>
#include <gal/e-table/e-cell-checkbox.h>
#include <gal/e-table/e-table.h>
#include <gal/e-table/e-tree-scrolled.h>
#include <gal/e-table/e-tree-memory.h>
#include <gal/e-table/e-tree-memory-callbacks.h>
#include <gal/e-table/e-tree-table-adapter.h>
#include <libgnome/gnome-i18n.h>
#include "e-summary-table.h"
#include "e-cell-tri.h"
#define COLS 2
#if 0 /* For translators */
char *headers[COLS] = {
N_("Shown"),
N_("Name")
};
#endif
#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-focus=\"true\" no-headers=\"true\"> \
<ETableColumn model_col=\"0\" _title=\"Shown\" minimum_width=\"20\" resizable=\"false\" cell=\"tricell\" compare=\"integer\"/> \
<ETableColumn model_col=\"1\" _title=\"Name\" resizable=\"true\" minimum-width=\"32\" cell=\"render-name\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<column source=\"1\"/> \
<grouping></grouping> \
</ETableState> \
</ETableSpecification>"
#define PARENT_TYPE (gtk_vbox_get_type ())
static GtkObjectClass *e_summary_table_parent_class;
struct _ESummaryTablePrivate {
GtkWidget *etable;
ETableExtras *extras;
ETreeTableAdapter *adapter;
ETreeModel *etm;
ETreePath root_node;
};
enum {
ITEM_CHANGED,
LAST_SIGNAL
};
static guint32 table_signals[LAST_SIGNAL] = { 0 };
/* ETree callbacks */
static GdkPixbuf *
icon_at (ETreeModel *etm,
ETreePath path,
void *model_data)
{
/* No icon, since the cell tree renderer takes care of +/- */
return NULL;
}
static int
column_count (ETreeModel *etm,
void *data)
{
return COLS;
}
static void *
duplicate_value (ETreeModel *etm,
int col,
const void *value,
void *data)
{
switch (col) {
case 0:
return (void *) value;
case 1:
return g_strdup (value);
default:
g_assert_not_reached ();
}
return NULL;
}
static void
free_value (ETreeModel *etm,
int col,
void *value,
void *data)
{
if (col == 1) {
g_free (value);
}
}
static void *
initialise_value (ETreeModel *etm,
int col,
void *data)
{
switch (col) {
case 0:
return GINT_TO_POINTER (1);
case 1:
return g_strdup ("2");
default:
g_assert_not_reached ();
}
return NULL;
}
static gboolean
value_is_empty (ETreeModel *etm,
int col,
const void *value,
void *data)
{
if (col == 1) {
return !(value && *(char *)value);
}
return FALSE;
}
static char *
value_to_string (ETreeModel *etm,
int col,
const void *value,
void *data)
{
switch (col) {
case 0:
return g_strdup_printf ("%d", GPOINTER_TO_INT (value));
case 1:
return g_strdup (value);
default:
g_assert_not_reached ();
}
return NULL;
}
static void *
value_at (ETreeModel *etm,
ETreePath path,
int col,
void *model_data)
{
GHashTable *table;
ESummaryTable *est = E_SUMMARY_TABLE (model_data);
ESummaryTableModelEntry *entry;
table = est->model;
if (e_tree_model_node_is_root (etm, path)) {
if (col == 1) {
return "<Root>";
} else {
return GINT_TO_POINTER (0);
}
} else {
entry = g_hash_table_lookup (table, path);
g_return_val_if_fail (entry != NULL, NULL);
if (col == 1) {
return entry->name;
} else {
if (entry->editable == TRUE) {
return GINT_TO_POINTER (entry->shown ? 2 : 1);
} else {
return GINT_TO_POINTER (0);
}
}
}
}
static void
set_value_at (ETreeModel *etm,
ETreePath path,
int col,
const void *val,
void *model_data)
{
GHashTable *table;
ESummaryTable *est = E_SUMMARY_TABLE (model_data);
ESummaryTableModelEntry *entry;
if (e_tree_model_node_is_root (etm, path)) {
return;
}
if (col != 0) {
return;
}
table = est->model;
entry = g_hash_table_lookup (table, path);
g_return_if_fail (entry != NULL);
if (entry->editable == TRUE) {
entry->shown = GPOINTER_TO_INT (val) == 1 ? FALSE : TRUE;
g_signal_emit (est, table_signals[ITEM_CHANGED], 0, path);
}
}
static gboolean
is_editable (ETreeModel *etm,
ETreePath path,
int col,
void *model_data)
{
GHashTable *table;
ESummaryTable *est = (ESummaryTable *) model_data;
ESummaryTableModelEntry *entry;
if (e_tree_model_node_is_root (etm, path)) {
return FALSE;
}
if (col == 1) {
return FALSE;
}
table = est->model;
entry = g_hash_table_lookup (table, path);
g_return_val_if_fail (entry != NULL, FALSE);
return entry->editable;
}
/* GtkObject callbacks */
static void
free_model_entry (gpointer key,
gpointer value,
gpointer user_data)
{
ESummaryTableModelEntry *entry;
entry = value;
g_free (entry->location);
g_free (entry->name);
g_free (entry);
}
static void
destroy (GtkObject *object)
{
ESummaryTable *est;
ESummaryTablePrivate *priv;
est = E_SUMMARY_TABLE (object);
priv = est->priv;
if (priv == NULL) {
return;
}
/* What do I need to free? */
g_hash_table_foreach (est->model, free_model_entry, NULL);
g_hash_table_destroy (est->model);
est->model = NULL;
g_free (priv);
est->priv = NULL;
e_summary_table_parent_class->destroy (object);
}
static void
e_summary_table_class_init (GtkObjectClass *object_class)
{
object_class->destroy = destroy;
e_summary_table_parent_class = gtk_type_class (PARENT_TYPE);
table_signals[ITEM_CHANGED] = gtk_signal_new ("item-changed",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (ESummaryTableClass, item_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
}
static void
e_summary_table_init (ESummaryTable *est)
{
ESummaryTablePrivate *priv;
ETreeMemory *etmm;
ECell *cell;
ETree *tree;
priv = g_new (ESummaryTablePrivate, 1);
est->priv = priv;
priv->etm = e_tree_memory_callbacks_new (icon_at,
column_count,
NULL,
NULL,
NULL,
NULL,
value_at,
set_value_at,
is_editable,
duplicate_value,
free_value,
initialise_value,
value_is_empty,
value_to_string,
est);
g_object_ref (priv->etm);
gtk_object_sink (GTK_OBJECT (priv->etm));
etmm = E_TREE_MEMORY (priv->etm);
e_tree_memory_set_expanded_default (etmm, TRUE);
priv->root_node = e_tree_memory_node_insert (etmm, NULL, 0, est);
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
priv->extras = e_table_extras_new ();
e_table_extras_add_cell (priv->extras, "render-name", e_cell_tree_new (NULL, NULL, FALSE, cell));
e_table_extras_add_cell (priv->extras, "tricell", e_cell_tri_new ());
priv->etable = e_tree_scrolled_new (priv->etm, priv->extras, SPEC, NULL);
if (priv->etable == NULL) {
g_warning ("Could not create ETable for ESummaryTable");
return;
}
tree = e_tree_scrolled_get_tree (E_TREE_SCROLLED (priv->etable));
e_tree_root_node_set_visible (tree, FALSE);
gtk_box_pack_start (GTK_BOX (est), GTK_WIDGET (priv->etable),
TRUE, TRUE, 0);
gtk_widget_show (GTK_WIDGET (priv->etable));
}
E_MAKE_TYPE (e_summary_table, "ESummaryTable", ESummaryTable,
e_summary_table_class_init, e_summary_table_init, PARENT_TYPE);
GtkWidget *
e_summary_table_new (GHashTable *model)
{
ESummaryTable *table;
table = gtk_type_new (e_summary_table_get_type ());
table->model = model;
return GTK_WIDGET (table);
}
ETreePath
e_summary_table_add_node (ESummaryTable *table,
ETreePath path,
int position,
gpointer node_data)
{
ETreeMemory *etmm;
ETreePath p;
g_return_val_if_fail (IS_E_SUMMARY_TABLE (table), NULL);
if (path == NULL) {
path = table->priv->root_node;
}
etmm = E_TREE_MEMORY (table->priv->etm);
e_tree_memory_freeze (etmm);
p = e_tree_memory_node_insert (etmm, path, position, node_data);
e_tree_memory_thaw (etmm);
return p;
}
guint
e_summary_table_get_num_children (ESummaryTable *table,
ETreePath path)
{
if (path == NULL) {
return e_tree_model_node_get_children (table->priv->etm,
table->priv->root_node, NULL);
} else {
return e_tree_model_node_get_children (table->priv->etm, path, NULL);
}
}

View File

@ -1,74 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Iain Holmes <iain@ximian.com>
*
* Copyright 2002 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __E_SUMMARY_TABLE_H__
#define __E_SUMMARY_TABLE_H__
#include <gtk/gtkvbox.h>
#include <glib.h>
#include <gal/e-table/e-tree-memory.h>
#define E_SUMMARY_TABLE_TYPE (e_summary_table_get_type ())
#define E_SUMMARY_TABLE(obj) (GTK_CHECK_CAST ((obj), E_SUMMARY_TABLE_TYPE, ESummaryTable))
#define E_SUMMARY_TABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SUMMARY_TABLE_TYPE, ESummaryTableClass))
#define IS_E_SUMMARY_TABLE(obj) (GTK_CHECK_TYPE ((obj), E_SUMMARY_TABLE_TYPE))
#define IS_E_SUMMARY_TABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_SUMMARY_TABLE_TYPE))
typedef struct _ESummaryTablePrivate ESummaryTablePrivate;
typedef struct _ESummaryTableClass ESummaryTableClass;
typedef struct _ESummaryTable ESummaryTable;
typedef struct _ESummaryTableModelEntry {
ETreePath path;
char *location;
gboolean editable;
gboolean removable;
gboolean shown;
char *name;
} ESummaryTableModelEntry;
struct _ESummaryTable {
GtkVBox parent;
GHashTable *model;
ESummaryTablePrivate *priv;
};
struct _ESummaryTableClass {
GtkVBoxClass parent_class;
void (* item_changed) (ESummaryTable *table,
ETreePath path);
};
GtkType e_summary_table_get_type (void);
GtkWidget *e_summary_table_new (GHashTable *model);
ETreePath e_summary_table_add_node (ESummaryTable *est,
ETreePath path,
int position,
gpointer node_data);
guint e_summary_table_get_num_children (ESummaryTable *est,
ETreePath path);
#endif

View File

@ -1,618 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-tasks.c
*
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gnome.h>
#include <gal/widgets/e-unicode.h>
#include "e-summary-tasks.h"
#include "e-summary.h"
#include <cal-client/cal-client.h>
#include <cal-util/timeutil.h>
#include <bonobo/bonobo-event-source.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-listener.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-object.h>
#include <gconf/gconf-client.h>
#define MAX_RELOAD_TRIES 10
struct _ESummaryTasks {
CalClient *client;
char *html;
char *due_today_colour;
char *overdue_colour;
char *default_uri;
GConfClient *gconf_client;
int gconf_value_changed_handler_id;
int cal_open_reload_timeout_id;
int reload_count;
};
const char *
e_summary_tasks_get_html (ESummary *summary)
{
if (summary == NULL) {
return NULL;
}
if (summary->tasks == NULL) {
return NULL;
}
return summary->tasks->html;
}
/* list_sort_merge, and list_sort are copied from GNOME-VFS.
Author: Sven Oliver <sven.over@ob.kamp.net>
Modified by Ettore Perazzoli <ettore@comm2000.it> to let the compare
functions get an additional gpointer parameter.
Included here as using gnome-vfs for 1 20 line function
seems a bit of overkill.
*/
typedef gint (* CalSummaryListCompareFunc) (gconstpointer a,
gconstpointer b,
gpointer data);
static GList *
cal_list_sort_merge (GList *l1,
GList *l2,
CalSummaryListCompareFunc compare_func,
gpointer data)
{
GList list, *l, *lprev;
l = &list;
lprev = NULL;
while (l1 && l2) {
if (compare_func (l1->data, l2->data, data) < 0) {
l->next = l1;
l = l->next;
l->prev = lprev;
lprev = l;
l1 = l1->next;
} else {
l->next = l2;
l = l->next;
l->prev = lprev;
lprev = l;
l2 = l2->next;
}
}
l->next = l1 ? l1 : l2;
l->next->prev = l;
return list.next;
}
static GList *
cal_list_sort (GList *list,
CalSummaryListCompareFunc compare_func,
gpointer data)
{
GList *l1, *l2;
if (!list)
return NULL;
if (!list->next)
return list;
l1 = list;
l2 = list->next;
while ((l2 = l2->next) != NULL) {
if ((l2 = l2->next) == NULL)
break;
l1 = l1->next;
}
l2 = l1->next;
l1->next = NULL;
return cal_list_sort_merge (cal_list_sort (list, compare_func, data),
cal_list_sort (l2, compare_func, data),
compare_func, data);
}
static int
sort_uids (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
icalcomponent *icalcomp_a, *icalcomp_b;
CalComponent *comp_a, *comp_b;
CalClient *client = user_data;
CalClientGetStatus status;
/* let undefined priorities be lowest ones */
int lowest = 10, rv;
int *pri_a, *pri_b;
/* a after b then return > 0 */
status = cal_client_get_object (client, a, &icalcomp_a);
if (status != CAL_CLIENT_GET_SUCCESS)
return -1;
status = cal_client_get_object (client, b, &icalcomp_b);
if (status != CAL_CLIENT_GET_SUCCESS)
return 1;
comp_a = cal_component_new ();
cal_component_set_icalcomponent (comp_a, icalcomp_a);
comp_b = cal_component_new ();
cal_component_set_icalcomponent (comp_b, icalcomp_b);
cal_component_get_priority (comp_a, &pri_a);
cal_component_get_priority (comp_b, &pri_b);
if (pri_a == NULL)
pri_a = &lowest;
if (pri_b == NULL)
pri_b = &lowest;
if (*pri_a == 0) {
*pri_a = lowest;
}
if (*pri_b == 0) {
*pri_b = lowest;
}
rv = *pri_a - *pri_b;
if (pri_a != &lowest)
cal_component_free_priority (pri_a);
if (pri_b != &lowest)
cal_component_free_priority (pri_b);
g_object_unref (comp_a);
g_object_unref (comp_b);
return rv;
}
static GList *
get_todays_uids (ESummary *summary,
CalClient *client,
GList *uids)
{
GList *today = NULL, *p;
time_t todays_end, todays_start, t;
t = time (NULL);
todays_start = time_day_begin_with_zone (t, summary->tz);
todays_end = time_day_end_with_zone (t, summary->tz);
for (p = uids; p; p = p->next) {
char *uid;
icalcomponent *icalcomp;
CalComponent *comp;
CalClientGetStatus status;
CalComponentDateTime due;
icaltimezone *zone;
time_t endt;
uid = p->data;
status = cal_client_get_object (client, uid, &icalcomp);
if (status != CAL_CLIENT_GET_SUCCESS) {
continue;
}
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomp);
cal_component_get_due (comp, &due);
cal_client_get_timezone (client, due.tzid, &zone);
if (due.value != 0) {
icaltimezone_convert_time (due.value, zone, summary->tz);
endt = icaltime_as_timet (*due.value);
if (endt <= todays_end) {
today = g_list_append (today, g_strdup (uid));
}
}
cal_component_free_datetime (&due);
g_object_unref (comp);
}
if (today == NULL) {
return NULL;
}
today = cal_list_sort (today, sort_uids, client);
return today;
}
static const char *
get_task_colour (ESummary *summary,
CalClient *client,
const char *uid)
{
icalcomponent *icalcomp;
CalComponent *comp;
CalClientGetStatus status;
CalComponentDateTime due;
icaltimezone *zone;
char *ret;
time_t end_t, t, todays_start, todays_end;
t = time (NULL);
todays_start = time_day_begin_with_zone (t, summary->tz);
todays_end = time_day_end_with_zone (t, summary->tz);
status = cal_client_get_object (client, uid, &icalcomp);
if (status != CAL_CLIENT_GET_SUCCESS) {
return "black";
}
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomp);
cal_component_get_due (comp, &due);
cal_client_get_timezone (client, due.tzid, &zone);
if (due.value != 0) {
icaltimezone_convert_time (due.value, zone, summary->tz);
end_t = icaltime_as_timet (*due.value);
if (end_t >= todays_start && end_t <= todays_end) {
ret = summary->tasks->due_today_colour;
} else if (end_t < t) {
ret = summary->tasks->overdue_colour;
} else {
ret = "black";
}
} else {
ret = "black";
}
cal_component_free_datetime (&due);
g_object_unref (comp);
return (const char *)ret;
}
static gboolean
generate_html (gpointer data)
{
ESummary *summary = data;
ESummaryTasks *tasks = summary->tasks;
GList *uids, *l;
GString *string;
char *tmp;
time_t t;
if (cal_client_get_load_state (tasks->client) != CAL_CLIENT_LOAD_LOADED)
return FALSE;
/* Set the default timezone on the server. */
if (summary->tz) {
cal_client_set_default_timezone (tasks->client,
summary->tz);
}
t = time (NULL);
uids = cal_client_get_uids (tasks->client, CALOBJ_TYPE_TODO);
if (summary->preferences->show_tasks == E_SUMMARY_CALENDAR_TODAYS_TASKS && uids != NULL) {
GList *tmp;
tmp = get_todays_uids (summary, tasks->client, uids);
cal_obj_uid_list_free (uids);
uids = tmp;
}
if (uids == NULL) {
g_free (tasks->html);
tasks->html = g_strconcat ("<dl><dt><img src=\"myevo-post-it.png\" align=\"middle\" "
"alt=\"\" width=\"48\" height=\"48\"> "
"<b><a href=\"", tasks->default_uri, "\">",
_("Tasks"),
"</a></b></dt><dd><b>", _("No tasks"), "</b></dd></dl>",
NULL);
return FALSE;
} else {
uids = cal_list_sort (uids, sort_uids, tasks->client);
string = g_string_new (NULL);
g_string_sprintf (string, "<dl><dt><img src=\"myevo-post-it.png\" align=\"middle\" "
"alt=\"\" width=\"48\" height=\"48\"> <b><a href=\"%s\">", tasks->default_uri);
g_string_append (string, _("Tasks"));
g_string_append (string, "</a></b></dt><dd>");
for (l = uids; l; l = l->next) {
char *uid;
icalcomponent *icalcomp;
CalComponent *comp;
CalComponentText text;
CalClientGetStatus status;
struct icaltimetype *completed;
const char *colour;
uid = l->data;
status = cal_client_get_object (tasks->client, uid, &icalcomp);
if (status != CAL_CLIENT_GET_SUCCESS) {
continue;
}
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomp);
cal_component_get_summary (comp, &text);
cal_component_get_completed (comp, &completed);
colour = get_task_colour (summary, tasks->client, uid);
if (completed == NULL) {
tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.png\" "
"alt=\"\" width=\"16\" height=\"16\"> &#160; "
"<a href=\"tasks:/%s\"><font size=\"-1\" color=\"%s\">%s</font></a><br>",
uid, colour ? colour : _("blue"), text.value ? text.value : _("(No Description)"));
} else {
#if 0
tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.xpm\" "
"alt=\"\" width=\"16\" height=\"16\"> &#160; "
"<font size=\"-1\"><strike><a href=\"evolution:/local/Tasks\">%s</a></strike></font><br>",
text.value);
#endif
cal_component_free_icaltimetype (completed);
g_object_unref (comp);
continue;
}
g_object_unref (comp);
g_string_append (string, tmp);
g_free (tmp);
}
cal_obj_uid_list_free (uids);
g_string_append (string, "</dd></dl>");
}
if (tasks->html) {
g_free (tasks->html);
}
tasks->html = string->str;
g_string_free (string, FALSE);
e_summary_draw (summary);
return FALSE;
}
static gboolean
cal_open_reload_timeout (void *data)
{
ESummary *summary = (ESummary *) data;
summary->tasks->cal_open_reload_timeout_id = 0;
if (++ summary->tasks->reload_count >= MAX_RELOAD_TRIES) {
summary->tasks->reload_count = 0;
return FALSE;
}
cal_client_open_default_tasks (summary->tasks->client, FALSE);
return FALSE;
}
static void
cal_opened_cb (CalClient *client,
CalClientOpenStatus status,
ESummary *summary)
{
if (status == CAL_CLIENT_OPEN_SUCCESS)
g_idle_add (generate_html, summary);
else
summary->tasks->cal_open_reload_timeout_id = g_timeout_add (1000,
cal_open_reload_timeout,
summary);
}
static void
obj_changed_cb (CalClient *client,
const char *uid,
gpointer data)
{
g_idle_add (generate_html, data);
}
static void
e_summary_tasks_protocol (ESummary *summary,
const char *uri,
void *closure)
{
ESummaryTasks *tasks;
CORBA_Environment ev;
const char *comp_uri;
GNOME_Evolution_Calendar_CompEditorFactory factory;
tasks = (ESummaryTasks *) closure;
comp_uri = cal_client_get_uri (tasks->client);
/* Get the factory */
CORBA_exception_init (&ev);
factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", 0, NULL, &ev);
if (BONOBO_EX (&ev)) {
g_message ("%s: Could not activate the component editor factory (%s)",
G_GNUC_FUNCTION, CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
return;
}
GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, comp_uri, (char *)uri + 7, &ev);
if (BONOBO_EX (&ev)) {
g_message ("%s: Execption while editing the component (%s)",
G_GNUC_FUNCTION, CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
bonobo_object_release_unref (factory, NULL);
}
static void
setup_task_folder (ESummary *summary)
{
ESummaryTasks *tasks;
tasks = summary->tasks;
g_assert (tasks != NULL);
g_assert (tasks->gconf_client != NULL);
if (tasks->cal_open_reload_timeout_id != 0) {
g_source_remove (tasks->cal_open_reload_timeout_id);
tasks->cal_open_reload_timeout_id = 0;
tasks->reload_count = 0;
}
g_free (tasks->due_today_colour);
g_free (tasks->overdue_colour);
g_free (tasks->default_uri);
tasks->due_today_colour = gconf_client_get_string (tasks->gconf_client,
"/apps/evolution/calendar/tasks/colors/due_today", NULL);
if (!tasks->due_today_colour)
tasks->due_today_colour = g_strdup ("blue");
tasks->overdue_colour = gconf_client_get_string (tasks->gconf_client,
"/apps/evolution/calendar/tasks/colors/overdue", NULL);
if (!tasks->overdue_colour)
tasks->overdue_colour = g_strdup ("red");
tasks->default_uri = gconf_client_get_string (tasks->gconf_client,
"/apps/evolution/shell/default_folders/tasks_path", NULL);
if (tasks->client != NULL)
g_object_unref (tasks->client);
tasks->client = cal_client_new ();
if (tasks->client == NULL) {
g_warning ("Error making the client");
return;
}
g_signal_connect (tasks->client, "cal-opened", G_CALLBACK (cal_opened_cb), summary);
g_signal_connect (tasks->client, "obj-updated", G_CALLBACK (obj_changed_cb), summary);
g_signal_connect (tasks->client, "obj-removed", G_CALLBACK (obj_changed_cb), summary);
if (! cal_client_open_default_tasks (tasks->client, FALSE))
g_message ("Open tasks failed");
}
static void
gconf_client_value_changed_cb (GConfClient *gconf_client,
const char *key,
GConfValue *value,
void *user_data)
{
setup_task_folder (E_SUMMARY (user_data));
generate_html (user_data);
}
static void
setup_gconf_client (ESummary *summary)
{
ESummaryTasks *tasks;
tasks = summary->tasks;
g_assert (tasks != NULL);
tasks->gconf_client = gconf_client_get_default ();
gconf_client_add_dir (tasks->gconf_client, "/apps/evolution/calendar/tasks/colors", FALSE, NULL);
gconf_client_add_dir (tasks->gconf_client, "/apps/evolution/shell/default_folders", FALSE, NULL);
tasks->gconf_value_changed_handler_id
= g_signal_connect (tasks->gconf_client, "value_changed",
G_CALLBACK (gconf_client_value_changed_cb), summary);
}
void
e_summary_tasks_init (ESummary *summary)
{
ESummaryTasks *tasks;
g_return_if_fail (summary != NULL);
tasks = g_new0 (ESummaryTasks, 1);
summary->tasks = tasks;
setup_gconf_client (summary);
setup_task_folder (summary);
e_summary_add_protocol_listener (summary, "tasks", e_summary_tasks_protocol, tasks);
}
void
e_summary_tasks_reconfigure (ESummary *summary)
{
setup_task_folder (summary);
generate_html (summary);
}
void
e_summary_tasks_free (ESummary *summary)
{
ESummaryTasks *tasks;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
tasks = summary->tasks;
if (tasks->cal_open_reload_timeout_id != 0)
g_source_remove (tasks->cal_open_reload_timeout_id);
g_object_unref (tasks->client);
g_free (tasks->html);
g_free (tasks->due_today_colour);
g_free (tasks->overdue_colour);
g_free (tasks->default_uri);
if (tasks->gconf_value_changed_handler_id != 0)
g_signal_handler_disconnect (tasks->gconf_client,
tasks->gconf_value_changed_handler_id);
g_object_unref (tasks->gconf_client);
g_free (tasks);
summary->tasks = NULL;
}

View File

@ -1,35 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-tasks.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifndef __E_SUMMARY_TASKS_H__
#define __E_SUMMARY_TASKS_H__
#include "e-summary-type.h"
typedef struct _ESummaryTasks ESummaryTasks;
const char *e_summary_tasks_get_html (ESummary *summary);
void e_summary_tasks_init (ESummary *summary);
void e_summary_tasks_reconfigure (ESummary *summary);
void e_summary_tasks_free (ESummary *summary);
#endif

View File

@ -1,28 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-summary-type.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Iain Holmes
*/
#ifndef __E_SUMMARY_TYPE_H__
#define __E_SUMMARY_TYPE_H__
typedef struct _ESummary ESummary;
#endif

Some files were not shown because too many files have changed in this diff Show More