[gnome-shell/eos3.8: 126/255] shell-app-system: extract deep comparison for GDesktopAppInfo
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 126/255] shell-app-system: extract deep comparison for GDesktopAppInfo
- Date: Wed, 10 Jun 2020 19:08:34 +0000 (UTC)
commit 3a46e84453134aaf04d8acf34b0d091a3afa2a72
Author: Will Thompson <wjt endlessm com>
Date: Wed Sep 26 14:17:03 2018 +0100
shell-app-system: extract deep comparison for GDesktopAppInfo
In the upstream version of this file there is only one instance of this
code. We have two, in app_is_stale() and app_info_changed(). The order
of comparisons is different between the two, but ignoring that, the only
difference is that the latter called g_app_info_equal().
For GDesktopAppInfo, g_app_info_equal() just compares the two desktop
file IDs; in the common case, these are derived from the on-disk path,
so comparing g_desktop_app_info_get_filename(), as app_is_stale() did,
is enough. But, g_desktop_app_info_get_filename() can return NULL if the
object was constructed with g_desktop_app_info_new_from_keyfile(); in
that case, g_app_info_equal() falls back to pointer equality.
With this patch, we call g_app_info_equal() on both code paths, and
compare the results of g_desktop_app_info_get_filename() with
g_strcmp0() since they can be NULL.
https://phabricator.endlessm.com/T23877
src/shell-app-system.c | 47 ++++-------------------------------------------
1 file changed, 4 insertions(+), 43 deletions(-)
---
diff --git a/src/shell-app-system.c b/src/shell-app-system.c
index 760a13574b..aa957ae575 100644
--- a/src/shell-app-system.c
+++ b/src/shell-app-system.c
@@ -210,7 +210,6 @@ static gboolean
app_is_stale (ShellApp *app)
{
GDesktopAppInfo *info, *old;
- GAppInfo *old_info, *new_info;
gboolean is_unchanged;
if (shell_app_is_window_backed (app))
@@ -222,25 +221,8 @@ app_is_stale (ShellApp *app)
return TRUE;
old = shell_app_get_app_info (app);
- old_info = G_APP_INFO (old);
- new_info = G_APP_INFO (info);
-
- is_unchanged =
- g_app_info_should_show (old_info) == g_app_info_should_show (new_info) &&
- strcmp (g_desktop_app_info_get_filename (old),
- g_desktop_app_info_get_filename (info)) == 0 &&
- g_strcmp0 (g_app_info_get_executable (old_info),
- g_app_info_get_executable (new_info)) == 0 &&
- g_strcmp0 (g_app_info_get_commandline (old_info),
- g_app_info_get_commandline (new_info)) == 0 &&
- strcmp (g_app_info_get_name (old_info),
- g_app_info_get_name (new_info)) == 0 &&
- g_strcmp0 (g_app_info_get_description (old_info),
- g_app_info_get_description (new_info)) == 0 &&
- strcmp (g_app_info_get_display_name (old_info),
- g_app_info_get_display_name (new_info)) == 0 &&
- g_icon_equal (g_app_info_get_icon (old_info),
- g_app_info_get_icon (new_info));
+
+ is_unchanged = shell_app_system_app_info_equal (old, info);
return !is_unchanged;
}
@@ -270,33 +252,12 @@ static gboolean
app_info_changed (ShellApp *app,
GDesktopAppInfo *desk_new_info)
{
- GIcon *app_icon;
- GIcon *new_icon;
GDesktopAppInfo *desk_app_info = shell_app_get_app_info (app);
- GAppInfo *app_info = G_APP_INFO (desk_app_info);
- GAppInfo *new_info = G_APP_INFO (desk_new_info);
- if (!app_info)
+ if (!desk_app_info)
return TRUE;
- app_icon = g_app_info_get_icon (app_info);
- new_icon = g_app_info_get_icon (new_info);
-
- return !(g_app_info_equal (app_info, new_info) &&
- g_icon_equal (app_icon, new_icon) &&
- g_app_info_should_show (app_info) == g_app_info_should_show (new_info) &&
- strcmp (g_desktop_app_info_get_filename (desk_app_info),
- g_desktop_app_info_get_filename (desk_new_info)) == 0 &&
- g_strcmp0 (g_app_info_get_executable (app_info),
- g_app_info_get_executable (new_info)) == 0 &&
- g_strcmp0 (g_app_info_get_commandline (app_info),
- g_app_info_get_commandline (new_info)) == 0 &&
- strcmp (g_app_info_get_name (app_info),
- g_app_info_get_name (new_info)) == 0 &&
- strcmp (g_app_info_get_display_name (app_info),
- g_app_info_get_display_name (new_info)) == 0 &&
- g_strcmp0 (g_app_info_get_description (app_info),
- g_app_info_get_description (new_info)) == 0);
+ return !shell_app_system_app_info_equal (desk_app_info, desk_new_info);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]