pidgin/pidginabout.c

changeset 38672
df4a6635745a
parent 38667
f8ae2ff1c19b
child 38673
743b0df28288
equal deleted inserted replaced
38671:a27270f4ac0a 38672:df4a6635745a
1 /* Purple is the legal property of its developers, whose names are too numerous
2 * to list here. Please refer to the COPYRIGHT file distributed with this
3 * source distribution.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
18 */
1 #include <gdk-pixbuf/gdk-pixbuf.h> 19 #include <gdk-pixbuf/gdk-pixbuf.h>
2 #include <json-glib/json-glib.h> 20 #include <json-glib/json-glib.h>
3 21
4 #include "package_revision.h" 22 #include "package_revision.h"
5 #include "pidginabout.h" 23 #include "pidginabout.h"
7 #include "internal.h" 25 #include "internal.h"
8 #include "gtkutils.h" 26 #include "gtkutils.h"
9 #include "gtkwebview.h" 27 #include "gtkwebview.h"
10 28
11 #include <stdio.h> 29 #include <stdio.h>
12
13 #include "config.h"
14 30
15 #ifdef HAVE_MESON_CONFIG 31 #ifdef HAVE_MESON_CONFIG
16 #include "meson-config.h" 32 #include "meson-config.h"
17 #endif 33 #endif
18 34
151 developers = json_object_get_array_member(root_object, "developers"); 167 developers = json_object_get_array_member(root_object, "developers");
152 sections = json_array_get_elements(developers); 168 sections = json_array_get_elements(developers);
153 169
154 for(l = sections; l; l = l->next) { 170 for(l = sections; l; l = l->next) {
155 GtkTreeIter section_iter; 171 GtkTreeIter section_iter;
156 GList *ll = NULL, *people = NULL;
157 JsonObject *section = json_node_get_object(l->data); 172 JsonObject *section = json_node_get_object(l->data);
158 JsonArray *people_array = NULL; 173 JsonArray *people = NULL;
159 gchar *markup = NULL; 174 gchar *markup = NULL;
175 guint idx = 0, n_people = 0;
160 176
161 markup = g_strdup_printf( 177 markup = g_strdup_printf(
162 "<span font_weight=\"bold\" font_size=\"large\">%s</span>", 178 "<span font_weight=\"bold\" font_size=\"large\">%s</span>",
163 json_object_get_string_member(section, "title") 179 json_object_get_string_member(section, "title")
164 ); 180 );
172 -1 188 -1
173 ); 189 );
174 190
175 g_free(markup); 191 g_free(markup);
176 192
177 people_array = json_object_get_array_member(section, "people"); 193 people = json_object_get_array_member(section, "people");
178 people = json_array_get_elements(people_array); 194 n_people = json_array_get_length(people);
179 195
180 for(ll = people; ll; ll = ll->next) { 196 for(idx = 0; idx < n_people; idx++) {
181 GtkTreeIter person_iter; 197 GtkTreeIter person_iter;
182 gchar *markup = g_strdup(json_node_get_string(ll->data));
183 198
184 gtk_tree_store_append(about->priv->developers_store, &person_iter, &section_iter); 199 gtk_tree_store_append(about->priv->developers_store, &person_iter, &section_iter);
185 gtk_tree_store_set( 200 gtk_tree_store_set(
186 about->priv->developers_store, 201 about->priv->developers_store,
187 &person_iter, 202 &person_iter,
188 0, markup, 203 0, json_array_get_string_element(people, idx),
189 1, 0.5f, 204 1, 0.5f,
190 -1 205 -1
191 ); 206 );
192
193 g_free(markup);
194 } 207 }
195
196 g_list_free(people);
197 } 208 }
198 209
199 g_list_free(sections); 210 g_list_free(sections);
200 211
201 /* clean up */ 212 /* clean up */
235 languages = json_object_get_array_member(root_object, "languages"); 246 languages = json_object_get_array_member(root_object, "languages");
236 sections = json_array_get_elements(languages); 247 sections = json_array_get_elements(languages);
237 248
238 for(l = sections; l; l = l->next) { 249 for(l = sections; l; l = l->next) {
239 GtkTreeIter section_iter; 250 GtkTreeIter section_iter;
240 GList *ll = NULL, *people = NULL;
241 JsonObject *section = json_node_get_object(l->data); 251 JsonObject *section = json_node_get_object(l->data);
242 JsonArray *people_array = NULL; 252 JsonArray *people = NULL;
243 gchar *markup = NULL; 253 gchar *markup = NULL;
254 guint idx = 0, n_people = 0;
244 255
245 markup = g_strdup_printf( 256 markup = g_strdup_printf(
246 "<span font_weight=\"bold\" font_size=\"large\">%s</span>", 257 "<span font_weight=\"bold\" font_size=\"large\">%s</span>",
247 json_object_get_string_member(section, "title") 258 json_object_get_string_member(section, "title")
248 ); 259 );
256 -1 267 -1
257 ); 268 );
258 269
259 g_free(markup); 270 g_free(markup);
260 271
261 people_array = json_object_get_array_member(section, "people"); 272 people = json_object_get_array_member(section, "people");
262 people = json_array_get_elements(people_array); 273 n_people = json_array_get_length(people);
263 274
264 for(ll = people; ll; ll = ll->next) { 275 for(idx = 0; idx < n_people; idx++) {
265 GtkTreeIter person_iter; 276 GtkTreeIter person_iter;
266 gchar *markup = g_strdup(json_node_get_string(ll->data));
267 277
268 gtk_tree_store_append(about->priv->translators_store, &person_iter, &section_iter); 278 gtk_tree_store_append(about->priv->translators_store, &person_iter, &section_iter);
269 gtk_tree_store_set( 279 gtk_tree_store_set(
270 about->priv->translators_store, 280 about->priv->translators_store,
271 &person_iter, 281 &person_iter,
272 0, markup, 282 0, json_array_get_string_element(people, idx),
273 1, 0.5f, 283 1, 0.5f,
274 -1 284 -1
275 ); 285 );
276
277 g_free(markup);
278 } 286 }
279
280 g_list_free(people);
281 } 287 }
282 288
283 g_list_free(sections); 289 g_list_free(sections);
284 290
285 /* clean up */ 291 /* clean up */
312 /* now walk through the arguments and add them */ 318 /* now walk through the arguments and add them */
313 splits = g_strsplit(build_args, " ", -1); 319 splits = g_strsplit(build_args, " ", -1);
314 for(idx = 0; splits[idx]; idx++) { 320 for(idx = 0; splits[idx]; idx++) {
315 gchar **value_split = g_strsplit(splits[idx], "=", 2); 321 gchar **value_split = g_strsplit(splits[idx], "=", 2);
316 322
317 if(value_split[0] == NULL || g_utf8_strlen(value_split[0], -1) == 0) { 323 if(value_split[0] == NULL || value_split[0][0] == '\0') {
318 continue; 324 continue;
319 } 325 }
320 326
321 gtk_tree_store_append(about->priv->build_info_store, &value, &section); 327 gtk_tree_store_append(about->priv->build_info_store, &value, &section);
322 gtk_tree_store_set( 328 gtk_tree_store_set(

mercurial