[gnome-control-center/gnome-3-8] search-provider: escape the description passed to gnome-shell



commit ba5a8665f5ed638e3e8d682f274f846aa8cf3303
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Mar 1 00:36:30 2013 +0100

    search-provider: escape the description passed to gnome-shell
    
    gnome-shell uses the description as markup (to allow highlighting
    the searched terms), so we need to properly escape it to avoid warnings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694908

 search-provider/cc-search-provider.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/search-provider/cc-search-provider.c b/search-provider/cc-search-provider.c
index b62576e..fde0fc7 100644
--- a/search-provider/cc-search-provider.c
+++ b/search-provider/cc-search-provider.c
@@ -187,7 +187,7 @@ handle_get_result_metas (CcShellSearchProvider2  *skeleton,
   GVariantBuilder builder;
   GAppInfo *app;
   const char *id;
-  char *name, *description, *icon_string;
+  char *name, *description, *escaped_description, *icon_string;
   GIcon *icon;
 
   g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
@@ -205,6 +205,7 @@ handle_get_result_metas (CcShellSearchProvider2  *skeleton,
                           -1);
       id = g_app_info_get_id (app);
       icon_string = g_icon_to_string (icon);
+      escaped_description = g_markup_escape_text (description, -1);
 
       g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
       g_variant_builder_add (&builder, "{sv}",
@@ -214,11 +215,12 @@ handle_get_result_metas (CcShellSearchProvider2  *skeleton,
       g_variant_builder_add (&builder, "{sv}",
                              "gicon", g_variant_new_string (icon_string));
       g_variant_builder_add (&builder, "{sv}",
-                             "description", g_variant_new_string (description));
+                             "description", g_variant_new_string (escaped_description));
       g_variant_builder_close (&builder);
 
       g_free (name);
       g_free (description);
+      g_free (escaped_description);
       g_free (icon_string);
       g_object_unref (app);
       g_object_unref (icon);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]