Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zhy20120210:failed_1
gnome-packagekit
gnome-packagekit-BNC474160.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-packagekit-BNC474160.patch of Package gnome-packagekit
Index: gnome-packagekit-0.3.14/src/gpk-client-eula.c =================================================================== --- gnome-packagekit-0.3.14.orig/src/gpk-client-eula.c +++ gnome-packagekit-0.3.14/src/gpk-client-eula.c @@ -55,6 +55,16 @@ gpk_client_eula_button_help_cb (GtkWidge gpk_gnome_help ("eula"); } +static void text_callback (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error) +{ + g_string_append_len ((GString*) user_data, text, text_len); +} + +static void error_callback (GMarkupParseContext *context, GError *error, gpointer user_data) +{ + egg_warning ("Error parsing - %s", error->message); +} + /** * gpk_client_eula_show: * @@ -102,6 +112,23 @@ gpk_client_eula_show (GtkWindow *window, pk_package_id_free (ident); g_free (text); + GString *stripped_license = g_string_new (NULL); + GError *error = NULL; + GMarkupParser parser = {NULL, NULL, text_callback, NULL, error_callback}; + GMarkupParseContext *context = g_markup_parse_context_new (&parser, 0, stripped_license, NULL); + if (g_markup_parse_context_parse (context, license_agreement, g_utf8_strlen (license_agreement, -1), &error)) + { + egg_debug ("replacing license with stripped license"); + license_agreement = stripped_license->str; + } + else + { + egg_warning ("Error parsing license - %s", error->message); + if (error) + g_error_free (error); + } + g_markup_parse_context_free (context); + buffer = gtk_text_buffer_new (NULL); gtk_text_buffer_insert_at_cursor (buffer, license_agreement, strlen (license_agreement)); widget = glade_xml_get_widget (glade_xml, "textview_details"); @@ -122,6 +149,7 @@ gpk_client_eula_show (GtkWindow *window, has_agreed_eula = FALSE; gtk_main (); + g_string_free (stripped_license, TRUE); /* hide window */ if (GTK_IS_WIDGET (widget)) gtk_widget_hide (widget); Index: gnome-packagekit-0.3.14/src/gpk-application.c =================================================================== --- gnome-packagekit-0.3.14.orig/src/gpk-application.c +++ gnome-packagekit-0.3.14/src/gpk-application.c @@ -951,17 +951,52 @@ egg_strreplace_indirect (gchar **text, c return TRUE; } +static void text_callback (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error) +{ + g_string_append_len ((GString*) user_data, text, text_len); +} + +static void error_callback (GMarkupParseContext *context, GError *error, gpointer user_data) +{ + egg_debug ("Error parsing - %s", error->message); +} + /** * gpk_application_text_format_display: **/ static gchar * -gpk_application_text_format_display (const gchar *ascii) +gpk_application_text_format_display (const gchar *ascii, gboolean strip) { gchar *text; text = g_strdup (ascii); egg_strreplace_indirect (&text, "``", "“"); egg_strreplace_indirect (&text, "''", "”"); egg_strreplace_indirect (&text, "'", "’"); + + if (!strip) + return text; + + GString *stripped_text = g_string_new (NULL); + GError *error = NULL; + GMarkupParser parser = {NULL, NULL, text_callback, NULL, error_callback}; + GMarkupParseContext *context = g_markup_parse_context_new (&parser, 0, stripped_text, NULL); + if (g_markup_parse_context_parse (context, text, g_utf8_strlen (text, -1), &error)) + { + egg_debug ("replacing text with stripped text"); + g_free (text); + text = stripped_text->str; + } + else + { + if (stripped_text->str) + g_free (stripped_text->str); + if (error) + g_error_free (error); + } + + g_markup_parse_context_free (context); + g_string_free (stripped_text, FALSE); + return text; } @@ -1028,7 +1063,7 @@ gpk_application_details_cb (PkClient *cl } /* set the description */ - text = gpk_application_text_format_display (details->description); + text = gpk_application_text_format_display (details->description, TRUE); widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description"); gpk_application_set_text_buffer (widget, text); g_free (text); @@ -1088,7 +1123,7 @@ gpk_application_package_cb (PkClient *cl return; /* format if required */ - summary = gpk_application_text_format_display (obj->summary); + summary = gpk_application_text_format_display (obj->summary, FALSE); package_id = pk_package_id_to_string (obj->id); /* mark as got so we don't warn */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor