Commit Graph

1009 Commits

Author SHA1 Message Date
Alexander Larsson
c7c0bcef89 xdgmime - Correct the range checks for magic matching 2009-10-02 12:55:54 +02:00
Alexander Larsson
2624e7d6c6 Remove unnecessary includes 2009-10-02 12:55:54 +02:00
Alexander Larsson
e1643fd76d xdgmime - support the new case sensitive flag 2009-10-02 12:55:54 +02:00
Alexander Larsson
7c27df1fee xdgmime - support cache files with minor version 2 2009-10-02 12:55:54 +02:00
Alexander Larsson
ce239a010e Read the new glob2 format with case sensitive flags 2009-10-02 12:55:54 +02:00
Matthias Clasen
e9fe53980b Fix --runtime-libdir option
For stable releases, it needs to take LT_REVISION into account, not
hardcode 0.
2009-09-29 23:08:03 -04:00
Matthias Clasen
6555e0171d Fix mime_info_cache_dir_add_desktop_entries
This function tried to avoid adding duplicate entries, but failed
due to using the wrong search function. See bug 595972.
2009-09-29 20:52:26 -04:00
Matthias Clasen
5fdb169b72 Clarify docs of g_async_result_get_source_object
It returns a new reference. Reported in bug 596748
2009-09-29 20:33:39 -04:00
Alexander Larsson
90e1308809 Avoid critical error in thread check if source is destroyed
The source can be destroyed by the time we complete the result, and
then the g_source_get_context(current_source) call will cause
a critical error. We check for the source being destroyed and avoid
the check in that case.

This means we miss the right-thread check in this case, but thats
merely a helper, so this is not critical.
2009-09-29 11:27:15 +02:00
Alexander Larsson
6f1ce483eb Always report metadata on the path, not symlink target
Metadata are really part of the pathname, not the target file
(as they are stored by pathname, and for many metadata like icon position
etc make not sense using the target data). So, even if nofollow
is not specified we should not follow links for metadata.

Ideally this should be implemented in the metadata extension in gvfs,
but the extension API does not allow this, so we do it in gio.

See https://bugzilla.gnome.org/show_bug.cgi?id=593809
2009-09-28 15:55:44 +02:00
Josselin Mouette
cc4970cf94 Fall back to inotify_init if inotify_init1 does not work
This fixes monitoring failing to work when glib is built on a 2.6.27+
kernel but run on an older one.

http://bugs.debian.org/544354
https://bugzilla.gnome.org/show_bug.cgi?id=593775
2009-09-23 18:39:45 +02:00
Mart Raudsepp
c755a7fd11 gio: Fix some typos in G*AppInfo documentation 2009-09-22 11:22:44 +03:00
Mart Raudsepp
6c061da2a2 gio: Fix a Since tag to actually show up in new API of 2.20 indeces
Typo made in e05426062
2009-09-22 11:22:44 +03:00
Paolo Borelli
80f66b1141 Fix build with srcdir != builddir, bug #594597 2009-09-19 10:22:33 +02:00
Matthias Clasen
53fc10d269 Fix a lot of clang complaints
Mostly dead assignments.
2009-09-18 19:20:06 -04:00
Sjoerd Simons
8667317766 Fix GNetworkAddress skipping addresses when enumerating
g_network_address_address_enumerator_next_finish takes the first item of the
address list and moves the pointer to the next one, so we shouldn't do the same
in g_network_address_address_enumerator_next_async function

Fixes bug #593941
2009-09-11 15:25:34 +01:00
Richard Hughes
cdd04f36ca Make the error const for g_simple_async_result_set_from_error 2009-09-11 15:20:34 +01:00
James Hunt
11477609d1 g_socket_send_message() fails due to invalid sendmsg(2) params.
g_socket_send_message() and g_socket_send_to() fail with ENOBUFS or
EFAULT due to the fact that if no "address" argument is specified to
g_socket_send_message, when g_socket_send_message() calls sendmsg(2),
the 2nd parameter to sendmsg ("const struct msghdr *msg") contains
uninitialized values. The fix is simple - initialize msg.msg_name to
NULL and msg.msg_msg_namelen to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=594759
2009-09-11 08:52:14 -04:00
Alexander Larsson
8af494d987 Avoid reading uninitialized memory
If the statfs call fails, don't look at the result.
2009-09-07 12:50:58 +02:00
Alexander Larsson
06de24f430 Remove warning in g_simple_async_result_complete
This warning hits code that uses GSimpleAsyncResult outside of a
mainloop as a helper object. For instance EggDBus does this.
Since the bugs this warning would fix are pretty easy to spot
and since EggDBus is deployed already we just remove the
"called from outside main loop" warning.

