[almanah] core: Remove definition support



commit 050f22244d8586f7dbb5f5f6050fd2e481cb6cce
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Nov 7 16:57:16 2010 +0000

    core: Remove definition support
    
    It's never worked particularly well or been especially useful, and will be
    replaced by a hyperlinking system. Helps: bgo#631835

 data/almanah.ui                 |  241 -------------------------
 src/Makefile.am                 |   36 +----
 src/add-definition-dialog.c     |  284 -----------------------------
 src/add-definition-dialog.h     |   60 ------
 src/definition-manager-window.c |  378 ---------------------------------------
 src/definition-manager-window.h |   51 ------
 src/definition.c                |  341 -----------------------------------
 src/definition.h                |   93 ----------
 src/definitions/contact.c       |  240 -------------------------
 src/definitions/contact.h       |   52 ------
 src/definitions/file.c          |  125 -------------
 src/definitions/file.h          |   52 ------
 src/definitions/note.c          |  138 --------------
 src/definitions/note.h          |   52 ------
 src/definitions/uri.c           |  140 ---------------
 src/definitions/uri.h           |   52 ------
 src/import-operation.c          |   15 --
 src/interface.c                 |   51 +-----
 src/main-window.c               |  188 +-------------------
 src/main.c                      |    4 -
 src/main.h                      |    2 -
 src/storage-manager.c           |  186 +-------------------
 src/storage-manager.h           |    8 +-
 23 files changed, 14 insertions(+), 2775 deletions(-)
---
diff --git a/data/almanah.ui b/data/almanah.ui
index c190bbf..85d100f 100644
--- a/data/almanah.ui
+++ b/data/almanah.ui
@@ -188,40 +188,6 @@
 						<signal name="activate" handler="mw_jump_to_today_activate_cb"/>
 					</object>
 				</child>
-				<child>
-					<object class="GtkAction" id="almanah_ui_definitions">
-						<property name="name">definitions</property>
-						<property name="label" translatable="yes">_Definitions</property>
-					</object>
-				</child>
-				<child>
-					<object class="GtkAction" id="almanah_ui_add_definition">
-						<property name="stock-id">gtk-add</property>
-						<property name="name">add-definition</property>
-						<property name="label" translatable="yes">_Add Definition</property>
-						<property name="tooltip" translatable="yes">Add a definition for the currently selected text.</property>
-						<property name="is-important">True</property>
-						<property name="sensitive">False</property><!-- Disabled until a selection range is made -->
-						<signal name="activate" handler="mw_add_definition_activate_cb"/>
-					</object>
-				</child>
-				<child>
-					<object class="GtkAction" id="almanah_ui_remove_definition">
-						<property name="stock-id">gtk-remove</property>
-						<property name="name">remove-definition</property>
-						<property name="label" translatable="yes">_Remove Definition</property>
-						<property name="tooltip" translatable="yes">Remove the definition from the currently selected text.</property>
-						<property name="sensitive">False</property><!-- Disabled until a selection range is made -->
-						<signal name="activate" handler="mw_remove_definition_activate_cb"/>
-					</object>
-				</child>
-				<child>
-					<object class="GtkAction" id="almanah_ui_view_definitions">
-						<property name="name">view-definitions</property>
-						<property name="label" translatable="yes">_View Definitions</property>
-						<signal name="activate" handler="mw_view_definitions_activate_cb"/>
-					</object>
-				</child>
 			</object>
 		</child>
 		<ui>
@@ -257,12 +223,6 @@
 					<menuitem action="almanah_ui_insert_time"/>
 					<menuitem action="almanah_ui_important"/>
 				</menu>
-				<menu action="almanah_ui_definitions">
-					<menuitem action="almanah_ui_add_definition"/>
-					<menuitem action="almanah_ui_remove_definition"/>
-					<separator/>
-					<menuitem action="almanah_ui_view_definitions"/>
-				</menu>
 				<menu action="almanah_ui_help">
 					<menuitem action="almanah_ui_about"/>
 				</menu>
@@ -274,9 +234,6 @@
 				<toolitem action="almanah_ui_bold"/>
 				<toolitem action="almanah_ui_italic"/>
 				<toolitem action="almanah_ui_underline"/>
-				<separator/>
-				<toolitem action="almanah_ui_add_definition"/>
-				<toolitem action="almanah_ui_remove_definition"/>
 			</toolbar>
 		</ui>
 	</object>
@@ -490,88 +447,6 @@
 		</columns>
 	</object>
 
-	<!-- TODO: Use the description of definition types somewhere -->
-	<object class="AlmanahAddDefinitionDialog" id="almanah_add_definition_dialog">
-		<property name="border-width">5</property>
-		<child internal-child="vbox">
-			<object class="GtkVBox" id="vbox1">
-				<property name="spacing">6</property>
-				<child>
-					<object class="GtkVBox" id="almanah_add_main_vbox">
-						<property name="spacing">18</property>
-						<property name="border-width">5</property>
-						<child>
-							<object class="GtkHBox" id="almanah_add_hbox">
-								<property name="spacing">6</property>
-								<child>
-									<object class="GtkLabel" id="almanah_add_type_label">
-										<property name="xalign">0</property>
-										<property name="label" translatable="yes">Definition type:</property>
-										<accessibility>
-											<relation target="almanah_add_type_combo_box" type="label-for"/>
-										</accessibility>
-									</object>
-									<packing>
-										<property name="expand">False</property>
-									</packing>
-								</child>
-								<child>
-									<object class="GtkComboBox" id="almanah_add_type_combo_box">
-										<property name="model">almanah_add_type_store</property>
-										<signal name="changed" handler="add_type_combo_box_changed_cb"/>
-										<accessibility>
-											<relation target="almanah_add_type_label" type="labelled-by"/>
-										</accessibility>
-										<child>
-											<object class="GtkCellRendererPixbuf" id="renderer5"/>
-											<attributes>
-												<attribute name="icon-name">2</attribute>
-											</attributes>
-										</child>
-										<child>
-											<object class="GtkCellRendererText" id="renderer4"/>
-											<attributes>
-												<attribute name="text">0</attribute>
-											</attributes>
-										</child>
-									</object>
-								</child>
-							</object>
-							<packing>
-								<property name="expand">False</property>
-							</packing>
-						</child>
-						<child>
-							<object class="GtkVBox" id="almanah_add_vbox"/>
-						</child>
-					</object>
-				</child>
-				<child internal-child="action_area">
-					<object class="GtkHButtonBox" id="hbuttonbox1">
-						<child>
-							<object class="GtkButton" id="almanah_add_cancel_button">
-								<property name="use-stock">True</property>
-								<property name="label">gtk-cancel</property>
-							</object>
-						</child>
-						<child>
-							<object class="GtkButton" id="almanah_add_add_button">
-								<property name="use-stock">True</property>
-								<property name="label">gtk-add</property>
-								<property name="can-default">True</property>
-								<property name="has-default">True</property>
-							</object>
-						</child>
-					</object>
-				</child>
-			</object>
-		</child>
-		<action-widgets>
-			<action-widget response="-6">almanah_add_cancel_button</action-widget><!-- GTK_RESPONSE_CANCEL -->
-			<action-widget response="-5">almanah_add_add_button</action-widget><!-- GTK_RESPONSE_OK -->
-		</action-widgets>
-	</object>
-
 	<object class="GtkImage" id="almanah_sd_search_button_image">
 		<property name="stock">gtk-find</property>
 	</object>
