? autom4te-2.53.cache
? config.cache
? stamp-h1
? libwnck/ook
Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.36
diff -u -r1.36 tasklist.c
--- libwnck/tasklist.c	21 May 2002 10:22:45 -0000	1.36
+++ libwnck/tasklist.c	6 Jun 2002 20:29:06 -0000
@@ -77,6 +77,8 @@
 		     if this is an application */
   gboolean really_toggling; /* Set when tasklist really wants
 			       to change the togglebutton state */
+  
+  gboolean is_visible;
   gulong state_changed_tag;
   gulong icon_changed_tag;
   gulong name_changed_tag;
@@ -101,6 +103,7 @@
   WnckTask *active_app; /* NULL if active window not in tasklist */
   
   gboolean include_all_workspaces;
+  gboolean include_only_minimized;
   
   /* Calculated by update_lists */
   GList *windows;
@@ -137,6 +140,7 @@
 						 WnckWindow      *window);
 static WnckTask *wnck_task_new_from_application (WnckTasklist    *tasklist,
 						 WnckApplication *application);
+static void wnck_task_set_app_visibility   (WnckTask        *task);
 
 static char      *wnck_task_get_text (WnckTask *task);
 static GdkPixbuf *wnck_task_get_icon (WnckTask *task);
@@ -357,6 +361,7 @@
   tasklist->priv = g_new0 (WnckTasklistPrivate, 1);
 
   tasklist->priv->include_all_workspaces = FALSE;
+  tasklist->priv->include_only_minimized = FALSE;
   
   tasklist->priv->win_hash = g_hash_table_new (NULL, NULL);
   tasklist->priv->app_hash = g_hash_table_new (NULL, NULL);
@@ -393,12 +398,9 @@
 
   tasklist = WNCK_TASKLIST (object);
 
-  /* Tasks should have gone away due to removing their
-   * buttons in container destruction
-   */
+  wnck_tasklist_free_tasks (tasklist);
   g_assert (tasklist->priv->windows == NULL);
   g_assert (tasklist->priv->applications == NULL);
-  /* wnck_tasklist_free_tasks (tasklist); */
   
   g_hash_table_destroy (tasklist->priv->win_hash);
   tasklist->priv->win_hash = NULL;
@@ -464,6 +466,22 @@
 }
 
 void
+wnck_tasklist_set_include_only_minimized (WnckTasklist *tasklist,
+					  gboolean      include_only_minimized)
+{
+  g_return_if_fail (WNCK_IS_TASKLIST (tasklist));
+
+  include_only_minimized = (include_only_minimized != 0);
+
+  if (tasklist->priv->include_only_minimized == include_only_minimized)
+    return;
+  
+  tasklist->priv->include_only_minimized = include_only_minimized;
+  wnck_tasklist_update_lists (tasklist);
+  gtk_widget_queue_resize (GTK_WIDGET (tasklist));
+}
+
+void
 wnck_tasklist_set_grouping_limit (WnckTasklist *tasklist,
 				  gint          limit)
 {
@@ -670,12 +688,14 @@
     {
       WnckTask *task = WNCK_TASK (l->data);
 
+      if (task->button) {
       gtk_widget_size_request (task->button, &child_req);
       
       max_height = MAX (child_req.height,
 			max_height);
       max_width = MAX (child_req.width,
 		       max_width);
+      }
       
       l = l->next;
     }
@@ -685,12 +705,14 @@
     {
       WnckTask *task = WNCK_TASK (l->data);
       
+      if (task->button) {
       gtk_widget_size_request (task->button, &child_req);
       
       max_height = MAX (child_req.height,
 			max_height);
       max_width = MAX (child_req.width,
 		       max_width);
+      }
       
       l = l->next;
     }
@@ -730,6 +752,15 @@
   /* Calculate size_hints list */
   
   n_windows = g_list_length (tasklist->priv->windows);
+  l = tasklist->priv->windows;
+  while (l != NULL)
+    {
+	    WnckTask *task = WNCK_TASK (l->data);
+	    l = l->next;
+	    if (!task->is_visible)
+		    n_windows--;
+    }
+
   n_grouped_buttons = 0;
   ungrouped_apps = g_list_copy (tasklist->priv->applications);
   score_set = FALSE;
@@ -850,6 +881,14 @@
   tasklist = WNCK_TASKLIST (widget);
 
   n_windows = g_list_length (tasklist->priv->windows);
+  l = tasklist->priv->windows;
+  while (l != NULL)
+    {
+	    WnckTask *task = WNCK_TASK (l->data);
+	    l = l->next;
+	    if (!task->is_visible)
+		    n_windows--;
+    }
   n_grouped_buttons = 0;
   ungrouped_apps = g_list_copy (tasklist->priv->applications);
   score_set = FALSE;
@@ -888,14 +927,17 @@
 	    {
 	      win_task = WNCK_TASK (l->data);
 	      
+	      if (win_task->is_visible)
 	      gtk_widget_set_child_visible (GTK_WIDGET (win_task->button), FALSE);
 	      l = l->next;
 	    }
 	}
       else
 	{
+	  if (app_task->is_visible) {
 	  visible_tasks = g_list_prepend (visible_tasks, app_task->windows->data);
 	  gtk_widget_set_child_visible (GTK_WIDGET (app_task->button), FALSE);
+	  }
 	}
       
       button_width = wnck_tasklist_layout (allocation,
@@ -911,8 +953,10 @@
     {
       app_task = WNCK_TASK (l->data);
       
+      if (app_task->is_visible) {
       visible_tasks = g_list_concat (visible_tasks, g_list_copy (app_task->windows));
       gtk_widget_set_child_visible (GTK_WIDGET (app_task->button), FALSE);
+      }
       l = l->next;
     }
 
@@ -927,6 +971,8 @@
   while (l != NULL)
     {
       WnckTask *task = WNCK_TASK (l->data);
+      
+      if (task->is_visible) {
       int col = i % n_cols;
       int row = i / n_cols;
       
@@ -941,6 +987,7 @@
       gtk_widget_set_child_visible (GTK_WIDGET (task->button), TRUE);
 
       i++;
+      }
       l = l->next;
     }
   g_list_free (visible_tasks);
@@ -968,6 +1015,7 @@
       WnckTask *task = WNCK_TASK (tmp->data);
       tmp = tmp->next;
       
+      if (task->button)
       (* callback) (task->button, callback_data);
     }
   
