summaryrefslogtreecommitdiff
path: root/UConnectionManager.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2024-12-23 23:59:45 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-27 19:36:10 +0100
commitb9703b29819b619037cc282d719c187e51bacd30 (patch)
treebd6d73e5fb6bcb6eb307844103b3dff185f2ac9a /UConnectionManager.pas
parenta9634b933f71a9045e61d29c486f2d51d39fd1e2 (diff)
downloadtuxcmd-b9703b29819b619037cc282d719c187e51bacd30.tar.xz
Port to g-i generated glib2 bindings
Includes switch to FPC -Mobjfpc and related pointer style fixes.
Diffstat (limited to 'UConnectionManager.pas')
-rw-r--r--UConnectionManager.pas68
1 files changed, 34 insertions, 34 deletions
diff --git a/UConnectionManager.pas b/UConnectionManager.pas
index a9cbbfb..bf9e67f 100644
--- a/UConnectionManager.pas
+++ b/UConnectionManager.pas
@@ -22,8 +22,8 @@ unit UConnectionManager;
interface
uses
- glib2, gdk2, gtk2, pango, SysUtils, Types, Classes, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKView,
- GTKUtils, GTKDialogs, GTKPixbuf, GTKClasses, GTKMenus,
+ lazglib2, gtk2, SysUtils, Classes, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKView,
+ GTKPixbuf, GTKMenus,
UCore, UCoreWorkers, UCoreClasses, UVFSCore, UEngines;
type
@@ -66,7 +66,7 @@ type
Thread: TOpenConnectionThread;
SourcePanelEngine: TPanelEngine;
ConnectedEngine: TVFSEngine;
- function DoConnectInternal(const URI: string; Engine: TVFSEngine; ParentForm: TCustomGTKForm; VFSQuickConnectMode: boolean; Error: PPGError): boolean;
+ function DoConnectInternal(const URI: string; Engine: TVFSEngine; AParentForm: TCustomGTKForm; VFSQuickConnectMode: boolean; Error: PPGError): boolean;
end;
var
@@ -133,7 +133,7 @@ begin
ListView := TGTKListView.CreateTyped(Self, True, [lcPointer, lcText, lcText]);
ListView.SelectionMode := smSingle;
- ListView.OnKeyDown := ListViewKeyDown;
+ ListView.OnKeyDown := @ListViewKeyDown;
{
gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(ListView.FWidget), GDK_BUTTON1_MASK, @row_targets, 1, GDK_ACTION_MOVE);
@@ -215,21 +215,21 @@ begin
ConnectMenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
ConnectMenuItem.Caption := LANGConnMgr_ConnectButton;
ConnectMenuItem.StockIcon := 'gtk-connect';
- ConnectMenuItem.OnClick := ConnectButtonClick;
+ ConnectMenuItem.OnClick := @ConnectButtonClick;
AddConnectionMenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
AddConnectionMenuItem.Caption := LANGConnMgr_AddConnectionButtonCaption;
AddConnectionMenuItem.StockIcon := 'gtk-add';
- AddConnectionMenuItem.OnClick := AddConnectionButtonClick;
+ AddConnectionMenuItem.OnClick := @AddConnectionButtonClick;
EditMenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
EditMenuItem.Caption := LANGConnMgr_EditButtonCaption;
- EditMenuItem.OnClick := EditButtonClick;
+ EditMenuItem.OnClick := @EditButtonClick;
RemoveMenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
RemoveMenuItem.Caption := LANGConnMgr_RemoveButtonCaption;
RemoveMenuItem.StockIcon := 'gtk-remove';
- RemoveMenuItem.OnClick := RemoveButtonClick;
+ RemoveMenuItem.OnClick := @RemoveButtonClick;
DuplicateMenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
DuplicateMenuItem.Caption := LANGFConnectionManager_DuplicateMenuItem_Caption;
- DuplicateMenuItem.OnClick := DuplicateButtonClick;
+ DuplicateMenuItem.OnClick := @DuplicateButtonClick;
ItemsPopupMenu.Add(ConnectMenuItem);
ItemsPopupMenu.Add(TGTKMenuItem.CreateTyped(Self, itSeparator));
ItemsPopupMenu.Add(AddConnectionMenuItem);
@@ -238,8 +238,8 @@ begin
ItemsPopupMenu.Add(RemoveMenuItem);
FillList;
- ListView.OnSelectionChanged := ListViewSelectionChanged;
- ListView.OnDblClick := ListViewDblClick;
+ ListView.OnSelectionChanged := @ListViewSelectionChanged;
+ ListView.OnDblClick := @ListViewDblClick;
ListView.PopupMenu := ItemsPopupMenu;
ListView.SetFocus;
if (ListView.Items.Count > 0) and (ConfConnMgrActiveItem >= 0) and (ConfConnMgrActiveItem < ListView.Items.Count) then begin
@@ -247,17 +247,17 @@ begin
ListView.Items[ConfConnMgrActiveItem].SetCursor(0, False, False, 0, 0);
end;
ListViewSelectionChanged(Self);
- AddConnectionButton.OnClick := AddConnectionButtonClick;
- EditButton.OnClick := EditButtonClick;
- DuplicateButton.OnClick := DuplicateButtonClick;
- RemoveButton.OnClick := RemoveButtonClick;
- CloseButton.OnClick := CloseButtonClick;
- ConnectButton.OnClick := ConnectButtonClick;
- StopButton.OnClick := StopButtonClick;
- QuickConnectButton.OnClick := QuickConnectButtonClick;
- OnKeyDown := FormKeyDown;
- OnClose := FormClose;
- OnResponse := FormResponse;
+ AddConnectionButton.OnClick := @AddConnectionButtonClick;
+ EditButton.OnClick := @EditButtonClick;
+ DuplicateButton.OnClick := @DuplicateButtonClick;
+ RemoveButton.OnClick := @RemoveButtonClick;
+ CloseButton.OnClick := @CloseButtonClick;
+ ConnectButton.OnClick := @ConnectButtonClick;
+ StopButton.OnClick := @StopButtonClick;
+ QuickConnectButton.OnClick := @QuickConnectButtonClick;
+ OnKeyDown := @FormKeyDown;
+ OnClose := @FormClose;
+ OnResponse := @FormResponse;
end;
procedure TFConnectionManager.ListViewSelectionChanged(Sender: TObject);
@@ -360,7 +360,7 @@ begin
try
Item := ListView.Selected;
if Item = nil then Exit;
- ConnMgrItem := Item.AsPointer(0);
+ ConnMgrItem := TConnMgrItem(Item.AsPointer(0));
if ConnMgrItem = nil then Exit;
FConnectionProperties := TFConnectionProperties.Create(Self);
FConnectionProperties.NameEntry.Text := ConnMgrItem.ConnectionName;
@@ -402,7 +402,7 @@ begin
try
Item := ListView.Selected;
if Item = nil then Exit;
- ConnMgrItem := Item.AsPointer(0);
+ ConnMgrItem := TConnMgrItem(Item.AsPointer(0));
if ConnMgrItem = nil then Exit;
FConnectionProperties := TFConnectionProperties.Create(Self);
FConnectionProperties.NameEntry.Text := '';
@@ -449,7 +449,7 @@ var Item: TGTKListItem;
begin
Item := ListView.Selected;
if Item = nil then Exit;
- ConnMgrItem := Item.AsPointer(0);
+ ConnMgrItem := TConnMgrItem(Item.AsPointer(0));
if ConnMgrItem = nil then Exit;
if Application.MessageBox(PGtkWindow(FWidget), Format(LANGConnMgr_DoYouWantDelete, [Item.AsString(1)]),
[mbYes, mbNo], mbQuestion, mbYes, mbNo) = mbYes then
@@ -457,7 +457,7 @@ begin
OldIndex := ListView.ConvertToSorted(Item.Index);
if ConnectionMgrList.Count > 0 then
for i := 0 to ConnectionMgrList.Count - 1 do
- if ConnectionMgrList[i] = ConnMgrItem then begin
+ if TConnMgrItem(ConnectionMgrList[i]) = ConnMgrItem then begin
ConnectionMgrList.Delete(i);
Break;
end;
@@ -483,7 +483,7 @@ var i: integer;
begin
if ConnectionMgrList.Count > 0 then
for i := 0 to ConnectionMgrList.Count - 1 do begin
- ConnMgrItem := ConnectionMgrList[i];
+ ConnMgrItem := TConnMgrItem(ConnectionMgrList[i]);
Item := ListView.Items.Add;
Item.SetValue(0, ConnMgrItem);
Item.SetValue(1, ConnMgrItem.ConnectionName);
@@ -542,7 +542,7 @@ var Engine: TVFSEngine;
Error: PGError;
begin
FActiveConnInfo := nil;
- if ListView.Selected <> nil then FActiveConnInfo := ListView.Selected.AsPointer(0);
+ if ListView.Selected <> nil then FActiveConnInfo := TConnMgrItem(ListView.Selected.AsPointer(0));
if FActiveConnInfo = nil then Exit;
if PluginList.Count = 0 then begin
@@ -555,7 +555,7 @@ begin
if Length(FActiveConnInfo.PluginID) > 0 then
for i := 0 to PluginList.Count - 1 do
if TVFSPlugin(PluginList[i]).ModuleID = FActiveConnInfo.PluginID then begin
- VFSPlugin := PluginList[i];
+ VFSPlugin := TVFSPlugin(PluginList[i]);
Break;
end;
if VFSPlugin = nil then begin
@@ -563,12 +563,12 @@ begin
if Length(TVFSPlugin(PluginList[i]).Services) > 0 then
for j := 0 to Length(TVFSPlugin(PluginList[i]).Services) - 1 do
if WideCompareText(TVFSPlugin(PluginList[i]).Services[j], FActiveConnInfo.ServiceType) = 0 then begin
- VFSPlugin := PluginList[i];
+ VFSPlugin := TVFSPlugin(PluginList[i]);
Break;
end;
if VFSPlugin <> nil then Break;
end;
- if VFSPlugin = nil then VFSPlugin := PluginList[0]; // Fallback in hope some other plugin can handle it
+ if VFSPlugin = nil then VFSPlugin := TVFSPlugin(PluginList[0]); // Fallback in hope some other plugin can handle it
end;
if (SourcePanelEngine is TVFSEngine) and ConfReplaceConnectionWarning then begin
@@ -624,15 +624,15 @@ begin
ModalResult := mbOK;
end;
-function TFConnectionManager.DoConnectInternal(const URI: string; Engine: TVFSEngine; ParentForm: TCustomGTKForm; VFSQuickConnectMode: boolean; Error: PPGError): boolean;
+function TFConnectionManager.DoConnectInternal(const URI: string; Engine: TVFSEngine; AParentForm: TCustomGTKForm; VFSQuickConnectMode: boolean; Error: PPGError): boolean;
begin
Result := False;
FSilenceError := False;
Thread := TOpenConnectionThread.Create;
try
- Thread.VFSConnectionManagerMode := ParentForm = Self;
+ Thread.VFSConnectionManagerMode := AParentForm = Self;
Thread.VFSQuickConnectMode := VFSQuickConnectMode;
- Thread.DialogsParentWindow := ParentForm;
+ Thread.DialogsParentWindow := AParentForm;
Thread.AEngine := Engine;
Thread.URI := URI;
Thread.Resume;