Signal emission

I created a new sign to set a label, with the following code:

	 g_signal_new ("set-title",
				   FNC_TYPE_EDIT,
				   G_SIGNAL_RUN_LAST,
				   G_STRUCT_OFFSET (FncEditInterface, set_title),
				   NULL, NULL, NULL,
				   G_TYPE_NONE,
				   1, G_TYPE_CHAR);

const gchar *text = “Some Text”;

g_signal_emit_by_name (self, “set-title”, text, NULL);

But it doesn’t work, but if I switch to functional G_TYPE_STRING someone can give me an explanation.

	 g_signal_new ("set-title",
				   FNC_TYPE_EDIT,
				   G_SIGNAL_RUN_LAST,
				   G_STRUCT_OFFSET (FncEditInterface, set_title),
				   NULL, NULL, NULL,
				   G_TYPE_NONE,
				   1, G_TYPE_STRING);

The G_TYPE_CHAR GType is for single char values; G_TYPE_STRING is for C strings (NUL-terminated char arrays).

You can read the G_TYPE_STRING documentation.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.