Mercurial > pidgin.yaz
changeset 14999:db590283788d
[gaim-migrate @ 17777]
Refactor some duplicated code, and fix a case where that code hadn't been duplicated properly.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 19 Nov 2006 05:56:50 +0000 |
parents | fee45b614eb7 |
children | 82d1a2fc6d25 |
files | gtk/gtklog.c |
diffstat | 1 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/gtklog.c Sun Nov 19 05:56:07 2006 +0000 +++ b/gtk/gtklog.c Sun Nov 19 05:56:50 2006 +0000 @@ -106,6 +106,14 @@ gtk_tree_path_free(path); } +static const char *log_get_date(GaimLog *log) +{ + if (log->tm) + return gaim_date_format_full(log->tm); + else + return gaim_date_format_full(localtime(&log->time)); +} + static void search_cb(GtkWidget *button, GaimGtkLogViewer *lv) { const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); @@ -145,7 +153,7 @@ gtk_tree_store_append (lv->treestore, &iter, NULL); gtk_tree_store_set(lv->treestore, &iter, - 0, gaim_date_format_full(localtime(&log->time)), + 0, log_get_date(log), 1, log, -1); } g_free(read); @@ -217,14 +225,10 @@ char *title; if (log->type == GAIM_LOG_CHAT) title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"), - log->name, - log->tm ? gaim_date_format_full(log->tm) : - gaim_date_format_full(localtime(&log->time))); + log->name, log_get_date(log)); else title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"), - log->name, - log->tm ? gaim_date_format_full(log->tm) : - gaim_date_format_full(localtime(&log->time))); + log->name, log_get_date(log)); gtk_label_set_markup(GTK_LABEL(viewer->label), title); g_free(title); @@ -285,7 +289,7 @@ /* sub */ gtk_tree_store_append(lv->treestore, &child, &toplevel); gtk_tree_store_set(lv->treestore, &child, - 0, log->tm ? gaim_date_format_full(log->tm) : gaim_date_format_full(localtime(&log->time)), + 0, log_get_date(log), 1, log, -1);