diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2023-03-02 13:31:08 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2023-03-02 15:44:59 +0100 |
commit | 6c13e8767e77f38baf1265c63bf1cf0a33ba1612 (patch) | |
tree | b61079f720a866ede7a5e369ca87cebb54d9c3a8 /src | |
parent | 76f7d6da7fd155b5a54482bc459d5d2001aa1ec7 (diff) | |
download | tracker-6c13e8767e77f38baf1265c63bf1cf0a33ba1612.tar.gz |
libtracker-common: Drop locale utils
This somewhat pointless boilerplate, get rid of it.
Diffstat (limited to 'src')
-rw-r--r-- | src/libtracker-common/meson.build | 1 | ||||
-rw-r--r-- | src/libtracker-common/tracker-common.h | 1 | ||||
-rw-r--r-- | src/libtracker-common/tracker-locale.c | 77 | ||||
-rw-r--r-- | src/libtracker-common/tracker-locale.h | 48 | ||||
-rw-r--r-- | src/libtracker-sparql/core/tracker-data-manager.c | 1 | ||||
-rw-r--r-- | src/libtracker-sparql/core/tracker-db-interface-sqlite.c | 1 |
6 files changed, 0 insertions, 129 deletions
diff --git a/src/libtracker-common/meson.build b/src/libtracker-common/meson.build index 17bdd533a..639588fa5 100644 --- a/src/libtracker-common/meson.build +++ b/src/libtracker-common/meson.build @@ -6,7 +6,6 @@ tracker_common_sources = [ 'tracker-file-utils.c', 'tracker-term-utils.c', 'tracker-utils.c', - 'tracker-locale.c', 'tracker-parser-utils.c', 'tracker-language.c', ] diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h index e572b6ebc..0a5c361b7 100644 --- a/src/libtracker-common/tracker-common.h +++ b/src/libtracker-common/tracker-common.h @@ -35,7 +35,6 @@ #include "tracker-parser.h" #include "tracker-term-utils.h" #include "tracker-utils.h" -#include "tracker-locale.h" #undef __LIBTRACKER_COMMON_INSIDE__ diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c deleted file mode 100644 index 390428d6a..000000000 --- a/src/libtracker-common/tracker-locale.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010 Nokia <ivan.frade@nokia.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#include <locale.h> -#include <string.h> - -#include <glib.h> - -#include "tracker-locale.h" - -static GRecMutex locales_mutex; - -static const gchar * -tracker_locale_get_unlocked (TrackerLocaleID id) -{ - const gchar *env_locale = NULL; - - switch (id) { - case TRACKER_LOCALE_LANGUAGE: - env_locale = g_getenv ("LANG"); - break; - case TRACKER_LOCALE_TIME: - env_locale = setlocale (LC_TIME, NULL); - break; - case TRACKER_LOCALE_COLLATE: - env_locale = setlocale (LC_COLLATE, NULL); - break; - case TRACKER_LOCALE_NUMERIC: - env_locale = setlocale (LC_NUMERIC, NULL); - break; - case TRACKER_LOCALE_MONETARY: - env_locale = setlocale (LC_MONETARY, NULL); - break; - default: - g_assert_not_reached (); - break; - } - - return env_locale; -} - -gchar * -tracker_locale_get (TrackerLocaleID id) -{ - const gchar *env_locale = NULL; - gchar *locale; - - g_rec_mutex_lock (&locales_mutex); - - env_locale = tracker_locale_get_unlocked (id); - - /* Always return a duplicated string, as the locale may change at any - * moment */ - locale = g_strdup (env_locale); - - g_rec_mutex_unlock (&locales_mutex); - - return locale; -} diff --git a/src/libtracker-common/tracker-locale.h b/src/libtracker-common/tracker-locale.h deleted file mode 100644 index 0a8812d74..000000000 --- a/src/libtracker-common/tracker-locale.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2010 Nokia <ivan.frade@nokia.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __LIBTRACKER_COMMON_LOCALE_H__ -#define __LIBTRACKER_COMMON_LOCALE_H__ - -#include <glib.h> - -G_BEGIN_DECLS - -#if !defined (__LIBTRACKER_COMMON_INSIDE__) && !defined (TRACKER_COMPILATION) -#error "only <libtracker-common/tracker-common.h> must be included directly." -#endif - -/* Type of locales supported in tracker */ -typedef enum { - TRACKER_LOCALE_LANGUAGE, - TRACKER_LOCALE_TIME, - TRACKER_LOCALE_COLLATE, - TRACKER_LOCALE_NUMERIC, - TRACKER_LOCALE_MONETARY, - TRACKER_LOCALE_LAST -} TrackerLocaleID; - -/* Get the current locale of the given type. - * Note that it returns a newly-allocated string which should be g_free()-ed - */ -gchar *tracker_locale_get (TrackerLocaleID id); - -G_END_DECLS - -#endif /* __LIBTRACKER_COMMON_LOCALE_H__ */ diff --git a/src/libtracker-sparql/core/tracker-data-manager.c b/src/libtracker-sparql/core/tracker-data-manager.c index 1481a1a02..80e53623e 100644 --- a/src/libtracker-sparql/core/tracker-data-manager.c +++ b/src/libtracker-sparql/core/tracker-data-manager.c @@ -25,7 +25,6 @@ #include <glib/gstdio.h> #include <libtracker-common/tracker-debug.h> -#include <libtracker-common/tracker-locale.h> #include <libtracker-sparql/tracker-deserializer-rdf.h> diff --git a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c index 9e372e408..24c863616 100644 --- a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c +++ b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c @@ -28,7 +28,6 @@ #include <libtracker-common/tracker-date-time.h> #include <libtracker-common/tracker-debug.h> -#include <libtracker-common/tracker-locale.h> #include <libtracker-common/tracker-parser.h> #include <libtracker-sparql/tracker-cursor.h> |