aboutsummaryrefslogtreecommitdiffstats
path: root/shell/evolution-test-component.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-09-20 05:13:08 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-09-20 05:13:08 +0800
commit899db1fe37a9b8d229a2dc67c9b09ccb48a43521 (patch)
treefd712715ea8b801d0821602f9f175220218fc16c /shell/evolution-test-component.c
parent28b4ae90d788b6bbce25ef7b887c96dfa952e5fb (diff)
downloadgsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar.gz
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar.bz2
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar.lz
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar.xz
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.tar.zst
gsoc2013-evolution-899db1fe37a9b8d229a2dc67c9b09ccb48a43521.zip
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
Diffstat (limited to 'shell/evolution-test-component.c')
-rw-r--r--shell/evolution-test-component.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index 2cad304136..95a1c4d091 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -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;
}