[gnome-todo] task-list-popover: Factor out from GtdNewTaskRow



commit bbd3993d9f4672bd7eee99dd194089abee424e0b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Sep 5 10:39:59 2018 -0300

    task-list-popover: Factor out from GtdNewTaskRow
    
    This will allow a more contained implementation of the
    tasklist selector popover. Search is almost there, but
    lacks a filter list model to enable that.

 data/todo.gresource.xml                    |   1 +
 data/ui/new-task-row.ui                    |  18 +--
 data/ui/task-list-popover.ui               |  42 ++++++
 src/meson.build                            |   1 +
 src/task-list-view/gtd-new-task-row.c      | 204 +++++----------------------
 src/task-list-view/gtd-task-list-popover.c | 217 +++++++++++++++++++++++++++++
 src/task-list-view/gtd-task-list-popover.h |  34 +++++
 7 files changed, 334 insertions(+), 183 deletions(-)
---
diff --git a/data/todo.gresource.xml b/data/todo.gresource.xml
index 86c248b..3414390 100644
--- a/data/todo.gresource.xml
+++ b/data/todo.gresource.xml
@@ -18,6 +18,7 @@
     <file compressed="true" preprocess="xml-stripblanks">ui/provider-row.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/provider-selector.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/task-list-panel.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/task-list-popover.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/task-row.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
     <file compressed="true">theme/Adwaita.css</file>
diff --git a/data/ui/new-task-row.ui b/data/ui/new-task-row.ui
index 44545eb..d7af358 100644
--- a/data/ui/new-task-row.ui
+++ b/data/ui/new-task-row.ui
@@ -27,22 +27,10 @@
     </child>
   </template>
 
-  <object class="GtkPopover" id="tasklist_popover">
+  <object class="GtdTaskListPopover" id="tasklist_popover">
     <property name="can_focus">False</property>
     <property name="relative-to">entry</property>
-    <child>
-      <object class="GtkListBox" id="tasklist_list">
-        <property name="can_focus">False</property>
-        <property name="margin">12</property>
-        <property name="selection_mode">none</property>
-        <signal name="row-activated" handler="tasklist_selected_cb" object="GtdNewTaskRow" swapped="no" />
-        <style>
-          <class name="background" />
-        </style>
-      </object>
-    </child>
-  </object>
-  <object class="GtkSizeGroup" id="sizegroup">
-    <property name="mode">horizontal</property>
+    <signal name="notify::task-list" handler="on_tasklist_popover_changed_cb" object="GtdNewTaskRow" 
swapped="no" />
+    <signal name="closed" handler="on_tasklist_popover_closed_cb" object="GtdNewTaskRow" swapped="no" 
after="yes" />
   </object>
 </interface>
