Add code to query the ::Activity interface in the
EvolutionShellComponent class and get the test component to use it. svn path=/trunk/; revision=10448
This commit is contained in:
@ -1,3 +1,24 @@
|
||||
2001-06-24 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* evolution-test-component.c: Remove the `activity_interface'
|
||||
global.
|
||||
(timeout_callback_3): Get the ::Activity interface using
|
||||
`evolution_shell_client_get_activity_interface()' on
|
||||
`parent_shell' instead.
|
||||
(timeout_callback_2): Likewise.
|
||||
(timeout_callback_2): Likewise.
|
||||
(timeout_callback_1): Likewise.
|
||||
(owner_set_callback): Don't query interface here. Check if the
|
||||
shell has an ::Activity interface by using
|
||||
`evolution_shell_client_get_activity_interface()' here as well.
|
||||
|
||||
* evolution-shell-client.c: New member `activity_interface' in
|
||||
`EvolutionShellClientPrivate'.
|
||||
(destroy): unref/release it.
|
||||
(evolution_shell_client_construct): Initialize it by querying the
|
||||
shell CORBA Object for the ::Activity interface.
|
||||
(evolution_shell_client_get_activity_interface): New.
|
||||
|
||||
2001-06-23 Jason Leach <jleach@ximian.com>
|
||||
|
||||
* e-shell-folder-selection-dialog.c
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
struct _EvolutionShellClientPrivate {
|
||||
int dummy;
|
||||
GNOME_Evolution_Activity activity_interface;
|
||||
};
|
||||
|
||||
#define PARENT_TYPE bonobo_object_client_get_type ()
|
||||
@ -222,10 +222,24 @@ destroy (GtkObject *object)
|
||||
{
|
||||
EvolutionShellClient *shell_client;
|
||||
EvolutionShellClientPrivate *priv;
|
||||
CORBA_Environment ev;
|
||||
|
||||
shell_client = EVOLUTION_SHELL_CLIENT (object);
|
||||
priv = shell_client->priv;
|
||||
|
||||
CORBA_exception_init (&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);
|
||||
CORBA_Object_release (priv->activity_interface, &ev);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
g_free (priv);
|
||||
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
@ -250,7 +264,7 @@ init (EvolutionShellClient *shell_client)
|
||||
EvolutionShellClientPrivate *priv;
|
||||
|
||||
priv = g_new (EvolutionShellClientPrivate, 1);
|
||||
priv->dummy = 0;
|
||||
priv->activity_interface = CORBA_OBJECT_NIL;
|
||||
|
||||
shell_client->priv = priv;
|
||||
}
|
||||
@ -267,11 +281,31 @@ void
|
||||
evolution_shell_client_construct (EvolutionShellClient *shell_client,
|
||||
GNOME_Evolution_Shell corba_shell)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
EvolutionShellClientPrivate *priv;
|
||||
|
||||
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);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
priv = shell_client->priv;
|
||||
g_return_if_fail (priv->activity_interface == CORBA_OBJECT_NIL);
|
||||
|
||||
priv->activity_interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)),
|
||||
"IDL:GNOME/Evolution/Activity:1.0",
|
||||
&ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_warning ("EvolutionShellClient: Error querying interface ::Activity -- %s", ev._repo_id);
|
||||
priv->activity_interface = CORBA_OBJECT_NIL;
|
||||
} else if (CORBA_Object_is_nil (priv->activity_interface, &ev)) {
|
||||
g_warning ("No ::Activity interface for ShellClient %p", shell_client);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,6 +364,26 @@ evolution_shell_client_user_select_folder (EvolutionShellClient *shell_client,
|
||||
uri_return, physical_uri_return);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* evolution_shell_client_get_activity_interface:
|
||||
* @shell_client: An EvolutionShellClient object
|
||||
*
|
||||
* Get the GNOME::Evolution::Activity for the shell associated to
|
||||
* @shell_client.
|
||||
*
|
||||
* Return value: A CORBA Object represeting the GNOME::Evolution::Activity
|
||||
* interface.
|
||||
**/
|
||||
GNOME_Evolution_Activity
|
||||
evolution_shell_client_get_activity_interface (EvolutionShellClient *shell_client)
|
||||
{
|
||||
g_return_val_if_fail (shell_client != NULL, CORBA_OBJECT_NIL);
|
||||
g_return_val_if_fail (EVOLUTION_IS_SHELL_CLIENT (shell_client), CORBA_OBJECT_NIL);
|
||||
|
||||
return shell_client->priv->activity_interface;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* evolution_shell_client_get_local_storage:
|
||||
|
||||
@ -67,6 +67,8 @@ void evolution_shell_client_user_select_folder (EvolutionShe
|
||||
char **uri_return,
|
||||
char **physical_uri_return);
|
||||
|
||||
GNOME_Evolution_Activity evolution_shell_client_get_activity_interface (EvolutionShellClient *shell_client);
|
||||
|
||||
GNOME_Evolution_LocalStorage evolution_shell_client_get_local_storage (EvolutionShellClient *shell_client);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -45,7 +45,6 @@ static const EvolutionShellComponentFolderType folder_types[] = {
|
||||
|
||||
|
||||
static EvolutionShellClient *parent_shell = NULL;
|
||||
static GNOME_Evolution_Activity activity_interface = CORBA_OBJECT_NIL;
|
||||
|
||||
static CORBA_long activity_id = 0;
|
||||
|
||||
@ -133,9 +132,8 @@ timeout_callback_3 (void *data)
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
GNOME_Evolution_Activity_operationFinished (activity_interface,
|
||||
activity_id,
|
||||
&ev);
|
||||
GNOME_Evolution_Activity_operationFinished (evolution_shell_client_get_activity_interface (parent_shell),
|
||||
activity_id, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_warning ("Cannot report operation as finished; exception returned -- %s\n",
|
||||
@ -160,7 +158,7 @@ timeout_callback_2 (void *data)
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
GNOME_Evolution_Activity_operationProgressing (activity_interface,
|
||||
GNOME_Evolution_Activity_operationProgressing (evolution_shell_client_get_activity_interface (parent_shell),
|
||||
activity_id,
|
||||
"Operation Foo in progress",
|
||||
(CORBA_float) progress / 100.0,
|
||||
@ -191,14 +189,14 @@ timeout_callback_1 (void *data)
|
||||
CORBA_boolean suggest_display;
|
||||
CORBA_Environment ev;
|
||||
GNOME_Evolution_AnimatedIcon *animated_icon;
|
||||
GNOME_Evolution_Activity activity_interface;
|
||||
|
||||
activity_interface = evolution_shell_client_get_activity_interface (parent_shell);
|
||||
if (activity_interface== CORBA_OBJECT_NIL)
|
||||
return FALSE;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
if (CORBA_Object_is_nil (activity_interface, &ev)) {
|
||||
CORBA_exception_free (&ev);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_print ("Component becoming busy -- %s\n", COMPONENT_ID);
|
||||
|
||||
task_bar_event_listener = bonobo_listener_new (task_bar_event_listener_callback, NULL);
|
||||
@ -284,26 +282,14 @@ owner_set_callback (EvolutionShellComponent *shell_component,
|
||||
EvolutionShellClient *shell_client,
|
||||
const char *evolution_homedir)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_assert (parent_shell == NULL);
|
||||
|
||||
g_print ("We have an owner -- home directory is `%s'\n", evolution_homedir);
|
||||
|
||||
parent_shell = shell_client;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
activity_interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)),
|
||||
"IDL:GNOME/Evolution/Activity:1.0",
|
||||
&ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION)
|
||||
activity_interface = CORBA_OBJECT_NIL;
|
||||
|
||||
if (CORBA_Object_is_nil (activity_interface, &ev))
|
||||
if (evolution_shell_client_get_activity_interface (parent_shell) == CORBA_OBJECT_NIL)
|
||||
g_warning ("Shell doesn't have a ::Activity interface -- weird!");
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user