[console/zbrown/quick-ci-check] application: use a settings object



commit a69560b21a76ab59b5d2da09bccfa287c4f440ce
Author: Zander Brown <zbrown gnome org>
Date:   Wed Aug 17 02:15:24 2022 +0100

    application: use a settings object
    
    Stop exposing our ‘settings’ directly on application, instead provide
    KgxWindows with a KgxSettings instance they can bind to
    
    Simplify `add_terminal` moving shell resolution to KgxSettings
    
    Manage zoom actions via binds to said settings object

 src/kgx-application.c | 316 ++++++++++++--------------------------------------
 src/kgx-application.h |  22 +---
 src/kgx-window.c      |  85 +++++---------
 src/kgx-window.h      |   7 +-
 4 files changed, 106 insertions(+), 324 deletions(-)
---
diff --git a/src/kgx-application.c b/src/kgx-application.c
index 21d67a2..48a20fa 100644
--- a/src/kgx-application.c
+++ b/src/kgx-application.c
@@ -47,123 +47,6 @@
 
 G_DEFINE_TYPE (KgxApplication, kgx_application, ADW_TYPE_APPLICATION)
 
-enum {
-  PROP_0,
-  PROP_THEME,
-  PROP_FONT,
-  PROP_FONT_SCALE,
-  PROP_SCROLLBACK_LINES,
-  LAST_PROP
-};
-
-static GParamSpec *pspecs[LAST_PROP] = { NULL, };
-
-
-static void
-kgx_application_set_theme (KgxApplication *self,
-                           KgxTheme        theme)
-{
-  AdwStyleManager *style_manager;
-
-  g_return_if_fail (KGX_IS_APPLICATION (self));
-
-  self->theme = theme;
-
-  style_manager = adw_style_manager_get_default ();
-
-  switch (theme) {
-    case KGX_THEME_AUTO:
-      adw_style_manager_set_color_scheme (style_manager, ADW_COLOR_SCHEME_PREFER_LIGHT);
-      break;
-    case KGX_THEME_DAY:
-      adw_style_manager_set_color_scheme (style_manager, ADW_COLOR_SCHEME_FORCE_LIGHT);
-      break;
-    case KGX_THEME_NIGHT:
-    case KGX_THEME_HACKER:
-    default:
-      adw_style_manager_set_color_scheme (style_manager, ADW_COLOR_SCHEME_FORCE_DARK);
-      break;
-  }
-
-  g_object_notify_by_pspec (G_OBJECT (self), pspecs[PROP_THEME]);
-}
-
-
-static void
-kgx_application_set_scale (KgxApplication *self,
-                           gdouble         scale)
-{
-  GAction *action;
-
-  g_return_if_fail (KGX_IS_APPLICATION (self));
-
-  self->scale = CLAMP (scale, KGX_FONT_SCALE_MIN, KGX_FONT_SCALE_MAX);
-
-  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-out");
-  g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                               self->scale > KGX_FONT_SCALE_MIN);
-  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-normal");
-  g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                               self->scale != KGX_FONT_SCALE_DEFAULT);
-  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-in");
-  g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                               self->scale < KGX_FONT_SCALE_MAX);
-
-  g_object_notify_by_pspec (G_OBJECT (self), pspecs[PROP_FONT_SCALE]);
-}
-
-
-static void
-kgx_application_set_property (GObject      *object,
-                              guint         property_id,
-                              const GValue *value,
-                              GParamSpec   *pspec)
-{
-  KgxApplication *self = KGX_APPLICATION (object);
-
-  switch (property_id) {
-    case PROP_THEME:
-      kgx_application_set_theme (self, g_value_get_enum (value));
-      break;
-    case PROP_FONT_SCALE:
-      kgx_application_set_scale (self, g_value_get_double (value));
-      break;
-    case PROP_SCROLLBACK_LINES:
-      self->scrollback_lines = g_value_get_int64 (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-static void
-kgx_application_get_property (GObject    *object,
-                              guint       property_id,
-                              GValue     *value,
-                              GParamSpec *pspec)
-{
-  KgxApplication *self = KGX_APPLICATION (object);
-
-  switch (property_id) {
-    case PROP_THEME:
-      g_value_set_enum (value, self->theme);
-      break;
-    case PROP_FONT:
-      g_value_take_boxed (value, kgx_application_get_font (self));
-      break;
-    case PROP_FONT_SCALE:
-      g_value_set_double (value, self->scale);
-      break;
-    case PROP_SCROLLBACK_LINES:
-      g_value_set_int64 (value, self->scrollback_lines);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
 
 static void
 kgx_application_finalize (GObject *object)
@@ -171,8 +54,6 @@ kgx_application_finalize (GObject *object)
   KgxApplication *self = KGX_APPLICATION (object);
 
   g_clear_object (&self->settings);
-  g_clear_object (&self->desktop_interface);
-
   g_clear_pointer (&self->pages, g_tree_unref);
 
   G_OBJECT_CLASS (kgx_application_parent_class)->finalize (object);
@@ -207,9 +88,6 @@ kgx_application_activate (GApplication *app)
 static void
 kgx_application_startup (GApplication *app)
 {
-  KgxApplication    *self = KGX_APPLICATION (app);
-  g_autoptr (GAction) settings_action = NULL;
-
   const char *const new_window_accels[] = { "<shift><primary>n", NULL };
   const char *const new_tab_accels[] = { "<shift><primary>t", NULL };
   const char *const close_tab_accels[] = { "<shift><primary>w", NULL };
@@ -245,14 +123,6 @@ kgx_application_startup (GApplication *app)
                                          "app.zoom-out", zoom_out_accels);
   gtk_application_set_accels_for_action (GTK_APPLICATION (app),
                                          "app.zoom-normal", zoom_normal_accels);
-
-  self->settings = g_settings_new (KGX_APPLICATION_ID);
-  g_settings_bind (self->settings, "theme", app, "theme", G_SETTINGS_BIND_DEFAULT);
-  g_settings_bind (self->settings, "font-scale", app, "font-scale", G_SETTINGS_BIND_DEFAULT);
-  g_settings_bind (self->settings, "scrollback-lines", app, "scrollback-lines", G_SETTINGS_BIND_DEFAULT);
-
-  settings_action = g_settings_create_action (self->settings, "theme");
-  g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (settings_action));
 }
 
 
@@ -340,13 +210,13 @@ kgx_application_command_line (GApplication            *app,
   g_variant_dict_lookup (options, G_OPTION_REMAINING, "^aay", &argv);
 
   if (g_variant_dict_lookup (options, "set-shell", "^as", &shell) && shell) {
-    g_settings_set_strv (self->settings, "shell", shell);
+    kgx_settings_set_custom_shell (self->settings, shell);
 
     return EXIT_SUCCESS;
   }
 
   if (g_variant_dict_lookup (options, "set-scrollback", "x", &scrollback)) {
-    g_settings_set_int64 (self->settings, "scrollback-lines", scrollback);
+    kgx_settings_set_scrollback (self->settings, scrollback);
 
     return EXIT_SUCCESS;
   }
@@ -507,11 +377,9 @@ kgx_application_handle_local_options (GApplication *app,
 static void
 kgx_application_class_init (KgxApplicationClass *klass)
 {
-  GObjectClass      *object_class = G_OBJECT_CLASS (klass);
-  GApplicationClass *app_class    = G_APPLICATION_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GApplicationClass *app_class = G_APPLICATION_CLASS (klass);
 
-  object_class->set_property = kgx_application_set_property;
-  object_class->get_property = kgx_application_get_property;
   object_class->finalize = kgx_application_finalize;
 
   app_class->activate = kgx_application_activate;
@@ -520,59 +388,6 @@ kgx_application_class_init (KgxApplicationClass *klass)
   app_class->local_command_line = kgx_application_local_command_line;
   app_class->command_line = kgx_application_command_line;
   app_class->handle_local_options = kgx_application_handle_local_options;
-
-  /**
-   * KgxApplication:theme:
-   *
-   * The palette to use, one of the values of #KgxTheme
-   *
-   * Officially only "night" exists, "hacker" is just a little fun
-   *
-   * Bound to ‘theme’ GSetting so changes persist
-   *
-   * Stability: Private
-   */
-  pspecs[PROP_THEME] =
-    g_param_spec_enum ("theme", "Theme", "Terminal theme",
-                       KGX_TYPE_THEME, KGX_THEME_NIGHT,
-                       G_PARAM_READWRITE);
-
-  pspecs[PROP_FONT] =
-    g_param_spec_boxed ("font", "Font", "Monospace font",
-                         PANGO_TYPE_FONT_DESCRIPTION,
-                         G_PARAM_READABLE);
-
-  pspecs[PROP_FONT_SCALE] =
-    g_param_spec_double ("font-scale", "Font scale", "Font scaling",
-                         KGX_FONT_SCALE_MIN,
-                         KGX_FONT_SCALE_MAX,
-                         KGX_FONT_SCALE_DEFAULT,
-                         G_PARAM_READWRITE);
-
-  /**
-   * KgxApplication:scrollback-lines:
-   *
-   * How many lines of scrollback #KgxTerminal should keep
-   *
-   * Bound to ‘scrollback-lines’ GSetting so changes persist
-   *
-   * Stability: Private
-   */
-  pspecs[PROP_SCROLLBACK_LINES] =
-    g_param_spec_int64 ("scrollback-lines", "Scrollback Lines", "Size of the scrollback",
-                        G_MININT64, G_MAXINT64, 512,
-                        G_PARAM_READWRITE);
-
-  g_object_class_install_properties (object_class, LAST_PROP, pspecs);
-}
-
-
-static void
-font_changed (GSettings      *settings,
-              const char     *key,
-              KgxApplication *self)
-{
-  g_object_notify_by_pspec (G_OBJECT (self), pspecs[PROP_FONT]);
 }
 
 
@@ -731,11 +546,7 @@ zoom_out_activated (GSimpleAction *action,
 {
   KgxApplication *self = KGX_APPLICATION (data);
 
-  if (self->scale < 0.1) {
-    return;
-  }
-
-  kgx_application_set_scale (self, self->scale - 0.1);
+  kgx_settings_decrease_scale (self->settings);
 }
 
 
@@ -746,7 +557,7 @@ zoom_normal_activated (GSimpleAction *action,
 {
   KgxApplication *self = KGX_APPLICATION (data);
 
-  kgx_application_set_scale (self, KGX_FONT_SCALE_DEFAULT);
+  kgx_settings_reset_scale (self->settings);
 }
 
 
@@ -757,7 +568,7 @@ zoom_in_activated (GSimpleAction *action,
 {
   KgxApplication *self = KGX_APPLICATION (data);
 
-  kgx_application_set_scale (self, self->scale + 0.1);
+  kgx_settings_increase_scale (self->settings);
 }
 
 
@@ -771,9 +582,52 @@ static GActionEntry app_entries[] = {
 };
 
 
+static gboolean
+theme_to_colour_scheme (GBinding     *binding,
+                        const GValue *from_value,
+                        GValue       *to_value,
+                        gpointer      user_data)
+{
+  switch (g_value_get_enum (from_value)) {
+    case KGX_THEME_AUTO:
+      g_value_set_enum (to_value, ADW_COLOR_SCHEME_PREFER_LIGHT);
+      break;
+    case KGX_THEME_DAY:
+      g_value_set_enum (to_value, ADW_COLOR_SCHEME_FORCE_LIGHT);
+      break;
+    case KGX_THEME_NIGHT:
+    case KGX_THEME_HACKER:
+    default:
+      g_value_set_enum (to_value, ADW_COLOR_SCHEME_FORCE_DARK);
+      break;
+  }
+
+  return TRUE;
+}
+
+
+static gboolean
+scale_to_can_reset (GBinding     *binding,
+                    const GValue *from_value,
+                    GValue       *to_value,
+                    gpointer      user_data)
+{
+  double scale = g_value_get_double (from_value);
+
+  g_value_set_boolean (to_value,
+                       fabs (scale - KGX_FONT_SCALE_DEFAULT) > 0.05);
+
+  return TRUE;
+}
+
+
 static void
 kgx_application_init (KgxApplication *self)
 {
+  g_autoptr (GPropertyAction) theme_action = NULL;
+  AdwStyleManager *style_manager = adw_style_manager_get_default ();
+  GAction *action;
+
   g_application_add_main_option_entries (G_APPLICATION (self), entries);
 
   g_action_map_add_action_entries (G_ACTION_MAP (self),
@@ -781,37 +635,32 @@ kgx_application_init (KgxApplication *self)
                                    G_N_ELEMENTS (app_entries),
                                    self);
 
-  self->desktop_interface = g_settings_new (DESKTOP_INTERFACE_SETTINGS_SCHEMA);
-
-  g_signal_connect (self->desktop_interface,
-                    "changed::" MONOSPACE_FONT_KEY_NAME,
-                    G_CALLBACK (font_changed),
-                    self);
-
-  self->pages = g_tree_new_full (kgx_pid_cmp, NULL, NULL, NULL);
-}
+  self->settings = g_object_new (KGX_TYPE_SETTINGS, NULL);
+  g_object_bind_property_full (self->settings, "theme",
+                               style_manager, "color-scheme",
+                               G_BINDING_SYNC_CREATE,
+                               theme_to_colour_scheme, NULL, NULL, NULL);
 
+  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-out");
+  g_object_bind_property (self->settings, "scale-can-decrease",
+                          action, "enabled",
+                          G_BINDING_SYNC_CREATE);
 
-/**
- * kgx_application_get_font:
- * @self: the #KgxApplication
- *
- * Creates a #PangoFontDescription for the system monospace font.
- *
- * Returns: (transfer full): a new #PangoFontDescription
- */
-PangoFontDescription *
-kgx_application_get_font (KgxApplication *self)
-{
-  // Taken from gnome-terminal
-  g_autofree char *font = NULL;
+  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-normal");
+  g_object_bind_property_full (self->settings, "font-scale",
+                               action, "enabled",
+                               G_BINDING_SYNC_CREATE,
+                               scale_to_can_reset, NULL, NULL, NULL);
 
-  g_return_val_if_fail (KGX_IS_APPLICATION (self), NULL);
+  action = g_action_map_lookup_action (G_ACTION_MAP (self), "zoom-in");
+  g_object_bind_property (self->settings, "scale-can-increase",
+                          action, "enabled",
+                          G_BINDING_SYNC_CREATE);
 
-  font = g_settings_get_string (self->desktop_interface,
-                                MONOSPACE_FONT_KEY_NAME);
+  theme_action = g_property_action_new ("theme", self->settings, "theme");
+  g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (theme_action));
 
-  return pango_font_description_from_string (font);
+  self->pages = g_tree_new_full (kgx_pid_cmp, NULL, NULL, NULL);
 }
 
 
@@ -897,32 +746,14 @@ kgx_application_add_terminal (KgxApplication *self,
                               GStrv           argv,
                               const char     *title)
 {
-  g_autofree char *user_shell = vte_get_user_shell ();
   g_autofree char *directory = NULL;
   g_auto (GStrv) shell = NULL;
-  g_auto (GStrv) custom_shell = NULL;
   GtkWindow *window;
   GtkWidget *tab;
   KgxPages *pages;
 
-  if (argv == NULL) {
-    custom_shell = g_settings_get_strv (self->settings, "shell");
-
-    if (g_strv_length (custom_shell) > 0) {
-      shell = g_steal_pointer (&custom_shell);
-    } else if (user_shell != NULL) {
-      shell = g_new0 (char *, 2);
-      shell[0] = g_steal_pointer (&user_shell);
-      shell[1] = NULL;
-    }
-  }
-
-  /* We should probably do something other than /bin/sh  */
-  if (argv == NULL && shell == NULL) {
-    shell = g_new0 (char *, 2);
-    shell[0] = g_strdup ("/bin/sh");
-    shell[1] = NULL;
-    g_warning ("Defaulting to “%s”", shell[0]);
+  if (G_LIKELY (argv == NULL)) {
+    shell = kgx_settings_get_shell (self->settings);
   }
 
   if (working_directory) {
@@ -945,6 +776,7 @@ kgx_application_add_terminal (KgxApplication *self,
   } else {
     window = g_object_new (KGX_TYPE_WINDOW,
                            "application", self,
+                           "settings", self->settings,
                            NULL);
   }
 
diff --git a/src/kgx-application.h b/src/kgx-application.h
index 8a123a8..c396702 100644
--- a/src/kgx-application.h
+++ b/src/kgx-application.h
@@ -26,19 +26,6 @@
 
 G_BEGIN_DECLS
 
-/**
- * DESKTOP_INTERFACE_SETTINGS_SCHEMA:
- * The schema that defines the system fonts
- */
-#define DESKTOP_INTERFACE_SETTINGS_SCHEMA "org.gnome.desktop.interface"
-
-/**
- * MONOSPACE_FONT_KEY_NAME:
- * The name of the key in %DESKTOP_INTERFACE_SETTINGS_SCHEMA for the monospace
- * font
- */
-#define MONOSPACE_FONT_KEY_NAME "monospace-font-name"
-
 #define KGX_DISPLAY_NAME _("Console")
 
 #define KGX_TYPE_APPLICATION (kgx_application_get_type())
@@ -59,20 +46,13 @@ struct _KgxApplication
   AdwApplication            parent_instance;
 
   /*< public >*/
-  KgxTheme                  theme;
-  double                    scale;
-  gint64                    scrollback_lines;
-
-  GSettings                *settings;
-  GSettings                *desktop_interface;
-
   GTree                    *pages;
+  KgxSettings              *settings;
 };
 
 G_DECLARE_FINAL_TYPE (KgxApplication, kgx_application, KGX, APPLICATION, AdwApplication)
 
 
-PangoFontDescription *kgx_application_get_font        (KgxApplication *self);
 void                  kgx_application_add_page        (KgxApplication *self,
                                                        KgxTab         *page);
 KgxTab               *kgx_application_lookup_page     (KgxApplication *self,
diff --git a/src/kgx-window.c b/src/kgx-window.c
index bd32766..c22983e 100644
--- a/src/kgx-window.c
+++ b/src/kgx-window.c
@@ -35,7 +35,6 @@
 
 #include "kgx-window.h"
 #include "kgx-application.h"
-#include "kgx-process.h"
 #include "kgx-close-dialog.h"
 #include "kgx-pages.h"
 #include "kgx-tab-button.h"
@@ -47,80 +46,63 @@ G_DEFINE_TYPE (KgxWindow, kgx_window, ADW_TYPE_APPLICATION_WINDOW)
 
 enum {
   PROP_0,
-  PROP_APPLICATION,
+  PROP_SETTINGS,
   LAST_PROP
 };
 
 static GParamSpec *pspecs[LAST_PROP] = { NULL, };
 
 
-static void
-update_zoom (KgxWindow      *self,
-             KgxApplication *app)
+static gboolean
+scale_to_label (GBinding     *binding,
+                const GValue *from_value,
+                GValue       *to_value,
+                gpointer      user_data)
 {
-  g_autofree char *label = NULL;
-  gdouble zoom;
+  int zoom = round (g_value_get_double (from_value) * 100);
 
-  g_object_get (app,
-                "font-scale", &zoom,
-                NULL);
-
-  label = g_strdup_printf ("%i%%",
-                           (int) round (zoom * 100));
-  gtk_label_set_label (GTK_LABEL (self->zoom_level), label);
-}
+  g_value_take_string (to_value, g_strdup_printf ("%i%%", zoom));
 
-
-static void
-zoomed (GObject *object, GParamSpec *pspec, gpointer data)
-{
-  KgxWindow *self = KGX_WINDOW (data);
-
-  update_zoom (self, KGX_APPLICATION (object));
+  return TRUE;
 }
 
 
 static void
 kgx_window_constructed (GObject *object)
 {
-  KgxWindow       *self = KGX_WINDOW (object);
-  GtkApplication  *application = NULL;
+  KgxWindow *self = KGX_WINDOW (object);
   AdwStyleManager *style_manager;
 
   G_OBJECT_CLASS (kgx_window_parent_class)->constructed (object);
 
-  application = gtk_window_get_application (GTK_WINDOW (self));
   style_manager = adw_style_manager_get_default ();
 
-  g_object_bind_property (application, "theme",
+  g_object_bind_property (self->settings, "theme",
                           self->pages, "theme",
                           G_BINDING_SYNC_CREATE);
-  g_object_bind_property (application, "theme",
+  g_object_bind_property (self->settings, "theme",
                           self->theme_switcher, "theme",
-                          G_BINDING_SYNC_CREATE |
-                          G_BINDING_BIDIRECTIONAL);
+                          G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
   g_object_bind_property (style_manager, "system-supports-color-schemes",
                           self->theme_switcher, "show-system",
                           G_BINDING_SYNC_CREATE);
 
-  g_object_bind_property (application, "font",
+  g_object_bind_property (self->settings, "font",
                           self->pages, "font",
                           G_BINDING_SYNC_CREATE);
 
-  g_object_bind_property (application, "font-scale",
+  g_object_bind_property (self->settings, "font-scale",
                           self->pages, "zoom",
                           G_BINDING_SYNC_CREATE);
 
-  g_object_bind_property (application, "scrollback-lines",
+  g_object_bind_property (self->settings, "scrollback-lines",
                           self->pages, "scrollback-lines",
                           G_BINDING_SYNC_CREATE);
 
-  g_signal_connect_object (application,
-                           "notify::font-scale", G_CALLBACK (zoomed),
-                           self,
-                           0);
-
-  update_zoom (self, KGX_APPLICATION (application));
+  g_object_bind_property_full (self->settings, "font-scale",
+                               self->zoom_level, "label",
+                               G_BINDING_SYNC_CREATE,
+                               scale_to_label, NULL, NULL, NULL);
 }
 
 
@@ -129,6 +111,7 @@ kgx_window_dispose (GObject *object)
 {
   KgxWindow *self = KGX_WINDOW (object);
 
+  g_clear_object (&self->settings);
   g_clear_object (&self->tab_actions);
 
   G_OBJECT_CLASS (kgx_window_parent_class)->dispose (object);
@@ -144,9 +127,8 @@ kgx_window_set_property (GObject      *object,
   KgxWindow *self = KGX_WINDOW (object);
 
   switch (property_id) {
-    case PROP_APPLICATION:
-      gtk_window_set_application (GTK_WINDOW (self),
-                                  g_value_get_object (value));
+    case PROP_SETTINGS:
+      g_set_object (&self->settings, g_value_get_object (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -164,9 +146,8 @@ kgx_window_get_property (GObject    *object,
   KgxWindow *self = KGX_WINDOW (object);
 
   switch (property_id) {
-    case PROP_APPLICATION:
-      g_value_set_object (value,
-                          gtk_window_get_application (GTK_WINDOW (self)));
+    case PROP_SETTINGS:
+      g_value_set_object (value, self->settings);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -262,6 +243,7 @@ create_tearoff_host (KgxPages *pages, KgxWindow *self)
 
   new_window = g_object_new (KGX_TYPE_WINDOW,
                              "application", application,
+                             "settings", self->settings,
                              "default-width", width,
                              "default-height", height,
                              NULL);
@@ -332,17 +314,10 @@ kgx_window_class_init (KgxWindowClass *klass)
 
   window_class->close_request = kgx_window_close_request;
 
-  /**
-   * KgxWindow:application:
-   *
-   * Proxy for #GtkWindow #GtkWindow:application but with %G_PARAM_CONSTRUCT,
-   * simple as that
-   */
-  pspecs[PROP_APPLICATION] =
-    g_param_spec_object ("application", "Application",
-                         "The application the window is part of",
-                         KGX_TYPE_APPLICATION,
-                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+  pspecs[PROP_SETTINGS] =
+    g_param_spec_object ("settings", NULL, NULL,
+                         KGX_TYPE_SETTINGS,
+                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, LAST_PROP, pspecs);
 
diff --git a/src/kgx-window.h b/src/kgx-window.h
index 84ce6b9..2fe538c 100644
--- a/src/kgx-window.h
+++ b/src/kgx-window.h
@@ -34,10 +34,6 @@ G_BEGIN_DECLS
 
 /**
  * KgxWindow:
- * @theme: the palette
- * @working_dir: the working directory of the #KgxTerminal
- * @command: the command to run, %NULL for default shell
- * @close_on_zero: should the window close when the command exits with 0
  * @last_cols: the column width last time we received #GtkWidget::size-allocate
  * @last_rows: the row count last time we received #GtkWidget::size-allocate
  * @timeout: the id of the #GSource used to hide the statusbar
@@ -49,7 +45,6 @@ G_BEGIN_DECLS
  * @exit_message: the #GtkLabel for showing important messages
  * @zoom_level: the #GtkLabel in the #GtkPopover showing the current zoom level
  * @pages: the #KgxPages of #KgxPage current in the window
- * @about_item: the #GtkModelButton for the about item
  */
 struct _KgxWindow
 {
@@ -57,7 +52,7 @@ struct _KgxWindow
   AdwApplicationWindow  parent_instance;
 
   /*< public >*/
-  KgxTheme              theme;
+  KgxSettings          *settings;
 
   /* Size indicator */
   int                   last_cols;


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