diff options
Diffstat (limited to 'UFileTypeSettings.pas')
| -rw-r--r-- | UFileTypeSettings.pas | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/UFileTypeSettings.pas b/UFileTypeSettings.pas index 55ce5c5..d6d7eca 100644 --- a/UFileTypeSettings.pas +++ b/UFileTypeSettings.pas @@ -22,9 +22,8 @@ unit UFileTypeSettings; interface uses - gtk2, SysUtils, Types, Classes, Variants, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKView, GTKUtils, GTKDialogs, - GTKPixbuf, GTKClasses, - UCoreClasses, UGnome; + gtk2, SysUtils, Classes, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKView, GTKUtils, GTKDialogs, + GTKPixbuf, GTKClasses, UGnome; type TFFileTypeSettings = class(TGTKDialog) @@ -131,7 +130,7 @@ begin Column.AddAttribute('text', 0); Column.SortID := 0; Column.Resizable := True; - g_object_set(G_OBJECT(Column.FColumn), 'sizing', 2, 'fixed-width', 150, nil); + g_object_set(G_OBJECT(Column.FColumn), 'sizing', [2, 'fixed-width', 150, nil]); { Column.FixedWidth := 300; Column.SizingMode := smFixed; } Column.SetProperty('ellipsize', 3); @@ -297,10 +296,10 @@ begin ColorLabel.UseUnderline := True; ColorButton := TGnomeColorButton.Create(Self); ColorButton.SetSizeRequest(40, -1); - ColorButton.OnColorChanged := ColorButtonColorChanged; + ColorButton.OnColorChanged := @ColorButtonColorChanged; ColorLabel.FocusControl := ColorButton; DefaultColorCheckBox := TGTKCheckButton.CreateWithLabel(Self, LANGDefaultColor); - DefaultColorCheckBox.OnToggled := DefaultColorCheckBoxToggled; + DefaultColorCheckBox.OnToggled := @DefaultColorCheckBoxToggled; ColorHBox.AddControlEx(ColorLabel, False, False, 4); ColorHBox.AddControlEx(ColorButton, False, False, 5); ColorHBox.AddControlEx(DefaultColorCheckBox, False, False, 5); @@ -310,11 +309,11 @@ begin IconLabel.Caption := LANGIcon; IconLabel.UseUnderline := True; IconEntry := TGTKEntry.Create(Self); - IconEntry.OnChanged := IconEntryChanged; + IconEntry.OnChanged := @IconEntryChanged; IconLabel.FocusControl := IconEntry; BrowseIconButton := TGTKButton.Create(Self); BrowseIconButton.Caption := LANGBrowseButton_Caption; - BrowseIconButton.OnClick := BrowseIconButtonClick; + BrowseIconButton.OnClick := @BrowseIconButtonClick; Icon := TGTKImage.Create(Self); Icon.SetSizeRequest(24, 24); IconFrame := TGTKFrame.CreateWithoutLabel(Self); @@ -323,7 +322,7 @@ begin if FUseGnomeIconEntry then begin GnomeIconButton := TGnomeIconEntry.Create(Self); GnomeIconButton.Filename := ''; - GnomeIconButton.OnIconChanged := GnomeIconButtonIconChanged; + GnomeIconButton.OnIconChanged := @GnomeIconButtonIconChanged; end; Table2 := TGTKTable.Create(Self); @@ -347,28 +346,28 @@ begin Notebook.AppendPage(FNameExtVBox3, LANGNotebookPageExtensions); Notebook.AppendPage(ActionsVBox, LANGNotebookPageActions); - OnKeyDown := FormKeyDown; - OnDestroy := FormDestroy; - AddFiletypeButton.OnClick := AddFiletypeButtonClick; - RemoveFiletypeButton.OnClick := RemoveFiletypeButtonClick; - ListView.OnSelectionChanged := ListViewSelectionChanged; - AddExtButton.OnClick := AddExtButtonClick; - RemoveExtButton.OnClick := RemoveExtButtonClick; - FNameExtEntry.OnKeyDown := FNameExtEntryKeyDown; - FNameExtListView.OnSelectionChanged := FNameExtListViewSelectionChanged; - AssocDescriptionEntry.OnChanged := AssocDescriptionEntryChanged; - ActionsListView.OnSelectionChanged := ActionsListViewSelectionChanged; - AddActionButton.OnClick := AddActionButtonClick; - RemoveActionButton.OnClick := RemoveActionButtonClick; - DescriptionEntry.OnChanged := DescriptionEntryChanged; - CommandEntry.OnChanged := CommandEntryChanged; - RunInTerminalCheckBox.OnToggled := RunInTerminalCheckBoxToggled; - AutodetectCheckBox.OnToggled := AutodetectCheckBoxToggled; - SetDefaultActionButton.OnClick := SetDefaultActionButtonClick; - BrowseButton.OnClick := BrowseButtonClick; - - ListView.CellDataFunc := ListViewCellDataFunc; - ActionsListView.CellDataFunc := ActionsListViewCellDataFunc; + OnKeyDown := @FormKeyDown; + OnDestroy := @FormDestroy; + AddFiletypeButton.OnClick := @AddFiletypeButtonClick; + RemoveFiletypeButton.OnClick := @RemoveFiletypeButtonClick; + ListView.OnSelectionChanged := @ListViewSelectionChanged; + AddExtButton.OnClick := @AddExtButtonClick; + RemoveExtButton.OnClick := @RemoveExtButtonClick; + FNameExtEntry.OnKeyDown := @FNameExtEntryKeyDown; + FNameExtListView.OnSelectionChanged := @FNameExtListViewSelectionChanged; + AssocDescriptionEntry.OnChanged := @AssocDescriptionEntryChanged; + ActionsListView.OnSelectionChanged := @ActionsListViewSelectionChanged; + AddActionButton.OnClick := @AddActionButtonClick; + RemoveActionButton.OnClick := @RemoveActionButtonClick; + DescriptionEntry.OnChanged := @DescriptionEntryChanged; + CommandEntry.OnChanged := @CommandEntryChanged; + RunInTerminalCheckBox.OnToggled := @RunInTerminalCheckBoxToggled; + AutodetectCheckBox.OnToggled := @AutodetectCheckBoxToggled; + SetDefaultActionButton.OnClick := @SetDefaultActionButtonClick; + BrowseButton.OnClick := @BrowseButtonClick; + + ListView.CellDataFunc := @ListViewCellDataFunc; + ActionsListView.CellDataFunc := @ActionsListViewCellDataFunc; ListViewSelectionChanged(Self); ListView.SetFocus; end; @@ -510,7 +509,7 @@ procedure TFFileTypeSettings.RemoveFiletypeButtonClick(Sender: TObject); var Item: TFileAssoc; begin if Assigned(ListView.Selected) and Assigned(ListView.Selected.AsPointer(2)) then begin - Item := ListView.Selected.AsPointer(2); + Item := TFileAssoc(ListView.Selected.AsPointer(2)); Item.Free; IntAssocList.Remove(Item); ListView.Items.Delete(ListView.Selected.Index); @@ -552,7 +551,7 @@ begin DefaultColorCheckBox.Checked := True; Exit; end; - Item := ListView.Selected.AsPointer(2); + Item := TFileAssoc(ListView.Selected.AsPointer(2)); FNameExtListView.Items.Clear; if Length(Item.Extensions) > 0 then for i := 0 to Length(Item.Extensions) - 1 do @@ -666,7 +665,7 @@ begin CommandEntry.Text := ''; Exit; end; - Action := ActionsListView.Selected.AsPointer(2); + Action := TAssocAction(ActionsListView.Selected.AsPointer(2)); DescriptionEntry.Text := Action.ActionName; CommandEntry.Text := Action.ActionCommand; RunInTerminalCheckBox.Checked := Action.RunInTerminal; @@ -695,9 +694,9 @@ begin try if (ActionsListView.Items.Count = 0) or (not Assigned(ActionsListView.Selected)) or (not Assigned(ListView.Selected)) or (not Assigned(ListView.Selected.AsPointer(2))) then Exit; - Item := ListView.Selected.AsPointer(2); - Action := ActionsListView.Selected.AsPointer(2); - if (Item.DefaultAction > Item.ActionList.Count - 1) or (Item.ActionList[Item.DefaultAction] = Action) + Item := TFileAssoc(ListView.Selected.AsPointer(2)); + Action := TAssocAction(ActionsListView.Selected.AsPointer(2)); + if (Item.DefaultAction > Item.ActionList.Count - 1) or (TAssocAction(Item.ActionList[Item.DefaultAction]) = Action) then Item.DefaultAction := 0; if Item.DefaultAction > ActionsListView.Selected.Index then Dec(Item.DefaultAction); Action.Free; @@ -714,7 +713,7 @@ begin Assigned(ActionsListView.Selected) and Assigned(ActionsListView.Selected.AsPointer(2)) then begin TAssocAction(ActionsListView.Selected.AsPointer(2)).ActionName := DescriptionEntry.Text; - Item := ListView.Selected.AsPointer(2); + Item := TFileAssoc(ListView.Selected.AsPointer(2)); if (Item.ActionList.Count - 1 >= Item.DefaultAction) and (ActionsListView.Selected.AsPointer(2) = Item.ActionList[Item.DefaultAction]) then ActionsListView.Selected.SetValue(0, DescriptionEntry.Text + LANGDefault) else ActionsListView.Selected.SetValue(0, DescriptionEntry.Text); @@ -852,10 +851,10 @@ begin if Assigned(Data) and (Data is TFileAssoc) and ((Data.FileTypeName = ConstFTAMetaDirectory) or (Data.FileTypeName = ConstFTAMetaFile)) then case ColumnID of - 0: g_object_set(cell, 'markup', g_strconcat('<span weight="bold" underline="single">', s, '</span>', nil), nil); - 1: g_object_set(cell, 'markup', g_strconcat('<span style="italic">', s, '</span>', nil), nil); + 0: g_object_set(cell, 'markup', [g_strconcat('<span weight="bold" underline="single">', s, '</span>', nil), nil]); + 1: g_object_set(cell, 'markup', [g_strconcat('<span style="italic">', s, '</span>', nil), nil]); end - else g_object_set(cell, 'markup', s, nil); + else g_object_set(cell, 'markup', [s, nil]); end; @@ -870,15 +869,15 @@ begin ImageCol := False; if ColumnID = 0 then ImageCol := GTK_IS_CELL_RENDERER_PIXBUF(cell); if ImageCol then Exit; - Item := ListView.Selected.AsPointer(2); + Item := TFileAssoc(ListView.Selected.AsPointer(2)); if Item = nil then Exit; Data := nil; gtk_tree_model_get(tree_model, iter, 2, @Data, -1); gtk_tree_model_get(tree_model, iter, ColumnID, @s, -1); if Assigned(Data) and (Data is TAssocAction) and (Item.ActionList.IndexOf(Data) = Item.DefaultAction) - then g_object_set(cell, 'markup', g_strconcat('<span weight="bold">', s, '</span>', nil), nil) - else g_object_set(cell, 'markup', s, nil); + then g_object_set(cell, 'markup', [g_strconcat('<span weight="bold">', s, '</span>', nil), nil]) + else g_object_set(cell, 'markup', [s, nil]); end; (********************************************************************************************************************************) |