However, we need to keep the "called from wrong context" warning
as that is very helpful when debugging misuse of the new multiple
main context code.
2009-09-07 10:25:14 +02:00
Matthias Clasen
034d516160 Another dead assignment 2009-09-07 03:28:35 -04:00
Matthias Clasen
6cda9bfb02 Remove a dead initialization 2009-09-07 03:14:15 -04:00
Matthias Clasen
30645bd0a5 Remove a dead increment 2009-09-07 03:12:06 -04:00
Matthias Clasen
0d1ffbf361 Remove another dead assignment 2009-09-07 03:10:01 -04:00
Matthias Clasen
f2c8572d84 Remmove a dead assignment.
Spotted by clang.
2009-09-07 03:07:22 -04:00
Matthias Clasen
1ec32c403b Move a assignment to the relevant #ifdef branch
Dead code spotted by clang.
2009-09-07 03:02:58 -04:00
Matthias Clasen
e67c3cf2b0 Remove dead code 2009-09-07 03:01:02 -04:00
Matthias Clasen
80fd5ed402 Don't evaluate an uninitialized value
Bug found by clang.
2009-09-07 02:50:51 -04:00
Benjamin Otte
4114f1214c Bug 594034 - Use g_mkstemp_full() when creating the replacement file
Previous code used g_mkstemp(). But when using
G_FILE_CREATE_REPLACE_DESTINATION, no attempt was made to ensure proper
mode and flags of the created temporary file. The visible issue was that
the file was always created with mode 0600 as opposed to using 0666.
(The invisible issue was that O_RDWR was used instead of O_WRONLY.)
2009-09-04 22:45:57 +02:00
Benjamin Otte
3826963e65 Use lchmod instead of stat + chown if available
Fallout of the NOFLOOW_SYMLINKS fix from bug 593406
2009-09-01 21:53:35 +02:00
Benjamin Otte
48e0af0157 Bug 593406 - Permissions set to 777 after copying via Nautilus
Only fail to set the permissions when the actual file is a symlink.
The previous fix failed for every file when NOFOLLOW_SYMLINKS was set.
2009-09-01 21:33:11 +02:00
Benjamin Otte
bb7852e34b Only do the chmod NOFOLLOW_SYMLINK checks with HAVE_SYMLINK 2009-09-01 21:29:43 +02:00
Benjamin Otte
fc44bf40a4 Fix gtk-doc syntax 2009-09-01 12:48:55 +02:00
Benjamin Otte
e695c0932f Bug 593406 - Permissions set to 777 after copying via Nautilus
When doing a g_file_copy() with nofollow-symlinks (to copy a link for
example), the later copying of the file attributes copies the source
links 777 attributes to the target's attributes. As chmod affects the
symlink target, this would cause such copies to always set the target to
777 mode.

This patch makes setting the mode with nofollow-symlinks fail with
NOT_SUPPORTED.

The aforementioned g_file_copy() will still succeed, because it ignores
errors of the attribute copy.
2009-09-01 12:15:31 +02:00
Matthias Clasen
c47dca4cfe Re-commit 30b8774f7f
Turns out Alex had agreed to this.
2009-08-27 23:40:16 -04:00
Matthias Clasen
2889f1b8a3 Use the saved errno value
Bug 591995
2009-08-27 23:02:08 -04:00
Matthias Clasen
3a47f48311 Revert "add a "gsettings-backend" extension point to GIO"
This reverts commit 30b8774f7f.
2009-08-27 22:51:53 -04:00
Ryan Lortie
30b8774f7f add a "gsettings-backend" extension point to GIO 2009-08-27 13:45:48 -04:00
Matthias Clasen
eadef0325a Documentation fixes 2009-08-24 13:34:38 -04:00
Dan Winship
cd5bd15987 Use MSG_NOSIGNAL in GSocket if it's available
Even though we ignore SIGPIPE, gdb will still stop when the process
receives one, which sometimes confuses people into thinking the app
has crashed (eg, bug 578984, bug 590420), and is annoying anyway. So
use MSG_NOSIGNAL if it's there.

http://bugzilla.gnome.org/show_bug.cgi?id=591378
2009-08-19 12:12:15 -04:00
Dan Winship
021dd960cf Re-run res_init() when resolv.conf changes
libc caches the contents of resolv.conf, so if it changes (eg, because
the network state changed), we need re-run res_init().

http://bugzilla.gnome.org/show_bug.cgi?id=584246
2009-08-19 12:08:15 -04:00
Benjamin Otte
6db03d73a4 When creating a pipe for a cancelled cancellable, write to it
Includes (untested) fix for win32 that calls SetEvent() in that case.
2009-08-19 11:02:06 +02:00
Benjamin Otte
faae032ad0 Use g_cancellable_release_fd()
Part of: Bug 591388 - number of GCancellables available is too limited
2009-08-19 11:02:06 +02:00
Benjamin Otte
e2c97292c2 Implement g_cancellable_release_fd()
Part of: Bug 591388 - number of GCancellables available is too limited
2009-08-19 11:02:06 +02:00
Benjamin Otte
63426886ff Add g_cancellable_release_fd()
This patch only adds the function. The function is a NOP.
See the API documentation for a rationale.

