From 7d757b8452daed2575e3a9cc300459d7e8674345 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 11 Oct 2024 23:38:44 +0200 Subject: Full port to GError Started 15 years ago, picking up on that work. Introduced the new TUXCMD_ERROR domain to distinguish between operations or their steps. Plugins may continue reporting the G_IO_ERROR domain. --- UGnome.pas | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'UGnome.pas') diff --git a/UGnome.pas b/UGnome.pas index 2955142..5edab31 100644 --- a/UGnome.pas +++ b/UGnome.pas @@ -21,7 +21,7 @@ unit UGnome; interface -uses glib2, gdk2, gdk2pixbuf, gtk2, Classes, ULibc, +uses glib2, gdk2, gdk2pixbuf, gtk2, Classes, ULibc, UError, GTKForms, GTKControls, GTKStdCtrls, GTKExtCtrls, GTKClasses, GTKDialogs, GTKUtils, GTKConsts, uVFSprototypes; @@ -176,7 +176,7 @@ type PGnomeColorPicker = PGtkWidget; const AFTER_ALL_TABS = -1; NOT_IN_APP_WINDOWS = -2; -var libGlib2Handle, libGtk2Handle, libGnome2Handle, libGnomeUI2Handle: Pointer; +var libGlib2Handle, libGio2Handle, libGtk2Handle, libGnome2Handle, libGnomeUI2Handle: Pointer; gnome_about_new: function (const name, version, copyright, comments: Pchar; const authors, documenters: PPchar; const translator_credits: Pchar; logo_pixbuf: PGdkPixbuf): PGtkWidget; cdecl; {$IFDEF KYLIX} @@ -212,9 +212,11 @@ var libGlib2Handle, libGtk2Handle, libGnome2Handle, libGnomeUI2Handle: Pointer; message_format:Pgchar):PGtkWidget; varargs; cdecl; {$ENDIF} g_mkdir_with_parents: function (const pathname: PChar; mode: integer): integer; cdecl; + __g_io_error_from_errno: function (err_no: gint): GIOErrorEnum; cdecl; function _gtk_notebook_insert_page(notebook:PGtkNotebook; child:PGtkWidget;tab_label:PGtkWidget; position:gint):gint; cdecl; external gtklib name 'gtk_notebook_insert_page'; +procedure g_prefix_error(err: PPGError; format: Pgchar); varargs; cdecl; external gliblib name 'g_prefix_error'; @@ -1637,17 +1639,26 @@ procedure LoadGnomeLibs; begin // Set default values @gnome_about_new := nil; + @gnome_program_init := nil; + @libgnome_module_info_get := nil; + @libgnomeui_module_info_get := nil; @gnome_color_picker_new := nil; @gnome_color_picker_get_i16 := nil; @gnome_color_picker_set_i16 := nil; - @libgnomeui_module_info_get := nil; - @gnome_program_init := nil; - @libgnome_module_info_get := nil; @gnome_icon_entry_new := nil; @gnome_icon_entry_set_pixmap_subdir := nil; @gnome_icon_entry_get_filename := nil; @gnome_icon_entry_set_filename := nil; + @gnome_date_edit_new := nil; + @gnome_date_edit_set_time := nil; + @gnome_date_edit_get_time := nil; @gtk_event_box_set_visible_window := nil; + @gtk_icon_size_lookup_for_settings := nil; + @gtk_window_set_icon_name := nil; + @g_filename_display_name := nil; + @gtk_message_dialog_new_with_markup := nil; + @g_mkdir_with_parents := nil; + @__g_io_error_from_errno := nil; // Dynamic loading libGlib2Handle := dlopen('libglib-2.0.so.0', RTLD_LAZY); @@ -1657,6 +1668,11 @@ begin @g_mkdir_with_parents := dlsym(libGlib2Handle, 'g_mkdir_with_parents'); DebugMsg(['libglib-2.0.so loaded, @g_filename_display_name = ', @g_filename_display_name]); end; + libGio2Handle := dlopen('libgio-2.0.so.0', RTLD_LAZY); + if libGio2Handle = nil then libGio2Handle := dlopen('libgio-2.0.so', RTLD_LAZY); + if libGio2Handle <> nil then begin + @__g_io_error_from_errno := dlsym(libGio2Handle, 'g_io_error_from_errno'); + end; libGtk2Handle := dlopen('libgtk-x11-2.0.so.0', RTLD_LAZY); if libGtk2Handle = nil then libGtk2Handle := dlopen('libgtk-x11-2.0.so', RTLD_LAZY); if libGtk2Handle <> nil then begin -- cgit v1.2.3