[gtk/matthiasc/for-master: 11/12] printbackend: Add a list model getter
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 11/12] printbackend: Add a list model getter
- Date: Sun, 31 May 2020 14:36:05 +0000 (UTC)
commit 470df8303b77ab3aed7aac7737d24324bc469404
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 22 14:49:26 2019 -0500
printbackend: Add a list model getter
Now that we have a list model for printers,
we can start using it.
gtk/gtkprintbackend.c | 13 +++++++++++++
gtk/gtkprintbackendprivate.h | 2 ++
2 files changed, 15 insertions(+)
---
diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c
index a6f44c08ca..eadd4125d5 100644
--- a/gtk/gtkprintbackend.c
+++ b/gtk/gtkprintbackend.c
@@ -471,6 +471,19 @@ gtk_print_backend_get_printer_list (GtkPrintBackend *backend)
return result;
}
+GListModel *
+gtk_print_backend_get_printers (GtkPrintBackend *backend)
+{
+ if (!backend->priv->printer_list_requested)
+ {
+ if (GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list)
+ GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list (backend);
+ backend->priv->printer_list_requested = TRUE;
+ }
+
+ return G_LIST_MODEL (backend->priv->printers);
+}
+
gboolean
gtk_print_backend_printer_list_is_done (GtkPrintBackend *backend)
{
diff --git a/gtk/gtkprintbackendprivate.h b/gtk/gtkprintbackendprivate.h
index 1c6b91e228..c6505b7c7c 100644
--- a/gtk/gtkprintbackendprivate.h
+++ b/gtk/gtkprintbackendprivate.h
@@ -149,6 +149,8 @@ GType gtk_print_backend_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend);
GDK_AVAILABLE_IN_ALL
+GListModel *gtk_print_backend_get_printers (GtkPrintBackend *print_backend);
+GDK_AVAILABLE_IN_ALL
gboolean gtk_print_backend_printer_list_is_done (GtkPrintBackend *print_backend);
GDK_AVAILABLE_IN_ALL
GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]