Adding new files

78 views
Skip to first unread message

Igor Korot

unread,
Mar 14, 2023, 10:11:58 AM3/14/23
to wx-dev
Hi,
An instruction on
https://github.com/wxWidgets/wxWidgets/blob/master/docs/contributing/how-to-add-files-to-build-system.md
says what to do when adding the new file to either base or the GUI.

However there BASE_AND_GUI_WIN32/OSX sections in the files.bkl
(but nothing for GTK) and those instructions do not cover the case
when one will need to add the file into both base and GUI.

Can this be explained?

Also - it would be nice if there is an instruction on creating a new
variable (for base and GUI on GTK, for example).

Thank you.

Vadim Zeitlin

unread,
Mar 15, 2023, 2:07:16 PM3/15/23
to wx-...@googlegroups.com
On Tue, 14 Mar 2023 09:15:11 -0500 Igor Korot wrote:

IK> Hi,
IK> An instruction on
IK> https://github.com/wxWidgets/wxWidgets/blob/master/docs/contributing/how-to-add-files-to-build-system.md
IK> says what to do when adding the new file to either base or the GUI.
IK>
IK> However there BASE_AND_GUI_WIN32/OSX sections in the files.bkl
IK> (but nothing for GTK) and those instructions do not cover the case
IK> when one will need to add the file into both base and GUI.
IK>
IK> Can this be explained?
IK>
IK> Also - it would be nice if there is an instruction on creating a new
IK> variable (for base and GUI on GTK, for example).

There can be no variable containing common base and GTK files because base
under Unix is toolkit-independent.

Regards,
VZ

Igor Korot

unread,
Mar 16, 2023, 12:39:12 AM3/16/23
to wx-...@googlegroups.com
Vadiim,
Not sure I understand.
I added my new file to GTK_LOWLEVEL_SRC and GTK_SRC
re-run bakefile_gen and while wxBase compiled fine, core failed,
because the file is linked twice.

What would be the correct place?

Thank you.

>
> Regards,
> VZ

Igor Korot

unread,
Mar 16, 2023, 12:47:17 AM3/16/23
to wx-...@googlegroups.com
My understanding is that GTK_LOWLEVEL_SRC is for
the base and GTK_SRC is for the core.
But it looks like I'm wrong since GTK_LOWLEVEL_SRC is for both.

And so my file is referenced twice.

Vadim Zeitlin

unread,
Mar 16, 2023, 11:10:50 AM3/16/23
to wx-...@googlegroups.com
On Wed, 15 Mar 2023 23:46:56 -0500 Igor Korot wrote:

IK> My understanding is that GTK_LOWLEVEL_SRC is for
IK> the base and GTK_SRC is for the core.
IK> But it looks like I'm wrong since GTK_LOWLEVEL_SRC is for both.
IK>
IK> And so my file is referenced twice.

GTK_LOWLEVEL_SRC is for wxGTK files included in wxUniv/GTK build, GTK_SRC
is for the rest of wxGTK files. So you need to include your new
GTK-specific file (assuming it really is GTK-specific) in exactly one of
them, most likely GTK_SRC.

Regards,
VZ

Igor Korot

unread,
Mar 16, 2023, 5:23:11 PM3/16/23
to wx-...@googlegroups.com
Vadim,
I presume it will be used for both wxBase and wxCore, right?

Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
Mar 16, 2023, 6:24:18 PM3/16/23
to wx-...@googlegroups.com
On Thu, 16 Mar 2023 16:22:58 -0500 Igor Korot wrote:

IK> Vadim,
IK>
IK> On Thu, Mar 16, 2023 at 10:10 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> >
IK> > On Wed, 15 Mar 2023 23:46:56 -0500 Igor Korot wrote:
IK> >
IK> > IK> My understanding is that GTK_LOWLEVEL_SRC is for
IK> > IK> the base and GTK_SRC is for the core.
IK> > IK> But it looks like I'm wrong since GTK_LOWLEVEL_SRC is for both.
IK> > IK>
IK> > IK> And so my file is referenced twice.
IK> >
IK> > GTK_LOWLEVEL_SRC is for wxGTK files included in wxUniv/GTK build, GTK_SRC
IK> > is for the rest of wxGTK files. So you need to include your new
IK> > GTK-specific file (assuming it really is GTK-specific) in exactly one of
IK> > them, most likely GTK_SRC.
IK>
IK> I presume it will be used for both wxBase and wxCore, right?