@@ -977,6 +1025,7 @@
       WnckTask *task = WNCK_TASK (tmp->data);
       tmp = tmp->next;
       
+      if (task->button)
       (* callback) (task->button, callback_data);
     }
 }
@@ -1084,7 +1133,16 @@
           /* if we just unref the task it means we lose our ref to the
            * task before we unparent the button, which breaks stuff.
            */
+	  if (task->button) {
 	  gtk_widget_destroy (task->button);
+	  } else {
+		  g_hash_table_remove (tasklist->priv->win_hash,
+			       task->window);
+		  tasklist->priv->windows =
+			  g_list_remove (tasklist->priv->windows,
+					 task);
+		  g_object_unref (task);
+	  }
 	}
     }
   g_assert (tasklist->priv->windows == NULL);
@@ -1100,7 +1158,16 @@
           /* if we just unref the task it means we lose our ref to the
            * task before we unparent the button, which breaks stuff.
            */
+	  if (task->button)
 	  gtk_widget_destroy (task->button);
+	  else {
+		  g_hash_table_remove (tasklist->priv->app_hash,
+			       task->application);
+		  tasklist->priv->applications =
+			  g_list_remove (tasklist->priv->applications,
+					 task);
+		  g_object_unref (task);
+	  }
 	}
     }
   g_assert (tasklist->priv->applications == NULL);
@@ -1114,33 +1181,26 @@
   WnckWindow *win;
   WnckApplication *app;
   GList *l;
-  WnckWorkspace *active_workspace;
   WnckTask *app_task;
   WnckTask *win_task;
 
   wnck_tasklist_free_tasks (tasklist);
   
