Commit Graph

371 Commits

Author SHA1 Message Date
Matthias Clasen
e5734c37a6 Add g_list_store_sort
GListStore already has a g_list_store_insert_sorted function,
which can be used to keep the list sorted according to a fixed
sort function. But if the sort function changes (as e.g. with
sort columns in a list UI), the entire list needs to be
resorted. In that case, you want g_list_store_sort().

https://bugzilla.gnome.org/show_bug.cgi?id=754152
2015-08-31 10:40:45 -04:00
Debarshi Ray
fa0f51ddf8 fileinfo: Add a G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE attribute
This is meant for opaque, non-POSIX-like backends to indicate that the
URI is not persistent. Applications should look at
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI.
Examples of such backends could be a portal for letting sandboxed
applications access the file-system, or a database-backed storage like
Google Drive.

In these cases, the user visible file and folder names are different
from the real identifiers, used by the backend. So, a request to
create google-drive://user@gmail.com/foo/New\ File, would actually
lead to google-drive://user@gmail.com/foo/bar on the server even though
the user visible name is still "New File". Since the server-defined URI
is persistent and sanity-checked by the backend, it is recommended that
applications switch to it as soon as possible. Backends will try to
keep a mapping from "fake" to "real" URIs, but those are only on a
best effort basis. They might not be persistent or have the same
guarantees as the "real" URIs.

https://bugzilla.gnome.org/show_bug.cgi?id=741602
2015-08-20 18:40:02 +02:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Richard Hughes
a80e7db1a8 gio: Add network metered information to GNetworkMonitor
Add a property to GNetworkMonitor indicating if the network
is metered, e.g. subject to limitations set by service providers.

The default value is FALSE

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-27 06:44:52 -04:00
Xavier Claessens
73a71d6a43 doc: Add missing GTlsDatabaseClass
https://bugzilla.gnome.org/show_bug.cgi?id=750573
2015-06-08 16:04:53 -04:00
Matthias Clasen
1405eeeed7 Add registry helpers to the docs 2015-06-05 19:13:19 -04:00
Matthias Clasen
01e9302673 Add new API to docs 2015-06-05 15:27:25 -04:00
Xavier Claessens
0d8dd2cf5c doc: add GTlsInteractionClass
https://bugzilla.gnome.org/show_bug.cgi?id=750344
2015-06-03 10:19:02 -04:00
Alexander Larsson
f8273f39a1 Add GNativeSocketAddress for handling "other" addresses
Instead of just dropping address types that we're not specifically
handling we return a GNativeSocketAddress which is just a dummy
container for the stuct sockaddr.

https://bugzilla.gnome.org/show_bug.cgi?id=750203
2015-06-03 08:52:54 +02:00
Ross Lagerwall
495d864e43 docs: Fix documentation for 95d300eac5 2015-04-07 18:23:39 +01:00
Paolo Borelli
b64e2956f6 Add an event signal to GSocketListener
This allows the caller to know when a socket has been bound so that
it can for instance set the SO_SENDBUF and SO_RECVBUF socket options
before listen is called

https://bugzilla.gnome.org/show_bug.cgi?id=738207
2015-04-04 21:26:15 +02:00
Ryan Lortie
eff505ed3c docs: more cleanups for GIO 2015-03-12 16:43:02 -04:00
Xavier Claessens
15a4af545e Doc: Mark a few things as private 2015-03-12 16:09:14 -04:00
Philip Withnall
4f1f68e6be gtask: Add a GTask:completed property
This can be used to query whether the task has completed, in the sense
that it has had a result set on it, and has already – or will soon –
invoke its callback function.

Notifications for this property are emitted immediately after the task’s
main callback, in the same main context as that callback. This allows
for multiple bits of code to listen for completion of the GTask, which
opens the door for blocking on cancellation of the GTask and improved
handling of ‘pending’ behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=743636
2015-03-10 08:37:45 +00:00
Ryan Lortie
73d4e6f12f Rename g_unix_mount_monitor_new() to _get()
This is a singleton, but we have a function called _new() to get it.
What's worse is that the documentation makes no mention of this, and
actually specifically says that a new monitor will be created each time.

