summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorzhuyaliang <[email protected]>2023-10-23 16:47:38 +0800
committerraveit65 <[email protected]>2023-10-25 12:19:43 +0200
commitb1331ef7978fdaa11049d9958e4ed279103af570 (patch)
tree68baf5f0170d14bf3cf13a4665ccc351a4f59635 /capplets
parent1a837ccdb078c0021588809814bfa80641acc3a8 (diff)
downloadmate-control-center-b1331ef7978fdaa11049d9958e4ed279103af570.tar.bz2
mate-control-center-b1331ef7978fdaa11049d9958e4ed279103af570.tar.xz
common: Fix compilation warnings replace deprecated functions gtk_rc_get_theme_dir and gtk_rc_scanner_new
Diffstat (limited to 'capplets')
-rw-r--r--capplets/common/Makefile.am1
-rw-r--r--capplets/common/gtkrc-utils.c47
-rw-r--r--capplets/common/mate-theme-test.c18
3 files changed, 64 insertions, 2 deletions
diff --git a/capplets/common/Makefile.am b/capplets/common/Makefile.am
index 5362f2e2..d7815b88 100644
--- a/capplets/common/Makefile.am
+++ b/capplets/common/Makefile.am
@@ -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)\" \
diff --git a/capplets/common/gtkrc-utils.c b/capplets/common/gtkrc-utils.c
index 4b5ac0e1..2fac2e93 100644
--- a/capplets/common/gtkrc-utils.c
+++ b/capplets/common/gtkrc-utils.c
@@ -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)
{
@@ -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);
diff --git a/capplets/common/mate-theme-test.c b/capplets/common/mate-theme-test.c
index 8e5ed73c..aef052d1 100644
--- a/capplets/common/mate-theme-test.c
+++ b/capplets/common/mate-theme-test.c
@@ -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[])
{
@@ -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);