fixed gtk file dialog with empty filter from Collin

git-svn-id: trunk@6863 -
This commit is contained in:
mattias 2005-02-28 18:21:43 +00:00
parent a9f6d6087a
commit 28d0c4a485
3 changed files with 26 additions and 10 deletions

View File

@ -219,8 +219,8 @@ type
procedure InitializeFontDialog(FontDialog: TFontDialog; procedure InitializeFontDialog(FontDialog: TFontDialog;
var SelWidget: PGtkWidget; Title: PChar); var SelWidget: PGtkWidget; Title: PChar);
procedure InitializeCommonDialog(ADialog: TObject; AWindow: PGtkWidget); procedure InitializeCommonDialog(ADialog: TObject; AWindow: PGtkWidget);
procedure CreateOpenDialogFilter(OpenDialog: TOpenDialog; function CreateOpenDialogFilter(OpenDialog: TOpenDialog;
SelWidget: PGtkWidget); SelWidget: PGtkWidget): string;
procedure CreatePreviewDialogControl(PreviewDialog: TPreviewFileDialog; procedure CreatePreviewDialogControl(PreviewDialog: TPreviewFileDialog;
SelWidget: PGtkWidget); SelWidget: PGtkWidget);
procedure InitializeOpenDialog(OpenDialog: TOpenDialog; procedure InitializeOpenDialog(OpenDialog: TOpenDialog;
@ -442,6 +442,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.222 2005/02/28 18:21:43 mattias
fixed gtk file dialog with empty filter from Collin
Revision 1.221 2005/02/05 09:09:52 mattias Revision 1.221 2005/02/05 09:09:52 mattias
implemented TListView for gtk2 From Andrew Haines implemented TListView for gtk2 From Andrew Haines

View File

@ -4154,10 +4154,11 @@ end;
Params: OpenDialog: TOpenDialog; SelWidget: PGtkWidget Params: OpenDialog: TOpenDialog; SelWidget: PGtkWidget
Returns: - Returns: -
Adds a Filter pulldown to a gtk file selection dialog. Adds a Filter pulldown to a gtk file selection dialog. Returns the
inital filter mask.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TGtkWidgetSet.CreateOpenDialogFilter(OpenDialog: TOpenDialog; function TGtkWidgetSet.CreateOpenDialogFilter(OpenDialog: TOpenDialog;
SelWidget: PGtkWidget); SelWidget: PGtkWidget): string;
var var
FilterList: TList; FilterList: TList;
HBox, LabelWidget, FilterPullDownWidget, HBox, LabelWidget, FilterPullDownWidget,
@ -4215,6 +4216,7 @@ begin
gtk_object_set_data(PGtkObject(SelWidget), 'LCLFilterList', FilterList); gtk_object_set_data(PGtkObject(SelWidget), 'LCLFilterList', FilterList);
// set the initial filter // set the initial filter
Result := 'none'; { Don't use '' as null return as this is used for *.* }
if FilterList.Count>0 then begin if FilterList.Count>0 then begin
i:=0; i:=0;
CurMask:=0; CurMask:=0;
@ -4226,8 +4228,7 @@ begin
end; end;
inc(i); inc(i);
end; end;
PopulateFileAndDirectoryLists(GTK_FILE_SELECTION(SelWidget), Result := PFileSelFilterEntry(FilterList[CurMask])^.Mask;
PFileSelFilterEntry(FilterList[CurMask])^.Mask);
end; end;
end; end;
@ -4291,6 +4292,7 @@ procedure TGtkWidgetSet.InitializeOpenDialog(OpenDialog: TOpenDialog;
var var
FileDetailLabel, HBox, FrameWidget: PGtkWidget; FileDetailLabel, HBox, FrameWidget: PGtkWidget;
FileSelWidget: PGtkFileSelection; FileSelWidget: PGtkFileSelection;
InitialFilter: string;
begin begin
FileSelWidget:=GTK_FILE_SELECTION(SelWidget); FileSelWidget:=GTK_FILE_SELECTION(SelWidget);
@ -4336,7 +4338,7 @@ begin
CreateOpenDialogHistory(OpenDialog,SelWidget); CreateOpenDialogHistory(OpenDialog,SelWidget);
// Filter - a frame with an option menu // Filter - a frame with an option menu
CreateOpenDialogFilter(OpenDialog,SelWidget); InitialFilter := CreateOpenDialogFilter(OpenDialog,SelWidget);
// Details - a frame with a label // Details - a frame with a label
if (ofViewDetail in OpenDialog.Options) then begin if (ofViewDetail in OpenDialog.Options) then begin
@ -4364,6 +4366,9 @@ begin
// set initial filename // set initial filename
if OpenDialog.Filename<>'' then if OpenDialog.Filename<>'' then
gtk_file_selection_set_filename(FileSelWidget,PChar(OpenDialog.Filename)); gtk_file_selection_set_filename(FileSelWidget,PChar(OpenDialog.Filename));
if InitialFilter <> 'none' then
PopulateFileAndDirectoryLists(FileSelWidget, InitialFilter);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -6992,6 +6997,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.633 2005/02/28 18:21:43 mattias
fixed gtk file dialog with empty filter from Collin
Revision 1.632 2005/02/26 18:39:56 mattias Revision 1.632 2005/02/26 18:39:56 mattias
fixed gtk open dialog go up fixed gtk open dialog go up

View File

@ -3208,8 +3208,10 @@ begin
Add(Dirs, AppendPathDelim(Info.Name)); Add(Dirs, AppendPathDelim(Info.Name));
until FindNext(Info) <> 0; until FindNext(Info) <> 0;
FindClose(Info); FindClose(Info);
// add all files // add required files
if FindFirst(AppendPathDelim(Dir)+Mask, faAnyFile, Info) = 0 then Dir := AppendPathDelim(Dir)+Mask;
if Mask = '' then Dir := Dir + GetAllFilesMask;
if FindFirst(Dir, faAnyFile, Info) = 0 then
repeat repeat
if (Info.Attr and faDirectory) <> faDirectory then if (Info.Attr and faDirectory) <> faDirectory then
Add(Files, Info.Name); Add(Files, Info.Name);
@ -8081,6 +8083,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.345 2005/02/28 18:21:43 mattias
fixed gtk file dialog with empty filter from Collin
Revision 1.344 2005/02/26 18:39:56 mattias Revision 1.344 2005/02/26 18:39:56 mattias
fixed gtk open dialog go up fixed gtk open dialog go up