summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Murphy <hello@itsjamie.dev>2022-07-16 21:48:25 -0700
committerJamie Murphy <hello@itsjamie.dev>2022-07-16 21:48:25 -0700
commitc3870783d81d721e801a05d159d3502cf84f18f4 (patch)
tree693c594bf43e985de0119d0d481be94d8c4ee05a
parentafe9e8bd6eb9a8509af5d1789f24e96bea70bf8b (diff)
downloadgnome-todo-wip/todo-txt.tar.gz
todo-txt: Create ProviderTodoTxt and register itwip/todo-txt
-rw-r--r--src/plugins/task-lists-workspace/gtd-import-export-dialog.c50
-rw-r--r--src/plugins/task-lists-workspace/gtd-import-export-dialog.ui11
-rw-r--r--src/plugins/todo-txt/gtd-plugin-todo-txt.c244
-rw-r--r--src/plugins/todo-txt/gtd-plugin-todo-txt.h5
-rw-r--r--src/plugins/todo-txt/gtd-provider-todo-txt.c184
-rw-r--r--src/plugins/todo-txt/gtd-provider-todo-txt.h (renamed from src/plugins/todo-txt/gtd-task-todo-txt.h)22
-rw-r--r--src/plugins/todo-txt/gtd-task-todo-txt.c53
-rw-r--r--src/plugins/todo-txt/gtd-todo-txt-parser.h1
-rw-r--r--src/plugins/todo-txt/meson.build2
9 files changed, 304 insertions, 268 deletions
diff --git a/src/plugins/task-lists-workspace/gtd-import-export-dialog.c b/src/plugins/task-lists-workspace/gtd-import-export-dialog.c
index 84c0337d..8a46c31b 100644
--- a/src/plugins/task-lists-workspace/gtd-import-export-dialog.c
+++ b/src/plugins/task-lists-workspace/gtd-import-export-dialog.c
@@ -18,6 +18,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#include "endeavour.h"
+
#include "gtd-import-export-dialog.h"
#include "gtd-enum-types.h"
@@ -28,6 +30,7 @@ struct _GtdImportExportDialog
AdwWindow parent;
GtkLabel *select_service_label;
+ GtkListBox *service_listbox;
GtdDialogType dialog_type;
};
@@ -56,6 +59,43 @@ gtd_import_export_dialog_set_type (GtdImportExportDialog *self,
}
/*
+ * Callbacks
+ */
+
+static GtkWidget*
+create_row_for_provider_cb (gpointer item,
+ gpointer user_data)
+{
+ // GtdImportExportDialog *self;
+ GtdImportExportProvider *provider;
+ GtkWidget *row;
+
+ // self = GTD_IMPORT_EXPORT_DIALOG (user_data);
+
+ if (GTD_IS_IMPORT_EXPORT_PROVIDER (item))
+ {
+ provider = GTD_IMPORT_EXPORT_PROVIDER (item);
+ row = adw_action_row_new ();
+
+ adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row),
+ gtd_import_export_provider_get_name (provider));
+
+ adw_action_row_set_subtitle (ADW_ACTION_ROW (row),
+ gtd_import_export_provider_get_description (provider));
+
+ adw_action_row_add_prefix (ADW_ACTION_ROW (row),
+ gtk_image_new_from_gicon (gtd_import_export_provider_get_icon (provider)));
+ }
+ else
+ {
+ row = gtk_list_box_row_new ();
+ }
+
+ return row;
+}
+
+
+/*
* GObject overrides
*/
@@ -118,13 +158,23 @@ gtd_import_export_dialog_class_init (GtdImportExportDialogClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/todo/plugins/task-lists-workspace/gtd-import-export-dialog.ui");
+ gtk_widget_class_bind_template_child (widget_class, GtdImportExportDialog, service_listbox);
gtk_widget_class_bind_template_child (widget_class, GtdImportExportDialog, select_service_label);
}
static void
gtd_import_export_dialog_init (GtdImportExportDialog *self)
{
+ GListModel *model;
+
gtk_widget_init_template (GTK_WIDGET (self));
+
+ model = gtd_manager_get_import_export_providers_model (gtd_manager_get_default ());
+ gtk_list_box_bind_model (self->service_listbox,
+ model,
+ create_row_for_provider_cb,
+ self,
+ NULL);
}
GtkWidget*
diff --git a/src/plugins/task-lists-workspace/gtd-import-export-dialog.ui b/src/plugins/task-lists-workspace/gtd-import-export-dialog.ui
index b2b71866..7c1fff41 100644
--- a/src/plugins/task-lists-workspace/gtd-import-export-dialog.ui
+++ b/src/plugins/task-lists-workspace/gtd-import-export-dialog.ui
@@ -38,6 +38,17 @@
</style>
</object>
</child>
+ <child type="center">
+ <object class="GtkListBox" id="service_listbox">
+ <property name="margin-top">24</property>
+ <property name="hexpand">true</property>
+ <property name="vexpand">true</property>
+ <property name="selection_mode">browse</property>
+ <style>
+ <class name="transparent" />
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/plugins/todo-txt/gtd-plugin-todo-txt.c b/src/plugins/todo-txt/gtd-plugin-todo-txt.c
index 68fc17aa..37971627 100644
--- a/src/plugins/todo-txt/gtd-plugin-todo-txt.c
+++ b/src/plugins/todo-txt/gtd-plugin-todo-txt.c
@@ -1,6 +1,6 @@
/* gtd-plugin-todo-txt.c
*
- * Copyright (C) 2016 Rohit Kaushik <kaushikrohit325@gmail.com>
+ * Copyright (C) 2022 Jamie Murphy <hello@itsjamie.dev>
*
* 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
@@ -20,22 +20,19 @@
#include "gtd-debug.h"
#include "gtd-plugin-todo-txt.h"
+#include "gtd-provider-todo-txt.h"
#include <glib/gi18n.h>
#include <glib-object.h>
/**
- * The #GtdPluginTodoTxt is a class that loads Todo.txt
- * provider of Endeavour.
+ * The #GtdPluginTodoTxt is a class that loads the
+ * #GtdImportExportProvider for Todo.txt support.
*/
struct _GtdPluginTodoTxt
{
- PeasExtensionBase parent;
-
- GFile *source_file;
-
- GSettings *settings;
+ GObject parent;
GtkWidget *preferences_box;
GtkWidget *preferences;
@@ -48,84 +45,60 @@ enum
LAST_PROP
};
-static void on_source_changed_cb (GtkWidget *preference_panel,
- GtdPluginTodoTxt *self);
-
static void gtd_activatable_iface_init (GtdActivatableInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtdPluginTodoTxt, gtd_plugin_todo_txt, PEAS_TYPE_EXTENSION_BASE, 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (GTD_TYPE_ACTIVATABLE, gtd_activatable_iface_init))
-
+G_DEFINE_TYPE_WITH_CODE (GtdPluginTodoTxt, gtd_plugin_todo_txt, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTD_TYPE_ACTIVATABLE, gtd_activatable_iface_init))
/*
- * Auxiliary methods
+ * GtdActivatable interface implementation
*/
-static gboolean
-set_default_source (GtdPluginTodoTxt *self)
+static void
+gtd_plugin_todo_txt_activate (GtdActivatable *activatable)
{
- g_autofree gchar *default_file = NULL;
- g_autoptr (GError) error = NULL;
-
- GTD_ENTRY;
-
- default_file = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS), "todo.txt", NULL);
- self->source_file = g_file_new_for_path (default_file);
+ ;
+}
- if (g_file_query_exists (self->source_file, NULL))
- GTD_RETURN (TRUE);
+static void
+gtd_plugin_todo_txt_deactivate (GtdActivatable *activatable)
+{
+ ;
+}
- g_file_create (self->source_file, G_FILE_CREATE_NONE, NULL, &error);
+static GtkWidget*
+gtd_plugin_todo_txt_get_preferences_panel (GtdActivatable *activatable)
+{
+ GtdPluginTodoTxt *plugin = GTD_PLUGIN_TODO_TXT (activatable);
- if (error)
- {
- gtd_manager_emit_error_message (gtd_manager_get_default (),
- _("Cannot create Todo.txt file"),
- error->message,
- NULL,
- NULL);
- GTD_RETURN (FALSE);
- }
+ return plugin->preferences_box;
- GTD_RETURN (TRUE);
}
-static gboolean
-setup_source (GtdPluginTodoTxt *self)
+static void
+gtd_activatable_iface_init (GtdActivatableInterface *iface)
{
- g_autoptr (GError) error = NULL;
- g_autofree gchar *source = NULL;
+ iface->activate = gtd_plugin_todo_txt_activate;
+ iface->deactivate = gtd_plugin_todo_txt_deactivate;
+ //iface->get_preferences_panel = gtd_plugin_todo_txt_get_preferences_panel;
+}
- GTD_ENTRY;
+/*
+ * Auxiliary methods
+ */
- source = g_settings_get_string (self->settings, "file");
+static void
+gtd_plugin_todo_txt_register_provider (GtdPluginTodoTxt *self)
+{
+ GtdProviderTodoTxt *provider;
+ GtdManager *manager;
- if (!source || source[0] == '\0')
- {
- if (!set_default_source (self))
- GTD_RETURN (FALSE);
- }
- else
- {
- self->source_file = g_file_new_for_path (source);
- }
+ manager = gtd_manager_get_default ();
- if (!g_file_query_exists (self->source_file, NULL))
- {
- g_file_create (self->source_file, G_FILE_CREATE_NONE, NULL, &error);
-
- if (error)
- {
- gtd_manager_emit_error_message (gtd_manager_get_default (),
- _("Cannot create Todo.txt file"),
- error->message,
- NULL,
- NULL);
- GTD_RETURN (FALSE);
- }
- }
+ /* Load the todo.txt provider */
+ provider = gtd_provider_todo_txt_new ();
- GTD_RETURN (TRUE);
+ gtd_manager_add_import_export_provider (manager, GTD_IMPORT_EXPORT_PROVIDER (provider));
}
static void
@@ -134,13 +107,9 @@ setup_preferences_panel (GtdPluginTodoTxt *self)
g_autofree gchar *path = NULL;
GtkWidget *label;
GtkWidget *box;
- gboolean set;
-
- set = setup_source (self);
/* Preferences */
box = g_object_new (GTK_TYPE_BOX,
- "margin", 18,
"spacing", 12,
"expand", TRUE,
"orientation", GTK_ORIENTATION_VERTICAL,
@@ -158,30 +127,6 @@ setup_preferences_panel (GtdPluginTodoTxt *self)
//gtk_container_add (GTK_CONTAINER (box), self->preferences);
/* If there's a file set, select it */
- path = g_settings_get_string (self->settings, "file");
-
- if (path && *path)
- {
- g_autoptr (GError) error = NULL;
- g_autoptr (GFile) file = NULL;
-
- g_debug ("Selecting Todo.txt file %s", path);
-
- file = g_file_new_for_path (path);
-
- gtk_file_chooser_set_file (GTK_FILE_CHOOSER (self->preferences), file, &error);
-
- if (error)
- {
- g_warning ("Error selecting Todo.txt file (%s): %s", path, error->message);
-
- gtd_manager_emit_error_message (gtd_manager_get_default (),
- _("Error opening Todo.txt file"),
- error->message,
- NULL,
- NULL);
- }
- }
/* Big warning label reminding the user that this is experimental */
label = gtk_label_new ("");
@@ -199,95 +144,8 @@ setup_preferences_panel (GtdPluginTodoTxt *self)
/* Store the box, and report it as the preferences panel itself */
self->preferences_box = box;
-
- g_signal_connect (self->preferences, "file-set", G_CALLBACK (on_source_changed_cb), self);
}
-
-/*
- * Callbacks
- */
-
-static void
-on_source_changed_finished_cb (GtdPluginTodoTxt *self)
-{
- gboolean set;
-
- GTD_ENTRY;
-
- set = setup_source (self);
-
- if (!set)
- GTD_RETURN ();
-
- GTD_EXIT;
-}
-
-static void
-on_source_changed_cb (GtkWidget *preference_panel,
- GtdPluginTodoTxt *self)
-{
- g_autoptr (GFile) file = NULL;
-
- GTD_ENTRY;
-
- g_clear_object (&self->source_file);
-
- file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (self->preferences));
- g_settings_set_string (self->settings, "file", g_file_peek_path (file));
-
- on_source_changed_finished_cb (self);
-
- GTD_EXIT;
-}
-
-
-/*
- * GtdActivatable implementation
- */
-
-static void
-gtd_plugin_todo_txt_activate (GtdActivatable *activatable)
-{
-}
-
-static void
-gtd_plugin_todo_txt_deactivate (GtdActivatable *activatable)
-{
-}
-
-static GList*
-gtd_plugin_todo_txt_get_header_widgets (GtdActivatable *activatable)
-{
- return NULL;
-}
-
-static GtkWidget*
-gtd_plugin_todo_txt_get_preferences_panel (GtdActivatable *activatable)
-{
- GtdPluginTodoTxt *plugin = GTD_PLUGIN_TODO_TXT (activatable);
-
- return plugin->preferences_box;
-
-}
-
-static GList*
-gtd_plugin_todo_txt_get_panels (GtdActivatable *activatable)
-{
- return NULL;
-}
-
-static void
-gtd_activatable_iface_init (GtdActivatableInterface *iface)
-{
- iface->activate = gtd_plugin_todo_txt_activate;
- iface->deactivate = gtd_plugin_todo_txt_deactivate;
- // iface->get_header_widgets = gtd_plugin_todo_txt_get_header_widgets;
- // iface->get_preferences_panel = gtd_plugin_todo_txt_get_preferences_panel;
- // iface->get_panels = gtd_plugin_todo_txt_get_panels;
-}
-
-
/*
* GObject overrides
*/
@@ -324,28 +182,16 @@ gtd_plugin_todo_txt_class_init (GtdPluginTodoTxtClass *klass)
object_class->finalize = gtd_plugin_todo_txt_finalize;
object_class->get_property = gtd_plugin_todo_txt_get_property;
- g_object_class_override_property (object_class, PROP_PREFERENCES_PANEL, "preferences-panel");
+ g_object_class_override_property (object_class,
+ PROP_PREFERENCES_PANEL,
+ "preferences-panel");
}
static void
gtd_plugin_todo_txt_init (GtdPluginTodoTxt *self)
{
- self->settings = g_settings_new ("org.gnome.todo.plugins.todo-txt");
-
setup_preferences_panel (self);
-}
-
-static void
-gtd_plugin_todo_txt_class_finalize (GtdPluginTodoTxtClass *klass)
-{
-}
-
-G_MODULE_EXPORT void
-gtd_plugin_todo_txt_register_types (PeasObjectModule *module)
-{
- gtd_plugin_todo_txt_register_type (G_TYPE_MODULE (module));
- peas_object_module_register_extension_type (module,
- GTD_TYPE_ACTIVATABLE,
- GTD_TYPE_PLUGIN_TODO_TXT);
+ /* load the provider */
+ gtd_plugin_todo_txt_register_provider (self);
}
diff --git a/src/plugins/todo-txt/gtd-plugin-todo-txt.h b/src/plugins/todo-txt/gtd-plugin-todo-txt.h
index 2120ce84..2b520214 100644
--- a/src/plugins/todo-txt/gtd-plugin-todo-txt.h
+++ b/src/plugins/todo-txt/gtd-plugin-todo-txt.h
@@ -1,6 +1,6 @@
/* gtd-todo-txt-plugin.h
*
- * Copyright (C) 2016 Rohit Kaushik <kaushikrohit325@gmail.com>
+ * Copyright (C) 2022 Jamie Murphy <hello@itsjamie.dev>
*
* 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
@@ -26,11 +26,8 @@
G_BEGIN_DECLS
#define GTD_TYPE_PLUGIN_TODO_TXT (gtd_plugin_todo_txt_get_type())
-
G_DECLARE_FINAL_TYPE (GtdPluginTodoTxt, gtd_plugin_todo_txt, GTD, PLUGIN_TODO_TXT, PeasExtensionBase)
-G_MODULE_EXPORT void gtd_plugin_todo_txt_register_types (PeasObjectModule *module);
-
G_END_DECLS
#endif /* GTD_TODO_TXT_PLUGIN_H */
diff --git a/src/plugins/todo-txt/gtd-provider-todo-txt.c b/src/plugins/todo-txt/gtd-provider-todo-txt.c
new file mode 100644
index 00000000..ab923f42
--- /dev/null
+++ b/src/plugins/todo-txt/gtd-provider-todo-txt.c
@@ -0,0 +1,184 @@
+/* gtd-provider-todo-txt.c
+ *
+ * Copyright (C) 2022 Jamie Murphy <hello@itsjamie.dev>
+ *
+ * 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/>.
+ */
+
+#define G_LOG_DOMAIN "GtdImportExportProviderTodoTxt"
+
+#include "gtd-provider-todo-txt.h"
+
+#include <glib/gi18n.h>
+
+struct _GtdProviderTodoTxt
+{
+ GtdObject parent;
+
+ GIcon *icon;
+};
+
+static void gtd_import_export_provider_iface_init (GtdImportExportProviderInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtdProviderTodoTxt, gtd_provider_todo_txt, GTD_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTD_TYPE_IMPORT_EXPORT_PROVIDER, gtd_import_export_provider_iface_init))
+
+enum
+{
+ PROP_0,
+ PROP_ENABLED,
+ PROP_DESCRIPTION,
+ PROP_ICON,
+ PROP_ID,
+ PROP_NAME,
+ PROP_PROVIDER_TYPE,
+ N_PROPS
+};
+
+
+/*
+ * GtdImportExportProvider overrides
+ */
+
+static const gchar*
+gtd_provider_todo_txt_get_id (GtdImportExportProvider *provider)
+{
+ return "todo-txt";
+}
+
+static const gchar*
+gtd_provider_todo_txt_get_name (GtdImportExportProvider *provider)
+{
+ return "Todo.txt";
+}
+
+static const gchar*
+gtd_provider_todo_txt_get_provider_type (GtdImportExportProvider *provider)
+{
+ return "todo-txt";
+}
+
+static const gchar*
+gtd_provider_todo_txt_get_description (GtdImportExportProvider *provider)
+{
+ return "Todo.txt";
+}
+
+static gboolean
+gtd_provider_todo_txt_get_enabled (GtdImportExportProvider *provider)
+{
+ return TRUE;
+}
+
+static GIcon*
+gtd_provider_todo_txt_get_icon (GtdImportExportProvider *provider)
+{
+ GtdProviderTodoTxt *self = GTD_PROVIDER_TODO_TXT (provider);
+
+ return self->icon;
+}
+
+static void
+gtd_import_export_provider_iface_init (GtdImportExportProviderInterface *iface)
+{
+ iface->get_id = gtd_provider_todo_txt_get_id;
+ iface->get_name = gtd_provider_todo_txt_get_name;
+ iface->get_provider_type = gtd_provider_todo_txt_get_provider_type;
+ iface->get_description = gtd_provider_todo_txt_get_description;
+ iface->get_enabled = gtd_provider_todo_txt_get_enabled;
+ // iface->refresh = gtd_provider_todo_txt_refresh;
+ iface->get_icon = gtd_provider_todo_txt_get_icon;
+}
+
+/*
+ * GObject overrides
+ */
+
+static void
+gtd_provider_todo_txt_finalize (GObject *object)
+{
+ GtdProviderTodoTxt *self = (GtdProviderTodoTxt *)object;
+
+ g_clear_object (&self->icon);
+
+ G_OBJECT_CLASS (gtd_provider_todo_txt_parent_class)->finalize (object);
+}
+
+static void
+gtd_provider_todo_txt_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtdImportExportProvider *provider = GTD_IMPORT_EXPORT_PROVIDER (object);
+
+ switch (prop_id)
+ {
+ case PROP_DESCRIPTION:
+ g_value_set_string (value, gtd_provider_todo_txt_get_description (provider));
+ break;
+
+ case PROP_ENABLED:
+ g_value_set_boolean (value, gtd_provider_todo_txt_get_enabled (provider));
+ break;
+
+ case PROP_ICON:
+ g_value_set_object (value, gtd_provider_todo_txt_get_icon (provider));
+ break;
+
+ case PROP_ID:
+ g_value_set_string (value, gtd_provider_todo_txt_get_id (provider));
+ break;
+
+ case PROP_NAME:
+ g_value_set_string (value, gtd_provider_todo_txt_get_name (provider));
+ break;
+
+ case PROP_PROVIDER_TYPE:
+ g_value_set_string (value, gtd_provider_todo_txt_get_provider_type (provider));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gtd_provider_todo_txt_class_init (GtdProviderTodoTxtClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gtd_provider_todo_txt_finalize;
+ object_class->get_property = gtd_provider_todo_txt_get_property;
+
+ g_object_class_override_property (object_class, PROP_DESCRIPTION, "description");
+ g_object_class_override_property (object_class, PROP_ENABLED, "enabled");
+ g_object_class_override_property (object_class, PROP_ICON, "icon");
+ g_object_class_override_property (object_class, PROP_ID, "id");
+ g_object_class_override_property (object_class, PROP_NAME, "name");
+ g_object_class_override_property (object_class, PROP_PROVIDER_TYPE, "provider-type");
+}
+
+static void
+gtd_provider_todo_txt_init (GtdProviderTodoTxt *self)
+{
+ self->icon = G_ICON (g_themed_icon_new_with_default_fallbacks ("accessories-text-editor-symbolic"));
+}
+
+GtdProviderTodoTxt*
+gtd_provider_todo_txt_new ()
+{
+ return g_object_new (GTD_TYPE_PROVIDER_TODO_TXT,
+ NULL);
+}
diff --git a/src/plugins/todo-txt/gtd-task-todo-txt.h b/src/plugins/todo-txt/gtd-provider-todo-txt.h
index 26879fc4..feed4271 100644
--- a/src/plugins/todo-txt/gtd-task-todo-txt.h
+++ b/src/plugins/todo-txt/gtd-provider-todo-txt.h
@@ -1,6 +1,6 @@
-/* gtd-task-todo-txt.h
+/* gtd-provider-todo-txt.h
*
- * Copyright (C) 2018 Rohit Kaushik <kaushikrohit325@gmail.com>
+ * Copyright (C) 2022 Jamie Murphy <hello@itsjamie.dev>
*
* 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
@@ -16,19 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#pragma once
+#ifndef GTD_PROVIDER_TODO_TXT_H
+#define GTD_PROVIDER_TODO_TXT_H
#include "endeavour.h"
+#include "gtd-import-export-provider.h"
-G_BEGIN_DECLS
-
-#define GTD_TYPE_TASK_TODO_TXT (gtd_task_todo_txt_get_type())
+#include <glib.h>
-G_DECLARE_FINAL_TYPE (GtdTaskTodoTxt, gtd_task_todo_txt, GTD, TASK_TODO_TXT, GtdTask)
+G_BEGIN_DECLS
-GtdTaskTodoTxt* gtd_task_todo_txt_new (void);
+#define GTD_TYPE_PROVIDER_TODO_TXT (gtd_provider_todo_txt_get_type())
+G_DECLARE_FINAL_TYPE (GtdProviderTodoTxt, gtd_provider_todo_txt, GTD, PROVIDER_TODO_TXT, GtdObject)
-void gtd_task_todo_txt_set_completion_date (GtdTaskTodoTxt *self,
- GDateTime *dt);
+GtdProviderTodoTxt* gtd_provider_todo_txt_new ();
G_END_DECLS
+
+#endif /* GTD_PROVIDER_TODO_TXT_H */
diff --git a/src/plugins/todo-txt/gtd-task-todo-txt.c b/src/plugins/todo-txt/gtd-task-todo-txt.c
deleted file mode 100644
index e7018890..00000000
--- a/src/plugins/todo-txt/gtd-task-todo-txt.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* gtd-task-todo-txt.c
- *
- * Copyright (C) 2018 Rohit Kaushik <kaushikrohit325@gmail.com>
- *
- * 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/>.
- */
-
-#define G_LOG_DOMAIN "GtdTaskTodoTxt"
-
-#include "gtd-task-todo-txt.h"
-
-struct _GtdTaskTodoTxt
-{
- GtdTask parent;
-};
-
-G_DEFINE_TYPE (GtdTaskTodoTxt, gtd_task_todo_txt, GTD_TYPE_TASK)
-
-static void
-gtd_task_todo_txt_class_init (GtdTaskTodoTxtClass *klass)
-{
-}
-
-static void
-gtd_task_todo_txt_init (GtdTaskTodoTxt *self)
-{
-}
-
-GtdTaskTodoTxt*
-gtd_task_todo_txt_new (void)
-{
- return g_object_new (GTD_TYPE_TASK_TODO_TXT, NULL);
-}
-
-void
-gtd_task_todo_txt_set_completion_date (GtdTaskTodoTxt *self,
- GDateTime *dt)
-{
- g_return_if_fail (GTD_IS_TASK_TODO_TXT (self));
-
- GTD_TASK_CLASS (gtd_task_todo_txt_parent_class)->set_completion_date (GTD_TASK (self), dt);
-}
diff --git a/src/plugins/todo-txt/gtd-todo-txt-parser.h b/src/plugins/todo-txt/gtd-todo-txt-parser.h
index 418c301c..3d5f4c07 100644
--- a/src/plugins/todo-txt/gtd-todo-txt-parser.h
+++ b/src/plugins/todo-txt/gtd-todo-txt-parser.h
@@ -22,7 +22,6 @@
#define INDENT_LEN 4
#include "endeavour.h"
-#include "gtd-task-todo-txt.h"
#include <glib.h>
diff --git a/src/plugins/todo-txt/meson.build b/src/plugins/todo-txt/meson.build
index ff9fac40..f76daead 100644
--- a/src/plugins/todo-txt/meson.build
+++ b/src/plugins/todo-txt/meson.build
@@ -2,8 +2,8 @@ plugins_ldflags += ['-Wl,--undefined=todo_txt_plugin_register_types']
plugins_sources += files(
'gtd-plugin-todo-txt.c',
+ 'gtd-provider-todo-txt.c',
'gtd-todo-txt-parser.c',
- 'gtd-task-todo-txt.c',
'todo-txt-plugin.c',
)