diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-17 23:13:20 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-17 23:13:20 +0100 |
commit | ddbfde655bbb235ebd94e1309db3c05b75cbe3b8 (patch) | |
tree | 4fff6324fd19fab9abda5df06808fa3ea56bf143 | |
parent | 3a89feb75936fb70c5852e8254d225ed7a20a0fb (diff) | |
download | messenger-gtk-ddbfde655bbb235ebd94e1309db3c05b75cbe3b8.tar.gz messenger-gtk-ddbfde655bbb235ebd94e1309db3c05b75cbe3b8.zip |
Adjusted flap handling to fix issues with touchscreen
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/ui/chat.c | 26 | ||||
-rw-r--r-- | src/ui/contact_info.c | 7 | ||||
-rw-r--r-- | 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 @@ | |||
40 | #include "../file.h" | 40 | #include "../file.h" |
41 | 41 | ||
42 | static gboolean | 42 | static gboolean |
43 | _flap_reveal_switch(gpointer user_data) | 43 | _flap_chat_details_reveal_switch(gpointer user_data) |
44 | { | 44 | { |
45 | HdyFlap* flap = HDY_FLAP(user_data); | 45 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; |
46 | HdyFlap* flap = handle->flap_chat_details; | ||
46 | 47 | ||
47 | if (TRUE == hdy_flap_get_reveal_flap(flap)) { | 48 | if (TRUE == hdy_flap_get_reveal_flap(flap)) { |
48 | hdy_flap_set_reveal_flap(flap, FALSE); | 49 | hdy_flap_set_reveal_flap(flap, FALSE); |
@@ -50,14 +51,21 @@ _flap_reveal_switch(gpointer user_data) | |||
50 | hdy_flap_set_reveal_flap(flap, TRUE); | 51 | hdy_flap_set_reveal_flap(flap, TRUE); |
51 | } | 52 | } |
52 | 53 | ||
54 | gtk_widget_set_sensitive(GTK_WIDGET(handle->messages_listbox), TRUE); | ||
53 | return FALSE; | 55 | return FALSE; |
54 | } | 56 | } |
55 | 57 | ||
56 | static void | 58 | static void |
57 | handle_flap_via_button_click(UNUSED GtkButton* button, | 59 | handle_chat_details_via_button_click(UNUSED GtkButton* button, |
58 | gpointer user_data) | 60 | gpointer user_data) |
59 | { | 61 | { |
60 | g_idle_add(G_SOURCE_FUNC(_flap_reveal_switch), user_data); | 62 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; |
63 | |||
64 | gtk_widget_set_sensitive(GTK_WIDGET(handle->messages_listbox), FALSE); | ||
65 | g_idle_add( | ||
66 | G_SOURCE_FUNC(_flap_chat_details_reveal_switch), | ||
67 | handle | ||
68 | ); | ||
61 | } | 69 | } |
62 | 70 | ||
63 | static void | 71 | static void |
@@ -1126,8 +1134,8 @@ ui_chat_new(MESSENGER_Application *app) | |||
1126 | g_signal_connect( | 1134 | g_signal_connect( |
1127 | handle->chat_details_button, | 1135 | handle->chat_details_button, |
1128 | "clicked", | 1136 | "clicked", |
1129 | G_CALLBACK(handle_flap_via_button_click), | 1137 | G_CALLBACK(handle_chat_details_via_button_click), |
1130 | handle->flap_chat_details | 1138 | handle |
1131 | ); | 1139 | ); |
1132 | 1140 | ||
1133 | handle->chat_details_label = GTK_LABEL( | 1141 | handle->chat_details_label = GTK_LABEL( |
@@ -1141,8 +1149,8 @@ ui_chat_new(MESSENGER_Application *app) | |||
1141 | g_signal_connect( | 1149 | g_signal_connect( |
1142 | handle->hide_chat_details_button, | 1150 | handle->hide_chat_details_button, |
1143 | "clicked", | 1151 | "clicked", |
1144 | G_CALLBACK(handle_flap_via_button_click), | 1152 | G_CALLBACK(handle_chat_details_via_button_click), |
1145 | handle->flap_chat_details | 1153 | handle |
1146 | ); | 1154 | ); |
1147 | 1155 | ||
1148 | handle->chat_details_contacts_box = GTK_BOX( | 1156 | 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, | |||
52 | if ((name) && (0 == g_utf8_strlen(name, 1))) | 52 | if ((name) && (0 == g_utf8_strlen(name, 1))) |
53 | name = NULL; | 53 | name = NULL; |
54 | 54 | ||
55 | if (GNUNET_CHAT_contact_is_owned(contact)) | 55 | if (GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact)) |
56 | if (GNUNET_YES != GNUNET_CHAT_set_name(contact, name)) | 56 | { |
57 | if (GNUNET_YES != GNUNET_CHAT_set_name(handle->app->chat.messenger.handle, | ||
58 | name)) | ||
57 | gtk_entry_set_text( | 59 | gtk_entry_set_text( |
58 | handle->contact_name_entry, | 60 | handle->contact_name_entry, |
59 | GNUNET_CHAT_contact_get_name(contact) | 61 | GNUNET_CHAT_contact_get_name(contact) |
60 | ); | 62 | ); |
63 | } | ||
61 | else | 64 | else |
62 | GNUNET_CHAT_contact_set_name(contact, name); | 65 | GNUNET_CHAT_contact_set_name(contact, name); |
63 | 66 | ||
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 @@ | |||
39 | #include "../application.h" | 39 | #include "../application.h" |
40 | 40 | ||
41 | static gboolean | 41 | static gboolean |
42 | _flap_reveal_switch(gpointer user_data) | 42 | _flap_user_details_reveal_switch(gpointer user_data) |
43 | { | 43 | { |
44 | HdyFlap* flap = HDY_FLAP(user_data); | 44 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; |
45 | HdyFlap* flap = handle->flap_user_details; | ||
45 | 46 | ||
46 | if (TRUE == hdy_flap_get_reveal_flap(flap)) { | 47 | if (TRUE == hdy_flap_get_reveal_flap(flap)) { |
47 | hdy_flap_set_reveal_flap(flap, FALSE); | 48 | hdy_flap_set_reveal_flap(flap, FALSE); |
@@ -49,14 +50,21 @@ _flap_reveal_switch(gpointer user_data) | |||
49 | hdy_flap_set_reveal_flap(flap, TRUE); | 50 | hdy_flap_set_reveal_flap(flap, TRUE); |
50 | } | 51 | } |
51 | 52 | ||
53 | gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_listbox), TRUE); | ||
52 | return FALSE; | 54 | return FALSE; |
53 | } | 55 | } |
54 | 56 | ||
55 | static void | 57 | static void |
56 | handle_flap_via_button_click(UNUSED GtkButton* button, | 58 | handle_user_details_via_button_click(UNUSED GtkButton* button, |
57 | gpointer user_data) | 59 | gpointer user_data) |
58 | { | 60 | { |
59 | g_idle_add(G_SOURCE_FUNC(_flap_reveal_switch), user_data); | 61 | UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; |
62 | |||
63 | gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_listbox), FALSE); | ||
64 | g_idle_add( | ||
65 | G_SOURCE_FUNC(_flap_user_details_reveal_switch), | ||
66 | handle | ||
67 | ); | ||
60 | } | 68 | } |
61 | 69 | ||
62 | static void | 70 | static void |
@@ -375,8 +383,8 @@ ui_messenger_init(MESSENGER_Application *app, | |||
375 | g_signal_connect( | 383 | g_signal_connect( |
376 | handle->hide_user_details_button, | 384 | handle->hide_user_details_button, |
377 | "clicked", | 385 | "clicked", |
378 | G_CALLBACK(handle_flap_via_button_click), | 386 | G_CALLBACK(handle_user_details_via_button_click), |
379 | handle->flap_user_details | 387 | handle |
380 | ); | 388 | ); |
381 | 389 | ||
382 | handle->lobby_button = GTK_BUTTON( | 390 | handle->lobby_button = GTK_BUTTON( |
@@ -497,8 +505,8 @@ ui_messenger_init(MESSENGER_Application *app, | |||
497 | g_signal_connect( | 505 | g_signal_connect( |
498 | handle->user_details_button, | 506 | handle->user_details_button, |
499 | "clicked", | 507 | "clicked", |
500 | G_CALLBACK(handle_flap_via_button_click), | 508 | G_CALLBACK(handle_user_details_via_button_click), |
501 | handle->flap_user_details | 509 | handle |
502 | ); | 510 | ); |
503 | 511 | ||
504 | handle->chats_search = GTK_SEARCH_ENTRY( | 512 | handle->chats_search = GTK_SEARCH_ENTRY( |