tasklist applet, shared library version.



This patch makes the tasklist applet a shared library, it does support
multiple instances of the applet.

There is one known bug on deactivation that I will fix later.  I think
we should ship this as a shared library instead of a full blown
process (same applies to the deskguide).

Miguel.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/ChangeLog,v
retrieving revision 1.91
diff -u -r1.91 ChangeLog
--- ChangeLog	2000/10/22 09:38:29	1.91
+++ ChangeLog	2000/11/05 21:20:50
@@ -1,3 +1,19 @@
+2000-11-05  Miguel de Icaza  <miguel helixcode com>
+
+	* tasklist_properties.c: Move PropConfig to the TaskList structure
+	as well, to allow each instance to have its own configuration dialog.
+
+	* tasklist_applet.c: Remove unused prototypes, reoder functions to
+	avoid a couple of prototypes.
+
+2000-11-04  Miguel de Icaza  <miguel helixcode com>
+
+	* tasklist_applet.c (change_size): Removed dead code.
+	(show_task): Pass tasklist argument everywhere.
+
+	* tasklist_config.c (write_config): Remove globals.
+	(write_config, read_config): Pass TaskList argument.
+
 2000-10-22  Anders Carlsson  <andersca gnu org>
 
 	* tasklist_applet.c: Add patch from Eric Brayeur that gives
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- Makefile.am	2000/04/15 17:11:38	1.14
+++ Makefile.am	2000/11/05 21:20:50
@@ -10,26 +10,39 @@
 	-DVERSION=\""$(VERSION)"\" \
 	@PIXBUF_CFLAGS@
 
-bin_PROGRAMS = tasklist_applet
+#bin_PROGRAMS = tasklist_applet
+lib_LTLIBRARIES = libtasklist_applet.la
 
-tasklist_applet_SOURCES = tasklist_applet.c \
-			  tasklist_config.c \
-			  tasklist_icon.c \
-			  tasklist_menu.c \
-			  tasklist_properties.c \
-			  gstc.c \
-			  gwmh.c
+#tasklist_applet_SOURCES = 	\
+#	 tasklist_applet.c 	\
+#	 tasklist_config.c 	\
+#	 tasklist_icon.c 	\
+#	 tasklist_menu.c 	\
+#	 tasklist_properties.c 	\
+#	 gstc.c 			\
+#	 gwmh.c
+#
 
-tasklist_applet_LDADD = ../../panel/libpanel_applet.la \
-		     $(GNOME_LIBDIR) $(ORB_LIBS)         \
-		     $(GNOMEUI_LIBS) $(GNORBA_LIBS)      \
-		     $(INTLLIBS) @PIXBUF_LIBS@
+libtasklist_applet_la_SOURCES =\
+	 tasklist_applet.c 	\
+	 tasklist_config.c 	\
+	 tasklist_icon.c 	\
+	 tasklist_menu.c 	\
+	 tasklist_properties.c 	\
+	 gstc.c 		\
+	 gwmh.c
 
-EXTRA_DIST = \
-	pixmaps.h \
-	tasklist_applet.h \
-	tasklist_applet.gnorba \
-	tasklist_applet.desktop \
+#libtasklist_applet_la_LIBADD =				\
+#	../../panel/libpanel_applet.la 		\
+#	$(GNOME_LIBDIR) $(ORB_LIBS)		\
+#	$(GNOMEUI_LIBS) $(GNORBA_LIBS)		\
+#	$(INTLLIBS) @PIXBUF_LIBS@
+
+EXTRA_DIST = 			\
+	pixmaps.h 		\
+	tasklist_applet.h 	\
+	tasklist_applet.gnorba 	\
+	tasklist_applet.desktop	\
 	unknown.xpm		\
 	gnome-tasklist.png
 
Index: tasklist_applet.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_applet.c,v
retrieving revision 1.77
diff -u -r1.77 tasklist_applet.c
--- tasklist_applet.c	2000/10/22 09:38:29	1.77
+++ tasklist_applet.c	2000/11/05 21:20:52
@@ -10,58 +10,19 @@
 #include "tasklist_applet.h"
 #include "unknown.xpm"
 
-/* Prototypes */
-static void cb_properties (void);
-static void cb_about (void);
-gchar *fixup_task_label (TasklistTask *task);
-gboolean is_task_visible (TasklistTask *task);
-void draw_task (TasklistTask *task, GdkRectangle *rect);
-TasklistTask *find_gwmh_task (GwmhTask *gwmh_task);
-gboolean desk_notifier (gpointer func_data, GwmhDesk *desk, GwmhDeskInfoMask change_mask);
-gboolean task_notifier (gpointer func_data, GwmhTask *gwmh_task, GwmhTaskNotifyType ntype, GwmhTaskInfoMask imask);
-gboolean cb_button_press_event (GtkWidget *widget, GdkEventButton *event);
-gboolean cb_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time);
-void cb_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time);
-gboolean cb_motion_timeout (gpointer data);
-gboolean cb_expose_event (GtkWidget *widget, GdkEventExpose *event);
-void create_applet (void);
-TasklistTask *task_get_xy (gint x, gint y);
-GList *get_visible_tasks (void);
-gint get_horz_rows(void);
-gboolean show_task (TasklistTask *task);
-
-GNOME_Panel_OrientType tasklist_orient; /* Tasklist orient */
-GtkWidget *handle; /* The handle box */
-GtkWidget *applet; /* The applet */
-GtkWidget *area; /* The drawing area used to display tasks */
-GList *tasks = NULL; /* The list of tasks used */
-
-#define MOTION_TIMEOUT 500 /* Show task motion_task if cursor over task for ... msec */
-int motion_timeout = 0; /* Show task motion_task after MOTION_TIMEOUT in drag_motion */
-TasklistTask *motion_task = NULL; /* Task to show after motion_timeout */
-
-TasklistIcon *unknown_icon = NULL; /* The unknown icon */
-
-gint vert_height=0; /* Vertical height, used for resizing */
-gint horz_width=0;  /* Horizontal width, used for resizing */
-
-gint panel_size = 48;
-
-extern TasklistConfig Config;
-
 /* from gtkhandlebox.c */
 #define DRAG_HANDLE_SIZE 10
 
 /* get the horz_rows depending on the configuration settings */
 gint
