From 9c73777f2268b5bf2622f893e2a3ba7d0f720572 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 2 Nov 2002 08:25:03 +0000 Subject: First big sync of my GNOME 2 porting work (incomplete, and still pretty broken). Weeeeee! svn path=/trunk/; revision=18503 --- shell/evolution-shell-client.c | 51 +++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 11 deletions(-) (limited to 'shell/evolution-shell-client.c') diff --git a/shell/evolution-shell-client.c b/shell/evolution-shell-client.c index f7fb368399..1d2db19203 100644 --- a/shell/evolution-shell-client.c +++ b/shell/evolution-shell-client.c @@ -39,14 +39,16 @@ struct _EvolutionShellClientPrivate { + GNOME_Evolution_Shell corba_objref; + GNOME_Evolution_Activity activity_interface; GNOME_Evolution_Shortcuts shortcuts_interface; GNOME_Evolution_StorageRegistry storage_registry_interface; GHashTable *icons; }; -#define PARENT_TYPE bonobo_object_client_get_type () -static BonoboObjectClientClass *parent_class = NULL; +#define PARENT_TYPE G_TYPE_OBJECT +static GObjectClass *parent_class = NULL; /* Easy-to-use wrapper for Evolution::user_select_folder. */ @@ -80,9 +82,9 @@ query_shell_interface (EvolutionShellClient *shell_client, interface_object = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)), interface_name, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_warning ("EvolutionShellClient: Error querying interface %s on %p -- %s", - interface_name, shell_client, ev._repo_id); + interface_name, shell_client, BONOBO_EX_REPOID (&ev)); interface_object = CORBA_OBJECT_NIL; } else if (CORBA_Object_is_nil (interface_object, &ev)) { g_warning ("No interface %s for ShellClient %p", interface_name, shell_client); @@ -278,12 +280,21 @@ destroy (GtkObject *object) CORBA_exception_init (&ev); + if (priv->corba_objref != CORBA_OBJECT_NIL) { + Bonobo_Unknown_unref (priv->corba_objref, &ev); + if (ev._major != CORBA_NO_EXCEPTION) + g_warning ("EvolutionShellClient::destroy: " + "Error unreffing the ::Shell interface -- %s\n", + BONOBO_EX_REPOID (&ev)); + CORBA_Object_release (priv->corba_objref, &ev); + } + if (priv->activity_interface != CORBA_OBJECT_NIL) { Bonobo_Unknown_unref (priv->activity_interface, &ev); if (ev._major != CORBA_NO_EXCEPTION) g_warning ("EvolutionShellClient::destroy: " "Error unreffing the ::Activity interface -- %s\n", - ev._repo_id); + BONOBO_EX_REPOID (&ev)); CORBA_Object_release (priv->activity_interface, &ev); } @@ -292,7 +303,7 @@ destroy (GtkObject *object) if (ev._major != CORBA_NO_EXCEPTION) g_warning ("EvolutionShellClient::destroy: " "Error unreffing the ::Shortcuts interface -- %s\n", - ev._repo_id); + BONOBO_EX_REPOID (&ev)); CORBA_Object_release (priv->shortcuts_interface, &ev); } @@ -301,7 +312,7 @@ destroy (GtkObject *object) if (ev._major != CORBA_NO_EXCEPTION) g_warning ("EvolutionShellClient::destroy: " "Error unreffing the ::StorageRegistry interface -- %s\n", - ev._repo_id); + BONOBO_EX_REPOID (&ev)); CORBA_Object_release (priv->storage_registry_interface, &ev); } @@ -334,6 +345,7 @@ init (EvolutionShellClient *shell_client) EvolutionShellClientPrivate *priv; priv = g_new (EvolutionShellClientPrivate, 1); + priv->corba_objref = CORBA_OBJECT_NIL; priv->activity_interface = CORBA_OBJECT_NIL; priv->shortcuts_interface = CORBA_OBJECT_NIL; priv->storage_registry_interface = CORBA_OBJECT_NIL; @@ -360,11 +372,13 @@ evolution_shell_client_construct (EvolutionShellClient *shell_client, 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); - priv = shell_client->priv; g_return_if_fail (priv->activity_interface == CORBA_OBJECT_NIL); + /* (Notice that we don't ref or duplicate, since this is what the old + BonoboObject did.) */ + priv->corba_objref = corba_shell; + priv->activity_interface = query_shell_interface (shell_client, "IDL:GNOME/Evolution/Activity:1.0"); priv->shortcuts_interface = query_shell_interface (shell_client, "IDL:GNOME/Evolution/Shortcuts:1.0"); priv->storage_registry_interface = query_shell_interface (shell_client, "IDL:GNOME/Evolution/StorageRegistry:1.0"); @@ -396,6 +410,20 @@ evolution_shell_client_new (GNOME_Evolution_Shell corba_shell) return shell_client; } +/** + * evolution_shell_client_corba_objref: + * @shell_client: + * + * Return value: Return the CORBA objref associated with this shell client. + **/ +GNOME_Evolution_Shell +evolution_shell_client_corba_objref (EvolutionShellClient *shell_client) +{ + g_return_val_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client), CORBA_OBJECT_NIL); + + return shell_client->priv->corba_objref; +} + /** * evolution_shell_client_user_select_folder: @@ -525,7 +553,8 @@ evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client) corba_local_storage = GNOME_Evolution_Shell_getLocalStorage (corba_shell, &ev); if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("evolution_shell_client_get_local_storage() failing -- %s ???", ev._repo_id); + g_warning ("evolution_shell_client_get_local_storage() failing -- %s ???", + BONOBO_EX_REPOID (&ev)); CORBA_exception_free (&ev); return CORBA_OBJECT_NIL; } @@ -623,7 +652,7 @@ evolution_shell_client_create_storage_set_view (EvolutionShellClient *shell_clie control = GNOME_Evolution_Shell_createStorageSetView (corba_shell, ev); if (BONOBO_EX (ev)) { - g_warning ("Cannot create StorageSetView -- %s", BONOBO_EX_ID (ev)); + g_warning ("Cannot create StorageSetView -- %s", BONOBO_EX_REPOID (ev)); CORBA_exception_free (&my_ev); return NULL; } -- cgit v1.2.3