static VALUE po_get_error(VALUE self) { GError *error = NULL; gtk_print_operation_get_error(_SELF(self), &error); return error ? rbgerr_gerror2exception(error) : Qnil; }
static void handle_error (GtkPrintOperation *operation) { GtkWidget *dialog; GError *error = NULL; dialog = gtk_message_dialog_new_with_markup ( NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "<span weight=\"bold\" size=\"larger\">%s</span>", _("An error occurred while printing")); gtk_print_operation_get_error (operation, &error); if (error != NULL && error->message != NULL) gtk_message_dialog_format_secondary_text ( GTK_MESSAGE_DIALOG (dialog), "%s\n\n%s", _("The printing system reported the " "following details about the error:"), error->message); else gtk_message_dialog_format_secondary_text ( GTK_MESSAGE_DIALOG (dialog), "%s", _("The printing system did not report " "any additional details about the error.")); if (error != NULL) g_error_free (error); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); }
static void handle_print_result (IdeEditorView *self, GtkPrintOperation *operation, GtkPrintOperationResult result) { if (result == GTK_PRINT_OPERATION_RESULT_ERROR) { GError *error = NULL; gtk_print_operation_get_error (operation, &error); /* info bar */ g_warning ("%s", error->message); g_clear_error (&error); } }
static void print_done (GtkPrintOperation *op, GtkPrintOperationResult res, PrintData *print_data) { GError *error = NULL; if (res == GTK_PRINT_OPERATION_RESULT_ERROR) { GtkWidget *error_dialog; gtk_print_operation_get_error (op, &error); error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error printing file:\n%s", error ? error->message : "no details"); g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (error_dialog); } else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != NULL) g_object_unref (settings); settings = g_object_ref (gtk_print_operation_get_print_settings (op)); } g_free (print_data->text); g_free (print_data->font); g_free (print_data); if (!gtk_print_operation_is_finished (op)) { g_object_ref (op); active_prints = g_list_append (active_prints, op); update_statusbar (); /* This ref is unref:ed when we get the final state change */ g_signal_connect (op, "status_changed", G_CALLBACK (status_changed_cb), NULL); } }
static void cb_print_done(GtkPrintOperation* operation, GtkPrintOperationResult result, zathura_t* zathura) { if (result == GTK_PRINT_OPERATION_RESULT_APPLY) { if (zathura->print.settings != NULL) { g_object_unref(zathura->print.settings); } if (zathura->print.page_setup != NULL) { g_object_unref(zathura->print.page_setup); } /* save previous settings */ zathura->print.settings = g_object_ref(gtk_print_operation_get_print_settings(operation)); zathura->print.page_setup = g_object_ref(gtk_print_operation_get_default_page_setup(operation)); } else if (result == GTK_PRINT_OPERATION_RESULT_ERROR) { GError* error = NULL; gtk_print_operation_get_error(operation, &error); girara_notify(zathura->ui.session, GIRARA_ERROR, _("Printing failed: %s"), error->message); g_error_free(error); } }