[gnome-control-center/gbsneto/gtk4: 16/53] application: Subclass AdwApplication




commit e42a8197237425dd4312051db6bbe39c7276f5a3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Oct 19 20:57:26 2021 -0300

    application: Subclass AdwApplication
    
    It'll handle setting up various things for us.

 shell/cc-application.c | 23 ++++++++++-------------
 shell/cc-application.h |  4 ++--
 2 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/shell/cc-application.c b/shell/cc-application.c
index 4a90157e2..da0237b99 100644
--- a/shell/cc-application.c
+++ b/shell/cc-application.c
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <handy.h>
+#include <adwaita.h>
 
 #include "cc-application.h"
 #include "cc-log.h"
@@ -34,7 +34,7 @@
 
 struct _CcApplication
 {
-  GtkApplication  parent;
+  AdwApplication  parent;
 
   CcShellModel   *model;
 
@@ -53,7 +53,7 @@ static void help_activated         (GSimpleAction *action,
                                     GVariant      *parameter,
                                     gpointer       user_data);
 
-G_DEFINE_TYPE (CcApplication, cc_application, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE (CcApplication, cc_application, ADW_TYPE_APPLICATION)
 
 const GOptionEntry all_options[] = {
   { "version", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Display version number"), NULL },
@@ -85,10 +85,9 @@ help_activated (GSimpleAction *action,
     uri = cc_panel_get_help_uri (panel);
 
   window = cc_shell_get_toplevel (CC_SHELL (self->window));
-  gtk_show_uri_on_window (GTK_WINDOW (window),
-                          uri ? uri : "help:gnome-help/prefs",
-                          GDK_CURRENT_TIME,
-                          NULL);
+  gtk_show_uri (GTK_WINDOW (window),
+                uri ? uri : "help:gnome-help/prefs",
+                GDK_CURRENT_TIME);
 }
 
 static void
@@ -200,7 +199,7 @@ cc_application_quit (GSimpleAction *simple,
 {
   CcApplication *self = CC_APPLICATION (user_data);
 
-  gtk_widget_destroy (GTK_WIDGET (self->window));
+  gtk_window_destroy (GTK_WINDOW (self->window));
 }
 
 
@@ -225,8 +224,6 @@ cc_application_startup (GApplication *application)
 
   G_APPLICATION_CLASS (cc_application_parent_class)->startup (application);
 
-  hdy_init ();
-
   gtk_application_set_accels_for_action (GTK_APPLICATION (application),
                                          "app.help", help_accels);
 
@@ -287,9 +284,9 @@ cc_application_init (CcApplication *self)
 
   provider = gtk_css_provider_new ();
   gtk_css_provider_load_from_resource (provider, "/org/gnome/ControlCenter/gtk/style.css");
-  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                             GTK_STYLE_PROVIDER (provider),
-                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+                                              GTK_STYLE_PROVIDER (provider),
+                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 }
 
 GtkApplication *
diff --git a/shell/cc-application.h b/shell/cc-application.h
index e9c8b60af..7b1fa3b1f 100644
--- a/shell/cc-application.h
+++ b/shell/cc-application.h
@@ -21,13 +21,13 @@
 
 #include "cc-shell-model.h"
 
-#include <gtk/gtk.h>
+#include <adwaita.h>
 
 G_BEGIN_DECLS
 
 #define CC_TYPE_APPLICATION (cc_application_get_type())
 
-G_DECLARE_FINAL_TYPE (CcApplication, cc_application, CC, APPLICATION, GtkApplication)
+G_DECLARE_FINAL_TYPE (CcApplication, cc_application, CC, APPLICATION, AdwApplication)
 
 GtkApplication        *cc_application_new                    (void);
 


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