Commit Graph

48 Commits

Author SHA1 Message Date
Xavier Claessens
e5565f6635 Rename all visibility macros 2022-10-13 20:53:56 -04:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Philip Withnall
b4d58a7105 glib, gio: Use GLIB_DEPRECATED_MACRO instead of G_DISABLE_DEPRECATED
When defining deprecated macros, annotate them with
`GLIB_DEPRECATED_MACRO_IN_*()` and `GLIB_DEPRECATED_MACRO_IN_*_FOR()` to
conditionally emit warnings if people use them, depending on their
declared minimum and maximum GLib version requirements (see
`GLIB_VERSION_MIN_REQUIRED` and `GLIB_VERSION_MAX_ALLOWED`).

The old way of doing this was for users to define `G_DISABLE_DEPRECATED`
if they didn’t want to use deprecated APIs, but it reported errors via
missing symbols, and wasn’t version-dependent. It’s being phased out.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
9bfd7e2a9d gdesktopappinfo: Add deprecation version to GDesktopAppInfoLookup
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Will Thompson
5ca9eca632 gdesktopappinfo: add get_string_list() function
The X-Flatpak-RenamedFrom key is used in .desktop files to identify past
names for the desktop file. It is defined to be a list of strings.
However, there was previously no correct way to retrieve a list of
strings from the GKeyFile wrapped by GDesktopAppInfo, short of
re-parsing the file with GKeyFile.

Note that doing something like:

    g_strsplit (g_desktop_app_info_get_string (...), ";", -1)

is not correct: the raw value "a\;b;" represents the one-element list
["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so
g_desktop_app_info_get_string() returns NULL in this case. (Of course, a
.desktop file with a semicolon in its name is a pathological case.)

Add g_desktop_app_info_get_string_list(), a trivial wrapper around
g_key_file_get_string_list(), similar to g_desktop_app_info_get_string()
and co.

The change from g_key_file_free() to g_key_file_unref() in the test is
needed because g_key_file_free() clears the contents of the keyfile.
This is fine for all the fields which are eagerly loaded and copied into
GDesktopAppInfo, but not when we want to access arbitrary stuff from the
keyfile.
2018-10-01 20:03:55 +01:00
Daniel Drake
156d009696 gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant
Add an app-launching function which allows standard file descriptors
to be passed to the child process.

This will be used by gnome-shell to pass systemd journal descriptors
as stdout/stderr. gnome-shell's child_setup function can then be
eliminated, which will enable use of the posix_spawn optimized
gspawn codepath for desktop app launching.
2018-06-21 11:44:59 -05:00
Florian Müllner
a55bfeee41 gdesktopappinfo: Add g_desktop_app_info_get_locale_string()
Custom desktop file fields may be translated, but there is currently
no non-hacky way to look up the localized value; fill get gap with
a small wrapper around g_key_file_get_locale_string().

https://bugzilla.gnome.org/show_bug.cgi?id=779413
2018-01-08 16:28:34 +01:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Xavier Claessens
74c22150cf docs: fix up docs issues in gio/ 2015-02-05 16:20:43 +01:00
Ryan Lortie
e2f8afdd85 gio: add support for g_auto() and g_autoptr()
Add support to libgio types for the new cleanup macros.

https://bugzilla.gnome.org/show_bug.cgi?id=743640
2015-01-30 16:58:40 +01:00
Ryan Lortie
5a5e16e93c AppInfo: use XDG_CURRENT_DESKTOP for OnlyShowIn
Expand the functionality of g_desktop_app_info_set_desktop_env() to
include the possibility of passing strings containing ':' characters (as
some apps, such as gnome-session, are directly passing the value of
XDG_CURRENT_DESKTOP).  At the same time, deprecate it, since now we get
the list from the environment variable for ourselves.

Modify the checks in g_desktop_app_info_get_show_in() to deal with
multiple items listed in XDG_CURRENT_DESKTOP.  For example, if we find
that we have

  XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME

and a desktop file contains:

  OnlyShowIn=GNOME

then we will show this file because of the fallback to GNOME.  If the
file _also_ contains the line:

  NotShowIn=GNOME-Classic

Then we will not show it, because GNOME-Classic comes before GNOME in
XDG_CURRENT_DESKTOP.

https://bugzilla.gnome.org/show_bug.cgi?id=729813
2014-05-08 16:19:56 -04:00
Ryan Lortie
9aaf990960 Add g_desktop_app_info_get_implementations()
This provides support for the draft addition of 'Implements=' to the Desktop
Entry specification.

https://bugzilla.gnome.org/show_bug.cgi?id=712391
2014-05-08 16:19:05 -04:00
Volker Sobek
9f0ad54c80 docs: Use markdown links in all .c and .h files
Commit e7fd3de86d already did most of this.

https://bugzilla.gnome.org/show_bug.cgi?id=728285
2014-04-15 22:19:07 +02:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Ryan Lortie
3d32d5359a Add g_desktop_app_info_search()
The first time this function is called we load all of the keyfiles in
the directory, ignoring the 'Hidden' ones and build an index out of the
interesting fields using g_str_tokenize_and_fold().

We do prefix matching on the tokens to find relevent desktop files.

Right now this is implemented as a hashtable that we iterate over,
checking prefixes on each token.  This could possibly be sped up by
creating an array, but it's already pretty fast...

https://bugzilla.gnome.org/show_bug.cgi?id=711557
2013-11-07 12:41:27 -05:00
Ryan Lortie
6dc5c118e4 Implement the Desktop Action specification
For some time, the desktop file specification has supported "additional
application actions".  This is intended to allow for additional methods
of starting an app, such as a mail client having a "Compose New Message"
action that brings up the compose window instead of the folder list.

This patch adds support for this with a relatively minimal API.

In the case that the application is a GApplication and DBusActivatable,
desktop actions are translated into GActions that have been added to the
application with g_action_map_add_action().  This more or less closes
the loop on being able to activate an application with an action
invocation (instead of 'activate').

https://bugzilla.gnome.org/show_bug.cgi?id=664444
2013-07-11 12:48:08 -04:00
Ryan Lortie
0156092a42 various: add GLIB_AVAILABLE_IN_ALL everywhere else
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).

