[console/zbrown/quick-ci-check: 5/5] settings: move constants from terminal




commit bddce08b4312b2450abf75bb6c5628896ba838da
Author: Zander Brown <zbrown gnome org>
Date:   Wed Aug 24 13:28:57 2022 +0100

    settings: move constants from terminal
    
    They never really made sense to be there in the first place, and now we
    have a better place: KgxSettings
    
    Happily this also cleans up includes a bit, and sets some ground work
    for KgxSettings actually being used

 src/kgx-application.h    |  3 +-
 src/kgx-pages.c          |  2 +-
 src/kgx-settings.c       |  2 +-
 src/kgx-settings.h       | 44 ++++++++++++++++++++++++-
 src/kgx-tab.c            |  4 ++-
 src/kgx-terminal.c       | 33 +++++++++++++++++--
 src/kgx-terminal.h       | 86 ++----------------------------------------------
 src/kgx-theme-switcher.c |  4 +--
 src/kgx-window.h         |  2 +-
 src/meson.build          |  2 +-
 10 files changed, 86 insertions(+), 96 deletions(-)
---
diff --git a/src/kgx-application.h b/src/kgx-application.h
index 4aa879b..8a123a8 100644
--- a/src/kgx-application.h
+++ b/src/kgx-application.h
@@ -20,10 +20,9 @@
 
 #include <gtk/gtk.h>
 
-#include "kgx-process.h"
 #include "kgx-window.h"
-#include "kgx-terminal.h"
 #include "kgx-tab.h"
+#include "kgx-settings.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/kgx-pages.c b/src/kgx-pages.c
index 6e1298e..a4c4938 100644
--- a/src/kgx-pages.c
+++ b/src/kgx-pages.c
@@ -31,7 +31,7 @@
 #include "kgx-close-dialog.h"
 #include "kgx-pages.h"
 #include "kgx-tab.h"
-#include "kgx-terminal.h"
+#include "kgx-settings.h"
 #include "kgx-marshals.h"
 
 
diff --git a/src/kgx-settings.c b/src/kgx-settings.c
index 2337cb3..9a4c7eb 100644
--- a/src/kgx-settings.c
+++ b/src/kgx-settings.c
@@ -33,9 +33,9 @@
 #include "kgx-config.h"
 
 #include <gio/gio.h>
+#include <vte/vte.h>
 
 #include "kgx-settings.h"
-#include "kgx-terminal.h"
 
 
 /**
diff --git a/src/kgx-settings.h b/src/kgx-settings.h
index 2881071..8c000c0 100644
--- a/src/kgx-settings.h
+++ b/src/kgx-settings.h
@@ -21,10 +21,52 @@
 #include <glib-object.h>
 #include <pango/pango.h>
 
-#include "kgx-terminal.h"
+#include "kgx-enums.h"
 
 G_BEGIN_DECLS
 
+
+/**
+ * KgxTheme:
+ * @KGX_THEME_AUTO: Matches %KGX_THEME_DAY or %KGX_THEME_NIGHT depending on
+ *                  the user's global setting
+ * @KGX_THEME_NIGHT: The default, dark, theme
+ * @KGX_THEME_DAY: Alternate, light, theme
+ * @KGX_THEME_HACKER: Little easter egg theme
+ *
+ * Until [meson#1687](https://github.com/mesonbuild/meson/issues/1687) is
+ * resolved this enum must be manually kept in sync with
+ * the ‘Theme’ enum in our gschema
+ */
+typedef enum /*< enum,prefix=KGX >*/ {
+  KGX_THEME_AUTO = 0,   /*< nick=auto >*/
+  KGX_THEME_NIGHT = 1,  /*< nick=night >*/
+  KGX_THEME_DAY = 2,    /*< nick=day >*/
+  KGX_THEME_HACKER = 3, /*< nick=hacker >*/
+} KgxTheme;
+
+
+/**
+ * KGX_FONT_SCALE_MIN:
+ * The smallest font scale/zoom
+ */
+#define KGX_FONT_SCALE_MIN 0.5
+
+
+/**
+ * KGX_FONT_SCALE_MAX:
+ * The largest font scale/zoom
+ */
+#define KGX_FONT_SCALE_MAX 4.0
+
+
+/**
+ * KGX_FONT_SCALE_DEFAULT:
+ * The standard font scale/zoom
+ */
+#define KGX_FONT_SCALE_DEFAULT 1.0
+
+
 #define KGX_TYPE_SETTINGS kgx_settings_get_type ()
 
 G_DECLARE_FINAL_TYPE (KgxSettings, kgx_settings, KGX, SETTINGS, GObject)
