After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 93585 - IOChannel wrappers for glibmm
IOChannel wrappers for glibmm
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other other
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-09-18 17:13 UTC by Tassos Bassoukos
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Glib::IOChannel implementation patch (5.95 KB, patch)
2002-09-18 17:14 UTC, Tassos Bassoukos
none Details | Review
iochannel.patch (33.12 KB, patch)
2002-09-19 21:33 UTC, Tassos Bassoukos
none Details | Review
glibmm-source.diff: Modify implementation of Glib::Source to allow for Glib::Source::Source(GSource*, GSourceFunc) ctor. (9.55 KB, patch)
2002-09-23 10:44 UTC, Martin Schulze
none Details | Review
iosource-iochannel.diff: Add IOChannel::create_watch() and overloads for IOSource::create() and SignalIO::connect() (7.52 KB, patch)
2002-10-15 18:38 UTC, Martin Schulze
none Details | Review
iosource-iochannel.diff: Add IOChannel::create_watch() and overloads for SignalIO::connect() and IOSource::create(). (7.52 KB, patch)
2002-10-15 18:43 UTC, Martin Schulze
none Details | Review

Description Tassos Bassoukos 2002-09-18 17:13:56 UTC
Attached is a patch to add wrappers for IOChannels in glibmm.

Please comment on them; I still think there are some issues WRT 
code design and formatting.

These wrappers are also derivable; one can create his own IOChannels in C++
TODO: Documentation.

Tassos
Comment 1 Tassos Bassoukos 2002-09-18 17:14:54 UTC
Created attachment 11164 [details] [review]
Glib::IOChannel implementation patch
Comment 2 Murray Cumming 2002-09-19 08:12:43 UTC
I can't read that file. Is it a .tar, or a .tar.gz, maybe? Please tell
us the filename in the description.
Comment 3 Tassos Bassoukos 2002-09-19 13:33:41 UTC
The attachment's name should be "iochannel.patch.gz"
Comment 4 Murray Cumming 2002-09-19 16:55:56 UTC
I don't have many comments because I don't have much knowledge about 
this kind of thing. I will leave it to someone such as Daniel Elstner 
to decide about this.