If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:11:57 -05:00
Ryan Lortie
52c608dd0d gio: GLIB_AVAILABLE_IN to more APIs
Useful on its own, but also for a future patch for symbol visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2012-11-29 14:07:27 -05:00
Matthias Clasen
4adbc7aa42 GDesktopAppInfo: add enough api to make autostart implementable
gnome-session still uses EggDesktopFile, since GDesktopAppInfo is
missing a handful of APIs that are needed to implement the
autostart spec. This patch adds the minimum that is required.

https://bugzilla.gnome.org/show_bug.cgi?id=688497
2012-11-21 21:12:45 -05:00
Giovanni Campagna
bb7f3e0cbd GDesktopAppInfo: add an accessor for StartupWMClass
Components using GIO to do window to application matching can
use that field to retrieve potential candidates.

https://bugzilla.gnome.org/show_bug.cgi?id=673659
2012-04-14 02:44:25 +02:00
Matthias Clasen
d0b429af48 Revert "GDesktopAppInfo: add an accessor for StartupWMClass"
This reverts commit 3ccc4cf91d.
2012-04-06 19:15:53 -04:00
Giovanni Campagna
3ccc4cf91d GDesktopAppInfo: add an accessor for StartupWMClass
Components using GIO to do window to application matching can
use that field to retrieve potential candidates.

https://bugzilla.gnome.org/show_bug.cgi?id=673659
2012-04-07 00:22:02 +02:00
Matthias Clasen
5896808e8c GIO: Don't use G_DISABLE_DEPRECATED for functions 2011-11-03 00:16:41 -04:00
Florian Müllner
1ed88f0615 desktop-app-info: Add support for X-GNOME-Keywords
With search gaining traction as being the preferred way to locate
applications, the existing .desktop file fields meant for browsing
often produce insufficient results.
gnome-control-center introduced a custom X-GNOME-Keywords field for
that purpose, which we plan to support in gnome-shell as well.

https://bugzilla.gnome.org/show_bug.cgi?id=661763
2011-10-14 23:30:21 +02:00
Matthias Clasen
ff2dafb209 Add G_GNUC_DEPRECATED to deprecated functions in gio 2011-10-08 23:49:04 -04:00
Vincent Untz
ae7c48b955 GDesktopAppInfo: Add g_desktop_app_info_get_show_in()
Necessary for rebasing gnome-menus on top of GDesktopAppInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=655044
2011-07-23 10:05:12 +02:00
Vincent Untz
b87d9405be GDesktopAppInfo: Fix declaration of g_desktop_app_info_get_nodisplay 2011-06-14 09:01:25 +02:00
Vincent Untz
86ffdf5570 GDesktopAppInfo: Add g_desktop_app_info_get_nodisplay
Necessary for rebasing gnome-menus on top of GDesktopAppInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=652385
2011-06-14 08:53:48 +02:00
Colin Walters
4098ddcb06 GDesktopAppInfo: Add g_desktop_app_info_get_generic_name
Necessary for rebasing gnome-menus on top of GDesktopAppInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=647967
2011-04-27 11:34:43 -04:00
Colin Walters
276e6a7be8 GDesktopAppInfo: Add g_desktop_app_info_get_categories()
This is needed to rebase gnome-menus on top of GDesktopAppInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=647903
2011-04-27 11:24:37 -04:00
Colin Walters
0b59cf6566 g_desktop_app_info_launch_uris_as_manager: Fix parameter naming
This makes introspection happier.
2011-01-05 13:49:20 -05:00
Colin Walters
9be6da9448 Add missing indirection from previous commit
This follows the rest of GLib style, and fixes g-i scanning the
headers.
2011-01-05 13:02:28 -05:00
Colin Walters
e6546debd6 gdesktopappinfo: Add g_desktop_app_info_launch_uris_as_manager()
A new GDesktopAppInfo specific function which provides more control
over launched processes.  Intended basically only for use in GNOME
Shell, where we want:

