[gnome-todo/wip/gbsneto/plugins: 6/10] manager, window: removed unused code



commit 19b1383de7c16cb6427ca9354a320075127af01a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Dec 27 21:43:58 2015 -0200

    manager, window: removed unused code
    
    All this code will be ported to the new plugin
    model. For example, instead of manually holding
    Today & Scheduled tasklists, these will be GtdPanels
    exported by the EDS base plugin.

 data/ui/window.ui |   24 --------------
 src/gtd-manager.c |   48 +----------------------------
 src/gtd-manager.h |   10 ------
 src/gtd-window.c  |   87 -----------------------------------------------------
 4 files changed, 2 insertions(+), 167 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 8d6f1c8..1d320d7 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -105,30 +105,6 @@
                         <property name="title" translatable="yes">Lists</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtdTaskListView" id="today_list_view">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="show_list_name">True</property>
-                      </object>
-                      <packing>
-                        <property name="name">today</property>
-                        <property name="title" translatable="yes">Today</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtdTaskListView" id="scheduled_list_view">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="show_list_name">True</property>
-                      </object>
-                      <packing>
-                        <property name="name">scheduled</property>
-                        <property name="title" translatable="yes">Scheduled</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
diff --git a/src/gtd-manager.c b/src/gtd-manager.c
index db85225..96ce806 100644
--- a/src/gtd-manager.c
+++ b/src/gtd-manager.c
@@ -26,12 +26,6 @@
 
 typedef struct
 {
-  /*
-   * Today & Scheduled lists
-   */
-  GtdTaskList           *today_tasks_list;
-  GtdTaskList           *scheduled_tasks_list;
-
   GSettings             *settings;
   GtdPluginManager      *plugin_manager;
 
@@ -112,8 +106,8 @@ gtd_manager_finalize (GObject *object)
 {
   GtdManager *self = (GtdManager *)object;
 
-  g_clear_object (&self->priv->scheduled_tasks_list);
-  g_clear_object (&self->priv->today_tasks_list);
+  g_clear_object (&self->priv->plugin_manager);
+  g_clear_object (&self->priv->settings);
 
   G_OBJECT_CLASS (gtd_manager_parent_class)->finalize (object);
 }
@@ -397,10 +391,6 @@ gtd_manager_init (GtdManager *self)
   self->priv = gtd_manager_get_instance_private (self);
   self->priv->settings = g_settings_new ("org.gnome.todo");
 
-  /* fixed task lists */
-  self->priv->scheduled_tasks_list = g_object_new (GTD_TYPE_TASK_LIST, NULL);
-  self->priv->today_tasks_list = g_object_new (GTD_TYPE_TASK_LIST, NULL);
-
   /* plugin manager */
   self->priv->plugin_manager = gtd_plugin_manager_new ();
 
@@ -727,40 +717,6 @@ gtd_manager_set_is_first_run (GtdManager *manager,
                           is_first_run);
 }
 