-get_horz_rows(void)
+get_horz_rows(TaskList *tasklist)
 {
 	int result;
 
-	if (Config.follow_panel_size)
-		result = panel_size/ROW_HEIGHT;
+	if (tasklist->config.follow_panel_size)
+		result = tasklist->panel_size/ROW_HEIGHT;
 	else
-		result = Config.horz_rows;
+		result = tasklist->config.horz_rows;
 
 	if (result < 1)
 		result = 1;
@@ -71,16 +32,16 @@
 
 /* Shorten a label that is too long */
 gchar *
-fixup_task_label (TasklistTask *task)
+fixup_task_label (TaskList *tasklist, TasklistTask *task)
 {
 	gchar *str, *tempstr;
 	gint len, label_len;
 
-	label_len = gdk_string_width (area->style->font,
+	label_len = gdk_string_width (tasklist->area->style->font,
 				      task->gwmh_task->name);
 	
 	if (GWMH_TASK_ICONIFIED (task->gwmh_task))
-		label_len += gdk_string_width (area->style->font,
+		label_len += gdk_string_width (tasklist->area->style->font,
 					       "[]");
 
 	if (label_len > task->width - ROW_HEIGHT) {
@@ -93,10 +54,10 @@
 			wstr[0] = wstr[1] = wstr[2] = '?'; 
 			wstr[3] = '\0'; /* wcscpy(wstr,"???");*/
 			len = 3;
-			label_len = gdk_text_width_wc(area->style->font,
+			label_len = gdk_text_width_wc(tasklist->area->style->font,
                                                       wstr, len);
 			if (label_len <= task->width 
-			    - (Config.show_mini_icons ? 24:6)) {
+			    - (tasklist->config.show_mini_icons ? 24:6)) {
 				str = gdk_wcstombs(wstr);
 				g_free(wstr);
 				return str;
@@ -110,13 +71,13 @@
 			wstr[len] = '.';
 			wstr[len + 3] = '\0';
 			
-			label_len = gdk_text_width_wc (area->style->font,
+			label_len = gdk_text_width_wc (tasklist->area->style->font,
 						       wstr, len + 3);
 			
 			if (GWMH_TASK_ICONIFIED (task->gwmh_task))
-				label_len += gdk_string_width (area->style->font,
+				label_len += gdk_string_width (tasklist->area->style->font,
 							       "[]");
-			if (label_len <= task->width - (Config.show_mini_icons ? 24:6))
+			if (label_len <= task->width - (tasklist->config.show_mini_icons ? 24:6))
 				break;
 		}
 		str = gdk_wcstombs (wstr);
@@ -134,53 +95,10 @@
 	return str;
 }
 
-/* Check what task (if any) is at position x,y on the tasklist */
-TasklistTask *
-task_get_xy (gint x, gint y)
-{
-	GList *temp_tasks, *temp;
-	TasklistTask *task;
-
-	temp_tasks = get_visible_tasks ();
-
-	for (temp = temp_tasks; temp != NULL; temp = temp->next) {
-		task = (TasklistTask *)temp->data;
-		if (x > task->x &&
-		    x < task->x + task->width &&
-		    y > task->y &&
-		    y < task->y + task->height) {
-			g_list_free (temp_tasks);
-			return task;
-		}
-	}
-
-	if (temp_tasks != NULL)
-		g_list_free (temp_tasks);
-
-	return NULL;
-}
-
-/* Check which tasks are "visible",
-   if they should be drawn onto the tasklist */
-GList *
-get_visible_tasks (void)
-{
-	GList *temp_tasks;
-	GList *visible_tasks = NULL;
-
-	temp_tasks = tasks;
-	while (temp_tasks) {
-		if (is_task_visible ((TasklistTask *) temp_tasks->data))
-			visible_tasks = g_list_prepend (visible_tasks, temp_tasks->data);
-		temp_tasks = temp_tasks->next;
-	}
-	return g_list_reverse (visible_tasks);
-}
-
 /* Check if a task is "visible", 
    if it should be drawn onto the tasklist */
 gboolean
-is_task_visible (TasklistTask *task)
+is_task_visible (TaskList *tasklist, TasklistTask *task)
 {
 	GwmhDesk *desk_info;
 
@@ -194,17 +112,17 @@
 	    task->gwmh_task->harea != desk_info->current_harea ||
 	    task->gwmh_task->varea != desk_info->current_varea) {
 		if (!GWMH_TASK_STICKY (task->gwmh_task)) {
-			if (!Config.all_desks_minimized && 
-			    !Config.all_desks_normal)
+			if (!tasklist->config.all_desks_minimized && 
+			    !tasklist->config.all_desks_normal)
 				return FALSE;
 				
-			else if (Config.all_desks_minimized && 
-				 !Config.all_desks_normal) {
+			else if (tasklist->config.all_desks_minimized && 
+				 !tasklist->config.all_desks_normal) {
 				if (!GWMH_TASK_ICONIFIED (task->gwmh_task))
 					return FALSE;
 			}
-			else if (Config.all_desks_normal && 
-				 !Config.all_desks_minimized) {
+			else if (tasklist->config.all_desks_normal && 
+				 !tasklist->config.all_desks_minimized) {
 				if (GWMH_TASK_ICONIFIED (task->gwmh_task))
 					return FALSE;
 			}
@@ -212,19 +130,62 @@
 	}			
 
 	if (GWMH_TASK_ICONIFIED (task->gwmh_task)) {
-		if (!Config.show_minimized)
+		if (!tasklist->config.show_minimized)
 			return FALSE;
 	} else {
-		if (!Config.show_normal)
+		if (!tasklist->config.show_normal)
 			return FALSE;
 	}
 		
 	return TRUE;
 }
 
+/* Check which tasks are "visible",
+   if they should be drawn onto the tasklist */
+GList *
+get_visible_tasks (TaskList *tasklist)
+{
+	GList *temp_tasks;
+	GList *visible_tasks = NULL;
+
+	temp_tasks = tasklist->tasks;
+	while (temp_tasks) {
+		if (is_task_visible (tasklist, (TasklistTask *) temp_tasks->data))
+			visible_tasks = g_list_prepend (visible_tasks, temp_tasks->data);
+		temp_tasks = temp_tasks->next;
+	}
+	return g_list_reverse (visible_tasks);
+}
+
+/* Check what task (if any) is at position x,y on the tasklist */
+TasklistTask *
+task_get_xy (TaskList *tasklist, gint x, gint y)
+{
+	GList *temp_tasks, *temp;
+	TasklistTask *task;
+
+	temp_tasks = get_visible_tasks (tasklist);
+
+	for (temp = temp_tasks; temp != NULL; temp = temp->next) {
+		task = (TasklistTask *)temp->data;
+		if (x > task->x &&
+		    x < task->x + task->width &&
+		    y > task->y &&
+		    y < task->y + task->height) {
+			g_list_free (temp_tasks);
+			return task;
+		}
+	}
+
+	if (temp_tasks != NULL)
+		g_list_free (temp_tasks);
+
+	return NULL;
+}
+
 /* Draw a single task */
 void
-draw_task (TasklistTask *task, GdkRectangle *rect)
+draw_task (TaskList *tasklist, TasklistTask *task, GdkRectangle *rect)
 {
 	gchar *tempstr;
 	gint text_height, text_width;
@@ -233,29 +194,29 @@
 	TasklistIcon *icon;
 	GdkPixbuf *pixbuf;
 
-	if (!is_task_visible (task))
+	if (!is_task_visible (tasklist, task))
 		return;
 
-	gtk_paint_box (area->style, area->window,
+	gtk_paint_box (tasklist->area->style, tasklist->area->window,
 		       GWMH_TASK_FOCUSED (task->gwmh_task) ?
 		       GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
 		       GWMH_TASK_FOCUSED (task->gwmh_task) ?
 		       GTK_SHADOW_IN : GTK_SHADOW_OUT,
-		       rect, area, "button",
+		       rect, tasklist->area, "button",
 		       task->x, task->y,
 		       task->width, task->height);
 
 	if (task->gwmh_task->name) {
-		tempstr = fixup_task_label (task);
-		text_height = gdk_string_height (area->style->font, "1");
-		text_width = gdk_string_width (area->style->font, tempstr);
-		gdk_draw_string (area->window,
-				 area->style->font,
+		tempstr = fixup_task_label (tasklist, task);
+		text_height = gdk_string_height (tasklist->area->style->font, "1");
+		text_width = gdk_string_width (tasklist->area->style->font, tempstr);
+		gdk_draw_string (tasklist->area->window,
+				 tasklist->area->style->font,
 				 GWMH_TASK_FOCUSED (task->gwmh_task) ?
-				 area->style->fg_gc[GTK_STATE_ACTIVE] :
-				 area->style->fg_gc[GTK_STATE_NORMAL],
+				 tasklist->area->style->fg_gc[GTK_STATE_ACTIVE] :
+				 tasklist->area->style->fg_gc[GTK_STATE_NORMAL],
 				 task->x +
-				 (Config.show_mini_icons ? 10 : 0) +
+				 (tasklist->config.show_mini_icons ? 10 : 0) +
 				 ((task->width - text_width) / 2),
 				 task->y + ((task->height - text_height) / 2) + text_height,
 				 tempstr);
@@ -263,7 +224,7 @@
 		g_free (tempstr);
 	}
 
-	if (Config.show_mini_icons) {
+	if (tasklist->config.show_mini_icons) {
 		icon = task->icon;
 		
 		if (GWMH_TASK_ICONIFIED (task->gwmh_task))
@@ -272,7 +233,7 @@
 			pixbuf = icon->normal;
 
 		gdk_pixbuf_render_to_drawable_alpha (pixbuf,
-						     area->window,
+						     tasklist->area->window,
 						     0, 0,
 						     task->x + 3 + (16 - gdk_pixbuf_get_width (pixbuf)) / 2,
 						     task->y + (task->height - gdk_pixbuf_get_height (pixbuf)) / 2,
@@ -289,7 +250,7 @@
 
 /* Layout the tasklist */
 void
-layout_tasklist (void)
+layout_tasklist (TaskList *tasklist)
 {
 	gint j = 0, k = 0, num = 0, p = 0;
 	GList *temp_tasks, *temp;
@@ -298,26 +259,26 @@
 	gint num_rows = 0, num_cols = 0;
 	gint curx = 0, cury = 0, curwidth = 0, curheight = 0;
 	
-	temp_tasks = get_visible_tasks ();
+	temp_tasks = get_visible_tasks (tasklist);
 	num = g_list_length (temp_tasks);
 	
-	switch (applet_widget_get_panel_orient (APPLET_WIDGET (applet))) {
+	switch (applet_widget_get_panel_orient (APPLET_WIDGET (tasklist->applet))) {
 	case ORIENT_UP:
 	case ORIENT_DOWN:
 		if (num == 0) {
-			if (Config.horz_fixed)
-				horz_width = Config.horz_width;
+			if (tasklist->config.horz_fixed)
+				tasklist->horz_width = tasklist->config.horz_width;
 			else
-				horz_width = 4;
+				tasklist->horz_width = 4;
 			
-			change_size (FALSE);
+			change_size (tasklist, FALSE);
 			
-			gtk_widget_draw (area, NULL);
+			gtk_widget_draw (tasklist->area, NULL);
 			return;
 		}
 
 		while (p < num) {
-			if (num < get_horz_rows())
+			if (num < get_horz_rows(tasklist))
 				num_rows = num;
 			
 			j++;
@@ -326,25 +287,25 @@
 			if (num_rows < k + 1)
 				num_rows = k + 1;
 			
-			if (get_horz_rows () == 0 || j >= ((num + get_horz_rows() - 1) / get_horz_rows())) {
+			if (get_horz_rows (tasklist) == 0 || j >= ((num + get_horz_rows(tasklist) - 1) / get_horz_rows(tasklist))) {
 				j = 0;
 				k++;
 			}
 			p++;
 		}
 		
-		if (Config.horz_fixed) {
-			curheight = (ROW_HEIGHT * get_horz_rows() - 0) / num_rows;
-			curwidth = (Config.horz_width - 0) / num_cols;
+		if (tasklist->config.horz_fixed) {
+			curheight = (ROW_HEIGHT * get_horz_rows(tasklist) - 0) / num_rows;
+			curwidth = (tasklist->config.horz_width - 0) / num_cols;
 
 		} else {
-			curheight = (ROW_HEIGHT * get_horz_rows() - 0) / num_rows;
-			curwidth = Config.horz_taskwidth;
+			curheight = (ROW_HEIGHT * get_horz_rows(tasklist) - 0) / num_rows;
+			curwidth = tasklist->config.horz_taskwidth;
 
 			/* If the total width is higher than allowed, 
 			   we use the "fixed" way instead */
-			if ((curwidth * num_cols) > Config.horz_width)
-				curwidth = (Config.horz_width - 0) / num_cols;
+			if ((curwidth * num_cols) > tasklist->config.horz_width)
+				curwidth = (tasklist->config.horz_width - 0) / num_cols;
 		}
 
 
@@ -360,11 +321,11 @@
 			task->width = curwidth;
 			task->height = curheight;
 			
-			if (Config.horz_fixed) {
+			if (tasklist->config.horz_fixed) {
 				curx += curwidth;
 			
-				if (curx >= Config.horz_width ||
-				    curx + curwidth > Config.horz_width) {
+				if (curx >= tasklist->config.horz_width ||
+				    curx + curwidth > tasklist->config.horz_width) {
 					cury += curheight;
 					curx = 0;
 				}
@@ -379,12 +340,12 @@
 			}
 		}
 
-		if (Config.horz_fixed)
-			horz_width = Config.horz_width;
+		if (tasklist->config.horz_fixed)
+			tasklist->horz_width = tasklist->config.horz_width;
 		else
-			horz_width = num_cols * curwidth + 4;
+			tasklist->horz_width = num_cols * curwidth + 4;
 
-		change_size (FALSE);
+		change_size (tasklist, FALSE);
 
 		break;
 
@@ -392,22 +353,22 @@
 	case ORIENT_RIGHT:
 
 		if (num == 0) {
-			if (Config.vert_fixed)
-				vert_height = Config.vert_height;
+			if (tasklist->config.vert_fixed)
+				tasklist->vert_height = tasklist->config.vert_height;
 			else
-				vert_height = 4;
+				tasklist->vert_height = 4;
 			
-			change_size (FALSE);
+			change_size (tasklist, FALSE);
 			
-			gtk_widget_draw (area, NULL);
+			gtk_widget_draw (tasklist->area, NULL);
 			return;
 		}
 
 		curheight = ROW_HEIGHT;
-		if (Config.follow_panel_size)
-			curwidth = panel_size - 0;
+		if (tasklist->config.follow_panel_size)
+			curwidth = tasklist->panel_size - 0;
 		else
-			curwidth = Config.vert_width - 0;
+			curwidth = tasklist->config.vert_width - 0;
 		
 		num_cols = 1;
 		num_rows = num;
@@ -415,12 +376,12 @@
 		curx = 0;
 		cury = 0;
 
-		if (Config.vert_fixed)
-			vert_height = Config.vert_height;
+		if (tasklist->config.vert_fixed)
+			tasklist->vert_height = tasklist->config.vert_height;
 		else
-			vert_height = curheight * num_rows + 4;
+			tasklist->vert_height = curheight * num_rows + 4;
 		
-		change_size (FALSE);
+		change_size (tasklist, FALSE);
 
 		for (temp = temp_tasks; temp != NULL; temp = temp->next) {
 			task = (TasklistTask *) temp->data;
@@ -432,9 +393,9 @@
 			
 			curx += curwidth;
 
-			if (curx >= (Config.follow_panel_size?
-				     panel_size:
-				     Config.vert_width) - 0) {
+			if (curx >= (tasklist->config.follow_panel_size?
+				     tasklist->panel_size:
+				     tasklist->config.vert_width) - 0) {
 				cury += curheight;
 				curx = 0;
 			}
@@ -447,17 +408,17 @@
 		g_list_free (temp_tasks);
 
 	
-	gtk_widget_draw (area, NULL);
+	gtk_widget_draw (tasklist->area, NULL);
 }
 
 /* Get a task from the list that has got the given gwmh_task */
 TasklistTask *
-find_gwmh_task (GwmhTask *gwmh_task)
+find_gwmh_task (TaskList *tasklist, GwmhTask *gwmh_task)
 {
 	GList *temp_tasks;
 	TasklistTask *task;
 
-	temp_tasks = tasks;
+	temp_tasks = tasklist->tasks;
 
 	while (temp_tasks) {
 		task = (TasklistTask *)temp_tasks->data;
@@ -474,11 +435,13 @@
 desk_notifier (gpointer func_data, GwmhDesk *desk,
 	       GwmhDeskInfoMask change_mask)
 {
-	if (Config.all_desks_minimized && 
-	    Config.all_desks_normal)
+	TaskList *tasklist = (TaskList *) func_data;
+	
+	if (tasklist->config.all_desks_minimized && 
+	    tasklist->config.all_desks_normal)
 		return TRUE;
 
-	layout_tasklist ();
+	layout_tasklist (tasklist);
 
 	return TRUE;
 }
@@ -489,56 +452,57 @@
 	       GwmhTaskNotifyType ntype,
 	       GwmhTaskInfoMask imask)
 {
+	TaskList *tasklist = (TaskList *) func_data;
 	TasklistTask *task;
 	
 	switch (ntype)
 	{
 	case GWMH_NOTIFY_INFO_CHANGED:
 		if (imask & GWMH_TASK_INFO_WM_HINTS) {
-			if (tasklist_icon_get_pixmap (find_gwmh_task (gwmh_task)) !=
-			    find_gwmh_task (gwmh_task)->wmhints_icon) {
-				tasklist_icon_destroy (find_gwmh_task (gwmh_task));
-				tasklist_icon_set (find_gwmh_task (gwmh_task));
-				draw_task (find_gwmh_task (gwmh_task), NULL);
+			if (tasklist_icon_get_pixmap (find_gwmh_task (tasklist, gwmh_task)) !=
+			    find_gwmh_task (tasklist, gwmh_task)->wmhints_icon) {
+				tasklist_icon_destroy (tasklist, find_gwmh_task (tasklist, gwmh_task));
+				tasklist_icon_set (tasklist, find_gwmh_task (tasklist, gwmh_task));
+				draw_task (tasklist, find_gwmh_task (tasklist, gwmh_task), NULL);
 			}
 		}
 		if (imask & GWMH_TASK_INFO_GSTATE)
-			layout_tasklist ();
+			layout_tasklist (tasklist);
 		if (imask & GWMH_TASK_INFO_ICONIFIED)
-			layout_tasklist ();
+			layout_tasklist (tasklist);
 		if (imask & GWMH_TASK_INFO_FOCUSED)
-			draw_task (find_gwmh_task (gwmh_task), NULL);
+			draw_task (tasklist, find_gwmh_task (tasklist, gwmh_task), NULL);
 		if (imask & GWMH_TASK_INFO_MISC)
-			draw_task (find_gwmh_task (gwmh_task), NULL);
+			draw_task (tasklist, find_gwmh_task (tasklist, gwmh_task), NULL);
 		if (imask & GWMH_TASK_INFO_DESKTOP) {
-			if (Config.all_desks_minimized && 
-			    Config.all_desks_normal)
+			if (tasklist->config.all_desks_minimized && 
+			    tasklist->config.all_desks_normal)
 				break;
 
 			/* Redraw entire tasklist */
-			layout_tasklist ();
+			layout_tasklist (tasklist);
 		}
 		break;
 	case GWMH_NOTIFY_NEW:
 		task = g_malloc0 (sizeof (TasklistTask));
 		task->gwmh_task = gwmh_task;
 		task->wmhints_icon = tasklist_icon_get_pixmap (task);
-		tasklist_icon_set (task);
-		tasks = g_list_append (tasks, task);
-	        layout_tasklist ();
+		tasklist_icon_set (tasklist,task);
+		tasklist->tasks = g_list_append (tasklist->tasks, task);
+	        layout_tasklist (tasklist);
 		break;
 	case GWMH_NOTIFY_DESTROY:
-		task = find_gwmh_task (gwmh_task);
+		task = find_gwmh_task (tasklist, gwmh_task);
 		if(task) {
-			tasks = g_list_remove (tasks, task);
-			if (task == motion_task) {
-				motion_task = NULL;
+			tasklist->tasks = g_list_remove (tasklist->tasks, task);
+			if (task == tasklist->motion_task) {
+				tasklist->motion_task = NULL;
 			}
-			tasklist_icon_destroy (task);
+			tasklist_icon_destroy (tasklist, task);
 			if(task->menu)
 				gtk_widget_destroy(task->menu);
 			g_free (task);
-			layout_tasklist ();
+			layout_tasklist (tasklist);
 		}
 		break;
 	default:
@@ -550,11 +514,11 @@
 
 /* Show the task if need. Return TRUE if so */
 gboolean
-show_task (TasklistTask *task)
+show_task (TaskList *tasklist, TasklistTask *task)
 {
 	if (GWMH_TASK_ICONIFIED (task->gwmh_task) || !GWMH_TASK_FOCUSED (task->gwmh_task)) {
 	
-		if (!(Config.move_to_current && GWMH_TASK_ICONIFIED (task->gwmh_task))) {
+		if (!(tasklist->config.move_to_current && GWMH_TASK_ICONIFIED (task->gwmh_task))) {
 			GwmhDesk *desk_info;
 			desk_info = gwmh_desk_get_config ();
 					
@@ -582,18 +546,18 @@
 
 /* This routine gets called when the mouse is pressed */
 gboolean
-cb_button_press_event (GtkWidget *widget, GdkEventButton *event)
+cb_button_press_event (GtkWidget *widget, GdkEventButton *event, TaskList *tasklist)
 {
 	TasklistTask *task;
 	
-	task = task_get_xy ((gint)event->x, (gint)event->y);
+	task = task_get_xy (tasklist, (gint)event->x, (gint)event->y);
 
 	if (!task)
 		return FALSE;
 
 	if (event->button == 1) {
 
-		if (! show_task (task)) {
+		if (! show_task (tasklist, task)) {
 			gwmh_task_iconify (task->gwmh_task);
 		}
 
@@ -603,7 +567,7 @@
 	if (event->button == 3) {
 		gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
 					      "button_press_event");
-		menu_popup (task, event->button, event->time);
+		menu_popup (tasklist, task, event->button, event->time);
 		return TRUE;
 	}
 
@@ -611,68 +575,70 @@
 }
 
 void
-cb_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time)
+cb_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, TaskList *tasklist)
 {
-	if (motion_timeout) {
-		gtk_timeout_remove (motion_timeout);
-		motion_timeout = 0;
-		motion_task = NULL;
+	if (tasklist->motion_timeout) {
+		gtk_timeout_remove (tasklist->motion_timeout);
+		tasklist->motion_timeout = 0;
+		tasklist->motion_task = NULL;
 	}
 }
 
+gboolean 
+cb_motion_timeout (gpointer user_data)
+{
+	TaskList *tasklist = user_data;
+	
+	if (tasklist->motion_task) {
+		show_task (tasklist, tasklist->motion_task);
+	}
+
+	tasklist->motion_timeout = 0;
+	tasklist->motion_task = NULL;
+	
+	return FALSE;	
+}
+
 /* This routine gets called when user drag something over the tasklist */
 gboolean 
-cb_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time)
+cb_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, TaskList *tasklist)
 {
 	TasklistTask *task;
 	
 	gdk_drag_status (context, 0, time);
 	
-	task = task_get_xy (x, y);
+	task = task_get_xy (tasklist, x, y);
 	
-	if (task != motion_task) {
+	if (task != tasklist->motion_task) {
 	
-		if (motion_timeout) {
-			gtk_timeout_remove (motion_timeout);
+		if (tasklist->motion_timeout) {
+			gtk_timeout_remove (tasklist->motion_timeout);
 		}
 	
-		motion_task = task;
+		tasklist->motion_task = task;
 
 		if (task) {	
-			motion_timeout = gtk_timeout_add (MOTION_TIMEOUT, cb_motion_timeout, widget);		
+			tasklist->motion_timeout = gtk_timeout_add (MOTION_TIMEOUT, cb_motion_timeout, tasklist);		
 		} else {
-			motion_timeout = 0;
+			tasklist->motion_timeout = 0;
 		}
 	}
 	
 	return TRUE;
 }
 
-gboolean 
-cb_motion_timeout (gpointer data)
-{
-	if (motion_task) {
-		show_task (motion_task);
-	}
-
-	motion_timeout = 0;
-	motion_task = NULL;
-	
-	return FALSE;	
-}
-
 /* This routine gets called when the tasklist is exposed */
 gboolean
-cb_expose_event (GtkWidget *widget, GdkEventExpose *event)
+cb_expose_event (GtkWidget *widget, GdkEventExpose *event, TaskList *tasklist)
 {
 	GList *temp_tasks, *temp;
 	TasklistTask *task;
 
-	temp_tasks = get_visible_tasks ();
+	temp_tasks = get_visible_tasks (tasklist);
 
-	gtk_paint_flat_box (area->style, area->window,
-			    area->state, GTK_SHADOW_NONE,
-			    &event->area, area, "button",
+	gtk_paint_flat_box (tasklist->area->style, tasklist->area->window,
+			    tasklist->area->state, GTK_SHADOW_NONE,
+			    &event->area, tasklist->area, "button",
 			    0, 0, -1, -1);
 	
 	for (temp = temp_tasks; temp != NULL; temp = temp->next) {
@@ -685,7 +651,7 @@
 		rect.height = task->height;
 
 		if(gdk_rectangle_intersect(&event->area, &rect, &dest))
-			draw_task (task, &dest);
+			draw_task (tasklist, task, &dest);
 	}
 
 	if (temp_tasks != NULL)
@@ -696,19 +662,20 @@
 
 /* This routine gets called when the user selects "properties" */
 static void
-cb_properties (void)
+cb_properties (AppletWidget *applet, TaskList *tasklist)
 {
-	display_properties ();
+	display_properties (tasklist);
 }
 
 /* This routine gets called when the user selects "about" */
 static void
-cb_about (void)
+cb_about (AppletWidget *applet, TaskList *tasklist)
 {
 	static GtkWidget *dialog = NULL;
 
 	const char *authors[] = {
 		"Anders Carlsson (andersca gnu org)",
+		"Miguel de Icaza (miguel helixcode com)",
 		NULL
 	};
 
@@ -720,12 +687,13 @@
 		return;
 	}
 	
-	dialog = gnome_about_new ("Gnome Tasklist",
-				  VERSION,
-				  "Copyright (C) 1999 Anders Carlsson",
-				  authors,
-				  "A tasklist for the GNOME desktop environment.\nIcons by Tuomas Kuosmanen (tigert gimp org).",
-				  NULL);
+	dialog = gnome_about_new (
+		"Gnome Tasklist",
+		VERSION,
+		_("Copyright (C) 1999 Anders Carlsson"),
+		authors,
+		_("A tasklist for the GNOME desktop environment.\nIcons by Tuomas Kuosmanen (tigert gimp org)."),
+		NULL);
 	gtk_signal_connect (GTK_OBJECT(dialog), "destroy",
 			    GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
 
@@ -735,18 +703,18 @@
 
 /* Ignore mouse button 1 clicks */
 static gboolean
-ignore_1st_click (GtkWidget *widget, GdkEvent *event)
+ignore_1st_click (GtkWidget *widget, GdkEvent *event, TaskList *tasklist)
 {
 	GdkEventButton *buttonevent = (GdkEventButton *)event;
 
 	if (event->type == GDK_BUTTON_PRESS &&
 	    buttonevent->button == 1) {
-		if (buttonevent->window != area->window)
+		if (buttonevent->window != tasklist->area->window)
 			buttonevent->button = 2;
 	}
 	if (event->type == GDK_BUTTON_RELEASE &&
 	    buttonevent->button == 1) {
-		if (buttonevent->window != area->window)
+		if (buttonevent->window != tasklist->area->window)
 			buttonevent->button = 2;
 	}
 	 
@@ -755,68 +723,60 @@
 
 /* Changes size of the applet */
 void
-change_size (gboolean layout)
+change_size (TaskList *tasklist, gboolean layout)
 {
-	switch (applet_widget_get_panel_orient (APPLET_WIDGET (applet))) {
+	switch (applet_widget_get_panel_orient (APPLET_WIDGET (tasklist->applet))) {
 	case ORIENT_UP:
 	case ORIENT_DOWN:
-/*		if (Config.horz_fixed)
-			horz_width = Config.horz_width;
-		else
-		horz_width = 4;*/
-		GTK_HANDLE_BOX (handle)->handle_position = GTK_POS_LEFT;
-		gtk_widget_set_usize (handle, 
-				      DRAG_HANDLE_SIZE + horz_width,
-				      get_horz_rows() * ROW_HEIGHT);
-		gtk_drawing_area_size (GTK_DRAWING_AREA (area), 
-				       horz_width,
-				       get_horz_rows() * ROW_HEIGHT);
+		GTK_HANDLE_BOX (tasklist->handle)->handle_position = GTK_POS_LEFT;
+		gtk_widget_set_usize (tasklist->handle, 
+				      DRAG_HANDLE_SIZE + tasklist->horz_width,
+				      get_horz_rows(tasklist) * ROW_HEIGHT);
+		gtk_drawing_area_size (GTK_DRAWING_AREA (tasklist->area), 
+				       tasklist->horz_width,
+				       get_horz_rows(tasklist) * ROW_HEIGHT);
 		break;
 	case ORIENT_LEFT:
 	case ORIENT_RIGHT:
-/*		if (Config.vert_fixed)
-			vert_height = Config.vert_height;
-		else
-		vert_height = 4;*/
-		GTK_HANDLE_BOX (handle)->handle_position = GTK_POS_TOP;
-		gtk_widget_set_usize (handle, 
-				      (Config.follow_panel_size?
-				       panel_size:
-				       Config.vert_width),
-				      DRAG_HANDLE_SIZE + vert_height);
-		gtk_drawing_area_size (GTK_DRAWING_AREA (area), 
-				       (Config.follow_panel_size?
-					panel_size:
-					Config.vert_width),
-				       vert_height);
+		GTK_HANDLE_BOX (tasklist->handle)->handle_position = GTK_POS_TOP;
+		gtk_widget_set_usize (tasklist->handle, 
+				      (tasklist->config.follow_panel_size?
+				       tasklist->panel_size:
+				       tasklist->config.vert_width),
+				      DRAG_HANDLE_SIZE + tasklist->vert_height);
+		gtk_drawing_area_size (GTK_DRAWING_AREA (tasklist->area), 
+				       (tasklist->config.follow_panel_size?
+					tasklist->panel_size:
+					tasklist->config.vert_width),
+				       tasklist->vert_height);
 	}
+
 	if (layout)
-		layout_tasklist ();
+		layout_tasklist (tasklist);
 }
 
 /* Called when the panel's orient changes */
 static void
-cb_change_orient (GtkWidget *widget, GNOME_Panel_OrientType orient)
+cb_change_orient (GtkWidget *widget, GNOME_Panel_OrientType orient, TaskList *tasklist)
 {
-	
-	tasklist_orient = orient;
+	tasklist->tasklist_orient = orient;
 
 	/* Change size accordingly */
-	change_size (TRUE);
+	change_size (tasklist, TRUE);
 }
 
 static void
-cb_change_pixel_size (GtkWidget *widget, int size)
+cb_change_pixel_size (GtkWidget *widget, int size, TaskList *tasklist)
 {
-	panel_size = size;
+	tasklist->panel_size = size;
 	
 	/* Change size accordingly */
-	if(Config.follow_panel_size)
-		change_size (TRUE);
+	if(tasklist->config.follow_panel_size)
+		change_size (tasklist, TRUE);
 }
 
 static void
-cb_help (GtkWidget *w, gpointer data)
+cb_help (AppletWidget *w, TaskList *tasklist)
 {
 	GnomeHelpMenuEntry help_entry = { "tasklist_applet",
 					  "index.html" };
@@ -824,75 +784,126 @@
 }
 
 /* Create the applet */
-void
-create_applet (void)
+TaskList *
+tasklist_new (void)
 {
+	TaskList *tasklist;
 	GtkWidget *hbox;
 
-	applet = applet_widget_new ("tasklist_applet");
-	
+	tasklist = g_new0 (TaskList, 1);
+	tasklist->panel_size = 48;
+	tasklist->horz_width = 0;
+	tasklist->vert_height = 0;
+
+	tasklist->applet = applet_widget_new ("tasklist_applet");
+
 	hbox = gtk_hbox_new (FALSE, 0);
 	gtk_widget_show (hbox);
-	applet_widget_add (APPLET_WIDGET (applet), hbox);
+	applet_widget_add (APPLET_WIDGET (tasklist->applet), hbox);
 	
-	handle = gtk_handle_box_new ();
-	gtk_signal_connect (GTK_OBJECT (handle), "event",
-			    GTK_SIGNAL_FUNC (ignore_1st_click), NULL);
+	tasklist->handle = gtk_handle_box_new ();
+	gtk_signal_connect (GTK_OBJECT (tasklist->handle), "event",
+			    GTK_SIGNAL_FUNC (ignore_1st_click), tasklist);
 
-	area = gtk_drawing_area_new ();
+	tasklist->area = gtk_drawing_area_new ();
 
-	gtk_widget_show (area);
-	gtk_widget_show (handle);
-	gtk_container_add (GTK_CONTAINER (handle), area);
-	gtk_container_add (GTK_CONTAINER (hbox), handle);
+	{
+		GtkWidget *label = gtk_label_new ("LA LA LA");
 
-	gtk_widget_set_events (area, GDK_EXPOSURE_MASK | 
+		gtk_widget_show (label);
+		gtk_container_add (GTK_CONTAINER (tasklist->handle), tasklist->area);
+	}
+#if 0
+	gtk_container_add (GTK_CONTAINER (tasklist->handle), tasklist->area);
+#endif
+	gtk_container_add (GTK_CONTAINER (hbox), tasklist->handle);
+
+	read_config (tasklist);
+	
+	gtk_widget_set_events (tasklist->area, GDK_EXPOSURE_MASK | 
 			       GDK_BUTTON_PRESS_MASK |
 			       GDK_BUTTON_RELEASE_MASK);
-	gtk_signal_connect (GTK_OBJECT (area), "expose_event",
-			    GTK_SIGNAL_FUNC (cb_expose_event), NULL);
-	gtk_signal_connect (GTK_OBJECT (area), "button_press_event",
-			    GTK_SIGNAL_FUNC (cb_button_press_event), NULL);
-	gtk_signal_connect (GTK_OBJECT (area), "drag_motion",
-			    GTK_SIGNAL_FUNC (cb_drag_motion), NULL);
-	gtk_signal_connect (GTK_OBJECT (area), "drag_leave",
-			    GTK_SIGNAL_FUNC (cb_drag_leave), NULL);			    
+	gtk_signal_connect (GTK_OBJECT (tasklist->area), "expose_event",
+			    GTK_SIGNAL_FUNC (cb_expose_event), tasklist);
+	gtk_signal_connect (GTK_OBJECT (tasklist->area), "button_press_event",
+			    GTK_SIGNAL_FUNC (cb_button_press_event), tasklist);
+	gtk_signal_connect (GTK_OBJECT (tasklist->area), "drag_motion",
+			    GTK_SIGNAL_FUNC (cb_drag_motion), tasklist);
+	gtk_signal_connect (GTK_OBJECT (tasklist->area), "drag_leave",
+			    GTK_SIGNAL_FUNC (cb_drag_leave), tasklist);			    
 			    
 			    
-	gtk_drag_dest_set (GTK_WIDGET (area), 0,
+	gtk_drag_dest_set (GTK_WIDGET (tasklist->area), 0,
 	 		   NULL, 0, GDK_ACTION_COPY);  
+
+	gtk_signal_connect (GTK_OBJECT (tasklist->applet), "change-orient",
+			    GTK_SIGNAL_FUNC (cb_change_orient), tasklist);
+	gtk_signal_connect (GTK_OBJECT (tasklist->applet), "save-session",
+			    GTK_SIGNAL_FUNC (write_config), tasklist);
+	gtk_signal_connect (GTK_OBJECT (tasklist->applet), "change-pixel-size",
+			    GTK_SIGNAL_FUNC (cb_change_pixel_size), tasklist);
+
+	applet_widget_register_stock_callback (
+		APPLET_WIDGET (tasklist->applet),
+		"properties",
+		GNOME_STOCK_MENU_PROP,
+		_("Properties..."),
+		(AppletCallbackFunc) cb_properties,
+		tasklist);
+
+	applet_widget_register_stock_callback (
+		APPLET_WIDGET (tasklist->applet),
+		"help",
+		GNOME_STOCK_PIXMAP_HELP,
+		_("Help"),
+		(AppletCallbackFunc) cb_help,
+		tasklist);
+
+	applet_widget_register_stock_callback (
+		APPLET_WIDGET (tasklist->applet),
+		"about",
+		GNOME_STOCK_MENU_ABOUT,
+		_("About..."),
+		(AppletCallbackFunc) cb_about,
+		tasklist);
+
+	tasklist->unknown_icon = g_new (TasklistIcon, 1);
+	tasklist->unknown_icon->normal = gdk_pixbuf_new_from_xpm_data (unknown_xpm);
+	tasklist->unknown_icon->minimized = tasklist_icon_create_minimized_icon (tasklist, tasklist->unknown_icon->normal);
+	
+	tasklist->panel_size = applet_widget_get_panel_pixel_size(APPLET_WIDGET(tasklist->applet));
+	tasklist->tasklist_orient = applet_widget_get_panel_orient(APPLET_WIDGET(tasklist->applet));
+
+	gwmh_task_notifier_add (task_notifier, tasklist);
+	gwmh_desk_notifier_add (desk_notifier, tasklist);
+
+	gtk_widget_show_all (tasklist->area);
+	gtk_widget_show_all (tasklist->handle);
+
+	change_size (tasklist, TRUE);
+
+	{
+		GtkRequisition req;
+		
+		gtk_widget_size_request (tasklist->handle, &req);
+		printf ("Requested: %d %d\n", req.width, req.height);
+	}
+	
+	return tasklist;
+}
 
-	gtk_signal_connect (GTK_OBJECT (applet), "change-orient",
-			    GTK_SIGNAL_FUNC (cb_change_orient), NULL);
-	gtk_signal_connect (GTK_OBJECT (applet), "save-session",
-			    GTK_SIGNAL_FUNC (write_config), NULL);
-	gtk_signal_connect (GTK_OBJECT (applet), "change-pixel-size",
-			    GTK_SIGNAL_FUNC (cb_change_pixel_size), NULL);
-
-	applet_widget_register_stock_callback (APPLET_WIDGET (applet),
-					       "properties",
-					       GNOME_STOCK_MENU_PROP,
-					       _("Properties..."),
-					       (AppletCallbackFunc) cb_properties,
-					       NULL);
-	applet_widget_register_stock_callback (APPLET_WIDGET (applet),
-					       "help",
-					       GNOME_STOCK_PIXMAP_HELP,
-					       _("Help"),
-					       (AppletCallbackFunc) cb_help,
-					       NULL);
-
-	applet_widget_register_stock_callback (APPLET_WIDGET (applet),
-					       "about",
-					       GNOME_STOCK_MENU_ABOUT,
-					       _("About..."),
-					       (AppletCallbackFunc) cb_about,
-					       NULL);
+static void
+tasklist_init (void)
+{
+	gwmh_init ();
 }
 
+#ifdef APPLET_COMPILE_AS_PROCESS
 gint
 main (gint argc, gchar *argv[])
 {
+	TaskList *tasklist;
+	
 	/* Initialize i18n */
 	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
 	textdomain (PACKAGE);
@@ -909,25 +920,76 @@
 	gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
 	gtk_widget_set_default_visual (gdk_rgb_get_visual ());
 
-	gwmh_init ();
-	gwmh_task_notifier_add (task_notifier, NULL);
-	gwmh_desk_notifier_add (desk_notifier, NULL);
+	tasklist_init ();
 	
-	create_applet ();
+	tasklist = create_applet ();
 
-	read_config ();
-	panel_size = applet_widget_get_panel_pixel_size(APPLET_WIDGET(applet));
-	tasklist_orient = applet_widget_get_panel_orient(APPLET_WIDGET(applet));
-
-	change_size (TRUE);
+	gwmh_task_notifier_add (task_notifier, tasklist);
+	gwmh_desk_notifier_add (desk_notifier, tasklist);
+	
+	change_size (tasklist, TRUE);
 
 	gtk_widget_show (applet);
 
-	unknown_icon = g_new (TasklistIcon, 1);
-	unknown_icon->normal = gdk_pixbuf_new_from_xpm_data (unknown_xpm);
-	unknown_icon->minimized = tasklist_icon_create_minimized_icon (unknown_icon->normal);
-
 	applet_widget_gtk_main ();
 
 	return 0;
 }
+#else
+GtkWidget *
+make_new_applet (const char *goad_id)
+{
+	static int inited = 0;
+	TaskList *tasklist;
+	
+	if (!inited){
+		tasklist_init ();
+		inited = 1;
+	}
+	tasklist = tasklist_new ();
+
+	gtk_widget_show_all (tasklist->applet);
+
+	return tasklist->applet;
+}
+
+static CORBA_Object
+activator (PortableServer_POA poa,
+	   const char *goad_id,
+	   const char **params,
+	   gpointer *impl_ptr,
+	   CORBA_Environment *ev)
+{
+	GtkWidget *widget;
+
+	widget = make_new_applet (goad_id);
+	if (widget == NULL) {
+		g_warning (_("Don't know how to activate `%s'\n"), goad_id);
+		return CORBA_OBJECT_NIL;
+	}
+
+	return applet_widget_corba_activate (widget, poa, goad_id,
+					     params, impl_ptr, ev);
+}
+static void
+deactivator (PortableServer_POA poa,
+	     const char *goad_id,
+	     gpointer impl_ptr,
+	     CORBA_Environment *ev)
+{
+	applet_widget_corba_deactivate (poa, goad_id, impl_ptr, ev);
+}
+
+static const char *repo_id[]={ "IDL:GNOME/Applet:1.0", NULL };
+static GnomePluginObject applets_list[] = { 
+	{ repo_id, "tasklist_applet", NULL, "Task list applet",
+	  &activator, &deactivator },
+	{ NULL }
+};
+
+GnomePlugin GNOME_Plugin_info = { 
+	applets_list,
+	NULL
+};
+
+#endif
Index: tasklist_applet.gnorba
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_applet.gnorba,v
retrieving revision 1.1
diff -u -r1.1 tasklist_applet.gnorba
--- tasklist_applet.gnorba	1999/07/05 22:11:39	1.1
+++ tasklist_applet.gnorba	2000/11/05 21:20:52
@@ -1,5 +1,5 @@
 [tasklist_applet]
-type=exe
+type=shlib
 repo_id=IDL:GNOME/Applet:1.0
 description=GNOME Tasklist
-location_info=tasklist_applet
+location_info=libtasklist_applet.so
Index: tasklist_applet.h
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_applet.h,v
retrieving revision 1.25
diff -u -r1.25 tasklist_applet.h
--- tasklist_applet.h	2000/05/09 18:21:12	1.25
+++ tasklist_applet.h	2000/11/05 21:20:52
@@ -50,33 +50,90 @@
 	/* Follow the panel sizes */
 	gboolean follow_panel_size;
 
-	/* Stuff for horizontal mode */
-	gint horz_width; /* The width of the tasklist */
-	gint horz_rows; /* Number of rows */
-	gboolean horz_fixed; /* Fixed or dynamic sizing */
-	gint horz_taskwidth; /* Width of a single task (for dynamic sizing) */
-	/* Stuff for vertical mode */
-	gint vert_height; /* The height of the tasklist */
-	gint vert_width; /* The width of the tasklist */
-	gboolean vert_fixed; /* Fixed or dynamic sizing */
+	/*
+	 * Stuff for horizontal mode
+	 */
 
+	/* The width of the tasklist */
+	gint horz_width;
 
+	/* Number of rows */	
+	gint horz_rows;
+
+	/* Fixed or dynamic sizing */
+	gboolean horz_fixed;
+
+	/* Width of a single task (for dynamic sizing) */
+	gint horz_taskwidth; 
+
+	/*
+	 * Stuff for vertical mode
+	 */
+	/* The height of the tasklist */
+	gint vert_height;
+	
+	/* The width of the tasklist */
+	gint vert_width; 
+
+	/* Fixed or dynamic sizing */
+	gboolean vert_fixed; 
+
 };
 
 struct _TasklistIcon {
 	GdkPixbuf *normal;
 	GdkPixbuf *minimized;
 };
+
+typedef struct {
+	GNOME_Panel_OrientType tasklist_orient; /* Tasklist orient */
+	GtkWidget *handle; /* The handle box */
+	GtkWidget *applet; /* The applet */
+	GtkWidget *area; /* The drawing area used to display tasks */
+
+	/* The list of tasks used */
+	GList *tasks; 
+
+#define MOTION_TIMEOUT 500 /* Show task motion_task if cursor over task for ... msec */
+
+	/* Show task motion_task after MOTION_TIMEOUT in drag_motion */
+	int motion_timeout;
+
+	/* Task to show after motion_timeout */
+	TasklistTask *motion_task; 
+
+	/* Vertical height, used for resizing */
+	gint vert_height;
+
+	/* Horizontal width, used for resizing */
+	gint horz_width;  
+
+	gint panel_size;
+
+	/* The configuration */
+	TasklistConfig config;
+	TasklistIcon *unknown_icon; /* The unknown icon */
+
+	/*
+	 * Used during configuration editing
+	 */
+	/* The tasklist properties configuration */
+	TasklistConfig PropsConfig;
+
+	/* The Property box */
+	GtkWidget *prop;
+} TaskList;
 
-void menu_popup (TasklistTask *task, guint button, guint32 activate_time);
-void display_properties (void);
-void read_config (void);
-gboolean write_config (gpointer data,
-		       const gchar *privcfgpath,
-		       const gchar *globcfgpath);
-void change_size (gboolean layout);
-void layout_tasklist (void);
-GdkPixbuf *tasklist_icon_create_minimized_icon (GdkPixbuf *pixbuf);
-void tasklist_icon_set (TasklistTask *task);
-void tasklist_icon_destroy (TasklistTask *task);
-Pixmap tasklist_icon_get_pixmap (TasklistTask *task);
+void   	   menu_popup          (TaskList *, TasklistTask *task, guint button,
+				guint32 activate_time);
+void   	   display_properties  (TaskList *);
+void   	   read_config         (TaskList *);
+gboolean   write_config        (gpointer data,
+				const gchar *privcfgpath,
+				const gchar *globcfgpath);
+void       change_size         (TaskList *, gboolean layout);
+void       layout_tasklist     (TaskList *tasklist);
+GdkPixbuf *tasklist_icon_create_minimized_icon (TaskList *, GdkPixbuf *pixbuf);
+void       tasklist_icon_set        (TaskList *, TasklistTask *task);
+void       tasklist_icon_destroy    (TaskList *, TasklistTask *task);
+Pixmap     tasklist_icon_get_pixmap (TasklistTask *task);
Index: tasklist_config.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_config.c,v
retrieving revision 1.20
diff -u -r1.20 tasklist_config.c
--- tasklist_config.c	2000/04/03 20:26:41	1.20
+++ tasklist_config.c	2000/11/05 21:20:52
@@ -1,87 +1,83 @@
 #include "tasklist_applet.h"
 
-/* The applet */
-extern GtkWidget *applet;
-
-/* The configuration */
-TasklistConfig Config;
-
-gboolean write_config (gpointer data,
-		   const gchar *privcfgpath,
-		   const gchar *globcfgpath)
+gboolean
+write_config (gpointer data, const gchar *privcfgpath, const gchar *globcfgpath)
 {
+	TaskList *tasklist = (TaskList *) data;
+	
 	gnome_config_push_prefix (privcfgpath 
 				  ? privcfgpath
-				  : APPLET_WIDGET (applet)->privcfgpath);
+				  : APPLET_WIDGET (tasklist->applet)->privcfgpath);
 
 	gnome_config_set_bool ("tasklist/follow_panel_size",
-			       Config.follow_panel_size);
+			       tasklist->config.follow_panel_size);
 
 	gnome_config_set_bool ("tasklist/horz_fixed",
-			       Config.horz_fixed);
+			       tasklist->config.horz_fixed);
 	gnome_config_set_int ("tasklist/horz_width", 
-			      Config.horz_width);
+			      tasklist->config.horz_width);
 	gnome_config_set_int ("tasklist/horz_rows", 
-			      Config.horz_rows);
+			      tasklist->config.horz_rows);
 	gnome_config_set_int ("tasklist/horz_taskwidth",
-			      Config.horz_taskwidth);
+			      tasklist->config.horz_taskwidth);
 
 	gnome_config_set_bool ("tasklist/vert_fixed",
-			       Config.vert_fixed);	
+			       tasklist->config.vert_fixed);	
 	gnome_config_set_int ("tasklist/vert_height", 
-			      Config.vert_height);
+			      tasklist->config.vert_height);
 	gnome_config_set_int ("tasklist/vert_width",
-			      Config.vert_width);
+			      tasklist->config.vert_width);
 
 	
 	gnome_config_set_bool ("tasklist/show_mini_icons",
-			       Config.show_mini_icons);
+			       tasklist->config.show_mini_icons);
 	gnome_config_set_bool ("tasklist/show_normal",
-			       Config.show_normal);
+			       tasklist->config.show_normal);
 	gnome_config_set_bool ("tasklist/show_minimized",
-			       Config.show_minimized);
+			       tasklist->config.show_minimized);
 
 	gnome_config_set_bool ("tasklist/all_desks_normal",
-			       Config.all_desks_normal);
+			       tasklist->config.all_desks_normal);
 	gnome_config_set_bool ("tasklist/all_desks_minimized",
-			       Config.all_desks_minimized);
+			       tasklist->config.all_desks_minimized);
 
 	gnome_config_set_bool ("tasklist/confirm_before_kill",
-			       Config.confirm_before_kill);
+			       tasklist->config.confirm_before_kill);
 	gnome_config_set_bool ("tasklist/move_to_current",
-			       Config.move_to_current);
+			       tasklist->config.move_to_current);
 	gnome_config_sync ();
 	
 	gnome_config_pop_prefix ();
 	return FALSE;
 }
 
-void read_config (void)
+void
+read_config (TaskList *tasklist)
 {
-	gnome_config_push_prefix (APPLET_WIDGET (applet)->privcfgpath);
+	gnome_config_push_prefix (APPLET_WIDGET (tasklist->applet)->privcfgpath);
 
-	Config.follow_panel_size = gnome_config_get_bool ("tasklist/follow_panel_size=true");
+	tasklist->config.follow_panel_size = gnome_config_get_bool ("tasklist/follow_panel_size=true");
 
-	Config.horz_fixed = gnome_config_get_bool ("tasklist/horz_fixed=true");
+	tasklist->config.horz_fixed = gnome_config_get_bool ("tasklist/horz_fixed=true");
 	/* if the screen is not too wide, make it default to 300 */
 	if (gdk_screen_width () <= 800)
-		Config.horz_width = gnome_config_get_int ("tasklist/horz_width=300");
+		tasklist->config.horz_width = gnome_config_get_int ("tasklist/horz_width=300");
 	else
-		Config.horz_width = gnome_config_get_int ("tasklist/horz_width=450");
-	Config.horz_rows = gnome_config_get_int ("tasklist/horz_rows=2");
-	Config.horz_taskwidth = gnome_config_get_int ("tasklist/horz_taskwidth=150");
-	Config.vert_fixed = gnome_config_get_bool ("tasklist/vert_fixed=true");
-	Config.vert_width = gnome_config_get_int ("tasklist/vert_width=48");
-	Config.vert_height = gnome_config_get_int ("tasklist/vert_height=300");
+		tasklist->config.horz_width = gnome_config_get_int ("tasklist/horz_width=450");
+	tasklist->config.horz_rows = gnome_config_get_int ("tasklist/horz_rows=2");
+	tasklist->config.horz_taskwidth = gnome_config_get_int ("tasklist/horz_taskwidth=150");
+	tasklist->config.vert_fixed = gnome_config_get_bool ("tasklist/vert_fixed=true");
+	tasklist->config.vert_width = gnome_config_get_int ("tasklist/vert_width=48");
+	tasklist->config.vert_height = gnome_config_get_int ("tasklist/vert_height=300");
 
-	Config.confirm_before_kill = gnome_config_get_bool ("tasklist/confirm_before_kill=true");
+	tasklist->config.confirm_before_kill = gnome_config_get_bool ("tasklist/confirm_before_kill=true");
 	
-	Config.show_mini_icons = gnome_config_get_bool ("tasklist/show_mini_icons=true");
-	Config.show_normal = gnome_config_get_bool ("tasklist/show_normal=true");
-	Config.show_minimized = gnome_config_get_bool ("tasklist/show_minimized=true");
-	Config.all_desks_normal = gnome_config_get_bool ("tasklist/all_desks_normal=false");
-	Config.all_desks_minimized = gnome_config_get_bool ("tasklist/all_desks_minimized=false");
-	Config.move_to_current = gnome_config_get_bool ("tasklist/move_to_current=false");
+	tasklist->config.show_mini_icons = gnome_config_get_bool ("tasklist/show_mini_icons=true");
+	tasklist->config.show_normal = gnome_config_get_bool ("tasklist/show_normal=true");
+	tasklist->config.show_minimized = gnome_config_get_bool ("tasklist/show_minimized=true");
+	tasklist->config.all_desks_normal = gnome_config_get_bool ("tasklist/all_desks_normal=false");
+	tasklist->config.all_desks_minimized = gnome_config_get_bool ("tasklist/all_desks_minimized=false");
+	tasklist->config.move_to_current = gnome_config_get_bool ("tasklist/move_to_current=false");
 	
 	gnome_config_pop_prefix ();
 }
Index: tasklist_icon.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_icon.c,v
retrieving revision 1.5
diff -u -r1.5 tasklist_icon.c
--- tasklist_icon.c	2000/05/21 13:28:33	1.5
+++ tasklist_icon.c	2000/11/05 21:20:54
@@ -6,13 +6,10 @@
 #include <gwmh.h>
 #include "tasklist_applet.h"
 
-static gboolean tasklist_icon_check_mini (TasklistTask *task);
-static gboolean tasklist_icon_check_x (TasklistTask *task);
-static void tasklist_icon_set_minimized (TasklistTask *task);
+static gboolean tasklist_icon_check_mini (TaskList *tasklist, TasklistTask *task);
+static gboolean tasklist_icon_check_x (TaskList *tasklist, TasklistTask *task);
+static void tasklist_icon_set_minimized (TaskList *tasklist, TasklistTask *task);
 
-extern GtkWidget *area; /* The drawing area used to display tasks */
-extern TasklistIcon *unknown_icon; /* The unknown icon */
-
 #define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
 
 /* Shamelessly stolen from gwmh.c by Tim Janik */
@@ -22,6 +19,8 @@
 {
 	XWMHints *wmhints;
 	Pixmap pixmap;
+
+	g_return_val_if_fail (task != NULL, 0);
 	
 	wmhints = XGetWMHints (GDK_DISPLAY (), task->gwmh_task->xwin);
 
@@ -130,7 +129,7 @@
 }
 
 static gboolean
-tasklist_icon_check_mini (TasklistTask *task)
+tasklist_icon_check_mini (TaskList *tasklist, TasklistTask *task)
 {
 	GdkGC *gc;
 	int x, y, b, width, height, depth;
@@ -176,7 +175,7 @@
 	
 	pixbuf = gdk_pixbuf_get_from_drawable (NULL,
 					       pixmap,
-					       gtk_widget_get_colormap (area),
+					       gtk_widget_get_colormap (tasklist->area),
 					       0, 0,
 					       0, 0,
 					       width, height);
@@ -185,8 +184,8 @@
 	if (atomdata[1]) {
 		mask = gdk_pixmap_new (NULL, width, height, depth);
 		gc = gdk_gc_new (mask);
-		gdk_gc_set_background (gc, &area->style->black);
-		gdk_gc_set_foreground (gc, &area->style->white);
+		gdk_gc_set_background (gc, &tasklist->area->style->black);
+		gdk_gc_set_foreground (gc, &tasklist->area->style->white);
 		XCopyPlane (GDK_DISPLAY (), atomdata[1], GDK_WINDOW_XWINDOW (mask),
 			    GDK_GC_XGC (gc), 0, 0, width, height, 0, 0, 1);
 		gdk_gc_unref (gc);
@@ -213,7 +212,7 @@
 }
 
 static gboolean
-tasklist_icon_check_x (TasklistTask *task)
+tasklist_icon_check_x (TaskList *tasklist, TasklistTask *task)
 {
 	XWMHints * wmhints;
 	GdkPixmap *pixmap, *mask;
@@ -246,12 +245,12 @@
 		return FALSE;
 	}
 	
-	pixmap = gdk_pixmap_new (area->window, width, height, -1);	
+	pixmap = gdk_pixmap_new (tasklist->area->window, width, height, -1);	
 	gc = gdk_gc_new (pixmap);
 
 	if (depth == 1) {
-		gdk_gc_set_background (gc, &area->style->white);
-		gdk_gc_set_foreground (gc, &area->style->black);
+		gdk_gc_set_background (gc, &tasklist->area->style->white);
+		gdk_gc_set_foreground (gc, &tasklist->area->style->black);
 		XCopyPlane (GDK_DISPLAY (), wmhints->icon_pixmap, GDK_WINDOW_XWINDOW (pixmap),
 			   GDK_GC_XGC (gc), 0, 0, width, height, 0, 0, 1);
 	}
@@ -259,7 +258,7 @@
 		XCopyArea (GDK_DISPLAY (), wmhints->icon_pixmap, GDK_WINDOW_XWINDOW (pixmap),
 			   GDK_GC_XGC (gc), 0, 0, width, height, 0, 0);
 	}
-	pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, gtk_widget_get_colormap (area), 
+	pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, gtk_widget_get_colormap (tasklist->area), 
 					       0, 0,
 					       0, 0, width, height);
 	gdk_gc_destroy (gc);
@@ -271,8 +270,8 @@
 	if (wmhints->flags & IconMaskHint) {
 	       mask = gdk_pixmap_new (NULL, width, height, depth);
 	       gc = gdk_gc_new (mask);
-	       gdk_gc_set_background (gc, &area->style->black);
-	       gdk_gc_set_foreground (gc, &area->style->white);
+	       gdk_gc_set_background (gc, &tasklist->area->style->black);
+	       gdk_gc_set_foreground (gc, &tasklist->area->style->white);
 	       XCopyPlane (GDK_DISPLAY (), wmhints->icon_mask, GDK_WINDOW_XWINDOW (mask),
 			   GDK_GC_XGC (gc), 0, 0, width, height, 0, 0, 1);
 	       gdk_gc_unref (gc);
@@ -311,37 +310,37 @@
 }
 
 void
-tasklist_icon_set (TasklistTask *task)
+tasklist_icon_set (TaskList *tasklist, TasklistTask *task)
 {
 	task->icon = g_new (TasklistIcon, 1);
 
-	task->icon->normal = unknown_icon->normal;
-	task->icon->minimized = unknown_icon->minimized;
+	task->icon->normal = tasklist->unknown_icon->normal;
+	task->icon->minimized = tasklist->unknown_icon->minimized;
 
-	if (!tasklist_icon_check_x (task))
-		tasklist_icon_check_mini (task);
+	if (!tasklist_icon_check_x (tasklist, task))
+		tasklist_icon_check_mini (tasklist, task);
 		
 
-	tasklist_icon_set_minimized (task);
+	tasklist_icon_set_minimized (tasklist, task);
 }
 
 static void
-tasklist_icon_set_minimized (TasklistTask *task)
+tasklist_icon_set_minimized (TaskList *tasklist, TasklistTask *task)
 {
 	if (task->icon->minimized &&
-		task->icon->minimized != unknown_icon->minimized)
+		task->icon->minimized != tasklist->unknown_icon->minimized)
 		gdk_pixbuf_unref (task->icon->minimized);
 
-	task->icon->minimized = tasklist_icon_create_minimized_icon (task->icon->normal);
+	task->icon->minimized = tasklist_icon_create_minimized_icon (tasklist, task->icon->normal);
 }
 
 void
-tasklist_icon_destroy (TasklistTask *task)
+tasklist_icon_destroy (TaskList *tasklist, TasklistTask *task)
 {
-	if (task->icon->normal != unknown_icon->normal)
+	if (task->icon->normal != tasklist->unknown_icon->normal)
 		gdk_pixbuf_unref (task->icon->normal);
 	
-	if (task->icon->minimized != unknown_icon->minimized)
+	if (task->icon->minimized != tasklist->unknown_icon->minimized)
 		gdk_pixbuf_unref (task->icon->minimized);
 
 	g_free (task->icon);
@@ -349,7 +348,7 @@
 
 /* Stolen from gnome-pixmap.c */
 GdkPixbuf *
-tasklist_icon_create_minimized_icon (GdkPixbuf *pixbuf)
+tasklist_icon_create_minimized_icon (TaskList *tasklist, GdkPixbuf *pixbuf)
 {
 	GdkPixbuf *target;
 	gint i, j;
@@ -360,7 +359,7 @@
 	gint32 red, green, blue;
 	GdkColor color;
 	
-	color = area->style->bg[GTK_STATE_NORMAL];
+	color = tasklist->area->style->bg[GTK_STATE_NORMAL];
 	red = color.red / 255;
 	blue = color.blue / 255;
 	green = color.green / 255;
Index: tasklist_menu.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_menu.c,v
retrieving revision 1.17
diff -u -r1.17 tasklist_menu.c
--- tasklist_menu.c	2000/03/03 08:06:01	1.17
+++ tasklist_menu.c	2000/11/05 21:20:54
@@ -4,15 +4,12 @@
 #include "tasklist_applet.h"
 #include "pixmaps.h"
 
-GtkWidget *get_popup_menu (TasklistTask *task);
-void add_menu_item (gchar *name, GtkWidget *menu, MenuAction action, gchar **xpm);
+GtkWidget *get_popup_menu (TaskList *tasklist, TasklistTask *task);
+void add_menu_item (TaskList *, gchar *name, GtkWidget *menu, MenuAction action, gchar **xpm);
 gboolean cb_menu (GtkWidget *widget, gpointer data);
 void cb_to_desktop (GtkWidget *widget, gpointer data);
 void cb_menu_position (GtkMenu *menu, gint *x, gint *y, gpointer user_data);
 
-extern TasklistConfig Config;
-extern GtkWidget *area;
-extern GtkWidget *applet;
 TasklistTask *current_task;
 
 /* Callback for menu positioning */
@@ -22,13 +19,14 @@
 	GtkRequisition mreq;
 	gint wx, wy;
 	TasklistTask *task;
-
+	TaskList *tasklist = gtk_object_get_user_data (GTK_OBJECT (menu));
+	
 	current_task = task = (TasklistTask *)user_data;
 
 	gtk_widget_get_child_requisition (GTK_WIDGET (menu), &mreq);
-	gdk_window_get_origin (area->window, &wx, &wy);
+	gdk_window_get_origin (tasklist->area->window, &wx, &wy);
 
-	switch (applet_widget_get_panel_orient (APPLET_WIDGET (applet))) {
+	switch (applet_widget_get_panel_orient (APPLET_WIDGET (tasklist->applet))) {
 	case ORIENT_UP:
 		*x = wx + task->x;
 		*y = wy - mreq.height + task->y;
@@ -54,6 +52,8 @@
 gboolean
 cb_menu (GtkWidget *widget, gpointer data)
 {
+	TaskList *tasklist = gtk_object_get_user_data (GTK_OBJECT (widget));
+	
 	switch (GPOINTER_TO_INT (data)) {
 	case MENU_ACTION_SHADE_UNSHADE:
 		if (GWMH_TASK_SHADED (current_task->gwmh_task))
@@ -72,7 +72,7 @@
 						    GWMH_STATE_STICKY);
 		break;
 	case MENU_ACTION_KILL:
-		if (Config.confirm_before_kill) {
+		if (tasklist->config.confirm_before_kill) {
 			GtkWidget *dialog;
 			gint retval;
 
@@ -114,17 +114,18 @@
 
 /* Open a popup menu with window operations */
 void
-menu_popup (TasklistTask *task, guint button, guint32 activate_time)
+menu_popup (TaskList *tasklist, TasklistTask *task, guint button, guint32 activate_time)
 {
 	if(task->menu)
 		gtk_widget_destroy(task->menu);
 
-	task->menu = get_popup_menu (task);
+	task->menu = get_popup_menu (tasklist, task);
 
 	gtk_signal_connect(GTK_OBJECT(task->menu), "destroy",
 			   GTK_SIGNAL_FUNC(gtk_widget_destroyed),
 			   &task->menu);
 
+	gtk_object_set_user_data (GTK_OBJECT (task->menu), tasklist);
 	gtk_menu_popup (GTK_MENU (task->menu), NULL, NULL,
 			cb_menu_position, task,
 			button, activate_time);
@@ -132,7 +133,7 @@
 
 /* Add a menu item to the popup menu */
 void 
-add_menu_item (gchar *name, GtkWidget *menu, MenuAction action, gchar **xpm)
+add_menu_item (TaskList *tasklist, gchar *name, GtkWidget *menu, MenuAction action, gchar **xpm)
 {
 	GtkWidget *menuitem;
 	GdkPixmap *pixmap;
@@ -145,11 +146,12 @@
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 	gtk_container_add (GTK_CONTAINER (menuitem), label);
 	if (xpm) {
-		pixmap = gdk_pixmap_create_from_xpm_d (area->window, &mask, NULL, xpm);
+		pixmap = gdk_pixmap_create_from_xpm_d (tasklist->area->window, &mask, NULL, xpm);
 		gtkpixmap = gtk_pixmap_new (pixmap, mask);
 		gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menuitem), gtkpixmap);
 	}
-	
+
+	gtk_object_set_user_data (GTK_OBJECT (menuitem), tasklist);
 	gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
 			    GTK_SIGNAL_FUNC (cb_menu), GINT_TO_POINTER (action));
 
@@ -162,16 +164,17 @@
 void
 cb_to_desktop (GtkWidget *widget, gpointer data)
 {
+	TaskList *tasklist = gtk_object_get_user_data (GTK_OBJECT (widget));
+	
 	gwmh_task_set_desktop (current_task->gwmh_task, 
 			       GPOINTER_TO_INT (data));
 	gwmh_task_set_desktop (current_task->gwmh_task, 
 			       GPOINTER_TO_INT (data));
-	layout_tasklist ();
+	layout_tasklist (tasklist);
 }
 
 /* Create a popup menu */
-GtkWidget 
-*get_popup_menu (TasklistTask *task)
+GtkWidget *get_popup_menu (TaskList *tasklist, TasklistTask *task)
 {
 	GtkWidget *menu, *menuitem; /*, *desktop, *label, *gtkpixmap;*/
 	/*GdkPixmap *pixmap;*/
@@ -184,19 +187,19 @@
 	menu = gtk_menu_new ();
 	gtk_widget_show (menu);
 
-	add_menu_item (GWMH_TASK_ICONIFIED (task->gwmh_task)
+	add_menu_item (tasklist, GWMH_TASK_ICONIFIED (task->gwmh_task)
 		       ? _("Restore") : _("Iconify"), 
 		       menu, MENU_ACTION_SHOW_HIDE,
 		       GWMH_TASK_ICONIFIED (task->gwmh_task)
 		       ? tasklist_restore_xpm : tasklist_iconify_xpm);
 
-	add_menu_item (GWMH_TASK_SHADED (task->gwmh_task)
+	add_menu_item (tasklist, GWMH_TASK_SHADED (task->gwmh_task)
 		       ? _("Unshade") : _("Shade"), 
 		       menu, MENU_ACTION_SHADE_UNSHADE,
 		       GWMH_TASK_SHADED (task->gwmh_task)
 		       ? tasklist_unshade_xpm: tasklist_shade_xpm);
 
-	add_menu_item (GWMH_TASK_STICKY (task->gwmh_task)
+	add_menu_item (tasklist, GWMH_TASK_STICKY (task->gwmh_task)
 		       ? _("Unstick") : _("Stick"), 
 		       menu, MENU_ACTION_STICK_UNSTICK,
 		       GWMH_TASK_STICKY (task->gwmh_task)
@@ -206,7 +209,7 @@
 	label = gtk_label_new (_("To desktop"));
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 	gtk_container_add (GTK_CONTAINER (menuitem), label);
-	pixmap = gdk_pixmap_create_from_xpm_d (area->window, &mask, NULL,
+	pixmap = gdk_pixmap_create_from_xpm_d (tasklist->area->window, &mask, NULL,
 					       tasklist_send_to_desktop_xpm);
 	gtkpixmap = gtk_pixmap_new (pixmap, mask);
 	gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menuitem), gtkpixmap);
@@ -229,6 +232,7 @@
 			menuitem = gtk_menu_item_new_with_label (wsname);
 			gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
 					    GTK_SIGNAL_FUNC (cb_to_desktop), i);
+			gtk_object_set_user_data (GTK_OBJECT (menuitem), tasklist);
 			if (i == curworkspace)
 				gtk_widget_set_sensitive (menuitem, FALSE);
 			gtk_widget_show (menuitem);
@@ -242,14 +246,14 @@
 	gtk_widget_show (menuitem);
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 #endif
-	add_menu_item (_("Close window"), menu, MENU_ACTION_CLOSE,
+	add_menu_item (tasklist, _("Close window"), menu, MENU_ACTION_CLOSE,
 		       tasklist_close_xpm);
 
 	menuitem = gtk_menu_item_new ();
 	gtk_widget_show (menuitem);
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	
-	add_menu_item (_("Kill app"), menu, MENU_ACTION_KILL, tasklist_kill_xpm);
+	add_menu_item (tasklist, _("Kill app"), menu, MENU_ACTION_KILL, tasklist_kill_xpm);
 	
 	return menu;
 }
Index: tasklist_properties.c
===================================================================
RCS file: /cvs/gnome/gnome-core/applets/tasklist/tasklist_properties.c,v
retrieving revision 1.28
diff -u -r1.28 tasklist_properties.c
--- tasklist_properties.c	2000/04/16 14:58:35	1.28
+++ tasklist_properties.c	2000/11/05 21:20:58
@@ -1,36 +1,29 @@
 #include <config.h>
 #include "tasklist_applet.h"
 
-/* The tasklist configuration */
-extern TasklistConfig Config;
-
-/* The tasklist properties configuration */
-TasklistConfig PropsConfig;
-
-/* The Property box */
-GtkWidget *prop = NULL;
-
 /* Callback for apply */
 static void
 cb_apply (GtkWidget *widget, gint page, gpointer data)
 {
-
+	TaskList *tasklist = data;
+	
 	/* Copy the Property struct back to the Config struct */
-	memcpy (&Config, &PropsConfig, sizeof (TasklistConfig));
+	memcpy (&tasklist->config, &tasklist->PropsConfig, sizeof (TasklistConfig));
 
 	/* Redraw everything */
-	change_size (TRUE);
+	change_size (tasklist, TRUE);
 }
 
 /* Callback for radio buttons */
 static void
 cb_radio_button (GtkWidget *widget, gint *data)
 {
-
+	TaskList *tasklist = gtk_object_get_user_data (widget);
+	
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
 		*data = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
 							      "number"));
-		gnome_property_box_changed (GNOME_PROPERTY_BOX (prop));
+		gnome_property_box_changed (GNOME_PROPERTY_BOX (tasklist->prop));
 	}
 }
 
@@ -38,7 +31,9 @@
 static void
 cb_spin_button (GtkWidget *widget, gint *data)
 {
-	gnome_property_box_changed (GNOME_PROPERTY_BOX (prop));
+	TaskList *tasklist = gtk_object_get_user_data (GTK_OBJECT (widget));
+	
+	gnome_property_box_changed (GNOME_PROPERTY_BOX (tasklist->prop));
 	
 	*data = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
 }
@@ -47,7 +42,9 @@
 static void
 cb_check_button (GtkWidget *widget, gboolean *data)
 {
-	gnome_property_box_changed (GNOME_PROPERTY_BOX (prop));
+	TaskList *tasklist = gtk_object_get_user_data (GTK_OBJECT (widget));
+	
+	gnome_property_box_changed (GNOME_PROPERTY_BOX (tasklist->prop));
 
 	*data = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
 }
@@ -63,7 +60,8 @@
  
 /* Create a spin button */
 static GtkWidget *
-create_spin_button (gchar *name,
+create_spin_button (TaskList *tasklist,
+		    gchar *name,
 		    gint *init_value,
 		    gfloat min_value,
 		    gfloat max_value,
@@ -84,6 +82,7 @@
 	hbox = gtk_hbox_new (TRUE, GNOME_PAD_SMALL);
 
 	spin = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
+	gtk_object_set_user_data (GTK_OBJECT (spin), tasklist);
 	gtk_signal_connect (GTK_OBJECT (spin), "changed",
 			    GTK_SIGNAL_FUNC (cb_spin_button), init_value);
 						
@@ -100,7 +99,7 @@
 
 /* Create a radio button */
 static GtkWidget *
-create_radio_button (gchar *name, GSList **group, 
+create_radio_button (TaskList *tasklist, gchar *name, GSList **group, 
 		     gint number, gint *change_value)
 {
 	GtkWidget *radiobutton;
@@ -115,19 +114,20 @@
 			    GTK_SIGNAL_FUNC (cb_radio_button), change_value);
 	gtk_object_set_data (GTK_OBJECT (radiobutton), "number",
 			     GINT_TO_POINTER (number));
-
+	gtk_object_set_user_data (GTK_OBJECT (radiobutton), tasklist);
 
 	return radiobutton;
 }
 
 /* Create a check button */
 static GtkWidget *
-create_check_button (gchar *name, gboolean *change_value)
+create_check_button (TaskList *tasklist, gchar *name, gboolean *change_value)
 {
 	GtkWidget *checkbutton;
 
 	checkbutton = gtk_check_button_new_with_label (name);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), *change_value);
+	gtk_object_set_user_data (GTK_OBJECT (checkbutton), tasklist);
 	gtk_signal_connect (GTK_OBJECT (checkbutton), "toggled",
 			    GTK_SIGNAL_FUNC (cb_check_button), change_value);
 	return checkbutton;
@@ -135,7 +135,7 @@
 
 /* Create the size page */
 static void
-create_size_page (void)
+create_size_page (TaskList *tasklist)
 {
 	GtkWidget *hbox,/* *table,*/ *frame, *vbox, *topbox;
 	GSList *vertgroup = NULL, *horzgroup = NULL;
@@ -144,8 +144,9 @@
 	topbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
 	gtk_container_border_width (GTK_CONTAINER (topbox), GNOME_PAD_SMALL);
 	
-	autobutton = create_check_button (_("Follow panel size"),
-					  &PropsConfig.follow_panel_size);
+	autobutton = create_check_button (
+		tasklist, _("Follow panel size"),
+		&tasklist->PropsConfig.follow_panel_size);
 	gtk_box_pack_start (GTK_BOX (topbox),
 			    autobutton,
 			    FALSE, TRUE, 0);
@@ -160,40 +161,47 @@
 	vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
 	gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
 
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_spin_button (_("Tasklist width:"),
-						&PropsConfig.horz_width,
-						48,
-						8192,
-						10),
-			    FALSE, TRUE, 0);
-	w = create_spin_button (_("Rows of tasks:"),
-				&PropsConfig.horz_rows,
-				1,
-				8,
-				1);
+	gtk_box_pack_start (
+		GTK_BOX (vbox),
+		create_spin_button (
+			tasklist, _("Tasklist width:"),
+			&tasklist->PropsConfig.horz_width,
+			48,
+			8192,
+			10),
+		FALSE, TRUE, 0);
+	w = create_spin_button (
+		tasklist, _("Rows of tasks:"),
+		&tasklist->PropsConfig.horz_rows,
+		1,
+		8,
+		1);
 	gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, TRUE, 0);
 	gtk_signal_connect (GTK_OBJECT (autobutton), "toggled",
-			   GTK_SIGNAL_FUNC (cb_check_button_disable),
-			   w);
+			    GTK_SIGNAL_FUNC (cb_check_button_disable),
+			    w);
 	cb_check_button_disable (autobutton, w);
 
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_spin_button (_("Default task size:"),
-						&PropsConfig.horz_taskwidth,
-						48,
-						350,
-						10),
-			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (vbox),
+		create_spin_button (
+			tasklist, _("Default task size:"),
+			&tasklist->PropsConfig.horz_taskwidth,
+			48,
+			350,
+			10),
+		FALSE, TRUE, 0);
 
 
 	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_radio_button (_("Tasklist width is fixed"),
-						 &horzgroup, TRUE, &PropsConfig.horz_fixed),
+			    create_radio_button (
+				    tasklist, _("Tasklist width is fixed"),
+				    &horzgroup, TRUE, &tasklist->PropsConfig.horz_fixed),
 			    FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_radio_button (_("Tasklist width is dynamic"), 
-						 &horzgroup, FALSE, &PropsConfig.horz_fixed),
+			    create_radio_button (
+				    tasklist, _("Tasklist width is dynamic"), 
+				    &horzgroup, FALSE, &tasklist->PropsConfig.horz_fixed),
 			    FALSE, TRUE, 0);
 	
 	gtk_container_add (GTK_CONTAINER (frame), vbox);
@@ -204,16 +212,17 @@
 	vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
 	gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
 
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_spin_button (_("Tasklist height:"),
-						&PropsConfig.vert_height,
-						48,
-						1024*8,
-						10),
-			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (vbox),
+		create_spin_button (tasklist, _("Tasklist height:"),
+				    &tasklist->PropsConfig.vert_height,
+				    48,
+				    1024*8,
+				    10),
+		FALSE, TRUE, 0);
 
-	w = create_spin_button (_("Tasklist width:"),
-				&PropsConfig.vert_width,
+	w = create_spin_button (tasklist, _("Tasklist width:"),
+				&tasklist->PropsConfig.vert_width,
 				48,
 				512,
 				10);
@@ -223,23 +232,27 @@
 			   w);
 	cb_check_button_disable (autobutton, w);
 
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_radio_button (_("Tasklist height is fixed"),
-						 &vertgroup, TRUE, &PropsConfig.vert_fixed),
-			    FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox),
-			    create_radio_button (_("Tasklist height is dynamic"), 
-						 &vertgroup, FALSE, &PropsConfig.vert_fixed),
-			    FALSE, TRUE, 0);
-
+			    create_radio_button (
+				    tasklist,_("Tasklist height is fixed"),
+				    &vertgroup, TRUE, &tasklist->PropsConfig.vert_fixed),
+			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (vbox),
+		create_radio_button (
+			tasklist, _("Tasklist height is dynamic"), 
+			&vertgroup, FALSE, &tasklist->PropsConfig.vert_fixed),
+		FALSE, TRUE, 0);
+	
 	gtk_container_add (GTK_CONTAINER (frame), vbox);
 
-	gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop), topbox,
-					gtk_label_new (_("Size")));
+	gnome_property_box_append_page (
+		GNOME_PROPERTY_BOX (tasklist->prop), topbox,
+		gtk_label_new (_("Size")));
 }
 
 static void
-create_display_page (void)
+create_display_page (TaskList *tasklist)
 {
 	GtkWidget *vbox, *frame;
 	GtkWidget *miscbox, *taskbox;
@@ -255,19 +268,31 @@
 	taskbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
 	gtk_container_add (GTK_CONTAINER (frame), taskbox);
 	
-	gtk_box_pack_start (GTK_BOX (taskbox),
-			    create_check_button (_("Show normal applications"), &PropsConfig.show_normal),
-			    FALSE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (taskbox),
-			    create_check_button (_("Show iconified (minimized) applications"), &PropsConfig.show_minimized),
-			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (taskbox),
+		create_check_button (
+			tasklist, _("Show normal applications"),
+			&tasklist->PropsConfig.show_normal),
+		FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (taskbox),
+		create_check_button (
+			tasklist, _("Show iconified (minimized) applications"),
+			&tasklist->PropsConfig.show_minimized),
+		FALSE, TRUE, 0);
 			    
-	gtk_box_pack_start (GTK_BOX (taskbox),
-			    create_check_button (_("Show normal applications on all desktops"), &PropsConfig.all_desks_normal),
-			    FALSE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (taskbox),
-			    create_check_button (_("Show iconified (minimized) applications on all desktops"), &PropsConfig.all_desks_minimized),
-			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (taskbox),
+		create_check_button (
+			tasklist, _("Show normal applications on all desktops"),
+			&tasklist->PropsConfig.all_desks_normal),
+		FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (taskbox),
+		create_check_button (tasklist,
+				     _("Show iconified (minimized) applications on all desktops"),
+				     &tasklist->PropsConfig.all_desks_minimized),
+		FALSE, TRUE, 0);
 
 	frame = gtk_frame_new (_("Miscellaneous"));
 	gtk_container_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
@@ -276,17 +301,28 @@
 	miscbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
 	gtk_container_add (GTK_CONTAINER (frame), miscbox);
 
-	gtk_box_pack_start (GTK_BOX (miscbox),
-			    create_check_button (_("Show mini icons"), &PropsConfig.show_mini_icons),
-			    FALSE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (miscbox),
-			    create_check_button (_("Confirm before killing windows"), &PropsConfig.confirm_before_kill),
-			    FALSE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (miscbox),
-			    create_check_button (_("Move iconified tasks to current workspace when restoring"), &PropsConfig.move_to_current),
-			    FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (miscbox),
+		create_check_button (
+			tasklist, _("Show mini icons"),
+			&tasklist->PropsConfig.show_mini_icons),
+		FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (miscbox),
+		create_check_button (
+			tasklist,
+			_("Confirm before killing windows"),
+			&tasklist->PropsConfig.confirm_before_kill),
+		FALSE, TRUE, 0);
+	gtk_box_pack_start (
+		GTK_BOX (miscbox),
+		create_check_button (
+			tasklist,
+			_("Move iconified tasks to current workspace when restoring"),
+			&tasklist->PropsConfig.move_to_current),
+		FALSE, TRUE, 0);
 
-	gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop), vbox,
+	gnome_property_box_append_page (GNOME_PROPERTY_BOX (tasklist->prop), vbox,
 					gtk_label_new (_("Display")));
 }
 
@@ -300,37 +336,34 @@
 
 /* Display property dialog */
 void
-display_properties (void)
+display_properties (TaskList *tasklist)
 {
-	if (prop != NULL)
+	GtkWidget *prop;
+	
+	if (tasklist->prop != NULL)
 	{
-		gdk_window_show (prop->window);
-		gdk_window_raise (prop->window);
+		gdk_window_show (tasklist->prop->window);
+		gdk_window_raise (tasklist->prop->window);
 		return;
 
 	}
-	/* Copy memory from the tasklist config 
-	   to the tasklist properties config. */
-	memcpy (&PropsConfig, &Config, sizeof (TasklistConfig));
+	/*
+	 * Copy memory from the tasklist config 
+	 * to the tasklist properties config.
+	 */
+	memcpy (&tasklist->PropsConfig, &tasklist->config, sizeof (TasklistConfig));
 
-	prop = gnome_property_box_new ();
+	tasklist->prop = prop = gnome_property_box_new ();
 	gtk_window_set_title (GTK_WINDOW (prop), _("Tasklist properties"));
-	gtk_signal_connect (GTK_OBJECT (prop), "apply",
-			    GTK_SIGNAL_FUNC (cb_apply), NULL);
+	gtk_signal_connect (GTK_OBJECT (tasklist->prop), "apply",
+			    GTK_SIGNAL_FUNC (cb_apply), tasklist);
 	gtk_signal_connect (GTK_OBJECT (prop), "destroy",
 			    GTK_SIGNAL_FUNC (gtk_widget_destroyed),
 			    &prop);
 	gtk_signal_connect (GTK_OBJECT (prop), "help",
 			    GTK_SIGNAL_FUNC (phelp_cb), NULL);
-	create_display_page ();
-	create_size_page ();
+	create_display_page (tasklist);
+	create_size_page (tasklist);
 
 	gtk_widget_show_all (prop);
 }
-
-
-
-
-
-
-




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]