diff options
-rw-r--r-- | shell/ChangeLog | 14 | ||||
-rw-r--r-- | shell/e-shell.c | 117 | ||||
-rw-r--r-- | shell/e-shell.h | 24 |
3 files changed, 55 insertions, 100 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 13215a7b9d..0026253fec 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,19 @@ 2001-06-24 Ettore Perazzoli <ettore@ximian.com> + * e-shell.c: New member `iid' in EShellPrivate. + (init): Init to NULL. + (e_shell_construct): Set it to the value of the @iid argument. + (destroy): Unregister that IID. + (register_shell): Removed. + (e_shell_construct): Just do all the work here. The function was + too simple to really be useful as separate. + + * e-shell.c, e-shell.h: Changed to derive from BonoboXObject + instead of deriving from BonoboObject and doing all the nasty + CORBA work by hand. + +2001-06-24 Ettore Perazzoli <ettore@ximian.com> + * evolution-test-component.c (activity_client_clicked_callback): New callback for the "clicked" signal on the EActivityClient. Just spit out a warning now, for testing purposes. diff --git a/shell/e-shell.c b/shell/e-shell.c index de38dbcdfc..ad7da57b9f 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -58,10 +58,13 @@ #include "importer/intelligent.h" -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class = NULL; +#define PARENT_TYPE bonobo_x_object_get_type () +static BonoboXObjectClass *parent_class = NULL; struct _EShellPrivate { + /* IID for registering the object on OAF. */ + char *iid; + char *local_directory; GList *views; @@ -167,31 +170,6 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_ /* CORBA interface implementation. */ -static POA_GNOME_Evolution_Shell__vepv shell_vepv; - -static POA_GNOME_Evolution_Shell * -create_servant (void) -{ - POA_GNOME_Evolution_Shell *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_Shell *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &shell_vepv; - - CORBA_exception_init (&ev); - - POA_GNOME_Evolution_Shell__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_ShellComponent impl_Shell_getComponentByType (PortableServer_Servant servant, const CORBA_char *type, @@ -334,21 +312,6 @@ impl_Shell_createStorageSetView (PortableServer_Servant servant, } -/* OAF registration. */ - -static OAF_RegistrationResult -register_shell (EShell *shell, - const char *iid) -{ - CORBA_Object corba_object; - - /* FIXME: Multi-display stuff. */ - - corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - return oaf_active_server_register (iid, corba_object); -} - - /* Set up the ::Activity interface. */ static void @@ -605,6 +568,9 @@ destroy (GtkObject *object) shell = E_SHELL (object); priv = shell->priv; + if (priv->iid != NULL) + oaf_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (shell))); + g_free (priv->local_directory); if (priv->storage_set != NULL) @@ -660,34 +626,10 @@ destroy (GtkObject *object) /* Initialization. */ static void -corba_class_init (void) -{ - POA_GNOME_Evolution_Shell__vepv *vepv; - POA_GNOME_Evolution_Shell__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_Shell__epv, 1); - epv->getComponentByType = impl_Shell_getComponentByType; - epv->createNewView = impl_Shell_createNewView; - epv->selectUserFolder = impl_Shell_selectUserFolder; - epv->getLocalStorage = impl_Shell_getLocalStorage; - epv->createStorageSetView = impl_Shell_createStorageSetView; - - vepv = &shell_vepv; - vepv->_base_epv = base_epv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_Shell_epv = epv; -} - -static void class_init (EShellClass *klass) { GtkObjectClass *object_class; + POA_GNOME_Evolution_Shell__epv *epv; parent_class = gtk_type_class (PARENT_TYPE); @@ -713,7 +655,12 @@ class_init (EShellClass *klass) gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - corba_class_init (); + epv = & klass->epv; + epv->getComponentByType = impl_Shell_getComponentByType; + epv->createNewView = impl_Shell_createNewView; + epv->selectUserFolder = impl_Shell_selectUserFolder; + epv->getLocalStorage = impl_Shell_getLocalStorage; + epv->createStorageSetView = impl_Shell_createStorageSetView; } static void @@ -744,7 +691,6 @@ init (EShell *shell) /** * e_shell_construct: * @shell: An EShell object to construct - * @corba_object: A CORBA Object implementing the Evolution::Shell interface * @iid: OAFIID for registering the shell into the name server * @local_directory: Local directory for storing local information and folders * @show_splash: Whether to display a splash screen. @@ -755,25 +701,25 @@ init (EShell *shell) * Return value: %FALSE if the shell cannot be registered; %TRUE otherwise. **/ gboolean -e_shell_construct (EShell *shell, - GNOME_Evolution_Shell corba_object, - const char *iid, - const char *local_directory, - gboolean show_splash) +e_shell_construct (EShell *shell, + const char *iid, + const char *local_directory, + gboolean show_splash) { GtkWidget *splash; EShellPrivate *priv; + CORBA_Object corba_object; gchar *shortcut_path; g_return_val_if_fail (shell != NULL, FALSE); g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - g_return_val_if_fail (corba_object != CORBA_OBJECT_NIL, FALSE); g_return_val_if_fail (local_directory != NULL, FALSE); g_return_val_if_fail (g_path_is_absolute (local_directory), FALSE); - bonobo_object_construct (BONOBO_OBJECT (shell), corba_object); + /* FIXME: Multi-display stuff. */ - if (register_shell (shell, iid) != OAF_REG_SUCCESS) + corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); + if (oaf_active_server_register (iid, corba_object) != OAF_REG_SUCCESS) return FALSE; if (! show_splash) { @@ -788,6 +734,7 @@ e_shell_construct (EShell *shell, priv = shell->priv; + priv->iid = g_strdup (iid); priv->local_directory = g_strdup (local_directory); priv->folder_type_registry = e_folder_type_registry_new (); priv->storage_set = e_storage_set_new (priv->folder_type_registry); @@ -848,22 +795,13 @@ e_shell_new (const char *local_directory, { EShell *new; EShellPrivate *priv; - GNOME_Evolution_Shell corba_object; - POA_GNOME_Evolution_Shell *servant; g_return_val_if_fail (local_directory != NULL, NULL); g_return_val_if_fail (*local_directory != '\0', NULL); - servant = create_servant (); - if (servant == NULL) - return NULL; - new = gtk_type_new (e_shell_get_type ()); - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - if (! e_shell_construct (new, - corba_object, E_SHELL_OAFIID, - local_directory, show_splash)) { + if (! e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash)) { bonobo_object_unref (BONOBO_OBJECT (new)); return NULL; } @@ -1451,4 +1389,7 @@ e_shell_go_online (EShell *shell, } -E_MAKE_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE) +E_MAKE_X_TYPE (e_shell, "EShell", EShell, + class_init, init, PARENT_TYPE, + POA_GNOME_Evolution_Shell__init, + GTK_STRUCT_OFFSET (EShellClass, epv)); diff --git a/shell/e-shell.h b/shell/e-shell.h index 2a8fab2b85..a07706a41d 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -25,7 +25,7 @@ #define _E_SHELL_H_ #include <liboaf/liboaf.h> /* For the registration stuff. */ -#include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-xobject.h> #ifdef __cplusplus extern "C" { @@ -58,16 +58,17 @@ enum _EShellLineStatus { typedef enum _EShellLineStatus EShellLineStatus; struct _EShell { - BonoboObject parent; + BonoboXObject parent; EShellPrivate *priv; }; struct _EShellClass { - BonoboObjectClass parent_class; + BonoboXObjectClass parent_class; - void (* no_views_left) (EShell *shell); + POA_GNOME_Evolution_Shell__epv epv; + void (* no_views_left) (EShell *shell); void (* line_status_changed) (EShell *shell, EShellLineStatus status); }; @@ -76,14 +77,13 @@ struct _EShellClass { #define E_SHELL_OAFIID "OAFIID:GNOME_Evolution_Shell" -GtkType e_shell_get_type (void); -gboolean e_shell_construct (EShell *shell, - GNOME_Evolution_Shell corba_object, - const char *iid, - const char *local_directory, - gboolean show_splash); -EShell *e_shell_new (const char *local_directory, - gboolean show_splash); +GtkType e_shell_get_type (void); +gboolean e_shell_construct (EShell *shell, + const char *iid, + const char *local_directory, + gboolean show_splash); +EShell *e_shell_new (const char *local_directory, + gboolean show_splash); EShellView *e_shell_new_view (EShell *shell, const char *uri); |