[libadwaita] demo: inherit from AdwApplication



commit acf6da671cf9465b52a7aa3d772caeb6689626f5
Author: Nahuel Gomez Castro <nahuel gomezcastro outlook com ar>
Date:   Mon Jun 28 22:47:23 2021 -0300

    demo: inherit from AdwApplication
    
    Drop the connection to the startup signal, and move the stylesheet to
    /org/gnome/Adwaita/Demo

 examples/adwaita-demo.c              | 20 ++------------------
 examples/adwaita-demo.gresources.xml |  2 +-
 2 files changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/examples/adwaita-demo.c b/examples/adwaita-demo.c
index 78d9aa14..bca716d0 100644
--- a/examples/adwaita-demo.c
+++ b/examples/adwaita-demo.c
@@ -17,21 +17,6 @@ show_preferences (GSimpleAction *action,
   gtk_window_present (GTK_WINDOW (preferences));
 }
 
-static void
-startup (GtkApplication *app)
-{
-  GtkCssProvider *css_provider = gtk_css_provider_new ();
-
-  adw_init ();
-
-  gtk_css_provider_load_from_resource (css_provider, "/org/gnome/Adwaita/Demo/ui/style.css");
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (css_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-  g_object_unref (css_provider);
-}
-
 static void
 show_window (GtkApplication *app)
 {
@@ -46,17 +31,16 @@ int
 main (int    argc,
       char **argv)
 {
-  GtkApplication *app;
+  AdwApplication *app;
   int status;
   static GActionEntry app_entries[] = {
     { "preferences", show_preferences, NULL, NULL, NULL },
   };
 
-  app = gtk_application_new ("org.gnome.Adwaita.Demo", G_APPLICATION_FLAGS_NONE);
+  app = adw_application_new ("org.gnome.Adwaita.Demo", G_APPLICATION_FLAGS_NONE);
   g_action_map_add_action_entries (G_ACTION_MAP (app),
                                    app_entries, G_N_ELEMENTS (app_entries),
                                    app);
-  g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
   g_signal_connect (app, "activate", G_CALLBACK (show_window), NULL);
   status = g_application_run (G_APPLICATION (app), argc, argv);
   g_object_unref (app);
diff --git a/examples/adwaita-demo.gresources.xml b/examples/adwaita-demo.gresources.xml
index 5d0a89dc..8f0395fb 100644
--- a/examples/adwaita-demo.gresources.xml
+++ b/examples/adwaita-demo.gresources.xml
@@ -34,6 +34,7 @@
     <file preprocess="xml-stripblanks">icons/scalable/status/light-mode-symbolic.svg</file>
     <file preprocess="xml-stripblanks">icons/scalable/status/tab-audio-playing-symbolic.svg</file>
     <file preprocess="xml-stripblanks">icons/scalable/status/tab-audio-muted-symbolic.svg</file>
+    <file compressed="true">style.css</file>
   </gresource>
   <gresource prefix="/org/gnome/Adwaita/Demo/ui">
     <file preprocess="xml-stripblanks">adw-demo-preferences-window.ui</file>
@@ -41,6 +42,5 @@
     <file preprocess="xml-stripblanks">adw-flap-demo-window.ui</file>
     <file preprocess="xml-stripblanks">adw-tab-view-demo-window.ui</file>
     <file preprocess="xml-stripblanks">adw-view-switcher-demo-window.ui</file>
-    <file compressed="true">style.css</file>
   </gresource>
 </gresources>


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