diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-30 13:36:32 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-30 13:36:32 +0800 |
commit | 55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd (patch) | |
tree | 6efa90b13a9dc59a015ed62ac22bb8f2d01881fb | |
parent | f5fa17c2d0a2069e25d0b49aaf5fd4e8ea8dc4da (diff) | |
download | gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar.gz gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar.bz2 gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar.lz gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar.xz gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.tar.zst gsoc2013-evolution-55499e0ce4bb8a081d12e7243a0dd42aa55bbbfd.zip |
EvolutionShellClient.
svn path=/trunk/; revision=3820
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | addressbook/ChangeLog | 6 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 2 | ||||
-rw-r--r-- | calendar/ChangeLog | 6 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 3 | ||||
-rw-r--r-- | calendar/gui/component-factory.c | 3 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | filter/ChangeLog | 10 | ||||
-rw-r--r-- | filter/filter-arg-types.c | 111 | ||||
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/component-factory.c | 14 | ||||
-rw-r--r-- | notes/component-factory.c | 2 | ||||
-rw-r--r-- | shell/ChangeLog | 13 | ||||
-rw-r--r-- | shell/Makefile.am | 4 | ||||
-rw-r--r-- | shell/e-storage-set.c | 5 | ||||
-rw-r--r-- | shell/evolution-shell-client.c | 296 | ||||
-rw-r--r-- | shell/evolution-shell-client.h | 71 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 30 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 6 |
19 files changed, 475 insertions, 119 deletions
@@ -1,3 +1,9 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * notes/component-factory.c (owner_set_cb): Get an + EvolutionShellClient instead of an Evolution_Shell to match the + changes in libeshell. + 2000-06-29 Peter Williams <peterw@helixcode.com> * configure.in: Re-enable GNOME_PILOT_CHECK. diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 840e491fdb..962ca4b8ef 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,9 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * gui/component/addressbook-component.c (owner_set_cb): Get an + EvolutionShellClient instead of an Evolution_Shell to match the + changes in libeshell. + 2000-06-28 Christopher James Lahey <clahey@helixcode.com> * gui/component/select-names/, diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 793e168c18..8469967e7c 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -74,7 +74,7 @@ static int owner_count = 0; static void owner_set_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface, + EvolutionShellClient *shell_client, gpointer user_data) { owner_count ++; diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 46fd6690e8..06518ca29f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * gui/component-factory.c (owner_set_cb): Get an + EvolutionShellClient instead of an Evolution_Shell to match the + changes in libeshell. + 2000-06-29 Federico Mena Quintero <federico@helixcode.com> * gui/Makefile.am: Do not link and include the pilot stuff for the diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 1b178cfdfc..5ca51772b9 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -69,7 +69,8 @@ create_view (EvolutionShellComponent *shell_component, static void owner_set_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface) + EvolutionShellClient shell_client, + void *data) { g_print ("evolution-calendar: Yeeeh! We have an owner!\n"); /* FIXME */ } diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index 1b178cfdfc..5ca51772b9 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -69,7 +69,8 @@ create_view (EvolutionShellComponent *shell_component, static void owner_set_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface) + EvolutionShellClient shell_client, + void *data) { g_print ("evolution-calendar: Yeeeh! We have an owner!\n"); /* FIXME */ } diff --git a/configure.in b/configure.in index f6f713c367..370beb3551 100644 --- a/configure.in +++ b/configure.in @@ -469,6 +469,7 @@ widgets/Makefile widgets/e-paned/Makefile widgets/e-table/Makefile widgets/e-text/Makefile +widgets/e-toolbar/Makefile widgets/meeting-time-sel/Makefile widgets/misc/Makefile widgets/shortcut-bar/Makefile diff --git a/filter/ChangeLog b/filter/ChangeLog index 170b4b0ee0..6bcf2bd0a4 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,13 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * filter-arg-types.c: Replaced `global_shell_interface' with + `global_shell_client'. + (arg_folder_edit_value): Use + `evolution_shell_client_user_select_folder()'. + (create_listener): Removed. + (impl_FolderSelectionListener_selected): Removed, together with + all the ::Listener stuff. + 2000-06-29 Arik Devens <arik@helixcode.com> * vfoldertypes.xml (ruleset type="match"): Changed Cc to CC to be diff --git a/filter/filter-arg-types.c b/filter/filter-arg-types.c index 8599665b82..afecb0bcde 100644 --- a/filter/filter-arg-types.c +++ b/filter/filter-arg-types.c @@ -22,6 +22,8 @@ #include <gnome.h> +#include "evolution-shell-client.h" + #include "filter-arg-types.h" /* ********************************************************************** */ @@ -501,91 +503,7 @@ static void filter_arg_folder_class_init (FilterArgFolderClass *class); static void filter_arg_folder_init (FilterArgFolder *gspaper); static FilterArg *folder_parent_class; -extern Evolution_Shell global_shell_interface; - -static PortableServer_ServantBase__epv FolderSelectionListener_base_epv; -static POA_Evolution_FolderSelectionListener__epv FolderSelectionListener_epv; -static POA_Evolution_FolderSelectionListener__vepv FolderSelectionListener_vepv; -static gboolean FolderSelectionListener_vepv_initialized = FALSE; - -struct _FolderSelectionListenerServant { - POA_Evolution_FolderSelectionListener servant; - FilterArg *arg; - int index; - /*EvolutionShellComponentClient *component_client;*/ -}; -typedef struct _FolderSelectionListenerServant FolderSelectionListenerServant; - -static void -impl_FolderSelectionListener_selected(PortableServer_Servant listener_servant, char *uri, char *physical, CORBA_Environment *ev) -{ - FolderSelectionListenerServant *servant = listener_servant; - GList *node; - - /* only if we have a selection */ - if (physical[0]) { - printf ("user selected; %s, or did they select %s\n", uri, physical); - - /* FIXME: passing arg 2 of `g_list_index' makes pointer from integer without a cast */ - if (servant->index >= 0 && (node = g_list_index (servant->arg->values, servant->index))) { - node->data = g_strdup (physical); - } else { - servant->arg->values = g_list_append (servant->arg->values, g_strdup (physical)); - } - - gtk_signal_emit_by_name (GTK_OBJECT (servant->arg), "changed"); - } - gtk_object_unref (GTK_OBJECT (servant->arg)); - - g_free (servant); -} - -static Evolution_FolderSelectionListener -create_listener (FilterArg *arg, int index) -{ - PortableServer_Servant listener_servant; - Evolution_FolderSelectionListener corba_interface; - CORBA_Environment ev; - FolderSelectionListenerServant *servant; - - if (!FolderSelectionListener_vepv_initialized) { - FolderSelectionListener_base_epv._private = NULL; - FolderSelectionListener_base_epv.finalize = NULL; - FolderSelectionListener_base_epv.default_POA = NULL; - - FolderSelectionListener_epv.selected = impl_FolderSelectionListener_selected; - - FolderSelectionListener_vepv._base_epv = & FolderSelectionListener_base_epv; - FolderSelectionListener_vepv.Evolution_FolderSelectionListener_epv = & FolderSelectionListener_epv; - - FolderSelectionListener_vepv_initialized = TRUE; - } - servant = g_malloc0 (sizeof (*servant)); - servant->servant.vepv = &FolderSelectionListener_vepv; - servant->arg = arg; - gtk_object_ref (GTK_OBJECT (arg)); - servant->index = index; - - listener_servant = (PortableServer_Servant) servant; - - CORBA_exception_init (&ev); - - POA_Evolution_FolderSelectionListener__init (listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free(servant); - return CORBA_OBJECT_NIL; - } - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), listener_servant, &ev)); - - corba_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), listener_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - corba_interface = CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return corba_interface; -} +extern EvolutionShellClient *global_shell_client; guint filter_arg_folder_get_type (void) @@ -639,19 +557,32 @@ static int arg_folder_edit_value (FilterArg *arg, int index) { char *def; - CORBA_Environment ev; + char *physical_uri; printf ("folder edit value %d\n", index); + if (index < 0) { def = ""; } else { def = filter_arg_get_value (arg, index); } - CORBA_exception_init (&ev); - Evolution_Shell_user_select_folder (global_shell_interface, - create_listener (arg, index), - "Select Folder", def, &ev); + evolution_shell_client_user_select_folder (global_shell_client, + _("Select Folder"), + def, NULL, &physical_uri); + + if (physical_uri != NULL && physical_uri[0] != '\0') { + GList *node; + + if (index >= 0 && (node = g_list_index (arg->values, index))) + node->data = physical_uri; + else + arg->values = g_list_append (arg->values, physical_uri); + + gtk_signal_emit_by_name (GTK_OBJECT (arg), "changed"); + } else { + g_free (physical_uri); + } #warning "What do we really want to return here???" return 0; diff --git a/mail/ChangeLog b/mail/ChangeLog index f6ba7c3ade..460421471c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * component-factory.c: Replace `global_shell_interface' with + `global_shell_client'. + 2000-06-29 Jeffrey Stedfast <fejj@helixcode.com> * mail-ops.c (delete_msg): Clean up compile warnings diff --git a/mail/component-factory.c b/mail/component-factory.c index deb33b8a22..e29a174188 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -64,7 +64,7 @@ static const EvolutionShellComponentFolderType folder_types[] = { static GList *browsers; /* GROSS HACK: for passing to other parts of the program */ -Evolution_Shell global_shell_interface; +EvolutionShellClient global_shell_client; /* EvolutionShellComponent methods and signals. */ @@ -143,13 +143,14 @@ create_folder (EvolutionShellComponent *shell_component, static void owner_set_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface, + EvolutionShellClient shell_client, gpointer user_data) { g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */ /* GROSS HACK */ - global_shell_interface = shell_interface; + global_shell_client = shell_client; + create_vfolder_storage (shell_component); create_imap_storage (shell_component); create_news_storage (shell_component); @@ -211,14 +212,17 @@ component_factory_init (void) static void create_vfolder_storage (EvolutionShellComponent *shell_component) { + EvolutionShellClient *shell_client; Evolution_Shell corba_shell; EvolutionStorage *storage; - corba_shell = evolution_shell_component_get_owner (shell_component); - if (corba_shell == CORBA_OBJECT_NIL) { + shell_client = evolution_shell_component_get_owner (shell_component); + if (shell_client == NULL) { g_warning ("We have no shell!?"); return; } + + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); storage = evolution_storage_new ("VFolders"); if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { diff --git a/notes/component-factory.c b/notes/component-factory.c index 5e9cae24f5..f416156ba3 100644 --- a/notes/component-factory.c +++ b/notes/component-factory.c @@ -102,7 +102,7 @@ create_view (EvolutionShellComponent *shell_component, static void owner_set_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface, + EvolutionShellClient shell_client, gpointer user_data) { g_print ("evolution-notes: Yeeeh! We have an owner!\n"); /* FIXME */ diff --git a/shell/ChangeLog b/shell/ChangeLog index da707efdeb..ac11499d52 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2000-06-29 Ettore Perazzoli <ettore@helixcode.com> + + * evolution-shell-component.c: New member `owner_client'. Removed + member `corba_owner'. All the code updated to use it. + (evolution_shell_component_get_owner): Changed so that it returns + an EvolutionShellClient instead of the raw CORBA object. + + * evolution-shell-component.h: Change signal "owner_set" to get an + EvolutionShellClient wrapper instead of a CORBA interface. + + * evolution-shell-client.c: New. + * evolution-shell-client.h: New. + 2000-06-29 Dan Winship <danw@helixcode.com> * evolution-shell-component-client.c diff --git a/shell/Makefile.am b/shell/Makefile.am index 034403cc52..dbcc08cac6 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -44,6 +44,8 @@ noinst_LIBRARIES = \ libeshell_a_SOURCES = \ $(IDL_GENERATED) \ + evolution-shell-client.c \ + evolution-shell-client.h \ evolution-shell-component.c \ evolution-shell-component.h \ evolution-storage.c \ @@ -95,6 +97,8 @@ evolution_SOURCES = \ e-storage-set.h \ e-storage.c \ e-storage.h \ + evolution-shell-client.c \ + evolution-shell-client.h \ evolution-shell-component-client.c \ evolution-shell-component-client.h \ main.c diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index a779023bab..f24a3ac05c 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -214,8 +214,7 @@ class_init (EStorageSetClass *klass) GtkObjectClass *object_class; parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class = (GtkObjectClass*) klass; + object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = destroy; @@ -260,6 +259,8 @@ init (EStorageSet *storage_set) { EStorageSetPrivate *priv; + g_return_if_fail (E_IS_STORAGE_SET (storage_set)); + priv = g_new (EStorageSetPrivate, 1); priv->storages = NULL; priv->name_to_named_storage = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c new file mode 100644 index 0000000000..d9cc63cec2 --- /dev/null +++ b/shell/evolution-shell-client.c @@ -0,0 +1,296 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* evolution-shell-client.c + * + * Copyright (C) 2000 Helix Code, Inc. + * + * 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 Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <bonobo.h> + +#include "e-util/e-util.h" + +#include "evolution-shell-client.h" + + +struct _EvolutionShellClientPrivate { + int dummy; +}; + +#define PARENT_TYPE bonobo_object_get_type () +static BonoboObjectClass *parent_class = NULL; + + +/* Easy-to-use wrapper for Evolution::user_select_folder. */ + +static PortableServer_ServantBase__epv FolderSelectionListener_base_epv; +static POA_Evolution_FolderSelectionListener__epv FolderSelectionListener_epv; +static POA_Evolution_FolderSelectionListener__vepv FolderSelectionListener_vepv; +static gboolean FolderSelectionListener_vtables_initialized = FALSE; + +struct _FolderSelectionListenerServant { + POA_Evolution_FolderSelectionListener servant; + GMainLoop *main_loop; + char **uri_return; + char **physical_uri_return; +}; +typedef struct _FolderSelectionListenerServant FolderSelectionListenerServant; + +static void +impl_FolderSelectionListener_selected (PortableServer_Servant servant, + const CORBA_char *uri, + const CORBA_char *physical_uri, + CORBA_Environment *ev) +{ + FolderSelectionListenerServant *listener_servant; + + listener_servant = (FolderSelectionListenerServant *) servant; + + if (listener_servant->uri_return != NULL) + * (listener_servant->uri_return) = g_strdup (uri); + + if (listener_servant->physical_uri_return != NULL) + * (listener_servant->physical_uri_return) = g_strdup (physical_uri); + + g_main_quit (listener_servant->main_loop); +} + +static void +init_FolderSelectionListener_vtables (void) +{ + FolderSelectionListener_base_epv._private = NULL; + FolderSelectionListener_base_epv.finalize = NULL; + FolderSelectionListener_base_epv.default_POA = NULL; + + FolderSelectionListener_epv.selected = impl_FolderSelectionListener_selected; + + FolderSelectionListener_vepv._base_epv = &FolderSelectionListener_base_epv; + FolderSelectionListener_vepv.Evolution_FolderSelectionListener_epv = &FolderSelectionListener_epv; + + FolderSelectionListener_vtables_initialized = TRUE; +} + +static Evolution_FolderSelectionListener +create_folder_selection_listener_interface (char **result, + GMainLoop *main_loop, + char **uri_return, + char **physical_uri_return) +{ + Evolution_FolderSelectionListener corba_interface; + CORBA_Environment ev; + FolderSelectionListenerServant *servant; + PortableServer_Servant listener_servant; + + if (! FolderSelectionListener_vtables_initialized) + init_FolderSelectionListener_vtables (); + + servant = g_new (FolderSelectionListenerServant, 1); + servant->servant.vepv = &FolderSelectionListener_vepv; + servant->main_loop = main_loop; + servant->uri_return = uri_return; + servant->physical_uri_return = physical_uri_return; + + listener_servant = (PortableServer_Servant) servant; + + CORBA_exception_init (&ev); + + POA_Evolution_FolderSelectionListener__init (listener_servant, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_free(servant); + return CORBA_OBJECT_NIL; + } + + CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), listener_servant, &ev)); + + corba_interface = PortableServer_POA_servant_to_reference (bonobo_poa (), listener_servant, &ev); + if (ev._major != CORBA_NO_EXCEPTION) + corba_interface = CORBA_OBJECT_NIL; + + CORBA_exception_free (&ev); + + return corba_interface; +} + +static void +user_select_folder (EvolutionShellClient *shell_client, + const char *title, + const char *default_folder, + char **uri_return, + char **physical_uri_return) +{ + Evolution_FolderSelectionListener listener_interface; + Evolution_Shell corba_shell; + GMainLoop *main_loop; + CORBA_Environment ev; + char *result; + + result = NULL; + main_loop = g_main_new (FALSE); + + listener_interface = create_folder_selection_listener_interface (&result, main_loop, + uri_return, physical_uri_return); + if (listener_interface == CORBA_OBJECT_NIL) { + g_main_destroy (main_loop); + return; + } + + CORBA_exception_init (&ev); + + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); + + Evolution_Shell_user_select_folder (corba_shell, listener_interface, + title, default_folder, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + CORBA_exception_free (&ev); + + if (uri_return != NULL) + *uri_return = NULL; + if (physical_uri_return != NULL) + *physical_uri_return = NULL; + + return; + } + + g_main_run (main_loop); + + CORBA_Object_release (listener_interface, &ev); + + CORBA_exception_free (&ev); +} + + +/* GtkObject methods. */ + +static void +destroy (GtkObject *object) +{ + EvolutionShellClient *shell_client; + EvolutionShellClientPrivate *priv; + + shell_client = EVOLUTION_SHELL_CLIENT (object); + priv = shell_client->priv; + + /* Nothing to do here. */ + + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + + +static void +class_init (EvolutionShellClientClass *klass) +{ + GtkObjectClass *object_class; + + parent_class = gtk_type_class (bonobo_object_get_type ()); + + object_class = GTK_OBJECT_CLASS (klass); + + object_class->destroy = destroy; +} + +static void +init (EvolutionShellClient *shell_client) +{ + EvolutionShellClientPrivate *priv; + + priv = g_new (EvolutionShellClientPrivate, 1); + priv->dummy = 0; + + shell_client->priv = priv; +} + + +/** + * evolution_shell_client_construct: + * @shell_client: + * @corba_shell: + * + * Construct @shell_client associating it to @corba_shell. + **/ +void +evolution_shell_client_construct (EvolutionShellClient *shell_client, + Evolution_Shell corba_shell) +{ + g_return_if_fail (shell_client != NULL); + g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client)); + g_return_if_fail (corba_shell != CORBA_OBJECT_NIL); + + bonobo_object_construct (BONOBO_OBJECT (shell_client), (CORBA_Object) corba_shell); +} + +/** + * evolution_shell_client_new: + * @corba_shell: A pointer to the CORBA Evolution::Shell interface. + * + * Create a new client object for @corba_shell. + * + * Return value: A pointer to the Evolution::Shell client BonoboObject. + **/ +EvolutionShellClient * +evolution_shell_client_new (Evolution_Shell corba_shell) +{ + EvolutionShellClient *shell_client; + + shell_client = gtk_type_new (evolution_shell_client_get_type ()); + + evolution_shell_client_construct (shell_client, corba_shell); + + if (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)) == CORBA_OBJECT_NIL) { + bonobo_object_unref (BONOBO_OBJECT (shell_client)); + return NULL; + } + + return shell_client; +} + + +/** + * evolution_shell_client_user_select_folder: + * @shell_client: A EvolutionShellClient object + * @title: The title for the folder selection dialog + * @default_folder: The folder initially selected on the dialog + * @uri_return: + * @physical_uri_return: + * + * Pop up the shell's folder selection dialog with the specified @title and * + * *@default_folder as the initially selected folder. On return, set *@uri and + * *@physical_uri to the evolution: URI and the physical URI of the selected + * *folder. (The dialog is modal.) + **/ +void +evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client, + const char *title, + const char *default_folder, + char **uri_return, + char **physical_uri_return) +{ + g_return_if_fail (shell_client != NULL); + g_return_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client)); + g_return_if_fail (title != NULL); + g_return_if_fail (default_folder != NULL); + + user_select_folder (shell_client, title, default_folder, uri_return, physical_uri_return); +} + + +E_MAKE_TYPE (evolution_shell_client, "EvolutionShellClient", EvolutionShellClient, class_init, init, PARENT_TYPE) diff --git a/shell/evolution-shell-client.h b/shell/evolution-shell-client.h new file mode 100644 index 0000000000..c1b693fd45 --- /dev/null +++ b/shell/evolution-shell-client.h @@ -0,0 +1,71 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* evolution-shell-client.h + * + * Copyright (C) 2000 Helix Code, Inc. + * + * 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 Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +#ifndef __EVOLUTION_SHELL_CLIENT_H__ +#define __EVOLUTION_SHELL_CLIENT_H__ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <bonobo/bonobo-object.h> + +#include "Evolution.h" + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +#define EVOLUTION_TYPE_SHELL_CLIENT (evolution_shell_client_get_type ()) +#define EVOLUTION_SHELL_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClient)) +#define EVOLUTION_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_SHELL_CLIENT, EvolutionShellClientClass)) +#define EVOLUTION_IS_SHELL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) +#define EVOLUTION_IS_SHELL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_SHELL_CLIENT)) + + +typedef struct _EvolutionShellClient EvolutionShellClient; +typedef struct _EvolutionShellClientPrivate EvolutionShellClientPrivate; +typedef struct _EvolutionShellClientClass EvolutionShellClientClass; + +struct _EvolutionShellClient { + BonoboObject parent; + + EvolutionShellClientPrivate *priv; +}; + +struct _EvolutionShellClientClass { + BonoboObjectClass parent_class; +}; + + +GtkType evolution_shell_client_get_type (void); +void evolution_shell_client_construct (EvolutionShellClient *shell_client, + Evolution_Shell corba_shell); +EvolutionShellClient *evolution_shell_client_new (Evolution_Shell shell); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __EVOLUTION_SHELL_CLIENT_H__ */ diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index db57e6fa6b..2b739b67b6 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -44,7 +44,8 @@ struct _EvolutionShellComponentPrivate { EvolutionShellComponentCreateFolderFn create_folder_fn; EvolutionShellComponentRemoveFolderFn remove_folder_fn; - Evolution_Shell corba_owner; + EvolutionShellClient *owner_client; + void *closure; }; @@ -131,15 +132,15 @@ impl_ShellComponent_set_owner (PortableServer_Servant servant, shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); priv = shell_component->priv; - if (priv->corba_owner != CORBA_OBJECT_NIL) { + if (priv->owner_client != NULL) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_ShellComponent_AlreadyOwned, NULL); return; } - priv->corba_owner = CORBA_Object_duplicate (shell, ev); + priv->owner_client = evolution_shell_client_new (shell); - gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->corba_owner); + gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->owner_client); } static void @@ -154,14 +155,13 @@ impl_ShellComponent_unset_owner (PortableServer_Servant servant, shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); priv = shell_component->priv; - if (priv->corba_owner == CORBA_OBJECT_NIL) { + if (priv->owner_client == CORBA_OBJECT_NIL) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_ShellComponent_NotOwned, NULL); return; } - Bonobo_Unknown_unref (priv->corba_owner, ev); - CORBA_Object_release (priv->corba_owner, ev); + bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_UNSET]); } @@ -275,10 +275,8 @@ destroy (GtkObject *object) CORBA_exception_init (&ev); - if (priv->corba_owner != NULL) { - Bonobo_Unknown_unref (priv->corba_owner, &ev); - CORBA_Object_release (priv->corba_owner, &ev); - } + if (priv->owner_client != NULL) + bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); CORBA_exception_free (&ev); @@ -368,7 +366,7 @@ init (EvolutionShellComponent *shell_component) priv->create_view_fn = NULL; priv->create_folder_fn = NULL; priv->remove_folder_fn = NULL; - priv->corba_owner = CORBA_OBJECT_NIL; + priv->owner_client = NULL; priv->closure = NULL; shell_component->priv = priv; @@ -444,13 +442,13 @@ evolution_shell_component_new (const EvolutionShellComponentFolderType folder_ty return new; } -Evolution_Shell +EvolutionShellClient * evolution_shell_component_get_owner (EvolutionShellComponent *shell_component) { - g_return_val_if_fail (shell_component != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component), CORBA_OBJECT_NIL); + g_return_val_if_fail (shell_component != NULL, NULL); + g_return_val_if_fail (EVOLUTION_IS_SHELL_COMPONENT (shell_component), NULL); - return shell_component->priv->corba_owner; + return shell_component->priv->owner_client; } diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index a1a70ebafa..c91d4bec97 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -33,6 +33,8 @@ #include "Evolution.h" +#include "evolution-shell-client.h" + #ifdef cplusplus extern "C" { #pragma } @@ -104,7 +106,7 @@ struct _EvolutionShellComponentClass { /* Signals. */ void (* owner_set) (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface); + EvolutionShellClient *shell_client); void (* owner_unset) (EvolutionShellComponent *shell_component); }; @@ -122,7 +124,7 @@ EvolutionShellComponent *evolution_shell_component_new (const EvolutionSh EvolutionShellComponentCreateFolderFn create_folder_fn, EvolutionShellComponentRemoveFolderFn remove_folder_fn, void *closure); -Evolution_Shell evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); +EvolutionShellClient *evolution_shell_component_get_owner (EvolutionShellComponent *shell_component); #ifdef cplusplus } |