GNU bug report logs - #36376
Application menu of desktop environment not automatically updated

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Tue, 25 Jun 2019 14:13:01 UTC

Severity: important

Merged with 35594, 41298

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 36376 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Leo Prikler <leo.prikler <at> student.tugraz.at>, 36376 <at> debbugs.gnu.org
Subject: Re: bug#36376: Application menu of desktop environment not
 automatically updated
Date: Thu, 05 Nov 2020 01:38:25 -0500
[Message part 1 (text/plain, inline)]
Hi Ludovic!

> +static void
> +guix_profile_changed  (GFileMonitor      *monitor,
> +                       GFile             *file,
> +                       GFile             *other_file,
> +                       GFileMonitorEvent  event_type,
> +                       gpointer           user_data)
> +{
> +  DesktopFileDir *dir = user_data;
> +
> +  desktop_file_dir_reset (dir);
> +
> +  /* When ~/.guix-profile changes, emit the 'changed' signal so everyone
> +     knows.  */
> +  g_app_info_monitor_fire ();
> +}
> +
>  static void
>  desktop_file_dir_changed (GFileMonitor      *monitor,
>                            GFile             *file,
> @@ -1531,6 +1548,7 @@ desktop_file_dirs_lock (void)
>
>    if (desktop_file_dirs == NULL || desktop_file_dirs->len == 0)
>      {
> +      const gchar *home;
>        const char * const *dirs;
>        gint i;
>
> @@ -1555,6 +1573,27 @@ desktop_file_dirs_lock (void)
>        for (i = 0; dirs[i]; i++)
>          g_ptr_array_add (desktop_file_dirs, desktop_file_dir_new (dirs[i]));
>
> +      home = g_get_home_dir ();
> +      if (guix_profile_monitor == NULL && home != NULL)
> +        {
> +          DesktopFileDir *dir;
> +          const gchar *profile, *data_dir;
> +          profile = g_build_filename (home, ".guix-profile", NULL);
> +          data_dir = g_build_filename (profile, "share", NULL);
> +          dir = desktop_file_dir_new (data_dir);
> +
> +          /* Monitor ~/.guix-profile and treat modifications to
> +             ~/.guix-profile as if they were modifications to
> +             ~/.guix-profile/share.  */
> +          guix_profile_monitor =
> +            g_local_file_monitor_new_in_worker (profile, FALSE, G_FILE_MONITOR_NONE,
> +                                                guix_profile_changed,
> +                                                desktop_file_dir_ref (dir),
> +                                                closure_notify_cb, NULL);
> +
> +          g_ptr_array_add (desktop_file_dirs, desktop_file_dir_ref (dir));
> +        }
> +
>        /* The list of directories will never change after this, unless
>         * g_get_user_config_dir() changes due to %G_TEST_OPTION_ISOLATE_DIRS. */
>        desktop_file_dirs_config_dir = user_config_dir;

I think the attached patch is an improvement over the above, by also
supporting /run/current-system/share, being a bit simpler, and not
adding extra monitors.

I've reused the cool trick of passing FALSE to
g_local_file_monitor_new_in_worker to force it to use its polling mode
fallback.

[glib-appinfo-watch.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
It's untested because 'guix vm' is taking more time to complete than I'm
willing to wait for in the middle of the night :-).  I'll try it
tomorrow.

Thanks,

Maxim

This bug report was last modified 4 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.