diff options
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r-- | shell/e-shell.c | 201 |
1 files changed, 178 insertions, 23 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index 805d207406..b066985b1c 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -8,7 +8,8 @@ * (C) 2000 Helix Code, Inc. */ #include <config.h> -#include "Shell.h" +#include <gtk/gtkmain.h> +#include "Evolution.h" #include "e-util/e-util.h" #include "e-shell.h" @@ -19,6 +20,108 @@ POA_GNOME_Evolution_Shell__vepv eshell_vepv; GtkType e_shell_get_type (void); +void +e_shell_new_appointment (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_meeting_request (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_task (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_task_request (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_contact (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_mail_message (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_distribution_list (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_journal_entry (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +void +e_shell_new_note (EShell *eshell) +{ + printf ("Unimplemented function invoked: %s\n", __FUNCTION__); +} + +static void +EShell_cmd_new (PortableServer_Servant servant, + const GNOME_Evolution_Shell_NewType type, + CORBA_Environment *ev) +{ + EShell *eshell = E_SHELL (gnome_object_from_servant (servant)); + + switch (type){ + case GNOME_Evolution_Shell_APPOINTMENT: + e_shell_new_appointment (eshell); + break; + + case GNOME_Evolution_Shell_MEETING_REQUEST: + e_shell_new_meeting_request (eshell); + break; + + case GNOME_Evolution_Shell_TASK: + e_shell_new_task (eshell); + break; + + case GNOME_Evolution_Shell_TASK_REQUEST: + e_shell_new_task_request (eshell); + break; + + case GNOME_Evolution_Shell_CONTACT: + e_shell_new_contact (eshell); + break; + + case GNOME_Evolution_Shell_MAIL_MESSAGE: + e_shell_new_mail_message (eshell); + break; + + case GNOME_Evolution_Shell_DISTRIBUTION_LIST: + e_shell_new_distribution_list (eshell); + break; + + case GNOME_Evolution_Shell_JOURNAL_ENTRY: + e_shell_new_journal_entry (eshell); + break; + + case GNOME_Evolution_Shell_NOTE: + e_shell_new_note (eshell); + break; + + default: + } +} + static POA_GNOME_Evolution_Shell__epv * e_shell_get_epv (void) { @@ -26,6 +129,8 @@ e_shell_get_epv (void) epv = g_new0 (POA_GNOME_Evolution_Shell__epv, 1); + epv->new = EShell_cmd_new; + return epv; } @@ -39,11 +144,6 @@ init_e_shell_corba_class (void) static void e_shell_destroy (GtkObject *object) { - EShell *eshell = E_SHELL (object); - - if (eshell->base_uri) - g_free (eshell->base_uri); - GTK_OBJECT_CLASS (e_shell_parent_class)->destroy (object); } @@ -57,47 +157,102 @@ e_shell_class_init (GtkObjectClass *object_class) } static void -e_shell_init (GtkObject *object) +e_shell_destroy_views (EShell *eshell) { + GSList *l; + + for (l = eshell->views; l; l = l->next){ + EShellView *view = l->data; + + gtk_object_destroy (GTK_OBJECT (view)); + } } void -e_shell_set_base_uri (EShell *eshell, const char *base_uri) +e_shell_quit (EShell *eshell) { g_return_if_fail (eshell != NULL); - g_return_if_fail (!E_IS_SHELL (eshell)); - g_return_if_fail (base_uri != NULL); + g_return_if_fail (E_IS_SHELL (eshell)); - if (eshell->base_uri) - g_free (eshell->base_uri); + e_shell_destroy_views (eshell); - eshell->base_uri = g_strdup (base_uri); + gtk_main_quit (); +} + +static CORBA_Object +create_corba_eshell (GnomeObject *object) +{ + POA_GNOME_Evolution_Shell *servant; + CORBA_Environment ev; + + servant = (POA_GNOME_Evolution_Shell *)g_new0 (GnomeObjectServant, 1); + servant->vepv = &eshell_vepv; + + CORBA_exception_init (&ev); + + POA_GNOME_Evolution_Shell__init ((PortableServer_Servant) servant, &ev); + if (ev._major != CORBA_NO_EXCEPTION){ + CORBA_exception_free (&ev); + g_free (servant); + return CORBA_OBJECT_NIL; + } + + CORBA_exception_free (&ev); + + return gnome_object_activate_servant (object, servant); } -const char * -e_shell_get_base_uri (EShell *eshell) +static void +e_shell_init (GtkObject *object) { - g_return_val_if_fail (eshell != NULL, NULL); - g_return_val_if_fail (!E_IS_SHELL (eshell), NULL); +} - return eshell->base_uri; +static void +e_shell_construct (EShell *eshell, GNOME_Evolution_Shell corba_eshell) +{ + gnome_object_construct (GNOME_OBJECT (eshell), corba_eshell); } EShell * -e_shell_new (const char *base_uri) +e_shell_new (void) { + GNOME_Evolution_Shell corba_eshell; EShell *eshell; - g_return_val_if_fail (base_uri != NULL, NULL); - eshell = gtk_type_new (e_shell_get_type ()); - e_shell_set_base_uri (eshell, base_uri); + corba_eshell = create_corba_eshell (GNOME_OBJECT (eshell)); + if (corba_eshell == CORBA_OBJECT_NIL){ + gtk_object_destroy (GTK_OBJECT (eshell)); + return NULL; + } + + e_shell_construct (eshell, corba_eshell); return eshell; } +void +e_shell_register_view (EShell *eshell, EShellView *eshell_view) +{ + g_return_if_fail (eshell != NULL); + g_return_if_fail (E_IS_SHELL (eshell)); + g_return_if_fail (eshell_view != NULL); + + eshell->views = g_slist_prepend (eshell->views, eshell_view); +} + +void +e_shell_unregister_view (EShell *eshell, EShellView *eshell_view) +{ + g_return_if_fail (eshell != NULL); + g_return_if_fail (E_IS_SHELL (eshell)); + g_return_if_fail (eshell_view != NULL); + + eshell->views = g_slist_remove (eshell->views, eshell_view); +} + E_MAKE_TYPE (e_shell, "EShell", EShell, e_shell_class_init, e_shell_init, PARENT_TYPE); - + |