From 06fd3eee666f1219fbda396ba6ab60db6684683d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Sun, 3 May 2009 22:17:41 +0200 Subject: [PATCH] apply asynchronous parameters changes to GUI --- gdigi.c | 25 ++++++++++++++++++++++--- gui.c | 14 ++++++++++++++ gui.h | 1 + 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/gdigi.c b/gdigi.c index a125a4f..c75d050 100644 --- a/gdigi.c +++ b/gdigi.c @@ -214,6 +214,20 @@ void push_message(GString *msg) return; } + if (get_message_id(msg) == RECEIVE_PARAMETER_VALUE) { + unpack_message(msg); + SettingParam *param = setting_param_new_from_data(&msg->str[8], NULL); + g_message("Received parameter change ID: %d Position: %d Value: %d", param->id, param->position, param->value); + + GDK_THREADS_ENTER(); + apply_setting_param_to_gui(param); + GDK_THREADS_LEAVE(); + + setting_param_free(param); + g_string_free(msg, TRUE); + return; + } + g_mutex_lock(message_queue_mutex); g_queue_push_tail(message_queue, msg); g_mutex_unlock(message_queue_mutex); @@ -417,7 +431,8 @@ guint unpack_value(gchar *str, int *len) gint tmp; value = (unsigned char)str[0]; - *len += 1; + if (len != NULL) + *len += 1; if (value > 0x80) { tmp = value & 0x7F; @@ -426,7 +441,9 @@ guint unpack_value(gchar *str, int *len) for (i = 0; i