Debian Codegraph @

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

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