1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4
* Copyright (C) Philip Withnall 2008 <philip@tecnocode.co.uk>
6
* Almanah is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* Almanah is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with Almanah. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef ALMANAH_ENTRY_H
21
#define ALMANAH_ENTRY_H
24
#include <glib-object.h>
29
ALMANAH_ENTRY_EDITABLE = 1,
30
ALMANAH_ENTRY_FUTURE = 2,
31
ALMANAH_ENTRY_PAST = 0
32
} AlmanahEntryEditability;
34
/* The number of days after which a diary entry requires confirmation to be edited */
35
#define ALMANAH_ENTRY_CUTOFF_AGE 14
37
#define ALMANAH_TYPE_ENTRY (almanah_entry_get_type ())
38
#define ALMANAH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ALMANAH_TYPE_ENTRY, AlmanahEntry))
39
#define ALMANAH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ALMANAH_TYPE_ENTRY, AlmanahEntryClass))
40
#define ALMANAH_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ALMANAH_TYPE_ENTRY))
41
#define ALMANAH_IS_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ALMANAH_TYPE_ENTRY))
42
#define ALMANAH_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ALMANAH_TYPE_ENTRY, AlmanahEntryClass))
44
typedef struct _AlmanahEntryPrivate AlmanahEntryPrivate;
48
AlmanahEntryPrivate *priv;
55
GType almanah_entry_get_type (void);
56
AlmanahEntry *almanah_entry_new (GDate *date);
58
const guint8 *almanah_entry_get_data (AlmanahEntry *self, gsize *length);
59
void almanah_entry_set_data (AlmanahEntry *self, const guint8 *data, gsize length);
60
gboolean almanah_entry_get_content (AlmanahEntry *self, GtkTextBuffer *text_buffer, gboolean create_tags, GError **error);
61
void almanah_entry_set_content (AlmanahEntry *self, GtkTextBuffer *text_buffer);
63
void almanah_entry_get_date (AlmanahEntry *self, GDate *date);
64
AlmanahEntryEditability almanah_entry_get_editability (AlmanahEntry *self);
65
gboolean almanah_entry_is_empty (AlmanahEntry *self);
69
#endif /* !ALMANAH_ENTRY_H */