Merge lp:~voldyman/granite/fixed-1023269 into lp:~elementary-pantheon/granite/granite

Proposed by Akshay Shekher on 2012-07-12
Status: Merged
Merged at revision: 313
Proposed branch: lp:~voldyman/granite/fixed-1023269
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 218 lines (+33/-142)
5 files modified
lib/CMakeLists.txt (+1/-4)
lib/GtkPatch/AboutDialog.vala (+32/-2)
lib/GtkPatch/gtkpatch-utils.c (+0/-129)
lib/GtkPatch/gtkpatch-utils.h (+0/-4)
lib/GtkPatch/gtkpatch-utils.vapi (+0/-3)
To merge this branch: bzr merge lp:~voldyman/granite/fixed-1023269
Reviewer Review Type Date Requested Status
Cody Garver 2012-07-12 Approve on 2012-07-22
Review via email: mp+114636@code.launchpad.net

Description of the change

The string in About Dialog Box (eg authors = {"Akshay Shekher <email address hidden>","..."}
where parsed by a function written in C, which was in Gtkpatch.c (=>Gtkpatch.h,Gtkpatch.vapi)
i have created a simple function written in vala to replace that C code.

To post a comment you must log in.
lp:~voldyman/granite/fixed-1023269 updated on 2012-07-13
303. By Akshay Shekher on 2012-07-13

Fixed < in email

Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/CMakeLists.txt'
2--- lib/CMakeLists.txt 2012-05-23 14:58:43 +0000
3+++ lib/CMakeLists.txt 2012-07-13 09:09:17 +0000
4@@ -82,8 +82,6 @@
5 Widgets/StatusBar.vala
6 Main.vala
7 config.vapi
8-CUSTOM_VAPIS
9- ${CMAKE_CURRENT_SOURCE_DIR}/GtkPatch/gtkpatch-utils.vapi
10 PACKAGES
11 ${PKG_DEPS}
12 posix
13@@ -99,8 +97,7 @@
14 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/granite.deps DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vala/vapi/)
15 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/granite.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
16 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/Widgets/widgets-utils.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
17-add_library (${PKGNAME} SHARED
18- GtkPatch/gtkpatch-utils.c
19+add_library (${PKGNAME} SHARED
20 Widgets/widgets-utils.c
21 Widgets/close-button.c
22 ${VALA_C}
23
24=== modified file 'lib/GtkPatch/AboutDialog.vala'
25--- lib/GtkPatch/AboutDialog.vala 2012-05-11 07:35:52 +0000
26+++ lib/GtkPatch/AboutDialog.vala 2012-07-13 09:09:17 +0000
27@@ -380,8 +380,38 @@
28
29 private string set_string_from_string_array(string title, string[] peoples)
30 {
31- string text = title;
32- text += add_credits_section (title, peoples);
33+ string text = "";
34+ string name = "";
35+ string email = "" ;
36+ string _person_data;
37+ bool email_started= false;
38+ //text += add_credits_section (title, peoples);
39+ text += title + "<span size=\"small\">";
40+ for (int i= 0;i<peoples.length;i++){
41+ if (peoples[i] == null)
42+ break;
43+ _person_data = peoples[i];
44+
45+ for (int j=0;j< _person_data.length;j++){
46+
47+ if ( _person_data.get (j) == '<')
48+ email_started = true;
49+
50+ if (!email_started)
51+ name += _person_data[j].to_string ();
52+
53+ else
54+ if ( _person_data[j] != '<' && _person_data[j] != '>')
55+ email +=_person_data[j].to_string ();
56+
57+ }
58+ if (email == "")
59+ text += "<u>%s</u>\n".printf (name);
60+ else
61+ text += "<a href=\"%s\">%s</a>\n".printf (email,name);
62+ email = ""; name =""; email_started=false;
63+ }
64+ text += "</span>";
65
66 return text;
67 }
68
69=== removed file 'lib/GtkPatch/gtkpatch-utils.c'
70--- lib/GtkPatch/gtkpatch-utils.c 2011-10-12 12:27:13 +0000
71+++ lib/GtkPatch/gtkpatch-utils.c 1970-01-01 00:00:00 +0000
72@@ -1,129 +0,0 @@
73-/* GTK - The GIMP Toolkit
74- * Copyright (C) 2001 CodeFactory AB
75- * Copyright (C) 2001, 2002 Anders Carlsson
76- * Copyright (C) 2003, 2004 Matthias Clasen <mclasen@redhat.com>
77- *
78- * This library is free software; you can redistribute it and/or
79- * modify it under the terms of the GNU Library General Public
80- * License as published by the Free Software Foundation; either
81- * version 2 of the License, or (at your option) any later version.
82- *
83- * This library is distributed in the hope that it will be useful,
84- * but WITHOUT ANY WARRANTY; without even the implied warranty of
85- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
86- * Library General Public License for more details.
87- *
88- * You should have received a copy of the GNU Library General Public
89- * License along with this library; if not, write to the
90- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
91- * Boston, MA 02111-1307, USA.
92- */
93-
94-/*
95- * Author: Anders Carlsson <andersca@gnome.org>
96- *
97- * Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
98- * file for a list of people on the GTK+ Team. See the ChangeLog
99- * files for a list of changes. These files are distributed with
100- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
101- */
102-
103-#include "gtkpatch-utils.h"
104-
105-gchar *
106-add_credits_section (gchar *title, gchar **people)
107-{
108- gchar **p;
109- gchar *q0, *q1, *q2, *r1, *r2;
110-
111- if (people == NULL)
112- return;
113-
114- GString *str;
115- str = g_string_new ("<span size=\"small\">");
116- for (p = people; *p; p++)
117- {
118- q0 = *p;
119- while (*q0)
120- {
121- q1 = strchr (q0, '<');
122- q2 = q1 ? strchr (q1, '>') : NULL;
123- r1 = strstr (q0, "http://");
124- if (r1)
125- {
126- r2 = strpbrk (r1, " \n\t");
127- if (!r2)
128- r2 = strchr (r1, '\0');
129- }
130- else
131- r2 = NULL;
132-
133- if (r1 && r2 && (!q1 || !q2 || (r1 < q1)))
134- {
135- q1 = r1;
136- q2 = r2;
137- }
138- else if (q1 && (q1[1] == 'a' || q1[1] == 'A') && q1[2] == ' ')
139- {
140- /* if it is a <a> link leave it for the label to parse */
141- q1 = NULL;
142- }
143-
144- if (q1 && q2)
145- {
146- gchar *link;
147- gchar *text;
148- gchar *name;
149-
150- if (*q1 == '<')
151- {
152- /* email */
153- gchar *escaped;
154-
155- text = g_strstrip (g_strndup (q0, q1 - q0));
156- name = g_markup_escape_text (text, -1);
157- q1++;
158- link = g_strndup (q1, q2 - q1);
159- q2++;
160- escaped = g_uri_escape_string (link, NULL, FALSE);
161- g_string_append_printf (str,
162- "<a href=\"mailto:%s\">%s</a>",
163- escaped,
164- name[0] ? name : link);
165- g_free (escaped);
166- g_free (link);
167- g_free (text);
168- g_free (name);
169- }
170- else
171- {
172- /* uri */
173- text = g_strstrip (g_strndup (q0, q1 - q0));
174- name = g_markup_escape_text (text, -1);
175- link = g_strndup (q1, q2 - q1);
176- g_string_append_printf (str,
177- "<a href=\"%s\">%s</a>",
178- link,
179- name[0] ? name : link);
180- g_free (link);
181- g_free (text);
182- g_free (name);
183- }
184-
185- q0 = q2;
186- }
187- else
188- {
189- g_string_append (str, q0);
190- break;
191- }
192- }
193- g_string_append (str, "\n");
194- }
195- g_string_append (str, "</span>");
196- gchar *result = strdup (str->str);
197- g_string_free (str, TRUE);
198-
199- return result;
200-}
201-
202
203=== removed file 'lib/GtkPatch/gtkpatch-utils.h'
204--- lib/GtkPatch/gtkpatch-utils.h 2011-10-12 12:27:13 +0000
205+++ lib/GtkPatch/gtkpatch-utils.h 1970-01-01 00:00:00 +0000
206@@ -1,4 +0,0 @@
207-#include <glib.h>
208-#include <string.h>
209-
210-gchar *add_credits_section (gchar *title, gchar **people);
211
212=== removed file 'lib/GtkPatch/gtkpatch-utils.vapi'
213--- lib/GtkPatch/gtkpatch-utils.vapi 2011-10-12 12:27:13 +0000
214+++ lib/GtkPatch/gtkpatch-utils.vapi 1970-01-01 00:00:00 +0000
215@@ -1,3 +0,0 @@
216-
217-private string add_credits_section (string title, string[] people);
218-

Subscribers

People subscribed via source and target branches