aboutsummaryrefslogtreecommitdiff
path: root/src/ui/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/settings.c')
-rw-r--r--src/ui/settings.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ui/settings.c b/src/ui/settings.c
index 99b487b..ab13592 100644
--- a/src/ui/settings.c
+++ b/src/ui/settings.c
@@ -56,6 +56,43 @@ handle_general_combo_box_change(GtkComboBox *widget,
56 gtk_tree_model_get(model, &iter, 1, delay, -1); 56 gtk_tree_model_get(model, &iter, 1, delay, -1);
57} 57}
58 58
59int
60_leave_group_iteration(UNUSED void *cls,
61 UNUSED struct GNUNET_CHAT_Handle *handle,
62 struct GNUNET_CHAT_Group *group)
63{
64 GNUNET_CHAT_group_leave(group);
65 return GNUNET_YES;
66}
67
68int
69_delete_contact_iteration(UNUSED void *cls,
70 UNUSED struct GNUNET_CHAT_Handle *handle,
71 struct GNUNET_CHAT_Contact *contact)
72{
73 GNUNET_CHAT_contact_delete(contact);
74 return GNUNET_YES;
75}
76
77static void
78handle_leave_chats_button_click(UNUSED GtkButton* button,
79 gpointer user_data)
80{
81 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
82
83 GNUNET_CHAT_iterate_groups(
84 app->chat.messenger.handle,
85 _leave_group_iteration,
86 NULL
87 );
88
89 GNUNET_CHAT_iterate_contacts(
90 app->chat.messenger.handle,
91 _delete_contact_iteration,
92 NULL
93 );
94}
95
59static void 96static void
60handle_dialog_destroy(UNUSED GtkWidget *window, 97handle_dialog_destroy(UNUSED GtkWidget *window,
61 gpointer user_data) 98 gpointer user_data)
@@ -266,6 +303,13 @@ ui_settings_dialog_init(MESSENGER_Application *app,
266 ); 303 );
267 304
268 g_signal_connect( 305 g_signal_connect(
306 handle->leave_chats_button,
307 "clicked",
308 G_CALLBACK(handle_leave_chats_button_click),
309 app
310 );
311
312 g_signal_connect(
269 handle->dialog, 313 handle->dialog,
270 "destroy", 314 "destroy",
271 G_CALLBACK(handle_dialog_destroy), 315 G_CALLBACK(handle_dialog_destroy),