Commit Graph

668 Commits

Author SHA1 Message Date
Alexander Larsson
f662e7e86b Store protocol by id, add lookup function for name
We want to use the protocol id for lookup in the GSocketConnection
code, so we expose it. We also make GSocket store the protocol
as an int for less memory use and to allow platform specific protocols
to be specified.

Also added g_socket_protocol_id_lookup_by_name() to allow the higher
level code to specify the name by string, and g_socket_get_protocol_name()
to get it.
2009-05-15 09:10:23 +02:00
Alexander Larsson
bd87df9e73 Make GSocketSourceFunc return the GSocket
This is very useful when you have multiple sockets with sources.
2009-05-14 18:12:40 +02:00
Alexander Larsson
7ffdc91f51 Set optlen before calling getsockopt
We were sometimes failing in g_socket_check_pending_error because
we were not setting optlen on input and it was sometimes randomly
less than sizeof(int).
2009-05-14 16:19:07 +02:00
Alexander Larsson
145cec3c93 Import GInitable, GSocket and dependencies from gnio
This adds:
GInitable - failable object constructor interface
GAsyncInitable - async failable object constructor interface
GSocket - Platform independent lowlevel berkely socket style object
GSocketControlMessage - For passing control messages over GSocket
GUnixFDMessage - unix fd passing socket control message

Some changes were done during the import from gnio to make things
work in glib. For instance, types were moved to other headers, header
file boiler plate were updated to glib style and gio.symbols stuff
was added.
2009-05-14 15:44:36 +02:00
Alexander Larsson
33c00e5c33 Add g_network_address_parse
This is useful if you want to allow users to specify
the hostname and optionally a port.
2009-05-14 15:34:12 +02:00
Alexander Larsson
80a484ad2c Add the new GFile ops to gio.symbols
This adds all the symbols related to GFile GIOStream support that was
recently added.
2009-05-14 15:34:12 +02:00
Alexander Larsson
ed08218565 Add tests for local GIOStream GFile ops 2009-05-13 14:42:57 +02:00
Alexander Larsson
14d58d51a3 Local file implementation of GFileIOStream and ops
This implements all the GIOStream file ops for local files.
We use the "fallback to output stream" for all GFileIOStream ops.
Some helpers stuff was added to the local input and output streams
so they could be reused.
2009-05-13 14:42:57 +02:00
Alexander Larsson
7a2d4889b5 Add GIOStream operations to GFile
g_file_open_readwrite, g_file_create_readwrite, g_file_replace_readwrite
and async variants, with default implementations using threads.
2009-05-13 14:42:51 +02:00
Alexander Larsson
bd0b8c60c2 Add GFileIOStream class
This is similar to GFileInputStream and GFileOutputStream for GIOStreams.
The default implementations chain to the Output stream.
2009-05-13 14:42:46 +02:00
Alexander Larsson
6d0bebb7df Add comment about lifecycle issues for GIOStreams 2009-05-13 14:42:45 +02:00
Alexander Larsson
05f544c591 Import GIOStream from gnio
Based on gnio rev 84516a5f544d8d5f3da368a83844e84eca8ef771
2009-05-13 14:42:38 +02:00
Alexander Larsson
1ecfae6a71 Remove close in finalize, we do it in dispose
This is not needed, and in fact it may be a bad idea to call
it from finalize anyway since the object isn't fully alive then.
2009-05-13 13:18:28 +02:00
Alexander Larsson
2bbb85633f Remove not actually used member "cancelled" 2009-05-12 13:58:18 +02:00
Alexander Larsson
b3e4b761f4 Fix gcancellable.c build on non-win32
I forgot to add #ifdef G_OS_WIN32 in one place, sorry.
2009-05-06 13:26:17 +02:00
Alexander Larsson
e10edefff1 Simplify GCancellable support on win32
There is no need to have a GIOChannel in the GPollFD in
g_cancellable_create_pollfd. All we need is an Event object that
we signal when cancelling and reset when resetting.

Also, supporting g_cancellable_get_fd on Windows using _pipe is useless
as it doesn't work with any corresponding poll() function, so just don't
support that on win32.

I tested this with the cancellation support in GSocket from gnio.
2009-05-06 13:14:04 +02:00
Paul Pogonyshev
2fff3026ef Don't try to ref NULL pointer in g_desktop_app_info_dup()
Fixes bug #573246.
2009-05-05 22:16:59 +03:00
Carlos Garnacho
d89cc0d7cb Add a GMount::pre-unmount signal
This is the per-mount analogon to GVolumeMonitor::mount-pre-unmount.
2009-05-05 14:45:18 -04:00
Matthias Clasen
a28215fa90 Release 2.21.0 2009-05-03 18:08:49 -04:00
Paul Pogonyshev
4e694faa33 Fix g_input_stream_skip_async() documentation
Remove mention of inexisting argument.  Spotted in relation to bug
581229.
2009-05-04 00:55:35 +03:00
Matthias Clasen
3f06ddd8cd Match up parameter names to help gtk-doc 2009-05-02 23:17:29 -04:00
Matthias Clasen
2e4b51aeb3 Plug a memory leak in g_simple_async_result_set_op_res_gpointer
Fixes bug 579272.
2009-05-02 22:59:02 -04:00
Dan Winship
92ac8d165e Misc warning fixes
glib/pcre/pcre_ucp_search_funcs.c, glib/pcre/pcre_valid_utf8.c: add
back missing config.h includes, and this time add them to the copies
in glib/update-pcre/ too so they don't get lost again on the next PCRE
update.

