1. 28 Jan, 2019 1 commit
    • Ondrej Holy's avatar
      gappinfo: Add launch_uris_async() and launch_uris_finish() vfuncs · cec5778c
      Ondrej Holy authored
      The g_app_info_launch_uris_async() and g_app_info_launch_uris_finish()
      functions are crucial to fix g_app_info_launch_default_for_uri_async()
      to be really asynchronous.
      This patch also adds GDesktopAppInfo implementation of that vfuncs.
      The implementation may still use some synchronous calls to local MIME DB.
  2. 17 Dec, 2018 1 commit
  3. 23 Nov, 2018 1 commit
  4. 01 Oct, 2018 1 commit
    • Will Thompson's avatar
      gdesktopappinfo: add get_string_list() function · 5ca9eca6
      Will Thompson authored
      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
  5. 27 Jun, 2018 1 commit
  6. 21 Jun, 2018 2 commits
    • Daniel Drake's avatar
      gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant · 156d0096
      Daniel Drake authored
      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.
    • Daniel Drake's avatar
      gdesktopappinfo: enable fast posix_spawn gspawn codepath · 742efe62
      Daniel Drake authored
      In order to use the new posix_spawn gspawn codepath, for more robust
      app launching when available memory is low, we need to meet some
      child_setup needs to be NULL for this optimization to work, so drop
      the internal child_setup that is used here. Replace it with a lightweight
      wrapper binary (gio-launch-desktop) that sets GIO_LAUNCHED_DESKTOP_FILE_PID
      before executing the app.
      Adjust PATH for gio tests so that it can execute the new binary from the
      build directory.
  7. 04 May, 2018 1 commit
  8. 24 Apr, 2018 1 commit
  9. 28 Mar, 2018 1 commit
  10. 08 Jan, 2018 1 commit
  11. 08 Dec, 2017 2 commits
  12. 28 Nov, 2017 1 commit
  13. 26 Oct, 2017 1 commit
  14. 11 Sep, 2017 1 commit
  15. 23 Aug, 2017 1 commit
  16. 29 May, 2017 2 commits
    • Matthias Clasen's avatar
      Make dbus activation sandbox-aware · d3b4f7c9
      Matthias Clasen authored
      When we call org.freedesktop.Application.Open to activate
      an application and pass file uris, the application may not
      be able to see the files due to a flatpak sandbox.
      Flatpak puts the flatpak app-id in the  X-Flatpak key in
      desktop files that it exports, so we can easily recognize
      applications that may be affected by this.
      In this case, call the document portal to export the files
      and pass the resulting uri's instead of the original ones.
    • Sébastien Wilmet's avatar
      gio/: LGPLv2+ -> LGPLv2.1+ · 3bf4a720
      Sébastien Wilmet authored
      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
  17. 02 Dec, 2016 1 commit
  18. 22 Nov, 2016 1 commit
  19. 12 Oct, 2016 1 commit
  20. 07 Jun, 2016 1 commit
  21. 04 Jun, 2016 1 commit
  22. 25 Apr, 2016 1 commit
    • Allison Karlitskaya's avatar
      GDesktopAppInfo: support bus activation with '-' · 3301b852
      Allison Karlitskaya authored
      GApplication has accepted any valid bus name as an application ID since
      before the time of D-Bus activation.  This includes bus names with '-'.
      Several applications have even attempted support bus activation with
      these names, going as far as installing D-Bus service files, without
      realising that they are silently falling back to fork()/exec() on
      account of the name containing a dash.
      The reason for the problem is that D-Bus object paths cannot contain
      dashes.  We solved this problem privately in an unspecified way inside
      of GApplication but substituting '_' in this case, but never made this
      part of the Desktop Entry Specification.
      The fact that these apps with '-' in the desktop file names aren't
      actually using D-Bus activation is beside the point: their intent here
      was clear.  Let's avoid forcing them to rename their desktop files again
      by simply accepting '-' in desktop file names and munging the path in
      the way that GApplication did so historically.
      The new path escaping code here has been copied more or less verbatim
      from GApplication's own code for the same purpose, with only the removal
      of one irrelevant part.
      An update to the desktop entry specification will follow.
  23. 15 Mar, 2016 1 commit
  24. 06 Oct, 2015 1 commit
  25. 22 Apr, 2015 1 commit
    • Allison Karlitskaya's avatar
      app info: tweak default application algorithm · 2bb898c6
      Allison Karlitskaya authored
      Always run the full algorithm for a given mime type before considering
      fallback types.
      This includes considering installed applications capable of handling a
      particular mimetype, even if such an app is not explicitly marked as
      default, and there is a default app for a less-specific type.
      Specifically, this often helps with cases of installing apps that can
      handle a particular subtype of text/plain.  We want to take those apps
      in preference to a generic text editor, even if that editor is listed as
      the default for text/plain and there is no default listed for the more
      specific type.
      Because of the more holistic approach taken by the algorithm, it is now
      more complicated, but it also means that we can do more work while
      holding the lock.  In turn, that lets us avoid duplicating some strings,
      which is nice.
  26. 20 Mar, 2015 1 commit
    • Allison Karlitskaya's avatar
      substantially rework file monitors · 2737ab32
      Allison Karlitskaya authored
      Remove all event merging and dispatch logic from GFileMonitor.  The only
      implementation of GFileMonitor outside of glib is in gvfs and it already
      does these things properly.
      Get rid of GLocalDirectoryMonitor.  We will use a single class,
      GLocalFileMonitor, for both directory and file monitoring.  This will
      prevent every single backend from having to create two objects
      separately (eg: ginotifydirectorymonitor.c and ginotifyfilemonitor.c).
      Introduce GFileMonitorSource as a thread-safe cross-context dispatch
      mechanism.  Put it in GLocalFileMonitor.  All backends will be expected
      to dispatch via the source and not touch the GFileMonitor object at all
      from the worker thread.
      Remove all construct properties from GLocalFileMonitor and remove the
      "context" construct property from GFileMonitor.  All backends must now
      get the information about what file to monitor from the ->start() call
      which is mandatory to implement.
      Remove the implementation of rate limiting in GFileMonitor and add an
      implementation in GLocalFileMonitor.  gvfs never did anything with this
      anyway, but if it wanted to, it would have to implement it for itself.
      This was done in order to get the rate_limit field into the
      GFileMonitorSource so that it could be safely accessed from the worker
      Expose g_local_file_is_remote() internally for NFS detection.
      With the "is_remote" functionality exposed, we can now move all
      functions for creating local file monitors to a proper location in
      Port the inotify backend to adjust to the changes above.  None of the
      other backends are ported yet.  Those will come in future commits.
  27. 05 Feb, 2015 1 commit
  28. 15 Oct, 2014 1 commit
    • Jasper St. Pierre's avatar
      gdesktopappinfo: Fix copy/paste typo from e24e89bc · 5a0a85e4
      Jasper St. Pierre authored
      Commit e24e89bc accidentally ironically introduced a typo when replacing
      the code with symbolic contents. Specifically, "Added Associations" was
      replaced with "Default Applications" when reading defaults.list, giving
      a warning about the file containing a "Default Applications" group.
      If this was intended, it should have not been lumped in with a cleanup.
  29. 30 Sep, 2014 1 commit
  30. 16 Sep, 2014 1 commit
  31. 09 Sep, 2014 1 commit
    • Allison Karlitskaya's avatar
      GDesktopAppInfo: avoid inotify on missing dirs · 3b8bc8ba
      Allison Karlitskaya authored
      Some desktop file directories, like /usr/local/share/applications may be
      missing on some systems.
      When we try to inotify on these directories, this will result in a
      every-4-seconds poll being setup which is quite bad.
      This is an issue that should be fixed in inotify itself but the problem
      is much larger there.  For now, we can work around it in GDesktopAppInfo
      by refusing to monitor missing directories.
      We may get some spurious notifications of changes in the case that
      /usr/local/share or /usr/local/share/applications is created without
      actually adding desktop files, but spurious changes can already be
      reported in other cases, so that's OK.  We won't get (user-visible)
      notification for a simple case of a completely unrelated file being
      created (however we cannot avoid the wakeup in this case due to how
      inotify works).  That's probably pretty theoretical, though, since files
      in /usr don't change much and for the home directory we're likely to
      have at least ~/.config and ~/.local existing.
  32. 04 Sep, 2014 1 commit
    • Allison Karlitskaya's avatar
      GDesktopAppInfo: fix default app logic · 08efbda7
      Allison Karlitskaya authored
      We use "tweaks" structures to track how a particular directory impacts
      the list of added, removed and default applications.  We maintain this
      set of tweaks for each directory, in a hash table, keyed by unaliased
      mime type name, in order to facilitate fast lookups.
      A typo in the logic for creating and maintaining the uniqueness of these
      structures was causing the default app to be selected incorrectly from
      time to time.  Fix that.
  33. 08 May, 2014 2 commits
    • Allison Karlitskaya's avatar
      AppInfo: use XDG_CURRENT_DESKTOP for OnlyShowIn · 5a5e16e9
      Allison Karlitskaya authored
      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
      and a desktop file contains:
      then we will show this file because of the fallback to GNOME.  If the
      file _also_ contains the line:
      Then we will not show it, because GNOME-Classic comes before GNOME in
    • Allison Karlitskaya's avatar
      Add g_desktop_app_info_get_implementations() · 9aaf9909
      Allison Karlitskaya authored
      This provides support for the draft addition of 'Implements=' to the Desktop
      Entry specification.
  34. 15 Apr, 2014 2 commits
    • Allison Karlitskaya's avatar
      gdesktopappinfo: fix a crasher · afaee8dc
      Allison Karlitskaya authored
      During the time that we are expanding the strv, it is not
      null-terminated.  Use the strv_len variable instead to bound the search
      for duplicates.
    • Allison Karlitskaya's avatar
      GDesktopAppInfo: rewrite content type code · 6fd5a8cd
      Allison Karlitskaya authored
      Redo the code for type-based selection of applications (all,
      recommended, default, fallback) based on the new DesktopFileDir
      structures that we introduced last cycle.
      At the same time, we expand the functionality to add support for the new
      features of the specification:
       - moving ~/.local/share/applications/mimeapps.list to ~/.config/
       - per-desktop default applications (via XDG_CURRENT_DESKTOP)
       - sysadmin customisation of defaults (via /etc/xdg/mimeapps.list)
       - deprecation of the old defaults.list, favouring the use of
         /usr/share/applications/mimeapps.list (or gnome-mimeapps.list) to
         accomplish the same
      We modify the mimeapps testcase to check for mimeapps.list having been
      created in XDG_CONFIG_HOME instead of XDG_DATA_HOME.
      The modification is a net reduction of code (due to less duplication in
      bookkeeping).  It is also an increase in performance and reduction in
      memory consumption (due to simplified data structures).  Finally, it
      removes the stat-based timestamp checking in favour of the
      GFileMonitor-based approach that was already being used in the
      implementation of DesktopFileDir (in order to know if we had to rescan
      the desktop files themselves).
  35. 12 Apr, 2014 1 commit