diff --git a/data/ui/task-list-popover.ui b/data/ui/task-list-popover.ui
new file mode 100644
index 0000000..2a2f3f6
--- /dev/null
+++ b/data/ui/task-list-popover.ui
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtdTaskListPopover" parent="GtkPopover">
+    <child>
+      <object class="GtkBox">
+        <property name="margin">18</property>
+        <property name="spacing">12</property>
+        <property name="orientation">vertical</property>
+
+        <!-- Search entry -->
+        <child>
+          <object class="GtkSearchEntry" id="search_entry">
+            <property name="visible">false</property>
+          </object>
+        </child>
+
+        <!-- Listbox -->
+        <child>
+          <object class="GtkScrolledWindow">
+            <property name="hscrollbar-policy">never</property>
+            <property name="max-content-height">480</property>
+            <property name="propagate-natural-height">true</property>
+            <child>
+              <object class="GtkListBox" id="listbox">
+                <property name="selection_mode">none</property>
+                <signal name="row-activated" handler="on_listbox_row_activated_cb" 
object="GtdTaskListPopover" swapped="no" />
+                <style>
+                  <class name="background" />
+                </style>
+              </object>
+            </child>
+          </object>
+        </child>
+
+      </object>
+    </child>
+  </template>
+
+  <object class="GtkSizeGroup" id="sizegroup">
+    <property name="mode">horizontal</property>
+  </object>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index faf2a9f..7128f4f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -49,6 +49,7 @@ sources = files(
   'task-list-view/gtd-dnd-row.c',
   'task-list-view/gtd-markdown-renderer.c',
   'task-list-view/gtd-new-task-row.c',
+  'task-list-view/gtd-task-list-popover.c',
   'task-list-view/gtd-task-list-view.c',
   'task-list-view/gtd-task-row.c',
   'widgets/gtd-color-button.c',
diff --git a/src/task-list-view/gtd-new-task-row.c b/src/task-list-view/gtd-new-task-row.c
index da61aa5..12db224 100644
--- a/src/task-list-view/gtd-new-task-row.c
+++ b/src/task-list-view/gtd-new-task-row.c
@@ -25,6 +25,7 @@
 #include "gtd-rows-common-private.h"
 #include "gtd-task.h"
 #include "gtd-task-list.h"
+#include "gtd-task-list-popover.h"
 #include "gtd-task-list-view.h"
 #include "gtd-utils.h"
 
@@ -36,13 +37,7 @@ struct _GtdNewTaskRow
   GtkBin              parent;
 
   GtkEntry           *entry;
-  GtkSizeGroup       *sizegroup;
-  GtkListBox         *tasklist_list;
-  GtkPopover         *tasklist_popover;
-
-  GtdTaskList        *selected_tasklist;
-
-  GtdManager         *manager;
+  GtdTaskListPopover *tasklist_popover;
 
   gboolean            show_list_selector;
 };
@@ -74,6 +69,7 @@ update_secondary_icon (GtdNewTaskRow *self)
   g_autoptr (GdkPaintable) paintable = NULL;
   g_autoptr (GdkRGBA) color = NULL;
   g_autofree gchar *tooltip = NULL;
+  GtdTaskList *selected_list;
 
   if (!self->show_list_selector)
     {
@@ -81,57 +77,37 @@ update_secondary_icon (GtdNewTaskRow *self)
       return;
     }
 
-  if (!self->selected_tasklist)
+  selected_list = gtd_task_list_popover_get_task_list (GTD_TASK_LIST_POPOVER (self->tasklist_popover));
+
+  if (!selected_list)
     return;
 
-  color = gtd_task_list_get_color (self->selected_tasklist);
+  color = gtd_task_list_get_color (selected_list);
   paintable = gtd_create_circular_paintable (color, 12);
 
   gtk_entry_set_icon_from_paintable (self->entry, GTK_ENTRY_ICON_SECONDARY, paintable);
 
   /* Translators: %1$s is the task list name, %2$s is the provider name */
   tooltip = g_strdup_printf (_("%1$s \t <small>%2$s</small>"),
-                             gtd_task_list_get_name (self->selected_tasklist),
-                             gtd_provider_get_description (gtd_task_list_get_provider 
(self->selected_tasklist)));
+                             gtd_task_list_get_name (selected_list),
+                             gtd_provider_get_description (gtd_task_list_get_provider (selected_list)));
   gtk_entry_set_icon_tooltip_markup (self->entry, GTK_ENTRY_ICON_SECONDARY, tooltip);
 }
 
-static void
-set_selected_tasklist (GtdNewTaskRow *self,
-                       GtdTaskList   *list)
-{
-  GtdManager *manager;
-
-  manager = gtd_manager_get_default ();
-
-  /* NULL list means the default */
-  if (!list)
-    list = gtd_manager_get_default_task_list (manager);
-
-  if (g_set_object (&self->selected_tasklist, list))
-    update_secondary_icon (self);
-}
-
 static void
 show_task_list_selector_popover (GtdNewTaskRow *self)
 {
   GdkRectangle rect;
 
   gtk_entry_get_icon_area (self->entry, GTK_ENTRY_ICON_SECONDARY, &rect);
-  gtk_popover_set_pointing_to (self->tasklist_popover, &rect);
-  gtk_popover_popup (self->tasklist_popover);
+  gtk_popover_set_pointing_to (GTK_POPOVER (self->tasklist_popover), &rect);
+  gtk_popover_popup (GTK_POPOVER (self->tasklist_popover));
 }
 
 /*
  * Callbacks
  */
 
