[packagekit] The patch to enable title with uri in update viewer

Zhu, Peter J peter.j.zhu at intel.com
Tue Jun 16 07:20:13 PDT 2009


Hi Richard
Richard Hughes wrote on Tuesday, June 16, 2009 9:03 PM
> On Tue, Jun 16, 2009 at 9:59 AM, Zhu, Peter
> J<peter.j.zhu at intel.com> wrote: 
>> Richard Hughes wrote on Tuesday, June 16, 2009 4:24 PM
>>> Is this against git master?
>>> 
>> Yes
> 
> [hughsie at hughsie-laptop gnome-packagekit]$ git whatchanged
> src/gpk-update-viewer2.c
> fatal: ambiguous argument 'src/gpk-update-viewer2.c':
> unknown revision 
> or path not in the working tree.
> 
> We renamed gpk-update-viewer2.c to gpk-update-viewer.c a
> few months 
> ago -- where are you getting your git checkout from?
> What's the output 
> of ".git/FETCH_HEAD"?
> 

Sorry, as I sent in previous thread, I made a mistake making diff than a local git tree. 

The correct one is:

diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 598ccd2..b46113d 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -1140,13 +1140,15 @@ gpk_update_viewer_add_description_link_item (GtkTextBuffer *buffer, GtkTextIter
 {
 	GtkTextTag *tag;
 	const gchar *uri;
+	const gchar *text;
 	gint i;
 
 	/* insert at end */
 	gtk_text_buffer_insert_with_tags_by_name (buffer, iter, title, -1, "para", NULL);
 
-	for (i=0; i<array->len; i++) {
+	for (i=0; i<array->len; i+=2) {
 		uri = g_ptr_array_index (array, i);
+		text = g_ptr_array_index (array, i+1);
 		gtk_text_buffer_insert (buffer, iter, "\n", -1);
 		gtk_text_buffer_insert (buffer, iter, "* ", -1);
 		tag = gtk_text_buffer_create_tag (buffer, NULL,
@@ -1154,7 +1156,7 @@ gpk_update_viewer_add_description_link_item (GtkTextBuffer *buffer, GtkTextIter
 						  "underline", PANGO_UNDERLINE_SINGLE,
 						  NULL);
 		g_object_set_data (G_OBJECT (tag), "href", g_strdup (uri));
-		gtk_text_buffer_insert_with_tags (buffer, iter, uri, -1, tag, NULL);
+		gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL);
 		gtk_text_buffer_insert (buffer, iter, ".", -1);
 	}
 	gtk_text_buffer_insert (buffer, iter, "\n", -1);
@@ -1183,7 +1185,7 @@ gpk_update_viewer_get_uris (const gchar *url_string)
 	}
 
 	/* copy into array */
-	for (i=0; i<length; i+=2)
+	for (i=0; i<length; i++)
 		g_ptr_array_add (array, g_strdup (urls[i]));
 
 	return array;


More information about the PackageKit mailing list