diff --git a/src/kgx-tab.c b/src/kgx-tab.c
index 0ddfc70..983c495 100644
--- a/src/kgx-tab.c
+++ b/src/kgx-tab.c
@@ -22,14 +22,16 @@
  * @short_description: Base for things in a #KgxPages
  */
 
+#include "kgx-config.h"
+
 #include <glib/gi18n.h>
 #define PCRE2_CODE_UNIT_WIDTH 0
 #include <pcre2.h>
 
-#include "kgx-config.h"
 #include "kgx-tab.h"
 #include "kgx-pages.h"
 #include "kgx-terminal.h"
+#include "kgx-settings.h"
 #include "kgx-util.h"
 #include "kgx-application.h"
 #include "kgx-marshals.h"
diff --git a/src/kgx-terminal.c b/src/kgx-terminal.c
index a50106d..7fa18b7 100644
--- a/src/kgx-terminal.c
+++ b/src/kgx-terminal.c
@@ -25,6 +25,8 @@
  * menu (via #GtkPopover) and link detection
  */
 
+#include "kgx-config.h"
+
 #include <glib/gi18n.h>
 #include <adwaita.h>
 #include <vte/vte.h>
@@ -34,8 +36,8 @@
 #include "rgba.h"
 #include "xdg-fm1.h"
 
-#include "kgx-config.h"
 #include "kgx-terminal.h"
+#include "kgx-settings.h"
 #include "kgx-marshals.h"
 
 /*       Regex adapted from TerminalWidget.vala in Pantheon Terminal       */
@@ -56,7 +58,9 @@
 #define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
 #define URLPATH "(?:(/" PATHCHARS_CLASS "+(?:[(]" PATHCHARS_CLASS "*[)])*" PATHCHARS_CLASS "*)*" 
PATHTERM_CLASS ")?"
 
-static const gchar* links[KGX_TERMINAL_N_LINK_REGEX] = {
+#define KGX_TERMINAL_N_LINK_REGEX 5
+
+static const char *links[KGX_TERMINAL_N_LINK_REGEX] = {
   SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH,
   "(?:www|ftp)" HOSTCHARS_CLASS "*\\." HOST PORT URLPATH,
   "(?:callto:|h323:|sip:)" USERCHARS_CLASS "[" USERCHARS ".]*(?:" PORT "/[a-z0-9]+)?\\@" HOST,
@@ -66,6 +70,31 @@ static const gchar* links[KGX_TERMINAL_N_LINK_REGEX] = {
 
 /*       Regex adapted from TerminalWidget.vala in Pantheon Terminal       */
 
+/**
+ * KgxTerminal:
+ * @theme: the palette to use, see #KgxTerminal:theme
+ * @actions: action map for the context menu
+ * @current_url: the address under the cursor
+ * @match_id: regex ids for finding hyperlinks
+ *
+ * Stability: Private
+ */
+struct _KgxTerminal {
+  /*< private >*/
+  VteTerminal parent_instance;
+
+  /*< public >*/
+  KgxTheme    theme;
+  GtkWidget  *popup_menu;
+
+  /* Hyperlinks */
+  char       *current_url;
+  int         match_id[KGX_TERMINAL_N_LINK_REGEX];
+
+  gboolean    popup_is_touch;
+};
+
+
 G_DEFINE_TYPE (KgxTerminal, kgx_terminal, VTE_TYPE_TERMINAL)
 
 enum {
diff --git a/src/kgx-terminal.h b/src/kgx-terminal.h
index 6c689d4..be56ec7 100644
--- a/src/kgx-terminal.h
+++ b/src/kgx-terminal.h
@@ -18,94 +18,12 @@
 
 #pragma once
 
-#include <gtk/gtk.h>
+#include <glib-object.h>
 #include <vte/vte.h>
 
-#include "kgx-enums.h"
-
 G_BEGIN_DECLS
 
-/**
- * KgxTheme:
- * @KGX_THEME_AUTO: Matches %KGX_THEME_DAY or %KGX_THEME_NIGHT depending on the
- *     system preferences
- * @KGX_THEME_NIGHT: The default, public, theme
- * @KGX_THEME_DAY: Alternate, light theme
- * @KGX_THEME_HACKER: Little easter egg theme
- *
- * Until [meson#1687](https://github.com/mesonbuild/meson/issues/1687) is
- * resolved this enum must be manually kept in sync with
- * the ‘Theme’ enum in the gschema
- */
-typedef enum /*< enum,prefix=KGX >*/
-{
-  KGX_THEME_AUTO = 0,   /*< nick=auto >*/
-  KGX_THEME_NIGHT = 1,  /*< nick=night >*/
-  KGX_THEME_DAY = 2,    /*< nick=day >*/
-  KGX_THEME_HACKER = 3, /*< nick=hacker >*/
-} KgxTheme;
-
-/**
- * KGX_TERMINAL_N_LINK_REGEX:
- * The number of regexs use to search for hyperlinks
- *
- * Stability: Private
- */
-#define KGX_TERMINAL_N_LINK_REGEX 5
-
-
-/**
- * KGX_FONT_SCALE_MIN:
- * The smallest font scale/zoom
- *
- * Stability: Private
- */
-#define KGX_FONT_SCALE_MIN 0.5
-
-
-/**
- * KGX_FONT_SCALE_MAX:
- * The largest font scale/zoom
- *
- * Stability: Private
- */
-#define KGX_FONT_SCALE_MAX 4.0
-
-
-/**
- * KGX_FONT_SCALE_DEFAULT:
- * The standard font scale/zoom
- *
- * Stability: Private
- */
-#define KGX_FONT_SCALE_DEFAULT 1.0
-
-
-#define KGX_TYPE_TERMINAL (kgx_terminal_get_type())
-
-/**
- * KgxTerminal:
- * @theme: the palette to use, see #KgxTerminal:theme
- * @actions: action map for the context menu
- * @current_url: the address under the cursor
- * @match_id: regex ids for finding hyperlinks
- *
- * Stability: Private
- */
-struct _KgxTerminal {
-  /*< private >*/
-  VteTerminal parent_instance;
-
-  /*< public >*/
-  KgxTheme    theme;
-  GtkWidget  *popup_menu;
-
-  /* Hyperlinks */
-  char       *current_url;
-  int         match_id[KGX_TERMINAL_N_LINK_REGEX];
-
-  gboolean    popup_is_touch;
-};
+#define KGX_TYPE_TERMINAL kgx_terminal_get_type()
 
 G_DECLARE_FINAL_TYPE (KgxTerminal, kgx_terminal, KGX, TERMINAL, VteTerminal)
 
diff --git a/src/kgx-theme-switcher.c b/src/kgx-theme-switcher.c
index 04d2f62..05a45d3 100644
--- a/src/kgx-theme-switcher.c
+++ b/src/kgx-theme-switcher.c
@@ -17,9 +17,9 @@
  */
 
 #include "kgx-config.h"
-#include "kgx-theme-switcher.h"
 
-#include "kgx-terminal.h"
+#include "kgx-theme-switcher.h"
+#include "kgx-settings.h"
 
 
 struct _KgxThemeSwitcher {
diff --git a/src/kgx-window.h b/src/kgx-window.h
index b1610ab..84ce6b9 100644
--- a/src/kgx-window.h
+++ b/src/kgx-window.h
@@ -21,7 +21,7 @@
 #include <gtk/gtk.h>
 #include <adwaita.h>
 
-#include "kgx-terminal.h"
+#include "kgx-settings.h"
 #include "kgx-pages.h"
 
 G_BEGIN_DECLS
diff --git a/src/meson.build b/src/meson.build
index ac27d3d..04c9b85 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -75,7 +75,7 @@ kgx_sources += gnome.gdbus_codegen('xdg-fm1',
 kgx_enums = gnome.mkenums_simple('kgx-enums',
                                     sources: [
                                       'kgx-close-dialog.h',
-                                      'kgx-terminal.h',
+                                      'kgx-settings.h',
                                       'kgx-tab.h'
                                     ])
 


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