Debian Codegraph @

src/gtkhelper.c

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2022-2025 Geoffrey D. Bennett <[email protected]>
2 // SPDX-License-Identifier: GPL-3.0-or-later
3
4 #include "gtkhelper.h"
5
6 void gtk_widget_set_margin(GtkWidget *w, int margin) {
7 gtk_widget_set_margin_top(w, margin);
8 gtk_widget_set_margin_bottom(w, margin);
9 gtk_widget_set_margin_start(w, margin);
10 gtk_widget_set_margin_end(w, margin);
11 }
12
13 void gtk_widget_set_expand(GtkWidget *w, gboolean expand) {
14 gtk_widget_set_hexpand(w, expand);
15 gtk_widget_set_vexpand(w, expand);
16 }
17
18 void gtk_widget_set_align(GtkWidget *w, GtkAlign x, GtkAlign y) {
19 gtk_widget_set_halign(w, x);
20 gtk_widget_set_valign(w, y);
21 }
22
23 void gtk_grid_set_spacing(GtkGrid *grid, int spacing) {
24 gtk_grid_set_row_spacing(grid, spacing);
25 gtk_grid_set_column_spacing(grid, spacing);
26 }
27
28 void gtk_widget_remove_css_classes_by_prefix(
29 GtkWidget *w,
30 const char *prefix
31 ) {
32 char **classes = gtk_widget_get_css_classes(w);
33
34 for (char **i = classes; *i != NULL; i++)
35 if (strncmp(*i, prefix, strlen(prefix)) == 0)
36 gtk_widget_remove_css_class(w, *i);
37
38 g_strfreev(classes);
39 }