[vala/wip/attributes: 83/100] Drop Signal.get_signal_canonical_cconstant



commit c16b5cb75cb3a03ce140373211227c77a82ea273
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jun 30 10:46:11 2011 +0200

    Drop Signal.get_signal_canonical_cconstant

 codegen/valaccodebasemodule.vala   |   26 ++++++++++++++++++++++++++
 codegen/valagdbusclientmodule.vala |    2 +-
 codegen/valagdbusservermodule.vala |    2 +-
 codegen/valagsignalmodule.vala     |    8 ++++----
 vala/valasignal.vala               |   31 -------------------------------
 5 files changed, 32 insertions(+), 37 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 007bb91..abffc85 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5836,6 +5836,32 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return true;
 	}
 
+	public CCodeConstant get_signal_canonical_constant (Signal sig, string? detail = null) {
+		var str = new StringBuilder ("\"");
+
+		string i = get_ccode_name (sig);
+
+		while (i.length > 0) {
+			unichar c = i.get_char ();
+			if (c == '_') {
+				str.append_c ('-');
+			} else {
+				str.append_unichar (c);
+			}
+
+			i = i.next_char ();
+		}
+
+		if (detail != null) {
+			str.append ("::");
+			str.append (detail);
+		}
+
+		str.append_c ('"');
+
+		return new CCodeConstant (str.str);
+	}
+
 	public override void visit_class (Class cl) {
 	}
 
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index b580e0d..a19076c 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -401,7 +401,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_emit_by_name"));
 		ccall.add_argument (new CCodeIdentifier ("self"));
-		ccall.add_argument (sig.get_canonical_cconstant ());
+		ccall.add_argument (get_signal_canonical_constant (sig));
 
 		foreach (Parameter param in sig.get_parameters ()) {
 			var param_name = get_variable_cname (param.name);
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index f4b971c..72e2e5f 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -601,7 +601,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
 			var connect = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_connect"));
 			connect.add_argument (new CCodeIdentifier ("object"));
-			connect.add_argument (sig.get_canonical_cconstant ());
+			connect.add_argument (get_signal_canonical_constant (sig));
 			connect.add_argument (new CCodeCastExpression (new CCodeIdentifier (generate_dbus_signal_wrapper (sig, sym, dbus_iface_name)), "GCallback"));
 			connect.add_argument (new CCodeIdentifier ("data"));
 			ccode.add_expression (connect);
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 50eda03..fba5c87 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -107,7 +107,7 @@ public class Vala.GSignalModule : GObjectModule {
 
 	private CCodeExpression? get_signal_name_cexpression (Signal sig, Expression? detail_expr, CodeNode node) {
 		if (detail_expr == null) {
-			return sig.get_canonical_cconstant ();
+			return get_signal_canonical_constant (sig);
 		}
 
 		if (detail_expr.value_type is NullType || !detail_expr.value_type.compatible (string_type)) {
@@ -117,7 +117,7 @@ public class Vala.GSignalModule : GObjectModule {
 		}
 
 		if (detail_expr is StringLiteral) {
-			return sig.get_canonical_cconstant (((StringLiteral) detail_expr).eval ());
+			return get_signal_canonical_constant (sig, ((StringLiteral) detail_expr).eval ());
 		}
 
 		var detail_decl = get_temp_variable (detail_expr.value_type, true, node);
@@ -125,7 +125,7 @@ public class Vala.GSignalModule : GObjectModule {
 		temp_ref_vars.insert (0, detail_decl);
 
 		var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strconcat"));
-		ccall.add_argument (sig.get_canonical_cconstant (""));
+		ccall.add_argument (get_signal_canonical_constant (sig, ""));
 		ccall.add_argument (get_cvalue (detail_expr));
 		ccall.add_argument (new CCodeConstant ("NULL"));
 
@@ -488,7 +488,7 @@ public class Vala.GSignalModule : GObjectModule {
 				var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_signal_emit_by_name"));
 				ccall.add_argument (pub_inst);
 
-				ccall.add_argument (sig.get_canonical_cconstant ());
+				ccall.add_argument (get_signal_canonical_constant (sig));
 				
 				set_cvalue (expr, ccall);
 			}
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 4254131..614ff0b 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -167,37 +167,6 @@ public class Vala.Signal : Symbol, Lockable {
 		return generated_delegate;
 	}
 	
-	/**
-	 * Returns the string literal of this signal to be used in C code.
-	 *
-	 * @return string literal to be used in C code
-	 */
-	public CCodeConstant get_canonical_cconstant (string? detail = null) {
-		var str = new StringBuilder ("\"");
-		
-		string i = get_cname ();
-		
-		while (i.length > 0) {
-			unichar c = i.get_char ();
-			if (c == '_') {
-				str.append_c ('-');
-			} else {
-				str.append_unichar (c);
-			}
-			
-			i = i.next_char ();
-		}
-
-		if (detail != null) {
-			str.append ("::");
-			str.append (detail);
-		}
-
-		str.append_c ('"');
-		
-		return new CCodeConstant (str.str);
-	}
-
 	public override void accept (CodeVisitor visitor) {
 		visitor.visit_signal (this);
 	}



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