-/**
- * gtd_manager_get_scheduled_list:
- * @manager: a #GtdManager
- *
- * Retrieves the internal #GtdTaskList that holds scheduled tasks.
- *
- * Returns: (transfer none): the internal #GtdTaskList with scheduled
- * tasks
- */
-GtdTaskList*
-gtd_manager_get_scheduled_list (GtdManager *manager)
-{
-  g_return_val_if_fail (GTD_IS_MANAGER (manager), NULL);
-
-  return manager->priv->scheduled_tasks_list;
-}
-
-/**
- * gtd_manager_get_today_list:
- * @manager: a #GtdManager
- *
- * Retrieves the internal #GtdTaskList that holds tasks for today.
- *
- * Returns: (transfer none): the internal #GtdTaskList with today's
- * tasks
- */
-GtdTaskList*
-gtd_manager_get_today_list (GtdManager *manager)
-{
-  g_return_val_if_fail (GTD_IS_MANAGER (manager), NULL);
-
-  return manager->priv->today_tasks_list;
-}
-
 void
 gtd_manager_emit_error_message (GtdManager  *manager,
                                 const gchar *primary_message,
diff --git a/src/gtd-manager.h b/src/gtd-manager.h
index 6fab18c..0742fc6 100644
--- a/src/gtd-manager.h
+++ b/src/gtd-manager.h
@@ -58,16 +58,6 @@ void                    gtd_manager_remove_task           (GtdManager
 void                    gtd_manager_update_task           (GtdManager           *manager,
                                                            GtdTask              *task);
 
-/* Special lists */
-GtdTaskList*            gtd_manager_get_scheduled_list    (GtdManager           *manager);
-
-GtdTaskList*            gtd_manager_get_today_list        (GtdManager           *manager);
-
-/* Online accounts */
-GoaClient*              gtd_manager_get_goa_client        (GtdManager           *manager);
-
-gboolean                gtd_manager_is_goa_client_ready   (GtdManager           *manager);
-
 /* Settings */
 GtdProvider*            gtd_manager_get_default_provider  (GtdManager           *manager);
 
diff --git a/src/gtd-window.c b/src/gtd-window.c
index f8d599c..633a2ae 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -46,7 +46,6 @@ typedef struct
   GtdNotificationWidget         *notification_widget;
   GtkWidget                     *remove_button;
   GtkWidget                     *rename_button;
-  GtdTaskListView               *scheduled_list_view;
   GtkSearchBar                  *search_bar;
   GtkToggleButton               *search_button;
   GtkSearchEntry                *search_entry;
@@ -54,7 +53,6 @@ typedef struct
   GtkStack                      *stack;
   GtkStackSwitcher              *stack_switcher;
   GtdProviderDialog             *provider_dialog;
-  GtdTaskListView               *today_list_view;
   GtdTaskListView               *list_view;
 
   /* rename popover */
@@ -481,59 +479,6 @@ gtd_window__cancel_selection_button_clicked (GtkWidget *button,
 }
 
 static void
-gtd_window_update_list_counters (GtdTaskList *list,
-                                 GtdTask     *task,
-                                 GtdWindow   *window)
-{
-  GtdWindowPrivate *priv;
-  GtkWidget *container_child;
-  gboolean is_today;
-  GList *tasks;
-  GList *l;
-  gchar *new_title;
-  gint counter;
-
-  g_return_if_fail (GTD_IS_WINDOW (window));
-  g_return_if_fail (GTD_IS_TASK_LIST (list));
-
-  priv = window->priv;
-
-  /* Count the number of incomplete tasks */
-  counter = 0;
-  tasks = gtd_task_list_get_tasks (list);
-
-  for (l = tasks; l != NULL; l = l->next)
-    {
-      if (!gtd_task_get_complete (l->data))
-        counter++;
-    }
-
-  /* Update the list title */
-  is_today = list == gtd_manager_get_today_list (priv->manager);
-
-  container_child = is_today ? GTK_WIDGET (priv->today_list_view) : GTK_WIDGET (priv->scheduled_list_view);
-
-  if (counter == 0)
-    {
-      new_title = g_strdup_printf ("%s", is_today ? _("Today") : _("Scheduled"));
-    }
-  else
-    {
-      new_title = g_strdup_printf ("%s (%d)",
-                                   is_today ? _("Today") : _("Scheduled"),
-                                   counter);
-    }
-
-  gtk_container_child_set (GTK_CONTAINER (priv->stack),
-                           container_child,
-                           "title", new_title,
-                           NULL);
-
-  g_list_free (tasks);
-  g_free (new_title);
-}
-
-static void
 gtd_window__create_new_list (GSimpleAction *simple,
                              GVariant      *parameter,
                              gpointer       user_data)
@@ -997,36 +942,6 @@ gtd_window_set_property (GObject      *object,
         }
 
       g_list_free (lists);
-
-      /* Setup 'Today' and 'Scheduled' lists */
-      gtd_task_list_view_set_task_list (self->priv->today_list_view, gtd_manager_get_today_list 
(self->priv->manager));
-      gtd_task_list_view_set_task_list (self->priv->scheduled_list_view, gtd_manager_get_scheduled_list 
(self->priv->manager));
-
-      g_signal_connect (gtd_manager_get_today_list (self->priv->manager),
-                        "task-added",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-      g_signal_connect (gtd_manager_get_today_list (self->priv->manager),
-                        "task-updated",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-      g_signal_connect (gtd_manager_get_today_list (self->priv->manager),
-                        "task-removed",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-      g_signal_connect (gtd_manager_get_scheduled_list (self->priv->manager),
-                        "task-added",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-      g_signal_connect (gtd_manager_get_scheduled_list (self->priv->manager),
-                        "task-updated",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-      g_signal_connect (gtd_manager_get_scheduled_list (self->priv->manager),
-                        "task-removed",
-                        G_CALLBACK (gtd_window_update_list_counters),
-                        self);
-
       g_object_notify (object, "manager");
       break;
 
@@ -1102,14 +1017,12 @@ gtd_window_class_init (GtdWindowClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, rename_entry);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, rename_popover);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, save_rename_button);
-  gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, scheduled_list_view);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, stack);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, search_bar);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, search_button);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, search_entry);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, select_button);
   gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, stack_switcher);
-  gtk_widget_class_bind_template_child_private (widget_class, GtdWindow, today_list_view);
 
   gtk_widget_class_bind_template_callback (widget_class, gtd_window__back_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, gtd_window__cancel_selection_button_clicked);


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