diff options
Diffstat (limited to 'UGnome.pas')
| -rw-r--r-- | UGnome.pas | 268 |
1 files changed, 93 insertions, 175 deletions
@@ -21,7 +21,7 @@ unit UGnome; interface -uses glib2, gdk2, gdk2pixbuf, gtk2, Classes, ULibc, UError, +uses glib2, lazglib2, lazgobject2, gdk2, gdk2pixbuf, gtk2, Classes, ULibc, GTKForms, GTKControls, GTKStdCtrls, GTKExtCtrls, GTKClasses, GTKDialogs, GTKUtils, GTKConsts, uVFSprototypes; @@ -125,7 +125,7 @@ type TGnomeColorButton = class(TGTKButton) procedure RemovePage(PageNo: integer); function GetTabCaption(PageNo: integer): string; procedure SetTabCaption(PageNo: integer; Caption: string); - procedure SetTabTooltip(PageNo: integer; Tooltip: string); + procedure SetTabTooltip(PageNo: integer; ATooltip: string); published property PageIndex: integer read GetPageIndex write SetPageIndex; property ShowCloseButtons: boolean read FShowCloseButtons write SetShowCloseButtons default False; @@ -176,7 +176,7 @@ type PGnomeColorPicker = PGtkWidget; const AFTER_ALL_TABS = -1; NOT_IN_APP_WINDOWS = -2; -var libGlib2Handle, libGio2Handle, libGtk2Handle, libGnome2Handle, libGnomeUI2Handle: Pointer; +var 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; gnome_program_init: function (const app_id, app_version: PChar; const module_info: Pointer; argc: integer; argv: PPChar): Pointer; varargs; cdecl; @@ -193,19 +193,15 @@ var libGlib2Handle, libGio2Handle, libGtk2Handle, libGnome2Handle, libGnomeUI2Ha gnome_date_edit_set_time: procedure (gde: PGnomeDateEdit; the_time: time_t); cdecl; gnome_date_edit_get_time: function (gde: PGnomeDateEdit): time_t; cdecl; - gtk_event_box_set_visible_window: procedure (event_box: PGtkEventBox; visible_window: gboolean); cdecl; - gtk_icon_size_lookup_for_settings: function (settings: PGtkSettings; size: TGtkIconSize; width, height: Pgint): gboolean; cdecl; - gtk_window_set_icon_name: procedure (window: PGtkWindow; const name: Pgchar); cdecl; - g_filename_display_name: function (const filename: PChar): PChar; cdecl; - gtk_message_dialog_new_with_markup: function (parent:PGtkWindow; flags:TGtkDialogFlags; - _type:TGtkMessageType; buttons:TGtkButtonsType; - message_format:Pgchar):PGtkWidget; varargs; cdecl; - 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'; +procedure gtk_event_box_set_visible_window(event_box: PGtkEventBox; visible_window: gboolean); cdecl; external gtklib; +function gtk_icon_size_lookup_for_settings(settings: PGtkSettings; size: TGtkIconSize; width, height: Pgint): gboolean; cdecl; external gtklib; +procedure gtk_window_set_icon_name(window: PGtkWindow; const name: Pgchar); cdecl; external gtklib; +function gtk_notebook_insert_page(notebook:PGtkNotebook; child:PGtkWidget;tab_label:PGtkWidget; position:gint):gint; cdecl; external gtklib; +function gtk_message_dialog_new_with_markup(parent:PGtkWindow; flags:TGtkDialogFlags; + _type:TGtkMessageType; buttons:TGtkButtonsType; + message_format:Pgchar):PGtkWidget; varargs; cdecl; external gtklib; @@ -214,7 +210,7 @@ procedure LoadGnomeLibs; implementation -uses SysUtils, DateUtils, UConfig, UCoreUtils, ULocale, UFileAssoc; +uses SysUtils, DateUtils, UCoreUtils, ULocale, UFileAssoc; (********************************************************************************************************************************) @@ -256,11 +252,11 @@ begin inherited Create(AOwner); FUseGnomeUI := Assigned(gnome_color_picker_new) and Assigned(gnome_color_picker_get_i16) and Assigned(gnome_color_picker_set_i16); if FUseGnomeUI then begin - FWidget := gnome_color_picker_new; - g_signal_connect(PGtkObject(FWidget), 'color-set', G_CALLBACK(@TGnomeColorButton_color_set), Self); + FWidget := gnome_color_picker_new(); + g_signal_connect_data(PGObject(FWidget), 'color-set', TGCallback(@TGnomeColorButton_color_set), Self, nil, G_CONNECT_DEFAULT); end else begin FWidget := gtk_button_new_with_label(''); // This should be here due to height-related troubles - g_signal_connect(PGtkObject(FWidget), 'clicked', G_CALLBACK(@TGnomeColorButton_OnClick), Self); + g_signal_connect_data(PGObject(FWidget), 'clicked', TGCallback(@TGnomeColorButton_OnClick), Self, nil, G_CONNECT_DEFAULT); BorderStyle := bsHalf; end; Show; @@ -325,7 +321,7 @@ begin inherited Create(AOwner); FIconChanged := nil; FWidget := gnome_icon_entry_new('History', 'Browse'); - g_signal_connect(PGtkObject(FWidget), 'changed', G_CALLBACK(@TGnomeIconEntry_changed), Self); + g_signal_connect_data(PGObject(FWidget), 'changed', TGCallback(@TGnomeIconEntry_changed), Self, nil, G_CONNECT_DEFAULT); Show; end; @@ -400,9 +396,9 @@ begin FBusy := False; // Set up drag-and-drop - g_signal_connect(FWidget, 'button-press-event', G_CALLBACK(@button_press_cb), Self); - g_signal_connect(FWidget, 'button-release-event', G_CALLBACK(@button_release_cb), Self); - g_signal_connect(FWidget, 'scroll-event', G_CALLBACK(@scroll_event_callback), Self); + g_signal_connect_data(PGObject(FWidget), 'button-press-event', TGCallback(@button_press_cb), Self, nil, G_CONNECT_DEFAULT); + g_signal_connect_data(PGObject(FWidget), 'button-release-event', TGCallback(@button_release_cb), Self, nil, G_CONNECT_DEFAULT); + g_signal_connect_data(PGObject(FWidget), 'scroll-event', TGCallback(@scroll_event_callback), Self, nil, G_CONNECT_DEFAULT); gtk_widget_add_events(FWidget, GDK_BUTTON1_MOTION_MASK); Show; @@ -453,13 +449,11 @@ begin char_width := pango_font_metrics_get_approximate_digit_width(metrics); pango_font_metrics_unref(metrics); } - if @gtk_icon_size_lookup_for_settings <> nil - then gtk_icon_size_lookup_for_settings(gtk_widget_get_settings(hbox), GTK_ICON_SIZE_MENU, @w, @h) - else begin w := 16; h := 16; end; + gtk_icon_size_lookup_for_settings(gtk_widget_get_settings(hbox), GTK_ICON_SIZE_MENU, @w, @h); // gtk_widget_set_size_request(hbox, TAB_WIDTH_N_CHARS * PANGO_PIXELS(char_width) + 2 * w, -1); - button := g_object_get_data(G_OBJECT(hbox), 'close-button'); + button := g_object_get_data(PGObject(hbox), 'close-button'); gtk_widget_set_size_request(button, w + 2, h + 2); end; @@ -469,7 +463,7 @@ var tab: PGtkWidget; position: integer; CanClose: boolean; begin - tab := g_object_get_data(G_OBJECT(widget), 'child'); + tab := g_object_get_data(PGObject(widget), 'child'); ntb := TEphyNotebook(data); position := gtk_notebook_page_num(GTK_NOTEBOOK(ntb.FWidget), GTK_WIDGET(tab)); @@ -495,10 +489,10 @@ begin hbox := gtk_hbox_new(FALSE, 0); label_ebox := gtk_event_box_new(); - if @gtk_event_box_set_visible_window <> nil then gtk_event_box_set_visible_window(GTK_EVENT_BOX (label_ebox), FALSE); + gtk_event_box_set_visible_window(GTK_EVENT_BOX (label_ebox), FALSE); gtk_box_pack_start(GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(label_ebox), 'button-press-event', G_CALLBACK(@label_ebox_button_pressed), Self); - g_object_set_data(G_OBJECT(label_ebox), 'child', Child.FWidget); + g_signal_connect_data(PGObject(label_ebox), 'button-press-event', TGCallback(@label_ebox_button_pressed), Self, nil, G_CONNECT_DEFAULT); + g_object_set_data(PGObject(label_ebox), 'child', Child.FWidget); label_hbox := gtk_hbox_new (FALSE, 0); gtk_container_add(GTK_CONTAINER (label_ebox), label_hbox); @@ -507,7 +501,7 @@ begin close_button := gtk_button_new (); gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE); // don't allow focus on the close button - g_object_set(G_OBJECT(close_button), 'can-focus', gboolean(FALSE), nil); + g_object_set(PGObject(close_button), 'can-focus', [gboolean(FALSE), nil]); gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE); rcstyle := gtk_rc_style_new (); @@ -520,9 +514,9 @@ begin gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); gtk_tooltips_set_tip(FTooltips, close_button, PChar(LANGEphyNotebookCloseTab), nil); - g_object_set_data(G_OBJECT(close_button), 'tab', hbox); - g_object_set_data(G_OBJECT(close_button), 'child', Child.FWidget); - g_signal_connect(G_OBJECT(close_button), 'clicked', G_CALLBACK(@close_button_clicked_cb), Self); + g_object_set_data(PGObject(close_button), 'tab', hbox); + g_object_set_data(PGObject(close_button), 'child', Child.FWidget); + g_signal_connect_data(PGObject(close_button), 'clicked', TGCallback(@close_button_clicked_cb), Self, nil, G_CONNECT_DEFAULT); // setup site icon, empty by default icon := gtk_image_new (); @@ -537,7 +531,7 @@ begin gtk_box_pack_start (GTK_BOX(label_hbox), _label, TRUE, TRUE, 0); // Set minimal size - g_signal_connect(hbox, 'style-set', G_CALLBACK(@tab_label_style_set_cb), nil); + g_signal_connect_data(PGObject(hbox), 'style-set', TGCallback(@tab_label_style_set_cb), nil, nil, G_CONNECT_DEFAULT); gtk_widget_show (hbox); @@ -547,13 +541,13 @@ begin gtk_widget_show (image); if FShowCloseButtons then gtk_widget_show (close_button); - g_object_set_data (G_OBJECT (hbox), 'label', _label); - g_object_set_data (G_OBJECT (hbox), 'label-ebox', label_ebox); - g_object_set_data (G_OBJECT (hbox), 'icon', icon); - g_object_set_data (G_OBJECT (hbox), 'close-button', close_button); - g_object_set_data (G_OBJECT (hbox), 'tooltips', FTooltips); + g_object_set_data(PGObject(hbox), 'label', _label); + g_object_set_data(PGObject(hbox), 'label-ebox', label_ebox); + g_object_set_data(PGObject(hbox), 'icon', icon); + g_object_set_data(PGObject(hbox), 'close-button', close_button); + g_object_set_data(PGObject(hbox), 'tooltips', FTooltips); - Result := _gtk_notebook_insert_page(PGtkNotebook(FWidget), Child.FWidget, hbox, Position); + Result := gtk_notebook_insert_page(PGtkNotebook(FWidget), Child.FWidget, hbox, Position); end; procedure TEphyNotebook.RemovePage(PageNo: integer); @@ -565,24 +559,24 @@ function TEphyNotebook.GetTabCaption(PageNo: integer): string; var wid, lab: PGtkWidget; begin wid := gtk_notebook_get_tab_label(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo)); - lab := g_object_get_data (G_OBJECT(wid), 'label'); - Result := PgcharToString(gtk_label_get_text(GTK_LABEL(lab))); + lab := g_object_get_data (PGObject(wid), 'label'); + Result := String(gtk_label_get_text(GTK_LABEL(lab))); end; procedure TEphyNotebook.SetTabCaption(PageNo: integer; Caption: string); var wid, lab: PGtkWidget; begin wid := gtk_notebook_get_tab_label(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo)); - lab := g_object_get_data (G_OBJECT(wid), 'label'); - gtk_label_set_text(GTK_LABEL(lab), StringToPgchar(Caption)); + lab := g_object_get_data (PGObject(wid), 'label'); + gtk_label_set_text(GTK_LABEL(lab), PChar(Caption)); end; -procedure TEphyNotebook.SetTabTooltip(PageNo: integer; Tooltip: string); +procedure TEphyNotebook.SetTabTooltip(PageNo: integer; ATooltip: string); var wid, lab: PGtkWidget; begin wid := gtk_notebook_get_tab_label(PGtkNotebook(FWidget), gtk_notebook_get_nth_page(PGtkNotebook(FWidget), PageNo)); - lab := g_object_get_data (G_OBJECT(wid), 'label-ebox'); - gtk_tooltips_set_tip(FTooltips, lab, StringToPgchar(Tooltip), nil); + lab := g_object_get_data (PGObject(wid), 'label-ebox'); + gtk_tooltips_set_tip(FTooltips, lab, PChar(ATooltip), nil); end; function TEphyNotebook.GetPageIndex: integer; @@ -762,23 +756,23 @@ begin // disconnect the signals before ungrabbing! if toplevel_grab_broken_handler_id <> 0 then begin - g_signal_handler_disconnect(toplevel, toplevel_grab_broken_handler_id); + g_signal_handler_disconnect(PGObject(toplevel), toplevel_grab_broken_handler_id); toplevel_grab_broken_handler_id := 0; end; if grab_notify_handler_id <> 0 then begin - g_signal_handler_disconnect(FWidget, grab_notify_handler_id); + g_signal_handler_disconnect(PGObject(FWidget), grab_notify_handler_id); grab_notify_handler_id := 0; end; if toplevel_motion_notify_handler_id <> 0 then begin - g_signal_handler_disconnect(toplevel, toplevel_motion_notify_handler_id); + g_signal_handler_disconnect(PGObject(toplevel), toplevel_motion_notify_handler_id); toplevel_motion_notify_handler_id := 0; end; if toplevel_button_release_handler_id <> 0 then begin - g_signal_handler_disconnect(toplevel, toplevel_button_release_handler_id); + g_signal_handler_disconnect(PGObject(toplevel), toplevel_button_release_handler_id); toplevel_button_release_handler_id := 0; end; if motion_notify_handler_id <> 0 then begin - g_signal_handler_disconnect(FWidget, motion_notify_handler_id); + g_signal_handler_disconnect(PGObject(FWidget), motion_notify_handler_id); motion_notify_handler_id := 0; end; @@ -934,10 +928,10 @@ begin if (toplevel_grab_broken_handler_id = 0) and (toplevel_motion_notify_handler_id = 0) and (toplevel_button_release_handler_id = 0) and (grab_notify_handler_id = 0) then begin - toplevel_grab_broken_handler_id := g_signal_connect(toplevel, 'grab-broken-event', G_CALLBACK(@grab_broken_event_cb), Self); - toplevel_motion_notify_handler_id := g_signal_connect(toplevel, 'motion-notify-event', G_CALLBACK(@toplevel_motion_notify_cb), Self); - toplevel_button_release_handler_id := g_signal_connect(toplevel, 'button-release-event', G_CALLBACK(@toplevel_button_release_cb), Self); - grab_notify_handler_id := g_signal_connect(FWidget, 'grab-notify', G_CALLBACK(@grab_notify_cb), Self); + toplevel_grab_broken_handler_id := g_signal_connect_data(PGObject(toplevel), 'grab-broken-event', TGCallback(@grab_broken_event_cb), Self, nil, G_CONNECT_DEFAULT); + toplevel_motion_notify_handler_id := g_signal_connect_data(PGObject(toplevel), 'motion-notify-event', TGCallback(@toplevel_motion_notify_cb), Self, nil, G_CONNECT_DEFAULT); + toplevel_button_release_handler_id := g_signal_connect_data(PGObject(toplevel), 'button-release-event', TGCallback(@toplevel_button_release_cb), Self, nil, G_CONNECT_DEFAULT); + grab_notify_handler_id := g_signal_connect_data(PGObject(FWidget), 'grab-notify', TGCallback(@grab_notify_cb), Self, nil, G_CONNECT_DEFAULT); drag_start_idx := gtk_notebook_get_current_page(GTK_NOTEBOOK(FWidget)); Result := True; @@ -1032,7 +1026,7 @@ begin dest->priv->motion_notify_handler_id = g_signal_connect (G_OBJECT (dest), "motion-notify-event", - G_CALLBACK (motion_notify_cb), + TGCallback (motion_notify_cb), NULL); *) @@ -1046,11 +1040,11 @@ begin // start drag handling in dest notebook dest.x_start := Trunc(event^.x_root); dest.y_start := Trunc(event^.y_root); - dest.motion_notify_handler_id := g_signal_connect(G_OBJECT(dest.FWidget), 'motion-notify-event', G_CALLBACK(@motion_notify_cb), dest); + dest.motion_notify_handler_id := g_signal_connect_data(PGObject(dest.FWidget), 'motion-notify-event', TGCallback(@motion_notify_cb), dest, nil, G_CONNECT_DEFAULT); dest.drag_start(event^.time); -{ dest.motion_notify_handler_id := g_signal_connect(G_OBJECT(dest.FWidget), 'motion-notify-event', G_CALLBACK(@motion_notify_cb), nil); +{ dest.motion_notify_handler_id := g_signal_connect(PGObject(dest.FWidget), 'motion-notify-event', TGCallback(@motion_notify_cb), nil); dest.drag_start(event^.time); } end; end; @@ -1073,7 +1067,7 @@ var tab: PGtkWidget; begin Result := False; ntb := TEphyNotebook(data); - tab := g_object_get_data(G_OBJECT(widget), 'child'); + tab := g_object_get_data(PGObject(widget), 'child'); position := gtk_notebook_page_num(GTK_NOTEBOOK(ntb.FWidget), GTK_WIDGET(tab)); // DebugMsg(['@******* label_ebox_button_pressed, button = ', event^.button, ', Position = ', position, ', data = 0x', IntToHex(Integer(data), 8), ', widget = 0x', IntToHex(Integer(widget), 8)]); @@ -1112,7 +1106,7 @@ begin ntb.x_start := Trunc(event^.x_root); ntb.y_start := Trunc(event^.y_root); DebugMsg(['@################# x_start = ', ntb.x_start, ', y_start = ', ntb.y_start]); - ntb.motion_notify_handler_id := g_signal_connect(G_OBJECT(notebook), 'motion-notify-event', G_CALLBACK(@motion_notify_cb), data); + ntb.motion_notify_handler_id := g_signal_connect_data(PGObject(notebook), 'motion-notify-event', TGCallback(@motion_notify_cb), data, nil, G_CONNECT_DEFAULT); end; if tab_clicked >= 0 then begin @@ -1203,17 +1197,17 @@ begin Exit; end; Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)], - GTK_BUTTONS_NONE, '%s', StringToPgchar(Text)); - CheckBox := PGtkCheckButton(gtk_check_button_new_with_mnemonic(StringToPgchar(DontShowAgainText))); + GTK_BUTTONS_NONE, '%s', PChar(Text)); + CheckBox := PGtkCheckButton(gtk_check_button_new_with_mnemonic(PChar(DontShowAgainText))); gtk_widget_show(PGtkWidget(CheckBox)); - gtk_box_pack_end(GTK_BOX(GTK_DIALOG(Dialog).vbox), PGtkWidget(CheckBox), False, False, 12); + gtk_box_pack_end(GTK_BOX(GTK_DIALOG(Dialog)^.vbox), PGtkWidget(CheckBox), False, False, 12); for i := 1 to NumMessageButtons do if TMessageButton(i - 1) in Buttons then begin w := gtk_dialog_add_button(PGtkDialog(Dialog), MessageButtonID[i], i); if TMessageButton(i - 1) = Default then gtk_widget_grab_focus(w); end; - if Escape <> mbNone then g_signal_connect(PGtkObject(Dialog), 'key-press-event', G_CALLBACK(@Gnome_MessageBox_key_press_event), - Pointer(Ord(Escape) + 1{MessageButtonID[Ord(Escape)]})); + if Escape <> mbNone then g_signal_connect_data(PGObject(Dialog), 'key-press-event', TGCallback(@Gnome_MessageBox_key_press_event), + Pointer(Ord(Escape) + 1{MessageButtonID[Ord(Escape)]}), nil, G_CONNECT_DEFAULT); if Default <> mbNone then gtk_dialog_set_default_response(PGtkDialog(Dialog), Ord(Default)); Result := TMessageButton(gtk_dialog_run(PGtkDialog(Dialog)) - 1); DontShowAgainChecked := gtk_toggle_button_get_active(PGtkToggleButton(CheckBox)); @@ -1244,7 +1238,7 @@ begin primary := g_strndup (AMessage, primary - AMessage); end; - if (primary <> nil) and (secondary <> nil) and (@gtk_message_dialog_new_with_markup <> nil) + if (primary <> nil) and (secondary <> nil) then dialog := gtk_message_dialog_new_with_markup (PGtkWindow(DialogParent), 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, '<span size="large" weight="ultrabold">%s</span>'#10'%s', @@ -1359,8 +1353,8 @@ begin gtk_table_attach (GTK_TABLE (table), alabel, 0, 1, row, row + 1, GTK_FILL, GTK_EXPAND or GTK_FILL, 0, 0); gtk_table_attach_defaults (GTK_TABLE (table), PGtkWidget(entry), 1, 2, row, row + 1); gtk_label_set_mnemonic_widget (PGtkLabel(alabel), PGtkWidget(entry)); - g_signal_connect (entry, 'changed', G_CALLBACK (@pw_dialog_verify_input), user_data); - g_signal_connect (entry, 'activate', G_CALLBACK (@pw_dialog_cycle_focus), user_data); + g_signal_connect_data(PGObject(entry), 'changed', TGCallback (@pw_dialog_verify_input), user_data, nil, G_CONNECT_DEFAULT); + g_signal_connect_data(PGObject(entry), 'activate', TGCallback (@pw_dialog_cycle_focus), user_data, nil, G_CONNECT_DEFAULT); Result := entry; end; @@ -1439,14 +1433,14 @@ begin anon_box := gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), anon_box, FALSE, FALSE, 0); - priv.choice_anon := gtk_radio_button_new_with_mnemonic (nil, PChar(LANGGtkMountOperation_ConnectAnonymously)); - gtk_box_pack_start (GTK_BOX (anon_box), priv.choice_anon, FALSE, FALSE, 0); - g_signal_connect (priv.choice_anon, 'toggled', G_CALLBACK (@pw_dialog_anonymous_toggled), @priv); + priv.choice_anon := gtk_radio_button_new_with_mnemonic(nil, PChar(LANGGtkMountOperation_ConnectAnonymously)); + gtk_box_pack_start(GTK_BOX (anon_box), priv.choice_anon, FALSE, FALSE, 0); + g_signal_connect_data(PGObject(priv.choice_anon), 'toggled', TGCallback (@pw_dialog_anonymous_toggled), @priv, nil, G_CONNECT_DEFAULT); - group := gtk_radio_button_get_group (GTK_RADIO_BUTTON (priv.choice_anon)); - priv.choice_user := gtk_radio_button_new_with_mnemonic (group, PChar(LANGGtkMountOperation_ConnectAsUser)); - gtk_box_pack_start (GTK_BOX (anon_box), priv.choice_user, FALSE, FALSE, 0); - g_signal_connect (priv.choice_user, 'toggled', G_CALLBACK (@pw_dialog_anonymous_toggled), @priv); + group := LAZGLIB2.PGSList(gtk_radio_button_get_group(GTK_RADIO_BUTTON(priv.choice_anon))); + priv.choice_user := gtk_radio_button_new_with_mnemonic(GLIB2.PGSList(group), PChar(LANGGtkMountOperation_ConnectAsUser)); + gtk_box_pack_start(GTK_BOX(anon_box), priv.choice_user, FALSE, FALSE, 0); + g_signal_connect_data(PGObject(priv.choice_user), 'toggled', TGCallback (@pw_dialog_anonymous_toggled), @priv, nil, G_CONNECT_DEFAULT); end; rows := 0; @@ -1457,8 +1451,8 @@ begin // The table that holds the entries priv.entry_container := gtk_alignment_new (0.0, 0.0, 1.0, 1.0); - if can_anonymous then g_object_set (priv.entry_container, 'left-padding', 12, nil); - gtk_box_pack_start (GTK_BOX (vbox), priv.entry_container, FALSE, FALSE, 0); + if can_anonymous then g_object_set(PGObject(priv.entry_container), 'left-padding', [12, nil]); + gtk_box_pack_start(GTK_BOX(vbox), priv.entry_container, FALSE, FALSE, 0); table := gtk_table_new (rows, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 12); @@ -1484,9 +1478,9 @@ begin if (flags and VFS_ASK_PASSWORD_ARCHIVE_MODE) = VFS_ASK_PASSWORD_ARCHIVE_MODE then begin unmask_checkbox := gtk_check_button_new_with_mnemonic (PChar(LANGFSetPassword_ShowPasswordCheckButton)); - g_object_set(G_OBJECT(unmask_checkbox), 'can-focus', 0, nil); + g_object_set(PGObject(unmask_checkbox), 'can-focus', [0, nil]); gtk_box_pack_start (GTK_BOX (vbox), unmask_checkbox, FALSE, FALSE, 0); - g_signal_connect (unmask_checkbox, 'toggled', G_CALLBACK (@unmask_checkbox_toggled), @priv); + g_signal_connect_data(PGObject(unmask_checkbox), 'toggled', TGCallback (@unmask_checkbox_toggled), @priv, nil, G_CONNECT_DEFAULT); end; if ((flags and VFS_ASK_PASSWORD_SAVING_SUPPORTED) = VFS_ASK_PASSWORD_SAVING_SUPPORTED) or @@ -1500,17 +1494,17 @@ begin radio_forget := gtk_radio_button_new_with_mnemonic (nil, s); gtk_box_pack_start (GTK_BOX (remember_box), radio_forget, FALSE, FALSE, 0); - group := gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_forget)); + group := LAZGLIB2.PGSList(gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_forget))); // gnome-keyring only if (flags and VFS_ASK_PASSWORD_SAVING_SUPPORTED) = VFS_ASK_PASSWORD_SAVING_SUPPORTED then begin - radio_session := gtk_radio_button_new_with_mnemonic (group, PChar(LANGGtkMountOperation_RememberPasswordUntilYouLogout)); + radio_session := gtk_radio_button_new_with_mnemonic(GLIB2.PGSList(group), PChar(LANGGtkMountOperation_RememberPasswordUntilYouLogout)); gtk_box_pack_start (GTK_BOX (remember_box), radio_session, FALSE, FALSE, 0); - group := gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_session)); + group := LAZGLIB2.PGSList(gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_session))); end; if (flags and VFS_ASK_PASSWORD_SAVING_SUPPORTED) = 0 then s := PChar(LANGGtkMountOperation_SavePasswordInConnectionManager) else s := PChar(LANGGtkMountOperation_RememberForever); - radio_remember := gtk_radio_button_new_with_mnemonic (group, s); + radio_remember := gtk_radio_button_new_with_mnemonic(GLIB2.PGSList(group), s); gtk_box_pack_start (GTK_BOX (remember_box), radio_remember, FALSE, FALSE, 0); // Select to save password when internal saving is supported @@ -1610,101 +1604,25 @@ end; (********************************************************************************************************************************) (********************************************************************************************************************************) -procedure SetupGnomeLibs; -var g: Pointer; -begin - try - if Assigned(gnome_program_init) and Assigned(libgnomeui_module_info_get) and Assigned(libgnome_module_info_get) then begin - DebugMsg(['Initializing Gnome...']); - g := gnome_program_init('TuxCommander', PChar(ConstAboutVersion), libgnomeui_module_info_get, GTKForms.argc, GTKForms.argv, - 'show-crash-dialog', 0, nil); - DebugMsg([' *GnomeProgram = ', g]); - - end; - except end; -end; - 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; - @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); - if libGlib2Handle = nil then libGlib2Handle := dlopen('libglib-2.0.so', RTLD_LAZY); - if libGlib2Handle <> nil then begin - @g_filename_display_name := dlsym(libGlib2Handle, 'g_filename_display_name'); - @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 - @gtk_event_box_set_visible_window := dlsym(libGtk2Handle, 'gtk_event_box_set_visible_window'); - @gtk_icon_size_lookup_for_settings := dlsym(libGtk2Handle, 'gtk_icon_size_lookup_for_settings'); - @gtk_window_set_icon_name := dlsym(libGtk2Handle, 'gtk_window_set_icon_name'); - @gtk_message_dialog_new_with_markup := dlsym(libGtk2Handle, 'gtk_message_dialog_new_with_markup'); - DebugMsg(['libgtk-x11-2.0.so loaded, @gtk_event_box_set_visible_window = ', @gtk_event_box_set_visible_window, - ', @gtk_icon_size_lookup_for_settings = ', @gtk_icon_size_lookup_for_settings]); - end; - libGnome2Handle := dlopen('libgnome-2.so.0', RTLD_LAZY); - if libGnome2Handle = nil then libGnome2Handle := dlopen('libgnome-2.so', RTLD_LAZY); - if libGnome2Handle <> nil then begin - @gnome_program_init := dlsym(libGnome2Handle, 'gnome_program_init'); - @libgnome_module_info_get := dlsym(libGnome2Handle, 'libgnome_module_info_get'); - DebugMsg(['libgnome-2.so loaded, @gnome_program_init = ', @gnome_program_init, ', @libgnome_module_info_get = ', @libgnome_module_info_get]); - end; - libGnomeUI2Handle := dlopen('libgnomeui-2.so.0', RTLD_LAZY); - if libGnomeUI2Handle = nil then libGnomeUI2Handle := dlopen('libgnomeui-2.so', RTLD_LAZY); - if libGnomeUI2Handle <> nil then begin - @gnome_about_new := dlsym(libGnomeUI2Handle, 'gnome_about_new'); - @gnome_color_picker_new := dlsym(libGnomeUI2Handle, 'gnome_color_picker_new'); - @gnome_color_picker_get_i16 := dlsym(libGnomeUI2Handle, 'gnome_color_picker_get_i16'); - @gnome_color_picker_set_i16 := dlsym(libGnomeUI2Handle, 'gnome_color_picker_set_i16'); - @libgnomeui_module_info_get := dlsym(libGnomeUI2Handle, 'libgnomeui_module_info_get'); - @gnome_icon_entry_new := dlsym(libGnomeUI2Handle, 'gnome_icon_entry_new'); - @gnome_icon_entry_set_pixmap_subdir := dlsym(libGnomeUI2Handle, 'gnome_icon_entry_set_pixmap_subdir'); - @gnome_icon_entry_get_filename := dlsym(libGnomeUI2Handle, 'gnome_icon_entry_get_filename'); - @gnome_icon_entry_set_filename := dlsym(libGnomeUI2Handle, 'gnome_icon_entry_set_filename'); - @gnome_date_edit_new := dlsym(libGnomeUI2Handle, 'gnome_date_edit_new'); - @gnome_date_edit_set_time := dlsym(libGnomeUI2Handle, 'gnome_date_edit_set_time'); - @gnome_date_edit_get_time := dlsym(libGnomeUI2Handle, 'gnome_date_edit_get_time'); - DebugMsg(['libgnomeui-2.so loaded, @gnome_about_new = ', @gnome_about_new, ', @gnome_color_picker_new = ', @gnome_color_picker_new, - ', @gnome_icon_entry_new = 0x', @gnome_icon_entry_new, ', @gnome_date_edit_new = ', @gnome_date_edit_new, - ', @libgnomeui_module_info_get = ', @libgnomeui_module_info_get]); - end; - SetupGnomeLibs; + 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; + 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; end; -initialization -finalization -// if libGnomeUI2Handle <> 0 then FreeLibrary(libGnomeUI2Handle); -// if libGnome2Handle <> 0 then FreeLibrary(libGnome2Handle); end. |
