Compare commits
No commits in common. 'c9' and 'cs10' have entirely different histories.
@ -1 +1 @@
|
||||
SOURCES/gnome-desktop-40.4.tar.xz
|
||||
SOURCES/gnome-desktop-44.0.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
57a003aa0e4f68fbfb18a56f2b807e145e1f643c SOURCES/gnome-desktop-40.4.tar.xz
|
||||
2b845227730824c503251c418f2b275283721211 SOURCES/gnome-desktop-44.0.tar.xz
|
||||
|
@ -0,0 +1,141 @@
|
||||
From a7322f90defc31abeee242ad984d5b3debb86f68 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Fri, 25 Aug 2023 09:47:47 -0400
|
||||
Subject: [PATCH 1/4] meson: Add python3 to build scripts
|
||||
|
||||
We're going to need to use python3 in a future commit to
|
||||
query langtable for a list of non-latin input sources.
|
||||
|
||||
As prep work for that, add the basic goo needed to get
|
||||
python3 available from the build system.
|
||||
---
|
||||
.gitlab-ci.yml | 2 +-
|
||||
meson.build | 3 +++
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
|
||||
index 6d6c7bbc..56962b1c 100644
|
||||
--- a/.gitlab-ci.yml
|
||||
+++ b/.gitlab-ci.yml
|
||||
@@ -1,49 +1,49 @@
|
||||
# You can override the included template(s) by including variable overrides
|
||||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
||||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
|
||||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
|
||||
# Note that environment variables can be set in several places
|
||||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
|
||||
include:
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
||||
|
||||
image: fedora:latest
|
||||
|
||||
variables:
|
||||
LAST_ABI_BREAK: 0da1fcac914ad4c67f016bda7864c4b153cbfbaa
|
||||
DEPENDENCIES: gtk3-devel gtk4-devel gsettings-desktop-schemas-devel gettext
|
||||
gtk-doc libxkbcommon-devel xkeyboard-config-devel itstool
|
||||
gobject-introspection-devel systemd-devel iso-codes-devel
|
||||
libseccomp-devel gcc gcc-c++ glibc-devel
|
||||
- meson redhat-rpm-config
|
||||
+ meson redhat-rpm-config python3-langtable
|
||||
TEST_DEPENDENCIES: gnome-desktop-testing xorg-x11-server-Xvfb glibc-langpack-en glibc-langpack-he glibc-langpack-ja abattis-cantarell-fonts libabigail git
|
||||
|
||||
build_stable:
|
||||
before_script:
|
||||
# Undo delangification present in the Fedora Docker images
|
||||
- rm -f /etc/rpm/macros.image-language-conf
|
||||
- echo "reinstall glib2" >> translist.txt
|
||||
# Work-around https://bugzilla.redhat.com/show_bug.cgi?id=1607172#c4
|
||||
- echo "update dnf gdbm" >> translist.txt
|
||||
- echo "remove python3-modulemd" >> translist.txt
|
||||
- dnf shell -y --nogpgcheck translist.txt
|
||||
- dnf update -y --nogpgcheck
|
||||
- dnf install -y --nogpgcheck $DEPENDENCIES
|
||||
- dnf install -y --nogpgcheck $TEST_DEPENDENCIES
|
||||
script:
|
||||
- meson --prefix=/usr -Dinstalled_tests=true build
|
||||
- pushd build
|
||||
- ninja
|
||||
- ninja install
|
||||
- ninja dist
|
||||
- G_MESSAGES_DEBUG=all xvfb-run -a -s "-screen 0 1024x768x24" ninja test
|
||||
- G_MESSAGES_DEBUG=all xvfb-run -a -s "-screen 0 1024x768x24"
|
||||
gnome-desktop-testing-runner --report-directory=test-results gnome-desktop
|
||||
- popd
|
||||
- .ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD)
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs/
|
||||
- build/test-results/
|
||||
when: on_failure
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 51a59e33..0419aa3c 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -9,60 +9,63 @@ project('gnome-desktop', 'c',
|
||||
|
||||
# Before making a release, the libversion string should be modified.
|
||||
#
|
||||
# * Bump the first component if binary compatibility has been broken; or
|
||||
# * Bump the second component if new APIs are added; or
|
||||
# * Bump the third component otherwise.
|
||||
#
|
||||
# When bumping the first component version, set the second and third components
|
||||
# to 0. When bumping the second version, set the third one to zero.
|
||||
#
|
||||
# A lot easier than libtool, right?
|
||||
libversion = '2.1.0'
|
||||
soversion = libversion.split('.')[0]
|
||||
|
||||
# Compatibility versions for libgnome-desktop-3
|
||||
compat_libversion = '20.0.0'
|
||||
compat_soversion = compat_libversion.split('.')[0]
|
||||
|
||||
gdk_pixbuf_req = '>= 2.36.5'
|
||||
gtk3_req = '>= 3.3.6'
|
||||
gtk4_req = '>= 4.4.0'
|
||||
glib_req = '>= 2.53.0'
|
||||
xrandr_req = '>= 1.3'
|
||||
schemas_req = '>= 3.27.0'
|
||||
xext_req = '>= 1.1'
|
||||
|
||||
gnome = import('gnome')
|
||||
i18n = import('i18n')
|
||||
pkg = import('pkgconfig')
|
||||
|
||||
+python = import('python')
|
||||
+python3 = python.find_installation('python3', modules : ['langtable'])
|
||||
+
|
||||
prefix = get_option('prefix')
|
||||
|
||||
datadir = prefix / get_option('datadir')
|
||||
libexecdir = prefix / get_option('libexecdir')
|
||||
|
||||
liblocaledir = get_option('prefix') / 'lib/locale'
|
||||
localedir = datadir / 'locale'
|
||||
test_metadir = datadir / 'installed-tests' / meson.project_name()
|
||||
test_execdir = libexecdir / 'installed-tests' / meson.project_name()
|
||||
versiondir = datadir / 'gnome'
|
||||
|
||||
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
|
||||
gtk3_dep = dependency('gtk+-3.0', version: gtk3_req, required: get_option('legacy_library'))
|
||||
gtk4_dep = dependency('gtk4', version: gtk4_req, required: get_option('build_gtk4'))
|
||||
glib_dep = dependency('glib-2.0', version: glib_req)
|
||||
gio_dep = dependency('gio-2.0', version: glib_req)
|
||||
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
|
||||
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
|
||||
fontconfig_dep = dependency('fontconfig')
|
||||
xkb_config_dep = dependency('xkeyboard-config')
|
||||
xkbregistry_dep = dependency('xkbregistry', required: false)
|
||||
iso_codes_dep = dependency('iso-codes')
|
||||
libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
|
||||
udev_dep = dependency('libudev', required: get_option('udev'))
|
||||
|
||||
# Check for bubblewrap compatible platform
|
||||
host_os = host_machine.system()
|
||||
host_cpu = host_machine.cpu()
|
||||
supported_os = ['linux']
|
||||
unsupported_cpus = ['alpha', 'ia64', 'm68k', 'sh4', 'sparc', 'sparc64']
|
||||
--
|
||||
2.41.0
|
||||
|
@ -0,0 +1,428 @@
|
||||
From 242308344cceca729148507d787f130151b44ea0 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Thu, 24 Aug 2023 17:37:37 -0400
|
||||
Subject: [PATCH 2/4] gnome-languages: Add function to detect non-latin layouts
|
||||
|
||||
If user chooses "Russian" we need to add "us" as well so they have
|
||||
a way to input latin characters.
|
||||
|
||||
This commit adds a function to detect layouts that need supplemental
|
||||
layouts to tag along.
|
||||
---
|
||||
.../generate-non-latin-input-sources.py | 44 +++++++++++++++++++
|
||||
libgnome-desktop/gnome-languages.c | 30 +++++++++++++
|
||||
libgnome-desktop/gnome-languages.h | 2 +
|
||||
libgnome-desktop/meson.build | 7 +++
|
||||
4 files changed, 83 insertions(+)
|
||||
create mode 100644 libgnome-desktop/generate-non-latin-input-sources.py
|
||||
|
||||
diff --git a/libgnome-desktop/generate-non-latin-input-sources.py b/libgnome-desktop/generate-non-latin-input-sources.py
|
||||
new file mode 100644
|
||||
index 00000000..d2b84f08
|
||||
--- /dev/null
|
||||
+++ b/libgnome-desktop/generate-non-latin-input-sources.py
|
||||
@@ -0,0 +1,44 @@
|
||||
+import langtable
|
||||
+
|
||||
+import locale
|
||||
+import re
|
||||
+
|
||||
+if hasattr(langtable, 'list_all_keyboards'):
|
||||
+ keyboards = langtable.list_all_keyboards()
|
||||
+else:
|
||||
+ from langtable.langtable import _keyboards_db
|
||||
+ keyboards = _keyboards_db.keys()
|
||||
+
|
||||
+non_latin_keyboards = {}
|
||||
+
|
||||
+for keyboard in keyboards:
|
||||
+ # Check if the keyboard supports ASCII
|
||||
+ if not langtable.supports_ascii(keyboardId=keyboard):
|
||||
+ input_source = re.sub(r'\((.*?)\)', r'+\1', keyboard)
|
||||
+ non_latin_keyboards[input_source] = 'xkb'
|
||||
+
|
||||
+sorted_non_latin_keyboards = sorted(non_latin_keyboards.items(), key=lambda x: x[0])
|
||||
+
|
||||
+header_prolog = '''
|
||||
+typedef struct
|
||||
+{
|
||||
+ char *type;
|
||||
+ char *id;
|
||||
+} InputSource;
|
||||
+
|
||||
+static InputSource non_latin_input_sources[] =
|
||||
+{
|
||||
+'''
|
||||
+
|
||||
+header_epilog = '''
|
||||
+};
|
||||
+'''
|
||||
+
|
||||
+with open('non-latin-input-sources.h', 'w') as file:
|
||||
+ file.write(header_prolog)
|
||||
+
|
||||
+ for keyboard, type in sorted_non_latin_keyboards:
|
||||
+ file.write(f' {{ "{type}", "{keyboard}" }},\n')
|
||||
+ file.write(" { NULL, NULL },")
|
||||
+
|
||||
+ file.write(header_epilog)
|
||||
diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
|
||||
index 8a0485c8..3bd4823f 100644
|
||||
--- a/libgnome-desktop/gnome-languages.c
|
||||
+++ b/libgnome-desktop/gnome-languages.c
|
||||
@@ -26,60 +26,61 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <langinfo.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#ifdef HAVE_XLOCALE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#include "gnome-gettext-portable.h"
|
||||
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include "gnome-languages.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
#ifndef __LC_LAST
|
||||
#define __LC_LAST 13
|
||||
#endif
|
||||
|
||||
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
|
||||
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
|
||||
|
||||
#include "default-input-sources.h"
|
||||
+#include "non-latin-input-sources.h"
|
||||
|
||||
typedef struct _GnomeLocale {
|
||||
char *id;
|
||||
char *name;
|
||||
char *language_code;
|
||||
char *territory_code;
|
||||
char *codeset;
|
||||
char *modifier;
|
||||
} GnomeLocale;
|
||||
|
||||
static GHashTable *gnome_languages_map;
|
||||
static GHashTable *gnome_territories_map;
|
||||
static GHashTable *gnome_available_locales_map;
|
||||
static GHashTable *gnome_language_count_map;
|
||||
static GHashTable *gnome_territory_count_map;
|
||||
|
||||
static char * construct_language_name (const char *language,
|
||||
const char *territory,
|
||||
const char *codeset,
|
||||
const char *modifier);
|
||||
|
||||
static gboolean language_name_is_valid (const char *language_name);
|
||||
|
||||
static void
|
||||
gnome_locale_free (GnomeLocale *locale)
|
||||
{
|
||||
if (locale == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1417,30 +1418,59 @@ gnome_get_input_source_from_locale (const char *locale,
|
||||
DefaultInputSource *dis;
|
||||
g_autofree gchar *l_code = NULL;
|
||||
g_autofree gchar *c_code = NULL;
|
||||
g_autofree gchar *key = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (locale != NULL, FALSE);
|
||||
g_return_val_if_fail (type != NULL, FALSE);
|
||||
g_return_val_if_fail (id != NULL, FALSE);
|
||||
|
||||
if (!table) {
|
||||
table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
for (i = 0; default_input_sources[i].id; ++i) {
|
||||
dis = &default_input_sources[i];
|
||||
g_hash_table_insert (table, (gpointer) dis->locale, dis);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gnome_parse_locale (locale, &l_code, &c_code, NULL, NULL))
|
||||
return FALSE;
|
||||
|
||||
key = g_strconcat (l_code, "_", c_code, NULL);
|
||||
|
||||
dis = g_hash_table_lookup (table, key);
|
||||
if (dis) {
|
||||
*type = dis->type;
|
||||
*id = dis->id;
|
||||
}
|
||||
return dis != NULL;
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * gnome_input_source_is_non_latin:
|
||||
+ * @type: an input source type (e.g., "xkb" or "ibus")
|
||||
+ * @id: an input source id (e.g., "us+dvorak" or "anthy")
|
||||
+ *
|
||||
+ * Returns whether or not the input source has the ability to enter latin characters.
|
||||
+ *
|
||||
+ * Return value: %TRUE if it can't enter latin characters
|
||||
+ *
|
||||
+ * Since: 46
|
||||
+ */
|
||||
+gboolean
|
||||
+gnome_input_source_is_non_latin (const char *type,
|
||||
+ const char *id)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; non_latin_input_sources[i].type != NULL; i++) {
|
||||
+ if (g_strcmp0 (type, non_latin_input_sources[i].type) != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (g_strcmp0 (id, non_latin_input_sources[i].id) != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
diff --git a/libgnome-desktop/gnome-languages.h b/libgnome-desktop/gnome-languages.h
|
||||
index ed0935c8..ed9242e7 100644
|
||||
--- a/libgnome-desktop/gnome-languages.h
|
||||
+++ b/libgnome-desktop/gnome-languages.h
|
||||
@@ -27,33 +27,35 @@
|
||||
#error This is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnome-languages.h
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <libgnome-desktop/gnome-desktop-version.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
char * gnome_get_language_from_locale (const char *locale,
|
||||
const char *translation);
|
||||
char * gnome_get_country_from_locale (const char *locale,
|
||||
const char *translation);
|
||||
char ** gnome_get_all_locales (void);
|
||||
gboolean gnome_parse_locale (const char *locale,
|
||||
char **language_codep,
|
||||
char **country_codep,
|
||||
char **codesetp,
|
||||
char **modifierp);
|
||||
char * gnome_normalize_locale (const char *locale);
|
||||
gboolean gnome_language_has_translations (const char *code);
|
||||
char * gnome_get_language_from_code (const char *code,
|
||||
const char *translation);
|
||||
char * gnome_get_country_from_code (const char *code,
|
||||
const char *translation);
|
||||
char * gnome_get_translated_modifier (const char *modifier,
|
||||
const char *translation);
|
||||
gboolean gnome_get_input_source_from_locale (const char *locale,
|
||||
const char **type,
|
||||
const char **id);
|
||||
|
||||
+gboolean gnome_input_source_is_non_latin (const char *type,
|
||||
+ const char *id);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GNOME_LANGUAGES_H */
|
||||
diff --git a/libgnome-desktop/meson.build b/libgnome-desktop/meson.build
|
||||
index 708a4ae8..d41e0cc0 100644
|
||||
--- a/libgnome-desktop/meson.build
|
||||
+++ b/libgnome-desktop/meson.build
|
||||
@@ -28,118 +28,124 @@ conf.set('HAVE_USELOCALE', cc.has_function('uselocale'))
|
||||
conf.set('HAVE_XLOCALE', cc.has_header('xlocale.h'))
|
||||
|
||||
configure_file(
|
||||
output: 'config.h',
|
||||
configuration: conf,
|
||||
)
|
||||
|
||||
version_conf = configuration_data()
|
||||
version_array = meson.project_version().split('.')
|
||||
version_conf.set('GNOME_PLATFORM', version_array[0])
|
||||
|
||||
gnome_desktop_header_file = configure_file(
|
||||
input: 'gnome-desktop-version.h.in',
|
||||
output: 'gnome-desktop-version.h',
|
||||
configuration: version_conf,
|
||||
)
|
||||
|
||||
dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
|
||||
'xrandr.xml',
|
||||
namespace: 'MetaDBus',
|
||||
interface_prefix: 'org.gnome.Mutter'
|
||||
)
|
||||
|
||||
dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
|
||||
'idle-monitor.xml',
|
||||
namespace: 'MetaDBus',
|
||||
interface_prefix: 'org.gnome.Mutter',
|
||||
object_manager: true
|
||||
)
|
||||
|
||||
+non_latin_input_sources = custom_target('generate_non_latin_input_sources_header',
|
||||
+ output : 'non-latin-input-sources.h',
|
||||
+ command : [python3, files ('generate-non-latin-input-sources.py')]
|
||||
+)
|
||||
+
|
||||
base_ldflags = []
|
||||
base_symbol_map = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'base-symbol.map')
|
||||
if cc.has_link_argument(base_symbol_map)
|
||||
base_ldflags += base_symbol_map
|
||||
endif
|
||||
|
||||
### gnome-desktop-base
|
||||
libgnome_desktop_base_sources = [
|
||||
'gnome-desktop-version.c',
|
||||
'gnome-desktop-thumbnail.c',
|
||||
'gnome-idle-monitor.c',
|
||||
'gnome-languages.c',
|
||||
'gnome-pnp-ids.c',
|
||||
'gnome-systemd.c',
|
||||
'gnome-wall-clock.c',
|
||||
'gnome-xkb-info.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_base_private_sources = [
|
||||
'gnome-datetime-source.c',
|
||||
'gnome-desktop-thumbnail-script.c',
|
||||
'gnome-gettext-portable.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_base_headers = [
|
||||
gnome_desktop_header_file,
|
||||
'gnome-desktop-thumbnail.h',
|
||||
'gnome-idle-monitor.h',
|
||||
'gnome-languages.h',
|
||||
'gnome-pnp-ids.h',
|
||||
'gnome-systemd.h',
|
||||
'gnome-wall-clock.h',
|
||||
'gnome-xkb-info.h',
|
||||
]
|
||||
|
||||
if get_option('build_gtk4')
|
||||
install_headers(libgnome_desktop_base_headers,
|
||||
subdir: 'gnome-desktop-4.0/libgnome-desktop'
|
||||
)
|
||||
|
||||
base_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
glib_dep,
|
||||
gio_dep,
|
||||
gio_unix_dep,
|
||||
libsystemd_dep,
|
||||
schemas_dep,
|
||||
xkb_config_dep,
|
||||
xkbregistry_dep,
|
||||
iso_codes_dep,
|
||||
udev_dep,
|
||||
seccomp_dep,
|
||||
m_dep,
|
||||
rt_dep,
|
||||
]
|
||||
|
||||
libgnome_desktop_base = library('gnome-desktop-4',
|
||||
sources: [
|
||||
+ non_latin_input_sources,
|
||||
libgnome_desktop_base_sources,
|
||||
libgnome_desktop_base_private_sources,
|
||||
dbus_idle_built_sources,
|
||||
],
|
||||
dependencies: base_deps,
|
||||
soversion: soversion,
|
||||
version: libversion,
|
||||
c_args: libargs,
|
||||
link_args: base_ldflags,
|
||||
install: true,
|
||||
include_directories: [
|
||||
include_directories('.'),
|
||||
include_directories('..'),
|
||||
],
|
||||
)
|
||||
|
||||
if get_option('introspection')
|
||||
libgnome_desktop_base_gir = gnome.generate_gir(libgnome_desktop_base,
|
||||
sources: [libgnome_desktop_base_headers, libgnome_desktop_base_sources],
|
||||
export_packages: 'gnome-desktop-4',
|
||||
namespace: 'GnomeDesktop',
|
||||
nsversion: '4.0',
|
||||
includes: ['GObject-2.0', 'Gio-2.0', 'GDesktopEnums-3.0', 'GdkPixbuf-2.0'],
|
||||
extra_args: ['-DGNOME_DESKTOP_USE_UNSTABLE_API', '--quiet', '--warn-all'],
|
||||
identifier_prefix: 'Gnome',
|
||||
symbol_prefix: 'gnome',
|
||||
install: true,
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -162,60 +168,61 @@ if get_option('build_gtk4')
|
||||
include_directories: [
|
||||
include_directories('.'),
|
||||
include_directories('..'),
|
||||
],
|
||||
)
|
||||
|
||||
subdir('gnome-bg')
|
||||
subdir('gnome-rr')
|
||||
endif
|
||||
|
||||
### Legacy ###
|
||||
if get_option('legacy_library')
|
||||
introspection_sources = [
|
||||
'gnome-desktop-version.c',
|
||||
'gnome-desktop-thumbnail.c',
|
||||
'gnome-bg.c',
|
||||
'gnome-bg-slide-show.c',
|
||||
'gnome-bg-crossfade.c',
|
||||
'gnome-rr.c',
|
||||
'gnome-rr-config.c',
|
||||
'gnome-rr-output-info.c',
|
||||
'gnome-systemd.c',
|
||||
'gnome-pnp-ids.c',
|
||||
'gnome-wall-clock.c',
|
||||
'gnome-xkb-info.c',
|
||||
'gnome-idle-monitor.c',
|
||||
'gnome-languages.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_sources = [
|
||||
+ non_latin_input_sources,
|
||||
introspection_sources,
|
||||
dbus_xrandr_built_sources,
|
||||
dbus_idle_built_sources,
|
||||
'gnome-datetime-source.c',
|
||||
'gnome-desktop-thumbnail-script.c',
|
||||
'gnome-gettext-portable.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_headers = [
|
||||
gnome_desktop_header_file,
|
||||
'gnome-bg.h',
|
||||
'gnome-bg-crossfade.h',
|
||||
'gnome-bg-slide-show.h',
|
||||
'gnome-desktop-thumbnail.h',
|
||||
'gnome-rr.h',
|
||||
'gnome-rr-config.h',
|
||||
'gnome-systemd.h',
|
||||
'gnome-pnp-ids.h',
|
||||
'gnome-wall-clock.h',
|
||||
'gnome-xkb-info.h',
|
||||
'gnome-idle-monitor.h',
|
||||
'gnome-languages.h',
|
||||
]
|
||||
|
||||
install_headers(libgnome_desktop_headers,
|
||||
subdir: 'gnome-desktop-3.0/libgnome-desktop'
|
||||
)
|
||||
|
||||
gnome_desktop_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
--
|
||||
2.41.0
|
||||
|
@ -0,0 +1,257 @@
|
||||
From 185c1f7541ee44095ec5d9348298510e28e37f2c Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Thu, 24 Aug 2023 17:43:00 -0400
|
||||
Subject: [PATCH 3/4] meson: Add codegen for localed
|
||||
|
||||
We're going to need to be querying localed for input source information.
|
||||
|
||||
This commit paves the way for that by generating proxy glue code for
|
||||
talking to localed.
|
||||
---
|
||||
libgnome-desktop/meson.build | 8 +++++
|
||||
libgnome-desktop/org.freedesktop.locale1.xml | 38 ++++++++++++++++++++
|
||||
2 files changed, 46 insertions(+)
|
||||
create mode 100644 libgnome-desktop/org.freedesktop.locale1.xml
|
||||
|
||||
diff --git a/libgnome-desktop/meson.build b/libgnome-desktop/meson.build
|
||||
index d41e0cc0..164fd2ff 100644
|
||||
--- a/libgnome-desktop/meson.build
|
||||
+++ b/libgnome-desktop/meson.build
|
||||
@@ -28,60 +28,66 @@ conf.set('HAVE_USELOCALE', cc.has_function('uselocale'))
|
||||
conf.set('HAVE_XLOCALE', cc.has_header('xlocale.h'))
|
||||
|
||||
configure_file(
|
||||
output: 'config.h',
|
||||
configuration: conf,
|
||||
)
|
||||
|
||||
version_conf = configuration_data()
|
||||
version_array = meson.project_version().split('.')
|
||||
version_conf.set('GNOME_PLATFORM', version_array[0])
|
||||
|
||||
gnome_desktop_header_file = configure_file(
|
||||
input: 'gnome-desktop-version.h.in',
|
||||
output: 'gnome-desktop-version.h',
|
||||
configuration: version_conf,
|
||||
)
|
||||
|
||||
dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
|
||||
'xrandr.xml',
|
||||
namespace: 'MetaDBus',
|
||||
interface_prefix: 'org.gnome.Mutter'
|
||||
)
|
||||
|
||||
dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
|
||||
'idle-monitor.xml',
|
||||
namespace: 'MetaDBus',
|
||||
interface_prefix: 'org.gnome.Mutter',
|
||||
object_manager: true
|
||||
)
|
||||
|
||||
+dbus_localed_built_sources = gnome.gdbus_codegen('sd-locale1',
|
||||
+ 'org.freedesktop.locale1.xml',
|
||||
+ namespace: 'SdDBus',
|
||||
+ interface_prefix: 'org.freedesktop',
|
||||
+)
|
||||
+
|
||||
non_latin_input_sources = custom_target('generate_non_latin_input_sources_header',
|
||||
output : 'non-latin-input-sources.h',
|
||||
command : [python3, files ('generate-non-latin-input-sources.py')]
|
||||
)
|
||||
|
||||
base_ldflags = []
|
||||
base_symbol_map = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'base-symbol.map')
|
||||
if cc.has_link_argument(base_symbol_map)
|
||||
base_ldflags += base_symbol_map
|
||||
endif
|
||||
|
||||
### gnome-desktop-base
|
||||
libgnome_desktop_base_sources = [
|
||||
'gnome-desktop-version.c',
|
||||
'gnome-desktop-thumbnail.c',
|
||||
'gnome-idle-monitor.c',
|
||||
'gnome-languages.c',
|
||||
'gnome-pnp-ids.c',
|
||||
'gnome-systemd.c',
|
||||
'gnome-wall-clock.c',
|
||||
'gnome-xkb-info.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_base_private_sources = [
|
||||
'gnome-datetime-source.c',
|
||||
'gnome-desktop-thumbnail-script.c',
|
||||
'gnome-gettext-portable.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_base_headers = [
|
||||
@@ -95,60 +101,61 @@ libgnome_desktop_base_headers = [
|
||||
'gnome-xkb-info.h',
|
||||
]
|
||||
|
||||
if get_option('build_gtk4')
|
||||
install_headers(libgnome_desktop_base_headers,
|
||||
subdir: 'gnome-desktop-4.0/libgnome-desktop'
|
||||
)
|
||||
|
||||
base_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
glib_dep,
|
||||
gio_dep,
|
||||
gio_unix_dep,
|
||||
libsystemd_dep,
|
||||
schemas_dep,
|
||||
xkb_config_dep,
|
||||
xkbregistry_dep,
|
||||
iso_codes_dep,
|
||||
udev_dep,
|
||||
seccomp_dep,
|
||||
m_dep,
|
||||
rt_dep,
|
||||
]
|
||||
|
||||
libgnome_desktop_base = library('gnome-desktop-4',
|
||||
sources: [
|
||||
non_latin_input_sources,
|
||||
libgnome_desktop_base_sources,
|
||||
libgnome_desktop_base_private_sources,
|
||||
dbus_idle_built_sources,
|
||||
+ dbus_localed_built_sources,
|
||||
],
|
||||
dependencies: base_deps,
|
||||
soversion: soversion,
|
||||
version: libversion,
|
||||
c_args: libargs,
|
||||
link_args: base_ldflags,
|
||||
install: true,
|
||||
include_directories: [
|
||||
include_directories('.'),
|
||||
include_directories('..'),
|
||||
],
|
||||
)
|
||||
|
||||
if get_option('introspection')
|
||||
libgnome_desktop_base_gir = gnome.generate_gir(libgnome_desktop_base,
|
||||
sources: [libgnome_desktop_base_headers, libgnome_desktop_base_sources],
|
||||
export_packages: 'gnome-desktop-4',
|
||||
namespace: 'GnomeDesktop',
|
||||
nsversion: '4.0',
|
||||
includes: ['GObject-2.0', 'Gio-2.0', 'GDesktopEnums-3.0', 'GdkPixbuf-2.0'],
|
||||
extra_args: ['-DGNOME_DESKTOP_USE_UNSTABLE_API', '--quiet', '--warn-all'],
|
||||
identifier_prefix: 'Gnome',
|
||||
symbol_prefix: 'gnome',
|
||||
install: true,
|
||||
)
|
||||
endif
|
||||
|
||||
pkg.generate(
|
||||
libgnome_desktop_base,
|
||||
requires: ['gsettings-desktop-schemas'],
|
||||
@@ -172,60 +179,61 @@ if get_option('build_gtk4')
|
||||
)
|
||||
|
||||
subdir('gnome-bg')
|
||||
subdir('gnome-rr')
|
||||
endif
|
||||
|
||||
### Legacy ###
|
||||
if get_option('legacy_library')
|
||||
introspection_sources = [
|
||||
'gnome-desktop-version.c',
|
||||
'gnome-desktop-thumbnail.c',
|
||||
'gnome-bg.c',
|
||||
'gnome-bg-slide-show.c',
|
||||
'gnome-bg-crossfade.c',
|
||||
'gnome-rr.c',
|
||||
'gnome-rr-config.c',
|
||||
'gnome-rr-output-info.c',
|
||||
'gnome-systemd.c',
|
||||
'gnome-pnp-ids.c',
|
||||
'gnome-wall-clock.c',
|
||||
'gnome-xkb-info.c',
|
||||
'gnome-idle-monitor.c',
|
||||
'gnome-languages.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_sources = [
|
||||
non_latin_input_sources,
|
||||
introspection_sources,
|
||||
dbus_xrandr_built_sources,
|
||||
dbus_idle_built_sources,
|
||||
+ dbus_localed_built_sources,
|
||||
'gnome-datetime-source.c',
|
||||
'gnome-desktop-thumbnail-script.c',
|
||||
'gnome-gettext-portable.c',
|
||||
]
|
||||
|
||||
libgnome_desktop_headers = [
|
||||
gnome_desktop_header_file,
|
||||
'gnome-bg.h',
|
||||
'gnome-bg-crossfade.h',
|
||||
'gnome-bg-slide-show.h',
|
||||
'gnome-desktop-thumbnail.h',
|
||||
'gnome-rr.h',
|
||||
'gnome-rr-config.h',
|
||||
'gnome-systemd.h',
|
||||
'gnome-pnp-ids.h',
|
||||
'gnome-wall-clock.h',
|
||||
'gnome-xkb-info.h',
|
||||
'gnome-idle-monitor.h',
|
||||
'gnome-languages.h',
|
||||
]
|
||||
|
||||
install_headers(libgnome_desktop_headers,
|
||||
subdir: 'gnome-desktop-3.0/libgnome-desktop'
|
||||
)
|
||||
|
||||
gnome_desktop_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
gtk3_dep,
|
||||
glib_dep,
|
||||
gio_dep,
|
||||
diff --git a/libgnome-desktop/org.freedesktop.locale1.xml b/libgnome-desktop/org.freedesktop.locale1.xml
|
||||
new file mode 100644
|
||||
index 00000000..bc23d3a1
|
||||
--- /dev/null
|
||||
+++ b/libgnome-desktop/org.freedesktop.locale1.xml
|
||||
@@ -0,0 +1,38 @@
|
||||
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
+<node>
|
||||
+ <interface name="org.freedesktop.locale1">
|
||||
+ <property name="Locale" type="as" access="read">
|
||||
+ </property>
|
||||
+ <property name="X11Layout" type="s" access="read">
|
||||
+ </property>
|
||||
+ <property name="X11Model" type="s" access="read">
|
||||
+ </property>
|
||||
+ <property name="X11Variant" type="s" access="read">
|
||||
+ </property>
|
||||
+ <property name="X11Options" type="s" access="read">
|
||||
+ </property>
|
||||
+ <property name="VConsoleKeymap" type="s" access="read">
|
||||
+ </property>
|
||||
+ <property name="VConsoleKeymapToggle" type="s" access="read">
|
||||
+ </property>
|
||||
+ <method name="SetLocale">
|
||||
+ <arg type="as" direction="in"/>
|
||||
+ <arg type="b" direction="in"/>
|
||||
+ </method>
|
||||
+ <method name="SetVConsoleKeyboard">
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="b" direction="in"/>
|
||||
+ <arg type="b" direction="in"/>
|
||||
+ </method>
|
||||
+ <method name="SetX11Keyboard">
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="s" direction="in"/>
|
||||
+ <arg type="b" direction="in"/>
|
||||
+ <arg type="b" direction="in"/>
|
||||
+ </method>
|
||||
+ </interface>
|
||||
+</node>
|
||||
--
|
||||
2.41.0
|
||||
|
@ -0,0 +1,561 @@
|
||||
From f9dc0fefa8abfe37ea2029fefb6e49c2f3a0a696 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Thu, 24 Aug 2023 19:58:17 -0400
|
||||
Subject: [PATCH 4/4] languages: Add functions for getting default input
|
||||
sources
|
||||
|
||||
The code to get the default input sources would otherwise need
|
||||
to be duplicated across control-center, gnome-shell and
|
||||
gnome-initial-setup.
|
||||
|
||||
This commit avoids some of that redundancy by consolidating the
|
||||
logic into two new functions:
|
||||
|
||||
gnome_get_default_input_sources and
|
||||
gnome_get_default_input_sources_finish
|
||||
|
||||
Note, these functions don't provide change notification, so there
|
||||
is still some redundancy needed by callers.
|
||||
---
|
||||
libgnome-desktop/gnome-languages.c | 341 +++++++++++++++++++++++++++++
|
||||
libgnome-desktop/gnome-languages.h | 11 +
|
||||
2 files changed, 352 insertions(+)
|
||||
|
||||
diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
|
||||
index 3bd4823f..5d6c8b94 100644
|
||||
--- a/libgnome-desktop/gnome-languages.c
|
||||
+++ b/libgnome-desktop/gnome-languages.c
|
||||
@@ -16,81 +16,89 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Written by : William Jon McCann <mccann@jhu.edu>
|
||||
* Ray Strode <rstrode@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <langinfo.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#ifdef HAVE_XLOCALE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#include "gnome-gettext-portable.h"
|
||||
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include "gnome-languages.h"
|
||||
+#include "gnome-xkb-info.h"
|
||||
+
|
||||
+#include "sd-locale1.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
#ifndef __LC_LAST
|
||||
#define __LC_LAST 13
|
||||
#endif
|
||||
|
||||
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
|
||||
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
|
||||
|
||||
#include "default-input-sources.h"
|
||||
#include "non-latin-input-sources.h"
|
||||
|
||||
typedef struct _GnomeLocale {
|
||||
char *id;
|
||||
char *name;
|
||||
char *language_code;
|
||||
char *territory_code;
|
||||
char *codeset;
|
||||
char *modifier;
|
||||
} GnomeLocale;
|
||||
|
||||
+typedef struct _GnomeInputSourceDefaults {
|
||||
+ InputSource **input_sources;
|
||||
+ char **options;
|
||||
+} GnomeInputSourceDefaults;
|
||||
+
|
||||
static GHashTable *gnome_languages_map;
|
||||
static GHashTable *gnome_territories_map;
|
||||
static GHashTable *gnome_available_locales_map;
|
||||
static GHashTable *gnome_language_count_map;
|
||||
static GHashTable *gnome_territory_count_map;
|
||||
|
||||
static char * construct_language_name (const char *language,
|
||||
const char *territory,
|
||||
const char *codeset,
|
||||
const char *modifier);
|
||||
|
||||
static gboolean language_name_is_valid (const char *language_name);
|
||||
|
||||
static void
|
||||
gnome_locale_free (GnomeLocale *locale)
|
||||
{
|
||||
if (locale == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (locale->id);
|
||||
g_free (locale->name);
|
||||
g_free (locale->codeset);
|
||||
g_free (locale->modifier);
|
||||
g_free (locale->language_code);
|
||||
g_free (locale->territory_code);
|
||||
g_free (locale);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -1447,30 +1455,363 @@ gnome_get_input_source_from_locale (const char *locale,
|
||||
}
|
||||
|
||||
/**
|
||||
* gnome_input_source_is_non_latin:
|
||||
* @type: an input source type (e.g., "xkb" or "ibus")
|
||||
* @id: an input source id (e.g., "us+dvorak" or "anthy")
|
||||
*
|
||||
* Returns whether or not the input source has the ability to enter latin characters.
|
||||
*
|
||||
* Return value: %TRUE if it can't enter latin characters
|
||||
*
|
||||
* Since: 46
|
||||
*/
|
||||
gboolean
|
||||
gnome_input_source_is_non_latin (const char *type,
|
||||
const char *id)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; non_latin_input_sources[i].type != NULL; i++) {
|
||||
if (g_strcmp0 (type, non_latin_input_sources[i].type) != 0)
|
||||
continue;
|
||||
|
||||
if (g_strcmp0 (id, non_latin_input_sources[i].id) != 0)
|
||||
continue;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
+
|
||||
+static void
|
||||
+on_got_localed_proxy (GObject *object,
|
||||
+ GAsyncResult *result,
|
||||
+ GTask *sub_task)
|
||||
+{
|
||||
+ g_autoptr(SdDBusLocale1) proxy = NULL;
|
||||
+ g_autoptr(GError) error = NULL;
|
||||
+
|
||||
+ proxy = sd_dbus_locale1_proxy_new_finish (result, &error);
|
||||
+
|
||||
+ if (error != NULL) {
|
||||
+ g_task_return_error (sub_task, g_steal_pointer (&error));
|
||||
+ } else {
|
||||
+ g_task_return_pointer (sub_task, g_steal_pointer (&proxy), (GDestroyNotify) g_object_unref);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+get_localed_proxy (GCancellable *cancellable,
|
||||
+ GAsyncReadyCallback callback,
|
||||
+ GTask *main_task)
|
||||
+{
|
||||
+ g_autoptr(GTask) sub_task = NULL;
|
||||
+
|
||||
+ sub_task = g_task_new (NULL,
|
||||
+ cancellable,
|
||||
+ callback,
|
||||
+ main_task);
|
||||
+
|
||||
+ sd_dbus_locale1_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
|
||||
+ G_DBUS_PROXY_FLAGS_NONE,
|
||||
+ "org.freedesktop.locale1",
|
||||
+ "/org/freedesktop/locale1",
|
||||
+ cancellable,
|
||||
+ (GAsyncReadyCallback)
|
||||
+ on_got_localed_proxy,
|
||||
+ sub_task);
|
||||
+
|
||||
+ g_object_set_data_full (G_OBJECT (main_task),
|
||||
+ "gnome-desktop-get-localed-proxy",
|
||||
+ g_steal_pointer (&sub_task),
|
||||
+ g_object_unref);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+input_source_equal (const InputSource *a,
|
||||
+ const InputSource *b)
|
||||
+{
|
||||
+ return g_str_equal (a->type, b->type) && g_str_equal (a->id, b->id);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+gnome_input_source_defaults_free (GnomeInputSourceDefaults *defaults)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; defaults->input_sources[i] != NULL; i++) {
|
||||
+ g_free (defaults->input_sources[i]->type);
|
||||
+ g_free (defaults->input_sources[i]->id);
|
||||
+ g_free (defaults->input_sources[i]);
|
||||
+ }
|
||||
+ g_free (defaults->input_sources);
|
||||
+ g_strfreev (defaults->options);
|
||||
+ g_free (defaults);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sort_input_sources (InputSource *a,
|
||||
+ InputSource *b)
|
||||
+{
|
||||
+ gboolean a_is_input_method, b_is_input_method;
|
||||
+ gboolean a_is_latin, b_is_latin;
|
||||
+
|
||||
+ /* Make sure NULL gets put at the end */
|
||||
+ if (a == NULL) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (b == NULL) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Make sure latin get put at the front */
|
||||
+ a_is_input_method = g_str_equal (a->type, "ibus");
|
||||
+ b_is_input_method = g_str_equal (b->type, "ibus");
|
||||
+ a_is_latin = !gnome_input_source_is_non_latin (a->type, a->id);
|
||||
+ b_is_latin = !gnome_input_source_is_non_latin (b->type, b->id);
|
||||
+
|
||||
+ if (a_is_latin && !b_is_latin) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (b_is_latin && !a_is_latin) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ /* and input methods get put before raw keyboard layouts */
|
||||
+ if (a_is_input_method && !b_is_input_method) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (b_is_input_method && !a_is_input_method) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+on_got_localed_proxy_for_getting_default_input_sources (GObject *object,
|
||||
+ GAsyncResult *result,
|
||||
+ GTask *main_task)
|
||||
+{
|
||||
+ g_autoptr(SdDBusLocale1) proxy = NULL;
|
||||
+ g_autoptr(GError) error = NULL;
|
||||
+ g_autoptr(GPtrArray) input_sources = NULL;
|
||||
+ g_autofree InputSource *locale_input_source = NULL;
|
||||
+ g_autofree char *input_method_language = NULL;
|
||||
+ const char * const *locale_data;
|
||||
+ g_autofree char *system_locale = NULL;
|
||||
+ g_autofree char *layouts_string = NULL;
|
||||
+ g_autofree char *variants_string = NULL;
|
||||
+ g_autofree char *options_string = NULL;
|
||||
+ g_auto(GStrv) layouts = NULL;
|
||||
+ size_t number_of_layouts = 0;
|
||||
+ g_auto(GStrv) variants = NULL;
|
||||
+ size_t number_of_variants = 0;
|
||||
+ g_auto(GStrv) options = NULL;
|
||||
+ const char *type = NULL, *id = NULL;
|
||||
+ size_t i;
|
||||
+ GnomeInputSourceDefaults *defaults;
|
||||
+
|
||||
+ proxy = g_task_propagate_pointer (G_TASK (result), &error);
|
||||
+
|
||||
+ if (proxy == NULL) {
|
||||
+ g_task_return_error (main_task, g_steal_pointer (&error));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ input_sources = g_ptr_array_new ();
|
||||
+
|
||||
+ locale_data = sd_dbus_locale1_get_locale (proxy);
|
||||
+ for (i = 0; locale_data[i] != NULL; i++) {
|
||||
+ if (g_str_has_prefix (locale_data[i], "LANG=")) {
|
||||
+ system_locale = g_strdup (locale_data[i] + strlen("LANG="));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (gnome_get_input_source_from_locale (system_locale, &type, &id)) {
|
||||
+ locale_input_source = g_new0 (InputSource, 1);
|
||||
+ locale_input_source->type = g_strdup (type);
|
||||
+ locale_input_source->id = g_strdup (id);
|
||||
+
|
||||
+ /* We add locale derived input source first if it's an input method
|
||||
+ * and last if it's xkb based.
|
||||
+ */
|
||||
+ if (g_strcmp0 (type, "ibus") == 0) {
|
||||
+ g_ptr_array_add (input_sources, g_steal_pointer (&locale_input_source));
|
||||
+ input_method_language = gnome_get_language_from_locale (system_locale, NULL);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ layouts_string = sd_dbus_locale1_dup_x11_layout (proxy);
|
||||
+ variants_string = sd_dbus_locale1_dup_x11_variant (proxy);
|
||||
+ options_string = sd_dbus_locale1_dup_x11_options (proxy);
|
||||
+
|
||||
+ layouts = g_strsplit (layouts_string, ",", -1);
|
||||
+
|
||||
+ if (variants_string[0] != '\0') {
|
||||
+ variants = g_strsplit (variants_string, ",", -1);
|
||||
+ } else {
|
||||
+ variants = g_strdupv ((char *[]) { "", NULL });
|
||||
+ }
|
||||
+
|
||||
+ options = g_strsplit (options_string, ",", -1);
|
||||
+
|
||||
+ number_of_layouts = g_strv_length (layouts);
|
||||
+ number_of_variants = g_strv_length (variants);
|
||||
+
|
||||
+ if (number_of_layouts == number_of_variants) {
|
||||
+ g_autoptr(GnomeXkbInfo) xkb_info = gnome_xkb_info_new ();
|
||||
+ g_autofree char *system_language = NULL;
|
||||
+
|
||||
+ gnome_parse_locale (system_locale, &system_language, NULL, NULL, NULL);
|
||||
+
|
||||
+ for (i = 0; layouts[i] != NULL; i++) {
|
||||
+ g_autofree InputSource *input_source = g_new0 (InputSource, 1);
|
||||
+
|
||||
+ input_source->type = g_strdup ("xkb");
|
||||
+ input_source->id = g_strdup_printf ("%s%s%s",
|
||||
+ layouts[i],
|
||||
+ variants[i][0] != '\0'? "+" : "",
|
||||
+ variants[i]);
|
||||
+
|
||||
+ if (g_ptr_array_find_with_equal_func (input_sources, input_source, (GEqualFunc) input_source_equal, NULL))
|
||||
+ continue;
|
||||
+
|
||||
+ if (input_method_language != NULL) {
|
||||
+ const char *layout_language = NULL;
|
||||
+
|
||||
+ gnome_xkb_info_get_layout_info (xkb_info, input_source->id, &layout_language, NULL, NULL, NULL);
|
||||
+
|
||||
+ if (g_strcmp0 (input_method_language, layout_language) == 0)
|
||||
+ continue;
|
||||
+ } else if (system_language != NULL) {
|
||||
+ GList *languages = NULL, *node = NULL;
|
||||
+ const char *system_language_name = get_language (system_language);
|
||||
+
|
||||
+ languages = gnome_xkb_info_get_languages_for_layout (xkb_info, layouts[i]);
|
||||
+ for (node = languages; node != NULL; node = node->next) {
|
||||
+ const char *language_name = get_language (node->data);
|
||||
+
|
||||
+ if (g_strcmp0 (system_language_name, language_name) == 0) {
|
||||
+ g_clear_pointer (&locale_input_source, g_free);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ g_list_free (languages);
|
||||
+ }
|
||||
+
|
||||
+ g_ptr_array_add (input_sources, g_steal_pointer (&input_source));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (locale_input_source != NULL) {
|
||||
+ if (!g_ptr_array_find_with_equal_func (input_sources, locale_input_source, (GEqualFunc) input_source_equal, NULL)) {
|
||||
+ g_ptr_array_add (input_sources, g_steal_pointer (&locale_input_source));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (input_sources->len == 0) {
|
||||
+ InputSource *input_source = g_new0 (InputSource, 1);
|
||||
+ input_source->type = g_strdup ("xkb");
|
||||
+ input_source->id = g_strdup ("us");
|
||||
+ g_ptr_array_add (input_sources, g_steal_pointer (&input_source));
|
||||
+ }
|
||||
+ g_ptr_array_add (input_sources, NULL);
|
||||
+
|
||||
+ g_ptr_array_sort_values (input_sources, (GCompareFunc) sort_input_sources);
|
||||
+
|
||||
+ defaults = g_new0 (GnomeInputSourceDefaults, 1);
|
||||
+ defaults->input_sources = (InputSource **) g_ptr_array_steal (input_sources, NULL);
|
||||
+ defaults->options = g_steal_pointer (&options);
|
||||
+
|
||||
+ g_task_return_pointer (main_task, defaults, (GDestroyNotify) gnome_input_source_defaults_free);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gnome_get_default_input_sources:
|
||||
+ * @cancellable: a #GCancellable
|
||||
+ * @callback: a #GAsyncReadyCallback
|
||||
+ * @user_data: user data for @callback
|
||||
+ *
|
||||
+ * Asynchronously fetches a list of of default input sources based on locale and system
|
||||
+ * configuration. This is for when a user has no input sources configured
|
||||
+ * in GSettings.
|
||||
+ *
|
||||
+ * Since: 46
|
||||
+ */
|
||||
+void
|
||||
+gnome_get_default_input_sources (GCancellable *cancellable,
|
||||
+ GAsyncReadyCallback callback,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ GTask *task;
|
||||
+
|
||||
+ languages_init ();
|
||||
+
|
||||
+ task = g_task_new (NULL,
|
||||
+ cancellable,
|
||||
+ callback,
|
||||
+ user_data);
|
||||
+
|
||||
+ get_localed_proxy (cancellable,
|
||||
+ (GAsyncReadyCallback)
|
||||
+ on_got_localed_proxy_for_getting_default_input_sources,
|
||||
+ task);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gnome_get_default_input_sources_finish:
|
||||
+ * @ids: (out) (transfer full): an array of input sources (eg. "us+dvorak" or "anthy")
|
||||
+ * @types: (out) (transfer full): an array of types (either "xkb" or "ibus")
|
||||
+ * @options: (out) (transfer full): an options string to use with all input sources
|
||||
+ * @error: a #GError
|
||||
+ *
|
||||
+ * Returns a whether or not a list of default input sources based on locale and system
|
||||
+ * configuration could be retrieved. This is for when a user has no input sources configured
|
||||
+ * in GSettings.
|
||||
+ *
|
||||
+ * Since: 46
|
||||
+ */
|
||||
+gboolean
|
||||
+gnome_get_default_input_sources_finish (GAsyncResult *result,
|
||||
+ GStrv *ids,
|
||||
+ GStrv *types,
|
||||
+ GStrv *options,
|
||||
+ GError **error)
|
||||
+{
|
||||
+ GnomeInputSourceDefaults *defaults = NULL;
|
||||
+ size_t i;
|
||||
+ g_autoptr (GStrvBuilder) ids_builder = NULL;
|
||||
+ g_autoptr (GStrvBuilder) types_builder = NULL;
|
||||
+
|
||||
+ defaults = g_task_propagate_pointer (G_TASK (result), error);
|
||||
+
|
||||
+ if (defaults == NULL) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ ids_builder = g_strv_builder_new ();
|
||||
+ types_builder = g_strv_builder_new ();
|
||||
+
|
||||
+ for (i = 0; defaults->input_sources[i] != NULL; i++) {
|
||||
+ g_strv_builder_add (ids_builder, defaults->input_sources[i]->id);
|
||||
+ g_strv_builder_add (types_builder, defaults->input_sources[i]->type);
|
||||
+ }
|
||||
+
|
||||
+ if (ids != NULL)
|
||||
+ *ids = g_strv_builder_end (ids_builder);
|
||||
+
|
||||
+ if (types != NULL)
|
||||
+ *types = g_strv_builder_end (types_builder);
|
||||
+
|
||||
+ if (options != NULL)
|
||||
+ *options = g_steal_pointer (&defaults->options);
|
||||
+
|
||||
+ gnome_input_source_defaults_free (defaults);
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
diff --git a/libgnome-desktop/gnome-languages.h b/libgnome-desktop/gnome-languages.h
|
||||
index ed9242e7..3e261c28 100644
|
||||
--- a/libgnome-desktop/gnome-languages.h
|
||||
+++ b/libgnome-desktop/gnome-languages.h
|
||||
@@ -1,61 +1,72 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright 2008 Red Hat, Inc.
|
||||
* Copyright 2007 William Jon McCann <mccann@jhu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Written by: Ray Strode
|
||||
* William Jon McCann
|
||||
*/
|
||||
|
||||
#ifndef __GNOME_LANGUAGES_H
|
||||
#define __GNOME_LANGUAGES_H
|
||||
|
||||
#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#error This is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnome-languages.h
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
+#include <gio/gio.h>
|
||||
#include <libgnome-desktop/gnome-desktop-version.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
char * gnome_get_language_from_locale (const char *locale,
|
||||
const char *translation);
|
||||
char * gnome_get_country_from_locale (const char *locale,
|
||||
const char *translation);
|
||||
char ** gnome_get_all_locales (void);
|
||||
gboolean gnome_parse_locale (const char *locale,
|
||||
char **language_codep,
|
||||
char **country_codep,
|
||||
char **codesetp,
|
||||
char **modifierp);
|
||||
char * gnome_normalize_locale (const char *locale);
|
||||
gboolean gnome_language_has_translations (const char *code);
|
||||
char * gnome_get_language_from_code (const char *code,
|
||||
const char *translation);
|
||||
char * gnome_get_country_from_code (const char *code,
|
||||
const char *translation);
|
||||
char * gnome_get_translated_modifier (const char *modifier,
|
||||
const char *translation);
|
||||
gboolean gnome_get_input_source_from_locale (const char *locale,
|
||||
const char **type,
|
||||
const char **id);
|
||||
|
||||
gboolean gnome_input_source_is_non_latin (const char *type,
|
||||
const char *id);
|
||||
+
|
||||
+void gnome_get_default_input_sources (GCancellable *cancellable,
|
||||
+ GAsyncReadyCallback callback,
|
||||
+ gpointer user_data);
|
||||
+
|
||||
+gboolean gnome_get_default_input_sources_finish (GAsyncResult *result,
|
||||
+ GStrv *ids,
|
||||
+ GStrv *types,
|
||||
+ GStrv *options,
|
||||
+ GError **error);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GNOME_LANGUAGES_H */
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,23 +0,0 @@
|
||||
image/bmp=org.gnome.eog.desktop;
|
||||
image/gif=org.gnome.eog.desktop;
|
||||
image/jpeg=org.gnome.eog.desktop;
|
||||
image/jpg=org.gnome.eog.desktop;
|
||||
image/pjpeg=org.gnome.eog.desktop;
|
||||
image/png=org.gnome.eog.desktop;
|
||||
image/tiff=org.gnome.eog.desktop;
|
||||
image/x-bmp=org.gnome.eog.desktop;
|
||||
image/x-gray=org.gnome.eog.desktop;
|
||||
image/x-icb=org.gnome.eog.desktop;
|
||||
image/x-ico=org.gnome.eog.desktop;
|
||||
image/x-png=org.gnome.eog.desktop;
|
||||
image/x-portable-anymap=org.gnome.eog.desktop;
|
||||
image/x-portable-bitmap=org.gnome.eog.desktop;
|
||||
image/x-portable-graymap=org.gnome.eog.desktop;
|
||||
image/x-portable-pixmap=org.gnome.eog.desktop;
|
||||
image/x-xbitmap=org.gnome.eog.desktop;
|
||||
image/x-xpixmap=org.gnome.eog.desktop;
|
||||
image/x-pcx=org.gnome.eog.desktop;
|
||||
image/svg+xml=org.gnome.eog.desktop;
|
||||
image/svg+xml-compressed=org.gnome.eog.desktop;
|
||||
image/vnd.wap.wbmp=org.gnome.eog.desktop;
|
||||
image/x-icns=org.gnome.eog.desktop;
|
@ -0,0 +1,22 @@
|
||||
image/jpeg=org.gnome.Loupe.desktop;
|
||||
image/png=org.gnome.Loupe.desktop;
|
||||
image/gif=org.gnome.Loupe.desktop;
|
||||
image/webp=org.gnome.Loupe.desktop;
|
||||
image/tiff=org.gnome.Loupe.desktop;
|
||||
image/x-tga=org.gnome.Loupe.desktop;
|
||||
image/vnd-ms.dds=org.gnome.Loupe.desktop;
|
||||
image/x-dds=org.gnome.Loupe.desktop;
|
||||
image/bmp=org.gnome.Loupe.desktop;
|
||||
image/vnd.microsoft.icon=org.gnome.Loupe.desktop;
|
||||
image/vnd.radiance=org.gnome.Loupe.desktop;
|
||||
image/x-exr=org.gnome.Loupe.desktop;
|
||||
image/x-portable-bitmap=org.gnome.Loupe.desktop;
|
||||
image/x-portable-graymap=org.gnome.Loupe.desktop;
|
||||
image/x-portable-pixmap=org.gnome.Loupe.desktop;
|
||||
image/x-portable-anymap=org.gnome.Loupe.desktop;
|
||||
image/x-qoi=org.gnome.Loupe.desktop;
|
||||
image/svg+xml=org.gnome.Loupe.desktop;
|
||||
image/svg+xml-compressed=org.gnome.Loupe.desktop;
|
||||
image/avif=org.gnome.Loupe.desktop;
|
||||
image/heic=org.gnome.Loupe.desktop;
|
||||
image/jxl=org.gnome.Loupe.desktop;
|
@ -0,0 +1,72 @@
|
||||
From 334dd1e558ecced106f6c5ecacae687279904b54 Mon Sep 17 00:00:00 2001
|
||||
From: David King <amigadave@amigadave.com>
|
||||
Date: Fri, 18 Feb 2022 09:52:46 +0000
|
||||
Subject: [PATCH] Use inscript as default Indic IM
|
||||
|
||||
https://src.fedoraproject.org/rpms/gnome-desktop3/pull-request/6
|
||||
---
|
||||
libgnome-desktop/default-input-sources.h | 26 ++++++++++++------------
|
||||
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/libgnome-desktop/default-input-sources.h b/libgnome-desktop/default-input-sources.h
|
||||
index 1e02bce1..00072687 100644
|
||||
--- a/libgnome-desktop/default-input-sources.h
|
||||
+++ b/libgnome-desktop/default-input-sources.h
|
||||
@@ -8,12 +8,12 @@ typedef struct
|
||||
static DefaultInputSource default_input_sources[] =
|
||||
{
|
||||
{ "ar_DZ", "xkb", "ara+azerty" },
|
||||
- { "as_IN", "ibus", "m17n:as:phonetic" },
|
||||
+ { "as_IN", "ibus", "m17n:as:inscript2" },
|
||||
{ "ast_ES", "xkb", "es+ast" },
|
||||
{ "az_AZ", "xkb", "az" },
|
||||
{ "be_BY", "xkb", "by" },
|
||||
{ "bg_BG", "xkb", "bg+phonetic" },
|
||||
- { "bn_IN", "ibus", "m17n:bn:inscript" },
|
||||
+ { "bn_IN", "ibus", "m17n:bn:inscript2" },
|
||||
{ "cat_ES", "xkb", "es+cat" },
|
||||
{ "cs_CZ", "xkb", "cz" },
|
||||
{ "de_CH", "xkb", "ch" },
|
||||
@@ -31,28 +31,28 @@ static DefaultInputSource default_input_sources[] =
|
||||
{ "fr_CH", "xkb", "ch+fr" },
|
||||
{ "fr_FR", "xkb", "fr+oss" },
|
||||
{ "gl_ES", "xkb", "es" },
|
||||
- { "gu_IN", "ibus", "m17n:gu:inscript" },
|
||||
+ { "gu_IN", "ibus", "m17n:gu:inscript2" },
|
||||
{ "he_IL", "xkb", "il" },
|
||||
- { "hi_IN", "ibus", "m17n:hi:inscript" },
|
||||
+ { "hi_IN", "ibus", "m17n:hi:inscript2" },
|
||||
{ "id_ID", "xkb", "us" },
|
||||
{ "it_IT", "xkb", "it" },
|
||||
{ "ja_JP", "ibus", "anthy" },
|
||||
- { "kn_IN", "ibus", "m17n:kn:kgp" },
|
||||
+ { "kn_IN", "ibus", "m17n:kn:inscript2" },
|
||||
{ "ko_KR", "ibus", "hangul" },
|
||||
- { "mai_IN", "ibus", "m17n:mai:inscript" },
|
||||
- { "ml_IN", "ibus", "m17n:ml:inscript" },
|
||||
- { "mr_IN", "ibus", "m17n:mr:inscript" },
|
||||
+ { "mai_IN", "ibus", "m17n:mai:inscript2" },
|
||||
+ { "ml_IN", "ibus", "m17n:ml:inscript2" },
|
||||
+ { "mr_IN", "ibus", "m17n:mr:inscript2" },
|
||||
{ "nl_NL", "xkb", "us+altgr-intl" },
|
||||
- { "or_IN", "ibus", "m17n:or:inscript" },
|
||||
- { "pa_IN", "ibus", "m17n:pa:inscript" },
|
||||
+ { "or_IN", "ibus", "m17n:or:inscript2" },
|
||||
+ { "pa_IN", "ibus", "m17n:pa:inscript2-guru" },
|
||||
{ "pl_PL", "xkb", "pl" },
|
||||
{ "pt_BR", "xkb", "br" },
|
||||
{ "pt_PT", "xkb", "pt" },
|
||||
{ "ru_RU", "xkb", "ru" },
|
||||
- { "sd_IN", "ibus", "m17n:sd:inscript" },
|
||||
+ { "sd_IN", "ibus", "m17n:sd:inscript2-deva" },
|
||||
{ "sk_SK", "xkb", "sk" },
|
||||
- { "ta_IN", "ibus", "m17n:ta:tamil99" },
|
||||
- { "te_IN", "ibus", "m17n:te:inscript" },
|
||||
+ { "ta_IN", "ibus", "m17n:ta:inscript2" },
|
||||
+ { "te_IN", "ibus", "m17n:te:inscript2" },
|
||||
{ "tr_TR", "xkb", "tr" },
|
||||
{ "ur_IN", "ibus", "m17n:ur:phonetic" },
|
||||
{ "zh_CN", "ibus", "libpinyin" },
|
||||
--
|
||||
2.40.0
|
||||
|
Loading…
Reference in new issue