Mercurial > pidgin.yaz
comparison pidgin/gtkprefs.c @ 28950:8f62997d90b7
Remove some code duplication which also fixes a small inconsistency in the
formatting.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 16 Nov 2009 07:08:27 +0000 |
parents | 97fcfefdbda7 |
children | b26b9f8c9dbd |
comparison
equal
deleted
inserted
replaced
28949:97fcfefdbda7 | 28950:8f62997d90b7 |
---|---|
340 sound_entry = NULL; | 340 sound_entry = NULL; |
341 debugbutton = NULL; | 341 debugbutton = NULL; |
342 notebook_page = 0; | 342 notebook_page = 0; |
343 } | 343 } |
344 | 344 |
345 static gchar * | |
346 get_theme_markup(const char *name, gboolean custom, const char *author, | |
347 const char *description) | |
348 { | |
349 | |
350 return g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>", | |
351 name, custom ? " " : "", custom ? _("(Custom)") : "", | |
352 author != NULL ? " - " : "", author != NULL ? author : "", | |
353 description != NULL ? description : ""); | |
354 } | |
355 | |
345 static void | 356 static void |
346 theme_refresh_theme_list(void) | 357 theme_refresh_theme_list(void) |
347 { | 358 { |
348 GdkPixbuf *pixbuf; | 359 GdkPixbuf *pixbuf; |
349 GSList *themes; | 360 GSList *themes; |
354 if (!(themes = smiley_themes)) | 365 if (!(themes = smiley_themes)) |
355 return; | 366 return; |
356 | 367 |
357 while (themes) { | 368 while (themes) { |
358 struct smiley_theme *theme = themes->data; | 369 struct smiley_theme *theme = themes->data; |
359 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" | 370 char *description = get_theme_markup(_(theme->name), FALSE, |
360 "<span size='smaller' foreground='dim grey'>%s</span>", | 371 _(theme->author), _(theme->desc)); |
361 _(theme->name), _(theme->author), _(theme->desc)); | |
362 gtk_list_store_append(prefs_smiley_themes, &iter); | 372 gtk_list_store_append(prefs_smiley_themes, &iter); |
363 | 373 |
364 /* | 374 /* |
365 * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it | 375 * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it |
366 * looks like it should be ok to me. Anyone know what's up? --Mark | 376 * looks like it should be ok to me. Anyone know what's up? --Mark |
377 g_object_unref(G_OBJECT(pixbuf)); | 387 g_object_unref(G_OBJECT(pixbuf)); |
378 | 388 |
379 g_free(description); | 389 g_free(description); |
380 themes = themes->next; | 390 themes = themes->next; |
381 } | 391 } |
382 } | |
383 | |
384 static gchar * | |
385 get_theme_markup(const char *name, gboolean custom, const char *author, | |
386 const char *description) | |
387 { | |
388 | |
389 return g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>", | |
390 name, custom ? " " : "", custom ? _("(Custom)") : "", | |
391 author != NULL ? " - " : "", author != NULL ? author : "", | |
392 description != NULL ? description : ""); | |
393 } | 392 } |
394 | 393 |
395 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ | 394 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ |
396 static void | 395 static void |
397 pref_sound_generate_markup(void) | 396 pref_sound_generate_markup(void) |