From 40e288f4fa5b890017dde115136417c132b05bf5 Mon Sep 17 00:00:00 2001
From: Jasper Huijsmans <jbhuijsmans@home.nl>
Date: Wed, 3 Nov 2004 10:52:14 +0000
Subject: [PATCH] Re-add dynamic workspace updating. With g_module_unload()
 function to disconnect handlers

(Old svn revision: 12126)
---
 configure               | 20 ++++++++++----------
 configure.ac            |  4 ++--
 ltmain.sh               |  3 ---
 mcs-plugin/workspaces.c | 26 +++++++++++++++++++-------
 4 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/configure b/configure
index 678c88a35..2db889bc4 100755
--- a/configure
+++ b/configure
@@ -1825,7 +1825,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=xfwm4
- VERSION=4.1.91
+ VERSION=4.1.92
 
 
 cat >>confdefs.h <<_ACEOF
@@ -24660,23 +24660,23 @@ fi
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:$LINENO: checking for xfce-mcs-manager >= 4.1.90" >&5
-echo $ECHO_N "checking for xfce-mcs-manager >= 4.1.90... $ECHO_C" >&6
+        echo "$as_me:$LINENO: checking for xfce-mcs-manager >= 4.1.92" >&5
+echo $ECHO_N "checking for xfce-mcs-manager >= 4.1.92... $ECHO_C" >&6
 
-        if $PKG_CONFIG --exists "xfce-mcs-manager >= 4.1.90" ; then
+        if $PKG_CONFIG --exists "xfce-mcs-manager >= 4.1.92" ; then
             echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
             succeeded=yes
 
             echo "$as_me:$LINENO: checking XFCE_MCS_MANAGER_CFLAGS" >&5
 echo $ECHO_N "checking XFCE_MCS_MANAGER_CFLAGS... $ECHO_C" >&6
-            XFCE_MCS_MANAGER_CFLAGS=`$PKG_CONFIG --cflags "xfce-mcs-manager >= 4.1.90"`
+            XFCE_MCS_MANAGER_CFLAGS=`$PKG_CONFIG --cflags "xfce-mcs-manager >= 4.1.92"`
             echo "$as_me:$LINENO: result: $XFCE_MCS_MANAGER_CFLAGS" >&5
 echo "${ECHO_T}$XFCE_MCS_MANAGER_CFLAGS" >&6
 
             echo "$as_me:$LINENO: checking XFCE_MCS_MANAGER_LIBS" >&5
 echo $ECHO_N "checking XFCE_MCS_MANAGER_LIBS... $ECHO_C" >&6
-            XFCE_MCS_MANAGER_LIBS=`$PKG_CONFIG --libs "xfce-mcs-manager >= 4.1.90"`
+            XFCE_MCS_MANAGER_LIBS=`$PKG_CONFIG --libs "xfce-mcs-manager >= 4.1.92"`
             echo "$as_me:$LINENO: result: $XFCE_MCS_MANAGER_LIBS" >&5
 echo "${ECHO_T}$XFCE_MCS_MANAGER_LIBS" >&6
         else
@@ -24684,7 +24684,7 @@ echo "${ECHO_T}$XFCE_MCS_MANAGER_LIBS" >&6
             XFCE_MCS_MANAGER_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
-            XFCE_MCS_MANAGER_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xfce-mcs-manager >= 4.1.90"`
+            XFCE_MCS_MANAGER_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xfce-mcs-manager >= 4.1.92"`
             echo $XFCE_MCS_MANAGER_PKG_ERRORS
         fi
 
@@ -24699,12 +24699,12 @@ echo "${ECHO_T}$XFCE_MCS_MANAGER_LIBS" >&6
   if test $succeeded = yes; then
      :
   else