-  active_workspace = wnck_screen_get_active_workspace (tasklist->priv->screen);  
   windows = wnck_screen_get_windows (tasklist->priv->screen);
   
   l = windows;
   while (l != NULL)
     {
-      WnckWindowState state;
       win = WNCK_WINDOW (l->data);
 
-      state = wnck_window_get_state (win);
-      if ((state & WNCK_WINDOW_STATE_SKIP_TASKLIST) == 0 &&
-	  (tasklist->priv->include_all_workspaces ||
-	   active_workspace == NULL ||
-	   wnck_window_is_on_workspace (win, active_workspace)))
-	{
 	  win_task = wnck_task_new_from_window (tasklist, win);
 	  tasklist->priv->windows = g_list_prepend (tasklist->priv->windows, win_task);
 	  g_hash_table_insert (tasklist->priv->win_hash, win, win_task);
 	  
-	  gtk_widget_set_parent (win_task->button, GTK_WIDGET (tasklist));
-	  gtk_widget_show (win_task->button);
+	  if (win_task->button) {
+	    gtk_widget_set_parent (win_task->button, GTK_WIDGET (tasklist));
+	    gtk_widget_show (win_task->button);
+	  }
 	  
 	  app = wnck_window_get_application (win);
 	  app_task = g_hash_table_lookup (tasklist->priv->app_hash, app);
@@ -1148,16 +1208,18 @@
 	  if (app_task == NULL)
 	    {
 	      app_task = wnck_task_new_from_application (tasklist, app);
-	      gtk_widget_set_parent (app_task->button, GTK_WIDGET (tasklist));
-	      gtk_widget_show (app_task->button);
 	      
 	      tasklist->priv->applications = g_list_prepend (tasklist->priv->applications,
 							     app_task);
 	      g_hash_table_insert (tasklist->priv->app_hash, app, app_task);
 	    }
+	    if (win_task->is_visible && !app_task->is_visible) {
+	      wnck_task_set_app_visibility(app_task);
+	      gtk_widget_set_parent (app_task->button, GTK_WIDGET (tasklist));
+	      gtk_widget_show (app_task->button);
+	    }
 	  
 	    app_task->windows = g_list_prepend (app_task->windows, win_task);
-	}
       
       l = l->next;
     }
@@ -1169,7 +1231,7 @@
       app_task = WNCK_TASK (l->data);
 
       app_task->windows = g_list_sort (app_task->windows, wnck_task_compare);
-
+      
       /* so the number of windows in the task gets reset on the
        * task label
        */
@@ -1190,8 +1252,8 @@
   if (active_task &&
       active_task == tasklist->priv->active_task)
     return;
-
-  if (tasklist->priv->active_task)
+  
+  if (tasklist->priv->active_task && tasklist->priv->active_task->is_visible)
     {
       tasklist->priv->active_task->really_toggling = TRUE;
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tasklist->priv->active_task->button),
@@ -1201,7 +1263,7 @@
   
   tasklist->priv->active_task = active_task;
   
-  if (tasklist->priv->active_task)
+  if (tasklist->priv->active_task && tasklist->priv->active_task->is_visible)
     {
       tasklist->priv->active_task->really_toggling = TRUE;
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tasklist->priv->active_task->button),
@@ -1218,7 +1280,7 @@
 	  active_task == tasklist->priv->active_app)
 	return;
 
-      if (tasklist->priv->active_app)
+      if (tasklist->priv->active_app && tasklist->priv->active_app->is_visible)
 	{
 	  tasklist->priv->active_app->really_toggling = TRUE;
 	  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tasklist->priv->active_app->button),
@@ -1228,7 +1290,7 @@
   
       tasklist->priv->active_app = active_task;
   
-      if (tasklist->priv->active_app)
+      if (tasklist->priv->active_app && tasklist->priv->active_app->is_visible)
 	{
 	  tasklist->priv->active_app->really_toggling = TRUE;
 	  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tasklist->priv->active_app->button),
@@ -1247,7 +1309,7 @@
 	for (list = tasklist->priv->windows; list; list = list->next) {
 		WnckTask *task = WNCK_TASK (list->data);
 		
-		if (!GTK_WIDGET_REALIZED (task->button))
+		if (!task->button || !GTK_WIDGET_REALIZED (task->button))
 			continue;
 
 		gdk_window_get_origin (GTK_BUTTON (task->button)->event_window,
@@ -1638,6 +1700,7 @@
   GdkPixbuf *pixbuf;
   char *text;
 
+  if (task->is_visible) {
   pixbuf = wnck_task_get_icon (task);
   gtk_image_set_from_pixbuf (GTK_IMAGE (task->image),
 			     pixbuf);
@@ -1650,6 +1713,7 @@
   g_free (text);
 
   gtk_widget_queue_resize (GTK_WIDGET (task->tasklist));
+  }
 }
 
 static void
@@ -1683,6 +1747,10 @@
 	  if (app_task)
 	    wnck_task_update_visible_state (app_task);
 	}
+        if (tasklist->priv->include_only_minimized) {
+	  wnck_tasklist_update_lists  (tasklist);
+	  gtk_widget_queue_resize (GTK_WIDGET (tasklist));
+	}
     }
     
 }
