Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.40
diff -u -u -r1.40 tasklist.c
--- libwnck/tasklist.c	13 Aug 2002 03:54:15 -0000	1.40
+++ libwnck/tasklist.c	24 Aug 2002 14:20:58 -0000
@@ -442,6 +442,45 @@
   G_OBJECT_CLASS (tasklist_parent_class)->finalize (object);
 }
 
+void 
+wnck_tasklist_minimize_active_workspace (WnckTasklist             *tasklist)
+{
+  WnckWorkspace *active_workspace;
+  WnckWorkspace *window_workspace;
+  GList *tmp;
+  
+  active_workspace = wnck_screen_get_active_workspace (tasklist->priv->screen);
+
+  tmp = tasklist->priv->windows;
+  while (tmp != NULL)
+    {
+      WnckTask *task = WNCK_TASK (tmp->data);
+      tmp = tmp->next;
+      
+      window_workspace = wnck_window_get_workspace (task->window);
+      if (window_workspace &&
+          window_workspace == active_workspace)
+	{
+	  wnck_window_minimize(task->window);
+	}
+    }
+  
+  tmp = tasklist->priv->applications;
+  while (tmp != NULL)
+    {
+      WnckTask *task = WNCK_TASK (tmp->data);
+      tmp = tmp->next;
+      
+      window_workspace = wnck_window_get_workspace (task->window);
+      if (window_workspace &&
+          window_workspace == active_workspace)
+	{
+	  wnck_window_minimize(task->window);
+	}
+    }
+
+}
+
 void
 wnck_tasklist_set_grouping (WnckTasklist            *tasklist,
 			    WnckTasklistGroupingType grouping)
Index: libwnck/tasklist.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.h,v
retrieving revision 1.9
diff -u -u -r1.9 tasklist.h
--- libwnck/tasklist.h	14 May 2002 17:44:42 -0000	1.9
+++ libwnck/tasklist.h	24 Aug 2002 14:20:59 -0000
@@ -63,6 +63,7 @@
 const int *wnck_tasklist_get_size_hint_list (WnckTasklist  *tasklist,
 					      int           *n_elements);
 
+void wnck_tasklist_minimize_active_workspace (WnckTasklist *tasklist);
 void wnck_tasklist_set_grouping (WnckTasklist             *tasklist,
 				 WnckTasklistGroupingType  grouping);
 void wnck_tasklist_set_switch_workspace_on_unminimize (WnckTasklist  *tasklist,
Index: libwnck/test-tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/test-tasklist.c,v
retrieving revision 1.7
diff -u -u -r1.7 test-tasklist.c
--- libwnck/test-tasklist.c	14 May 2002 16:55:38 -0000	1.7
+++ libwnck/test-tasklist.c	24 Aug 2002 14:20:59 -0000
@@ -2,14 +2,24 @@
 #include <libwnck/libwnck.h>
 #include <gtk/gtk.h>
 
+void minimize_all (GtkButton *button, gpointer data)
+{
+   WnckTasklist *tasklist = WNCK_TASKLIST(data);
+   g_assert (data != NULL);
+
+   wnck_tasklist_minimize_active_workspace(tasklist);   
+}
+
 int
 main (int argc, char **argv)
 {
   WnckScreen *screen;
   GtkWidget *win;
   GtkWidget *frame;
+  GtkWidget *box;
   GtkWidget *tasklist;
-  
+  GtkWidget *minimize_button;
+   
   gtk_init (&argc, &argv);
 
   screen = wnck_screen_get_default ();
@@ -37,9 +47,18 @@
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
   gtk_container_add (GTK_CONTAINER (win), frame);
 
-  gtk_container_add (GTK_CONTAINER (frame), tasklist);  
-
+  box = gtk_vbox_new(FALSE, 2);
+  minimize_button = gtk_button_new_with_label("Minimize current workspace");
+  g_signal_connect (G_OBJECT(minimize_button), "clicked",
+		    G_CALLBACK (minimize_all), 
+		    (gpointer) tasklist);
+  gtk_box_pack_start_defaults(GTK_BOX(box), minimize_button);
+  gtk_box_pack_start_defaults(GTK_BOX(box), tasklist);
   gtk_widget_show (tasklist);
+  gtk_widget_show (minimize_button);
+  gtk_widget_show (box);
+
+  gtk_container_add (GTK_CONTAINER (frame), box);
   gtk_widget_show (frame);
 
   gtk_window_move (GTK_WINDOW (win), 0, 0);
Index: libwnck/window.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/window.c,v
retrieving revision 1.27
diff -u -u -r1.27 window.c
--- libwnck/window.c	9 Aug 2002 15:25:25 -0000	1.27
+++ libwnck/window.c	24 Aug 2002 14:21:02 -0000
@@ -827,6 +827,8 @@
 WnckWorkspace*
 wnck_window_get_workspace (WnckWindow *window)
 {
+  if (!window)
+    return NULL;
   if (window->priv->workspace == ALL_WORKSPACES)
     return NULL;
   else
