printbackend: Add a list model getter

Now that we have a list model for printers,
we can start using it.
This commit is contained in:
Matthias Clasen 2019-12-22 14:49:26 -05:00
parent a026677849
commit fb587cb529
2 changed files with 15 additions and 0 deletions

View File

@ -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)
{

View File

@ -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,