-     { { echo "$as_me:$LINENO: error: Library requirements (xfce-mcs-manager >= 4.1.90) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (xfce-mcs-manager >= 4.1.90) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+     { { echo "$as_me:$LINENO: error: Library requirements (xfce-mcs-manager >= 4.1.92) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (xfce-mcs-manager >= 4.1.92) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
    { (exit 1); exit 1; }; }
   fi
 
-  XFCE_MCS_MANAGER_REQUIRED_VERSION=4.1.90
+  XFCE_MCS_MANAGER_REQUIRED_VERSION=4.1.92
 
 
 
diff --git a/configure.ac b/configure.ac
index 06c11620e..18cbbafcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_INIT([src/main.c])
 
 AC_PREREQ(2.52)
 
-AM_INIT_AUTOMAKE([xfwm4], [4.1.91])
+AM_INIT_AUTOMAKE([xfwm4], [4.1.92])
 
 AM_CONFIG_HEADER([config.h])
 
@@ -55,7 +55,7 @@ BM_DEPEND(LIBXFCE4MCS_CLIENT, libxfce4mcs-client-1.0, 4.1.91)
 BM_DEPEND(LIBXFCE4MCS_MANAGER, libxfce4mcs-manager-1.0, 4.1.91)
 BM_DEPEND([LIBXFCE4UTIL], [libxfce4util-1.0], [4.1.17])
 BM_DEPEND(LIBXFCEGUI4, libxfcegui4-1.0, 4.1.21)
-XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [4.1.90])
+XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [4.1.92])
 
 BM_DEPEND_CHECK(LIBSTARTUP_NOTIFICATION, libstartup-notification-1.0, 0.5,
   [startup-notification], [startup notification library], [yes])
diff --git a/ltmain.sh b/ltmain.sh
index 23f82e3b7..c13e957f7 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -33,9 +33,6 @@ basename="s,^.*/,,g"
 # function.
 progpath="$0"
 
-# RH: define SED for historic ltconfig's generated by Libtool 1.3
-[ -z "$SED" ] && SED=sed
-
 # The name of this program:
 progname=`echo "$progpath" | $SED $basename`
 modename="$progname"
diff --git a/mcs-plugin/workspaces.c b/mcs-plugin/workspaces.c
index 398556399..9b146eb6b 100644
--- a/mcs-plugin/workspaces.c
+++ b/mcs-plugin/workspaces.c
@@ -51,6 +51,8 @@
 
 static McsManager *mcs_manager;
 static NetkScreen *netk_screen = NULL;
+static gulong ws_created_id = 0;
+static gulong ws_destroyed_id = 0;
 
 static int ws_count = 1;
 static char **ws_names = NULL;
@@ -187,9 +189,11 @@ create_workspaces_channel (McsPlugin * mcs_plugin)
        remains and crashes the MCS manager on workspace count
        change.
        Safer to remove it for now.
+
+       XXX added g_module_unload () to remove callbacks.
+     */
        
        watch_workspaces_hint (mcs_manager);
-     */
 }
 
 static void
@@ -573,11 +577,19 @@ update_channel (NetkScreen * screen, NetkWorkspace * ws, McsManager * manager)
 static void
 watch_workspaces_hint (McsManager * manager)
 {
-    /* make GCC happy */
-    (void)&watch_workspaces_hint;
+    ws_created_id =g_signal_connect (netk_screen, "workspace-created",
+                                     G_CALLBACK (update_channel), manager);
+
+    ws_destroyed_id = g_signal_connect (netk_screen, "workspace-destroyed",
+                                        G_CALLBACK (update_channel), manager);
+}
+
+g_module_unload (GModule *module)
+{
+    DBG ("Disconecting workspace signal handlers");
+
+    g_signal_handler_disconnect (netk_screen, ws_created_id);
+    g_signal_handler_disconnect (netk_screen, ws_destroyed_id);
 
-    g_signal_connect (netk_screen, "workspace-created",
-                      G_CALLBACK (update_channel), manager);
-    g_signal_connect (netk_screen, "workspace-destroyed",
-                      G_CALLBACK (update_channel), manager);
+    g_object_unref (netk_screen);
 }
-- 
GitLab