[gnome-todo] unscheduled-tasks: add plugin to manage unscheduled tasks
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] unscheduled-tasks: add plugin to manage unscheduled tasks
- Date: Fri, 17 Jun 2016 19:21:22 +0000 (UTC)
commit f64638ed3221d9b6dfcf51fb1756cc78aaad9ba2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jun 17 16:20:09 2016 -0300
unscheduled-tasks: add plugin to manage unscheduled tasks
configure.ac | 4 +-
plugins/Makefile.am | 5 +
plugins/unscheduled-panel/Makefile.am | 8 ++
.../unscheduled-panel/unscheduled-panel.plugin.in | 13 +++
.../unscheduled-panel/__init__.py | 114 ++++++++++++++++++++
5 files changed, 143 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 415a4b2..7914220 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ dnl Plugins
dnl ================================================================
GNOME_TODO_ADD_PLUGIN([eds], [Evolution-Data-Server], [yes])
GNOME_TODO_ADD_PLUGIN([score], [Score], [yes])
+GNOME_TODO_ADD_PLUGIN([unscheduled-panel], [Unscheduled Tasks Panel], [yes])
AC_CONFIG_FILES([
Makefile
@@ -117,7 +118,8 @@ echo "
release: ${ax_is_release}
Plugins:
- Score: ${enable_score_plugin}
+ Score.................... ${enable_score_plugin}
+ Unscheduled panel........ ${enable_unscheduled_panel_plugin}
Now type 'make' to build $PACKAGE
"
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 2e9957e..e7f5b89 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -4,4 +4,9 @@ if BUILD_SCORE_PLUGIN
SUBDIRS += score
endif
+if BUILD_UNSCHEDULED_PANEL_PLUGIN
+SUBDIRS += unscheduled-panel
+endif
+
+
MAINTAINERCLEANFILES = Makefile.in
diff --git a/plugins/unscheduled-panel/Makefile.am b/plugins/unscheduled-panel/Makefile.am
new file mode 100644
index 0000000..6f6e1e1
--- /dev/null
+++ b/plugins/unscheduled-panel/Makefile.am
@@ -0,0 +1,8 @@
+include $(top_srcdir)/common.am
+
+EXTRA_DIST = $(plugin_DATA)
+
+score_plugindir = $(plugindir)/unscheduled-panel
+score_plugin_DATA = unscheduled-panel.plugin
+nobase_score_plugin_DATA = \
+ unscheduled-panel/__init__.py
diff --git a/plugins/unscheduled-panel/unscheduled-panel.plugin.in
b/plugins/unscheduled-panel/unscheduled-panel.plugin.in
new file mode 100644
index 0000000..a72c7c6
--- /dev/null
+++ b/plugins/unscheduled-panel/unscheduled-panel.plugin.in
@@ -0,0 +1,13 @@
+[Plugin]
+Name = Unscheduled Panel
+Module = unscheduled-panel
+Description = Adds a panel to show unscheduled tasks
+Version = @VERSION@
+Authors = Georges Basile Stavracas Neto <gbsneto gnome org>
+Copyright = Copyleft © The To Do maintainers
+Website = https://wiki.gnome.org/Apps/Todo
+Builtin = false
+Hidden = false
+License = GPL
+Loader = python3
+Depends =
diff --git a/plugins/unscheduled-panel/unscheduled-panel/__init__.py
b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
new file mode 100644
index 0000000..667f538
--- /dev/null
+++ b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python3
+
+# __init__.py
+#
+# Copyright (C) 2016 Georges Basile Stavracas Neto <georges stavracas 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/>.
+
+import gi
+
+gi.require_version('Gtd', '1.0')
+gi.require_version('Peas', '1.0')
+
+from gi.repository import Gio, GLib, GObject, Gtd, Gtk, Peas
+
+from gettext import gettext as _
+
+
+class UnscheduledPanel(Gtk.Box, Gtd.Panel):
+
+ menu = GObject.Property(type=Gio.Menu, default=None)
+ name = GObject.Property(type=str, default=_("unscheduled-panel"))
+ title = GObject.Property(type=str, default=_("Unscheduled"))
+
+ def __init__(self):
+ Gtk.Box.__init__(self)
+
+ manager = Gtd.Manager.get_default()
+ manager.connect('list-added', self._count_tasks)
+ manager.connect('list-changed', self._count_tasks)
+ manager.connect('list-removed', self._count_tasks)
+
+ self.task_counter = 0
+ self.tasklist = Gtd.TaskList()
+
+ self.view = Gtd.TaskListView(hexpand=True,
+ vexpand=True)
+ self.view.set_show_list_name(True)
+ self.view.set_task_list(self.tasklist)
+
+ self.add(self.view)
+ self.show_all()
+
+ self._count_tasks()
+
+ def _count_tasks(self, unused_0=None, unused_1=None):
+
+ previous_task_counter = self.task_counter
+ self.task_counter = 0
+
+ manager = Gtd.Manager.get_default()
+ current_tasks = self.tasklist.get_tasks()
+
+ for tasklist in manager.get_task_lists():
+ for task in tasklist.get_tasks():
+ if not task in current_tasks and task.get_due_date() is None:
+ self.tasklist.save_task(task)
+ self.task_counter += 1
+
+ if previous_task_counter == self.task_counter:
+ self.notify("title")
+
+ def do_get_header_widgets(self):
+ return None
+
+ def do_get_menu(self):
+ return None
+
+ def do_get_panel_name(self):
+ return "unscheduled-panel"
+
+ def do_get_panel_title(self):
+ if self.task_counter == 0:
+ return _("Unscheduled")
+ else:
+ return _("Unscheduled (%d)" % self.task_counter)
+
+class UnscheduledPanelPlugin(GObject.Object, Gtd.Activatable):
+
+ preferences_panel = GObject.Property(type=Gtk.Widget, default=None)
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+
+ self.panel = UnscheduledPanel()
+
+ def do_activate(self):
+ pass
+
+ def do_deactivate(self):
+ pass
+
+ def do_get_header_widgets(self):
+ return None
+
+ def do_get_panels(self):
+ return [self.panel]
+
+ def do_get_preferences_panel(self):
+ return None
+
+ def do_get_providers(self):
+ return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]