From ddbfde655bbb235ebd94e1309db3c05b75cbe3b8 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Thu, 17 Mar 2022 23:13:20 +0100 Subject: Adjusted flap handling to fix issues with touchscreen Signed-off-by: TheJackiMonster --- src/ui/chat.c | 26 +++++++++++++++++--------- src/ui/contact_info.c | 7 +++++-- src/ui/messenger.c | 26 +++++++++++++++++--------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/ui/chat.c b/src/ui/chat.c index 79603db..d266726 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c @@ -40,9 +40,10 @@ #include "../file.h" static gboolean -_flap_reveal_switch(gpointer user_data) +_flap_chat_details_reveal_switch(gpointer user_data) { - HdyFlap* flap = HDY_FLAP(user_data); + UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; + HdyFlap* flap = handle->flap_chat_details; if (TRUE == hdy_flap_get_reveal_flap(flap)) { hdy_flap_set_reveal_flap(flap, FALSE); @@ -50,14 +51,21 @@ _flap_reveal_switch(gpointer user_data) hdy_flap_set_reveal_flap(flap, TRUE); } + gtk_widget_set_sensitive(GTK_WIDGET(handle->messages_listbox), TRUE); return FALSE; } static void -handle_flap_via_button_click(UNUSED GtkButton* button, - gpointer user_data) +handle_chat_details_via_button_click(UNUSED GtkButton* button, + gpointer user_data) { - g_idle_add(G_SOURCE_FUNC(_flap_reveal_switch), user_data); + UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; + + gtk_widget_set_sensitive(GTK_WIDGET(handle->messages_listbox), FALSE); + g_idle_add( + G_SOURCE_FUNC(_flap_chat_details_reveal_switch), + handle + ); } static void @@ -1126,8 +1134,8 @@ ui_chat_new(MESSENGER_Application *app) g_signal_connect( handle->chat_details_button, "clicked", - G_CALLBACK(handle_flap_via_button_click), - handle->flap_chat_details + G_CALLBACK(handle_chat_details_via_button_click), + handle ); handle->chat_details_label = GTK_LABEL( @@ -1141,8 +1149,8 @@ ui_chat_new(MESSENGER_Application *app) g_signal_connect( handle->hide_chat_details_button, "clicked", - G_CALLBACK(handle_flap_via_button_click), - handle->flap_chat_details + G_CALLBACK(handle_chat_details_via_button_click), + handle ); handle->chat_details_contacts_box = GTK_BOX( diff --git a/src/ui/contact_info.c b/src/ui/contact_info.c index 0bd7c58..1592a76 100644 --- a/src/ui/contact_info.c +++ b/src/ui/contact_info.c @@ -52,12 +52,15 @@ handle_contact_edit_button_click(UNUSED GtkButton *button, if ((name) && (0 == g_utf8_strlen(name, 1))) name = NULL; - if (GNUNET_CHAT_contact_is_owned(contact)) - if (GNUNET_YES != GNUNET_CHAT_set_name(contact, name)) + if (GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact)) + { + if (GNUNET_YES != GNUNET_CHAT_set_name(handle->app->chat.messenger.handle, + name)) gtk_entry_set_text( handle->contact_name_entry, GNUNET_CHAT_contact_get_name(contact) ); + } else GNUNET_CHAT_contact_set_name(contact, name); diff --git a/src/ui/messenger.c b/src/ui/messenger.c index b4d12af..e6ea657 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c @@ -39,9 +39,10 @@ #include "../application.h" static gboolean -_flap_reveal_switch(gpointer user_data) +_flap_user_details_reveal_switch(gpointer user_data) { - HdyFlap* flap = HDY_FLAP(user_data); + UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; + HdyFlap* flap = handle->flap_user_details; if (TRUE == hdy_flap_get_reveal_flap(flap)) { hdy_flap_set_reveal_flap(flap, FALSE); @@ -49,14 +50,21 @@ _flap_reveal_switch(gpointer user_data) hdy_flap_set_reveal_flap(flap, TRUE); } + gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_listbox), TRUE); return FALSE; } static void -handle_flap_via_button_click(UNUSED GtkButton* button, - gpointer user_data) +handle_user_details_via_button_click(UNUSED GtkButton* button, + gpointer user_data) { - g_idle_add(G_SOURCE_FUNC(_flap_reveal_switch), user_data); + UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; + + gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_listbox), FALSE); + g_idle_add( + G_SOURCE_FUNC(_flap_user_details_reveal_switch), + handle + ); } static void @@ -375,8 +383,8 @@ ui_messenger_init(MESSENGER_Application *app, g_signal_connect( handle->hide_user_details_button, "clicked", - G_CALLBACK(handle_flap_via_button_click), - handle->flap_user_details + G_CALLBACK(handle_user_details_via_button_click), + handle ); handle->lobby_button = GTK_BUTTON( @@ -497,8 +505,8 @@ ui_messenger_init(MESSENGER_Application *app, g_signal_connect( handle->user_details_button, "clicked", - G_CALLBACK(handle_flap_via_button_click), - handle->flap_user_details + G_CALLBACK(handle_user_details_via_button_click), + handle ); handle->chats_search = GTK_SEARCH_ENTRY( -- cgit v1.2.3