#
# This file is an UNOFFICIAL patch for LXPanel to enable "Close all windows" feature.
# 
# Copyleft of Vincenzo di Cicco aka 0xNaN <enzodicicco@gmail.com>
#
#
# This patch is free software: you can redistribuite it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This patch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this patch. If not, see <http://www.gnu.org/licenses/>.
#
#
194a195
> static void taskbar_close_all_windows (GtkWidget * widget, Task * tk);
1061a1063,1072
> /* Handler for "activate" event from "close all windows" menu*/
> static void taskbar_close_all_windows (GtkWidget * widget, Task * tk )
> {	
> 	Task * tk_cursor;
> 	for (tk_cursor = tk->res_class->res_class_head; tk_cursor != NULL; tk_cursor = tk_cursor->res_class_flink)
> 	{
> 		Xclimsgwm(tk_cursor->win, a_WM_PROTOCOLS, a_WM_DELETE_WINDOW);
> 	}
> }
> 
1073,1086c1084,1107
<         Task * tk_cursor;
<         for (tk_cursor = tc->res_class_head; tk_cursor != NULL; tk_cursor = tk_cursor->res_class_flink)
<         {
<             if (task_is_visible_on_current_desktop(tb, tk_cursor))
<             {
<                 /* The menu item has the name, or the iconified name, and the icon of the application window. */
<                 GtkWidget * mi = gtk_image_menu_item_new_with_label(((tk_cursor->iconified) ? tk_cursor->name_iconified : tk_cursor->name));
<                 GtkWidget * im = gtk_image_new_from_pixbuf(gtk_image_get_pixbuf(GTK_IMAGE(tk_cursor->image)));
<                 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), im);
<                 g_signal_connect(mi, "button_press_event", G_CALLBACK(taskbar_popup_activate_event), (gpointer) tk_cursor);
< 	        gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
<             }
<         }
< 
---
>         if( event->button == 1 ) 
> 		{
> 			/* Left click on gruped-task. */
> 			Task * tk_cursor;
> 	        for (tk_cursor = tc->res_class_head; tk_cursor != NULL; tk_cursor = tk_cursor->res_class_flink)
> 	        {
>         	    if (task_is_visible_on_current_desktop(tb, tk_cursor))
> 	            {
> 	       	        /* The menu item has the name, or the iconified name, and the icon of the application window. */
>         	        GtkWidget * mi = gtk_image_menu_item_new_with_label(((tk_cursor->iconified) ? tk_cursor->name_iconified : tk_cursor->name));
>                 	GtkWidget * im = gtk_image_new_from_pixbuf(gtk_image_get_pixbuf(GTK_IMAGE(tk_cursor->image)));
> 	                gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), im);
> 	                g_signal_connect(mi, "button_press_event", G_CALLBACK(taskbar_popup_activate_event), (gpointer) tk_cursor);
> 					gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
>             	}
>         	}	
> 		}
> 		else if(event->button == 3)
> 		{
> 			/* Right click on gruped-task. */ 
> 			GtkWidget * mi = gtk_menu_item_new_with_mnemonic (_("_Close all windows"));
> 			gtk_menu_append ( GTK_MENU(menu), mi);
> 			g_signal_connect( mi, "activate", G_CALLBACK(taskbar_close_all_windows), tk);
> 		}
