Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: Fix compilation warnings replace deprecated functions gtk_rc_get_theme_dir and gtk_rc_scanner_new #734

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions capplets/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ EXTRA_DIST =
AM_CPPFLAGS = \
-DMATECC_DATA_DIR="\"$(pkgdatadir)\"" \
-DMATELOCALEDIR="\"$(datadir)/locale\"" \
-DMATEDATADIR="\"$(datadir)\"" \
-DGTK_ENGINE_DIR="\"$(GTK_ENGINE_DIR)\"" \
-DG_LOG_DOMAIN=\"capplet-common\" \
-DINSTALL_PREFIX=\"$(prefix)\" \
Expand Down
47 changes: 46 additions & 1 deletion capplets/common/gtkrc-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,51 @@ void gtkrc_get_details(gchar* filename, GSList** engines, GSList** symbolic_colo
g_scanner_destroy (scanner);
}

static const GScannerConfig gtk_rc_scanner_config =
{
(
" \t\r\n"
) /* cset_skip_characters */,
(
"_"
G_CSET_a_2_z
G_CSET_A_2_Z
) /* cset_identifier_first */,
(
G_CSET_DIGITS
"-_"
G_CSET_a_2_z
G_CSET_A_2_Z
) /* cset_identifier_nth */,
( "#\n" ) /* cpair_comment_single */,

TRUE /* case_sensitive */,

TRUE /* skip_comment_multi */,
TRUE /* skip_comment_single */,
TRUE /* scan_comment_multi */,
TRUE /* scan_identifier */,
FALSE /* scan_identifier_1char */,
FALSE /* scan_identifier_NULL */,
TRUE /* scan_symbols */,
TRUE /* scan_binary */,
TRUE /* scan_octal */,
TRUE /* scan_float */,
TRUE /* scan_hex */,
TRUE /* scan_hex_dollar */,
TRUE /* scan_string_sq */,
TRUE /* scan_string_dq */,
TRUE /* numbers_2_int */,
FALSE /* int_2_float */,
FALSE /* identifier_2_string */,
TRUE /* char_2_token */,
TRUE /* symbol_2_token */,
FALSE /* scope_0_fallback */,
FALSE /* store_int64 */,

0 /* < private > padding_dummy*/,
};

gchar *
gtkrc_get_color_scheme (const gchar *gtkrc_file)
{
Expand All @@ -184,7 +229,7 @@ gtkrc_get_color_scheme (const gchar *gtkrc_file)
GSList *files = NULL;
GSList *read_files = NULL;
GTokenType token;
GScanner *scanner = gtk_rc_scanner_new ();
GScanner *scanner = g_scanner_new (&gtk_rc_scanner_config);

g_scanner_scope_add_symbol (scanner, 0, "include", INCLUDE_SYMBOL);
g_scanner_scope_add_symbol (scanner, 0, "gtk_color_scheme", COLOR_SCHEME_SYMBOL);
Expand Down
18 changes: 17 additions & 1 deletion capplets/common/mate-theme-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
#include <string.h>
#include "mate-theme-info.h"

static gchar *
mate_rc_get_theme_dir (void)
{
const gchar *var;
gchar *path;

var = g_getenv ("GTK_DATA_PREFIX");

if (var)
path = g_build_filename (var, "share", "themes", NULL);
else
path = g_build_filename (MATEDATADIR, "share", "themes", NULL);

return path;
}

int
main (int argc, char *argv[])
{
Expand Down Expand Up @@ -71,7 +87,7 @@ main (int argc, char *argv[])
gchar *str;

g_print ("No gtk-2 themes were found. The following directories were tested:\n");
str = gtk_rc_get_theme_dir ();
str = mate_rc_get_theme_dir ();
g_print ("\t%s\n", str);
g_free (str);
str = g_build_filename (g_get_home_dir (), ".themes", NULL);
Expand Down