[gnome-text-editor/wip/exalm/preview-style] preferences-dialog: Use .card for previews




commit e0c256252518f730a97a7570a84e2bbffb39a8b7
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Apr 6 23:01:22 2022 +0400

    preferences-dialog: Use .card for previews
    
    See https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/252

 src/editor-preferences-dialog.c  |  1 +
 src/editor-preferences-dialog.ui | 41 +++++++++++++++++++---------------------
 src/style.css                    |  9 ++++++---
 3 files changed, 26 insertions(+), 25 deletions(-)
---
diff --git a/src/editor-preferences-dialog.c b/src/editor-preferences-dialog.c
index b58ddb4..1b8c783 100644
--- a/src/editor-preferences-dialog.c
+++ b/src/editor-preferences-dialog.c
@@ -177,6 +177,7 @@ update_style_scheme_selection (EditorPreferencesDialog *self)
       gboolean selected = g_strcmp0 (scheme_id, id) == 0;
 
       gtk_source_style_scheme_preview_set_selected (preview, selected);
+      gtk_widget_add_css_class (GTK_WIDGET (preview), "card");
 
       if (selected)
         gtk_source_buffer_set_style_scheme (self->buffer, scheme);
diff --git a/src/editor-preferences-dialog.ui b/src/editor-preferences-dialog.ui
index d98fde1..bd28c49 100644
--- a/src/editor-preferences-dialog.ui
+++ b/src/editor-preferences-dialog.ui
@@ -16,36 +16,33 @@
           <object class="AdwPreferencesGroup">
             <property name="title" translatable="yes">Appearance</property>
             <child>
-              <object class="GtkFrame">
+              <object class="GtkSourceView" id="source_view">
+                <property name="editable">false</property>
+                <property name="cursor-visible">false</property>
+                <property name="top-margin">8</property>
+                <property name="bottom-margin">8</property>
+                <property name="left-margin">12</property>
+                <property name="right-margin">12</property>
+                <property name="right-margin-position">30</property>
+                <property name="monospace">true</property>
+                <property name="show-line-numbers">true</property>
                 <property name="margin-bottom">24</property>
-                <child>
-                  <object class="GtkSourceView" id="source_view">
-                    <property name="editable">false</property>
-                    <property name="cursor-visible">false</property>
-                    <property name="top-margin">8</property>
-                    <property name="bottom-margin">8</property>
-                    <property name="left-margin">12</property>
-                    <property name="right-margin">12</property>
-                    <property name="right-margin-position">30</property>
-                    <property name="monospace">true</property>
-                    <property name="show-line-numbers">true</property>
-                    <property name="buffer">
-                      <object class="GtkSourceBuffer" id="buffer">
-                      </object>
-                    </property>
-                    <style>
-                      <class name="preview"/>
-                    </style>
+                <property name="buffer">
+                  <object class="GtkSourceBuffer" id="buffer">
                   </object>
-                </child>
+                </property>
+                <style>
+                  <class name="preview"/>
+                  <class name="card"/>
+                </style>
               </object>
             </child>
             <child>
               <object class="GtkFlowBox" id="scheme_group">
                 <signal name="child-activated" handler="style_scheme_activated_cb" swapped="true"/>
                 <property name="hexpand">true</property>
-                <property name="column-spacing">0</property>
-                <property name="row-spacing">0</property>
+                <property name="column-spacing">12</property>
+                <property name="row-spacing">12</property>
                 <property name="max-children-per-line">4</property>
                 <property name="max-children-per-line">4</property>
                 <property name="selection-mode">none</property>
diff --git a/src/style.css b/src/style.css
index 4476d5b..1f0c2ed 100644
--- a/src/style.css
+++ b/src/style.css
@@ -3,11 +3,14 @@ window.org-gnome-TextEditor.preferences textview.preview {
   line-height: 1.2;
 }
 window.org-gnome-TextEditor.preferences preferencesgroup flowboxchild {
-  outline-offset: -3px;
-  border-radius: 14px;
-  outline-width: 2px;
+  outline-offset: 2px;
+  border-radius: 12px;
+  padding: 0;
 }
 
+window.org-gnome-TextEditor.preferences preferencesgroup flowboxchild GtkSourceStyleSchemePreview {
+  margin: 0;
+}
 
 /* EditorThemeSelector */
 window.org-gnome-TextEditor themeselector {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]