[gnome-text-editor] app: set "devel" css class on windows



commit dc85d2313bb9765160bc8a0570453e0e3d20d0a7
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 14 22:08:17 2021 -0700

    app: set "devel" css class on windows
    
    If -Ddevelopment=true, set the devel css class for stripes on headerbar.

 src/editor-application.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/editor-application.c b/src/editor-application.c
index b0b4939..4255fda 100644
--- a/src/editor-application.c
+++ b/src/editor-application.c
@@ -220,11 +220,26 @@ editor_application_shutdown (GApplication *application)
   G_APPLICATION_CLASS (editor_application_parent_class)->shutdown (application);
 }
 
+static void
+editor_application_window_added (GtkApplication *application,
+                                 GtkWindow      *window)
+{
+  g_assert (EDITOR_IS_APPLICATION (application));
+  g_assert (GTK_IS_WINDOW (window));
+
+#if DEVELOPMENT_BUILD
+  gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
+#endif
+
+  GTK_APPLICATION_CLASS (editor_application_parent_class)->window_added (application, window);
+}
+
 static void
 editor_application_class_init (EditorApplicationClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
+  GtkApplicationClass *gtk_application_class = GTK_APPLICATION_CLASS (klass);
 
   object_class->constructed = editor_application_constructed;
 
@@ -233,6 +248,8 @@ editor_application_class_init (EditorApplicationClass *klass)
   application_class->startup = editor_application_startup;
   application_class->shutdown = editor_application_shutdown;
   application_class->handle_local_options = editor_application_handle_local_options;
+
+  gtk_application_class->window_added = editor_application_window_added;
 }
 
 static const GOptionEntry entries[] = {


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