[gnome-builder/wip/gtk4-port: 416/1774] plugins/editorui: tweak styling for scheme previews
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 416/1774] plugins/editorui: tweak styling for scheme previews
- Date: Mon, 11 Jul 2022 22:31:11 +0000 (UTC)
commit 56c101fa412cf0bd74df5537a0253053927d0c3b
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 6 12:56:12 2022 -0700
plugins/editorui: tweak styling for scheme previews
.../editorui/gbp-editorui-preferences-addin.c | 23 +++++++++++-----------
src/plugins/editorui/style.css | 14 ++++++++++---
2 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/editorui/gbp-editorui-preferences-addin.c
b/src/plugins/editorui/gbp-editorui-preferences-addin.c
index 07049d1ce..e78a002e9 100644
--- a/src/plugins/editorui/gbp-editorui-preferences-addin.c
+++ b/src/plugins/editorui/gbp-editorui-preferences-addin.c
@@ -189,26 +189,23 @@ ide_preferences_builtin_add_schemes (const char *page_name,
const char * const *scheme_ids;
GtkFlowBox *flowbox;
GtkWidget *preview;
- GtkFrame *frame;
g_assert (IDE_IS_PREFERENCES_WINDOW (window));
g_assert (entry != NULL);
g_assert (ADW_IS_PREFERENCES_GROUP (group));
preview = gbp_editorui_preview_new ();
- frame = g_object_new (GTK_TYPE_FRAME,
- "child", preview,
- "margin-bottom", 12,
- NULL);
- adw_preferences_group_add (group, GTK_WIDGET (frame));
+ gtk_widget_add_css_class (GTK_WIDGET (preview), "card");
+ gtk_widget_set_margin_bottom (preview, 12);
+ adw_preferences_group_add (group, preview);
manager = gtk_source_style_scheme_manager_get_default ();
scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);
flowbox = g_object_new (GTK_TYPE_FLOW_BOX,
"activate-on-single-click", TRUE,
- "column-spacing", 6,
- "row-spacing", 6,
+ "column-spacing", 12,
+ "row-spacing", 12,
"max-children-per-line", 4,
NULL);
gtk_widget_add_css_class (GTK_WIDGET (flowbox), "style-schemes");
@@ -216,12 +213,14 @@ ide_preferences_builtin_add_schemes (const char *page_name,
for (guint i = 0; scheme_ids[i]; i++)
{
GtkSourceStyleScheme *scheme = gtk_source_style_scheme_manager_get_scheme (manager, scheme_ids[i]);
- GtkWidget *selector = gtk_source_style_scheme_preview_new (scheme);
+ GtkSourceStyleSchemePreview *selector;
- gtk_actionable_set_action_name (GTK_ACTIONABLE (selector), "app.style-scheme-name");
+ selector = g_object_new (GTK_SOURCE_TYPE_STYLE_SCHEME_PREVIEW,
+ "action-name", "app.style-scheme-name",
+ "scheme", scheme,
+ NULL);
gtk_actionable_set_action_target (GTK_ACTIONABLE (selector), "s", scheme_ids[i]);
-
- gtk_flow_box_append (flowbox, selector);
+ gtk_flow_box_append (flowbox, GTK_WIDGET (selector));
}
g_signal_connect_object (IDE_APPLICATION_DEFAULT,
diff --git a/src/plugins/editorui/style.css b/src/plugins/editorui/style.css
index 9059ff9ec..2bce7c332 100644
--- a/src/plugins/editorui/style.css
+++ b/src/plugins/editorui/style.css
@@ -1,6 +1,14 @@
window.preferences preferencesgroup flowbox.style-schemes flowboxchild {
- outline-offset: -3px;
- border-radius: 14px;
+ outline-offset: 2px;
+ border-radius: 12px;
outline-width: 2px;
+ padding: 0;
+}
+window.preferences preferencesgroup flowbox.style-schemes flowboxchild GtkSourceStyleSchemePreview {
+ margin: 0;
+}
+window.preferences preferencesgroup flowbox.style-schemes flowboxchild
GtkSourceStyleSchemePreview:not(.selected) {
+ box-shadow: 0 0 0 1px alpha(black, 0.03),
+ 0 1px 3px 1px alpha(black, .07),
+ 0 2px 6px 2px alpha(black, .03);
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]