Mercurial > pidgin
changeset 1068:ed28707debdc
[gaim-migrate @ 1078]
tooltips for one connection. need to figure out how to do it for multiple connections.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 04 Nov 2000 22:35:05 +0000 |
parents | 649199f4730e |
children | 5d4926907b21 |
files | src/buddy.c src/gaim.h src/multi.h src/server.c |
diffstat | 4 files changed, 77 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Sat Nov 04 20:20:27 2000 +0000 +++ b/src/buddy.c Sat Nov 04 22:35:05 2000 +0000 @@ -1420,6 +1420,45 @@ return FALSE; } +static char *caps_string(gushort caps) +{ + static char buf[256], *tmp; + int count = 0, i = 0; + gushort bit = 1; + while (bit <= 0x20) { + if (bit & caps) { + switch (bit) { + case 0x1: + tmp = _("Buddy Icon"); + break; + case 0x2: + tmp = _("Voice"); + break; + case 0x4: + tmp = _("IM Image"); + break; + case 0x8: + tmp = _("Chat"); + break; + case 0x10: + tmp = _("Get File"); + break; + case 0x20: + tmp = _("Send File"); + break; + default: + tmp = NULL; + break; + } + if (tmp) + i += g_snprintf(buf+i, sizeof(buf)-i, "%s%s", (count ? ", " : ""), tmp); + count++; + } + bit <<= 1; + } + return buf; +} + static void update_idle_time(struct buddy_show *bs) { char idlet[16]; time_t t; @@ -1427,6 +1466,11 @@ struct buddy *b; GSList *c; + char infotip[256]; + char warn[256]; + char caps[256]; + char *sotime, *itime; + time(&t); if (g_slist_length(bs->connlist) == 1) { b = find_buddy(bs->connlist->data, bs->name); @@ -1445,6 +1489,37 @@ gtk_label_set(GTK_LABEL(bs->idle), ""); if (display_options & OPT_DISP_SHOW_IDLETIME) gtk_widget_show(bs->idle); + + /* now we do the tooltip */ + sotime = sec_to_text(t - b->signon + + ((struct gaim_connection *)bs->connlist->data)->correction_time); + + if (b->idle) + itime = sec_to_text(t - b->idle); + else { + itime = g_malloc(1); itime[0] = 0; + } + + if (b->evil) + g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil); + else + warn[0] = '\0'; + + if (b->caps) + g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps)); + else + caps[0] = '\0'; + + g_snprintf(infotip, sizeof infotip, _("Alias: %s \nScreen Name: %s\n" + "Logged in: %s\n%s%s%s%s%s"), + b->show, b->name, sotime, warn, + (b->idle ? _("Idle: ") : ""), itime, + (b->idle ? "\n" : ""), caps); + + gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, ""); + + g_free(sotime); + g_free(itime); } else { /* FIXME */ }
--- a/src/gaim.h Sat Nov 04 20:20:27 2000 +0000 +++ b/src/gaim.h Sat Nov 04 22:35:05 2000 +0000 @@ -459,9 +459,6 @@ extern GtkWidget *applet; #endif /* USE_APPLET */ -/* Globals in server.c */ -extern int correction_time; - /* Globals in dialog.c */ extern char fontface[64]; extern GdkColor bgcolor;
--- a/src/multi.h Sat Nov 04 20:20:27 2000 +0000 +++ b/src/multi.h Sat Nov 04 22:35:05 2000 +0000 @@ -55,6 +55,7 @@ char g_screenname[64]; int options; /* same as aim_user options */ int keepalive; + int correction_time; /* stuff needed for per-connection idle times */ int idle_timer; time_t login_time;
--- a/src/server.c Sat Nov 04 20:20:27 2000 +0000 +++ b/src/server.c Sat Nov 04 22:35:05 2000 +0000 @@ -44,8 +44,6 @@ #include "pixmaps/ok.xpm" #include "pixmaps/cancel.xpm" -int correction_time = 0; - void serv_login(struct aim_user *user) { struct prpl *p = find_prpl(user->protocol); @@ -412,7 +410,7 @@ struct gaim_connection *g = find_gaim_conn_by_name(name); if (g) { - correction_time = (int)(signon - g->login_time); + gc->correction_time = (int)(signon - g->login_time); if (!b) { return; }