*) To directly know the GPid for each launched program, without
   having to listen to a DBus signal emitted in our own process
*) Possibly control over the process environment; for example,
   we may want to call setsid() or redirect file descriptors.

And in the future:
*) To avoid recursively calling ourself via DBus, when a later
   patch causes g_app_info_launch() to indirect via the shell.

https://bugzilla.gnome.org/show_bug.cgi?id=606960
2011-01-05 11:58:07 -05:00
Benjamin Otte
fb94859e84 API: Reinstate "gio-desktop-app-info-lookup" extension point
Removing an extension point is an API and ABI break. In particular, it
causes (older) gvfs versions to fail loading with a linkage error from
ld which in turn makes the desktop unusable.
So this reinstate the extension point and API provided by it, but
deprecates and does not use it. So no functionality is changed.

This reverts parts of commit 9b262f1c5f.

Complaints-Also-To: Ryan Lortie <desrt@desrt.ca>
2010-11-09 21:13:04 -05:00
Bastien Nocera
9b262f1c5f Replace "gio-desktop-app-info-lookup" extension point
With a native version, that looks for desktop items supporting
x-scheme-handler/foo, when looking for a handler for the "foo"
URI scheme handler.

https://bugzilla.gnome.org/show_bug.cgi?id=631410
2010-10-05 17:15:37 +01:00
Colin Walters
f552689058 [GDesktopAppInfo] New function g_desktop_app_info_get_filename
This allows access to the full file path, where possible.

https://bugzilla.gnome.org/show_bug.cgi?id=612832
2010-03-14 15:45:46 -04:00
Michael Natterer
f2a2d6c9ac big header formatting cleanup: indentation, vtable formatting, consistent
2008-09-02  Michael Natterer  <mitch@imendio.com>

	* *.h: big header formatting cleanup: indentation, vtable
	formatting, consistent spacing in (* vfunc), trailing whitespace
	removal. Formatting should be pretty consistent in all GIO headers
	now.


svn path=/trunk/; revision=7433
2008-09-02 19:05:58 +00:00
Matthias Clasen
981f9ed840 Avoid a filename conflict
svn path=/trunk/; revision=7192
2008-07-16 06:30:12 +00:00
Matthias Clasen
9d82224015 Add a function to create a GDesktopAppInfo from a GKeyFile. Proposed by
* gio.symbols:
        * gdesktopappinfo.[hc]: Add a function to create a
        GDesktopAppInfo from a GKeyFile. Proposed by Josselin Mouette.


svn path=/trunk/; revision=7143
2008-07-02 16:23:23 +00:00
Matthias Clasen
c8f43a1bb6 Add more docs
svn path=/trunk/; revision=6493
2008-02-11 07:17:48 +00:00
Matthias Clasen
826d8c5b41 Documentation additions
svn path=/trunk/; revision=6492
2008-02-11 07:12:56 +00:00
Alexander Larsson
e61e022333 giomodule-priv.h include moved to .c file.
2008-01-29  Alexander Larsson  <alexl@redhat.com>

        * gdesktopappinfo.c:
        * gdesktopappinfo.h:
	giomodule-priv.h include moved to .c file.



svn path=/trunk/; revision=6416
2008-01-29 15:11:54 +00:00
Alexander Larsson
431fef8617 Add g_file_query_default_handler utility to easily look up the GAppInfo
2008-01-29  Alexander Larsson  <alexl@redhat.com>

        * gfile.[ch]:
        Add g_file_query_default_handler utility to easily look up
	the GAppInfo that handles a file.
	
        * gdesktopappinfo.[ch]:
        * giomodule.c:
	Set up an extension point for g_app_info_get_default_for_uri_scheme()
	
        * gvfs.c:
	Remove unused function