@@ -753,122 +628,6 @@
 		</action-widgets>
 	</object>
 
-	<object class="GtkListStore" id="almanah_dmw_definition_store">
-		<columns>
-			<column type="AlmanahDefinition"/><!-- Definition object -->
-			<column type="gchararray"/><!-- Definition text -->
-		</columns>
-	</object>
-
-	<object class="AlmanahDefinitionManagerWindow" id="almanah_definition_manager_window">
-		<property name="border-width">12</property>
-		<child>
-			<object class="GtkHBox" id="hbox1">
-				<property name="spacing">6</property>
-				<child>
-					<object class="GtkScrolledWindow" id="scrolledwindow3">
-						<property name="hscrollbar-policy">GTK_POLICY_AUTOMATIC</property>
-						<property name="vscrollbar-policy">GTK_POLICY_AUTOMATIC</property>
-						<property name="shadow-type">GTK_SHADOW_IN</property>
-						<property name="width-request">200</property>
-						<child>
-							<object class="GtkTreeView" id="almanah_dmw_definition_tree_view">
-								<property name="model">almanah_dmw_definition_store</property>
-								<property name="headers-visible">False</property>
-								<signal name="row-activated" handler="dmw_definition_tree_view_row_activated_cb"/>
-								<child internal-child="accessible">
-									<object class="AtkObject" id="a11y-almanah_dmw_definition_tree_view">
-										<property name="AtkObject::accessible-name" translatable="yes">Definition List</property>
-									</object>
-								</child>
-								<child>
-									<object class="GtkTreeViewColumn" id="column1">
-										<child>
-											<object class="GtkCellRendererText" id="renderer1"/>
-											<attributes>
-												<attribute name="text">1</attribute>
-											</attributes>
-										</child>
-									</object>
-								</child>
-							</object>
-						</child>
-					</object>
-					<packing>
-						<property name="expand">False</property>
-					</packing>
-				</child>
-				<child>
-					<object class="GtkVBox" id="almanah_dmw_vbox">
-						<property name="spacing">6</property>
-						<child>
-							<object class="GtkLabel" id="almanah_dmw_name_label">
-								<property name="label" translatable="yes">Nothing selected</property>
-								<property name="xalign">0</property>
-								<child internal-child="accessible">
-									<object class="AtkObject" id="a11y-almanah_dmw_name_label">
-										<property name="AtkObject::accessible-name" translatable="yes">Definition Type</property>
-									</object>
-								</child>
-								<attributes>
-									<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
-								</attributes>
-							</object>
-							<packing>
-								<property name="expand">False</property>
-							</packing>
-						</child>
-						<child>
-							<object class="GtkAlignment" id="almanah_dmw_description_alignment">
-								<property name="left-padding">6</property>
-								<child>
-									<object class="GtkLabel" id="almanah_dmw_description_label">
-										<property name="wrap">True</property>
-										<property name="xalign">0</property>
-										<property name="yalign">0</property>
-										<child internal-child="accessible">
-											<object class="AtkObject" id="a11y-almanah_dmw_description_label">
-												<property name="AtkObject::accessible-name" translatable="yes">Definition Description</property>
-											</object>
-										</child>
-									</object>
-								</child>
-							</object>
-						</child>
-						<child>
-							<object class="GtkHButtonBox" id="almanah_dmw_button_box">
-								<child>
-									<object class="GtkButton" id="almanah_dmw_remove_button">
-										<property name="use-stock">True</property>
-										<property name="label">gtk-remove</property>
-										<property name="sensitive">False</property>
-										<signal name="clicked" handler="dmw_remove_button_clicked_cb"/>
-									</object>
-								</child>
-								<child>
-									<object class="GtkButton" id="almanah_dmw_view_button">
-										<property name="image">almanah_mw_view_button_image</property>
-										<property name="label" translatable="yes">View</property>
-										<property name="sensitive">False</property>
-										<signal name="clicked" handler="dmw_view_button_clicked_cb"/>
-										<child internal-child="accessible">
-											<object class="AtkObject" id="a11y-almanah_dmw_view_button">
-												<property name="AtkObject::accessible-name" translatable="yes">View Event</property>
-											</object>
-										</child>
-									</object>
-								</child>
-							</object>
-							<packing>
-								<property name="expand">False</property>
-							</packing>
-						</child>
-					</object>
-				</child>
-			</object>
-		</child>
-	</object>
-
 	<object class="AlmanahDateEntryDialog" id="almanah_date_entry_dialog">
 		<property name="border-width">5</property>
 		<child internal-child="vbox">
diff --git a/src/Makefile.am b/src/Makefile.am
index d374391..06d286d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,12 +9,8 @@ almanah_SOURCES = \
 	interface.h			\
 	main-window.c			\
 	main-window.h			\
-	definition-manager-window.c	\
-	definition-manager-window.h	\
 	storage-manager.c		\
 	storage-manager.h		\
-	add-definition-dialog.c		\
-	add-definition-dialog.h		\
 	search-dialog.c			\
 	search-dialog.h			\
 	printing.c			\
@@ -27,8 +23,6 @@ almanah_SOURCES = \
 	event-factory.h			\
 	event-manager.c			\
 	event-manager.h			\
-	definition.c			\
-	definition.h			\
 	date-entry-dialog.c		\
 	date-entry-dialog.h		\
 	import-export-dialog.c		\
@@ -37,12 +31,6 @@ almanah_SOURCES = \
 	import-operation.h		\
 	export-operation.c		\
 	export-operation.h		\
-	definitions/file.c		\
-	definitions/file.h		\
-	definitions/note.c		\
-	definitions/note.h		\
-	definitions/uri.c		\
-	definitions/uri.h		\
 	widgets/calendar.c		\
 	widgets/calendar.h
 
