comparison pidgin/gtklog.c @ 15578:3ae0ba9aee46

Use person icon for Person log viewer
author Sean Egan <seanegan@gmail.com>
date Tue, 06 Feb 2007 20:14:31 +0000
parents 7ebe32203e67
children 0a5823d45398
comparison
equal deleted inserted replaced
15577:a7b4a4c2cfcf 15578:3ae0ba9aee46
30 #include "log.h" 30 #include "log.h"
31 #include "notify.h" 31 #include "notify.h"
32 #include "request.h" 32 #include "request.h"
33 #include "util.h" 33 #include "util.h"
34 34
35 #include "gaimstock.h"
35 #include "gtkblist.h" 36 #include "gtkblist.h"
36 #include "gtkimhtml.h" 37 #include "gtkimhtml.h"
37 #include "gtklog.h" 38 #include "gtklog.h"
38 #include "gtkutils.h" 39 #include "gtkutils.h"
39 40
487 logs = logs->next; 488 logs = logs->next;
488 } 489 }
489 } 490 }
490 491
491 static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList *logs, 492 static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList *logs,
492 const char *title, GdkPixbuf *pixbuf, int log_size) 493 const char *title, GtkWidget *icon, int log_size)
493 { 494 {
494 PidginLogViewer *lv; 495 PidginLogViewer *lv;
495 GtkWidget *title_box; 496 GtkWidget *title_box;
496 char *text; 497 char *text;
497 GtkWidget *pane; 498 GtkWidget *pane;
546 g_signal_connect(G_OBJECT(lv->window), "response", 547 g_signal_connect(G_OBJECT(lv->window), "response",
547 G_CALLBACK(destroy_cb), ht); 548 G_CALLBACK(destroy_cb), ht);
548 gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); 549 gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer");
549 550
550 /* Icon *************/ 551 /* Icon *************/
551 if (pixbuf != NULL) { 552 if (icon != NULL) {
552 GtkWidget *icon;
553
554 title_box = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); 553 title_box = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
555 gtk_container_set_border_width(GTK_CONTAINER(title_box), GAIM_HIG_BOX_SPACE); 554 gtk_container_set_border_width(GTK_CONTAINER(title_box), GAIM_HIG_BOX_SPACE);
556 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0); 555 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0);
557 556
558 icon = gtk_image_new_from_pixbuf(pixbuf);
559 gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); 557 gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0);
560 g_object_unref(G_OBJECT(pixbuf));
561 } else 558 } else
562 title_box = GTK_DIALOG(lv->window)->vbox; 559 title_box = GTK_DIALOG(lv->window)->vbox;
563 560
564 /* Label ************/ 561 /* Label ************/
565 lv->label = gtk_label_new(NULL); 562 lv->label = gtk_label_new(NULL);
685 682
686 title = g_strdup_printf(_("Conversations with %s"), name); 683 title = g_strdup_printf(_("Conversations with %s"), name);
687 } 684 }
688 685
689 display_log_viewer(ht, gaim_log_get_logs(type, screenname, account), 686 display_log_viewer(ht, gaim_log_get_logs(type, screenname, account),
690 title, pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM), 687 title, gtk_image_new_from_pixbuf(pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM)),
691 gaim_log_get_total_size(type, screenname, account)); 688 gaim_log_get_total_size(type, screenname, account));
692 g_free(title); 689 g_free(title);
693 } 690 }
694 691
695 void pidgin_log_show_contact(GaimContact *contact) { 692 void pidgin_log_show_contact(GaimContact *contact) {
696 struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1); 693 struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1);
697 GaimBlistNode *child; 694 GaimBlistNode *child;
698 PidginLogViewer *lv = NULL; 695 PidginLogViewer *lv = NULL;
699 GList *logs = NULL; 696 GList *logs = NULL;
700 char *filename;
701 GdkPixbuf *pixbuf; 697 GdkPixbuf *pixbuf;
698 GtkWidget *image = gtk_image_new();;
702 const char *name = NULL; 699 const char *name = NULL;
703 char *title; 700 char *title;
704 int total_log_size = 0; 701 int total_log_size = 0;
705 702
706 g_return_if_fail(contact != NULL); 703 g_return_if_fail(contact != NULL);
724 ((GaimBuddy *)child)->account), logs); 721 ((GaimBuddy *)child)->account), logs);
725 total_log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy *)child)->name, ((GaimBuddy *)child)->account); 722 total_log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy *)child)->name, ((GaimBuddy *)child)->account);
726 } 723 }
727 logs = g_list_sort(logs, gaim_log_compare); 724 logs = g_list_sort(logs, gaim_log_compare);
728 725
729 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "icons", "online.png", NULL); 726 pixbuf = gtk_widget_render_icon (image, PIDGIN_STOCK_STATUS_PERSON,
730 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 727 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow");
731 g_free(filename); 728 gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
732 729
733 if (contact->alias != NULL) 730 if (contact->alias != NULL)
734 name = contact->alias; 731 name = contact->alias;
735 else if (contact->priority != NULL) 732 else if (contact->priority != NULL)
736 name = gaim_buddy_get_contact_alias(contact->priority); 733 name = gaim_buddy_get_contact_alias(contact->priority);
737 734
738 title = g_strdup_printf(_("Conversations with %s"), name); 735 title = g_strdup_printf(_("Conversations with %s"), name);
739 display_log_viewer(ht, logs, title, pixbuf, total_log_size); 736 display_log_viewer(ht, logs, title, image, total_log_size);
740 g_free(title); 737 g_free(title);
741 } 738 }
742 739
743 void pidgin_syslog_show() 740 void pidgin_syslog_show()
744 { 741 {