svn path=/trunk/; revision=6409
2008-01-29 12:18:48 +00:00
Alexander Larsson
8af463f939 Add g_app_info_supports_files() Remove desktop arg from
2008-01-04  Alexander Larsson  <alexl@redhat.com>

        * gappinfo.[ch]:
        * gwin32appinfo.c:
        * gio.symbols:
	Add g_app_info_supports_files() 
        Remove desktop arg from g_app_info_should_show().
	
        * gdesktopappinfo.[ch]:
	Implement g_app_info_supports_files() and new should_show()
	Add g_desktop_app_info_set_desktop_env() to set the desktop
	for should_show(). (This will be set by gtk+ later)


svn path=/trunk/; revision=6242
2008-01-04 10:51:56 +00:00
Alexander Larsson
ced2927726 Only allow including <gio/gio.h> from apps
2007-12-14  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * fam/Makefile.am:
        * gappinfo.h:
        * gasyncresult.h:
        * gbufferedinputstream.h:
        * gbufferedoutputstream.h:
        * gcancellable.h:
        * gcontenttype.h:
        * gdatainputstream.h:
        * gdataoutputstream.h:
        * gdesktopappinfo.h:
        * gdirectorymonitor.h:
        * gdrive.h:
        * gfile.h:
        * gfileattribute.h:
        * gfileenumerator.h:
        * gfileicon.h:
        * gfileinfo.h:
        * gfileinputstream.h:
        * gfilemonitor.h:
        * gfilenamecompleter.h:
        * gfileoutputstream.h:
        * gfilterinputstream.h:
        * gfilteroutputstream.h:
        * gicon.h:
        * ginputstream.h:
        * gio.h:
        * gioerror.h:
        * giomodule.h:
        * gioscheduler.h:
        * gloadableicon.h:
        * gmemoryinputstream.h:
        * gmemoryoutputstream.h:
        * gmount.h:
        * gmountoperation.h:
        * goutputstream.h:
        * gseekable.h:
        * gsimpleasyncresult.h:
        * gthemedicon.h:
        * gunixinputstream.h:
        * gunixmounts.h:
        * gunixoutputstream.h:
        * gvfs.h:
        * gvolume.h:
        * gvolumemonitor.h:
        * inotify/Makefile.am:
	Only allow including <gio/gio.h> from apps


svn path=/trunk/; revision=6117
2007-12-14 10:35:24 +00:00
Matthias Clasen
355d85b171 Install gdesktopappinfo as unix-specific api
svn path=/trunk/; revision=6090
2007-12-10 18:51:21 +00:00
Alexander Larsson
d9594f5709 Removed unnecessary file
2007-11-28  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * gdriveprivate.h:
	Removed unnecessary file
	
        * gdesktopappinfo.[ch]:
        * gdummyfile.[ch]:
        * gfile.c:
        * glocaldirectorymonitor.[ch]:
        * glocalfile.[ch]:
        * glocalfileenumerator.[ch]:
        * glocalfileinputstream.[ch]:
        * glocalfilemonitor.[ch]:
        * glocalfileoutputstream.[ch]:
        * glocalvfs.[ch]:
        * gnativevolumemonitor.c:
        * gpollfilemonitor.[ch]:
        * gunionvolumemonitor.[ch]:
        * gunixdrive.[ch]:
        * gunixvolume.[ch]:
        * gunixvolumemonitor.[ch]:
        * gvfs.c:
        * gvolumeprivate.h:
        * inotify/ginotifydirectorymonitor.[ch]:
        * inotify/ginotifyfilemonitor.[ch]:
        * inotify/inotify-helper.c:
	Append _ to all internal functions
	
        * gio.symbols:
	Add missing symbols
	Export symbols needed for modules


svn path=/trunk/; revision=5977
2007-11-28 16:01:59 +00:00
Alexander Larsson
3781343738 gio/ docs/reference/gio Merged gio-standalone into glib.
2007-11-26  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * configure.in:
        * gio-2.0-uninstalled.pc.in:
        * gio-2.0.pc.in: 
        * gio-unix-2.0-uninstalled.pc.in:
        * gio-unix-2.0.pc.in:
	* gio/
	* docs/reference/gio
	Merged gio-standalone into glib.
	
        * glib/glibintl.h:
        * glib/gutils.c:
	Export glib_gettext so that gio can use it
	Add P_ (using same domain for now)
	Add I_ as g_intern_static_string


svn path=/trunk/; revision=5941
2007-11-26 16:13:05 +00:00