Part of: Bug 591388 - number of GCancellables available is too limited
2009-08-19 11:02:05 +02:00
Benjamin Otte
bb8e4f06ab Bug 591714 – Figure out failure handling for g_cancellable_make_pollfd()
Make g_cancellable_make_pollfd() return a gboolean that indicates its error
status. Update the code that calls this function accordingly.
2009-08-19 11:02:05 +02:00
Benjamin Otte
a6ac4e90d5 Fix multiple returns in gtk-doc comment 2009-08-18 11:34:20 +02:00
Dan Winship
8f6d26e964 g_inet_socket_address_to_native: properly zero out sockaddr_in6 2009-08-17 13:20:49 -04:00
Shixin Zeng
406c3aa019 [Win32] Avoid superfluous '/' from g_file_resolve_relative_path()
Patch from bug #591532.
2009-08-14 23:23:28 +03:00
Dan Winship
882e36106d Fix a bad void return. #588901 2009-07-30 11:18:35 -04:00
Dan Winship
f34b1f024f Conditionalize portability #includes in g-asyncns.h
http://bugzilla.gnome.org/show_bug.cgi?id=589988
2009-07-29 22:35:07 -04:00
Dan Winship
45067ab9e9 Fix leaks in GSocketClient and GThreadedResolver
Also update gio/tests/send-data.c to test async connection, and free
more stuff in several tests to make leaks easier to see.
2009-07-23 16:27:01 -04:00
Lin Ma
4654a7d593 Fixed a missing head which will cause crashes for 64bit applications
Without that head, the returned pointer will be truncated to 32bit, then
causes crashes for 64bit applications.
2009-07-21 10:45:25 +08:00
Benjamin Otte
dfda26d1a9 Propagate the right error 2009-07-20 14:29:51 +02:00
Tor Lillqvist
474ba7dbc3 Make it compile on Windows.
Surround a symlink-related code snippet with ifdef S_ISLNK.
2009-07-07 14:39:10 +03:00
Matthias Clasen
3d1e812778 Document support_thread_contexts 2009-07-06 00:00:42 -04:00
Matthias Clasen
563c55bb71 Fix a segfault in g_cancellable_cancel 2009-07-05 23:38:09 -04:00
Matthias Clasen
5694ab7642 Revert "Move gio tests from gio/tests/ to tests/gio/"
This reverts commit 2262d76b33.

Move GIO tests back to where they belong.
2009-07-05 22:49:24 -04:00
Matthias Clasen
8de4be69a9 Move comment to the right place 2009-07-05 22:35:55 -04:00
Matthias Clasen
aa065346d3 Register ids for new file attributes 2009-07-05 22:26:11 -04:00
David Zeuthen
99a1c47343 Allow interaction when unmounting mounts
For details, see bug 587482. The new api:

 - Provide new _with_operation() variants of all unmount and eject methods

 - Add GMountOperation::show-processes signal
   - this can be used to show processes blocking an unmount operation

 - Deprecate all unmount and eject methods

 - Add g_drive_can_start_degraded() method
   - this is to avoid auto-starting degraded drives

 - Make g_drive_stop() resp. g_file_stop_mountable() take a GMountOperation
   - these ops were recently added and not yet public API so it's fine
     to change how they work

 - Provide a way to poll mountable files, e.g. g_file_poll_mountable()

 - Add some missing file attributes for mountable files
  - G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE
    - needed for the GDU Nautilus extensions to format a volume
  - G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED:
    - mimics g_drive_can_start_degraded()
  - G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL:
    - mimics g_drive_can_poll_for_media()
  - G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC
    - mimics g_drive_is_media_check_automatic()
