Debian Codegraph @

demo/pages/about/adw-demo-page-about.c

raw
1 #include "adw-demo-page-about.h"
2
3 #include <glib/gi18n.h>
4
5 struct _AdwDemoPageAbout
6 {
7 AdwBin parent_instance;
8 };
9
10 G_DEFINE_FINAL_TYPE (AdwDemoPageAbout, adw_demo_page_about, ADW_TYPE_BIN)
11
12 static void
13 demo_run_cb (AdwDemoPageAbout *self)
14 {
15 AdwDialog *about;
16
17 const char *developers[] = {
18 "Angela Avery <[email protected]>",
19 NULL
20 };
21
22 const char *artists[] = {
23 "GNOME Design Team",
24 NULL
25 };
26
27 const char *special_thanks[] = {
28 "My cat",
29 NULL
30 };
31
32 const char *release_notes = "\
33 <p>\
34 This release adds the following features:\
35 </p>\
36 <ul>\
37 <li>Added a way to export fonts.</li>\
38 <li>Better support for <code>monospace</code> fonts.</li>\
39 <li>Added a way to preview <em>italic</em> text.</li>\
40 <li>Bug fixes and performance improvements.</li>\
41 <li>Translation updates.</li>\
42 </ul>\
43 ";
44
45 about =
46 g_object_new (ADW_TYPE_ABOUT_DIALOG,
47 "application-icon", "org.example.Typeset",
48 "application-name", _("Typeset"),
49 "developer-name", _("Angela Avery"),
50 "version", "1.2.3",
51 "release-notes-version", "1.2.0",
52 "release-notes", release_notes,
53 "comments", _("Typeset is an app that doesn’t exist and is used as an example content for this about dialog."),
54 "website", "https://example.org",
55 "issue-url", "https://example.org",
56 "support-url", "https://example.org",
57 "copyright", "© 2022 Angela Avery",
58 "license-type", GTK_LICENSE_LGPL_2_1,
59 "developers", developers,
60 "artists", artists,
61 "translator-credits", _("translator-credits"),
62 NULL);
63
64 adw_about_dialog_add_link (ADW_ABOUT_DIALOG (about),
65 _("_Documentation"),
66 "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.AboutDialog.html");
67
68 adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
69 _("Fonts"),
70 NULL,
71 GTK_LICENSE_CUSTOM,
72 "This application uses font data from <a href='https://example.org'>somewhere</a>.");
73
74 adw_about_dialog_add_acknowledgement_section (ADW_ABOUT_DIALOG (about),
75 _("Special thanks to"),
76 special_thanks);
77
78 adw_about_dialog_add_other_app (ADW_ABOUT_DIALOG (about),
79 "org.gnome.Adwaita1.Demo",
80 _("Adwaita Demo"),
81 _("Tour of the features in Libadwaita"));
82
83 adw_dialog_present (about, GTK_WIDGET (self));
84 }
85
86 static void
87 adw_demo_page_about_class_init (AdwDemoPageAboutClass *klass)
88 {
89 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
90
91 gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Adwaita1/Demo/ui/pages/about/adw-demo-page-about.ui");
92
93 gtk_widget_class_install_action (widget_class, "demo.run", NULL, (GtkWidgetActionActivateFunc) demo_run_cb);
94 }
95
96 static void
97 adw_demo_page_about_init (AdwDemoPageAbout *self)
98 {
99 gtk_widget_init_template (GTK_WIDGET (self));
100 }