aboutsummaryrefslogtreecommitdiff
path: root/src/ui/contact_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/contact_info.c')
-rw-r--r--src/ui/contact_info.c125
1 files changed, 125 insertions, 0 deletions
diff --git a/src/ui/contact_info.c b/src/ui/contact_info.c
new file mode 100644
index 0000000..b8e504b
--- /dev/null
+++ b/src/ui/contact_info.c
@@ -0,0 +1,125 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/*
21 * @author Tobias Frisch
22 * @file ui/contact_info.c
23 */
24
25#include "contact_info.h"
26
27#include "../application.h"
28
29static void
30handle_close_button_click(UNUSED GtkButton *button,
31 gpointer user_data)
32{
33 GtkDialog *dialog = GTK_DIALOG(user_data);
34 gtk_window_close(GTK_WINDOW(dialog));
35}
36
37static void
38handle_dialog_destroy(UNUSED GtkWidget *window,
39 gpointer user_data)
40{
41 ui_contact_info_dialog_cleanup((UI_CONTACT_INFO_Handle*) user_data);
42}
43
44void
45ui_contact_info_dialog_init(MESSENGER_Application *app,
46 UI_CONTACT_INFO_Handle *handle)
47{
48 handle->builder = gtk_builder_new_from_resource(
49 application_get_resource_path(app, "ui/contact_info.ui")
50 );
51
52 handle->dialog = GTK_DIALOG(
53 gtk_builder_get_object(handle->builder, "contact_info_dialog")
54 );
55
56 gtk_window_set_transient_for(
57 GTK_WINDOW(handle->dialog),
58 GTK_WINDOW(app->ui.messenger.main_window)
59 );
60
61 handle->contact_info_stack = GTK_STACK(
62 gtk_builder_get_object(handle->builder, "contact_info_stack")
63 );
64
65 handle->details_box = GTK_WIDGET(
66 gtk_builder_get_object(handle->builder, "details_box")
67 );
68
69 handle->contact_avatar = HDY_AVATAR(
70 gtk_builder_get_object(handle->builder, "contact_avatar")
71 );
72
73 handle->contact_name = GTK_ENTRY(
74 gtk_builder_get_object(handle->builder, "contact_name")
75 );
76
77 handle->reveal_identity_button = GTK_BUTTON(
78 gtk_builder_get_object(handle->builder, "reveal_identity_button")
79 );
80
81 handle->open_chat_button = GTK_BUTTON(
82 gtk_builder_get_object(handle->builder, "open_chat_button")
83 );
84
85 handle->id_drawing_area = GTK_DRAWING_AREA(
86 gtk_builder_get_object(handle->builder, "id_drawing_area")
87 );
88
89 handle->back_button = GTK_BUTTON(
90 gtk_builder_get_object(handle->builder, "back_button")
91 );
92
93 handle->close_button = GTK_BUTTON(
94 gtk_builder_get_object(handle->builder, "close_button")
95 );
96
97 g_signal_connect(
98 handle->close_button,
99 "clicked",
100 G_CALLBACK(handle_close_button_click),
101 handle->dialog
102 );
103
104 g_signal_connect(
105 handle->dialog,
106 "destroy",
107 G_CALLBACK(handle_dialog_destroy),
108 handle
109 );
110}
111
112void
113ui_contact_info_dialog_update(UI_CONTACT_INFO_Handle *handle,
114 struct GNUNET_CHAT_Contact *contact)
115{
116 // TODO
117}
118
119void
120ui_contact_info_dialog_cleanup(UI_CONTACT_INFO_Handle *handle)
121{
122 g_object_unref(handle->builder);
123
124 memset(handle, 0, sizeof(*handle));
125}