summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-06-13 18:36:35 +0200
committerraveit65 <[email protected]>2019-06-13 21:53:50 +0200
commit198eca640f38843beb735421482dd60edc2f9524 (patch)
treea478d840a05f115f5c60636220408d2511cf3b3c /capplets
parentd1750c05b226fb204305515dab143edc4caa68b6 (diff)
downloadmate-control-center-198eca640f38843beb735421482dd60edc2f9524.tar.bz2
mate-control-center-198eca640f38843beb735421482dd60edc2f9524.tar.xz
Populate initial messenger list with irc scheme handler apps
Diffstat (limited to 'capplets')
-rw-r--r--capplets/default-applications/mate-da-capplet.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/capplets/default-applications/mate-da-capplet.c b/capplets/default-applications/mate-da-capplet.c
index 07d16170..56743521 100644
--- a/capplets/default-applications/mate-da-capplet.c
+++ b/capplets/default-applications/mate-da-capplet.c
@@ -588,6 +588,23 @@ fill_list_from_desktop_file (GList* app_list, const gchar *desktop_id)
return list;
}
+static gint
+compare_apps (gconstpointer a, gconstpointer b)
+{
+ GAppInfo *app_info_1, *app_info_2;
+ gchar *app_dpy_name_1, *app_dpy_name_2;
+ gint ret;
+
+ app_info_1 = G_APP_INFO (a);
+ app_info_2 = G_APP_INFO (b);
+ app_dpy_name_1 = g_utf8_casefold (g_app_info_get_display_name (app_info_1), -1);
+ app_dpy_name_2 = g_utf8_casefold (g_app_info_get_display_name (app_info_2), -1);
+ ret = g_strcmp0 (app_dpy_name_1, app_dpy_name_2);
+ g_free (app_dpy_name_1);
+ g_free (app_dpy_name_2);
+ return ret;
+}
+
static void
show_dialog(MateDACapplet* capplet, const gchar* start_page)
{
@@ -694,10 +711,13 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
/* Messenger havent mime types, so check in .desktop files for
Categories=InstantMessaging */
- capplet->messengers = NULL;
+ capplet->messengers = g_app_info_get_all_for_type ("x-scheme-handler/irc");
all_apps = g_app_info_get_all();
for (entry = all_apps; entry != NULL; entry = g_list_next(entry))
{
+ if (capplet->messengers && g_list_index (capplet->messengers, entry) != -1)
+ continue;
+
GDesktopAppInfo* item = (GDesktopAppInfo*) entry->data;
if (g_desktop_app_info_get_categories (item) != NULL &&
g_strrstr (g_desktop_app_info_get_categories (item), "InstantMessaging"))
@@ -705,7 +725,7 @@ show_dialog(MateDACapplet* capplet, const gchar* start_page)
capplet->messengers = g_list_prepend (capplet->messengers, item);
}
}
- capplet->messengers = g_list_reverse (capplet->messengers);
+ capplet->messengers = g_list_sort (capplet->messengers, compare_apps);
fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->web_combo_box), capplet->web_browsers, "x-scheme-handler/http");
fill_combo_box(capplet->icon_theme, GTK_COMBO_BOX(capplet->mail_combo_box), capplet->mail_readers, "x-scheme-handler/mailto");