@@ -58,9 +46,7 @@ almanah_SOURCES += \
 	events/calendar-appointment.c		\
 	events/calendar-appointment.h		\
 	events/calendar-task.c			\
-	events/calendar-task.h			\
-	definitions/contact.c			\
-	definitions/contact.h
+	events/calendar-task.h
 endif
 
 if ENCRYPTION
@@ -72,7 +58,6 @@ endif
 almanah_CPPFLAGS = \
 	-DPACKAGE_LOCALE_DIR=\""$(datadir)/locale"\"	\
 	-DPACKAGE_DATA_DIR=\""$(datadir)"\"		\
-	-I$(srcdir)/definitions				\
 	-I$(srcdir)/events				\
 	-I$(srcdir)/event-factories			\
 	$(DISABLE_DEPRECATED)				\
@@ -105,28 +90,9 @@ almanah-marshal.c: almanah-marshal.list almanah-marshal.h
 
 # Enums
 ALMANAH_ENUM_FILES = \
-	definition-builtins.h		\
-	definition-builtins.c		\
 	event-factory-builtins.h	\
 	event-factory-builtins.c
 
-definition-builtins.h: definition.h Makefile
-	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
-			--fhead "#ifndef __ALMANAH_DEFINITION_BUILTINS_H__\n#define __ALMANAH_DEFINITION_BUILTINS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
-			--fprod "/* enumerations from \"@filename \" */\n" \
-			--vhead "GType @enum_name _get_type (void) G_GNUC_CONST;\n#define ALMANAH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-			--ftail "G_END_DECLS\n\n#endif /* __ALMANAH_DEFINITION_BUILTINS_H__ */" \
-		definition.h) > $(@F)
-
-definition-builtins.c: definition.h Makefile definition-builtins.h
-	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
-			--fhead "#include \"definition.h\"\n#include \"definition-builtins.h\"" \
-			--fprod "\n/* enumerations from \"@filename \" */" \
-			--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" \
-			--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
-			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ type@_register_static (\"@EnumName \", values);\n  }\n  return etype;\n}\n" \
-		definition.h) > $(@F)
-
 event-factory-builtins.h: event-factory.h Makefile
 	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#ifndef __ALMANAH_EVENT_FACTORY_BUILTINS_H__\n#define __ALMANAH_EVENT_FACTORY_BUILTINS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
diff --git a/src/import-operation.c b/src/import-operation.c
index e8f8be1..5e941f8 100644
--- a/src/import-operation.c
+++ b/src/import-operation.c
@@ -381,7 +381,6 @@ import_database (AlmanahImportOperation *self, GFile *source, AlmanahImportProgr
 	GFileInfo *file_info;
 	gchar *path;
 	const gchar *display_name;
-	GSList *i, *definitions = NULL;
 	AlmanahEntry *entry;
 	AlmanahStorageManager *database;
 	AlmanahStorageManagerIter iter;
@@ -426,24 +425,10 @@ import_database (AlmanahImportOperation *self, GFile *source, AlmanahImportProgr
 			goto finish;
 	}
 
-	/* Query for every definition */
-	definitions = almanah_storage_manager_get_definitions (database);
-	for (i = definitions; i != NULL; i = i->next) {
-		/* Add the definition to the proper database, ignoring failure */
-		almanah_storage_manager_add_definition (almanah->storage_manager, ALMANAH_DEFINITION (i->data));
-		g_object_unref (i->data);
-
-		/* Check for cancellation */
-		if (cancellable != NULL && g_cancellable_set_error_if_cancelled (cancellable, error) == TRUE)
-			goto finish;
-	}
-
 	/* Success! */
 	success = TRUE;
 
 finish:
-	g_slist_free (definitions);
-
 	almanah_storage_manager_disconnect (database, NULL);
 	g_object_unref (database);
 
diff --git a/src/interface.c b/src/interface.c
index 07d646c..b77ba04 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -23,7 +23,6 @@
 
 #include "main.h"
 #include "main-window.h"
-#include "add-definition-dialog.h"
 #include "search-dialog.h"
 #ifdef ENABLE_ENCRYPTION
 #include "preferences-dialog.h"
@@ -39,47 +38,9 @@ almanah_get_interface_filename (void)
 		return PACKAGE_DATA_DIR"/almanah/almanah.ui";
 }
 
-static gboolean
-definition_tag_event_cb (GtkTextTag *tag, GObject *object, GdkEvent *event, GtkTextIter *iter, gpointer user_data)
-{
-	AlmanahDefinition *definition;
-	gchar *text;
-	GtkTextIter start_iter, end_iter;
-
-	/* TODO: Display a popup menu on right-clicking? Display a list of definitions, or allow this one to be edited, when Ctrl clicking? */
-	/* Handle only double- or control-click events on any definition tags, so they can act like hyperlinks */
-	if ((event->type != GDK_BUTTON_RELEASE && event->type != GDK_2BUTTON_PRESS) ||
-	    (event->type == GDK_BUTTON_RELEASE && !(event->button.state & GDK_CONTROL_MASK))) {
-		return FALSE;
-	}
-
-	/* Get the start and end iters for this tag instance */
-	start_iter = *iter;
-	if (gtk_text_iter_backward_to_tag_toggle (&start_iter, tag) == FALSE)
-		start_iter = *iter;
-
-	end_iter = start_iter;
-	if (gtk_text_iter_forward_to_tag_toggle (&end_iter, tag) == FALSE)
-		end_iter = *iter;
-
-	/* Get the tag's text */
-	text = gtk_text_iter_get_text (&start_iter, &end_iter);
-	definition = almanah_storage_manager_get_definition (almanah->storage_manager, text);
-	g_free (text);
-
-	if (definition == NULL) {
-		/* If the definition no longer exists, remove the tag */
-		gtk_text_buffer_remove_tag (gtk_text_iter_get_buffer (iter), tag, &start_iter, &end_iter);
-		return FALSE;
-	}
-
-	return almanah_definition_view (definition);
-}
-
 void
 almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect_events)
 {
-	GtkTextTag *tag;
 	GtkTextTagTable *table;
 
 	table = gtk_text_buffer_get_tag_table (text_buffer);
@@ -89,6 +50,11 @@ almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect
 		gtk_text_buffer_create_tag (text_buffer, "gtkspell-misspelled", NULL);
 	}
 
+	if (gtk_text_tag_table_lookup (table, "definition") == NULL) {
+		/* Same for definitions (which have been removed from Almanah) */
+		gtk_text_buffer_create_tag (text_buffer, "definition", NULL);
+	}
+
 	gtk_text_buffer_create_tag (text_buffer, "bold", 
 				    "weight", PANGO_WEIGHT_BOLD, 
 				    NULL);
