Debian Codegraph @

debian/patches/0001-Remove-welcome-screen.patch

raw symbols SCIP
1 From: Dale Richards <[email protected]>
2 Date: Wed, 10 Jun 2026 21:56:29 +0100
3 Subject: Remove beta welcome screen
4
5 ---
6 src/main.c | 3 -
7 src/welcome.c | 214 ----------------------------------------------------------
8 src/welcome.h | 8 ---
9 3 files changed, 225 deletions(-)
10 delete mode 100644 src/welcome.c
11 delete mode 100644 src/welcome.h
12
13 diff --git a/src/main.c b/src/main.c
14 index 1fabd1b..0e38db1 100644
15 --- a/src/main.c
16 +++ b/src/main.c
17 @@ -3,7 +3,6 @@
18
19 #include "alsa.h"
20 #include "alsa-sim.h"
21 -#include "welcome.h"
22 #include "debug.h"
23 #include "main.h"
24 #include "menu.h"
25 @@ -46,8 +45,6 @@ static void startup(GtkApplication *app, gpointer user_data) {
26
27 create_no_card_window();
28 create_hardware_window(app);
29 -
30 - show_welcome(app);
31 }
32
33 // not called when any files are opened from the command-line so we do
34 diff --git a/src/welcome.c b/src/welcome.c
35 deleted file mode 100644
36 index 7d2f550..0000000
37 --- a/src/welcome.c
38 +++ /dev/null
39 @@ -1,214 +0,0 @@
40 -// SPDX-FileCopyrightText: 2026 Geoffrey D. Bennett <[email protected]>
41 -// SPDX-License-Identifier: GPL-3.0-or-later
42 -
43 -#include <glib.h>
44 -#include <glib/gstdio.h>
45 -
46 -#include "welcome.h"
47 -#include "gtkhelper.h"
48 -
49 -#define BETA_VERSION "1.0beta"
50 -#define WELCOME_FILE "welcome.conf"
51 -
52 -static char *get_config_dir(void) {
53 - const char *config_home = g_get_user_config_dir();
54 - return g_build_filename(config_home, "alsa-scarlett-gui", NULL);
55 -}
56 -
57 -static char *get_welcome_path(void) {
58 - char *config_dir = get_config_dir();
59 - char *path = g_build_filename(config_dir, WELCOME_FILE, NULL);
60 - g_free(config_dir);
61 - return path;
62 -}
63 -
64 -static char *get_today(void) {
65 - GDateTime *now = g_date_time_new_now_local();
66 - char *today = g_date_time_format(now, "%Y-%m-%d");
67 - g_date_time_unref(now);
68 - return today;
69 -}
70 -
71 -static gboolean should_suppress(void) {
72 - char *path = get_welcome_path();
73 - GKeyFile *key_file = g_key_file_new();
74 - gboolean suppress = FALSE;
75 -
76 - if (g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, NULL)) {
77 - if (g_key_file_get_boolean(
78 - key_file, BETA_VERSION, "dismissed", NULL
79 - )) {
80 - suppress = TRUE;
81 - } else {
82 - char *snooze_date = g_key_file_get_string(
83 - key_file, BETA_VERSION, "snooze_date", NULL
84 - );
85 - if (snooze_date) {
86 - char *today = get_today();
87 - suppress = strcmp(snooze_date, today) == 0;
88 - g_free(today);
89 - g_free(snooze_date);
90 - }
91 - }
92 - }
93 -
94 - g_key_file_free(key_file);
95 - g_free(path);
96 - return suppress;
97 -}
98 -
99 -static GKeyFile *load_welcome_keyfile(char **out_path) {
100 - char *config_dir = get_config_dir();
101 -
102 - if (g_mkdir_with_parents(config_dir, 0755) < 0) {
103 - g_warning("Failed to create config directory: %s", config_dir);
104 - g_free(config_dir);
105 - return NULL;
106 - }
107 - g_free(config_dir);
108 -
109 - *out_path = get_welcome_path();
110 - GKeyFile *key_file = g_key_file_new();
111 - g_key_file_load_from_file(key_file, *out_path, G_KEY_FILE_NONE, NULL);
112 - return key_file;
113 -}
114 -
115 -static void set_snooze_date(void) {
116 - char *path;
117 - GKeyFile *key_file = load_welcome_keyfile(&path);
118 - if (!key_file)
119 - return;
120 -
121 - char *today = get_today();
122 - g_key_file_set_string(key_file, BETA_VERSION, "snooze_date", today);
123 - g_free(today);
124 - g_key_file_save_to_file(key_file, path, NULL);
125 -
126 - g_key_file_free(key_file);
127 - g_free(path);
128 -}
129 -
130 -static void set_dismissed(void) {
131 - char *path;
132 - GKeyFile *key_file = load_welcome_keyfile(&path);
133 - if (!key_file)
134 - return;
135 -
136 - g_key_file_set_boolean(key_file, BETA_VERSION, "dismissed", TRUE);
137 - g_key_file_save_to_file(key_file, path, NULL);
138 -
139 - g_key_file_free(key_file);
140 - g_free(path);
141 -}
142 -
143 -static gboolean on_key_pressed(
144 - GtkEventControllerKey *controller,
145 - guint keyval,
146 - guint keycode,
147 - GdkModifierType state,
148 - GtkWindow *window
149 -) {
150 - if (keyval == GDK_KEY_Escape) {
151 - gtk_window_close(window);
152 - return TRUE;
153 - }
154 - return FALSE;
155 -}
156 -
157 -static void on_acknowledge(GtkWidget *button, GtkWindow *window) {
158 - set_dismissed();
159 - gtk_window_destroy(window);
160 -}
161 -
162 -static void on_remind_later(GtkWidget *button, GtkWindow *window) {
163 - set_snooze_date();
164 - gtk_window_destroy(window);
165 -}
166 -
167 -void show_welcome(GtkApplication *app) {
168 - if (should_suppress())
169 - return;
170 -
171 - GtkWidget *window = gtk_window_new();
172 - char *title = g_strdup_printf("Welcome to ALSA Scarlett GUI %s", VERSION);
173 - gtk_window_set_title(GTK_WINDOW(window), title);
174 - g_free(title);
175 - gtk_window_set_application(GTK_WINDOW(window), app);
176 - gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
177 - gtk_widget_add_css_class(window, "window-frame");
178 - gtk_widget_add_css_class(window, "modal");
179 -
180 - GtkWidget *content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 20);
181 - gtk_window_set_child(GTK_WINDOW(window), content);
182 - gtk_widget_add_css_class(content, "window-content");
183 - gtk_widget_add_css_class(content, "top-level-content");
184 - gtk_widget_set_margin(content, 30);
185 -
186 - GtkWidget *heading = gtk_label_new(NULL);
187 - char *heading_markup = g_strdup_printf(
188 - "<span size='large' weight='bold'>"
189 - "Welcome to ALSA Scarlett GUI %s!"
190 - "</span>",
191 - VERSION
192 - );
193 - gtk_label_set_markup(GTK_LABEL(heading), heading_markup);
194 - g_free(heading_markup);
195 - gtk_box_append(GTK_BOX(content), heading);
196 -
197 - GtkWidget *message = gtk_label_new(
198 - "Thank you for testing this beta release.\n\n"
199 - "Please check the release notes for what's new, join the\n"
200 - "discussion, and if you encounter any issues, search for\n"
201 - "existing reports or raise a new issue on GitHub."
202 - );
203 - gtk_label_set_justify(GTK_LABEL(message), GTK_JUSTIFY_CENTER);
204 - gtk_box_append(GTK_BOX(content), message);
205 -
206 - GtkWidget *links_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);
207 - gtk_widget_set_halign(links_box, GTK_ALIGN_CENTER);
208 - gtk_box_append(GTK_BOX(content), links_box);
209 -
210 - GtkWidget *release_notes = gtk_link_button_new_with_label(
211 - "https://github.com/geoffreybennett/alsa-scarlett-gui/blob/"
212 - BETA_VERSION "/RELEASE-NOTES.md",
213 - "Release Notes"
214 - );
215 - gtk_box_append(GTK_BOX(links_box), release_notes);
216 -
217 - GtkWidget *discussion = gtk_link_button_new_with_label(
218 - "https://github.com/geoffreybennett/alsa-scarlett-gui/discussions/221",
219 - "Join the Discussion"
220 - );
221 - gtk_box_append(GTK_BOX(links_box), discussion);
222 -
223 - GtkWidget *issues = gtk_link_button_new_with_label(
224 - "https://github.com/geoffreybennett/alsa-scarlett-gui/issues",
225 - "Report or Search for Issues"
226 - );
227 - gtk_box_append(GTK_BOX(links_box), issues);
228 -
229 - GtkWidget *button_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20);
230 - gtk_widget_set_halign(button_box, GTK_ALIGN_CENTER);
231 - gtk_box_append(GTK_BOX(content), button_box);
232 -
233 - GtkWidget *remind_button = gtk_button_new_with_label("Remind Me Later");
234 - g_signal_connect(
235 - remind_button, "clicked", G_CALLBACK(on_remind_later), window
236 - );
237 - gtk_box_append(GTK_BOX(button_box), remind_button);
238 -
239 - GtkWidget *ack_button = gtk_button_new_with_label("Got it, thanks");
240 - g_signal_connect(
241 - ack_button, "clicked", G_CALLBACK(on_acknowledge), window
242 - );
243 - gtk_box_append(GTK_BOX(button_box), ack_button);
244 -
245 - GtkEventController *key_controller = gtk_event_controller_key_new();
246 - g_signal_connect(
247 - key_controller, "key-pressed",
248 - G_CALLBACK(on_key_pressed), window
249 - );
250 - gtk_widget_add_controller(window, key_controller);
251 -
252 - gtk_window_present(GTK_WINDOW(window));
253 -}
254 diff --git a/src/welcome.h b/src/welcome.h
255 deleted file mode 100644
256 index 80b0c81..0000000
257 --- a/src/welcome.h
258 +++ /dev/null
259 @@ -1,8 +0,0 @@
260 -// SPDX-FileCopyrightText: 2026 Geoffrey D. Bennett <[email protected]>
261 -// SPDX-License-Identifier: GPL-3.0-or-later
262 -
263 -#pragma once
264 -
265 -#include <gtk/gtk.h>
266 -
267 -void show_welcome(GtkApplication *app);