[gnome-text-editor] printoperation: propagate line numbers when printing



commit 8b1095b7655affd95a965212c8ae2c826f409b48
Author: Christian Hergert <chergert redhat com>
Date:   Sun Dec 19 16:48:24 2021 -0800

    printoperation: propagate line numbers when printing
    
    If shown in the UI, show them when printing.
    
    Someday we might allow overriding all this from the print dialog.

 src/editor-print-operation.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/editor-print-operation.c b/src/editor-print-operation.c
index a3be8f3..b064b24 100644
--- a/src/editor-print-operation.c
+++ b/src/editor-print-operation.c
@@ -105,6 +105,7 @@ editor_print_operation_begin_print (GtkPrintOperation *operation,
   guint tab_width;
   gboolean syntax_hl;
   gboolean use_system_font;
+  gboolean show_line_numbers;
 
   settings = g_settings_new ("org.gnome.TextEditor");
   use_system_font = g_settings_get_boolean (settings, "use-system-font");
@@ -114,11 +115,13 @@ editor_print_operation_begin_print (GtkPrintOperation *operation,
 
   tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (self->view));
   syntax_hl = gtk_source_buffer_get_highlight_syntax (buffer);
+  show_line_numbers = gtk_source_view_get_show_line_numbers (self->view);
 
   self->compositor = g_object_new (GTK_SOURCE_TYPE_PRINT_COMPOSITOR,
                                    "buffer", buffer,
                                    "tab-width", tab_width,
                                    "highlight-syntax", syntax_hl,
+                                   "print-line-numbers", show_line_numbers,
                                    "wrap-mode", GTK_WRAP_WORD_CHAR,
                                    NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]