summaryrefslogtreecommitdiff
path: root/UError.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-12-13 14:32:58 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-12-13 14:32:58 +0100
commit0f7616a007edaa1d19c4672a4fd390c072b1eba6 (patch)
treea1524927d8986bb54345c47ded84bb3c2a9559c2 /UError.pas
parentae0047b8a5fa76ea76c66d8c5c580eba39178755 (diff)
downloadtuxcmd-0.6.74.tar.xz
Error system transformation to GErrorv0.6.74
Note that most coreworkers are broken at the moment.
Diffstat (limited to 'UError.pas')
-rw-r--r--UError.pas25
1 files changed, 24 insertions, 1 deletions
diff --git a/UError.pas b/UError.pas
index cf722e3..57250a8 100644
--- a/UError.pas
+++ b/UError.pas
@@ -21,7 +21,7 @@ unit UError;
interface
-uses glib2, gdk2, Classes, ULibc;
+uses glib2, gtk2, Classes, ULibc, GTKForms;
// Ported from gioerror.h
@@ -68,6 +68,8 @@ function G_IO_ERROR: TGQuark;
function g_io_error_from_errno(err_no: gint): GIOErrorEnum;
+procedure ShowError(Parent: TCustomGTKForm; const Text: string; Error: PGError);
+
implementation
uses SysUtils, UCoreUtils, UGnome;
@@ -111,5 +113,26 @@ begin
end;
end;
+
+(********************************************************************************************************************************)
+procedure ShowError(Parent: TCustomGTKForm; const Text: string; Error: PGError);
+var Dialog: PGtkWidget;
+ error_str: PChar;
+begin
+ if Error <> nil then error_str := Error^.message
+ else error_str := '';
+ if @gtk_message_dialog_new_with_markup <> nil
+ then dialog := gtk_message_dialog_new_with_markup (PGtkWindow(Parent.FWidget), GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ '<span size="large" weight="ultrabold">%s</span>'#10#10'%s',
+ PChar(Text), error_str)
+ else dialog := gtk_message_dialog_new (PGtkWindow(Parent.FWidget), GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ '%s'#10#10'%s', PChar(Text), error_str);
+ gtk_window_set_title (PGtkWindow(dialog), '');
+ gtk_dialog_run (PGtkDialog(Dialog));
+ gtk_widget_destroy (PGtkWidget(Dialog));
+end;
+
end.