Files in GTK_SRC are only used for wxGTK. Files in BASE_SRC are used for
wxBase. You shouldn't use the same file for both.

Regards,
VZ

Igor Korot

unread,
Mar 16, 2023, 6:51:56 PM3/16/23
to wx-dev
Vadim,

I'd gladly use BASE_AND_GUI_GTK_SRC, but as you said I shouldn't.
The volume.cpp is placed in the MSW/OSX for both of them.

So, I can't create BASE_AND_GUI_GTK_SRC and I can't use GTK_SRC and BASE_SRC.

So how do I make it work?

The MSW source is split with #ifdef and I presume, so is OSX one.

Thank you.


 Regards,
VZ

Vadim Zeitlin

unread,
Mar 16, 2023, 7:06:12 PM3/16/23
to wx-...@googlegroups.com
On Thu, 16 Mar 2023 17:51:43 -0500 Igor Korot wrote:

IK> I'd gladly use BASE_AND_GUI_GTK_SRC, but as you said I shouldn't.
IK> The volume.cpp is placed in the MSW/OSX for both of them.
IK>
IK> So, I can't create BASE_AND_GUI_GTK_SRC and I can't use GTK_SRC and
IK> BASE_SRC.
IK>
IK> So how do I make it work?

You really need to define what "it" is, exactly. I have no idea what do
you want to do. I can try to guess it and provide you with solutions for
all cases, but it would be really simpler if you could tell upfront what is
your goal.

IK> The MSW source is split with #ifdef and I presume, so is OSX one.

This is a bad approach which it would be best to avoid it.

Regards,
VZ

Igor Korot

unread,
Mar 16, 2023, 7:24:28 PM3/16/23
to wx-dev
Vadim,


On Thu, Mar 16, 2023, 6:06 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Thu, 16 Mar 2023 17:51:43 -0500 Igor Korot wrote:

IK> I'd gladly use BASE_AND_GUI_GTK_SRC, but as you said I shouldn't.
IK> The volume.cpp is placed in the MSW/OSX for both of them.
IK>
IK> So, I can't create BASE_AND_GUI_GTK_SRC and I can't use GTK_SRC and
IK> BASE_SRC.
IK>
IK> So how do I make it work?

 You really need to define what "it" is, exactly. I have no idea what do
you want to do. I can try to guess it and provide you with solutions for
all cases, but it would be really simpler if you could tell upfront what is
your goal.

I'm trying to submit a PR for wxSFVolume class to be included for *nix/GTK.

It is GIO based with some GTK functions.



IK> The MSW source is split with #ifdef and I presume, so is OSX one.

 This is a bad approach which it would be best to avoid it.

Ok.

Thank you.


 Regards,
VZ

Vadim Zeitlin

unread,
Mar 17, 2023, 10:02:19 AM3/17/23
to wx-...@googlegroups.com
On Thu, 16 Mar 2023 18:24:16 -0500 Igor Korot wrote:

IK> I'm trying to submit a PR for wxSFVolume class to be included for *nix/GTK.
IK>
IK> It is GIO based with some GTK functions.

wxFSVolume is a complicated case. Normally you'd use 2 files, one with
GTK-independent implementation of wxFSVolumeBase and another one using GTK
of wxFSVolume itself, but the trouble is that you probably need to
implement wxFSVolumeBase::GetVolumes() function using GIO functions in the
GUI application.

I.e. this function needs to behave differently in console and GUI
applications. We do have a way to do this, but it requires adding a new
virtual function to wxAppTraits in wx/unix/apptbase.h and implementing it
differently in the two cases.

I.e. the bake/makefiles are really the least of your problems. You need to
make the code actually work correctly first and I strongly suspect it
doesn't do it right now, unless you've found some ingenious way to do it
that I don't know about.

Regards,
VZ

Igor Korot

unread,
Mar 17, 2023, 10:13:54 AM3/17/23
to wx-dev
Hi, Vadim,


On Fri, Mar 17, 2023, 9:02 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Thu, 16 Mar 2023 18:24:16 -0500 Igor Korot wrote:

