1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-05-21 12:39:29 +00:00

calls-record-store: GtkApplicationWindow is not a GListModel

I'm not sure how this worked in GTK3, but it doesn't anymore. The list
model is now composed with the record store instead of inherited.

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
Anton Lazarev 2023-12-16 12:58:31 -08:00
parent 0a3ce1d701
commit 8aea5498d7
3 changed files with 19 additions and 11 deletions

View file

@ -668,7 +668,7 @@ start_proper (CallsApplication *self)
self->main_window =
calls_main_window_new (gtk_app,
G_LIST_MODEL (self->record_store));
calls_record_store_get_list_model (self->record_store));
g_assert (self->main_window != NULL);
self->call_window = calls_call_window_new (gtk_app);

View file

@ -92,14 +92,16 @@ record_state_to_string (CallsCallRecordState state)
struct _CallsRecordStore {
GtkApplicationWindow parent_instance;
GObject parent_instance;
gchar *filename;
GomAdapter *adapter;
GomRepository *repository;
GListStore *list_store;
};
G_DEFINE_TYPE (CallsRecordStore, calls_record_store, G_TYPE_LIST_STORE);
G_DEFINE_TYPE (CallsRecordStore, calls_record_store, G_TYPE_OBJECT);
static void
@ -191,7 +193,7 @@ load_calls_fetch_cb (GomResourceGroup *group,
self);
}
g_list_store_splice (G_LIST_STORE (self),
g_list_store_splice (G_LIST_STORE (self->list_store),
0,
0,
records,
@ -442,7 +444,7 @@ record_call_save_cb (GomResource *resource,
} else {
g_debug ("Successfully saved new call record to database");
g_list_store_insert (G_LIST_STORE (data->self),
g_list_store_insert (G_LIST_STORE (data->self->list_store),
0,
CALLS_CALL_RECORD (resource));
@ -699,8 +701,6 @@ dispose (GObject *object)
{
CallsRecordStore *self = CALLS_RECORD_STORE (object);
g_list_store_remove_all (G_LIST_STORE (self));
g_clear_object (&self->repository);
G_OBJECT_CLASS (calls_record_store_parent_class)->dispose (object);
@ -780,13 +780,20 @@ calls_record_store_init (CallsRecordStore *self)
self->filename = g_build_filename (used_dir,
RECORD_STORE_FILENAME,
NULL);
self->list_store = g_list_store_new (CALLS_TYPE_CALL_RECORD);
}
CallsRecordStore *
calls_record_store_new (void)
{
return g_object_new (CALLS_TYPE_RECORD_STORE,
"item-type", CALLS_TYPE_CALL_RECORD,
NULL);
return g_object_new (CALLS_TYPE_RECORD_STORE, NULL);
}
GListModel *
calls_record_store_get_list_model (CallsRecordStore *self)
{
return G_LIST_MODEL (self->list_store);
}

View file

@ -31,9 +31,10 @@ G_BEGIN_DECLS
#define CALLS_TYPE_RECORD_STORE (calls_record_store_get_type ())
G_DECLARE_FINAL_TYPE (CallsRecordStore, calls_record_store, CALLS, RECORD_STORE, GListStore);
G_DECLARE_FINAL_TYPE (CallsRecordStore, calls_record_store, CALLS, RECORD_STORE, GObject);
CallsRecordStore *calls_record_store_new (void);
GListModel *calls_record_store_get_list_model (CallsRecordStore *);
G_END_DECLS