[tepl] Panel: class skeleton



commit 0caba2e7850f4394cb6662cf34a308ae3043b273
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Apr 21 13:56:32 2020 +0200

    Panel: class skeleton
    
    The TeplPanel class will replace the following functions:
    - tepl_stack_add_component()
    - tepl_stack_bind_setting()
    - tepl_side_panel_new()
    
    Having a class will be more convenient.

 docs/reference/tepl-docs.xml     |  1 +
 docs/reference/tepl-sections.txt | 16 ++++++++++
 po/POTFILES.in                   |  1 +
 tepl/meson.build                 |  2 ++
 tepl/tepl-panel.c                | 68 ++++++++++++++++++++++++++++++++++++++++
 tepl/tepl-panel.h                | 62 ++++++++++++++++++++++++++++++++++++
 tepl/tepl.h                      |  1 +
 7 files changed, 151 insertions(+)
---
diff --git a/docs/reference/tepl-docs.xml b/docs/reference/tepl-docs.xml
index 594771f..5d23944 100644
--- a/docs/reference/tepl-docs.xml
+++ b/docs/reference/tepl-docs.xml
@@ -42,6 +42,7 @@
 
     <chapter id="panels">
       <title>Side and Bottom Panels</title>
+      <xi:include href="xml/panel.xml"/>
       <xi:include href="xml/side-panel.xml"/>
       <xi:include href="xml/stack.xml"/>
     </chapter>
diff --git a/docs/reference/tepl-sections.txt b/docs/reference/tepl-sections.txt
index 0d584ac..fe67ea6 100644
--- a/docs/reference/tepl-sections.txt
+++ b/docs/reference/tepl-sections.txt
@@ -318,6 +318,22 @@ TeplMetadataManagerPrivate
 tepl_metadata_manager_get_type
 </SECTION>
 
+<SECTION>
+<FILE>panel</FILE>
+TeplPanel
+tepl_panel_new
+<SUBSECTION Standard>
+TEPL_IS_PANEL
+TEPL_IS_PANEL_CLASS
+TEPL_PANEL
+TEPL_PANEL_CLASS
+TEPL_PANEL_GET_CLASS
+TEPL_TYPE_PANEL
+TeplPanelClass
+TeplPanelPrivate
+tepl_panel_get_type
+</SECTION>
+
 <SECTION>
 <FILE>side-panel</FILE>
 tepl_side_panel_new
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d9208c2..fea0b58 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -22,6 +22,7 @@ tepl/tepl-metadata.c
 tepl/tepl-metadata-manager.c
 tepl/tepl-metadata-parser.c
 tepl/tepl-notebook.c
+tepl/tepl-panel.c
 tepl/tepl-side-panel.c
 tepl/tepl-signal-group.c
 tepl/tepl-stack.c
diff --git a/tepl/meson.build b/tepl/meson.build
index 6c11d32..451c5c6 100644
--- a/tepl/meson.build
+++ b/tepl/meson.build
@@ -18,6 +18,7 @@ tepl_public_headers = [
   'tepl-metadata.h',
   'tepl-metadata-manager.h',
   'tepl-notebook.h',
+  'tepl-panel.h',
   'tepl-side-panel.h',
   'tepl-stack.h',
   'tepl-statusbar.h',
@@ -47,6 +48,7 @@ tepl_public_c_files = [
   'tepl-metadata.c',
   'tepl-metadata-manager.c',
   'tepl-notebook.c',
+  'tepl-panel.c',
   'tepl-side-panel.c',
   'tepl-stack.c',
   'tepl-statusbar.c',
diff --git a/tepl/tepl-panel.c b/tepl/tepl-panel.c
new file mode 100644
index 0000000..15cd7eb
--- /dev/null
+++ b/tepl/tepl-panel.c
@@ -0,0 +1,68 @@
+/*
+ * 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-panel.h"
+
+/**
+ * SECTION:panel
+ * @Title: TeplPanel
+ * @Short_description: Side or bottom panel
+ *
+ * #TeplPanel permits to create a side or bottom panel with several components.
+ */
+
+struct _TeplPanelPrivate
+{
+       gint something;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (TeplPanel, tepl_panel, GTK_TYPE_GRID)
+
+static void
+tepl_panel_finalize (GObject *object)
+{
+
+       G_OBJECT_CLASS (tepl_panel_parent_class)->finalize (object);
+}
+
+static void
+tepl_panel_class_init (TeplPanelClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize = tepl_panel_finalize;
+}
+
+static void
+tepl_panel_init (TeplPanel *panel)
+{
+       panel->priv = tepl_panel_get_instance_private (panel);
+}
+
+/**
+ * tepl_panel_new:
+ *
+ * Returns: (transfer floating): a new #TeplPanel.
+ * Since: 5.0
+ */
+TeplPanel *
+tepl_panel_new (void)
+{
+       return g_object_new (TEPL_TYPE_PANEL, NULL);
+}
diff --git a/tepl/tepl-panel.h b/tepl/tepl-panel.h
new file mode 100644
index 0000000..3c81a1c
--- /dev/null
+++ b/tepl/tepl-panel.h
@@ -0,0 +1,62 @@
+/*
+ * 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_PANEL_H
+#define TEPL_PANEL_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_PANEL             (tepl_panel_get_type ())
+#define TEPL_PANEL(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEPL_TYPE_PANEL, TeplPanel))
+#define TEPL_PANEL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), TEPL_TYPE_PANEL, TeplPanelClass))
+#define TEPL_IS_PANEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEPL_TYPE_PANEL))
+#define TEPL_IS_PANEL_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), TEPL_TYPE_PANEL))
+#define TEPL_PANEL_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), TEPL_TYPE_PANEL, TeplPanelClass))
+
+typedef struct _TeplPanel         TeplPanel;
+typedef struct _TeplPanelClass    TeplPanelClass;
+typedef struct _TeplPanelPrivate  TeplPanelPrivate;
+
+struct _TeplPanel
+{
+       GtkGrid parent;
+
+       TeplPanelPrivate *priv;
+};
+
+struct _TeplPanelClass
+{
+       GtkGridClass parent_class;
+
+       gpointer padding[12];
+};
+
+GType          tepl_panel_get_type     (void);
+
+TeplPanel *    tepl_panel_new          (void);
+
+G_END_DECLS
+
+#endif /* TEPL_PANEL_H */
diff --git a/tepl/tepl.h b/tepl/tepl.h
index 1b933cf..6488fa7 100644
--- a/tepl/tepl.h
+++ b/tepl/tepl.h
@@ -44,6 +44,7 @@
 #include <tepl/tepl-metadata.h>
 #include <tepl/tepl-metadata-manager.h>
 #include <tepl/tepl-notebook.h>
+#include <tepl/tepl-panel.h>
 #include <tepl/tepl-side-panel.h>
 #include <tepl/tepl-stack.h>
 #include <tepl/tepl-statusbar.h>


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