2009-07-05 21:59:38 -04:00
Benjamin Otte
c85ff0c750 [gio] minor improvements to g_cancellable_cancel()
- make this function not crash when cancellable is NULL
- avoid locking when the cancellable has already been cancelled
2009-07-05 21:36:03 +02:00
Dan Winship
29e6525b1e Two "make check" fixes for late changes to the thread-context patch
g_simple_async_result_complete() now checks that it's being run from
the correct main loop, so tests/gio/simple-async-result was failing,
because it called it from outside any main loop. (And gio's pltcheck
was failing because I hadn't added g_main_current_source() to it.)
2009-07-01 13:52:49 -04:00
Benjamin Otte
2262d76b33 Move gio tests from gio/tests/ to tests/gio/
This avoids getting tests built every time when working on libgio and
running make in the gio/ directory.
2009-07-01 19:03:19 +02:00
Dan Winship
65cc5d895a Support g_main_context_push_thread_default() in gio
GFile allows for the possibility that external implementations may not
support thread-default contexts yet, via
g_file_supports_thread_contexts(). GVolumeMonitor is not yet
thread-default-context aware.

Add a test program to verify that basic gio async ops work correctly
in non-default contexts.

http://bugzilla.gnome.org/show_bug.cgi?id=579984
2009-07-01 09:02:46 -04:00
Dan Winship
90381ecdbd Use low-level GSource methods in a few more places
(in preparation for thread-default context support)
2009-07-01 09:01:48 -04:00
Dan Winship
28a39fab5a Remove some unused code 2009-06-30 19:05:44 -04:00
Dan Winship
70e8eed6ac Fix GResolver for g_simple_async_result_set_op_res_gpointer change
Previously, re-setting the pointer value would cause the old
GDestroyNotify to be lost; now it causes it to be run.

http://bugzilla.gnome.org/show_bug.cgi?id=587415
2009-06-30 18:48:36 -04:00
Benjamin Otte
d589da7e86 Bug 587434 – regression tests fail
make this test not only compile, but also run successfully with mad
CFLAGS.
2009-06-30 20:42:14 +02:00
Benjamin Otte
80561f9718 Bug 587434 – regression tests fail
I missed one s/tmpfile/tmp_file/ which caused crashes.
2009-06-30 20:40:52 +02:00
Dan Winship
53beca955e Add GCancellables to GSocket ops
Currently, to implement cancellability correctly, all synchronous
calls to GSocket must be preceded by a g_socket_condition_wait() call,
(even though GSocket does this internally as well) and all
asynchronous calls must do occasional manual
g_cancellable_is_cancelled() checks. Since it's trivial to do these
checks inside GSocket instead, and we don't particularly want to
encourage people to use the APIs non-cancellably, move the
cancellation support into GSocket and simplify the existing callers.

http://bugzilla.gnome.org/show_bug.cgi?id=586797
2009-06-30 11:42:17 -04:00
Benjamin Otte
fc2b3ee560 remove unused label
complained about by -Wall
2009-06-29 18:32:09 +02:00
Benjamin Otte
afd63c3281 fix warnings from gcc compilation with my mad CFLAGS 2009-06-29 18:25:02 +02:00
Benjamin Otte
4b8ad50fc4 add g_file_attribute_set_*_by_id() and use them
This patch and the previous ones fixes the performance issues noted in
Bug 587089 – lookup_attribute() takes too much CPU
It increases performance for querying attributes by ~15% in my tests.
2009-06-29 18:25:02 +02:00
Benjamin Otte
bd198e5e45 export and use _g_file_attribute_matcher_matches_id() 2009-06-29 18:25:02 +02:00
Benjamin Otte
ceba40c27d add private header with attribute ids
attribute ids are generated when the attribute hash is initialized. This
way we can guarantee that the ids match every time.
2009-06-29 18:25:02 +02:00
Benjamin Otte
2620c23577 split lookup_attribute() into two functions 2009-06-29 18:25:02 +02:00
Benjamin Otte
66cebd7292 split attribute hash initialization into its own function 2009-06-29 18:25:01 +02:00
Tom Parker
e7a258692c Add NULL to end of g_filename_complete_get_completions() return value
g_filename_complete_get_completions() return value is meant to be a
g_strfreev-compatible array i.e. NULL-terminated. However, pointer arrays
aren't automagically NULL-terminated. This fixes bug 586868
2009-06-26 22:43:31 -04:00
Alexander Larsson
d884e509db Allow setting G_FILE_ATTRIBUTE_TYPE_INVALID attributes in GFileInfo
This is used to unset an attribute in g_file_set_attributes_from_info.
2009-06-25 09:18:01 +02:00
Richard Hughes
b0dc7afd2a Allow GCancellable to be subclassed by adding a private structure 2009-06-24 10:33:24 +02:00
David Zeuthen
0ccd18bc83 Bug 586675 – Runtime library location
Introduce an option to specify the runtime location for libraries via
a relative path to libdir.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-06-23 12:58:35 -04:00
Alexander Larsson
7662c86611 Add extension point for adding metadata for local files
This adds a local_file_add_info vfunc to GVfs that vfs implementations
can override to add metadata for local files.
2009-06-23 16:35:42 +02:00
Alexander Larsson
9a6146f54c Add g_file_info_set_attribute_status
Required for gvfs implementation for set_attribures_from_info.
2009-06-23 16:35:41 +02:00
Alexander Larsson
becf4186e6 Add g_file_info_has_namespace
Need this to quickly see if we should set attributes from
this GFileInfo in metadata extension.
2009-06-23 16:35:41 +02:00
Alexander Larsson
0ed9201ad2 Add string vector attribute type to GFileInfo
This is needed for the new metadata backend since nautilus has a
string-list metadata type, and we want to use this for nautilus.
2009-06-23 16:35:41 +02:00
Alexander Larsson
c1ab6454fe Copy namespaces correctly in g_file_copy_attributes
File attribute namespaces are delimited with "::", but
build_attribute_list_for_copy only used ":", so we didn't copy
any writable namespaces.
2009-06-23 16:35:41 +02:00
Matthias Clasen
854a43a3cd Fix build on mingw
Mingw does not have sys/uio.h. This was reported in bug 585937.

Author:    Matthias Clasen <mclasen@redhat.com>
2009-06-19 23:25:18 -04:00
Alexander Larsson
8cb481fd5f Use io_prio as mainloop prio for async-emulation (#579449)
I'm not sure why we used the elaborate formula to convert the io-priority
to the priority of the mainloop idle when emulating async i/o with idles.
However, it causes the default io priority to be less than the normal
idle prio, so the i/o won't be scheduled if there is an idle outstanding.

There is really no great mapping to use here, doing blocking i/o in an
idle of any prio is generally bad and apps doing a lot of async i/o should
initialize threads. However, if we use the io-priority directly we at least
avoid the starvation problem above and make things easier to understand.
2009-06-18 19:43:46 +02:00
Benjamin Otte
9fba812884 Revert "clarify documentation"
This reverts commit d218cf0f67.
This has been fixed in the code, so no need to keep the updated docs.
2009-06-18 15:29:41 +02:00
Benjamin Otte
835c03a5c1 syntax fix in documentation 2009-06-18 15:27:42 +02:00
Benjamin Otte
cf95d07691 fix typo in documentation 2009-06-18 15:27:42 +02:00
Benjamin Otte
d218cf0f67 clarify documentation 2009-06-18 15:27:41 +02:00
Matthias Clasen
0fbeab4520 Add g_setenv 2009-06-15 12:57:21 -04:00
David Zeuthen
fae755e056 Bug 585591 – Starting/stopping drives
Add API for starting/stopping drives. This new API will enable
GVolumeMonitor and GVfs implementations to add support for the
following features

 1. Powering down external hard disk enclosures / drives

 2. Starting/stopping multi-disk devices (such as RAID/btrfs/ZFS)

 3. Connecting/disconnecting iSCSI devices

 4. Reacting to the user pressing e.g. the "remove drive" button on
    a IBM/Lenovo Ultrabay: http://www.thinkwiki.org/wiki/Ultrabay

See the bug for the corresponding GVfs and Nautilus changes.
2009-06-15 10:59:43 -04:00
Ondrej Jirman
bb4f7c48f9 Fix incorrect freeing of thread pool in GThreadedSocketService (#584255) 2009-06-15 15:56:45 +02:00
Alexander Larsson
31cb0bdcb0 Emit changed in g_socket_listener_add_socket, not in add_address
This way we emit this signal when add_socket is called from another
place than add_address too.
2009-06-15 15:43:39 +02:00
Alexander Larsson
a640695f16 Ref the passed in socket in g_socket_listener_add_socket (#585599) 2009-06-15 15:42:38 +02:00
Alexander Larsson
67de6cba50 Add bound address out-argument to g_socket_listener_add_address (#585566)
This is very useful when binding to "any" port.
2009-06-15 14:23:57 +02:00
Alexander Larsson
740ae3aa29 Avoid unnecessary work if mount watching not specified (#585360)
If G_FILE_MONITOR_WATCH_MOUNTS isn't specified, don't do all the work
when the mtab changes.
2009-06-15 12:26:57 +02:00
Matthias Clasen
129eb07482 Support special icons for xdg user dirs
The icon names are folder-documents, folder-download, folder-music,
folder-pictures, folder-publicshare, folder-templates, folder-videos.
See bug 541276.
2009-06-15 01:45:34 -04:00
Matthias Clasen
50a7f53055 Don't use deprecated GLib api
Fixes bug 585673.
2009-06-15 01:12:50 -04:00
Matthias Clasen
642e9c7540 Fix the icon property implementation
Turns out both the setter and the getter were broken...
Fixes bug 585676.
2009-06-15 00:45:55 -04:00
Matthias Clasen
b533a944ff Trivial formatting fixes 2009-06-15 00:38:34 -04:00
Matthias Clasen
ce4aa6253e Include sys/uio.h for struct iovec
This fixes the build on OS X, bug 585280.
2009-06-14 23:55:12 -04:00
Matthias Clasen
8a3a3d797e Use inotify_init1 when available
To avoid leaking the inotify fd. Fixes bug 585478.
2009-06-14 22:29:17 -04:00
Ryan Lortie
4dbc2074bc Add GNIO test cases to .gitignore 2009-06-14 13:58:35 -04:00
Ryan Lortie
cb1a609240 Bug 585575 – g_socket_listener_add_inet_port()
Change the logic in g_socket_listener_add_inet_port() as per the
reasoning in the bug report.

  - If the OS supports neither IPv6 or IPv4, fail.
  - If the OS supports only IPv6, do that.
  - If the OS supports only IPv4, do that.
  - If the OS supports IPv6 and IPv6 "speaks" IPv4 then bind it
    and be done.
  - If the OS supports IPv6 and IPv6 doesn't "speak" IPv4 then
    create an additional socket for IPv4.
  - If binding any socket fails then fail the entire call.

Also, remove the ability to call this function with port == 0.  This
is a useless thing to do anyway since you have no way to know what
port number was actually allocated.  We should have a separate
function to deal with this.
2009-06-12 13:01:04 -04:00
Ryan Lortie
f7d756f5b6 add g_socket_speaks_ipv4()
Partial fix for Bug 585575.
2009-06-12 12:21:07 -04:00
Benjamin Otte
fd22781b18 make all APIs that take inet port arguments take a guint16 2009-06-12 15:57:51 +02:00
Benjamin Otte
3e3e3c2946 don't make strings const when they are not
gets rid of compiler warnings
2009-06-12 15:57:12 +02:00
Matthias Clasen
a402875de1 Fix an oversight in the previous commit
We don't want to unset DISPLAY etc, if none is specified in the
app launch context.
2009-06-11 12:41:16 -04:00
Matthias Clasen
9e43937d03 Include sys/types.h in gunixfdmessage.c
As recommended in 'man socket'. Fixes bug 585281.
2009-06-10 23:28:32 -04:00
Matthias Clasen
d3d81f74c5 Make setting DISPLAY work
And remove a bunch of grotty code to manipulate an environment
array at the same time. Instead, simply call setenv in the child_setup
function.
2009-06-10 16:20:51 -04:00
Dan Winship
74a3c71dcf Revert part of fix for old OS X that broke the compile on current OS X
http://bugzilla.gnome.org/show_bug.cgi?id=584574
2009-06-09 09:32:43 -04:00
Benjamin Otte
ced88fd0de Bug 585189 – g_cancellable_reset() must be called in same thread ...
... as g_cancellable_cancel()
Rework a g_critical() that would (rarely) trigger when _reset() was
called in a thread different from _cancel() by making _reset() wait for
the cancel function to be finished the same way
g_cancellable_disconnect() uses.
2009-06-09 12:19:24 +02:00
Benjamin Otte
74fd3e734f typo in documentation 2009-06-08 15:30:28 +02:00
Benjamin Otte
29a4a0a44d only query file info in g_file_copy() when we need it
The default implementation of g_file_copy() checked the size of the file
to copy to give useful progress updates unconditionally. This can cause
long delays on 1-connection FTP servers while it tries to open a second
connection before it returns EBUSY. This patch makes this query only
happen when we actually send progress updates.
2009-06-08 15:30:28 +02:00
Alexander Larsson
0bb5739f32 Reformat g_themed_icon_get_names return type to make gtk-doc work
Seems the gtk-doc scanner needs "const gchar* const *" to work, so switching
to that.
2009-06-01 22:10:41 +02:00
Dan Winship
ce6fbd6231 Fix multiple bugs in g_srv_target_list_sort()
In particular, targets with weight 0 should be very UNlikely to be
selected, not very likely, as they were before. However, even ignoring
that bug in the logic, there was an additional bug (swapping list
items would cause the 0-weight items to get re-ordered incorrectly
anyway), and the code contained several fencepost errors.

This patch also adds gio/tests/srvtarget.c, which confirms that for a
sample list of targets, we now generate all possible correct random
sortings and no incorrect sortings, and the correct sortings occur in
roughly the expected proportions (though if the current code is
still wrong, those proportions may be wrong as well).

http://bugzilla.gnome.org/show_bug.cgi?id=583398
2009-06-01 14:31:48 -04:00
Dan Winship
1ca91a2125 Clarify some GSocket docs 2009-06-01 14:24:44 -04:00
Dan Winship
5b3d62a7a6 Misc networking build fixes
http://bugzilla.gnome.org/show_bug.cgi?id=580301
http://bugzilla.gnome.org/show_bug.cgi?id=584176
2009-06-01 14:21:05 -04:00
Tor Lillqvist
85816117e3 Bump _WIN32_WINNT to 0x0501
Needed to get prototypes for getaddrinfo() and friends on mingw.
2009-06-01 14:04:49 +03:00
Hans Breuer
75ef018248 Updated msvc build files 2009-05-30 15:29:23 +02:00
Hans Breuer
780185449f Version resource template for gio 2009-05-30 15:24:06 +02:00
Hans Breuer
73dbe591fb Handle EAI_NODATA==EAI_NONAME in win32 SDK 2009-05-30 15:18:02 +02:00
Hans Breuer
cbca0ac5d9 Include io.h for write() on win32 2009-05-30 15:14:01 +02:00
Hans Breuer
f4e89ab877 Replace FIXME with proper SDK version define 2009-05-30 15:02:14 +02:00
Matthias Clasen
62abf79be2 Another pedantic docs fix 2009-05-28 14:40:18 -04:00
Alexander Larsson
d32226da6d Ref the right type in g_socket_control_message_deserialize
We were not looking at the right type at all due to a typo.
2009-05-28 15:34:57 +02:00
Alexander Larsson
390549f6c4 Document g_socket_control_message_deserialize 2009-05-28 15:34:57 +02:00
Shixin Zeng
dbe7408a5c Fix string length bugs in GWinHttpFile (#580347) 2009-05-28 12:55:11 +03:00
Matthias Clasen
a859f883cf Fix make check 2009-05-28 00:30:21 -04:00
Matthias Clasen
576839adbe Fix references to nonexisting functions 2009-05-27 22:44:31 -04:00
Matthias Clasen
06144900ec Documentation and coding style fixups
Lots of pedanic changes.
2009-05-27 18:20:08 -04:00
Hans Breuer
209a662c2f Correct reference and implement close_fn (#578769)
Do proper referencing and unreferencing of
GWinHttpFileInputStream::file and
GWinHttpFileInputStream::file::vfs. Implement
GWinHttpFileInputStream::close_fn.
2009-05-27 15:12:31 +03:00
Alexander Larsson
f99be75ff9 Remove mention of non-existing calls from docs
The docs mentions a separate seekable API for the various file streams
which don't actually exists. Change this to refer to the generic
GSeekable calls.
2009-05-25 15:46:35 +02:00
Alexander Larsson
3c0feca7f1 Don't end enum with comma (#583663)
This is valid C but breaks C++, so don't put it in headers.
2009-05-25 12:47:12 +02:00
Alexander Larsson
c93c98732a Don't return something from a void function (#583408) 2009-05-25 12:46:03 +02:00
Alexander Larsson
ce171195d9 Add g_inet_address_get_native_size (#583205)
This can be used to get the size of g_inet_address_to_bytes().
2009-05-25 11:33:56 +02:00
Christian Persch
54b43229f4 Use g_error_new_valist instead of a private copy of it 2009-05-23 17:53:01 +02:00
Alexander Larsson
14d53dcfa8 Fix connect on win32
We should not wait before calling connect for non-blocking connect.
Also, use the right error code for the nonblocking pending case on win32.
2009-05-20 16:40:55 +02:00
Alexander Larsson
bb66fdcce3 Fix build on win32 2009-05-20 16:40:54 +02:00
Alexander Larsson
c897cca601 Don't add unix specific APIs on win32 2009-05-20 16:40:54 +02:00
Alexander Larsson
5a46e4d140 Clarify g_cancellable_push_current docs wrt cancellable being NULL (#575013) 2009-05-20 14:55:14 +02:00
Alexander Larsson
ab29e09dac Don't dereference identifier_type if it is NULL (#579558) 2009-05-20 14:46:51 +02:00
Robert Bragg
d0d10e847f Take a reference on the gio file monitors while signaling pending file changes
It was possible for a signal handler to remove the last reference and
dispose the monitor.  If there were remaining pending_file_changes they
tried to dereference the disposed monitor.

This patch simply calls g_object_{ref,unref} around the loop that signals
the changes.
2009-05-20 14:23:53 +02:00
Alexander Larsson
6a9df8256a Use G_GSSIZE_FORMAT where needed (#577884) 2009-05-20 14:17:27 +02:00
Sjoerd Simons
7498049a16 Propagate errors from g_network_service_address_enumerator_next_async in its _finish function 2009-05-20 13:59:50 +02:00
Jonathon Jongsma
2be66c0458 Typedef GResolverClass in the standard way
It's a bit lame, but some of our C++ wrapping scripts expect objects to be
typedefed like:
    typedef struct _FooClass FooClass;
    struct {} _FooClass;

Rather than:
    typedef struct {} FooClass;

Functionally they're the same, but the former makes our lives easier in the
short term
2009-05-20 13:58:13 +02:00
Alexander Larsson
cb7a300e31 Don't return something from void function (#583229)
g_async_initable_init_async is void, don't return something from it.
2009-05-20 13:49:47 +02:00
Christian Persch
1cbdd2495d Preserve errno when using g_set_error with _() and g_strerror() 2009-05-20 13:47:55 +02:00
Christian Persch
80cfd099f3 Use g_set_error_literal
Bug #583206.
2009-05-20 13:46:39 +02:00
Alexander Larsson
c20b8d4d53 Check that close_fn is not %NULL before calling (#578499)
Some streams have no close function, so this caused a crash.
2009-05-20 13:41:25 +02:00
Sjoerd Simons
9033b37589 Add helper functions for connecting to service (#583061) 2009-05-20 12:41:50 +02:00
Dan Winship
25800ed4a3 Ignore SIGPIPE when using GSocket
http://bugzilla.gnome.org/show_bug.cgi?id=583001
2009-05-20 12:32:58 +02:00
Alexander Larsson
2ea22d8f46 Remove non-existing parameter from docs
g_unix_socket_address_abstract_names_supported has no address argument
2009-05-20 12:14:55 +02:00
Alexander Larsson
9d36c86f8a Add missing symbols to gio.symbols 2009-05-20 12:14:55 +02:00
Alexander Larsson
5cd86fbda6 Remove protocol names, instead use an enum with common protocols
The whole protocol name thing is pretty weird. The getprotobyname functions
seem to only specify one mapping for name <-> ids, so all families/types
must use the same values. Plus the values used for the protocols are
standardized by IANA, so are always the same.

So, we drop using names for protocols, intead introducing an enum with
a few commonly availible and used protocols.
2009-05-20 12:14:50 +02:00
Alexander Larsson
6d01593b06 Clarify "current condition" in g_socket_create_source docs 2009-05-20 11:30:43 +02:00
Alexander Larsson
8088182644 Actually implement max_threads for GThreadedSocketService 2009-05-20 11:28:27 +02:00
Alexander Larsson
053f9e72b1 Add support for graceful disconnect to GTcpConnection 2009-05-20 11:19:47 +02:00
Alexander Larsson
f061765e54 Call sync close function directly in async implementation
The g_io_stream_wrapper fails since there is already an outstanding
operation (the async close).
2009-05-20 11:18:34 +02:00
Alexander Larsson
fdfdec36d0 Add send-data, a g_socket_client test case 2009-05-19 13:44:11 +02:00
Alexander Larsson
18373cfbe8 Set the listen backlog before calling listen.
If we set it after it won't be used.
2009-05-19 12:06:29 +02:00
Alexander Larsson
64383fa3d9 Fix g_unix_socket_address_abstract_names_supported docs
The previous description was a cut-n-paste from another function.
2009-05-19 11:53:42 +02:00
Alexander Larsson
0ffe722193 Add g_socket_shutdown 2009-05-19 11:52:33 +02:00
Alexander Larsson
03441e724a Document GOutputVector and GInputVector 2009-05-19 11:27:07 +02:00
Alexander Larsson
e1a4389cbc Rename g_socket_check_pending_error to g_socket_check_connect_result
This is only used for connect anyway, and this describes the operation
better.
2009-05-19 10:57:58 +02:00
Alexander Larsson
bcba61c951 Update docs on listen backlog
Mention g_socket_set_listen_backlog in g_socket_listen.
Explain that listen backlock needs to be set before calling
listen. Also verify this with a g_return_if_fail.
2009-05-19 10:47:55 +02:00
Alexander Larsson
69130db81a Read socket state in g_socket_get_local/remote_address
Previously we saved the location in various places which is unnecessary
and sometimes even wrong. For instance, we saved the address we bound to
which may not have the final port set.
2009-05-19 10:40:27 +02:00
Alexander Larsson
f8cd1c5304 Clean up refereces to @protocol_id in g_socket_new docs
This was not fully updated from the protocol to protocol_id change.
2009-05-19 10:16:32 +02:00
Alexander Larsson
3756ddb0ee Ignore error when setting SO_REUSEADDR
The main error would be "not supported" which could happen for e.g.
unix domain sockets, we don't really care, as this is mainly something
for TCP to help out a bit.
2009-05-18 23:24:13 +02:00
Alexander Larsson
f24c7fa9cb Add support for abstract unix socket addresses 2009-05-18 21:31:28 +02:00
Alexander Larsson
d8bdc3e567 Add GError to g_socket_address_to_native
This is nice for some callers so they can report an error.
It is also required to support opional address types like
abstract paths for unix domain sockets.
2009-05-18 21:31:28 +02:00
Alexander Larsson
6ea86cc57f Update the docs for the new network APIs
This imports the network APIs into the gio reference docs, and cleans
up a bunch of gtk-doc warnings and documentation issues.
2009-05-18 13:07:43 +02:00
Alexander Larsson
e1afc6e79b Remove gtk-doc warnings
Some code was using gtk-doc comment blocks for non-gtk-doc contents, just
turn it into ordinary comments.
2009-05-18 13:07:39 +02:00
Alexander Larsson
c3f4e01627 Make all non-static functions start with underscore
We don't want to export a lot of non-namespaced internal symbols.
2009-05-18 11:27:49 +02:00
Alexander Larsson
66d49b8bde Remove g_socket_set/get_reuse_address from header
These functions have been removed.
2009-05-18 09:28:26 +02:00
Alexander Larsson
13cb011762 Add max_threads argument to g_threaded_socket_service_new 2009-05-18 08:47:49 +02:00
Paul Pogonyshev
5b683af237 Fix error message in set_mtime_atime()
Bug #578786.
2009-05-17 15:17:57 +03:00
Alexander Larsson
34e74378c9 Add test apps for highlevel socket classes
echo-server - simple echo server
httpd - simple http server
2009-05-15 21:34:14 +02:00
Alexander Larsson
67df7d43e9 Add references to highlevel classes in GSocket docs 2009-05-15 21:27:54 +02:00
Alexander Larsson
ce8361217c Import all the highlevel socket classes from gnio 2009-05-15 21:26:24 +02:00
Alexander Larsson
2597e3adc3 Remove unused variable 2009-05-15 20:58:27 +02:00
Alexander Larsson
4ade78fc3d Include stdlib.h to avoid warning
Fixes a "implicit declaration of function ‘strtol’" warning
2009-05-15 20:43:02 +02:00
Alexander Larsson
d3a2c457cb Forgot to return the allocated data in async_op_wrapper_new 2009-05-15 20:42:04 +02:00
Alexander Larsson
a48fc53251 Make cancellable pipe fds close-on-exec
GCancellable is purely an in-process thing, so ensure that no cancellable
fds accidentally leak to child processes.
2009-05-15 10:42:28 +02:00
Alexander Larsson
23424e7bcb Add padding to new classes 2009-05-15 10:28:30 +02:00
Alexander Larsson
8f67f47e05 Add test apps for GSocket API 2009-05-15 10:08:18 +02:00
Alexander Larsson
a258ec3b5b Fix deadlock in threaded resolver
When you're using the threaded resolver and using a sync call
without a cancellable the resolve_sync forgot to unlock the
initial req->mutex lock, leading to a deadlock when unrefing
the request.
2009-05-15 10:05:55 +02:00
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