-static void
-default_tasklist_changed_cb (GtdNewTaskRow *self)
-{
-  set_selected_tasklist (self, NULL);
-}
-
 static void
 entry_activated_cb (GtdNewTaskRow *self)
 {
@@ -153,17 +129,13 @@ entry_activated_cb (GtdNewTaskRow *self)
    * If there is no current list set, use the default list from the
    * default provider.
    */
+  if (!list)
+    list = gtd_task_list_popover_get_task_list (GTD_TASK_LIST_POPOVER (self->tasklist_popover));
+
   if (!list)
     {
-      if (self->selected_tasklist)
-        {
-          list = self->selected_tasklist;
-        }
-      else
-        {
-          GtdProvider *provider = gtd_manager_get_default_provider (gtd_manager_get_default ());
-          list = gtd_provider_get_default_task_list (provider);
-        }
+      GtdProvider *provider = gtd_manager_get_default_provider (gtd_manager_get_default ());
+      list = gtd_provider_get_default_task_list (provider);
     }
 
   g_return_if_fail (GTD_IS_TASK_LIST (list));
@@ -176,21 +148,6 @@ entry_activated_cb (GtdNewTaskRow *self)
   gtk_entry_set_text (self->entry, "");
 }
 
-static void
-tasklist_selected_cb (GtkListBox    *listbox,
-                      GtkListBoxRow *row,
-                      GtdNewTaskRow *self)
-{
-  GtdTaskList *list;
-
-  list = g_object_get_data (G_OBJECT (row), "tasklist");
-
-  set_selected_tasklist (self, list);
-
-  gtk_popover_popdown (self->tasklist_popover);
-  gtk_entry_grab_focus_without_selecting (self->entry);
-}
-
 static void
 on_entry_icon_released_cb (GtkEntry             *entry,
                            GtkEntryIconPosition  position,
@@ -220,72 +177,30 @@ on_focus_in_cb (GtkEventControllerKey *event_controller,
 }
 
 static void
-destroy_widget_cb (GtkWidget *widget,
-                   gpointer   user_data)
+on_tasklist_popover_changed_cb (GtdTaskListPopover *popover,
+                                GParamSpec         *pspec,
+                                GtdNewTaskRow      *self)
 {
-  gtk_widget_destroy (widget);
+  GTD_ENTRY;
+
+  update_secondary_icon (self);
+
+  GTD_EXIT;
 }
 
 static void
-update_tasklists_cb (GtdNewTaskRow *self)
+on_tasklist_popover_closed_cb (GtdTaskListPopover *popover,
+                               GtdNewTaskRow      *self)
 {
-  GList *tasklists, *l;
-
-  gtk_container_foreach (GTK_CONTAINER (self->tasklist_list), destroy_widget_cb, NULL);
-
-  tasklists = gtd_manager_get_task_lists (self->manager);
+  GTD_ENTRY;
 
-  for (l = tasklists; l != NULL; l = l->next)
-    {
-      g_autoptr (GdkPaintable) paintable = NULL;
-      g_autoptr (GdkRGBA) color = NULL;
-      GtkWidget *row, *box, *icon, *name, *provider;
-
-      box = g_object_new (GTK_TYPE_BOX,
-                          "orientation", GTK_ORIENTATION_HORIZONTAL,
-                          "spacing", 12,
-                          "margin", 6,
-                          NULL);
-
-      /* Icon */
-      color = gtd_task_list_get_color (l->data);
-      paintable = gtd_create_circular_paintable (color, 12);
-      icon = gtk_image_new_from_paintable (paintable);
-      gtk_widget_set_size_request (icon, 12, 12);
-      gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
-      gtk_widget_set_valign (icon, GTK_ALIGN_CENTER);
-
-      gtk_container_add (GTK_CONTAINER (box), icon);
-
-      /* Tasklist name */
-      name = g_object_new (GTK_TYPE_LABEL,
-                           "label", gtd_task_list_get_name (l->data),
-                           "xalign", 0.0,
-                           "hexpand", TRUE,
-                           NULL);
-
-      gtk_container_add (GTK_CONTAINER (box), name);
-
-      /* Provider name */
-      provider = g_object_new (GTK_TYPE_LABEL,
-                               "label", gtd_provider_get_description (gtd_task_list_get_provider (l->data)),
-                               "xalign", 0.0,
-                               NULL);
-      gtk_style_context_add_class (gtk_widget_get_style_context (provider), "dim-label");
-      gtk_size_group_add_widget (self->sizegroup, provider);
-      gtk_container_add (GTK_CONTAINER (box), provider);
-
-      /* The row itself */
-      row = gtk_list_box_row_new ();
-      gtk_container_add (GTK_CONTAINER (row), box);
-      gtk_container_add (GTK_CONTAINER (self->tasklist_list), row);
-
-      g_object_set_data (G_OBJECT (row), "tasklist", l->data);
-    }
+  //gtk_entry_grab_focus_without_selecting (self->entry);
+  gtk_widget_grab_focus (GTK_WIDGET (self->entry));
 
-  g_list_free (tasklists);
+  GTD_EXIT;
 }
 
+
 static void
 gtd_new_task_row_get_property (GObject    *object,
                                guint       prop_id,
@@ -304,36 +219,12 @@ gtd_new_task_row_set_property (GObject      *object,
   G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 }
 
-static void
-gtd_new_task_row_dispose (GObject *object)
-{
-  GtdNewTaskRow *self = GTD_NEW_TASK_ROW (object);
-
-  if (self->manager)
-    {
-      g_signal_handlers_disconnect_by_func (self->manager,
-                                            update_tasklists_cb,
-                                            self);
-
-      g_signal_handlers_disconnect_by_func (self->manager,
-                                            default_tasklist_changed_cb,
-                                            self);
-
-      self->manager = NULL;
-    }
-
-  g_clear_object (&self->selected_tasklist);
-
-  G_OBJECT_CLASS (gtd_new_task_row_parent_class)->dispose (object);
-}
-
 static void
 gtd_new_task_row_class_init (GtdNewTaskRowClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->dispose = gtd_new_task_row_dispose;
   object_class->get_property = gtd_new_task_row_get_property;
   object_class->set_property = gtd_new_task_row_set_property;
 
@@ -372,48 +263,25 @@ gtd_new_task_row_class_init (GtdNewTaskRowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/new-task-row.ui");
 
   gtk_widget_class_bind_template_child (widget_class, GtdNewTaskRow, entry);
-  gtk_widget_class_bind_template_child (widget_class, GtdNewTaskRow, sizegroup);
-  gtk_widget_class_bind_template_child (widget_class, GtdNewTaskRow, tasklist_list);
   gtk_widget_class_bind_template_child (widget_class, GtdNewTaskRow, tasklist_popover);
 
   gtk_widget_class_bind_template_callback (widget_class, entry_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_entry_icon_released_cb);
   gtk_widget_class_bind_template_callback (widget_class, on_focus_in_cb);
-  gtk_widget_class_bind_template_callback (widget_class, tasklist_selected_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_tasklist_popover_changed_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_tasklist_popover_closed_cb);
 
   gtk_widget_class_set_css_name (widget_class, "newtaskrow");
+
+  g_type_ensure (GTD_TYPE_TASK_LIST_POPOVER);
 }
 
 static void
 gtd_new_task_row_init (GtdNewTaskRow *self)
 {
-  GtdManager *manager = gtd_manager_get_default ();
-
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  g_signal_connect_swapped (manager,
-                            "list-added",
-                            G_CALLBACK (update_tasklists_cb),
-                            self);
-
-  g_signal_connect_swapped (manager,
-                            "list-changed",
-                            G_CALLBACK (update_tasklists_cb),
-                            self);
-
-  g_signal_connect_swapped (manager,
-                            "list-removed",
-                            G_CALLBACK (update_tasklists_cb),
-                            self);
-
-  g_signal_connect_swapped (manager,
-                            "notify::default-task-list",
-                            G_CALLBACK (default_tasklist_changed_cb),
-                            self);
-
-  self->manager = manager;
-
-  set_selected_tasklist (self, NULL);
+  update_secondary_icon (self);
 }
 
 GtkWidget*
diff --git a/src/task-list-view/gtd-task-list-popover.c b/src/task-list-view/gtd-task-list-popover.c
new file mode 100644
index 0000000..3ddbf6f
--- /dev/null
+++ b/src/task-list-view/gtd-task-list-popover.c
@@ -0,0 +1,217 @@
+/* gtd-task-list-popover.c
+ *
+ * Copyright 2018 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "GtdTaskListPopover"
+
+#include "gtd-manager.h"
+#include "gtd-provider.h"
+#include "gtd-task-list.h"
+#include "gtd-task-list-popover.h"
+#include "gtd-utils.h"
+
+struct _GtdTaskListPopover
+{
+  GtkPopover          parent;
+
+  GtkSizeGroup       *sizegroup;
+  GtkListBox         *listbox;
+
+  GtdTaskList        *selected_list;
+  GtdManager         *manager;
+};
+
+G_DEFINE_TYPE (GtdTaskListPopover, gtd_task_list_popover, GTK_TYPE_POPOVER)
+
+enum
+{
+  PROP_0,
+  PROP_TASK_LIST,
+  N_PROPS
+};
+
+static GParamSpec *properties[N_PROPS] = { NULL, };
+
+/*
+ * Auxiliary methods
+ */
+
+static void
+set_selected_tasklist (GtdTaskListPopover *self,
+                       GtdTaskList        *list)
+{
+  GtdManager *manager;
+
+  manager = gtd_manager_get_default ();
+
+  /* NULL list means the default */
+  if (!list)
+    list = gtd_manager_get_default_task_list (manager);
+
+  if (g_set_object (&self->selected_list, list))
+    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TASK_LIST]);
+}
+
+
+/*
+ * Callbacks
+ */
+
+static GtkWidget*
+create_list_row_cb (gpointer item,
+                    gpointer data)
+{
+  g_autoptr (GdkPaintable) paintable = NULL;
+  g_autoptr (GdkRGBA) color = NULL;
+  GtdTaskListPopover *self;
+  GtkWidget *provider;
+  GtkWidget *icon;
+  GtkWidget *name;
+  GtkWidget *row;
+  GtkWidget *box;
+
+  self = GTD_TASK_LIST_POPOVER (data);
+  box = g_object_new (GTK_TYPE_BOX,
+                      "orientation", GTK_ORIENTATION_HORIZONTAL,
+                      "spacing", 12,
+                      "margin", 6,
+                      NULL);
+
+  /* Icon */
+  color = gtd_task_list_get_color (item);
+  paintable = gtd_create_circular_paintable (color, 12);
+  icon = gtk_image_new_from_paintable (paintable);
+  gtk_widget_set_size_request (icon, 12, 12);
+  gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (icon, GTK_ALIGN_CENTER);
+
+  gtk_container_add (GTK_CONTAINER (box), icon);
+
+  /* Tasklist name */
+  name = g_object_new (GTK_TYPE_LABEL,
+                       "label", gtd_task_list_get_name (item),
+                       "xalign", 0.0,
+                       "hexpand", TRUE,
+                       NULL);
+
+  gtk_container_add (GTK_CONTAINER (box), name);
+
+  /* Provider name */
+  provider = g_object_new (GTK_TYPE_LABEL,
+                           "label", gtd_provider_get_description (gtd_task_list_get_provider (item)),
+                           "xalign", 0.0,
+                           NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (provider), "dim-label");
+  gtk_size_group_add_widget (self->sizegroup, provider);
+  gtk_container_add (GTK_CONTAINER (box), provider);
+
+  /* The row itself */
+  row = gtk_list_box_row_new ();
+  gtk_container_add (GTK_CONTAINER (row), box);
+
+  g_object_set_data (G_OBJECT (row), "tasklist", item);
+
+  return row;
+}
+
+static void
+on_default_tasklist_changed_cb (GtdTaskListPopover *self)
+{
+  set_selected_tasklist (self, NULL);
+}
+
+static void
+on_listbox_row_activated_cb (GtkListBox         *listbox,
+                             GtkListBoxRow      *row,
+                             GtdTaskListPopover *self)
+{
+  GtdTaskList *list = g_object_get_data (G_OBJECT (row), "tasklist");
+
+  set_selected_tasklist (self, list);
+  gtk_popover_popdown (GTK_POPOVER (self));
+}
+
+
+/*
+ * GObject overrides
+ */
+
+static void
+gtd_task_list_popover_finalize (GObject *object)
+{
+  GtdTaskListPopover *self = (GtdTaskListPopover *)object;
+
+  g_clear_object (&self->selected_list);
+
+  G_OBJECT_CLASS (gtd_task_list_popover_parent_class)->finalize (object);
+}
+
+static void
+gtd_task_list_popover_class_init (GtdTaskListPopoverClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = gtd_task_list_popover_finalize;
+
+  properties[PROP_TASK_LIST] = g_param_spec_object ("task-list",
+                                                    "Task list",
+                                                    "Task list",
+                                                    GTD_TYPE_TASK_LIST,
+                                                    G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/task-list-popover.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, GtdTaskListPopover, listbox);
+  gtk_widget_class_bind_template_child (widget_class, GtdTaskListPopover, sizegroup);
+
+  gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated_cb);
+}
+
+static void
+gtd_task_list_popover_init (GtdTaskListPopover *self)
+{
+  GtdManager *manager = gtd_manager_get_default ();
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  gtk_list_box_bind_model (self->listbox,
+                           gtd_manager_get_task_lists_model (manager),
+                           create_list_row_cb,
+                           self,
+                           NULL);
+
+  g_signal_connect_object (manager,
+                           "notify::default-task-list",
+                           G_CALLBACK (on_default_tasklist_changed_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  self->manager = manager;
+
+  set_selected_tasklist (self, NULL);
+}
+
+GtdTaskList*
+gtd_task_list_popover_get_task_list (GtdTaskListPopover *self)
+{
+  g_return_val_if_fail (GTD_IS_TASK_LIST_POPOVER (self), NULL);
+
+  return self->selected_list;
+}
diff --git a/src/task-list-view/gtd-task-list-popover.h b/src/task-list-view/gtd-task-list-popover.h
new file mode 100644
index 0000000..2a57ea9
--- /dev/null
+++ b/src/task-list-view/gtd-task-list-popover.h
@@ -0,0 +1,34 @@
+/* gtd-task-list-popover.h
+ *
+ * Copyright 2018 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "gtd-types.h"
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTD_TYPE_TASK_LIST_POPOVER (gtd_task_list_popover_get_type())
+
+G_DECLARE_FINAL_TYPE (GtdTaskListPopover, gtd_task_list_popover, GTD, TASK_LIST_POPOVER, GtkPopover)
+
+GtdTaskList*         gtd_task_list_popover_get_task_list         (GtdTaskListPopover *self);
+
+G_END_DECLS


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