static void mail_printer_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_PART_LIST: mail_printer_set_part_list ( E_MAIL_PRINTER (object), g_value_get_object (value)); return; case PROP_REMOTE_CONTENT: mail_printer_set_remote_content ( E_MAIL_PRINTER (object), g_value_get_object (value)); return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); }
static void mail_printer_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_PART_LIST: g_value_take_object ( value, e_mail_printer_ref_part_list ( E_MAIL_PRINTER (object))); return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); }
static gboolean mail_printer_print_timeout_cb (GTask *task) { AsyncContext *async_context; gpointer source_object; const gchar *export_filename; GtkPrintSettings *print_settings = NULL; WebKitPrintOperation *print_operation = NULL; WebKitPrintOperationResponse response; /* FIXME WK2 gulong draw_page_handler_id; gulong create_custom_widget_handler_id; gulong custom_widget_apply_handler_id;*/ async_context = g_task_get_task_data (task); g_return_val_if_fail (async_context != NULL, G_SOURCE_REMOVE); source_object = g_task_get_source_object (task); g_return_val_if_fail (E_IS_MAIL_PRINTER (source_object), G_SOURCE_REMOVE); print_settings = gtk_print_settings_new (); export_filename = e_mail_printer_get_export_filename (E_MAIL_PRINTER (source_object)); gtk_print_settings_set ( print_settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, export_filename); print_operation = webkit_print_operation_new (async_context->web_view); webkit_print_operation_set_print_settings (print_operation, print_settings); g_signal_connect_data ( print_operation, "failed", G_CALLBACK (mail_printer_print_failed_cb), g_object_ref (task), (GClosureNotify) g_object_unref, 0); g_signal_connect_data ( print_operation, "finished", G_CALLBACK (mail_printer_print_finished_cb), g_object_ref (task), (GClosureNotify) g_object_unref, 0); /* FIXME WK2 create_custom_widget_handler_id = g_signal_connect ( print_operation, "create-custom-widget", G_CALLBACK (mail_printer_create_custom_widget_cb), async_context); custom_widget_apply_handler_id = g_signal_connect ( print_operation, "custom-widget-apply", G_CALLBACK (mail_printer_custom_widget_apply_cb), async_context); */ /* FIXME WK2 - this will be hard to add back to WK2 API.. There is a CSS draft * that can be used to add a page numbers, but it is not in WebKit yet. * http://www.w3.org/TR/css3-page/ draw_page_handler_id = g_signal_connect ( print_operation, "draw-page", G_CALLBACK (mail_printer_draw_footer_cb), async_context->cancellable); */ response = webkit_print_operation_run_dialog (print_operation, NULL); /* FIXME WK2 g_signal_handler_disconnect ( print_operation, create_custom_widget_handler_id); g_signal_handler_disconnect ( print_operation, custom_widget_apply_handler_id); g_signal_handler_disconnect ( print_operation, draw_page_handler_id); */ g_clear_object (&print_operation); g_clear_object (&print_settings); if (response == WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL) { async_context->print_result = GTK_PRINT_OPERATION_RESULT_CANCEL; g_task_return_boolean (task, TRUE); } return G_SOURCE_REMOVE; }