@@ -98,11 +64,4 @@ almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect
 	gtk_text_buffer_create_tag (text_buffer, "underline",
 				    "underline", PANGO_UNDERLINE_SINGLE,
 				    NULL);
-	tag = gtk_text_buffer_create_tag (text_buffer, "definition",
-					  "foreground", "blue",
-					  "underline", PANGO_UNDERLINE_SINGLE,
-					  NULL);
-
-	if (connect_events == TRUE)
-		g_signal_connect (tag, "event", G_CALLBACK (definition_tag_event_cb), NULL);
 }
diff --git a/src/main-window.c b/src/main-window.c
index 041c1d0..cb264e2 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -30,7 +30,6 @@
 #include "main-window.h"
 #include "main.h"
 #include "interface.h"
-#include "add-definition-dialog.h"
 #include "preferences-dialog.h"
 #include "search-dialog.h"
 #include "date-entry-dialog.h"
@@ -38,8 +37,6 @@
 #include "entry.h"
 #include "storage-manager.h"
 #include "event.h"
-#include "definition.h"
-#include "definition-manager-window.h"
 #include "import-export-dialog.h"
 #include "widgets/calendar.h"
 
@@ -55,14 +52,12 @@ static void mw_entry_buffer_cursor_position_cb (GObject *object, GParamSpec *psp
 static void mw_entry_buffer_insert_text_cb (GtkTextBuffer *text_buffer, GtkTextIter *start, gchar *text, gint len, AlmanahMainWindow *main_window);
 static void mw_entry_buffer_insert_text_after_cb (GtkTextBuffer *text_buffer, GtkTextIter *start, gchar *text, gint len, AlmanahMainWindow *main_window);
 static void mw_entry_buffer_has_selection_cb (GObject *object, GParamSpec *pspec, AlmanahMainWindow *main_window);
-static void mw_entry_buffer_apply_tag_cb (GtkTextBuffer *buffer, GtkTextTag *tag, GtkTextIter *start_iter, GtkTextIter *end_iter, AlmanahMainWindow *main_window);
 static void mw_bold_toggled_cb (GtkToggleAction *action, AlmanahMainWindow *main_window);
 static void mw_italic_toggled_cb (GtkToggleAction *action, AlmanahMainWindow *main_window);
 static void mw_underline_toggled_cb (GtkToggleAction *action, AlmanahMainWindow *main_window);
 static void mw_events_updated_cb (AlmanahEventManager *event_manager, AlmanahEventFactoryType type_id, AlmanahMainWindow *main_window);
 static void mw_events_selection_changed_cb (GtkTreeSelection *tree_selection, AlmanahMainWindow *main_window);
 static void mw_events_value_data_cb (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
-static void mw_definition_removed_cb (AlmanahStorageManager *storage_manager, const gchar *definition_text, AlmanahMainWindow *main_window);
 
 /* GtkBuilder callbacks */
 void mw_calendar_day_selected_cb (GtkCalendar *calendar, AlmanahMainWindow *main_window);
@@ -83,9 +78,6 @@ void mw_search_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_preferences_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_about_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_jump_to_today_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
-void mw_add_definition_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
-void mw_remove_definition_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
-void mw_view_definitions_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_events_tree_view_row_activated_cb (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, AlmanahMainWindow *main_window);
 void mw_view_button_clicked_cb (GtkButton *button, AlmanahMainWindow *main_window);
 
@@ -95,8 +87,6 @@ struct _AlmanahMainWindowPrivate {
 	AlmanahCalendar *calendar;
 	GtkLabel *date_label;
 	GtkButton *view_button;
-	GtkAction *add_action;
-	GtkAction *remove_action;
 	GtkListStore *event_store;
 	GtkTreeSelection *events_selection;
 	GtkTreeViewColumn *event_value_column;
@@ -225,8 +215,6 @@ almanah_main_window_new (void)
 	priv->calendar = ALMANAH_CALENDAR (gtk_builder_get_object (builder, "almanah_mw_calendar"));
 	priv->date_label = GTK_LABEL (gtk_builder_get_object (builder, "almanah_mw_date_label"));
 	priv->view_button = GTK_BUTTON (gtk_builder_get_object (builder, "almanah_mw_view_button"));
-	priv->add_action = GTK_ACTION (gtk_builder_get_object (builder, "almanah_ui_add_definition"));
-	priv->remove_action = GTK_ACTION (gtk_builder_get_object (builder, "almanah_ui_remove_definition"));
 	priv->event_store = GTK_LIST_STORE (gtk_builder_get_object (builder, "almanah_mw_event_store"));
 	priv->events_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (builder, "almanah_mw_events_tree_view")));
 	priv->event_value_column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (builder, "almanah_mw_event_value_column"));
@@ -260,9 +248,6 @@ almanah_main_window_new (void)
 	/* Similarly, make sure we're notified when there's a selection so we can change the status of cut/copy/paste actions */
 	g_signal_connect (priv->entry_buffer, "notify::has-selection", G_CALLBACK (mw_entry_buffer_has_selection_cb), main_window);
 
-	/* Get notified of applied tags so we can check if referenced definitions still exist */
-	g_signal_connect_after (priv->entry_buffer, "apply-tag", G_CALLBACK (mw_entry_buffer_apply_tag_cb), main_window);
-
 	/* Connect up the formatting actions */
 	g_signal_connect (priv->bold_action, "toggled", G_CALLBACK (mw_bold_toggled_cb), main_window);
 	g_signal_connect (priv->italic_action, "toggled", G_CALLBACK (mw_italic_toggled_cb), main_window);
@@ -271,9 +256,6 @@ almanah_main_window_new (void)
 	/* Notification for event changes */
 	g_signal_connect (almanah->event_manager, "events-updated", G_CALLBACK (mw_events_updated_cb), main_window);
 
-	/* Notification for changes to definitions in the database */
-	g_signal_connect (almanah->storage_manager, "definition-removed", G_CALLBACK (mw_definition_removed_cb), main_window);
-
 	/* Select the current day and month */
 	mw_jump_to_today_activate_cb (NULL, main_window);
 
@@ -617,97 +599,6 @@ save_current_entry (AlmanahMainWindow *self)
 	}
 }
 