IK> I'm trying to submit a PR for wxSFVolume class to be included for *nix/GTK.
IK>
IK> It is GIO based with some GTK functions.

 wxFSVolume is a complicated case. Normally you'd use 2 files, one with
GTK-independent implementation of wxFSVolumeBase and another one using GTK
of wxFSVolume itself, but the trouble is that you probably need to
implement wxFSVolumeBase::GetVolumes() function using GIO functions in the
GUI application.

 I.e. this function needs to behave differently in console and GUI
applications.

Why?
What should be different for GetVolumes() in this case?

It should behave exactly the same - it will grab the volumes and push their names in the vector to return.

I don't know much about GTK/GIO, but I'm now curious.

Is MSW/OSX behaves differently?


We do have a way to do this, but it requires adding a new
virtual function to wxAppTraits in wx/unix/apptbase.h and implementing it
differently in the two cases.

 I.e. the bake/makefiles are really the least of your problems. You need to
make the code actually work correctly first and I strongly suspect it
doesn't do it right now, unless you've found some ingenious way to do it
that I don't know about.

So you suggest to try the code first in my application?
I'd like to try it in wx itself and see for myself. That's why u wanted to build the library with that class.


Thank you.


 Regards,
VZ

Vadim Zeitlin

unread,
Mar 17, 2023, 10:19:07 AM3/17/23
to wx-...@googlegroups.com
On Fri, 17 Mar 2023 09:13:41 -0500 Igor Korot wrote:

IK> What should be different for GetVolumes() in this case?

It can't use GTK in base application, so it has to be different.

IK> It should behave exactly the same - it will grab the volumes and push their
IK> names in the vector to return.

How will it do it in base?

IK> So you suggest to try the code first in my application?

All I say is that the problem is not with file organization at all, but
with code design.

Regards,
VZ

Igor Korot

unread,
Mar 17, 2023, 11:35:15 AM3/17/23
to wx-dev
Vadim,



On Fri, Mar 17, 2023, 9:19 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Fri, 17 Mar 2023 09:13:41 -0500 Igor Korot wrote:

IK> What should be different for GetVolumes() in this case?

 It can't use GTK in base application, so it has to be different.

Why should it.
My code compiled wxBase fine.


IK> It should behave exactly the same - it will grab the volumes and push their
IK> names in the vector to return.

 How will it do it in base?

It's a Gio call to get them and then it uses strcmp to filter stuff based on the options passed.
What's wrong with this approach?
It's still perfectly legal in C++ to use C API...


IK> So you suggest to try the code first in my application?

 All I say is that the problem is not with file organization at all, but
with code design.

I understand what you say and I agree.
But all I need is properly modify the bakefile to make the build succeed. 

Thank you.


 Regards,
VZ

Vadim Zeitlin

unread,
Mar 17, 2023, 12:44:41 PM3/17/23
to wx-...@googlegroups.com
On Fri, 17 Mar 2023 10:35:02 -0500 Igor Korot wrote:

IK> On Fri, Mar 17, 2023, 9:19 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK>
IK> > On Fri, 17 Mar 2023 09:13:41 -0500 Igor Korot wrote:
IK> >
IK> > IK> What should be different for GetVolumes() in this case?
IK> >
IK> > It can't use GTK in base application, so it has to be different.
IK>
IK> Why should it.
IK> My code compiled wxBase fine.

wxBase definitely can't depend on GTK libraries and ideally shouldn't
depend on glib nor GIO neither. In practice, it can already depend on them
indirectly if it uses libsecret, but it's still not the same as adding hard
dependencies on them and I'm not sure at all that we want to do it,
especially because nobody is almost certainly going to use wxFSVolume in
console applications under Unix, where it's pretty useless.

IK> It's a Gio call to get them and then it uses strcmp to filter stuff based
IK> on the options passed.
IK> What's wrong with this approach?
IK> It's still perfectly legal in C++ to use C API...

This has nothing to do with C++, it's just about adding a dependency on
libgio to wxBase.

IK> But all I need is properly modify the bakefile to make the build succeed.

No, this is not all that needs to be done. You need to avoid depending on
libgio in non-wxGTK code. As I said, the only way to do it that I know of
is to virtualize the function using it via wxAppTraits.

Regards,
VZ

Igor Korot

unread,
Mar 17, 2023, 1:09:45 PM3/17/23
to wx-...@googlegroups.com
Vaedim,

