[gnome-todo] Update to GTK 3.98.5 API changes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] Update to GTK 3.98.5 API changes
- Date: Thu, 18 Jun 2020 22:27:45 +0000 (UTC)
commit 6c3a1ec7526ed81370fb84eed02ef4d8f38838c1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jun 18 19:26:54 2020 -0300
Update to GTK 3.98.5 API changes
src/core/gtd-manager.c | 21 ++++++++++++++-------
src/gui/gtd-task-list-popover.c | 12 +++++++-----
src/gui/gtd-task-list-view.c | 10 +++++-----
src/gui/gtd-task-row.c | 19 +++++--------------
src/plugins/all-tasks-panel/gtd-all-tasks-panel.c | 13 ++++++++++---
src/plugins/inbox-panel/gtd-inbox-panel.c | 5 ++++-
src/plugins/next-week-panel/gtd-next-week-panel.c | 18 ++++++++++++++----
src/plugins/scheduled-panel/gtd-panel-scheduled.c | 13 ++++++++++---
src/plugins/today-panel/gtd-panel-today.c | 18 ++++++++++++++----
src/plugins/today-panel/gtd-today-omni-area-addin.c | 10 ++++++++--
src/plugins/welcome/gtd-welcome-workspace.c | 9 +++++++--
11 files changed, 98 insertions(+), 50 deletions(-)
---
diff --git a/src/core/gtd-manager.c b/src/core/gtd-manager.c
index 4e569ea..d7ead92 100644
--- a/src/core/gtd-manager.c
+++ b/src/core/gtd-manager.c
@@ -121,8 +121,8 @@ check_provider_is_default (GtdManager *self,
*/
static gboolean
-filter_achived_lists_func (gpointer item,
- gpointer user_data)
+filter_archived_lists_func (gpointer item,
+ gpointer user_data)
{
GtdTaskList *list;
GtdTask *task;
@@ -205,13 +205,16 @@ on_list_changed_cb (GtdProvider *provider,
GtdTaskList *list,
GtdManager *self)
{
+ GtkFilter *filter;
+
GTD_ENTRY;
gtd_list_store_sort (GTD_LIST_STORE (self->lists_model),
(GCompareDataFunc) compare_lists_cb,
self);
- gtk_filter_list_model_refilter (GTK_FILTER_LIST_MODEL (self->unarchived_tasks_model));
+ filter = gtk_filter_list_model_get_filter (GTK_FILTER_LIST_MODEL (self->unarchived_tasks_model));
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
g_signal_emit (self, signals[LIST_CHANGED], 0, list);
@@ -502,17 +505,21 @@ gtd_manager_class_init (GtdManagerClass *klass)
static void
gtd_manager_init (GtdManager *self)
{
+ g_autoptr (GtkFilter) archived_lists_filter = NULL;
+ g_autoptr (GtkFilter) inbox_filter = NULL;
+
+ inbox_filter = gtk_custom_filter_new (filter_inbox_cb, self, NULL);
+ archived_lists_filter = gtk_custom_filter_new (filter_archived_lists_func, self, NULL);
+
self->settings = g_settings_new ("org.gnome.todo");
self->plugin_manager = gtd_plugin_manager_new ();
self->clock = gtd_clock_new ();
self->cancellable = g_cancellable_new ();
self->lists_model = (GListModel*) gtd_list_store_new (GTD_TYPE_TASK_LIST);
- self->inbox_model = (GListModel*) gtk_filter_list_model_new (self->lists_model, filter_inbox_cb, self,
NULL);
+ self->inbox_model = (GListModel*) gtk_filter_list_model_new (self->lists_model, inbox_filter);
self->tasks_model = (GListModel*) _gtd_task_model_new (self);
self->unarchived_tasks_model = (GListModel*) gtk_filter_list_model_new (self->tasks_model,
- filter_achived_lists_func,
- self,
- NULL);
+ archived_lists_filter);
self->providers_model = (GListModel*) gtd_list_store_new (GTD_TYPE_PROVIDER);
}
diff --git a/src/gui/gtd-task-list-popover.c b/src/gui/gtd-task-list-popover.c
index 3833f01..fbe7441 100644
--- a/src/gui/gtd-task-list-popover.c
+++ b/src/gui/gtd-task-list-popover.c
@@ -190,7 +190,10 @@ static void
on_search_entry_search_changed_cb (GtkEntry *search_entry,
GtdTaskListPopover *self)
{
- gtk_filter_list_model_refilter (self->filter_model);
+ GtkFilter *filter;
+
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
@@ -237,12 +240,11 @@ gtd_task_list_popover_class_init (GtdTaskListPopoverClass *klass)
static void
gtd_task_list_popover_init (GtdTaskListPopover *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
GtdManager *manager = gtd_manager_get_default ();
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_task_lists_model (manager),
- filter_listbox_cb,
- self,
- NULL);
+ filter = gtk_custom_filter_new (filter_listbox_cb, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
gtk_widget_init_template (GTK_WIDGET (self));
diff --git a/src/gui/gtd-task-list-view.c b/src/gui/gtd-task-list-view.c
index d34fc3b..b63509c 100644
--- a/src/gui/gtd-task-list-view.c
+++ b/src/gui/gtd-task-list-view.c
@@ -625,13 +625,13 @@ row_is_subtask_of (GtdTaskRow *row_a,
static GtkListBoxRow*
get_drop_row_at_y (GtdTaskListView *self,
- gint y)
+ gdouble y)
{
GtdTaskListViewPrivate *priv;
GtkListBoxRow *hovered_row;
GtkListBoxRow *task_row;
GtkListBoxRow *drop_row;
- gint row_y, row_height;
+ gdouble row_y, row_height;
priv = gtd_task_list_view_get_instance_private (self);
@@ -715,10 +715,10 @@ scroll_to_dnd (gpointer user_data)
static void
check_dnd_scroll (GtdTaskListView *self,
gboolean should_cancel,
- gint y)
+ gdouble y)
{
GtdTaskListViewPrivate *priv = gtd_task_list_view_get_instance_private (self);
- gint current_y, height;
+ gdouble current_y, height;
if (should_cancel)
{
@@ -781,7 +781,7 @@ on_drop_target_drag_motion_cb (GtkDropTarget *drop_target,
GdkDrop *drop;
GtdTask *task;
GdkDrag *drag;
- gint x_offset;
+ gdouble x_offset;
GTD_ENTRY;
diff --git a/src/gui/gtd-task-row.c b/src/gui/gtd-task-row.c
index 7ed001c..45bb6bd 100644
--- a/src/gui/gtd-task-row.c
+++ b/src/gui/gtd-task-row.c
@@ -162,7 +162,6 @@ date_to_label_binding_cb (GBinding *binding,
return TRUE;
}
-#if 0
static GtkWidget*
create_transient_row (GtdTaskRow *self)
{
@@ -181,7 +180,6 @@ create_transient_row (GtdTaskRow *self)
return GTK_WIDGET (new_row);
}
-#endif
/*
@@ -263,7 +261,10 @@ on_drag_begin_cb (GtkDragSource *source,
GdkDrag *drag,
GtdTaskRow *self)
{
+ GtkWidget *drag_icon;
+ GtkWidget *new_row;
GtkWidget *widget;
+ gint x_offset;
GTD_ENTRY;
@@ -271,22 +272,12 @@ on_drag_begin_cb (GtkDragSource *source,
gtk_widget_set_cursor_from_name (widget, "grabbing");
-#if 0
- g_autoptr (GtkWidget) drag_icon = NULL;
- GtkWidget * *new_row;
- gint x_offset;
-
- /*
- * gtk_drag_set_icon_widget() inserts the row in a different GtkWindow, so
- * we have to create a new, transient row.
- */
new_row = create_transient_row (self);
- drag_icon = gtk_drag_icon_new_for_drag (drag);
- gtk_container_add (GTK_CONTAINER (drag_icon), new_row);
+ drag_icon = gtk_drag_icon_get_for_drag (drag);
+ gtk_drag_icon_set_child (GTK_DRAG_ICON (drag_icon), new_row);
x_offset = gtk_widget_get_margin_start (self->content_box);
gdk_drag_set_hotspot (drag, self->clicked_x + x_offset, self->clicked_y);
-#endif
gtk_widget_hide (widget);
diff --git a/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
b/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
index ad06865..6afc925 100644
--- a/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
+++ b/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
@@ -310,11 +310,13 @@ on_clock_day_changed_cb (GtdClock *clock,
GtdAllTasksPanel *self)
{
g_autoptr (GDateTime) now = NULL;
+ GtkFilter *filter;
now = g_date_time_new_now_local ();
gtd_task_list_view_set_default_date (self->view, now);
- gtk_filter_list_model_refilter (self->filter_model);
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
/*
@@ -462,12 +464,17 @@ gtd_all_tasks_panel_class_init (GtdAllTasksPanelClass *klass)
static void
gtd_all_tasks_panel_init (GtdAllTasksPanel *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
+ g_autoptr (GtkSorter) sorter = NULL;
GtdManager *manager = gtd_manager_get_default ();
self->icon = g_themed_icon_new ("view-tasks-all-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
- self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sort_func, self, NULL);
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
+
+ sorter = gtk_custom_sorter_new (sort_func, self, NULL);
+ self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sorter);
/* The main view */
self->view = GTD_TASK_LIST_VIEW (gtd_task_list_view_new ());
diff --git a/src/plugins/inbox-panel/gtd-inbox-panel.c b/src/plugins/inbox-panel/gtd-inbox-panel.c
index b9feb98..325cd3b 100644
--- a/src/plugins/inbox-panel/gtd-inbox-panel.c
+++ b/src/plugins/inbox-panel/gtd-inbox-panel.c
@@ -239,10 +239,13 @@ gtd_inbox_panel_class_init (GtdInboxPanelClass *klass)
static void
gtd_inbox_panel_init (GtdInboxPanel *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
GtdManager *manager = gtd_manager_get_default ();
self->icon = g_themed_icon_new ("mail-inbox-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
+
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
/* The main view */
self->view = GTD_TASK_LIST_VIEW (gtd_task_list_view_new ());
diff --git a/src/plugins/next-week-panel/gtd-next-week-panel.c
b/src/plugins/next-week-panel/gtd-next-week-panel.c
index 2279d83..54542bc 100644
--- a/src/plugins/next-week-panel/gtd-next-week-panel.c
+++ b/src/plugins/next-week-panel/gtd-next-week-panel.c
@@ -363,11 +363,13 @@ on_clock_day_changed_cb (GtdClock *clock,
GtdNextWeekPanel *self)
{
g_autoptr (GDateTime) now = NULL;
+ GtkFilter *filter;
now = g_date_time_new_now_local ();
gtd_task_list_view_set_default_date (self->view, now);
- gtk_filter_list_model_refilter (self->filter_model);
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
/*
@@ -517,14 +519,22 @@ gtd_next_week_panel_class_init (GtdNextWeekPanelClass *klass)
static void
gtd_next_week_panel_init (GtdNextWeekPanel *self)
{
+ g_autoptr (GtkFilter) incomplete_filter = NULL;
+ g_autoptr (GtkFilter) filter = NULL;
+ g_autoptr (GtkSorter) sorter = NULL;
g_autoptr (GDateTime) now = g_date_time_new_now_local ();
GtdManager *manager = gtd_manager_get_default ();
self->icon = g_themed_icon_new ("view-tasks-week-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
- self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sort_func, self, NULL);
- self->incomplete_model = gtk_filter_list_model_new (G_LIST_MODEL (self->sort_model), filter_complete_func,
self, NULL);
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
+
+ sorter = gtk_custom_sorter_new (sort_func, self, NULL);
+ self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sorter);
+
+ incomplete_filter = gtk_custom_filter_new (filter_complete_func, self, NULL);
+ self->incomplete_model = gtk_filter_list_model_new (G_LIST_MODEL (self->sort_model), incomplete_filter);
/* The main view */
self->view = GTD_TASK_LIST_VIEW (gtd_task_list_view_new ());
diff --git a/src/plugins/scheduled-panel/gtd-panel-scheduled.c
b/src/plugins/scheduled-panel/gtd-panel-scheduled.c
index 8e3aa48..38b4e16 100644
--- a/src/plugins/scheduled-panel/gtd-panel-scheduled.c
+++ b/src/plugins/scheduled-panel/gtd-panel-scheduled.c
@@ -320,11 +320,13 @@ on_clock_day_changed_cb (GtdClock *clock,
GtdPanelScheduled *self)
{
g_autoptr (GDateTime) now = NULL;
+ GtkFilter *filter;
now = g_date_time_new_now_local ();
gtd_task_list_view_set_default_date (self->view, now);
- gtk_filter_list_model_refilter (self->filter_model);
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
@@ -467,13 +469,18 @@ gtd_panel_scheduled_class_init (GtdPanelScheduledClass *klass)
static void
gtd_panel_scheduled_init (GtdPanelScheduled *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
+ g_autoptr (GtkSorter) sorter = NULL;
g_autoptr (GDateTime) now = g_date_time_new_now_local ();
GtdManager *manager = gtd_manager_get_default ();
self->icon = g_themed_icon_new ("alarm-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
- self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sort_func, self, NULL);
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
+
+ sorter = gtk_custom_sorter_new (sort_func, self, NULL);
+ self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sorter);
/* The main view */
self->view = GTD_TASK_LIST_VIEW (gtd_task_list_view_new ());
diff --git a/src/plugins/today-panel/gtd-panel-today.c b/src/plugins/today-panel/gtd-panel-today.c
index 880df01..3e9a3c6 100644
--- a/src/plugins/today-panel/gtd-panel-today.c
+++ b/src/plugins/today-panel/gtd-panel-today.c
@@ -269,11 +269,13 @@ on_clock_day_changed_cb (GtdClock *clock,
GtdPanelToday *self)
{
g_autoptr (GDateTime) now = NULL;
+ GtkFilter *filter;
now = g_date_time_new_now_local ();
gtd_task_list_view_set_default_date (self->view, now);
- gtk_filter_list_model_refilter (self->filter_model);
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
@@ -419,6 +421,9 @@ gtd_panel_today_class_init (GtdPanelTodayClass *klass)
static void
gtd_panel_today_init (GtdPanelToday *self)
{
+ g_autoptr (GtkFilter) incomplete_filter = NULL;
+ g_autoptr (GtkFilter) filter = NULL;
+ g_autoptr (GtkSorter) sorter = NULL;
g_autoptr (GDateTime) now = NULL;
GtdManager *manager;
@@ -426,9 +431,14 @@ gtd_panel_today_init (GtdPanelToday *self)
self->icon = g_themed_icon_new ("view-tasks-today-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
- self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sort_func, self, NULL);
- self->incomplete_model = gtk_filter_list_model_new (G_LIST_MODEL (self->sort_model), filter_complete_func,
self, NULL);
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
+
+ sorter = gtk_custom_sorter_new (sort_func, self, NULL);
+ self->sort_model = gtk_sort_list_model_new (G_LIST_MODEL (self->filter_model), sorter);
+
+ incomplete_filter = gtk_custom_filter_new (filter_complete_func, self, NULL);
+ self->incomplete_model = gtk_filter_list_model_new (G_LIST_MODEL (self->sort_model), incomplete_filter);
/* Connect to GtdManager::list-* signals to update the title */
manager = gtd_manager_get_default ();
diff --git a/src/plugins/today-panel/gtd-today-omni-area-addin.c
b/src/plugins/today-panel/gtd-today-omni-area-addin.c
index bea2fbf..e67807f 100644
--- a/src/plugins/today-panel/gtd-today-omni-area-addin.c
+++ b/src/plugins/today-panel/gtd-today-omni-area-addin.c
@@ -170,10 +170,13 @@ static void
on_clock_day_changed_cb (GtdClock *clock,
GtdTodayOmniAreaAddin *self)
{
+ GtkFilter *filter;
+
self->had_tasks = FALSE;
self->finished_tasks = FALSE;
- gtk_filter_list_model_refilter (self->filter_model);
+ filter = gtk_filter_list_model_get_filter (self->filter_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static void
@@ -276,12 +279,15 @@ gtd_today_omni_area_addin_class_init (GtdTodayOmniAreaAddinClass *klass)
static void
gtd_today_omni_area_addin_init (GtdTodayOmniAreaAddin *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
GtdManager *manager;
manager = gtd_manager_get_default ();
self->icon = g_themed_icon_new ("view-tasks-today-symbolic");
- self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
+
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->filter_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
g_signal_connect_object (self->filter_model,
"items-changed",
diff --git a/src/plugins/welcome/gtd-welcome-workspace.c b/src/plugins/welcome/gtd-welcome-workspace.c
index 8b0efa3..556e0be 100644
--- a/src/plugins/welcome/gtd-welcome-workspace.c
+++ b/src/plugins/welcome/gtd-welcome-workspace.c
@@ -136,7 +136,10 @@ static void
on_clock_day_changed_cb (GtdClock *clock,
GtdWelcomeWorkspace *self)
{
- gtk_filter_list_model_refilter (self->today_model);
+ GtkFilter *filter;
+
+ filter = gtk_filter_list_model_get_filter (self->today_model);
+ gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static void
@@ -302,6 +305,7 @@ gtd_welcome_workspace_class_init (GtdWelcomeWorkspaceClass *klass)
static void
gtd_welcome_workspace_init (GtdWelcomeWorkspace *self)
{
+ g_autoptr (GtkFilter) filter = NULL;
GtdManager *manager;
GListModel *inbox_model;
@@ -331,7 +335,8 @@ gtd_welcome_workspace_init (GtdWelcomeWorkspace *self)
g_variant_new ("s", "inbox-panel"));
/* Today */
- self->today_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter_func, self,
NULL);
+ filter = gtk_custom_filter_new (filter_func, self, NULL);
+ self->today_model = gtk_filter_list_model_new (gtd_manager_get_tasks_model (manager), filter);
g_signal_connect_object (self->today_model,
"items-changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]