-static void
-add_definition_to_current_entry (AlmanahMainWindow *self)
-{
-	AlmanahMainWindowPrivate *priv = self->priv;
-	GtkTextIter start_iter, end_iter;
-	gchar *text;
-	AlmanahDefinition *definition;
-
-	g_assert (priv->entry_buffer != NULL);
-	g_assert (gtk_text_buffer_get_char_count (priv->entry_buffer) != 0);
-
-	if (gtk_text_buffer_get_selection_bounds (priv->entry_buffer, &start_iter, &end_iter) == FALSE)
-		return;
-
-	text = gtk_text_buffer_get_text (priv->entry_buffer, &start_iter, &end_iter, FALSE);
-
-	/* If the definition already exists, don't display the dialogue */
-	definition = almanah_storage_manager_get_definition (almanah->storage_manager, text);
-	if (definition != NULL) {
-		g_object_unref (definition);
-
-		/* Add a GtkTextTag to the GtkTextBuffer to mark the definition */
-		gtk_text_buffer_apply_tag_by_name (priv->entry_buffer, "definition", &start_iter, &end_iter);
-		gtk_text_buffer_set_modified (priv->entry_buffer, TRUE);
-
-		g_free (text);
-		return;
-	}
-
-	/* Create the Add Definition dialogue if it doesn't already exist */
-	if (almanah->add_definition_dialog == NULL)
-		almanah->add_definition_dialog = GTK_WIDGET (almanah_add_definition_dialog_new ());
-
-	/* Ensure that something is selected and its widget's displayed */
-	almanah_add_definition_dialog_set_text (ALMANAH_ADD_DEFINITION_DIALOG (almanah->add_definition_dialog), text);
-	g_free (text);
-	gtk_widget_show_all (almanah->add_definition_dialog);
-
-	if (gtk_dialog_run (GTK_DIALOG (almanah->add_definition_dialog)) == GTK_RESPONSE_OK) {
-		definition = almanah_add_definition_dialog_get_definition (ALMANAH_ADD_DEFINITION_DIALOG (almanah->add_definition_dialog));
-		if (definition == NULL)
-			return;
-
-		/* Add to the DB */
-		almanah_storage_manager_add_definition (almanah->storage_manager, definition);
-
-		/* Add a GtkTextTag to the GtkTextBuffer to mark the definition */
-		gtk_text_buffer_apply_tag_by_name (priv->entry_buffer, "definition", &start_iter, &end_iter);
-		gtk_text_buffer_set_modified (priv->entry_buffer, TRUE);
-	}
-}
-
-static void
-remove_definition_from_current_entry (AlmanahMainWindow *self)
-{
-	/* We don't actually remove the definition from the database, since other entries may use it;
-	 * we simply remove the formatting. */
-	AlmanahMainWindowPrivate *priv = self->priv;
-	GtkTextIter start_iter, end_iter;
-	GtkTextTag *tag;
-	GtkTextTagTable *tag_table;
-
-	/* Find the tag in the tag table */
-	tag_table = gtk_text_buffer_get_tag_table (priv->entry_buffer);
-	tag = gtk_text_tag_table_lookup (tag_table, "definition");
-	g_assert (tag != NULL);
-
-	/* Find the boundaries of the tag (ignoring everything except the position
-	 * of the start iter of any selection the user's made). */
-	gtk_text_buffer_get_selection_bounds (priv->entry_buffer, &start_iter, NULL);
-	end_iter = start_iter;
-
-	if (gtk_text_iter_begins_tag (&start_iter, tag) == TRUE) {
-		/* We're at the start of the tag */
-		gtk_text_iter_forward_to_tag_toggle (&end_iter, tag);
-	} else if (gtk_text_iter_ends_tag (&start_iter, tag) == TRUE) {
-		/* We're at the end of the tag */
-		end_iter = start_iter;
-		gtk_text_iter_backward_to_tag_toggle (&start_iter, tag);
-	} else {
-		/* We're somewhere in the middle of the tag */
-		gtk_text_iter_backward_to_tag_toggle (&start_iter, tag);
-		end_iter = start_iter;
-		gtk_text_iter_forward_to_tag_toggle (&end_iter, tag);
-	}
-
-	/* Remove the tag */
-	gtk_text_buffer_remove_tag (priv->entry_buffer, tag, &start_iter, &end_iter);
-	gtk_text_buffer_set_modified (priv->entry_buffer, TRUE);
-}
-
 void
 almanah_main_window_select_date (AlmanahMainWindow *self, GDate *date)
 {
@@ -721,7 +612,7 @@ mw_entry_buffer_cursor_position_cb (GObject *object, GParamSpec *pspec, AlmanahM
 	AlmanahMainWindowPrivate *priv = main_window->priv;
 	GSList *_tag_list = NULL, *tag_list = NULL;
 	gboolean range_selected = FALSE;
-	gboolean bold_toggled = FALSE, italic_toggled = FALSE, underline_toggled = FALSE, remove_definition_toggled = FALSE;
+	gboolean bold_toggled = FALSE, italic_toggled = FALSE, underline_toggled = FALSE;
 
 	/* Ensure we don't overwrite current formatting options when characters are being typed.
 	 * (Execution of this function will be sandwiched between:
@@ -736,9 +627,6 @@ mw_entry_buffer_cursor_position_cb (GObject *object, GParamSpec *pspec, AlmanahM
 	if (range_selected == FALSE)
 		_tag_list = gtk_text_iter_get_tags (&iter);
 
-	/* We can only have the "add definition" action sensitive if there's a range selected */
-	gtk_action_set_sensitive (priv->add_action, (range_selected == TRUE) ? TRUE : FALSE);
-
 	/* Block signal handlers for the formatting actions while we're executing,
 	 * so formatting doesn't get unwittingly changed. */
 	priv->updating_formatting = TRUE;
@@ -762,11 +650,7 @@ mw_entry_buffer_cursor_position_cb (GObject *object, GParamSpec *pspec, AlmanahM
 			underline_toggled = TRUE;
 		}
 
-		if (strcmp (tag_name, "definition") == 0) {
-			/* Deal with definition tags slightly differently --- just toggle the sensitivity of the "remove definition" action */
-			gtk_action_set_sensitive (priv->remove_action, TRUE);
-			remove_definition_toggled = TRUE;
-		} else if (action != NULL) {
+		if (action != NULL) {
 			/* Force the toggle status on the action */
 			gtk_toggle_action_set_active (action, TRUE);
 		} else if (strcmp (tag_name, "gtkspell-misspelled") != 0) {
@@ -788,8 +672,6 @@ mw_entry_buffer_cursor_position_cb (GObject *object, GParamSpec *pspec, AlmanahM
 			gtk_toggle_action_set_active (priv->italic_action, FALSE);
 		if (underline_toggled == FALSE)
 			gtk_toggle_action_set_active (priv->underline_action, FALSE);
-		if (remove_definition_toggled == FALSE)
-			gtk_action_set_sensitive (priv->remove_action, FALSE);
 	}
 
 	/* Unblock signals */
@@ -837,33 +719,6 @@ mw_entry_buffer_has_selection_cb (GObject *object, GParamSpec *pspec, AlmanahMai
 	gtk_action_set_sensitive (main_window->priv->delete_action, has_selection);
 }
 
-static void
-mw_entry_buffer_apply_tag_cb (GtkTextBuffer *buffer, GtkTextTag *tag, GtkTextIter *start_iter, GtkTextIter *end_iter, AlmanahMainWindow *main_window)
-{
-	gchar *name;
-
-	g_object_get (G_OBJECT (tag), "name", &name, NULL);
-	if (strcmp (name, "definition") == 0) {
-		AlmanahDefinition *definition;
-		gchar *definition_text;
-
-		/* Check to see if the definition still exists in the DB */
-		definition_text = gtk_text_buffer_get_text (buffer, start_iter, end_iter, FALSE);
-		definition = almanah_storage_manager_get_definition (almanah->storage_manager, definition_text);
-		g_free (definition_text);
-
-		/* If the definition doesn't exist, remove the tag */
-		if (definition == NULL) {
-			gtk_text_buffer_remove_tag (buffer, tag, start_iter, end_iter);
-			gtk_text_buffer_set_modified (buffer, TRUE);
-		} else {
-			g_object_unref (definition);
-		}
-	}
-
-	g_free (name);
-}
-
 static gboolean
 mw_delete_event_cb (GtkWindow *window, gpointer user_data)
 {
@@ -1045,7 +900,7 @@ void
 mw_about_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
 {
 	gchar *license, *description;
-	guint entry_count, definition_count;
+	guint entry_count;
 
 	const gchar *authors[] =
 	{
@@ -1071,10 +926,8 @@ mw_about_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
 			  _(license_parts[2]),
 			  NULL);
 
-	almanah_storage_manager_get_statistics (almanah->storage_manager, &entry_count, &definition_count);
-	description = g_strdup_printf (_("A helpful diary keeper, storing %u entries and %u definitions."),
-				      entry_count,
-				      definition_count);
+	almanah_storage_manager_get_statistics (almanah->storage_manager, &entry_count);
+	description = g_strdup_printf (_("A helpful diary keeper, storing %u entries."), entry_count);
 
 	gtk_show_about_dialog (GTK_WINDOW (main_window),
 				"version", VERSION,
@@ -1106,27 +959,6 @@ mw_jump_to_today_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
 	almanah_main_window_select_date (main_window, &current_date);
 }
 
-void
-mw_add_definition_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
-{
-	add_definition_to_current_entry (main_window);
-}
-
-void
-mw_remove_definition_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
-{
-	remove_definition_from_current_entry (main_window);
-}
-
-void
-mw_view_definitions_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
-{
-	if (almanah->definition_manager_window == NULL)
-		almanah->definition_manager_window = GTK_WIDGET (almanah_definition_manager_window_new ());
-
-	gtk_widget_show_all (almanah->definition_manager_window);
-}
-
 static void
 clear_factory_events (AlmanahMainWindow *self, AlmanahEventFactoryType type_id)
 {
@@ -1236,8 +1068,6 @@ mw_calendar_day_selected_cb (GtkCalendar *calendar, AlmanahMainWindow *main_wind
 
 	/* Prepare for the possibility of failure --- do as much of the general interface changes as possible first */
 	gtk_list_store_clear (priv->event_store);
-	gtk_action_set_sensitive (priv->add_action, FALSE);
-	gtk_action_set_sensitive (priv->remove_action, FALSE); /* Only sensitive if something's selected */
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->view_button), FALSE);
 
 	if (almanah_entry_is_empty (priv->current_entry) == FALSE) {
@@ -1344,14 +1174,6 @@ mw_view_button_clicked_cb (GtkButton *button, AlmanahMainWindow *main_window)
 	g_list_free (events);
 }
 
-static void
-mw_definition_removed_cb (AlmanahStorageManager *storage_manager, const gchar *definition_text, AlmanahMainWindow *main_window)
-{
-	/* We need to remove any definition tags in the current entry which match @definition_text. It's
-	 * probably easier to just reload the current entry, though. */
-	mw_calendar_day_selected_cb (GTK_CALENDAR (main_window->priv->calendar), main_window);
-}
-
 #ifdef ENABLE_SPELL_CHECKING
 static void
 spell_checking_enabled_changed_cb (GSettings *settings, gchar *key, AlmanahMainWindow *self)
diff --git a/src/main.c b/src/main.c
index ec7ff7d..75d6e28 100644
--- a/src/main.c
+++ b/src/main.c
@@ -93,8 +93,6 @@ almanah_quit (void)
 	g_signal_connect (almanah->storage_manager, "disconnected", G_CALLBACK (storage_manager_disconnected_cb), NULL);
 	almanah_storage_manager_disconnect (almanah->storage_manager, NULL);
 
-	if (almanah->add_definition_dialog != NULL)
-		gtk_widget_destroy (almanah->add_definition_dialog);
 	if (almanah->search_dialog != NULL)
 		gtk_widget_destroy (almanah->search_dialog);
 	if (almanah->date_entry_dialog != NULL)
@@ -103,8 +101,6 @@ almanah_quit (void)
 	if (almanah->preferences_dialog != NULL)
 		gtk_widget_destroy (almanah->preferences_dialog);
 #endif /* ENABLE_ENCRYPTION */
-	if (almanah->definition_manager_window != NULL)
-		gtk_widget_destroy (almanah->definition_manager_window);
 	gtk_widget_destroy (almanah->main_window);
 
 	g_object_unref (almanah->event_manager);
diff --git a/src/main.h b/src/main.h
index 980e9e5..bb91a8f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -38,10 +38,8 @@ typedef struct {
 	GtkPageSetup *page_setup;
 
 	GtkWidget *main_window;
-	GtkWidget *add_definition_dialog;
 	GtkWidget *search_dialog;
 	GtkWidget *date_entry_dialog;
-	GtkWidget *definition_manager_window;
 #ifdef ENABLE_ENCRYPTION
 	GtkWidget *preferences_dialog;
 #endif /* ENABLE_ENCRYPTION */
diff --git a/src/storage-manager.c b/src/storage-manager.c
index 49ef227..2d14150 100644
--- a/src/storage-manager.c
+++ b/src/storage-manager.c
@@ -32,7 +32,6 @@
 
 #include "main.h"
 #include "entry.h"
-#include "definition.h"
 #include "storage-manager.h"
 #include "almanah-marshal.h"
 
@@ -58,9 +57,6 @@ enum {
 	SIGNAL_ENTRY_ADDED,
 	SIGNAL_ENTRY_MODIFIED,
 	SIGNAL_ENTRY_REMOVED,
-	SIGNAL_DEFINITION_ADDED,
-	SIGNAL_DEFINITION_MODIFIED,
-	SIGNAL_DEFINITION_REMOVED,
 	LAST_SIGNAL
 };
 
@@ -116,24 +112,6 @@ almanah_storage_manager_class_init (AlmanahStorageManagerClass *klass)
 	                                                              0, NULL, NULL,
 	                                                              g_cclosure_marshal_VOID__BOXED,
 	                                                              G_TYPE_NONE, 1, G_TYPE_DATE);
-	storage_manager_signals[SIGNAL_DEFINITION_ADDED] = g_signal_new ("definition-added",
-	                                                                 G_TYPE_FROM_CLASS (klass),
-	                                                                 G_SIGNAL_RUN_LAST,
-	                                                                 0, NULL, NULL,
-	                                                                 g_cclosure_marshal_VOID__OBJECT,
-	                                                                 G_TYPE_NONE, 1, ALMANAH_TYPE_DEFINITION);
-	storage_manager_signals[SIGNAL_DEFINITION_MODIFIED] = g_signal_new ("definition-modified",
-	                                                                    G_TYPE_FROM_CLASS (klass),
-	                                                                    G_SIGNAL_RUN_LAST,
-	                                                                    0, NULL, NULL,
-	                                                                    g_cclosure_marshal_VOID__OBJECT,
-	                                                                    G_TYPE_NONE, 1, ALMANAH_TYPE_DEFINITION);
-	storage_manager_signals[SIGNAL_DEFINITION_REMOVED] = g_signal_new ("definition-removed",
-	                                                                   G_TYPE_FROM_CLASS (klass),
-	                                                                   G_SIGNAL_RUN_LAST,
-	                                                                   0, NULL, NULL,
-	                                                                   g_cclosure_marshal_VOID__STRING,
-	                                                                   G_TYPE_NONE, 1, G_TYPE_STRING);
 }
 
 static void
@@ -223,8 +201,6 @@ create_tables (AlmanahStorageManager *self)
 	guint i;
 	const gchar *queries[] = {
 		"CREATE TABLE IF NOT EXISTS entries (year INTEGER, month INTEGER, day INTEGER, content TEXT, PRIMARY KEY (year, month, day))",
-		"CREATE TABLE IF NOT EXISTS definitions (definition_text TEXT, definition_type INTEGER, definition_value TEXT, "
-		                                        "definition_value2 TEXT, PRIMARY KEY (definition_text))",
 		"ALTER TABLE entries ADD COLUMN is_important INTEGER", /* added in 0.7.0 */
 		"ALTER TABLE entries ADD COLUMN edited_year INTEGER", /* added in 0.8.0 */
 		"ALTER TABLE entries ADD COLUMN edited_month INTEGER", /* added in 0.8.0 */
@@ -660,12 +636,11 @@ simple_query (AlmanahStorageManager *self, const gchar *query, GError **error, .
 }
 
 gboolean
-almanah_storage_manager_get_statistics (AlmanahStorageManager *self, guint *entry_count, guint *definition_count)
+almanah_storage_manager_get_statistics (AlmanahStorageManager *self, guint *entry_count)
 {
 	sqlite3_stmt *statement;
 
 	*entry_count = 0;
-	*definition_count = 0;
 
 	/* Get the number of entries and the number of letters */
 	if (sqlite3_prepare_v2 (self->priv->connection, "SELECT COUNT (year) FROM entries", -1, &statement, NULL) != SQLITE_OK)
@@ -679,21 +654,6 @@ almanah_storage_manager_get_statistics (AlmanahStorageManager *self, guint *entr
 	*entry_count = sqlite3_column_int (statement, 0);
 	sqlite3_finalize (statement);
 
-	if (*entry_count == 0)
-		return TRUE;
-
-	/* Get the number of definitions */
-	if (sqlite3_prepare_v2 (self->priv->connection, "SELECT COUNT (year) FROM definitions", -1, &statement, NULL) != SQLITE_OK)
-		return FALSE;
-
-	if (sqlite3_step (statement) != SQLITE_ROW) {
-		sqlite3_finalize (statement);
-		return FALSE;
-	}
-
-	*definition_count = sqlite3_column_int (statement, 0);
-	sqlite3_finalize (statement);
-
 	return TRUE;
 }
 
@@ -801,8 +761,7 @@ almanah_storage_manager_get_entry (AlmanahStorageManager *self, GDate *date)
  * @self: an #AlmanahStorageManager
  * @entry: an #AlmanahEntry
  *
- * Saves the specified @entry in the database synchronously. If the @entry's content is empty, it will delete @entry's rows in the database (as well
- * as its definitions' rows).
+ * Saves the specified @entry in the database synchronously. If the @entry's content is empty, it will delete @entry's rows in the database.
  *
  * The entry's last-edited date should be manually updated before storing it in the database, if desired.
  *
@@ -1145,147 +1104,6 @@ almanah_storage_manager_get_month_important_days (AlmanahStorageManager *self, G
 	return days;
 }
 
-static AlmanahDefinition *
-build_definition_from_statement (sqlite3_stmt *statement)
-{
-	/* Assumes query for SELECT definition_type, definition_value, definition_value2, definition_text, ... FROM definitions ... */
-	AlmanahDefinition *definition = almanah_definition_new (sqlite3_column_int (statement, 0));
-
-	if (definition == NULL)
-		return NULL;
-
-	almanah_definition_set_value (definition, (const gchar*) sqlite3_column_text (statement, 1));
-	almanah_definition_set_value2 (definition, (const gchar*) sqlite3_column_text (statement, 2));
-	almanah_definition_set_text (definition, (const gchar*) sqlite3_column_text (statement, 3));
-
-	return definition;
-}
-
-/**
- * almanah_storage_manager_get_definitions:
- * @self: an #AlmanahStorageManager
- *
- * Returns a list of all #AlmanahDefinition<!-- -->s in the database.
- *
- * Return value: a #GSList of #AlmanahDefinition<!-- -->s, or %NULL; unref elements with g_object_unref(); free list with g_slist_free()
- **/
-GSList *
-almanah_storage_manager_get_definitions (AlmanahStorageManager *self)
-{
-	GSList *definitions = NULL;
-	int result;
-	sqlite3_stmt *statement;
-
-	/* Prepare the statement */
-	if (sqlite3_prepare_v2 (self->priv->connection,
-	                        "SELECT definition_type, definition_value, definition_value2, definition_text FROM definitions", -1,
-	                        &statement, NULL) != SQLITE_OK) {
-		return NULL;
-	}
-
-	/* Execute the statement */
-	while ((result = sqlite3_step (statement)) == SQLITE_ROW) {
-		AlmanahDefinition *definition = build_definition_from_statement (statement);
-		if (definition != NULL)
-			definitions = g_slist_prepend (definitions, definition);
-	}
-
-	sqlite3_finalize (statement);
-
-	/* Check for errors */
-	if (result != SQLITE_DONE) {
-		g_slist_foreach (definitions, (GFunc) g_object_unref, NULL);
-		g_slist_free (definitions);
-		return NULL;
-	}
-
-	return g_slist_reverse (definitions);
-}
-
-/* Note: this function is case-insensitive, unless the definition text contains Unicode characters beyond the ASCII range.
- * This is an SQLite bug: http://sqlite.org/lang_expr.html#like */
-AlmanahDefinition *
-almanah_storage_manager_get_definition (AlmanahStorageManager *self, const gchar *definition_text)
-{
-	sqlite3_stmt *statement;
-	AlmanahDefinition *definition;
-
-	/* Prepare and run the query */
-	if (sqlite3_prepare_v2 (self->priv->connection,
-	                        "SELECT definition_type, definition_value, definition_value2, definition_text FROM definitions "
-	                        "WHERE definition_text LIKE '?' LIMIT 1", -1, &statement, NULL) != SQLITE_OK) {
-		return NULL;
-	}
-
-	sqlite3_bind_text (statement, 1, definition_text, -1, SQLITE_STATIC);
-
-	if (sqlite3_step (statement) != SQLITE_ROW) {
-		/* Error or empty result set */
-		sqlite3_finalize (statement);
-		return NULL;
-	}
-
-	/* Grab the data and run */
-	definition = build_definition_from_statement (statement);
-	sqlite3_finalize (statement);
-
-	return definition;
-}
-
-gboolean
-almanah_storage_manager_add_definition (AlmanahStorageManager *self, AlmanahDefinition *definition)
-{
-	gboolean return_value;
-	const gchar *value, *value2, *text;
-	AlmanahDefinitionType type_id;
-	AlmanahDefinition *real_definition;
-
-	type_id = almanah_definition_get_type_id (definition);
-	value = almanah_definition_get_value (definition);
-	value2 = almanah_definition_get_value2 (definition);
-	text = almanah_definition_get_text (definition);
-
-	/* Check to see if there's already a definition for this text (case-insensitively), and use its (correctly-cased) definition text instead of
-	 * ours */
-	real_definition = almanah_storage_manager_get_definition (self, text);
-	if (real_definition != NULL) {
-		text = almanah_definition_get_text (real_definition);
-		almanah_definition_set_text (definition, text);
-	}
-
-	/* Update/Insert the definition */
-	if (value2 == NULL) {
-		return_value = simple_query (self,
-		                                 "REPLACE INTO definitions (definition_type, definition_value, definition_text) "
-		                                 "VALUES (%u, '%q', '%q')", NULL, type_id, value, text);
-	} else {
-		return_value = simple_query (self,
-		                                 "REPLACE INTO definitions (definition_type, definition_value, definition_value2, definition_text) "
-		                                 "VALUES (%u, '%q', '%q', '%q')", NULL, type_id, value, value2, text);
-	}
-
-	if (real_definition != NULL)
-		g_object_unref (real_definition);
-
-	if (return_value == TRUE && real_definition != NULL)
-		g_signal_emit (self, storage_manager_signals[SIGNAL_DEFINITION_MODIFIED], 0, definition);
-	else if (return_value == TRUE)
-		g_signal_emit (self, storage_manager_signals[SIGNAL_DEFINITION_ADDED], 0, definition);
-
-	return return_value;
-}
-
-gboolean
-almanah_storage_manager_remove_definition (AlmanahStorageManager *self, const gchar *definition_text)
-{
-	if (simple_query (self, "DELETE FROM definitions WHERE definition_text = '%q'", NULL, definition_text) == TRUE) {
-		g_signal_emit (self, storage_manager_signals[SIGNAL_DEFINITION_REMOVED], 0, definition_text);
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
 const gchar *
 almanah_storage_manager_get_filename (AlmanahStorageManager *self, gboolean plain)
 {
diff --git a/src/storage-manager.h b/src/storage-manager.h
index a6c983f..b47dc93 100644
--- a/src/storage-manager.h
+++ b/src/storage-manager.h
@@ -24,7 +24,6 @@
 #include <glib-object.h>
 
 #include "entry.h"
-#include "definition.h"
 
 G_BEGIN_DECLS
 
@@ -72,7 +71,7 @@ AlmanahStorageManager *almanah_storage_manager_new (const gchar *filename);
 gboolean almanah_storage_manager_connect (AlmanahStorageManager *self, GError **error);
 gboolean almanah_storage_manager_disconnect (AlmanahStorageManager *self, GError **error);
 
-gboolean almanah_storage_manager_get_statistics (AlmanahStorageManager *self, guint *entry_count, guint *definition_count);
+gboolean almanah_storage_manager_get_statistics (AlmanahStorageManager *self, guint *entry_count);
 
 gboolean almanah_storage_manager_entry_exists (AlmanahStorageManager *self, GDate *date);
 AlmanahEntry *almanah_storage_manager_get_entry (AlmanahStorageManager *self, GDate *date);
@@ -87,11 +86,6 @@ AlmanahEntry *almanah_storage_manager_get_entries (AlmanahStorageManager *self,
 gboolean *almanah_storage_manager_get_month_marked_days (AlmanahStorageManager *self, GDateYear year, GDateMonth month, guint *num_days);
 gboolean *almanah_storage_manager_get_month_important_days (AlmanahStorageManager *self, GDateYear year, GDateMonth month, guint *num_days);
 
-GSList *almanah_storage_manager_get_definitions (AlmanahStorageManager *self);
-AlmanahDefinition *almanah_storage_manager_get_definition (AlmanahStorageManager *self, const gchar *definition_text);
-gboolean almanah_storage_manager_add_definition (AlmanahStorageManager *self, AlmanahDefinition *definition);
-gboolean almanah_storage_manager_remove_definition (AlmanahStorageManager *self, const gchar *definition_text);
-
 const gchar *almanah_storage_manager_get_filename (AlmanahStorageManager *self, gboolean plain);
 
 G_END_DECLS



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