Add support for switching to a different GAtSyntax at runtime
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Oct 2009 10:29:02 +0000 (12:29 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Oct 2009 10:29:47 +0000 (12:29 +0200)
gatchat/gatchat.c
gatchat/gatchat.h

index fa4f262..c4de147 100644 (file)
@@ -1003,6 +1003,18 @@ gboolean g_at_chat_shutdown(GAtChat *chat)
        return TRUE;
 }
 
+gboolean g_at_chat_set_syntax(GAtChat *chat, GAtSyntax *syntax)
+{
+       if (chat == NULL)
+               return FALSE;
+
+       g_at_syntax_unref(chat->syntax);
+
+       chat->syntax = g_at_syntax_ref(syntax);
+
+       return TRUE;
+}
+
 gboolean g_at_chat_set_disconnect_function(GAtChat *chat,
                        GAtDisconnectFunc disconnect, gpointer user_data)
 {
index b86fdb7..6a4c222 100644 (file)
@@ -47,6 +47,8 @@ void g_at_chat_unref(GAtChat *chat);
 
 gboolean g_at_chat_shutdown(GAtChat *chat);
 
+gboolean g_at_chat_set_syntax(GAtChat *chat, GAtSyntax *syntax);
+
 gboolean g_at_chat_set_disconnect_function(GAtChat *chat,
                        GAtDisconnectFunc disconnect, gpointer user_data);