[libdazzle] tests: use default styling from loaded theme
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] tests: use default styling from loaded theme
- Date: Tue, 6 Jun 2017 22:20:19 +0000 (UTC)
commit f9d3b0dd19cacd9b70f23c39f6612ca12d176183
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 6 15:20:07 2017 -0700
tests: use default styling from loaded theme
This makes it easier to tweak the theme and test things
tests/data/test-panel.css | 80 ---------------------------------------------
tests/test-panel.c | 22 +++++++-----
2 files changed, 13 insertions(+), 89 deletions(-)
---
diff --git a/tests/test-panel.c b/tests/test-panel.c
index adc8c3c..0918529 100644
--- a/tests/test-panel.c
+++ b/tests/test-panel.c
@@ -144,6 +144,17 @@ log_handler (const gchar *domain,
g_print ("%s: time=%0.5lf %s\n", domain, t, message);
}
+static void
+load_css (void)
+{
+ g_autoptr(GtkCssProvider) provider = NULL;
+
+ provider = dzl_css_provider_new ("/org/gnome/dazzle/themes");
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
gint
main (gint argc,
gchar *argv[])
@@ -151,21 +162,14 @@ main (gint argc,
GtkBuilder *builder = NULL;
GtkWindow *window = NULL;
GActionGroup *group;
- GtkCssProvider *provider;
GError *error = NULL;
g_autofree gchar *ui_path = g_build_filename (TEST_DATA_DIR, "test-panel.ui", NULL);
- g_autofree gchar *css_path = g_build_filename (TEST_DATA_DIR, "test-panel.css", NULL);
gtk_init (&argc, &argv);
- timer = g_timer_new ();
+ load_css ();
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_path (provider, css_path, &error);
- g_assert_no_error (error);
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ timer = g_timer_new ();
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, ui_path, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]