Skip to content

Commit

Permalink
libmalcontent-ui: Adjust the app list sort to be more stable
Browse files Browse the repository at this point in the history
This doesn’t achieve anything by itself, but makes some upcoming commits
to diff the new/old app lists work properly.

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

Helps: #18, #28
  • Loading branch information
pwithnall committed Oct 15, 2020
1 parent d01f063 commit 1d5da7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libmalcontent-ui/restrict-applications-selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ app_compare_id_length_cb (gconstpointer a,
{
GAppInfo *info_a = (GAppInfo *) a, *info_b = (GAppInfo *) b;
const gchar *id_a, *id_b;
gsize id_a_len, id_b_len;

id_a = g_app_info_get_id (info_a);
id_b = g_app_info_get_id (info_b);
Expand All @@ -383,7 +384,12 @@ app_compare_id_length_cb (gconstpointer a,
else if (id_b == NULL)
return 1;

return strlen (id_a) - strlen (id_b);
id_a_len = strlen (id_a);
id_b_len = strlen (id_b);
if (id_a_len == id_b_len)
return strcmp (id_a, id_b);
else
return id_a_len - id_b_len;
}

static void
Expand Down

0 comments on commit 1d5da7c

Please sign in to comment.