@@ -1765,6 +1833,7 @@
   GdkPixbuf *pixbuf;
   char *text;
   
+  if (task->is_visible) {
   task->button = gtk_toggle_button_new ();
   g_object_add_weak_pointer (G_OBJECT (task->button),
                              (void**) &task->button);
@@ -1819,7 +1888,12 @@
                            G_CALLBACK (wnck_task_button_press_event),
                            G_OBJECT (task),
                            0);
+  }
+}
 
+static void
+wnck_task_map_signals (WnckTask *task)
+{
   if (task->is_application)
     {
       task->app_name_changed_tag = g_signal_connect (G_OBJECT (task->application), "name_changed",
@@ -1834,7 +1908,6 @@
       task->name_changed_tag = g_signal_connect (G_OBJECT (task->window), "name_changed",
 						 G_CALLBACK (wnck_task_name_changed), task);
     }
-
 }
 
 static void
@@ -1909,15 +1982,29 @@
 			   WnckWindow   *window)
 {
   WnckTask *task;
+  WnckWindowState state;
+  WnckWorkspace *active_workspace;
+  
+  active_workspace = wnck_screen_get_active_workspace (tasklist->priv->screen);  
 
   task = g_object_new (WNCK_TYPE_TASK, NULL);
 
   task->is_application = FALSE;
+  state = wnck_window_get_state(window);
+  if ( (!tasklist->priv->include_only_minimized || (state & WNCK_WINDOW_STATE_MINIMIZED)) &&
+       (active_workspace == NULL || tasklist->priv->include_all_workspaces ||
+	wnck_window_is_on_workspace(window, active_workspace)) &&
+       !(state & WNCK_WINDOW_STATE_SKIP_TASKLIST) )
+    task->is_visible = TRUE;
+  else
+    task->is_visible = FALSE;
   task->window = g_object_ref (window);
   task->application = g_object_ref (wnck_window_get_application (window));
   task->tasklist = tasklist;
   
-  wnck_task_create_widgets (task);
+  if (task->is_visible)
+    wnck_task_create_widgets (task);
+  wnck_task_map_signals (task);
 
   return task;
 }
@@ -1931,16 +2018,24 @@
   task = g_object_new (WNCK_TYPE_TASK, NULL);
 
   task->is_application = TRUE;
+  task->is_visible = FALSE;
   task->application = g_object_ref (application);
   task->window = NULL;
   task->tasklist = tasklist;
   
+  wnck_task_map_signals (task);
+  
+  return task;
+}
+
+static void
+wnck_task_set_app_visibility (WnckTask *task)
+{
+  task->is_visible = TRUE;
   wnck_task_create_widgets (task);
   
   g_signal_connect_object (task->button, "expose_event",
                            G_CALLBACK (wnck_task_app_expose),
                            G_OBJECT (task),
                            G_CONNECT_AFTER);
-  
-  return task;
 }
Index: libwnck/tasklist.h
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.h,v
retrieving revision 1.9
diff -u -r1.9 tasklist.h
--- libwnck/tasklist.h	14 May 2002 17:44:42 -0000	1.9
+++ libwnck/tasklist.h	6 Jun 2002 20:29:06 -0000
@@ -71,6 +71,8 @@
 				       gint          limit);
 void wnck_tasklist_set_include_all_workspaces (WnckTasklist *tasklist,
 					       gboolean      include_all_workspaces);
+void wnck_tasklist_set_include_only_minimized (WnckTasklist *tasklist,
+					       gboolean      include_only_minimized);
 void wnck_tasklist_set_minimum_width (WnckTasklist *tasklist, gint size);
 gint wnck_tasklist_get_minimum_width (WnckTasklist *tasklist);
 void wnck_tasklist_set_minimum_height (WnckTasklist *tasklist, gint size);
Index: libwnck/test-tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/test-tasklist.c,v
retrieving revision 1.7
diff -u -r1.7 test-tasklist.c
--- libwnck/test-tasklist.c	14 May 2002 16:55:38 -0000	1.7
+++ libwnck/test-tasklist.c	6 Jun 2002 20:29:06 -0000
@@ -31,6 +31,8 @@
                     NULL);
 
   tasklist = wnck_tasklist_new (screen);
+  
+  wnck_tasklist_set_include_only_minimized (tasklist, TRUE);
 
   wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist), WNCK_TASKLIST_AUTO_GROUP);
   frame = gtk_frame_new (NULL);