On Fri, Mar 17, 2023 at 11:44 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
>
> On Fri, 17 Mar 2023 10:35:02 -0500 Igor Korot wrote:
>
> IK> On Fri, Mar 17, 2023, 9:19 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
> IK>
> IK> > On Fri, 17 Mar 2023 09:13:41 -0500 Igor Korot wrote:
> IK> >
> IK> > IK> What should be different for GetVolumes() in this case?
> IK> >
> IK> > It can't use GTK in base application, so it has to be different.
> IK>
> IK> Why should it.
> IK> My code compiled wxBase fine.
>
> wxBase definitely can't depend on GTK libraries and ideally shouldn't
> depend on glib nor GIO neither. In practice, it can already depend on them
> indirectly if it uses libsecret, but it's still not the same as adding hard
> dependencies on them and I'm not sure at all that we want to do it,
> especially because nobody is almost certainly going to use wxFSVolume in
> console applications under Unix, where it's pretty useless.

Understood.

>
> IK> It's a Gio call to get them and then it uses strcmp to filter stuff based
> IK> on the options passed.
> IK> What's wrong with this approach?
> IK> It's still perfectly legal in C++ to use C API...
>
> This has nothing to do with C++, it's just about adding a dependency on
> libgio to wxBase.

You asked about the way to implement it and I answered.

>
> IK> But all I need is properly modify the bakefile to make the build succeed.
>
> No, this is not all that needs to be done. You need to avoid depending on
> libgio in non-wxGTK code. As I said, the only way to do it that I know of
> is to virtualize the function using it via wxAppTraits.

Then maybe all that needs to be done is make a wxBase strub for wxFSVolume
and put its implementation in core only?
Granted - it will be ugly, but if it's easier...

Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
Mar 17, 2023, 7:09:41 PM3/17/23
to wx-...@googlegroups.com
On Fri, 17 Mar 2023 12:09:31 -0500 Igor Korot wrote:

IK> Then maybe all that needs to be done is make a wxBase strub for wxFSVolume
IK> and put its implementation in core only?
IK> Granted - it will be ugly, but if it's easier...

It can't be done with the current API, as the function for enumerating the
volumes is in wxFSVolumeBase, which is in wxBase, while you need to use GIO
functions in it, which can only be used from wxGTK.

Which is why I keep saying that you need to add wxAppTraits function which
will allow to use different implementations in wxBase and wxGTK. It's fine
if wxBase implementation is just a stub, e.g. returns only "/", of course.

Regards,
VZ

Igor Korot

unread,
Mar 17, 2023, 9:23:01 PM3/17/23
to wx-...@googlegroups.com
Vadim,
Understood.
And then the volume.cpp file will be added to core only (i.e. GTK_SRC), right?

I will try to make it like this.
Sorry for keeping you explaining it multiple times.

Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
Mar 18, 2023, 12:45:01 PM3/18/23
to wx-...@googlegroups.com
On Fri, 17 Mar 2023 20:22:48 -0500 Igor Korot wrote:

IK> Vadim,
IK>
IK> On Fri, Mar 17, 2023 at 6:09 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
[...]
IK> > Which is why I keep saying that you need to add wxAppTraits function which
IK> > will allow to use different implementations in wxBase and wxGTK. It's fine
IK> > if wxBase implementation is just a stub, e.g. returns only "/", of course.
IK>
IK> Understood.
IK> And then the volume.cpp file will be added to core only (i.e. GTK_SRC),
IK> right?

No, you're still going to need the file with the non-GTK implementation,
even if it's trivial, so you'll still need 2 files: one src/unix and in
BASE_UNIX_SRC and the other one in src/gtk and in GTK_SRC.

Regards,
VZ

Igor Korot

unread,
Mar 18, 2023, 1:20:08 PM3/18/23
to wx-...@googlegroups.com
Vadim,
So, IIUC, I will add an empty implementation in wxAppTraits and actual
implementation
in volume.cpp, right?
And then add volume.cpp in GTK_SRC.

Now, if I understand it, the GeVolumes() test is running on the
bwxBase for MSW and GTK.

BTW, is there a reason why MSW and OSX have this function in wxBase?


Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
Mar 18, 2023, 7:57:24 PM3/18/23
to wx-...@googlegroups.com
On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:

IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
IK> implementation in volume.cpp, right?

You will need to use an intermediate class to virtualize this, something
like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.

IK> BTW, is there a reason why MSW and OSX have this function in wxBase?

Because it works fine for the console applications there.

Regards,
VZ

Igor Korot

unread,
Mar 18, 2023, 11:23:19 PM3/18/23
to wx-...@googlegroups.com
Vadim,

On Sat, Mar 18, 2023 at 6:57 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
>
> On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:
>
> IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
> IK> implementation in volume.cpp, right?
>
> You will need to use an intermediate class to virtualize this, something
> like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
> returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
> from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.

OK.

>
> IK> BTW, is there a reason why MSW and OSX have this function in wxBase?
>
> Because it works fine for the console applications there.

It may be so, but then why did you say it doesn't make sense to use it
from console
applications in *nix/GTK world?

Thank you.

>
> Regards,
> VZ

Igor Korot

unread,
Mar 19, 2023, 9:49:28 PM3/19/23
to wx-...@googlegroups.com
Vadim,

On Sat, Mar 18, 2023 at 10:23 PM Igor Korot <ikor...@gmail.com> wrote:
>
> Vadim,
>
> On Sat, Mar 18, 2023 at 6:57 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
> >
> > On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:
> >
> > IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
> > IK> implementation in volume.cpp, right?
> >
> > You will need to use an intermediate class to virtualize this, something
> > like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
> > returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
> > from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.

Sorry, one more question.
Where will this additional class live?

Thank you.

Vadim Zeitlin

unread,
Mar 20, 2023, 4:14:30 AM3/20/23
to wx-...@googlegroups.com
On Sun, 19 Mar 2023 20:49:15 -0500 Igor Korot wrote:

IK> On Sat, Mar 18, 2023 at 10:23 PM Igor Korot <ikor...@gmail.com> wrote:
IK> >
IK> > Vadim,
IK> >
IK> > On Sat, Mar 18, 2023 at 6:57 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> > >
IK> > > On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:
IK> > >
IK> > > IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
IK> > > IK> implementation in volume.cpp, right?
IK> > >
IK> > > You will need to use an intermediate class to virtualize this, something
IK> > > like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
IK> > > returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
IK> > > from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.
IK>
IK> Sorry, one more question.
IK> Where will this additional class live?

The base class should be in include/wx/private/volume.h (which doesn't
need to be added to the bake/make/project files at all). The other classes,
deriving from it, can be defined locally in the files implementing them.

Regards,
VZ

Igor Korot

unread,
Mar 25, 2023, 1:45:53 AM3/25/23
to wx-...@googlegroups.com
Vadim,

On Mon, Mar 20, 2023 at 3:14 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
>
> On Sun, 19 Mar 2023 20:49:15 -0500 Igor Korot wrote:
>
> IK> On Sat, Mar 18, 2023 at 10:23 PM Igor Korot <ikor...@gmail.com> wrote:
> IK> >
> IK> > Vadim,
> IK> >
> IK> > On Sat, Mar 18, 2023 at 6:57 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
> IK> > >
> IK> > > On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:
> IK> > >
> IK> > > IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
> IK> > > IK> implementation in volume.cpp, right?
> IK> > >
> IK> > > You will need to use an intermediate class to virtualize this, something
> IK> > > like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
> IK> > > returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
> IK> > > from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.

What do I call this function?
It will not be documented, but we stll should have a good name for it.
And I presume I can use wxFSVolumeEnumerator for that class.

Thank you.

Vadim Zeitlin

unread,
Mar 26, 2023, 11:51:51 AM3/26/23
to wx-...@googlegroups.com
On Sat, 25 Mar 2023 00:45:33 -0500 Igor Korot wrote:

IK> On Mon, Mar 20, 2023 at 3:14 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> >
IK> > On Sun, 19 Mar 2023 20:49:15 -0500 Igor Korot wrote:
IK> >
IK> > IK> On Sat, Mar 18, 2023 at 10:23 PM Igor Korot <ikor...@gmail.com> wrote:
IK> > IK> >
IK> > IK> > Vadim,
IK> > IK> >
IK> > IK> > On Sat, Mar 18, 2023 at 6:57 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> > IK> > >
IK> > IK> > > On Sat, 18 Mar 2023 12:19:56 -0500 Igor Korot wrote:
IK> > IK> > >
IK> > IK> > > IK> So, IIUC, I will add an empty implementation in wxAppTraits and actual
IK> > IK> > > IK> implementation in volume.cpp, right?
IK> > IK> > >
IK> > IK> > > You will need to use an intermediate class to virtualize this, something
IK> > IK> > > like wxFSVolumeEnumerator. Then you'd add a function to wxAppTraits
IK> > IK> > > returning a wxFSVolumeEnumerator and return either wxFSVolumeTrivialEnum
IK> > IK> > > from the base implementation or wxFSVolumeGIOEnum from the wxGTK one.
IK>
IK> What do I call this function?

GetFSVolumeEnumerator() would seem to be a reasonable name for something
returning an object enumerating FS volumes.

Regards,
VZ

Igor Korot

unread,
May 25, 2024, 12:27:37 AMMay 25
to wx-...@googlegroups.com
Vadim.
I'd like to return to this...

On Fri, Mar 17, 2023 at 9:19 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
>
> On Fri, 17 Mar 2023 09:13:41 -0500 Igor Korot wrote:
>
> IK> What should be different for GetVolumes() in this case?
>
> It can't use GTK in base application, so it has to be different.

That's perfectly OK.
In the base it will link to the GIO but not GTK

I think it is possible to link to just GIO in this case.

And so base will just query GIO for the list of devices

And then the GUI will just retrieve the icons for the volumes...

>
> IK> It should behave exactly the same - it will grab the volumes and push their
> IK> names in the vector to return.
>
> How will it do it in base?

It will link to GIO. No GTK is necessary.
>
> IK> So you suggest to try the code first in my application?
>
> All I say is that the problem is not with file organization at all, but
> with code design.
>
Thank you.

> Regards,
> VZ

Igor Korot

unread,
May 25, 2024, 1:04:13 AMMay 25
to wx-...@googlegroups.com
Vadim,
Sorryabout the previous E-mail. I wanted to refresh the memory
but stopped somewhere in the middle.
Can you elaborate a little on the file structure?

The new class will be put in the new file and be added
s part of both base and core?
Or it can sit with wxAppTraits?

Or een better - is there an exaple already in the library
to look at and do the same?

Thank you.

>
> Regards,
> VZ

Vadim Zeitlin

unread,
May 25, 2024, 3:01:48 PMMay 25
to wx-...@googlegroups.com
On Sat, 25 May 2024 00:51:13 -0500 Igor Korot wrote:

IK> On Sat, Mar 18, 2023 at 11:45 AM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> >
IK> > On Fri, 17 Mar 2023 20:22:48 -0500 Igor Korot wrote:
IK> >
IK> > IK> Vadim,
IK> > IK>
IK> > IK> On Fri, Mar 17, 2023 at 6:09 PM Vadim Zeitlin <va...@wxwidgets.org> wrote:
IK> > [...]
IK> > IK> > Which is why I keep saying that you need to add wxAppTraits function which
IK> > IK> > will allow to use different implementations in wxBase and wxGTK. It's fine
IK> > IK> > if wxBase implementation is just a stub, e.g. returns only "/", of course.
IK> > IK>
IK> > IK> Understood.
IK> > IK> And then the volume.cpp file will be added to core only (i.e. GTK_SRC),
IK> > IK> right?
IK> >
IK> > No, you're still going to need the file with the non-GTK implementation,
IK> > even if it's trivial, so you'll still need 2 files: one src/unix and in
IK> > BASE_UNIX_SRC and the other one in src/gtk and in GTK_SRC.
IK>
IK> Can you elaborate a little on the file structure?

I have no idea about the context of this discussion any more but usually
you'd have something like src/unix/foounix.cpp and src/gtk/foo.cpp.

IK> The new class will be put in the new file and be added
IK> s part of both base and core?
IK> Or it can sit with wxAppTraits?

The Unix file would be part of base, the GTK one — part of core.

IK> Or een better - is there an exaple already in the library
IK> to look at and do the same?

You can look at GetDesktopEnvironment() for an example of a function
implemented differently for GTK and having a trivial implementation when
not using it.

Regards,
VZ
Reply all
Reply to author
Forward
0 new messages