https://bugzilla.gnome.org/show_bug.cgi?id=742599
2015-03-02 15:10:46 -05:00
Colin Walters
52cd62d946 filenumerator: Add g_file_enumerator_iterate()
This is *significantly* more pleasant to use from C (while handling
errors and memory cleanup).

While we're here, change some ugly, leaky code in
tests/desktop-app-info.c to use it, in addition to a test case
in tests/file.c.

https://bugzilla.gnome.org/show_bug.cgi?id=661554
2015-02-20 14:02:05 -05:00
Lars Uebernickel
b4ef6d957f gapplication: add "is-busy"
A property to query the current busy state of an application.

https://bugzilla.gnome.org/show_bug.cgi?id=744756
2015-02-19 08:39:55 +01:00
Lars Uebernickel
2d3d8cdce2 gapplication: tune busy-binding
g_application_bind_busy_property() had the restriction that only one
property can be bound per object, so that NULL could be used to unbind.
Even though this is enough for most uses, it is a weird API.

Lift that restriction and add an explicit unbind function.

https://bugzilla.gnome.org/show_bug.cgi?id=744565
2015-02-18 20:17:03 +01:00
Ignacio Casal Quinteiro
d4e3b82a93 Add GSimpleIOStream class
GSimpleIOStream represents an object that wraps an input and an output
stream making easy to use them by calling the #GIOStream methods.

https://bugzilla.gnome.org/show_bug.cgi?id=741630
2015-02-17 16:27:46 -05:00
Lars Uebernickel
0f2b54142a gapplication: add bind_busy_property()
Balancing g_application_{un,}mark_busy() is non-trivial in some cases.

Make it a bit more convenient by allowing to bind multiple boolean
properties (from different objects) to the busy state. As long as these
properties are true, the application is marked as busy.

https://bugzilla.gnome.org/show_bug.cgi?id=744565
2015-02-16 07:38:43 +01:00
Xavier Claessens
74c22150cf docs: fix up docs issues in gio/ 2015-02-05 16:20:43 +01:00
Xavier Claessens
caf9db2dfb Doc: Fix GListModel/GListStore 2015-02-04 15:07:14 +01:00
Ryan Lortie
3f3eac474b GListStore: add sorted insert function
Add g_list_store_insert_sorted() which takes a GCompareDataFunc to
decide where to insert.  This ends up being a very trivial function,
thanks to GSequence.

https://bugzilla.gnome.org/show_bug.cgi?id=743927
2015-02-03 15:46:48 +01:00
Lars Uebernickel
b69beff426 Add GListModel
GListModel is an interface that represents a dynamic list of GObjects.

Also add GListStore, a simple implementation of GListModel that stores
all objects in memory, using a GSequence.

https://bugzilla.gnome.org/show_bug.cgi?id=729351
2015-01-30 15:08:57 +01:00
Lars Uebernickel
6d55189d8c gsettings: add g_settings_schema_list_children
https://bugzilla.gnome.org/show_bug.cgi?id=743517
2015-01-28 18:09:28 +00:00
Lars Uebernickel
d95bb1f08b gsettings: add g_settings_schema_key_get_name
https://bugzilla.gnome.org/show_bug.cgi?id=743517
2015-01-28 18:09:28 +00:00
Cosimo Cecchi
be2d9b4f58 GSimpleAction: add g_simple_action_set_state_hint
Currently the only way to set a state hint on an action is through a
subclass; add a g_simple_action_set_state_hint() method so that this
becomes easier for clients that already use GSimpleAction.

https://bugzilla.gnome.org/show_bug.cgi?id=743521
2015-01-26 12:06:24 +00:00
Matthias Clasen
169eae47e5 gio: Add missing symbols to docs 2014-12-15 13:17:15 -05:00
Dan Winship
64f9bf96fd gnetworkaddress: Add g_network_address_new_loopback() constructor
This is a convenience method for creating a GNetworkAddress which is
guaranteed to return IPv4 and IPv6 loopback addresses. The program
cannot guarantee that 'localhost' will resolve to both types of
address, so programs which wish to connect to a local service over
either IPv4 or IPv6 must currently manually create an IPv4 and another
IPv6 socket, and detect which of the two are working. This new API
allows the existing GSocketConnectable machinery to be used to
automate that.

