[dconf-editor] Introduce BaseApplication.



commit 799cfcc457840042d2c580f4a694caa17f05b4b8
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Jan 13 05:23:11 2019 +0100

    Introduce BaseApplication.
    
    Just an interface to allow calling the application
    instance methods without exactly knowing its type.

 editor/base-window.vala  | 7 ++++++-
 editor/dconf-editor.vala | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/editor/base-window.vala b/editor/base-window.vala
index 395a350..2d8abf1 100644
--- a/editor/base-window.vala
+++ b/editor/base-window.vala
@@ -17,6 +17,11 @@
 
 using Gtk;
 
+private interface BaseApplication : Gtk.Application
+{
+    internal abstract void copy (string text);
+}
+
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/base-window.ui")]
 private class BaseWindow : AdaptativeWindow, AdaptativeWidget
 {
@@ -178,7 +183,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
     private inline void copy_text (string text)
         requires (!is_empty_text (text))
     {
-        ((ConfigurationEditor) get_application ()).copy ((!) text);
+        ((BaseApplication) get_application ()).copy ((!) text);
     }
 
     /*\
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 0af2cdf..4eaf869 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -15,7 +15,7 @@
   along with Dconf Editor.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-private class ConfigurationEditor : Gtk.Application
+private class ConfigurationEditor : Gtk.Application, BaseApplication
 {
     /* Translators: application name, as used in the window manager, the window title, the about dialog... */
     internal const string PROGRAM_NAME = _("dconf Editor");


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