Removed globals activity_client', progress'. (timeout_callback_3): Get

* evolution-test-component.c: Removed globals `activity_client',
`progress'.
(timeout_callback_3): Get the activity client from @data.
(timeout_callback_2): Likewise here.  Pass the activity client as
the user data pointer for `gtk_timeout_add()'.  Put the progress
count in a "my_progress" GtkObject data key.
(timeout_callback_1): Pass the newly created EActivityClient as
the user data pointer for `gtk_timeout_add()'.  Also, dispatch
itself again with a random timeout delay, for a maximum of
NUM_ACTIVITES times.  Initialize the "my_progress" GtkObject data
to be -1.

* e-activity-handler.c: New member `component_id' in
`ActivityInfo'.
(activity_info_new): New arg @component_id.  Init the
`component_id' member accordingly.
(activity_info_free): Free the `component_id' member.
(impl_operationStarted): Pass the component_id to
`activity_info_new()'.
(task_widget_new_from_activity_info): Pass the component_id to the
activity_info.

* e-task-widget.c: New member `component_id' in
`ETaskWidgetPrivate'.
(impl_destroy): Free it.
(init): Init to NULL.  Also init all the other members to NULL as
well.
(e_task_widget_construct): New arg @component_id.  Assign
->component_id to match it.
(e_task_widget_new): New arg @component_id here as well.  Pass it
over to `e_task_widget_construct()'.
(e_task_widget_get_component_id): New.

svn path=/trunk/; revision=12988
This commit is contained in:
Ettore Perazzoli
2001-09-19 21:13:08 +00:00
parent 28b4ae90d7
commit 899db1fe37
6 changed files with 155 additions and 8 deletions

View File

@ -45,10 +45,8 @@ static const EvolutionShellComponentFolderType folder_types[] = {
static EvolutionShellClient *parent_shell = NULL;
static EvolutionActivityClient *activity_client;
static int timeout_id = 0;
static int progress = -1;
/* Test the ::Shortcut interface. */
@ -124,6 +122,10 @@ activity_client_show_details_callback (EvolutionActivityClient *client,
static int
timeout_callback_3 (void *data)
{
EvolutionActivityClient *activity_client;
activity_client = EVOLUTION_ACTIVITY_CLIENT (data);
gtk_object_unref (GTK_OBJECT (activity_client));
g_print ("--> Done.\n");
@ -135,6 +137,12 @@ timeout_callback_3 (void *data)
static int
timeout_callback_2 (void *data)
{
EvolutionActivityClient *activity_client;
int progress;
activity_client = EVOLUTION_ACTIVITY_CLIENT (data);
progress = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (activity_client), "my_progress"));
if (progress < 0)
progress = 0;
@ -147,8 +155,10 @@ timeout_callback_2 (void *data)
}
progress ++;
gtk_object_set_data (GTK_OBJECT (activity_client), "my_progress", GINT_TO_POINTER (progress));
if (progress > 100) {
gtk_timeout_add (200, timeout_callback_3, NULL);
gtk_timeout_add (200, timeout_callback_3, activity_client);
return FALSE;
}
@ -159,8 +169,12 @@ timeout_callback_2 (void *data)
static int
timeout_callback_1 (void *data)
{
EvolutionActivityClient *activity_client;
gboolean suggest_display;
GdkPixbuf *animated_icon[2];
static int count = 0;
#define NUM_ACTIVITIES 10
animated_icon[0] = gdk_pixbuf_new_from_file (gnome_pixmap_file ("gnome-money.png"));
animated_icon[1] = NULL;
@ -177,6 +191,8 @@ timeout_callback_1 (void *data)
return FALSE;
}
gtk_object_set_data (GTK_OBJECT (activity_client), "my_progress", GINT_TO_POINTER (-1));
gtk_signal_connect (GTK_OBJECT (activity_client), "cancel",
GTK_SIGNAL_FUNC (activity_client_cancel_callback), NULL);
gtk_signal_connect (GTK_OBJECT (activity_client), "show_details",
@ -186,7 +202,12 @@ timeout_callback_1 (void *data)
if (suggest_display)
g_print (" --> Could display dialog box.\n");
gtk_timeout_add (100, timeout_callback_2, NULL);
gtk_timeout_add (100, timeout_callback_2, activity_client);
if (count < NUM_ACTIVITIES) {
count ++;
gtk_timeout_add ((rand () % 5 + 1) * 500, timeout_callback_1, NULL);
}
return FALSE;
}