libmalcontent-ui: Adjust the app list sort to be more stable
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
This commit is contained in:
parent
d01f063c39
commit
1d5da7c094
|
@ -372,6 +372,7 @@ app_compare_id_length_cb (gconstpointer a,
|
||||||
{
|
{
|
||||||
GAppInfo *info_a = (GAppInfo *) a, *info_b = (GAppInfo *) b;
|
GAppInfo *info_a = (GAppInfo *) a, *info_b = (GAppInfo *) b;
|
||||||
const gchar *id_a, *id_b;
|
const gchar *id_a, *id_b;
|
||||||
|
gsize id_a_len, id_b_len;
|
||||||
|
|
||||||
id_a = g_app_info_get_id (info_a);
|
id_a = g_app_info_get_id (info_a);
|
||||||
id_b = g_app_info_get_id (info_b);
|
id_b = g_app_info_get_id (info_b);
|
||||||
|
@ -383,7 +384,12 @@ app_compare_id_length_cb (gconstpointer a,
|
||||||
else if (id_b == NULL)
|
else if (id_b == NULL)
|
||||||
return 1;
|
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
|
static void
|
||||||
|
|
Loading…
Reference in New Issue