[gnome-todo] project: Fix list model constructors' ownership
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] project: Fix list model constructors' ownership
- Date: Sat, 1 Aug 2020 01:22:48 +0000 (UTC)
commit 0de005985fad0c9ca04093e443250f2c1530045e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jul 31 22:12:52 2020 -0300
project: Fix list model constructors' ownership
Before GTK 3.99, the various types of list models that
GTK offer had transfer-none constructors. Meaning, they
usually had to be used in conjunction to g_autoptr or
g_object_unref.
Since commit 706d464ae6d5 [1], however, the constructors
are transfer-full, and they don't take a ref on the passed
objects. The intention seems to be to allow the list model
APIs to be used as:
gtk_filter_list_model_new (model, gtk_filter_new (…));
Update GNOME To Do to not unref the GtkFilters and
GtkSorters when passing them to the models.
[1] https://gitlab.gnome.org/GNOME/gtk/-/commit/706d464ae6d5d3f120a2fb22932f49e07f034545
src/core/gtd-manager.c | 4 ++--
src/gui/gtd-task-list-popover.c | 2 +-
src/plugins/all-tasks-panel/gtd-all-tasks-panel.c | 4 ++--
src/plugins/inbox-panel/gtd-inbox-panel.c | 2 +-
src/plugins/next-week-panel/gtd-next-week-panel.c | 6 +++---
src/plugins/scheduled-panel/gtd-panel-scheduled.c | 4 ++--
src/plugins/today-panel/gtd-panel-today.c | 6 +++---
src/plugins/today-panel/gtd-today-omni-area-addin.c | 2 +-
src/plugins/welcome/gtd-welcome-workspace.c | 2 +-
9 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/core/gtd-manager.c b/src/core/gtd-manager.c
index d7ead92..aaf658f 100644
--- a/src/core/gtd-manager.c
+++ b/src/core/gtd-manager.c
@@ -505,8 +505,8 @@ 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;
+ GtkFilter *archived_lists_filter;
+ GtkFilter *inbox_filter;
inbox_filter = gtk_custom_filter_new (filter_inbox_cb, self, NULL);
archived_lists_filter = gtk_custom_filter_new (filter_archived_lists_func, self, NULL);
diff --git a/src/gui/gtd-task-list-popover.c b/src/gui/gtd-task-list-popover.c
index 3f5add0..a42549f 100644
--- a/src/gui/gtd-task-list-popover.c
+++ b/src/gui/gtd-task-list-popover.c
@@ -240,8 +240,8 @@ 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 ();
+ GtkFilter *filter;
filter = gtk_custom_filter_new (filter_listbox_cb, self, NULL);
self->filter_model = gtk_filter_list_model_new (gtd_manager_get_task_lists_model (manager),
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 6afc925..5c0377e 100644
--- a/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
+++ b/src/plugins/all-tasks-panel/gtd-all-tasks-panel.c
@@ -464,9 +464,9 @@ 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 ();
+ GtkFilter *filter;
+ GtkSorter *sorter;
self->icon = g_themed_icon_new ("view-tasks-all-symbolic");
diff --git a/src/plugins/inbox-panel/gtd-inbox-panel.c b/src/plugins/inbox-panel/gtd-inbox-panel.c
index 325cd3b..6191003 100644
--- a/src/plugins/inbox-panel/gtd-inbox-panel.c
+++ b/src/plugins/inbox-panel/gtd-inbox-panel.c
@@ -239,8 +239,8 @@ 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 ();
+ GtkFilter *filter;
self->icon = g_themed_icon_new ("mail-inbox-symbolic");
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 54542bc..1bea8d0 100644
--- a/src/plugins/next-week-panel/gtd-next-week-panel.c
+++ b/src/plugins/next-week-panel/gtd-next-week-panel.c
@@ -519,11 +519,11 @@ 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 ();
+ GtkFilter *incomplete_filter;
+ GtkFilter *filter;
+ GtkSorter *sorter;
self->icon = g_themed_icon_new ("view-tasks-week-symbolic");
diff --git a/src/plugins/scheduled-panel/gtd-panel-scheduled.c
b/src/plugins/scheduled-panel/gtd-panel-scheduled.c
index 38b4e16..949b052 100644
--- a/src/plugins/scheduled-panel/gtd-panel-scheduled.c
+++ b/src/plugins/scheduled-panel/gtd-panel-scheduled.c
@@ -469,10 +469,10 @@ 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 ();
+ GtkFilter *filter;
+ GtkSorter *sorter;
self->icon = g_themed_icon_new ("alarm-symbolic");
diff --git a/src/plugins/today-panel/gtd-panel-today.c b/src/plugins/today-panel/gtd-panel-today.c
index 3e9a3c6..a2944cc 100644
--- a/src/plugins/today-panel/gtd-panel-today.c
+++ b/src/plugins/today-panel/gtd-panel-today.c
@@ -421,11 +421,11 @@ 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;
+ GtkFilter *incomplete_filter;
+ GtkFilter *filter;
+ GtkSorter *sorter;
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 e67807f..33ba2ba 100644
--- a/src/plugins/today-panel/gtd-today-omni-area-addin.c
+++ b/src/plugins/today-panel/gtd-today-omni-area-addin.c
@@ -279,8 +279,8 @@ 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;
+ GtkFilter *filter;
manager = gtd_manager_get_default ();
diff --git a/src/plugins/welcome/gtd-welcome-workspace.c b/src/plugins/welcome/gtd-welcome-workspace.c
index a826dfe..5eb43da 100644
--- a/src/plugins/welcome/gtd-welcome-workspace.c
+++ b/src/plugins/welcome/gtd-welcome-workspace.c
@@ -305,9 +305,9 @@ 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;
+ GtkFilter *filter;
gtk_widget_init_template (GTK_WIDGET (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]