[gnome-text-editor] prefs: always show the current scheme in the list
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] prefs: always show the current scheme in the list
- Date: Mon, 27 Dec 2021 02:44:52 +0000 (UTC)
commit 3d805b779714c3cc0e4a0b18670dccac9078be29
Author: Christian Hergert <chergert redhat com>
Date: Sun Dec 26 18:44:47 2021 -0800
prefs: always show the current scheme in the list
Always show the current scheme if necessary in the list even if it doesn't
match our light/dark variant for the application.
Related #272
src/editor-preferences-dialog.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-preferences-dialog.c b/src/editor-preferences-dialog.c
index 8fc551e..e3a15e4 100644
--- a/src/editor-preferences-dialog.c
+++ b/src/editor-preferences-dialog.c
@@ -216,6 +216,7 @@ update_style_schemes (EditorPreferencesDialog *self)
GtkSourceStyleSchemeManager *sm;
const char * const *scheme_ids;
g_autoptr(GArray) schemes = NULL;
+ const char *current_scheme;
gboolean is_dark;
guint j = 0;
@@ -223,6 +224,7 @@ update_style_schemes (EditorPreferencesDialog *self)
schemes = g_array_new (FALSE, FALSE, sizeof (SchemeInfo));
is_dark = adw_style_manager_get_dark (adw_style_manager_get_default ());
+ current_scheme = editor_application_get_style_scheme (EDITOR_APPLICATION_DEFAULT);
/* Populate schemes for preferences */
sm = gtk_source_style_scheme_manager_get_default ();
@@ -273,7 +275,11 @@ update_style_schemes (EditorPreferencesDialog *self)
const SchemeInfo *info = &g_array_index (schemes, SchemeInfo, i);
GtkWidget *preview;
- if (is_dark != _editor_source_style_scheme_is_dark (info->scheme))
+ /* Ignore if not matching light/dark variant for app, unless it is
+ * the current scheme and it has no alternate.
+ */
+ if (is_dark != _editor_source_style_scheme_is_dark (info->scheme) &&
+ (g_strcmp0 (info->id, current_scheme) != 0 || info->has_alt))
continue;
preview = gtk_source_style_scheme_preview_new (info->scheme);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]