[tepl] StyleSchemeChooserWidget: class skeleton
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] StyleSchemeChooserWidget: class skeleton
- Date: Wed, 22 Apr 2020 13:58:14 +0000 (UTC)
commit 86e309d32a4dc6ad9b65f152a077bb862dc4fb07
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Apr 22 00:17:06 2020 +0200
StyleSchemeChooserWidget: class skeleton
po/POTFILES.in | 1 +
tepl/meson.build | 2 +
tepl/tepl-style-scheme-chooser-widget.c | 136 ++++++++++++++++++++++++++++++++
tepl/tepl-style-scheme-chooser-widget.h | 63 +++++++++++++++
tepl/tepl.h | 1 +
5 files changed, 203 insertions(+)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2ebf515..771f78a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -25,6 +25,7 @@ tepl/tepl-notebook.c
tepl/tepl-panel.c
tepl/tepl-signal-group.c
tepl/tepl-statusbar.c
+tepl/tepl-style-scheme-chooser-widget.c
tepl/tepl-tab.c
tepl/tepl-tab-group.c
tepl/tepl-tab-label.c
diff --git a/tepl/meson.build b/tepl/meson.build
index dcdbafb..b4964d2 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -20,6 +20,7 @@ tepl_public_headers = [
'tepl-notebook.h',
'tepl-panel.h',
'tepl-statusbar.h',
+ 'tepl-style-scheme-chooser-widget.h',
'tepl-tab.h',
'tepl-tab-group.h',
'tepl-tab-label.h',
@@ -48,6 +49,7 @@ tepl_public_c_files = [
'tepl-notebook.c',
'tepl-panel.c',
'tepl-statusbar.c',
+ 'tepl-style-scheme-chooser-widget.c',
'tepl-tab.c',
'tepl-tab-group.c',
'tepl-tab-label.c',
diff --git a/tepl/tepl-style-scheme-chooser-widget.c b/tepl/tepl-style-scheme-chooser-widget.c
new file mode 100644
index 0000000..fd62e89
--- /dev/null
+++ b/tepl/tepl-style-scheme-chooser-widget.c
@@ -0,0 +1,136 @@
+/*
+ * This file is part of Tepl, a text editor library.
+ *
+ * Copyright 2020 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Tepl 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.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Tepl 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tepl-style-scheme-chooser-widget.h"
+#include <gtksourceview/gtksource.h>
+
+struct _TeplStyleSchemeChooserWidgetPrivate
+{
+ gint something;
+};
+
+enum
+{
+ PROP_0,
+ PROP_STYLE_SCHEME,
+ N_PROPERTIES
+};
+
+static void gtk_source_style_scheme_chooser_interface_init (gpointer g_iface,
+ gpointer iface_data);
+
+G_DEFINE_TYPE_WITH_CODE (TeplStyleSchemeChooserWidget,
+ tepl_style_scheme_chooser_widget,
+ GTK_TYPE_BIN,
+ G_ADD_PRIVATE (TeplStyleSchemeChooserWidget)
+ G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_STYLE_SCHEME_CHOOSER,
+ gtk_source_style_scheme_chooser_interface_init))
+
+static void
+tepl_style_scheme_chooser_widget_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceStyleSchemeChooser *chooser = GTK_SOURCE_STYLE_SCHEME_CHOOSER (object);
+
+ switch (prop_id)
+ {
+ case PROP_STYLE_SCHEME:
+ g_value_set_object (value, gtk_source_style_scheme_chooser_get_style_scheme
(chooser));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+tepl_style_scheme_chooser_widget_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceStyleSchemeChooser *chooser = GTK_SOURCE_STYLE_SCHEME_CHOOSER (object);
+
+ switch (prop_id)
+ {
+ case PROP_STYLE_SCHEME:
+ gtk_source_style_scheme_chooser_set_style_scheme (chooser, g_value_get_object
(value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+tepl_style_scheme_chooser_widget_dispose (GObject *object)
+{
+
+ G_OBJECT_CLASS (tepl_style_scheme_chooser_widget_parent_class)->dispose (object);
+}
+
+static void
+tepl_style_scheme_chooser_widget_class_init (TeplStyleSchemeChooserWidgetClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->get_property = tepl_style_scheme_chooser_widget_get_property;
+ object_class->set_property = tepl_style_scheme_chooser_widget_set_property;
+ object_class->dispose = tepl_style_scheme_chooser_widget_dispose;
+
+ g_object_class_override_property (object_class, PROP_STYLE_SCHEME, "style-scheme");
+}
+
+static GtkSourceStyleScheme *
+tepl_style_scheme_chooser_widget_get_style_scheme (GtkSourceStyleSchemeChooser *chooser)
+{
+ return NULL;
+}
+
+static void
+tepl_style_scheme_chooser_widget_set_style_scheme (GtkSourceStyleSchemeChooser *chooser,
+ GtkSourceStyleScheme *scheme)
+{
+}
+
+static void
+gtk_source_style_scheme_chooser_interface_init (gpointer g_iface,
+ gpointer iface_data)
+{
+ GtkSourceStyleSchemeChooserInterface *interface = g_iface;
+
+ interface->get_style_scheme = tepl_style_scheme_chooser_widget_get_style_scheme;
+ interface->set_style_scheme = tepl_style_scheme_chooser_widget_set_style_scheme;
+}
+
+static void
+tepl_style_scheme_chooser_widget_init (TeplStyleSchemeChooserWidget *chooser)
+{
+ chooser->priv = tepl_style_scheme_chooser_widget_get_instance_private (chooser);
+}
+
+TeplStyleSchemeChooserWidget *
+tepl_style_scheme_chooser_widget_new (void)
+{
+ return g_object_new (TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET, NULL);
+}
diff --git a/tepl/tepl-style-scheme-chooser-widget.h b/tepl/tepl-style-scheme-chooser-widget.h
new file mode 100644
index 0000000..c2ddfee
--- /dev/null
+++ b/tepl/tepl-style-scheme-chooser-widget.h
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Tepl, a text editor library.
+ *
+ * Copyright 2020 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Tepl 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.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Tepl 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEPL_STYLE_SCHEME_CHOOSER_WIDGET_H
+#define TEPL_STYLE_SCHEME_CHOOSER_WIDGET_H
+
+#if !defined (TEPL_H_INSIDE) && !defined (TEPL_COMPILATION)
+#error "Only <tepl/tepl.h> can be included directly."
+#endif
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET (tepl_style_scheme_chooser_widget_get_type ())
+#define TEPL_STYLE_SCHEME_CHOOSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET, TeplStyleSchemeChooserWidget))
+#define TEPL_STYLE_SCHEME_CHOOSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET, TeplStyleSchemeChooserWidgetClass))
+#define TEPL_IS_STYLE_SCHEME_CHOOSER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET))
+#define TEPL_IS_STYLE_SCHEME_CHOOSER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET))
+#define TEPL_STYLE_SCHEME_CHOOSER_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
TEPL_TYPE_STYLE_SCHEME_CHOOSER_WIDGET, TeplStyleSchemeChooserWidgetClass))
+
+typedef struct _TeplStyleSchemeChooserWidget TeplStyleSchemeChooserWidget;
+typedef struct _TeplStyleSchemeChooserWidgetClass TeplStyleSchemeChooserWidgetClass;
+typedef struct _TeplStyleSchemeChooserWidgetPrivate TeplStyleSchemeChooserWidgetPrivate;
+
+struct _TeplStyleSchemeChooserWidget
+{
+ GtkBin parent;
+
+ TeplStyleSchemeChooserWidgetPrivate *priv;
+};
+
+struct _TeplStyleSchemeChooserWidgetClass
+{
+ GtkBinClass parent_class;
+
+ gpointer padding[12];
+};
+
+GType tepl_style_scheme_chooser_widget_get_type (void);
+
+TeplStyleSchemeChooserWidget *
+ tepl_style_scheme_chooser_widget_new (void);
+
+G_END_DECLS
+
+#endif /* TEPL_STYLE_SCHEME_CHOOSER_WIDGET_H */
diff --git a/tepl/tepl.h b/tepl/tepl.h
index 10dc9df..d32aad8 100644
--- a/tepl/tepl.h
+++ b/tepl/tepl.h
@@ -46,6 +46,7 @@
#include <tepl/tepl-notebook.h>
#include <tepl/tepl-panel.h>
#include <tepl/tepl-statusbar.h>
+#include <tepl/tepl-style-scheme-chooser-widget.h>
#include <tepl/tepl-tab.h>
#include <tepl/tepl-tab-group.h>
#include <tepl/tepl-tab-label.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]