glib/garray.c, glib/gbase64.c: fix signed/unsigned pointer casts

gio/xdgmime/xdgmimeglob.c: remove unused variable

gio/tests/live-g-file.c: fix printf args on x86_64

tests/Makefile.am, tests/regex-test.c: remove redundant -DENABLE_REGEX
2009-05-01 10:37:45 -04:00
Alexander Larsson
d8029ca9bc Ensure g_inet_address_get_type() call is not optimized away
Yet another place where the get_type call can be optimized away due
to the G_GNUC_CONST attribute. Use a volatile variable to ensure
its not.
2009-04-30 10:46:37 +02:00
David King
97fe421518 Fix ginetaddress.c compile on Linux
The GType type definition belongs outside the G_OS_WIN32 typedef.
2009-04-29 14:23:17 -04:00
Alexander Larsson
d80e12104f Ensure we're actually initializing the winsock library
It turns out that just calling g_inet_address_get_type() isn't
enough, since its marked G_GNUC_CONST, so the call is optimized
away. If we assign the return value to a volatile location we ensure
it is called.
2009-04-29 12:19:57 +02:00
Dan Winship
7c9caecfeb Fix the networking stuff on (current) OS X
OS X's headers split up the current and old (BIND 4) nameserver stuff
slightly differently than Linux does, but explicitly including
arpa/nameser_compat.h does the right thing on both. Part of #580301
2009-04-26 13:21:53 -04:00
Dan Winship
9a15da50e4 Fix ginetaddress.c compile on Solaris
In glibc, IN6_IS_ADDR_UNSPECIFIED() et al. cast their argument to a
uint32_t*, so it doesn't matter whether you pass them the in6_addr
itself (which is what you're supposed to do) or one of its union
members (which is what we were actually doing). Solaris's macro
accesses the in6_addr fields directly though, and so only works if you
pass the actual in6_addr. #580194.
2009-04-26 13:18:17 -04:00
Johan Bilien
491a036d84 Fix translation from GIO's file attr to xattr attributes
Bug 579862 – requesting xattr::foo ends up calling getxattr(...,
user.:foo,...)

The patch makes sure we escape xattr::, not xattr:, before adding user.
and calling getxattr.
2009-04-22 19:09:34 +01:00
Christian Persch
a9c33dbd7a Use P_ for translatable param spec strings
Translatable param spec strings should be annotated with P_() instead of
plain _(). Bug #579830.
2009-04-22 16:11:38 +02:00
Dan Winship
9a3d18d2a6 GResolver wrappers: GNetworkAddress, GNetworkService, GSocketConnectable
Higher-level wrappers around GResolver. GSocketConnectable provides an
interface for synchronously or asynchronously iterating multiple
socket addresses, with GNetworkAddress and GNetworkService providing
interfaces based on hostname and SRV record resolution.
Part of #548466.
2009-04-22 08:36:38 -04:00
Dan Winship
c94d3f9288 Add GResolver, a glib-ish interface to DNS
GResolver provides asynchronous (and synchronous-but-cancellable) APIs
for resolving hostnames, reverse-resolving IP addresses back to
hostnames, and resolving SRV records. Part of #548466.
2009-04-22 08:36:32 -04:00
Dan Winship
68fc055627 Add network address and socket types
Types and methods for dealing with IPv4 and IPv6 addresses (and UNIX
domain socket addresses under UNIX). This does not include code for
actual socket I/O.

Originally from "gnio". Much of the code was written by Christian
Kellner, Samuel Cormier-Iijima, and Ryan Lortie.

Part of #548466.
2009-04-22 08:36:10 -04:00
Alexander Larsson
0f48f804b6 Use g_cancellable_connect/disconnect
Use the new cancellable helper functions to avoid races. (#572844)
2009-04-20 13:17:10 +02:00
Alexander Larsson
0001014c37 Add helpers for connecting/disconnecting to cancelled signal
There are race conditions when connecting and disconnecting from the
"cancelled" signal on GCancellable which you need to do when
implementing cancellable operations. This adds helper functions that
avoid these races and mentions these races in the docs. (#572844)
2009-04-20 13:17:03 +02:00
Matthias Clasen
2c1dc529e8 Add a note about handling non-hal backends 2009-04-09 21:34:49 -04:00
Gian Mario Tagliaretti
856632c496 Fix a typo in GFile docs
Fixed function name in GFile docs from g_set_display_name to
g_file_set_display_name so that gtk-doc can link correctly.  (#578002)
2009-04-09 14:35:57 -04:00
Alexander Larsson
d0cf7b3878 Only mark regular files as backup files
Apps don't generally create backup directories, etc. So, if the file
ends with ~ but is not a regular file shouldn't be considered a backup
file. (#573673)
2009-04-08 09:12:02 +02:00
Matthias Clasen
e6e82c51a6 Move hex_digits to rodata
Turn a string into a constant array.
2009-04-03 00:35:43 -04:00
Matthias Clasen
25ff8ee748 Don't lie about ext4 filesystems
When returning a filesystem type id, say "ext3/ext4" instead of "ext3",
since both use the same superblock magic, so we can't discriminate
them without more work.
2009-04-03 00:23:54 -04:00
Alexander Larsson
1ce74b0dd3 On trash, if rename fails with EXDEV, return G_IO_ERROR_NOT_SUPPORTED
Sometimes it seems like the trash dir and the file are on the same
filesystem but the rename fails with EXDEV anyway (can happen
e.g. with bind mounts or multiple mounts of the same device). In this
case we want to return the right error so that apps can fallback to
regular delete.
2009-04-02 19:01:56 +02:00
Matthias Clasen
785bed2e18 Update README files to refer to git
Update various README files to refer to git instead of svn.
Add a README.commits that is pretty much a copy of the same file
in GTK+. Also discontinue ChangeLog files.
2009-03-31 19:39:16 -04:00
Carlos Garnacho
dabbea65c6 Bug 575270 – GVolumeMonitor::mount-pre-unmount not being emitted
2009-03-26  Carlos Garnacho  <carlosg@gnome.org>

        Bug 575270 – GVolumeMonitor::mount-pre-unmount not being emitted

        * gunixmount.c (eject_unmount_cb) (eject_unmount_do_cb)
        (eject_unmount_do): Emit ::mount-pre-unmount and wait 500msec before
        actually trying to unmount.


svn path=/trunk/; revision=8020
2009-03-26 13:59:02 +00:00
Colin Walters
1d1fba442f Bug 575708 - runaway inotify madness ...
2009-03-17  Colin Walters  <walters@redhat.com>

	Bug 575708 - runaway inotify madness ...

	* gfilemonitor.c: Queue up events in a local list and
	fire one idle, instead of queuing lots of individual
	idles which has bad performance behavior.


svn path=/trunk/; revision=8010
2009-03-17 21:59:18 +00:00
Alexander Larsson
a3fe428081 fix attributes argument of query_info methods to be "const char *".
2009-03-17  Alexander Larsson  <alexl@redhat.com>

        * glocalfileinputstream.c:
        * glocalfileoutputstream.c:
	fix attributes argument of query_info methods to
	be "const char *".


svn path=/trunk/; revision=8000
2009-03-17 11:21:37 +00:00
Alexander Larsson
6cff88ba18 Bug 575555 – Use fsync() when replacing files to avoid data loss on
2009-03-16  Alexander Larsson  <alexl@redhat.com>

	Bug 575555 – Use fsync() when replacing files to avoid data loss on crash

        * configure.in:
	Look for fsync().

        * glib/gfileutils.c:
        (write_to_temp_file):
	fsync temp file if destination file exists

2009-03-16  Alexander Larsson  <alexl@redhat.com>

	Bug 575555 – Use fsync() when replacing files to avoid data loss on crash

        * glocalfileoutputstream.c:
        (g_local_file_output_stream_close):
        (_g_local_file_output_stream_replace):
	fsync temp file before closing if replacing target file

	

svn path=/trunk/; revision=7991
2009-03-16 16:03:13 +00:00
Matthias Clasen
5a8a224ff0 2.20.0
svn path=/trunk/; revision=7976
2009-03-13 05:44:11 +00:00
Alexander Larsson
70a276eca3 Bug 573843 – g_get_current_dir returns non-absolute path
2009-03-04  Alexander Larsson  <alexl@redhat.com>

	Bug 573843 – g_get_current_dir returns non-absolute path

	* glocalfile.c (canonicalize_filename):
	Handle the case where g_get_current_dir() returns a non-absolute path.


svn path=/trunk/; revision=7958
2009-03-04 13:47:53 +00:00
Alexander Larsson
73477419e8 Bug 573970 – crash in gunixvolumemonitor:update_mounts when unmounting
2009-03-04  Alexander Larsson  <alexl@redhat.com>

	Bug 573970 – crash in gunixvolumemonitor:update_mounts when unmounting

        * gunionvolumemonitor.c:
        (g_union_volume_monitor_dispose):
	Run dispose on child monitors when disposing.

        * gunixvolumemonitor.c:
	Remove all volumes and mount on dispose to avoid circular
	dependencies not freeing the monitor



svn path=/trunk/; revision=7957
2009-03-04 10:45:10 +00:00
Alexander Larsson
896c3d1b2c Bug 561172 – gnome-open fails on local URIs with anchors
2009-03-03  Alexander Larsson  <alexl@redhat.com>

	Bug 561172 – gnome-open fails on local URIs with anchors

        * gdesktopappinfo.c:
	Don't force uris to filenames if the uri has an anchor, because
	that would strip the anchor.

        * glocalvfs.c:
	Strip anchor from file:// uris when creating GFile, since
	g_filename_from_uri doesn't handle them.



svn path=/trunk/; revision=7953
2009-03-03 19:02:16 +00:00