[bijiben/wip/sadiq/rewrite] Add plain note class



commit 054835360772da6facca447e34094c1add1760f2
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Sun Feb 25 12:52:42 2018 +0530

    Add plain note class

 src/notes/bjb-plain-note.c |  142 ++++++++++++++++++++++++++++++++++++++++++++
 src/notes/bjb-plain-note.h |   35 +++++++++++
 2 files changed, 177 insertions(+), 0 deletions(-)
---
diff --git a/src/notes/bjb-plain-note.c b/src/notes/bjb-plain-note.c
new file mode 100644
index 0000000..ee4a4a9
--- /dev/null
+++ b/src/notes/bjb-plain-note.c
@@ -0,0 +1,142 @@
+#define G_LOG_DOMAIN "bjb-plain-note"
+
+#include "config.h"
+
+#include "bjb-trace.h"
+
+#include "bjb-plain-note.h"
+
+/**
+ * SECTION: bjb-plain-note
+ * @title: BjbPlainNote
+ * @short_description:
+ * @include: "bjb-plain-note.h"
+ *
+ *
+ */
+
+struct _BjbPlainNote
+{
+  BjbNote parent_instance;
+};
+
+G_DEFINE_TYPE (BjbPlainNote, bjb_plain_note, BJB_NOTE)
+
+enum {
+  PROP_0,
+
+  N_PROPS
+};
+
+enum {
+
+  N_SIGNALS
+};
+
+static GParamSpec *properties[N_PROPS];
+static guint signals[N_SIGNALS];
+
+static void
+bjb_plain_note_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+  BjbPlainNote *self = (BjbPlainNote *)object;
+  BjbPlainNotePrivate *priv = bjb_plain_note_get_instance_private (self);
+
+  switch (prop_id)
+    {
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+bjb_plain_note_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+  BjbPlainNote *self = (BjbPlainNote *)object;
+  BjbPlainNotePrivate *priv = bjb_plain_note_get_instance_private (self);
+
+  switch (prop_id)
+    {
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+bjb_plain_note_dispose (GObject *object)
+{
+  BjbPlainNote *self = (BjbPlainNote *)object;
+  BjbPlainNotePrivate *priv = bjb_plain_note_get_instance_private (self);
+
+  BJB_ENTRY;
+
+
+
+  G_OBJECT_CLASS (bjb_plain_note_parent_class)->dispose (object);
+
+  BJB_EXIT;
+}
+
+static void
+bjb_plain_note_finalize (GObject *object)
+{
+  BjbPlainNote *self = (BjbPlainNote *)object;
+  BjbPlainNotePrivate *priv = bjb_plain_note_get_instance_private (self);
+
+  BJB_ENTRY;
+
+
+
+  G_OBJECT_CLASS (bjb_plain_note_parent_class)->finalize (object);
+
+  BJB_EXIT;
+}
+
+static void
+bjb_plain_note_class_init (BjbPlainNoteClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = bjb_plain_note_get_property;
+  object_class->set_property = bjb_plain_note_set_property;
+  object_class->dispose = bjb_plain_note_dispose;
+  object_class->finalize = bjb_plain_note_finalize;
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
+}
+
+static void
+bjb_plain_note_init (BjbPlainNote *self)
+{
+  BJB_ENTRY;
+
+
+
+  BJB_EXIT;
+}
+
+BjbPlainNote *
+bjb_plain_note_new (void)
+{
+  return g_object_new (BJB_TYPE_PLAIN_NOTE,
+                       NULL);
+}
+
+BjbPlainNote *
+bjb_pain_note_new_from_data (const gchar *data)
+{
+  gchar **all_content;
+
+  if (data == NULL)
+    return bjb_plain_note_new ();
+
+  all_content = bjb_plain_note_parse_data (data);
+}
diff --git a/src/notes/bjb-plain-note.h b/src/notes/bjb-plain-note.h
new file mode 100644
index 0000000..3c212c0
--- /dev/null
+++ b/src/notes/bjb-plain-note.h
@@ -0,0 +1,35 @@
+/* bjb-plain-note.h
+ *
+ * Copyright 2018 Mohammed Sadiq <sadiq sadiqpk org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define BJB_TYPE_PLAIN_NOTE (bjb_plain_note_get_type ())
+
+G_DECLARE_FINAL_TYPE (BjbPlainNote, bjb_plain_note, BJB, PLAIN_NOTE, BjbNote)
+
+BjbPlainNote *bjb_plain_note_new (void);
+BjbPlainNote *bjb_plain_note_new_from_data (const gchar *text);
+
+G_END_DECLS


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