Based on a patch from Philip Withnall.

https://bugzilla.gnome.org/show_bug.cgi?id=732317
2014-11-29 14:22:42 -05:00
Jonas Danielsson
bf9c862504 GApplication: Add g_application_add_main_option
This function adds a single main option entry to be handeled by
GApplication. The option entry has it arg_data field set to NULL
and will be added to the applications packed_options.

The rationale for this is that bindings will be able to add
command line options even when they can't use the un-boxed struct
GOptionEntry.

https://bugzilla.gnome.org/show_bug.cgi?id=727455
2014-08-20 16:02:59 +02:00
Ryan Lortie
cea9de93c8 GApplication: add a "resource base path"
We don't use this for anything inside of GApplication yet, but Gtk is
about to start using it to find various bits of the application (such as
its menus, icons, etc.).

By default, we form the base path from the application ID to end up with
the familiar /org/example/app style.

https://bugzilla.gnome.org/show_bug.cgi?id=722092
2014-07-07 13:40:03 -04:00
Matthias Clasen
abd4df4b55 docs: Add some missing apis 2014-05-31 10:54:02 -04:00
Sébastien Wilmet
54d1751fd8 doc: better ordering of GSubprocessLauncher functions
Take the same order as the header.
2014-05-12 00:25:06 +02:00
Ryan Lortie
0b27719293 docs: add two missing symbols on GDesktopAppInfo
https://bugzilla.gnome.org/show_bug.cgi?id=712391
2014-05-08 16:19:50 -04:00
David King
25f36d8e5e Add g_application_command_line_get_options_dict() to docs 2014-03-10 19:16:28 +00:00
Dan Winship
5575a3e9cb gio: don't accept nonstandard IPv4 "numbers-and-dots" addresses
In addition to the standard "192.168.1.1" format, there are numerous
legacy IPv4 address formats (such as "192.168.257",
"0xc0.0xa8.0x01.0x01", "0300.0250.0001.0001", "3232235777", and
"0xc0a80101"). However, none of these forms are ever used any more
except in phishing attempts. GLib wasn't supposed to be accepting
these addresses (neither g_hostname_is_ip_address() nor
g_inet_address_new_from_string() recognizes them), but getaddrinfo()
accepts them, and so the parts of gio that use getaddrinfo()
accidentally did accept those formats.

Fix GNetworkAddress and GResolver to reject these address formats.

https://bugzilla.gnome.org/show_bug.cgi?id=679957
2014-02-15 10:22:24 -05:00
Ryan Lortie
0e671286fc GApplication: parse command line options
Add support for parsing command line options with GApplication.

You can add GOptionGroup and GOptionEntry using two new APIs:
g_application_add_option_group() and
g_application_add_main_option_entries().

Also add a "handle-local-options" signal that allows handling of
commandline arguments in the local process without having to override
local_command_line.

As a special feature, you can have a %NULL @arg_data in a GOptionEntry
which will cause the argument to be stored in a GVariantDict.  This
dictionary is available for inspection and modification by the
"handle-local-options" signal and can be forwarded to the primary
instance in cases of command line invocation (where it can be fetched
using g_application_command_line_get_options()).

https://bugzilla.gnome.org/show_bug.cgi?id=721977
2014-02-06 12:02:53 +00:00
Xavier Claessens
c4e9135352 GFile: add GBytes version of _replace_contents_async()
https://bugzilla.gnome.org/show_bug.cgi?id=690525
2013-12-02 14:45:42 -05:00
Ryan Lortie
e55d33edc1 Add GAppInfoMonitor
This is a simple object that emits a "change" signal when the installed
applications may have changed in some way.

