From e6667aed7aaa5e60b3ded91aa5a6c28bf6da3314 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 17 Aug 2022 12:53:29 +0200 Subject: Implement roster to chat view transition --- gtk.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gtk.c') diff --git a/gtk.c b/gtk.c index 8e39a73..d4b1cfc 100644 --- a/gtk.c +++ b/gtk.c @@ -4,6 +4,7 @@ #include #include "limox.h" +#include "data.h" // the GTK application is available as global variable @@ -219,6 +220,13 @@ void gui_add_message(const char* sender_jid, const char* content) { printf("Received from %s:\n%s\n", sender_jid, content); } +static void to_chat(GtkWidget* roster_item_widget) { + + GtkWidget* chat_page = data_get_chat_page((void*)roster_item_widget); + gtk_stack_set_visible_child(GTK_STACK(stack), chat_page); + +} + void* gui_add_roster_item(const char* jid, const char* sub, const char* name) { // print debug message @@ -238,8 +246,8 @@ void* gui_add_roster_item(const char* jid, const char* sub, const char* name) { // add roster item widget to roster page gtk_box_append(GTK_BOX(roster_content_box), roster_item_widget); - //g_signal_connect_swapped(roster_item_widget, "clicked", G_CALLBACK(to_chat), - // chat->chat_layout_box); TODO this should be realized again + g_signal_connect_swapped(roster_item_widget, "clicked", G_CALLBACK(to_chat), + roster_item_widget); return (void*)roster_item_widget; } -- cgit v1.2.3-70-g09d2