diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-20 05:13:08 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-20 05:13:08 +0800 |
commit | 899db1fe37a9b8d229a2dc67c9b09ccb48a43521 (patch) | |
tree | fd712715ea8b801d0821602f9f175220218fc16c /shell/e-task-bar.c | |
parent | 28b4ae90d788b6bbce25ef7b887c96dfa952e5fb (diff) | |
download | gsoc2013-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/e-task-bar.c')
-rw-r--r-- | shell/e-task-bar.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/shell/e-task-bar.c b/shell/e-task-bar.c index 2c89b016f3..057fe4cc03 100644 --- a/shell/e-task-bar.c +++ b/shell/e-task-bar.c @@ -34,6 +34,54 @@ static GtkHBoxClass *parent_class = NULL; +/* WARNING: Ugly hack starts here. */ + +#define MAX_ACTIVITIES_PER_COMPONENT 2 + +static void +reduce_displayed_activities_per_component (ETaskBar *task_bar) +{ + GHashTable *component_ids_hash; + GtkBox *box; + GList *p; + + component_ids_hash = g_hash_table_new (g_str_hash, g_str_equal); + + box = GTK_BOX (task_bar); + + for (p = box->children; p != NULL; p = p->next) { + GtkBoxChild *child; + const char *component_id; + void *hash_item; + + child = (GtkBoxChild *) p->data; + component_id = e_task_widget_get_component_id (E_TASK_WIDGET (child->widget)); + + hash_item = g_hash_table_lookup (component_ids_hash, component_id); + + if (hash_item == NULL) { + gtk_widget_show (child->widget); + g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (1)); + } else { + int num_items; + + num_items = GPOINTER_TO_INT (hash_item); + g_assert (num_items <= MAX_ACTIVITIES_PER_COMPONENT); + + if (num_items == MAX_ACTIVITIES_PER_COMPONENT) { + gtk_widget_hide (child->widget); + } else { + num_items ++; + gtk_widget_show (child->widget); + g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (num_items)); + } + } + } + + g_hash_table_destroy (component_ids_hash); +} + + /* GtkObject methods. */ static void @@ -119,6 +167,8 @@ e_task_bar_prepend_task (ETaskBar *task_bar, gtk_widget_map (GTK_WIDGET (task_widget)); gtk_widget_queue_resize (GTK_WIDGET (task_widget)); } + + reduce_displayed_activities_per_component (task_bar); } void @@ -133,6 +183,8 @@ e_task_bar_remove_task (ETaskBar *task_bar, task_widget = e_task_bar_get_task_widget (task_bar, n); gtk_widget_destroy (GTK_WIDGET (task_widget)); + + reduce_displayed_activities_per_component (task_bar); } ETaskWidget * |