https://bugzilla.gnome.org/show_bug.cgi?id=711556
2013-11-06 11:26:53 -05:00
Ryan Lortie
bcb030a474 GSettingsSchemaKey: add introspection APIs
Add g_settings_schema_has_key() and _get_range(), _range_check(),
_get_value_type(), _get_default_value() methods on GSettingsSchemaKey.

Deprecate the equivalent APIs on GSettings.

https://bugzilla.gnome.org/show_bug.cgi?id=683017
2013-10-28 11:31:48 -07:00
Ryan Lortie
bebdfb8e62 GSettings: add getters for user/default value
Add two new APIs: g_settings_get_user_value() and
g_settings_get_default_value().   Together, these should allow the
inspection of all interesting cases of "is this key set?" and "what
would happen if I reset this key?"

https://bugzilla.gnome.org/show_bug.cgi?id=668233
2013-10-28 10:19:49 -07:00
Stef Walter
65af7c47ff Add a request_certificate virtual method to GTlsInteraction
This allows GTlsConnection implementations to request a certificate
from the user.

Fix ups by Dan Winship <danw@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=637257
2013-10-28 09:36:26 +01:00
Ryan Lortie
6f386341bd Add g_settings_schema_source_list_schemas()
g_settings_list_schemas() and g_settings_list_relocatable_schemas() are
now deprecated.

This will allow listing off schemas on non-default sources and is a
better fit with the new direction the API is going.

https://bugzilla.gnome.org/show_bug.cgi?id=680838
2013-10-27 17:12:57 -07:00
Ryan Lortie
96a053e025 Add g_settings_schema_key_get_summary/description
Add an API to read the summary and description from the .xml schema
files.

This will be used by dconf-editor and gnome-tweak-tool.

This API is a bit heavy -- it parses the XML and builds a table.  It
also loads gettext domains for translation.  It only does these things
if it is used, however, so it will not impact normal applications.

We store the summary/description in a pair of hash tables on the schema
source (which we have a backref to as of a few commits ago).  We can't
use a global table because people might want to request summary and
description from non-default sources.  We don't want to use per-schema
tables because we'd have to reparse the directory every time (since we
cannot guess which file a schema may have been in).

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 10:42:55 -07:00
Ryan Lortie
84fa07aeb1 Make GSettingsSchemaKey public
Take this private API and make it public along with a boxed type and
ref/unref functions.

Future commits will add accessors with new functionality and some that
allow us to deprecate functions on GSettings itself (such as
g_settings_get_range).

https://bugzilla.gnome.org/show_bug.cgi?id=668232
2013-10-27 10:42:50 -07:00
Ryan Lortie
fe7069749f file-info: Add a G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID attribute
This indicates whether the thumbnail (given by G_FILE_ATTRIBUTE_THUMBNAIL_PATH)
is valid — i.e. to represent the file in its current state. If
G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID is FALSE (for a normal _or_ failed
thumbnail) it means the file has changed since the thumbnail was generated, and
the thumbnail is out of date.

Part of checking thumbnail validity (by the spec) involves parsing
headers out of the thumbnail .png so we include some (small) code to do
that in a separate file.  We will likely want to copy this code to gvfs
to do the same for GVfsFile.

Heavily based on a patch from Philip Withnall <philip.withnall@collabora.co.uk>
who suggested the feature and designed the API.

https://bugzilla.gnome.org/show_bug.cgi?id=709898
2013-10-23 11:56:28 -04:00
Ryan Lortie
6957004007 GNotification: finish documentation
Add the missing documentation and add the section to the GIO reference
docs.  Fix up a few small documentation issues.

https://bugzilla.gnome.org/show_bug.cgi?id=688492
2013-10-21 14:30:30 -04:00
Matthias Clasen
c848323948 Fix up subprocess docs
The GSubprocessLauncher docs had their own long description,
but were not properly set up as their own section.
2013-10-17 20:55:53 -04:00
Matthias Clasen
71534d9d62 Fix up gio-sections.txt 2013-10-17 20:45:32 -04:00
Ryan Lortie
542ad4db03 Fixup GSubprocess documentation bits 2013-10-17 15:01:42 -04:00