[glib/wip/spell-checking: 2/2] GSpellCheckingBackend class



commit 06860dca4c3c05a2e2be7cf526d8443bf6373ace
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 12 01:39:14 2013 +0100

    GSpellCheckingBackend class

 gio/Makefile.am             |    2 +
 gio/giomodule.c             |    4 +++
 gio/gspellcheckingbackend.c |   62 +++++++++++++++++++++++++++++++++++++++++++
 gio/gspellcheckingbackend.h |   59 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 127 insertions(+), 0 deletions(-)
---
diff --git a/gio/Makefile.am b/gio/Makefile.am
index b8d90cf..fb77ba4 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -443,6 +443,7 @@ libgio_2_0_la_SOURCES =             \
        gsubprocesslauncher-private.h   \
        gsocketservice.c        \
        gspellchecker.c         \
+       gspellcheckingbackend.c \
        gsrvtarget.c            \
        gsimpleproxyresolver.c  \
        gtask.c                 \
@@ -603,6 +604,7 @@ gio_headers =                       \
        gsocketlistener.h       \
        gsocketservice.h        \
        gspellchecker.h         \
+       gspellcheckingbackend.h \
        gsrvtarget.h            \
        gsimpleproxyresolver.h  \
        gtask.h                 \
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 17d55de..28967f5 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -38,6 +38,7 @@
 #include "gtlsbackend.h"
 #include "gvfs.h"
 #include "gnotificationbackend.h"
+#include "gspellcheckingbackend.h"
 #ifdef G_OS_WIN32
 #include "gregistrysettingsbackend.h"
 #endif
@@ -1006,6 +1007,9 @@ _g_io_modules_ensure_extension_points_registered (void)
 
       ep = g_io_extension_point_register (G_NOTIFICATION_BACKEND_EXTENSION_POINT_NAME);
       g_io_extension_point_set_required_type (ep, G_TYPE_NOTIFICATION_BACKEND);
+
+      ep = g_io_extension_point_register (G_SPELL_CHECKING_BACKEND_EXTENSION_POINT_NAME);
+      g_io_extension_point_set_required_type (ep, G_TYPE_SPELL_CHECKING_BACKEND);
     }
   
   G_UNLOCK (registered_extensions);
diff --git a/gio/gspellcheckingbackend.c b/gio/gspellcheckingbackend.c
new file mode 100644
index 0000000..f8c29a9
--- /dev/null
+++ b/gio/gspellcheckingbackend.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2013 - Sébastien Wilmet
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Sébastien Wilmet <swilmet gnome org>
+ */
+
+#include "gspellcheckingbackend.h"
+#include "giomodule-priv.h"
+
+typedef struct
+{
+  gint something;
+} GSpellCheckingBackendPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GSpellCheckingBackend, g_spell_checking_backend, G_TYPE_OBJECT)
+
+static void
+g_spell_checking_backend_finalize (GObject *object)
+{
+
+  G_OBJECT_CLASS (g_spell_checking_backend_parent_class)->finalize (object);
+}
+
+static void
+g_spell_checking_backend_class_init (GSpellCheckingBackendClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = g_spell_checking_backend_finalize;
+}
+
+static void
+g_spell_checking_backend_init (GSpellCheckingBackend *self)
+{
+}
+
+GSpellCheckingBackend *
+g_spell_checking_backend_new_default (void)
+{
+  GType backend_type;
+
+  backend_type = _g_io_module_get_default_type (G_SPELL_CHECKING_BACKEND_EXTENSION_POINT_NAME,
+                                                "GSPELL_CHECKING_BACKEND",
+                                                G_STRUCT_OFFSET (GSpellCheckingBackendClass, is_supported));
+
+  return g_object_new (backend_type, NULL);
+}
diff --git a/gio/gspellcheckingbackend.h b/gio/gspellcheckingbackend.h
new file mode 100644
index 0000000..0d4abf1
--- /dev/null
+++ b/gio/gspellcheckingbackend.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2013 - Sébastien Wilmet
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Sébastien Wilmet <swilmet gnome org>
+ */
+
+#ifndef __G_SPELL_CHECKING_BACKEND_H__
+#define __G_SPELL_CHECKING_BACKEND_H__
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_SPELL_CHECKING_BACKEND             (g_spell_checking_backend_get_type ())
+#define G_SPELL_CHECKING_BACKEND(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
G_TYPE_SPELL_CHECKING_BACKEND, GSpellCheckingBackend))
+#define G_SPELL_CHECKING_BACKEND_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), 
G_TYPE_SPELL_CHECKING_BACKEND, GSpellCheckingBackendClass))
+#define G_IS_SPELL_CHECKING_BACKEND(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
G_TYPE_SPELL_CHECKING_BACKEND))
+#define G_IS_SPELL_CHECKING_BACKEND_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
G_TYPE_SPELL_CHECKING_BACKEND))
+#define G_SPELL_CHECKING_BACKEND_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
G_TYPE_SPELL_CHECKING_BACKEND, GSpellCheckingBackendClass))
+
+#define G_SPELL_CHECKING_BACKEND_EXTENSION_POINT_NAME "gspellcheckingbackend"
+
+typedef struct _GSpellCheckingBackend      GSpellCheckingBackend;
+typedef struct _GSpellCheckingBackendClass GSpellCheckingBackendClass;
+
+struct _GSpellCheckingBackend
+{
+  GObject parent;
+};
+
+struct _GSpellCheckingBackendClass
+{
+  GObjectClass parent_class;
+
+  gboolean  (*is_supported)             (void);
+};
+
+GType                    g_spell_checking_backend_get_type          (void) G_GNUC_CONST;
+
+GSpellCheckingBackend   *g_spell_checking_backend_new_default       (void);
+
+G_END_DECLS
+
+#endif /* __G_SPELL_CHECKING_BACKEND_H__ */


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