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.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/ui/about.c b/src/ui/about.c
index 70b2cd0..6306a74 100644
--- a/src/ui/about.c
+++ b/src/ui/about.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2022 GNUnet e.V. 3 Copyright (C) 2022--2024 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -28,73 +28,81 @@
28 28
29static void 29static void
30handle_close_button_click(UNUSED GtkButton *button, 30handle_close_button_click(UNUSED GtkButton *button,
31 gpointer user_data) 31 gpointer user_data)
32{ 32{
33 g_assert(user_data);
34
33 GtkAboutDialog *dialog = GTK_ABOUT_DIALOG(user_data); 35 GtkAboutDialog *dialog = GTK_ABOUT_DIALOG(user_data);
34 gtk_window_close(GTK_WINDOW(dialog)); 36 gtk_window_close(GTK_WINDOW(dialog));
35} 37}
36 38
37static void 39static void
38handle_dialog_destroy(UNUSED GtkWidget *window, 40handle_dialog_destroy(UNUSED GtkWidget *window,
39 gpointer user_data) 41 gpointer user_data)
40{ 42{
43 g_assert(user_data);
44
41 ui_about_dialog_cleanup((UI_ABOUT_Handle*) user_data); 45 ui_about_dialog_cleanup((UI_ABOUT_Handle*) user_data);
42} 46}
43 47
44void 48void
45ui_about_dialog_init(MESSENGER_Application *app, 49ui_about_dialog_init(MESSENGER_Application *app,
46 UI_ABOUT_Handle *handle) 50 UI_ABOUT_Handle *handle)
47{ 51{
52 g_assert((app) && (handle));
53
48 handle->builder = gtk_builder_new_from_resource( 54 handle->builder = gtk_builder_new_from_resource(
49 application_get_resource_path(app, "ui/about.ui") 55 application_get_resource_path(app, "ui/about.ui")
50 ); 56 );
51 57
52 handle->dialog = GTK_ABOUT_DIALOG( 58 handle->dialog = GTK_ABOUT_DIALOG(
53 gtk_builder_get_object(handle->builder, "about_dialog") 59 gtk_builder_get_object(handle->builder, "about_dialog")
54 ); 60 );
55 61
56 gtk_window_set_transient_for( 62 gtk_window_set_transient_for(
57 GTK_WINDOW(handle->dialog), 63 GTK_WINDOW(handle->dialog),
58 GTK_WINDOW(app->ui.messenger.main_window) 64 GTK_WINDOW(app->ui.messenger.main_window)
59 ); 65 );
60 66
61 gtk_about_dialog_set_program_name( 67 gtk_about_dialog_set_program_name(
62 handle->dialog, 68 handle->dialog,
63 MESSENGER_APPLICATION_APPNAME 69 MESSENGER_APPLICATION_APPNAME
64 ); 70 );
65 71
66 gtk_about_dialog_set_version( 72 gtk_about_dialog_set_version(
67 handle->dialog, 73 handle->dialog,
68 MESSENGER_APPLICATION_VERSION 74 MESSENGER_APPLICATION_VERSION
69 ); 75 );
70 76
71 gtk_about_dialog_set_logo_icon_name( 77 gtk_about_dialog_set_logo_icon_name(
72 handle->dialog, 78 handle->dialog,
73 MESSENGER_APPLICATION_ID 79 MESSENGER_APPLICATION_ID
74 ); 80 );
75 81
76 handle->close_button = GTK_BUTTON( 82 handle->close_button = GTK_BUTTON(
77 gtk_builder_get_object(handle->builder, "close_button") 83 gtk_builder_get_object(handle->builder, "close_button")
78 ); 84 );
79 85
80 g_signal_connect( 86 g_signal_connect(
81 handle->close_button, 87 handle->close_button,
82 "clicked", 88 "clicked",
83 G_CALLBACK(handle_close_button_click), 89 G_CALLBACK(handle_close_button_click),
84 handle->dialog 90 handle->dialog
85 ); 91 );
86 92
87 g_signal_connect( 93 g_signal_connect(
88 handle->dialog, 94 handle->dialog,
89 "destroy", 95 "destroy",
90 G_CALLBACK(handle_dialog_destroy), 96 G_CALLBACK(handle_dialog_destroy),
91 handle 97 handle
92 ); 98 );
93} 99}
94 100
95void 101void
96ui_about_dialog_cleanup(UI_ABOUT_Handle *handle) 102ui_about_dialog_cleanup(UI_ABOUT_Handle *handle)
97{ 103{
104 g_assert(handle);
105
98 g_object_unref(handle->builder); 106 g_object_unref(handle->builder);
99 107
100 memset(handle, 0, sizeof(*handle)); 108 memset(handle, 0, sizeof(*handle));