aboutsummaryrefslogtreecommitdiff
path: root/src/ui/about.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/about.c')
-rw-r--r--src/ui/about.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/ui/about.c b/src/ui/about.c
new file mode 100644
index 0000000..70b2cd0
--- /dev/null
+++ b/src/ui/about.c
@@ -0,0 +1,101 @@
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 about.c
23 */
24
25#include "about.h"
26
27#include "../application.h"
28
29static void
30handle_close_button_click(UNUSED GtkButton *button,
31 gpointer user_data)
32{
33 GtkAboutDialog *dialog = GTK_ABOUT_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_about_dialog_cleanup((UI_ABOUT_Handle*) user_data);
42}
43
44void
45ui_about_dialog_init(MESSENGER_Application *app,
46 UI_ABOUT_Handle *handle)
47{
48 handle->builder = gtk_builder_new_from_resource(
49 application_get_resource_path(app, "ui/about.ui")
50 );
51
52 handle->dialog = GTK_ABOUT_DIALOG(
53 gtk_builder_get_object(handle->builder, "about_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 gtk_about_dialog_set_program_name(
62 handle->dialog,
63 MESSENGER_APPLICATION_APPNAME
64 );
65
66 gtk_about_dialog_set_version(
67 handle->dialog,
68 MESSENGER_APPLICATION_VERSION
69 );
70
71 gtk_about_dialog_set_logo_icon_name(
72 handle->dialog,
73 MESSENGER_APPLICATION_ID
74 );
75
76 handle->close_button = GTK_BUTTON(
77 gtk_builder_get_object(handle->builder, "close_button")
78 );
79
80 g_signal_connect(
81 handle->close_button,
82 "clicked",
83 G_CALLBACK(handle_close_button_click),
84 handle->dialog
85 );
86
87 g_signal_connect(
88 handle->dialog,
89 "destroy",
90 G_CALLBACK(handle_dialog_destroy),
91 handle
92 );
93}
94
95void
96ui_about_dialog_cleanup(UI_ABOUT_Handle *handle)
97{
98 g_object_unref(handle->builder);
99
100 memset(handle, 0, sizeof(*handle));
101}