messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

commit cce355726f6cc845062a5e7e0435b90b52ec4d10
parent 7d6be3784f4f31a7e20ec5c9c4988e3fab864e8d
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Sun, 20 Mar 2022 16:17:08 +0100

Disabled buttons in settings which don't work yet

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Mresources/ui/settings.ui | 4++++
Msrc/ui/settings.c | 44++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/resources/ui/settings.ui b/resources/ui/settings.ui @@ -649,6 +649,7 @@ Author: Tobias Frisch <object class="GtkButton" id="delete_invitations_button"> <property name="label" translatable="yes">Delete all invitations</property> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can-focus">True</property> <property name="receives-default">True</property> <style> @@ -743,6 +744,7 @@ Author: Tobias Frisch <child> <object class="GtkFileChooserButton" id="download_folder_button"> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can-focus">False</property> <property name="title" translatable="yes">Select download folder</property> </object> @@ -821,6 +823,7 @@ Author: Tobias Frisch <object class="GtkButton" id="delete_files_button"> <property name="label" translatable="yes">Delete all files</property> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can-focus">True</property> <property name="receives-default">True</property> <style> @@ -910,6 +913,7 @@ Author: Tobias Frisch <object class="GtkButton" id="leave_chats_button"> <property name="label" translatable="yes">Leave all chats</property> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can-focus">True</property> <property name="receives-default">True</property> <style> diff --git a/src/ui/settings.c b/src/ui/settings.c @@ -56,6 +56,43 @@ handle_general_combo_box_change(GtkComboBox *widget, gtk_tree_model_get(model, &iter, 1, delay, -1); } +int +_leave_group_iteration(UNUSED void *cls, + UNUSED struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Group *group) +{ + GNUNET_CHAT_group_leave(group); + return GNUNET_YES; +} + +int +_delete_contact_iteration(UNUSED void *cls, + UNUSED struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Contact *contact) +{ + GNUNET_CHAT_contact_delete(contact); + return GNUNET_YES; +} + +static void +handle_leave_chats_button_click(UNUSED GtkButton* button, + gpointer user_data) +{ + MESSENGER_Application *app = (MESSENGER_Application*) user_data; + + GNUNET_CHAT_iterate_groups( + app->chat.messenger.handle, + _leave_group_iteration, + NULL + ); + + GNUNET_CHAT_iterate_contacts( + app->chat.messenger.handle, + _delete_contact_iteration, + NULL + ); +} + static void handle_dialog_destroy(UNUSED GtkWidget *window, gpointer user_data) @@ -266,6 +303,13 @@ ui_settings_dialog_init(MESSENGER_Application *app, ); g_signal_connect( + handle->leave_chats_button, + "clicked", + G_CALLBACK(handle_leave_chats_button_click), + app + ); + + g_signal_connect( handle->dialog, "destroy", G_CALLBACK(handle_dialog_destroy),