I did a little hacking and I added the functionality to see only the windows in the current workspace. Apply the following diff to the subversion code (as it is today).
- //get all windows
+ // Get all windows
windows=wnck_screen_get_windows(screen);
-
- tips=gtk_tooltips_new();
- box=gtk_hbox_new(FALSE,0);
-
- hash=g_hash_table_new(hash_func,equal_func);
-
+
+ // Get the current workspace
+ actWorkspace=wnck_screen_get_active_workspace(screen);
+
+ // Clear the container
+ gtk_container_foreach(GTK_CONTAINER(box), (GtkCallback)gtk_widget_destroy, NULL);
+
gint i,length;
length=g_list_length(windows);
for(i=0;i<length;i++)
{
win=(WnckWindow*)g_list_nth_data(windows,i);
Hi.
I did a little hacking and I added the functionality to see only the windows in the current workspace. Apply the following diff to the subversion code (as it is today).
<pre>
Index: tasklist.c
===================================================================
-- tasklist.c (revision 3)
+++ tasklist.c (working copy)
@@ -3,6 +3,7 @@
*
* Authors: Vinod Kumar Dahiya
* Hemant Kumar
+ * Sigurdur Gudbrandsson
*/
#include "tasklist.h"
@@ -105,10 +106,27 @@
g_hash_table_foreach(hash,rebuild_icons,NULL);
}
+char is_window_in_taskbar(WnckScreen *screen, WnckWindow *win)
+{
+ WnckWorkspace *actWorkspace;
+
+ // Get the current workspace
+ actWorkspace=wnck_screen_get_active_workspace(screen);
+
+ if(wnck_window_is_on_workspace(win,actWorkspace))
+ {
+ return 1;
+ }
+ return 0;
+}
+
static void add_window(WnckScreen *screen, WnckWindow *win, gpointer data)
{
GtkWidget *button;
+ if(!is_window_in_taskbar(screen, win))
+ return;
+
if(wnck_window_is_skip_tasklist (win))
return;
@@ -135,6 +153,9 @@
static void remove_window(WnckScreen *screen, WnckWindow *win, gpointer data)
{
GtkWidget *button;
+
+ if(!is_window_in_taskbar(screen, win))
+ return;
if(wnck_window_is_skip_tasklist (win))
return;
@@ -154,30 +175,49 @@
}
}
-GtkWidget *talika_tasklist_new(WnckScreen *screen)
+static void fill_taskbar(WnckScreen *screen, WnckWorkspace *previously_active_space, gpointer data)
{
GList *windows;
WnckWindow *win;
+ WnckWorkspace *actWorkspace;
- //get all windows
+ // Get all windows
windows=wnck_screen_get_windows(screen);
-
- tips=gtk_tooltips_new();
- box=gtk_hbox_new(FALSE,0);
-
- hash=g_hash_table_new(hash_func,equal_func);
-
+
+ // Get the current workspace
+ actWorkspace=wnck_screen_get_active_workspace(screen);
+
+ // Clear the container
+ gtk_container_foreach(GTK_CONTAINER(box), (GtkCallback)gtk_widget_destroy, NULL);
+
gint i,length;
length=g_list_length(windows);
for(i=0;i<length;i++)
{
win=(WnckWindow*)g_list_nth_data(windows,i);
- add_window(screen,win,NULL);
+ if(wnck_window_is_on_workspace(win,actWorkspace))
+ {
+ add_window(screen,win,NULL);
+ }
}
+ return;
+}
+
+GtkWidget *talika_tasklist_new(WnckScreen *screen)
+{
+ WnckWorkspace *workspace;
+
+ tips=gtk_tooltips_new();
+ box=gtk_hbox_new(FALSE,0);
+ hash=g_hash_table_new(hash_func,equal_func);
+
+ fill_taskbar(screen, workspace, NULL);
+
g_signal_connect(screen,"window-opened",G_CALLBACK(add_window),NULL);
g_signal_connect(screen,"window-closed",G_CALLBACK(remove_window),NULL);
+ g_signal_connect(screen,"active-workspace-changed",G_CALLBACK(fill_taskbar),NULL);
return box;
}
Index: tasklist.h
===================================================================
-- tasklist.h (revision 3)
+++ tasklist.h (working copy)
@@ -3,6 +3,7 @@
*
* Authors: Vinod Kumar Dahiya
* Hemant Kumar
+ * Sigurdur Gudbrandsson
*/
Index: AUTHORS
-- AUTHORS (revision 3)
+++ AUTHORS (working copy)
@@ -1,2 +1,3 @@
Vinod Kumar Dahiya <vinod@sinewmail.com>
Hemant Kumar <hemant@sinewmail.com>
+Sigurdur Gubrandsson <sigurdur@raforninn.is>
Index: INSTALL
===================================================================
-- INSTALL (revision 3)
+++ INSTALL (working copy)
@@ -1,7 +1,7 @@
install these packages ->
-libpanel-applet-dev
+libpanel-applet-dev (In ubuntu 9.04 libpanel-applet2-dev)
libwnck-dev
compile and install like ->
Index: talika.c
===================================================================
-- talika.c (revision 3)
+++ talika.c (working copy)
@@ -3,6 +3,7 @@
*
* Authors: Vinod Kumar Dahiya
* Hemant Kumar
+ * Sigurdur Gudbrandsson
*/
#include <panel-applet.h>
@@ -60,6 +61,11 @@
BONOBO_UI_VERB_END
};
+static void destroy_tasklist ( GtkWidget *list, gpointer data)
+{
+ g_free(list);
+}
+
static void applet_size_change (PanelApplet *applet,gint size, gpointer data)
{
talika_set_panel_size(size);
@@ -77,6 +83,9 @@
panel_applet_set_flags(applet,PANEL_APPLET_HAS_HANDLE|PANEL_APPLET_EXPAND_MAJOR);
+ g_signal_connect (PANEL_APPLET(applet),"destroy",
+ G_CALLBACK (destroy_tasklist), NULL);
+
WnckScreen *screen;
screen = wnck_screen_get_default ();
wnck_screen_force_update (screen);
</pre>
Cheers.
This patch is no good. I committed the changes to SVN.