void create_gtkprint_session(GtkTextView *text_view, const gchar *title) { GtkPrintOperation *op; GtkPrintOperationResult res; GError *err = NULL; page_title = title; op = create_print_operation(text_view); res = gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(text_view))), &err); switch (res) { case GTK_PRINT_OPERATION_RESULT_ERROR: create_error_dialog(text_view, err->message); g_error_free(err); case GTK_PRINT_OPERATION_RESULT_APPLY: if (settings) g_object_unref(settings); settings = g_object_ref(gtk_print_operation_get_print_settings(op)); default: break; } g_object_unref(op); }
void cairo_print_callback (DiagramData *data, const gchar *filename, guint flags, /* further additions */ void *user_data) { GtkPrintOperation *op = create_print_operation (data, filename ? filename : "diagram"); GtkPrintOperationResult res; GError *error = NULL; res = gtk_print_operation_run (op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, &error); if (GTK_PRINT_OPERATION_RESULT_ERROR == res) { message_error (error->message); g_error_free (error); } }
void create_gtkprint_preview_session(GtkTextView *text_view, const gchar *title) { GtkPrintOperation *op; GtkPrintOperationResult res; GError *err = NULL; page_title = title; op = create_print_operation(text_view); res = gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PREVIEW, GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(text_view))), &err); if (res == GTK_PRINT_OPERATION_RESULT_ERROR) { create_error_dialog(text_view, err->message); g_error_free(err); } g_object_unref(op); }