[gnome-builder] libide/tweaks: setup CSS loading for libide-tweaks



commit a9999aedf08e1e5a4b6ee5044ef354942ed12862
Author: Christian Hergert <chergert redhat com>
Date:   Wed Aug 10 13:40:51 2022 -0700

    libide/tweaks: setup CSS loading for libide-tweaks
    
    This will let us move some things out of libide-gui/style.css eventually.

 src/libide/gui/ide-application.c              |  1 +
 src/libide/tweaks/ide-tweaks-window.ui        |  3 +++
 src/libide/tweaks/libide-tweaks.gresource.xml |  1 +
 src/libide/tweaks/style.css                   | 14 ++++++++++++++
 src/libide/tweaks/tests/test-tweaks.c         |  7 +++++++
 5 files changed, 26 insertions(+)
---
diff --git a/src/libide/gui/ide-application.c b/src/libide/gui/ide-application.c
index 17de10964..f1ee18f0d 100644
--- a/src/libide/gui/ide-application.c
+++ b/src/libide/gui/ide-application.c
@@ -567,6 +567,7 @@ ide_application_init (IdeApplication *self)
   ide_application_load_typelibs (self);
 
   /* Ensure our core data is loaded early. */
+  _ide_application_add_resources (self, "resource:///org/gnome/libide-tweaks/");
   _ide_application_add_resources (self, "resource:///org/gnome/libide-sourceview/");
   _ide_application_add_resources (self, "resource:///org/gnome/libide-gui/");
   _ide_application_add_resources (self, "resource:///org/gnome/libide-greeter/");
diff --git a/src/libide/tweaks/ide-tweaks-window.ui b/src/libide/tweaks/ide-tweaks-window.ui
index da727fe64..24d9fd5ad 100644
--- a/src/libide/tweaks/ide-tweaks-window.ui
+++ b/src/libide/tweaks/ide-tweaks-window.ui
@@ -5,6 +5,9 @@
     <property name="default-width">1080</property>
     <property name="default-height">720</property>
     <property name="folded" bind-source="leaflet" bind-property="folded" bind-flags="sync-create"/>
+    <style>
+      <class name="IdeTweaksWindow"/>
+    </style>
     <child>
       <object class="AdwLeaflet" id="leaflet">
         <property name="can-navigate-back">true</property>
diff --git a/src/libide/tweaks/libide-tweaks.gresource.xml b/src/libide/tweaks/libide-tweaks.gresource.xml
index 12070f107..f575ca43e 100644
--- a/src/libide/tweaks/libide-tweaks.gresource.xml
+++ b/src/libide/tweaks/libide-tweaks.gresource.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/libide-tweaks">
+    <file>style.css</file>
     <file preprocess="xml-stripblanks">ide-tweaks-panel.ui</file>
     <file preprocess="xml-stripblanks">ide-tweaks-panel-list.ui</file>
     <file preprocess="xml-stripblanks">ide-tweaks-panel-list-row.ui</file>
diff --git a/src/libide/tweaks/style.css b/src/libide/tweaks/style.css
new file mode 100644
index 000000000..1e958d178
--- /dev/null
+++ b/src/libide/tweaks/style.css
@@ -0,0 +1,14 @@
+.IdeTweaksWindow .checkimage radio,
+.IdeTweaksWindow .checkimage check {
+  background: none;
+  outline: none;
+  box-shadow: none;
+  border: none;
+  color: @window_fg_color;
+  -gtk-icon-source: none;
+  -gtk-icon-size: 18px;
+}
+.IdeTweaksWindow .checkimage radio:checked,
+.IdeTweaksWindow .checkimage check:checked {
+  -gtk-icon-source: -gtk-icontheme('object-select-symbolic');
+}
diff --git a/src/libide/tweaks/tests/test-tweaks.c b/src/libide/tweaks/tests/test-tweaks.c
index 48d1789ff..9cae49192 100644
--- a/src/libide/tweaks/tests/test-tweaks.c
+++ b/src/libide/tweaks/tests/test-tweaks.c
@@ -39,6 +39,7 @@ main (int   argc,
   g_autoptr(GError) error = NULL;
   g_autofree char *expected = NULL;
   g_autofree char *expected_contents = NULL;
+  g_autoptr(GtkCssProvider) css = NULL;
   gboolean display = FALSE;
   gsize len = 0;
   const GOptionEntry entries[] = {
@@ -64,6 +65,12 @@ main (int   argc,
   gtk_icon_theme_add_search_path (gtk_icon_theme_get_for_display (gdk_display_get_default ()),
                                   PACKAGE_ICONDIR);
 
+  css = gtk_css_provider_new ();
+  gtk_css_provider_load_from_resource (css, "/org/gnome/libide-tweaks/style.css");
+  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+                                              GTK_STYLE_PROVIDER (css),
+                                              GTK_STYLE_PROVIDER_PRIORITY_THEME+1);
+
   tweaks = ide_tweaks_new ();
   string = g_string_new (NULL);
 


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