--- diff/valacodegenerator.vala 2007-03-15 23:31:54.000000000 -0300 +++ vala/valacodegenerator.vala 2007-03-15 23:29:49.000000000 -0300 @@ -3502,12 +3502,17 @@ var sig = (Signal) a.left.symbol_reference.node; var m = (Method) a.right.symbol_reference.node; + + CCodeFunctionCall ccall; + + if (a.operator != AssignmentOperator.SUB) { + var connect_func = "g_signal_connect_object"; if (!m.instance) { connect_func = "g_signal_connect"; } - var ccall = new CCodeFunctionCall (new CCodeIdentifier (connect_func)); + ccall = new CCodeFunctionCall (new CCodeIdentifier (connect_func)); if (ma.inner != null) { ccall.add_argument ((CCodeExpression) ma.inner.ccodenode); @@ -3534,7 +3539,36 @@ } else { ccall.add_argument (new CCodeConstant ("NULL")); } - + } else { + var connect_func = "g_signal_handlers_disconnect_by_func"; + + ccall = new CCodeFunctionCall (new CCodeIdentifier (connect_func)); + + if (ma.inner != null) { + ccall.add_argument ((CCodeExpression) ma.inner.ccodenode); + } else { + ccall.add_argument (new CCodeIdentifier ("self")); + } + + ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier (m.get_cname ()), "GCallback")); + + if (m.instance) { + if (a.right is MemberAccess) { + var right_ma = (MemberAccess) a.right; + if (right_ma.inner != null) { + ccall.add_argument ((CCodeExpression) right_ma.inner.ccodenode); + } else { + ccall.add_argument (new CCodeIdentifier ("self")); + } + } else if (a.right is LambdaExpression) { + ccall.add_argument (new CCodeIdentifier ("self")); + } + } else { + ccall.add_argument (new CCodeConstant ("NULL")); + } + + + } a.ccodenode = ccall; } else { /* explicitly use strong reference as ccast gets