But:
* You need to patch the ChangeLog.
* Please use Doxygen-style comments. You should just need to use /** 
instead of /*.
* Please remove the flippant comments such as "Oh, Lord, please 
forgive me." They are not helpful.
* A cvs diff might be better, if possible.

Otherwise, well done. It probably wasn't easy to figure out how the 
gtkmmproc macros can be used.
Comment 5 Tassos Bassoukos 2002-09-19 21:33:28 UTC
Created attachment 11176 [details] [review]
iochannel.patch
Comment 6 Tassos Bassoukos 2002-09-19 21:35:40 UTC
This should be a more proper patch. Includes ChangeLog entry,
basic documentation and a better iostream-IOChannel.
Comment 7 Martin Schulze 2002-09-23 10:42:17 UTC
As I promised on the ml I created a patch that modifies the
Glib::Source implementation so that it is possible to wrap existing
GSource objects. See ChangeLog and comments in the source for details.

This patch doesn't actually add a wrap function because the GSource
objects must be wrapped in the derivations of Glib::Source. I will
provide another patch that adds a Glib::IOSource::create(const
IOChannel&) creator function as soon as IOChannel is added.

Is it okay, to commit the patch (it compiles and the timeout and
thread examples work)?
Comment 8 Martin Schulze 2002-09-23 10:44:55 UTC
Created attachment 11218 [details] [review]
glibmm-source.diff: Modify implementation of Glib::Source to allow for Glib::Source::Source(GSource*, GSourceFunc) ctor.
Comment 9 Murray Cumming 2002-09-23 10:55:31 UTC
Martin, does your patch replace Tassos's patch? Or is it additional? 
Please provide more explanation. Daniel will probably decide what 
should be applied.
Comment 10 Martin Schulze 2002-09-23 12:38:11 UTC
My patch is stand-alone. It prepares the current Glib::Source
implementation for _future_ addition of Glib::IOSource::create(const
IOChannel&) and for addition of other derivations of Glib::Source that
wrap existing GSource objects in glibmm or projects depending on glibmm.

As a reminder: Glib::Source objects can be attached to any
Glib::MainContext to listen to all kinds of event sources (timeouts,
idle, io).
Comment 11 Murray Cumming 2002-10-08 11:24:28 UTC
Martin, I have applied your patch. Sorry for the delay - I really
wanted Daniel to take care of this.

So, will the next patch, that you mentioned, be a replacement or an
addition to Tassos's patch?
Comment 12 Martin Schulze 2002-10-09 09:36:47 UTC
It will be an addition. Tassos's patch provides Glib::IOChannel, my
addition would be Glib::IOSource::create(const IOChannel&).
Unfortunately I'm not the ideal person to review Tassos's patch
because my knowledge of stl streams is too little to write one.
Comment 13 Daniel Elstner 2002-10-15 00:31:38 UTC
First of all, sorry for the delay.

OK, I had a look at your patch and decided to do a major rewrite
(sorry), which is still based on your work though.  Thanks for that.

Roughly, I made the following changes:

1. I chose a different class/file structure.  You'll find class
StreamIOChannel in the public API which implements most of the stuff
you had in iochansup.cc.  Also, the internal layout (particularly wrt.
reference counting) is now nearly the same as for Glib::Source (or
rather as it was before Martin's recent changes ;)

2. Several methods got renamed, some removed.  E.g. it seems you
misunderstood the g_io_channel_unix_new() vs.
g_io_channel_win32_new_fd() issue.  The docs should explain why it
doesn't make sense to decide which one to use at compile time.

3. There were several problems in your implementation, for instance
mixing up characters/bytes as well as relying on undefined behaviour.
(I.e. in one place you tried writing to the buffer returned by
string::c_str()).

4. Indentation style -- uhm, well, your preferred style seems to
differ at least slightly from the gtkmm one ;)  Next time, please
adapt to the style used thorough the library.

There is one problem:  I didn't have time to test the new code, so
it's likely that there are some errors lurking.  It'd be nice if you
could test it (I'll do so myself too, but that might take some time).

So, if there's something in the code you think is plain wrong,
missing, different from your intentions, etc. please complain, so we
can discuss it.

--Daniel
Comment 14 Martin Schulze 2002-10-15 18:35:58 UTC
IOChannel::create_watch() is still missing!

I'm attaching a patch that adds
a) overloads for IOSource::create() and SignalIO::connect() that take
a const Glib::RefPtr<IOChannel>& and
b) IOChannel::create_watch() to match the glib API.

Daniel, is it OK to commit?
Comment 15 Martin Schulze 2002-10-15 18:38:10 UTC
Created attachment 11564 [details] [review]
iosource-iochannel.diff: Add IOChannel::create_watch() and overloads for IOSource::create() and SignalIO::connect()
Comment 16 Martin Schulze 2002-10-15 18:43:31 UTC
Created attachment 11565 [details] [review]
iosource-iochannel.diff: Add IOChannel::create_watch() and overloads for SignalIO::connect() and IOSource::create().
Comment 17 Martin Schulze 2002-10-15 18:44:51 UTC
Sorry, I accidently added the same patch twice. galeon2 is not very
stable with bugzilla...
Comment 18 Daniel Elstner 2002-10-15 19:34:55 UTC
--- glib/src/iochannel.hg	15 Oct 2002 00:02:28 -0000	1.1
+++ glib/src/iochannel.hg	15 Oct 2002 18:27:18 -0000
@@ -40,6 +40,8 @@
 {
 
 class Source;
+class IOSource;
+enum IOCondition;

Incomplete enum types is a GCC extension.  I'm wondering how it could
compile for you since the GCC 3.2 documentation states that this
extension is *not* supported by GNU C++.  Perhaps this has been a
recent change.

Otherwise it looks good.  Just #include <glibmm/main.h> instead and go
ahead.
Comment 19 Daniel Elstner 2002-10-15 19:43:32 UTC
Just FYI, I never experienced any problems with Galeon2 (using Mozilla
1.1 + Xft) and bugzilla.
Comment 20 Daniel Elstner 2002-10-16 17:44:11 UTC
Martin, I committed your patch myself to make sure it's in before the
freeze.

--Daniel
Comment 21 Martin Schulze 2002-10-16 18:14:42 UTC
Thanks a lot, I've been unavailable until just now. By the way, my
Mozilla version is CVS head (rv:1.2b) :-)