summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2024-12-23 12:09:37 +0100
committerTomas Bzatek <tbzatek@redhat.com>2024-12-23 12:09:37 +0100
commit585635371a182d2b3cd5400f6d26d8e20ade6dbd (patch)
treefe4d71d71ac7aec633488546e939fcca8a754ccd
parent6475cd8e422b88e8d0fa3499195e6392bd3bbf12 (diff)
downloadtuxcmd-585635371a182d2b3cd5400f6d26d8e20ade6dbd.tar.xz
Drop Application.GTKVersion_2_xxx_Up
...and related quirks along with it. Assume latest gtk2 release.
-rw-r--r--UChecksum.pas35
-rw-r--r--UChown.pas4
-rw-r--r--UColumns.pas2
-rw-r--r--UConfig.pas1
-rw-r--r--UConnectionManager.pas6
-rw-r--r--UCore.pas2
-rw-r--r--UCoreUtils.pas16
-rw-r--r--UFileTypeSettings.pas18
-rw-r--r--UGnome.pas2
-rw-r--r--UMain.pas234
-rw-r--r--UMounterPrefs.pas4
-rw-r--r--UToolTips.pas19
-rw-r--r--libgtk_kylix/GTKControls.pas16
-rw-r--r--libgtk_kylix/GTKForms.pas28
-rw-r--r--libgtk_kylix/GTKMenus.pas9
-rw-r--r--libgtk_kylix/GTKView.pas100
16 files changed, 110 insertions, 386 deletions
diff --git a/UChecksum.pas b/UChecksum.pas
index 0de5fda..8b3dbb7 100644
--- a/UChecksum.pas
+++ b/UChecksum.pas
@@ -334,7 +334,6 @@ begin
List.Add(Item);
ListItem := FileList.Items.Add;
ListItem.Data := Item;
- if not Application.GTKVersion_2_0_5_Up then ListItem.SetValue(0, Item);
end;
end;
@@ -343,14 +342,11 @@ const StatusStr : array[0..3] of string = ('?', 'OK', 'BAD', 'N/A');
var Data: TFileListItem;
Path: PGtkTreePath;
begin
- if not Application.GTKVersion_2_0_5_Up then gtk_tree_model_get(tree_model, iter, 0, @Data, -1)
- else begin
- Path := gtk_tree_model_get_path(tree_model, iter);
- if not Assigned(Path) then Exit;
- (Sender as TGTKListView).ConvertPathToChild(Path);
- Data := List[gtk_tree_path_get_indices(Path)^];
- gtk_tree_path_free(Path);
- end;
+ Path := gtk_tree_model_get_path(tree_model, iter);
+ if not Assigned(Path) then Exit;
+ (Sender as TGTKListView).ConvertPathToChild(Path);
+ Data := List[gtk_tree_path_get_indices(Path)^];
+ gtk_tree_path_free(Path);
case gtk_tree_view_column_get_sort_column_id(tree_column) of
0: g_object_set(cell, 'text', StrToUTF8(PChar(Format('[%s] %s', [StatusStr[Data.Status], Data.Name]))), nil);
-1: if not Data.IsMD5 then g_object_set(cell, 'text', PChar('0x' + IntToHex(Data.CRC, 8)), nil)
@@ -363,19 +359,14 @@ var Data1, Data2: TFileListItem;
Path: PGtkTreePath;
begin
Result := 0;
- if not Application.GTKVersion_2_0_5_Up then begin
- gtk_tree_model_get(model, a, 0, @Data1, -1);
- gtk_tree_model_get(model, b, 0, @Data2, -1);
- end else begin
- Path := gtk_tree_model_get_path(model, a);
- if not Assigned(Path) then Exit;
- Data1 := List[gtk_tree_path_get_indices(Path)^];
- gtk_tree_path_free(Path);
- Path := gtk_tree_model_get_path(model, b);
- if not Assigned(Path) then Exit;
- Data2 := List[gtk_tree_path_get_indices(Path)^];
- gtk_tree_path_free(Path);
- end;
+ Path := gtk_tree_model_get_path(model, a);
+ if not Assigned(Path) then Exit;
+ Data1 := List[gtk_tree_path_get_indices(Path)^];
+ gtk_tree_path_free(Path);
+ Path := gtk_tree_model_get_path(model, b);
+ if not Assigned(Path) then Exit;
+ Data2 := List[gtk_tree_path_get_indices(Path)^];
+ gtk_tree_path_free(Path);
if (Sender as TGTKView).SortColumnID = 0 then Result := CompareTextsEx(PChar(Data1.Name), PChar(Data2.Name));
end;
diff --git a/UChown.pas b/UChown.pas
index 770c3fe..5e09809 100644
--- a/UChown.pas
+++ b/UChown.pas
@@ -140,7 +140,7 @@ begin
for i := 0 to OwnerListView.Items.Count - 1 do
if OwnerListView.Items[i].AsInteger(1) = UID then begin
OwnerListView.Items[i].Selected := True;
- OwnerListView.Items[i].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ OwnerListView.Items[i].SetCursor(0, False, False, 0.5, 0);
susr := OwnerListView.Items[i].AsString(0);
Break;
end;
@@ -148,7 +148,7 @@ begin
for i := 0 to GroupListView.Items.Count - 1 do
if GroupListView.Items[i].AsInteger(1) = GID then begin
GroupListView.Items[i].Selected := True;
- GroupListView.Items[i].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ GroupListView.Items[i].SetCursor(0, False, False, 0.5, 0);
sgrp := GroupListView.Items[i].AsString(0);
Break;
end;
diff --git a/UColumns.pas b/UColumns.pas
index 944b659..d59b990 100644
--- a/UColumns.pas
+++ b/UColumns.pas
@@ -168,7 +168,7 @@ begin
ListView.Items[New].SetValue(2, ListView.Items[Old].AsInteger(2));
ListView.Items[Old].SetValue(2, i);
ListView.Items[New].Selected := True;
- ListView.Items[New].SetCursor(1, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListView.Items[New].SetCursor(1, False, False, 0.5, 0);
end;
end;
diff --git a/UConfig.pas b/UConfig.pas
index 81accd2..e34d7dd 100644
--- a/UConfig.pas
+++ b/UConfig.pas
@@ -47,7 +47,6 @@ const ConfDefaultNormalItemFGColor = '#000000';
ConfDefaultSettingsDir = '.tuxcmd'; // Also has to be changed in UGTKLoader
ConfDblClickDelay = 500;
ConfQuickRenameDelay = ConfDblClickDelay + 250;
- ConfInactiveTimerDelay = 0;
ConfEditViewFileSizeLimit = 10*1024*1024; // 10 MB
ConfAppNA = '---';
ConfDefaultRowHeight = 16;
diff --git a/UConnectionManager.pas b/UConnectionManager.pas
index f029bcb..a9cbbfb 100644
--- a/UConnectionManager.pas
+++ b/UConnectionManager.pas
@@ -344,7 +344,7 @@ begin
Item.SetValue(1, ConnMgrItem.ConnectionName);
Item.SetValue(2, FConnectionProperties.MakeURI(True));
Item.Selected := True;
- Item.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ Item.SetCursor(0, False, False, 0.5, 0);
end;
finally
FConnectionProperties.Free;
@@ -434,7 +434,7 @@ begin
Item.SetValue(1, ConnMgrItem.ConnectionName);
Item.SetValue(2, FConnectionProperties.MakeURI(True));
Item.Selected := True;
- Item.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ Item.SetCursor(0, False, False, 0.5, 0);
end;
finally
FConnectionProperties.Free;
@@ -470,7 +470,7 @@ begin
then OldIndex := ListView.ConvertFromSorted(ListView.Items.Count - 1)
else OldIndex := ListView.ConvertFromSorted(OldIndex);
ListView.Items[OldIndex].Selected := True;
- ListView.Items[OldIndex].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListView.Items[OldIndex].SetCursor(0, False, False, 0.5, 0);
end;
ListView.SetFocus;
end;
diff --git a/UCore.pas b/UCore.pas
index 9f1074f..ea13f18 100644
--- a/UCore.pas
+++ b/UCore.pas
@@ -162,7 +162,6 @@ begin
end;
Icon := UpDirIcon.FPixbuf;
ItemColor := NormalItemGDKColor;
- if not Application.GTKVersion_2_0_5_Up then ListItem.SetValue(0, Data);
end;
ListItem.Data := Data;
DataList.Add(Data);
@@ -275,7 +274,6 @@ begin
AssignFileType(List[i]);
DataList.Add(List[i]);
ListItem.Data := DataList[DataList.Count - 1];
- if not Application.GTKVersion_2_0_5_Up then ListItem.SetValue(0, List[i]);
end;
Time2 := Now;
DebugMsg(['Fill panel: ', SecondOf(Time2 - Time1), ':', MillisecondOf(Time2 - Time1)]);
diff --git a/UCoreUtils.pas b/UCoreUtils.pas
index 1fae28b..b0ea388 100644
--- a/UCoreUtils.pas
+++ b/UCoreUtils.pas
@@ -121,8 +121,6 @@ function XORStr(const s: string; Key: byte): string;
function FindCommonRoot(BasePath, DestPath: string): string;
function BuildRelativePath(BasePath, DestPath: string): string;
-procedure ReportGTKVersion;
-
// Internal locking
procedure InternalLock;
procedure InternalUnLock;
@@ -1772,20 +1770,6 @@ begin
end;
end;
-procedure ReportGTKVersion;
-begin
-{$IFDEF FPC}
- DebugMsg(['Reported GTK version: ', gtk_major_version, '.', gtk_minor_version, '.', gtk_micro_version]);
-{$ENDIF}
- if Application.GTKVersion_2_8_0_Up then DebugMsg(['Using quirks for GTK+ >= 2.8.0']) else
- if Application.GTKVersion_2_6_0_Up then DebugMsg(['Using quirks for GTK+ >= 2.6.0']) else
- if Application.GTKVersion_2_4_0_Up then DebugMsg(['Using quirks for GTK+ >= 2.4.0']) else
- if Application.GTKVersion_2_2_0_Up then DebugMsg(['Using quirks for GTK+ >= 2.2.0']) else
- if Application.GTKVersion_2_0_5_Up then DebugMsg(['Using quirks for GTK+ >= 2.0.5']) else
- DebugMsg(['Using quirks for GTK+ < 2.0.5']);
-end;
-
-
(********************************************************************************************************************************)
var InternalLockVar: integer;
procedure InternalLock;
diff --git a/UFileTypeSettings.pas b/UFileTypeSettings.pas
index 89189ab..55ce5c5 100644
--- a/UFileTypeSettings.pas
+++ b/UFileTypeSettings.pas
@@ -123,22 +123,22 @@ begin
TitleFrame.AddControl(TitleEventBox);
ClientArea.AddControlEx(TitleFrame, False, True, 0);
- ListView := TGTKListView.CreateTyped(Self, Application.GTKVersion_2_0_5_Up, [lcText, lcText, lcPointer, lcPixbuf]);
+ ListView := TGTKListView.CreateTyped(Self, True, [lcText, lcText, lcPointer, lcPixbuf]);
ListView.RulesHint := True;
Column := ListView.Columns.AddTyped(ctImageText);;
Column.Caption := LANGExtensionsColumn;
Column.AddImageAttribute('pixbuf', 3);
Column.AddAttribute('text', 0);
- if Application.GTKVersion_2_0_5_Up then Column.SortID := 0;
+ Column.SortID := 0;
Column.Resizable := True;
g_object_set(G_OBJECT(Column.FColumn), 'sizing', 2, 'fixed-width', 150, nil);
{ Column.FixedWidth := 300;
Column.SizingMode := smFixed; }
- if Application.GTKVersion_2_6_0_Up then Column.SetProperty('ellipsize', 3);
+ Column.SetProperty('ellipsize', 3);
Column := ListView.Columns.Add;
Column.Caption := LANGDescriptionColumn;
Column.AddAttribute('text', 1);
- if Application.GTKVersion_2_0_5_Up then Column.SortID := 1;
+ Column.SortID := 1;
Column.Resizable := True;
ListViewScrolledWindow := TGTKScrolledWindow.Create(Self);
ListViewScrolledWindow.AddControl(ListView);
@@ -168,19 +168,19 @@ begin
ClientArea.AddControlEx(Notebook, False, False, 0);
ActionsListViewScrolledWindow := TGTKScrolledWindow.Create(Self);
- ActionsListView := TGTKListView.CreateTyped(Self, Application.GTKVersion_2_0_5_Up, [lcText, lcText, lcPointer]);
+ ActionsListView := TGTKListView.CreateTyped(Self, True, [lcText, lcText, lcPointer]);
ActionsListView.RulesHint := True;
Column := ActionsListView.Columns.Add;
Column.Caption := LANGActionName;
Column.AddAttribute('text', 0);
- if Application.GTKVersion_2_0_5_Up then Column.SortID := 0;
+ Column.SortID := 0;
Column.Resizable := True;
Column.FixedWidth := 180;
Column.SizingMode := smFixed;
Column := ActionsListView.Columns.Add;
Column.Caption := LANGCommand;
Column.AddAttribute('text', 1);
- if Application.GTKVersion_2_0_5_Up then Column.SortID := 1;
+ Column.SortID := 1;
Column.Resizable := True;
ActionsListViewScrolledWindow.AddControl(ActionsListView);
ActionsListViewScrolledWindow.VertScrollBarPolicy := sbAutomatic;
@@ -501,7 +501,7 @@ begin
ListItem := ListView.Items.Add;
ListItem.SetValue(2, Item);
ListItem.Selected := True;
- ListItem.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListItem.SetCursor(0, False, False, 0.5, 0);
ListViewSelectionChanged(Self);
AssocDescriptionEntry.SetFocus;
end;
@@ -841,7 +841,6 @@ var ColumnID: integer;
Data: TFileAssoc;
s: Pointer;
begin
- if not Application.GTKVersion_2_0_5_Up then Exit;
ColumnID := gtk_tree_view_column_get_sort_column_id(tree_column);
ImageCol := False;
if ColumnID = 0 then ImageCol := GTK_IS_CELL_RENDERER_PIXBUF(cell);
@@ -867,7 +866,6 @@ var ColumnID: integer;
s: Pointer;
Item: TFileAssoc;
begin
- if not Application.GTKVersion_2_0_5_Up then Exit;
ColumnID := gtk_tree_view_column_get_sort_column_id(tree_column);
ImageCol := False;
if ColumnID = 0 then ImageCol := GTK_IS_CELL_RENDERER_PIXBUF(cell);
diff --git a/UGnome.pas b/UGnome.pas
index 9a04734..2536d42 100644
--- a/UGnome.pas
+++ b/UGnome.pas
@@ -1457,7 +1457,7 @@ begin
// The table that holds the entries
priv.entry_container := gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- if can_anonymous and Application.GTKVersion_2_4_0_Up then g_object_set (priv.entry_container, 'left-padding', 12, nil);
+ 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);
table := gtk_table_new (rows, 2, FALSE);
diff --git a/UMain.pas b/UMain.pas
index bce9d75..359397f 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -127,9 +127,6 @@ type
procedure miFileTypesClick(Sender: TObject);
procedure CommandLineComboKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
procedure FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
- procedure InactiveItemsTimerTimer(Sender: TObject);
- function OldGTKConvertToSorted(Sender: TObject; const Index: integer): integer;
- function OldGTKConvertFromSorted(Sender: TObject; const Index: integer): integer;
procedure SplitterPopupMenuClick(Sender: TObject);
procedure miChangePermissionsClick(Sender: TObject);
procedure miChangeOwnerClick(Sender: TObject);
@@ -189,7 +186,7 @@ type
private
LeftLastFocused, Editing, QuickFind, RedrawLeftInactive, RedrawRightInactive, StartUp, LeftTabPopup: boolean;
LastWidth, RunningEscSensitive: integer;
- InplaceEditTimer, InactiveItemsTimer, RebuildListViewsTimer, RightMouseSelectPopupTimer: TGTKTimer;
+ InplaceEditTimer, RebuildListViewsTimer, RightMouseSelectPopupTimer: TGTKTimer;
InplaceEditItem: TGTKListItem;
SavedCmdLine: string;
LastMounterButton: TGTKButton;
@@ -280,7 +277,6 @@ function form_event_handler(widget: PGtkWidget; event: PGdkEvent; user_data: gpo
procedure TFMain.FormCreate(Sender: TObject);
begin
- ReportGTKVersion;
SetupAppIcon;
StartUp := True;
RunningEscSensitive := 0;
@@ -314,10 +310,6 @@ begin
InplaceEditTimer := TGTKTimer.Create(Self);
InplaceEditTimer.Enabled := False;
InplaceEditTimer.OnTimer := InplaceEditTimerTimer;
- InactiveItemsTimer := TGTKTimer.Create(Self);
- InactiveItemsTimer.Enabled := False;
- InactiveItemsTimer.Interval := ConfInactiveTimerDelay;
- if not Application.GTKVersion_2_6_0_Up then InactiveItemsTimer.OnTimer := InactiveItemsTimerTimer;
RebuildListViewsTimer := TGTKTimer.Create(Self);
RebuildListViewsTimer.Enabled := False;
RebuildListViewsTimer.OnTimer := RebuildListViewsTimerTimer;
@@ -511,12 +503,6 @@ begin
RightScrolledWindow := TGTKScrolledWindow.Create(Self);
LeftListView := TGTKListView.CreateTyped(Self, True, [lcPointer]);
RightListView := TGTKListView.CreateTyped(Self, True, [lcPointer]);
- if not Application.GTKVersion_2_0_5_Up then begin
- LeftListView.FromSortedCoversionFunc := OldGTKConvertFromSorted;
- LeftListView.ToSortedCoversionFunc := OldGTKConvertToSorted;
- RightListView.FromSortedCoversionFunc := OldGTKConvertFromSorted;
- RightListView.ToSortedCoversionFunc := OldGTKConvertToSorted;
- end;
LeftStatusLine := TGTKLabel.Create(Self);
RightStatusLine := TGTKLabel.Create(Self);
LeftQuickFindVBox := TGTKVBox.Create(Self);
@@ -1088,8 +1074,7 @@ begin
GetFirstLastPanelColumn(FirstColumn, LastColumn);
// Temporarily disable the fixed height mode to be able to add columns the Pascal way
- if Application.GTKVersion_2_12_0_Up then
- g_object_set(ListView.FWidget, 'fixed_height_mode', 0, nil);
+ g_object_set(ListView.FWidget, 'fixed_height_mode', 0, nil);
for i := 1 to ConstNumPanelColumns do
if ConfColumnVisible[i] then begin
@@ -1129,13 +1114,13 @@ begin
gtk_cell_renderer_set_fixed_size(PGtkCellRenderer(Column.FRenderer), ConfColumnSizes[i], ConfRowHeight); }
if ConfColumnIDs[i] < 3 then begin // Filename column
Column.OnEdited := ListViewEdited;
- if Application.GTKVersion_2_6_0_Up then Column.SetProperty('ellipsize', 3);
+ Column.SetProperty('ellipsize', 3);
end;
if ConfColumnIDs[i] in [4, 8, 9] then begin
Column.SetProperty('xalign', 1);
Column.Alignment := 1;
end;
- if Application.GTKVersion_2_4_0_Up then Column.SetProperty('single-paragraph-mode', 1);
+ Column.SetProperty('single-paragraph-mode', 1);
Column.OnClicked := ListViewColumnClicked;
HandlerID := g_signal_connect(Column.FColumn, 'notify::width', G_CALLBACK(@ListViewColumnResized), ListView);
g_object_set_data(G_OBJECT(Column.FColumn), 'Width_Notify_Handler', Pointer(HandlerID));
@@ -1146,10 +1131,7 @@ begin
FontDesc := pango_font_description_from_string(PChar(ConfPanelFont));
gtk_widget_modify_font(ListView.FWidget, FontDesc);
end else gtk_widget_modify_font(ListView.FWidget, nil);
-
- // Set the fixed row height - there were some issues with custom drawing in the past, now with 2.18 it looks all fine
- if Application.GTKVersion_2_12_0_Up then
- g_object_set(ListView.FWidget, 'fixed_height_mode', 1, nil);
+ g_object_set(ListView.FWidget, 'fixed_height_mode', 1, nil);
end;
procedure TFMain.FormDestroy(Sender: TObject);
@@ -1754,8 +1736,7 @@ begin
AListView := RightListView;
end;
DeactivateQuickFind(LeftPanel);
- if Application.GTKVersion_2_0_5_Up then Data := DataList[ItemIndex]
- else Data := AListView.Items[ItemIndex].AsPointer(0);
+ Data := DataList[ItemIndex];
DebugMsg(['Selected:', Data^.FDisplayName]);
if not Assigned(Data) then Exit;
if Data^.UpDir then ChangingDir(LeftPanel, '..') else
@@ -1913,7 +1894,7 @@ begin
if (not b) and ((Engine.Path = '/') or (NewPath = '/')) and (HiliString1 = '') and (HiliString2 = '') then Sel := ListView.ConvertFromSorted(0);
ListView.Items[Sel].Selected := True;
// Application.ProcessMessages;
- ListView.Items[Sel].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListView.Items[Sel].SetCursor(0, False, False, 0.5, 0);
// Application.ProcessMessages;
end;
UpdatePanelInfo;
@@ -2098,21 +2079,16 @@ var Data1, Data2: PDataItem;
DataList: TList;
begin
Result := 0;
- if not Application.GTKVersion_2_0_5_Up then begin
- gtk_tree_model_get(model, a, 0, @Data1, -1);
- gtk_tree_model_get(model, b, 0, @Data2, -1);
- end else begin
- if Sender = LeftListView then DataList := LeftPanelData
- else DataList := RightPanelData;
- Path := gtk_tree_model_get_path(model, a);
- if not Assigned(Path) then Exit;
- Data1 := DataList[gtk_tree_path_get_indices(Path)^];
- gtk_tree_path_free(Path);
- Path := gtk_tree_model_get_path(model, b);
- if not Assigned(Path) then Exit;
- Data2 := DataList[gtk_tree_path_get_indices(Path)^];
- gtk_tree_path_free(Path);
- end;
+ if Sender = LeftListView then DataList := LeftPanelData
+ else DataList := RightPanelData;
+ Path := gtk_tree_model_get_path(model, a);
+ if not Assigned(Path) then Exit;
+ Data1 := DataList[gtk_tree_path_get_indices(Path)^];
+ gtk_tree_path_free(Path);
+ Path := gtk_tree_model_get_path(model, b);
+ if not Assigned(Path) then Exit;
+ Data2 := DataList[gtk_tree_path_get_indices(Path)^];
+ gtk_tree_path_free(Path);
Result := LVCompareItems(Data1, Data2, (Sender as TGTKView).SortOrder = soAscending, FMain.ColumnSortIDs[(Sender as TGTKView).SortColumnID + 1]);
end;
@@ -2290,29 +2266,18 @@ var s: PChar;
AFGColor, ABGColor: PGdkColor;
{ Rect, VisibleRect: TGdkRectangle; }
begin
- if Application.GTKVersion_2_0_5_Up then ColumnIdx := gtk_tree_view_column_get_sort_column_id(tree_column) else
- begin
- ColumnIdx := 0;
- for i := 0 to (Sender as TGTKListView).Columns.Count - 1 do
- if (cell = (Sender as TGTKListView).Columns[i].FRenderer) or (cell = (Sender as TGTKListView).Columns[i].FPixbufRenderer) then begin
- ColumnIdx := i;
- Break;
- end;
- end;
+ ColumnIdx := gtk_tree_view_column_get_sort_column_id(tree_column);
ColumnID := ColumnSortIDs[ColumnIdx + 1] - 1;
ImageCol := False;
if ColumnIdx = 0 then ImageCol := GTK_IS_CELL_RENDERER_PIXBUF(cell);
Data := nil;
- if not Application.GTKVersion_2_0_5_Up then gtk_tree_model_get(tree_model, iter, 0, @Data, -1)
- else begin
- if Sender = LeftListView then DataList := LeftPanelData
- else DataList := RightPanelData;
- TreePath := gtk_tree_model_get_path(tree_model, iter);
- if not Assigned(TreePath) then Exit;
- (Sender as TGTKListView).ConvertPathToChild(TreePath);
- Data := DataList[gtk_tree_path_get_indices(TreePath)^];
- gtk_tree_path_free(TreePath);
- end;
+ if Sender = LeftListView then DataList := LeftPanelData
+ else DataList := RightPanelData;
+ TreePath := gtk_tree_model_get_path(tree_model, iter);
+ if not Assigned(TreePath) then Exit;
+ (Sender as TGTKListView).ConvertPathToChild(TreePath);
+ Data := DataList[gtk_tree_path_get_indices(TreePath)^];
+ gtk_tree_path_free(TreePath);
(* gtk_tree_view_get_cell_area(tree_view, TreePath, nil, @Rect);
gtk_tree_view_get_visible_rect(tree_view, @VisibleRect);
if (Rect.height = 0) or (Rect.height <> ConfRowHeight) or (Rect.y = 0) or (Rect.y > VisibleRect.y + VisibleRect.height) then Exit; *)
@@ -2342,26 +2307,21 @@ begin
then begin
if (ColumnID = 0) or (ColumnID = 1) then s := FDisplayName else s := nil;
g_object_set(cell, 'text', s, 'foreground-gdk', AFGColor, nil);
- if Application.GTKVersion_2_2_0_Up or (not ConfUseFileTypeIcons) then
- g_object_set(cell, 'background-gdk', ABGColor, nil);
+ g_object_set(cell, 'background-gdk', ABGColor, nil);
end
else begin // not editing
if ConfDirsInBold then begin
if IsDir or UpDir then g_object_set(cell, 'markup', PChar(Format('<span weight="bold">%s</span>', [QuoteMarkupStr(ColumnData[ColumnID])])), 'foreground-gdk', AFGColor, nil)
else g_object_set(cell, 'markup', PChar(QuoteMarkupStr(ColumnData[ColumnID])), 'foreground-gdk', AFGColor, nil);
end else g_object_set(cell, 'text', ColumnData[ColumnID], 'foreground-gdk', AFGColor, nil);
- if Application.GTKVersion_2_2_0_Up or (not ConfUseFileTypeIcons) then
- g_object_set(cell, 'background-gdk', ABGColor, nil); // Older versions have bug in color filling
+ g_object_set(cell, 'background-gdk', ABGColor, nil);
end;
end else // this is the image column
if ConfUseFileTypeIcons then begin // Assign icons
- if Application.GTKVersion_2_2_0_Up then
- g_object_set(cell, 'cell-background-gdk', ABGColor, nil); // Older versions don't have this property
- if Sel and (not (Sender as TGTKView).Focused) and Application.GTKVersion_2_2_0_Up then begin
- if InactiveItemsTimer.Enabled then InactiveItemsTimer.Enabled := False;
+ g_object_set(cell, 'cell-background-gdk', ABGColor, nil);
+ if Sel and (not (Sender as TGTKView).Focused) then begin
if Sender = LeftListView then RedrawLeftInactive := True
else RedrawRightInactive := True;
- InactiveItemsTimer.Enabled := not Application.GTKVersion_2_6_0_Up;
end;
if Icon <> nil then g_object_set(cell, 'pixbuf', Icon, nil);
end;
@@ -2758,7 +2718,7 @@ begin
Item := (Sender as TGTKListView).GetItemAtPos(X, Y);
if Assigned(Item) then begin
Item.Selected := True;
- Item.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ Item.SetCursor(0, False, False, 0.5, 0);
end;
// Show file popup menu or start selection mode, depending on ConfRightClickSelect
@@ -2784,7 +2744,7 @@ begin
Item := (Sender as TGTKListView).GetItemAtPos(X, Y);
if Assigned(Item) then begin
Item.Selected := True;
- Item.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ Item.SetCursor(0, False, False, 0.5, 0);
end;
// Open directory in background tab
@@ -2818,7 +2778,7 @@ begin
RightMouseSelectPopupTimer.Enabled := False;
Data^.Selected := PanelRightMouseSelMode;
Item.Selected := True;
- Item.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ Item.SetCursor(0, False, False, 0.5, 0);
UpdatePanelInfoDown(Sender = LeftListView);
end;
end;
@@ -2947,7 +2907,6 @@ end;
procedure TFMain.ListViewSelectionChanged(Sender: TObject);
var i: integer;
-// AListView: TGTKListView;
begin
if Editing and ((Sender as TGTKListView).Selected <> InplaceEditItem) then begin
Editing := False;
@@ -2959,11 +2918,6 @@ begin
end;
if QuickFind then DeactivateQuickFind(Sender = LeftListView);
SaveCursorPositionTabbed(Sender = LeftListView);
-{ if Application.GTKVersion_2_6_0_Up then begin
- AListView := Sender as TGTKListView;
- if Assigned(AListView) and Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and Assigned(PDataItem(AListView.Selected.Data)^.ItemColor)
- then gtk_widget_modify_text(AListView.FWidget, GTK_STATE_SELECTED, PDataItem(AListView.Selected.Data)^.ItemColor);
- end; }
end;
procedure TFMain.SaveCursorPositionTabbed(LeftPanel: boolean);
@@ -3842,103 +3796,6 @@ begin
end;
end;
-procedure TFMain.InactiveItemsTimerTimer(Sender: TObject);
-
- procedure Redraw(AListView: TGTKListView; tree_view: PGtkTreeView);
- var TreePath: PGtkTreePath;
- Iter: TGtkTreeIter;
- Rect: TGdkRectangle;
- PixBuf, Icon: PGdkPixbuf;
- cell_width, cell_height: integer;
- begin
- if (csDestroying in ComponentState) or (AListView = nil) or (AListView.FSelection = nil) then Exit;
- if not gtk_tree_selection_get_selected(AListView.FSelection, nil, @Iter) then Exit;
- TreePath := gtk_tree_model_get_path(gtk_tree_view_get_model(tree_view), @Iter);
- if not Assigned(TreePath) then Exit;
- gtk_tree_view_get_background_area(tree_view, TreePath, AListView.Columns[0].FColumn, @Rect);
- gtk_tree_path_free(TreePath);
- gtk_cell_renderer_get_size(AListView.Columns[0].FPixbufRenderer, PGtkWidget(tree_view), nil, nil, nil, @cell_width, @cell_height);
- Icon := PDataItem(AListView.Selected.Data)^.Icon;
- Rect.width := Rect.x + cell_width + AListView.Columns[0].FRenderer^.xpad * 2 + 1;
- PixBuf := gdk_pixbuf_new(GDK_COLORSPACE_RGB, True, 8, Rect.width, Rect.height);
- gdk_pixbuf_fill(PixBuf, InactiveItemBGColorNum);
- gdk_pixbuf_render_to_drawable_alpha(PixBuf, PGdkDrawable(gtk_tree_view_get_bin_window(tree_view)), 0, 0, Rect.x, Rect.y,
- Rect.width, Rect.height, GDK_PIXBUF_ALPHA_FULL, 0, GDK_RGB_DITHER_NORMAL, 0, 0);
- gdk_pixbuf_unref(PixBuf);
- gdk_pixbuf_render_to_drawable_alpha(Icon, PGdkDrawable(gtk_tree_view_get_bin_window(tree_view)), 0, 0,
- Rect.x + AListView.Columns[0].FRenderer^.xpad, Rect.y + Rect.height div 2 - (16 div 2),
- 16, 16, GDK_PIXBUF_ALPHA_FULL, 0, GDK_RGB_DITHER_NORMAL, 0, 0);
- end;
-
-
-begin
- if Assigned(Sender) and Assigned(InactiveItemsTimer) and Assigned(LeftListView) and Assigned(RightListView) and
- (not (csDestroying in ComponentState)) then
- try
- InactiveItemsTimer.Enabled := False;
- if RedrawLeftInactive and (not LeftListView.Focused) // and (not ConfInactiveItemDefaultColors)
- then Redraw(LeftListView, PGtkTreeView(LeftListView.FWidget));
- if RedrawRightInactive and (not RightListView.Focused) // and (not ConfInactiveItemDefaultColors)
- then Redraw(RightListView, PGtkTreeView(RightListView.FWidget));
- RedrawLeftInactive := False;
- RedrawRightInactive := False;
- except end;
-end;
-
-
-(********************************************************************************************************************************)
-function TFMain.OldGTKConvertToSorted(Sender: TObject; const Index: integer): integer;
-var DataList, List: TList;
- i: integer;
- AListView: TGTKListView;
-begin
- Result := -1;
- if Sender = LeftListView then begin
- DataList := LeftPanelData;
- AListView := LeftListView;
- end else begin
- DataList := RightPanelData;
- AListView := RightListView;
- end;
- List := nil; // Silent compiler warnings
- if Assigned(DataList) and (DataList.Count > 0) then
- try
- List := TList.Create;
- for i := 0 to DataList.Count - 1 do List.Add(DataList[i]);
- if (List.Count > 1) and (AListView.SortOrder <> soNone) then
- SortDataList(List, AListView.SortOrder = soAscending, AListView.SortColumnID);
- Result := List.IndexOf(DataList[Index]);
- finally
- List.Free;
- end;
-end;
-
-function TFMain.OldGTKConvertFromSorted(Sender: TObject; const Index: integer): integer;
-var DataList, List: TList;
- i: integer;
- AListView: TGTKListView;
-begin
- Result := -1;
- if Sender = LeftListView then begin
- DataList := LeftPanelData;
- AListView := LeftListView;
- end else begin
- DataList := RightPanelData;
- AListView := RightListView;
- end;
- List := nil; // Silent compiler warnings
- if Assigned(DataList) and (DataList.Count > 0) then
- try
- List := TList.Create;
- for i := 0 to DataList.Count - 1 do List.Add(DataList[i]);
- if (List.Count > 1) and (AListView.SortOrder <> soNone) then
- SortDataList(List, AListView.SortOrder = soAscending, AListView.SortColumnID);
- Result := DataList.IndexOf(List[Index]);
- finally
- List.Free;
- end;
-end;
-
(********************************************************************************************************************************)
procedure TFMain.SplitterPopupMenuClick(Sender: TObject);
begin
@@ -4509,8 +4366,6 @@ end;
procedure TFMain.ApplySettings(RebuildListViews, RebuildIcons, Startup: boolean);
var i: integer;
begin
- InactiveItemsTimer.Enabled := False;
-
ButtonsBox.Visible := ConfShowFuncButtons;
ButtonBoxSeparator.Visible := ConfShowFuncButtons;
ButtonBoxSpace.Visible := not ConfShowFuncButtons;
@@ -4531,7 +4386,6 @@ begin
// Rebuild ListViews
if RebuildListViews then FMain.RebuildListViews(False);
- InactiveItemsTimer.Enabled := False;
// Colors Section
SetupColors;
@@ -4539,17 +4393,15 @@ begin
gtk_widget_modify_base(RightListView.FWidget, GTK_STATE_NORMAL, NormalItemGDKBackground);
gtk_widget_modify_base(LeftListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKBackground);
gtk_widget_modify_base(RightListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKBackground);
-// if Application.GTKVersion_2_6_0_Up then begin
- gtk_widget_modify_base(LeftListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKBackground);
- gtk_widget_modify_base(RightListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKBackground);
-
- gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_NORMAL, NormalItemGDKColor);
- gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_NORMAL, NormalItemGDKColor);
- gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKColor);
- gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKColor);
- gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKColor);
- gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKColor);
-// end;
+ gtk_widget_modify_base(LeftListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKBackground);
+ gtk_widget_modify_base(RightListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKBackground);
+
+ gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_NORMAL, NormalItemGDKColor);
+ gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_NORMAL, NormalItemGDKColor);
+ gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKColor);
+ gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_SELECTED, ActiveItemGDKColor);
+ gtk_widget_modify_text(LeftListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKColor);
+ gtk_widget_modify_text(RightListView.FWidget, GTK_STATE_ACTIVE, InactiveItemGDKColor);
// Resize commandline history
if ConfNumHistoryItems < CommandLineHistory.Count then begin
@@ -4815,7 +4667,6 @@ begin
if LeftPanel then AListView := LeftListView
else AListView := RightListView;
FilePopupMenuPopup(AListView);
- if not Application.GTKVersion_2_0_5_Up then FilePopupMenu.PopUp else
gtk_menu_popup(PGtkMenu(FilePopupMenu.FMenu), nil, nil, file_popup_position_cb, AListView, 0, gtk_get_current_event_time());
end;
@@ -5223,7 +5074,6 @@ begin
RightListView.Columns.Clear;
ConstructColumns(LeftListView);
ConstructColumns(RightListView);
- InactiveItemsTimer.Enabled := False;
if DoRefresh then begin
Application.ProcessMessages;
FMain.DoRefresh(True, True, True);
@@ -6095,7 +5945,7 @@ begin
for i := 0 to DataList.Count - 1 do
if WideCompareText(string(PDataItem(DataList[i])^.FName), ExtractFileName(FSearch.GoToFile)) = 0 then begin
AListView.Items[i].Selected := True;
- AListView.Items[i].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ AListView.Items[i].SetCursor(0, False, False, 0.5, 0);
Break;
end;
end;
diff --git a/UMounterPrefs.pas b/UMounterPrefs.pas
index 6a2f3cf..76ababd 100644
--- a/UMounterPrefs.pas
+++ b/UMounterPrefs.pas
@@ -348,7 +348,7 @@ begin
ListItem := ListView.Items.Add;
ListItem.SetValue(3, Item);
ListItem.Selected := True;
- ListItem.SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListItem.SetCursor(0, False, False, 0.5, 0);
ListViewSelectionChanged(Self);
DisplayTextEntry.SetFocus;
RefreshIcon(ListView.Selected.Index);
@@ -386,7 +386,7 @@ begin
ListView.Items[Old].SetValue(i, p);
end;
ListView.Items[New].Selected := True;
- ListView.Items[New].SetCursor(0, False, not Application.GTKVersion_2_2_0_Up, 0.5, 0);
+ ListView.Items[New].SetCursor(0, False, False, 0.5, 0);
end;
end;
diff --git a/UToolTips.pas b/UToolTips.pas
index 96a0ec2..a9ed9fb 100644
--- a/UToolTips.pas
+++ b/UToolTips.pas
@@ -255,18 +255,15 @@ begin
AListView := FMain.RightListView;
end;
- if not Application.GTKVersion_2_0_5_Up then gtk_tree_model_get(gtk_tree_view_get_model(data_panel), @iter, 0, @Data, -1)
- else begin
- TreePath := gtk_tree_path_new_from_string(PChar(IntToStr(gtk_tree_path_get_indices(data_row)^)));
- if not Assigned(TreePath) then Exit;
- AListView.ConvertPathToChild(TreePath);
- if (TreePath = nil) or (gtk_tree_path_get_indices(TreePath)^ > DataList.Count - 1) then begin
- FileListTipsHide;
- Exit;
- end;
- Data := DataList[gtk_tree_path_get_indices(TreePath)^];
- gtk_tree_path_free(TreePath);
+ TreePath := gtk_tree_path_new_from_string(PChar(IntToStr(gtk_tree_path_get_indices(data_row)^)));
+ if not Assigned(TreePath) then Exit;
+ AListView.ConvertPathToChild(TreePath);
+ if (TreePath = nil) or (gtk_tree_path_get_indices(TreePath)^ > DataList.Count - 1) then begin
+ FileListTipsHide;
+ Exit;
end;
+ Data := DataList[gtk_tree_path_get_indices(TreePath)^];
+ gtk_tree_path_free(TreePath);
if (Data = nil) or Data^.UpDir then begin
FileListTipsHide;
Exit;
diff --git a/libgtk_kylix/GTKControls.pas b/libgtk_kylix/GTKControls.pas
index 35719a8..ceafe18 100644
--- a/libgtk_kylix/GTKControls.pas
+++ b/libgtk_kylix/GTKControls.pas
@@ -469,24 +469,14 @@ var TooltipsData : PGtkTooltipsData;
begin
text := nil;
Result := '';
- if Application.GTKVersion_2_12_0_Up then begin
- g_object_get(FWidget, 'tooltip-text', @text, nil);
- if text <> nil then Result := string(text);
- end else begin
- TooltipsData := gtk_tooltips_data_get(FWidget);
- if Assigned(TooltipsData) then Result := PgcharToString(TooltipsData^.tip_text);
- end;
+ g_object_get(FWidget, 'tooltip-text', @text, nil);
+ if text <> nil then Result := string(text);
end;
procedure TGTKControl.SetTooltip(Value: string);
var FParentForm : TCustomGTKForm;
begin
- if Application.GTKVersion_2_12_0_Up then
- g_object_set(FWidget, 'tooltip-text', PChar(Value), nil)
- else begin
- FParentForm := GetParentForm(Self);
- if FParentForm <> nil then gtk_tooltips_set_tip(FParentForm.Tooltips.FObject, FWidget, StringToPgchar(Value), nil);
- end;
+ g_object_set(FWidget, 'tooltip-text', PChar(Value), nil)
end;
procedure TGTKControl.SetFocus;
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index e35357f..0224825 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -178,7 +178,7 @@ type // Some basic types
FTerminated: Boolean;
FOnException: TExceptionEvent;
FMainForm: TCustomGTKForm;
- FMainFormSet, FGTK205Up, FGTK220Up, FGTK240Up, FGTK260Up, FGTK280Up, FGTK212Up: Boolean;
+ FMainFormSet: Boolean;
FThreadID: __pthread_t;
procedure Quit;
protected
@@ -205,12 +205,6 @@ type // Some basic types
property Terminated: Boolean read FTerminated;
property OnException: TExceptionEvent read FOnException write FOnException;
published
- property GTKVersion_2_0_5_Up: boolean read FGTK205Up;
- property GTKVersion_2_2_0_Up: boolean read FGTK220Up;
- property GTKVersion_2_4_0_Up: boolean read FGTK240Up;
- property GTKVersion_2_6_0_Up: boolean read FGTK260Up;
- property GTKVersion_2_8_0_Up: boolean read FGTK280Up;
- property GTKVersion_2_12_0_Up: boolean read FGTK212Up;
property ThreadID: __pthread_t read FThreadID;
end;
@@ -547,7 +541,6 @@ procedure TGTKApplication.CreateHandle;
var
I: Integer;
Temp: string;
- Ver : Pchar;
begin
Argc := ParamCount + 1;
Argv := AllocMem((Argc + 1) * SizeOf(PChar));
@@ -563,26 +556,9 @@ begin
PCharArray(Argv^)[Argc] := nil;
{$R+}
- // Check for correct version of GTK+ library
- Ver := gtk_check_version(2, 12, 0);
- FGTK212Up := Ver = nil;
- if not FGTK212Up then Ver := gtk_check_version(2, 8, 0);
- FGTK280Up := Ver = nil;
- if not FGTK280Up then Ver := gtk_check_version(2, 6, 0);
- FGTK260Up := Ver = nil;
- if not FGTK260Up then Ver := gtk_check_version(2, 4, 0);
- FGTK240Up := Ver = nil;
- if not FGTK240Up then Ver := gtk_check_version(2, 2, 0);
- FGTK220Up := Ver = nil;
- if not FGTK220Up then Ver := gtk_check_version(2, 0, 5);
- FGTK205Up := Ver = nil;
- if not FGTK220Up then WriteLn('Warning: Your version of GTK+ is old and some workarounds has been activated. It is recommended to update GTK libraries at least to 2.2.0');
- if Ver <> nil then Ver := gtk_check_version(2, 0, 0);
- if Ver <> nil then WriteLn('Warning: There might be some problems with GTK+ library or version conflict.');
-
// Init threads
my_g_thread_init(nil);
-
+
(* ATTENTION: do not call gdk_threads_init(), it causes deadlocks and we don't really need it *)
// gdk_threads_init;
diff --git a/libgtk_kylix/GTKMenus.pas b/libgtk_kylix/GTKMenus.pas
index 2534f4c..bf2c095 100644
--- a/libgtk_kylix/GTKMenus.pas
+++ b/libgtk_kylix/GTKMenus.pas
@@ -362,13 +362,8 @@ function TGTKMenuItem.GetTornOff: boolean;
var b: gboolean;
begin
b := False;
- if Application.GTKVersion_2_6_0_Up then begin
- if FItemType = itTearOff then g_object_get(FWidget, 'tearoff-state', @b, nil) else
- if Assigned(FMenu) and (Count > 0) then g_object_get(FMenu, 'tearoff-state', @b, nil);
- end else begin
- if FItemType = itTearOff then b := Boolean(torn_off(PGTKTearOffMenuItem(FWidget)^)) else
- if Assigned(FMenu) and (Count > 0) then b := Boolean(torn_off(PGTKMenu(FMenu)^));
- end;
+ if FItemType = itTearOff then g_object_get(FWidget, 'tearoff-state', @b, nil) else
+ if Assigned(FMenu) and (Count > 0) then g_object_get(FMenu, 'tearoff-state', @b, nil);
Result := b;
end;
diff --git a/libgtk_kylix/GTKView.pas b/libgtk_kylix/GTKView.pas
index db1dc93..3b46fad 100644
--- a/libgtk_kylix/GTKView.pas
+++ b/libgtk_kylix/GTKView.pas
@@ -442,24 +442,12 @@ var Path: PGtkTreePath;
Iter: TGtkTreeIter;
begin
Result := Index;
- if Application.GTKVersion_2_0_5_Up then begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
- if not Assigned(Path) then Exit;
- if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_child_path_to_path(FTreeModelSort, Path);
- if not Assigned(Path) then Exit;
- Result := gtk_tree_path_get_indices(Path)^;
- gtk_tree_path_free(Path);
- end else
- if Assigned(FToSortedConvFunc) then Result := FToSortedConvFunc(Self, Index) else begin
- gtk_tree_model_get_iter_from_string(FTreeModel, @Iter, PChar(IntToStr(Index)));
-// gtk_tree_model_sort_convert_child_iter_to_iter(FTreeModelSort, @NewIter, @Iter);
- Path := gtk_tree_model_get_path(FTreeModel, @Iter);
- if not Assigned(Path) then Exit;
- if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_child_path_to_path(FTreeModelSort, Path);
- if not Assigned(Path) then Exit;
- Result := StrToIntDef(String(gtk_tree_path_to_string(Path)), Index);
- gtk_tree_path_free(Path);
- end;
+ Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
+ if not Assigned(Path) then Exit;
+ if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_child_path_to_path(FTreeModelSort, Path);
+ if not Assigned(Path) then Exit;
+ Result := gtk_tree_path_get_indices(Path)^;
+ gtk_tree_path_free(Path);
end;
function TGTKView.ConvertFromSorted(Index: integer): integer;
@@ -467,24 +455,12 @@ var Path: PGtkTreePath;
Iter: TGtkTreeIter;
begin
Result := Index;
- if Application.GTKVersion_2_0_5_Up then begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
- if not Assigned(Path) then Exit;
- if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_path_to_child_path(FTreeModelSort, Path);
- if not Assigned(Path) then Exit;
- Result := gtk_tree_path_get_indices(Path)^;
- gtk_tree_path_free(Path);
- end else
- if Assigned(FFromSortedConvFunc) then Result := FFromSortedConvFunc(Self, Index) else begin
- gtk_tree_model_get_iter_from_string(FTreeModel, @Iter, PChar(IntToStr(Index)));
-// gtk_tree_model_sort_convert_child_iter_to_iter(FTreeModelSort, @NewIter, @Iter);
- Path := gtk_tree_model_get_path(FTreeModel, @Iter);
- if not Assigned(Path) then Exit;
- if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_path_to_child_path(FTreeModelSort, Path);
- if not Assigned(Path) then Exit;
- Result := StrToIntDef(String(gtk_tree_path_to_string(Path)), Index);
- gtk_tree_path_free(Path);
- end;
+ Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(Index)));
+ if not Assigned(Path) then Exit;
+ if Assigned(FTreeModelSort) then Path := gtk_tree_model_sort_convert_path_to_child_path(FTreeModelSort, Path);
+ if not Assigned(Path) then Exit;
+ Result := gtk_tree_path_get_indices(Path)^;
+ gtk_tree_path_free(Path);
end;
procedure CellDataFunc(tree_column : PGtkTreeViewColumn; cell : PGtkCellRenderer; tree_model : PGtkTreeModel; iter : PGtkTreeIter; data : gpointer); cdecl;
@@ -522,8 +498,7 @@ begin
Item := nil;
if Assigned(arg1) then begin
TGTKListView(user_data).ConvertPathToChild(arg1);
- if Application.GTKVersion_2_0_5_Up then AIndex := gtk_tree_path_get_indices(arg1)^
- else AIndex := StrToIntDef(String(gtk_tree_path_to_string(arg1)), 0);
+ AIndex := gtk_tree_path_get_indices(arg1)^;
Item := TGTKListView(user_data).Items[AIndex];
Item.FIndex := AIndex;
end;
@@ -562,39 +537,20 @@ begin
end;
function TGTKListView.GetSelected: TGTKListItem;
-var Iter{, NewIter}: TGtkTreeIter;
+var Iter: TGtkTreeIter;
Path: PGtkTreePath;
AIndex: integer;
i: integer;
begin
Result := nil;
Path := nil;
- if not Application.GTKVersion_2_0_5_Up then begin
- for i := 0 to Items.Count - 1 do begin
- Path := gtk_tree_path_new_from_string(PChar(IntToStr(i)));
- if gtk_tree_selection_path_is_selected(gtk_tree_view_get_selection(PGtkTreeView(FWidget)), Path) then Break else
-// WriteLn('Index ', i, ', Selected: ', gtk_tree_selection_path_is_selected(gtk_tree_view_get_selection(PGtkTreeView(FWidget)), Path));
- gtk_tree_path_free(Path);
- Path := nil;
- end;
-// WriteLn('Selected: ', String(gtk_tree_path_to_string(Path)));
- ConvertPathToChild(Path);
-(* gtk_tree_model_get_iter_from_string(gtk_tree_view_get_model(PGtkTreeView(FWidget)){FTreeModelSort}, @Iter, gtk_tree_path_to_string(Path));
- gtk_tree_model_sort_convert_child_iter_to_iter(FTreeModelSort, @NewIter, @Iter);
- Path := gtk_tree_model_get_path({FTreeModelSort}gtk_tree_view_get_model(PGtkTreeView(FWidget)), @NewIter);
- *)
-// gtk_tree_model_sort_clear_cache(FTreeModelSort);
-// Path := gtk_tree_model_sort_convert_path_to_child_path(FTreeModelSort, Path);
- end else begin
- if not gtk_tree_selection_get_selected(gtk_tree_view_get_selection(PGtkTreeView(FWidget)), nil, @Iter) then Exit;
- Path := gtk_tree_model_get_path(gtk_tree_view_get_model(PGtkTreeView(FWidget)), @iter);
- if not Assigned(Path) then Exit;
- ConvertPathToChild(Path);
- end;
+ if not gtk_tree_selection_get_selected(gtk_tree_view_get_selection(PGtkTreeView(FWidget)), nil, @Iter) then Exit;
+ Path := gtk_tree_model_get_path(gtk_tree_view_get_model(PGtkTreeView(FWidget)), @iter);
+ if not Assigned(Path) then Exit;
+ ConvertPathToChild(Path);
// WriteLn('Selected Converted: ', String(gtk_tree_path_to_string(Path)));
if Assigned(Path) then begin
- if Application.GTKVersion_2_0_5_Up then AIndex := gtk_tree_path_get_indices(Path)^
- else AIndex := StrToIntDef(String(gtk_tree_path_to_string(Path)), 0);
+ AIndex := gtk_tree_path_get_indices(Path)^;
Result := Items[AIndex];
Result.FIndex := AIndex;
gtk_tree_path_free(Path);
@@ -643,8 +599,7 @@ begin
if gtk_tree_view_get_path_at_pos(PGtkTreeView(FWidget), X, Y, Path, Column, nil, nil) then begin
if not Assigned(Path) then Exit;
ConvertPathToChild(Path);
- if Application.GTKVersion_2_0_5_Up then AIndex := gtk_tree_path_get_indices(Path)^
- else AIndex := StrToIntDef(String(gtk_tree_path_to_string(Path)), 0);
+ AIndex := gtk_tree_path_get_indices(Path)^;
Result := Items[AIndex];
Result.FIndex := AIndex;
gtk_tree_path_free(Path);
@@ -1029,8 +984,7 @@ begin
DataColumn := TGTKTreeViewColumn(data).FIndex;
Path := gtk_tree_path_new_from_string(path_string);
if not Assigned(Path) then Exit;
- if Application.GTKVersion_2_0_5_Up then AIndex := gtk_tree_path_get_indices(Path)^
- else AIndex := StrToIntDef(String(gtk_tree_path_to_string(Path)), 0);
+ AIndex := gtk_tree_path_get_indices(Path)^;
TGTKTreeViewColumn(data).FOnEdited(TGTKTreeViewColumn(data), TGTKTreeViewColumn(data), ((TGTKTreeViewColumn(data).FOwner as TGTKTreeViewColumns).FOwner as TGTKListView).Items[AIndex], NewText, AllowChange, DataColumn);
if AllowChange and (((TGTKTreeViewColumn(data).FOwner as TGTKTreeViewColumns).FOwner as TGTKListView).Items.Count < AIndex) then
((TGTKTreeViewColumn(data).FOwner as TGTKTreeViewColumns).FOwner as TGTKListView).Items[AIndex].SetValue(DataColumn, NewText);
@@ -1045,8 +999,7 @@ begin
if Assigned(data) and Assigned(TGTKTreeViewColumn(data).FOnToggled) then begin
Path := gtk_tree_path_new_from_string(path_string);
if not Assigned(Path) then Exit;
- if Application.GTKVersion_2_0_5_Up then AIndex := gtk_tree_path_get_indices(Path)^
- else AIndex := StrToIntDef(String(gtk_tree_path_to_string(Path)), 0);
+ AIndex := gtk_tree_path_get_indices(Path)^;
TGTKTreeViewColumn(data).FOnToggled(TGTKTreeViewColumn(data), TGTKTreeViewColumn(data), ((TGTKTreeViewColumn(data).FOwner as TGTKTreeViewColumns).FOwner as TGTKListView).Items[AIndex]);
end;
end;
@@ -1267,12 +1220,6 @@ var Iter, NewIter: TGtkTreeIter;
Path: PGtkTreePath;
begin
try
- if not Application.GTKVersion_2_0_5_Up then begin
- Path := gtk_tree_path_new_from_string(StringToPgchar(IntToStr(FIndex)));
- ((FOwner as TGTKListItems).FOwner as TGTKView).ConvertChildToPath(Path);
- gtk_tree_selection_select_path(((FOwner as TGTKListItems).FOwner as TGTKView).FSelection, Path);
- gtk_tree_path_free(Path);
- end else
if gtk_tree_model_get_iter_from_string(PGtkTreeModel((FOwner as TGTKListItems).FStore), @Iter, StringToPgchar(IntToStr(FIndex))) then begin
if Assigned(((FOwner as TGTKListItems).FOwner as TGTKView).FTreeModelSort) then begin
gtk_tree_model_sort_convert_child_iter_to_iter(((FOwner as TGTKListItems).FOwner as TGTKView).FTreeModelSort, @NewIter, @Iter);
@@ -1298,8 +1245,7 @@ begin
Column := ((FOwner as TGTKListItems).FOwner as TGTKView).Columns[FocusColumnNo].FColumn;
// Renderer := ((FOwner as TGTKListItems).FOwner as TGTKView).Columns[FocusColumnNo].FRenderer;
-// if not Application.GTKVersion_2_0_5_Up then
- for i := 1 to 2 do gtk_main_iteration_do(False); // This ugly piece of code HAVE TO BE HERE due some focus-related problems in GtkTreeView
+ for i := 1 to 2 do gtk_main_iteration_do(False); // This ugly piece of code HAVE TO BE HERE due some focus-related problems in GtkTreeView
gtk_tree_view_set_cursor(PGtkTreeView(((FOwner as TGTKListItems).FOwner as TGTKView).FWidget), Path, Column, StartEditing);
// gtk_tree_view_set_cursor(PGtkTreeView(((FOwner as TGTKListItems).FOwner as TGTKView).FWidget), Path, Column, StartEditing);
// gtk_tree_view_set_cursor_on_cell(PGtkTreeView(((FOwner as TGTKListItems).FOwner as TGTKView).FWidget), Path, Column, Renderer, StartEditing);