[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src contact.h,1.7,1.8 status.c,1.56,1.57
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src contact.h,1.7,1.8 status.c,1.56,1.57 |
Date: |
Tue, 18 Mar 2003 05:47:17 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv8475/src
Modified Files:
contact.h status.c
Log Message:
better tooltip handling
Index: contact.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/contact.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- contact.h 29 Jan 2003 19:19:22 -0000 1.7
+++ contact.h 18 Mar 2003 10:47:14 -0000 1.8
@@ -54,6 +54,9 @@
void * status; /* GtkWidget */
void * label; /* GtkWidget */
int icon_handler;
+
+ char *last_status;
+ time_t last_status_change;
};
Index: status.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/status.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- status.c 17 Mar 2003 23:25:50 -0000 1.56
+++ status.c 18 Mar 2003 10:47:14 -0000 1.57
@@ -798,7 +798,7 @@
{
char * c = NULL, *tmp = NULL;
int need_tooltip_update = 0;
-
+ int need_tooltip_display = 0;
tmp = g_strndup(RUN_SERVICE(ea)->get_status_string(ea), 20);
c = g_strdup_printf("%s%s%s",
strlen(tmp)?"(":"",
@@ -830,36 +830,46 @@
if (update_contact && !ea->account_contact->status) {
ea->account_contact->status = gtk_label_new(c);
need_tooltip_update = 1;
+ printf("update!\n");
} else if (update_contact) {
- char *tmp = NULL;
- gtk_label_get(ea->account_contact->status, &tmp);
- need_tooltip_update = strcmp(c, tmp);
+ need_tooltip_update = (ea->account_contact->last_status
+ && strcmp(c,
ea->account_contact->last_status));
+ need_tooltip_display =
!gtk_tooltips_data_get(ea->account_contact->list_item);
+
gtk_label_set_text(ea->account_contact->status, c);
+ printf("update:%d|%d (%s, %s %p -
%s)\n",need_tooltip_update,need_tooltip_display,
+ ea->account_contact->last_status, c,
gtk_tooltips_data_get(ea->account_contact->list_item),
ea->account_contact->nick);
}
- if (update_contact && need_tooltip_update) {
- time_t t;
+ if (update_contact && (need_tooltip_display || need_tooltip_update)) {
struct tm *mytime;
char buff[128];
char *status = RUN_SERVICE(ea)->get_status_string(ea);
char *status_line = NULL;
- time(&t);
- mytime = localtime(&t);
-
- strftime(buff, 128, "%H:%M (%b %d)", mytime);
- status_line = g_strdup_printf(
- _("%s since %s"),
- strlen(status)?status:"Online", buff);
-
- if(!status_tips)
- status_tips = gtk_tooltips_new();
- gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips),
- ea->account_contact->list_item,
- status_line,
- _("status info here"));
+ if (need_tooltip_update) {
+ time(&ea->account_contact->last_status_change);
+ if (ea->account_contact->last_status)
+ free(ea->account_contact->last_status);
+ ea->account_contact->last_status = strdup(c);
+ }
+
+ if (ea->account_contact->last_status_change != 0) {
+ mytime =
localtime(&ea->account_contact->last_status_change);
+ strftime(buff, 128, "%H:%M (%b %d)", mytime);
+ status_line = g_strdup_printf(
+ _("%s since %s"),
+ strlen(status)?status:"Online", buff);
+
+ if(!status_tips)
+ status_tips = gtk_tooltips_new();
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips),
+ ea->account_contact->list_item,
+ status_line,
+ _("status info here"));
- g_free(status_line);
+ g_free(status_line);
+ }
}
g_free(c);
g_free(tmp);
@@ -881,7 +891,7 @@
box = gtk_hbox_new(FALSE, 1);
ea->pix = gtk_pixmap_new(iconblank_pm, iconblank_bm);
label = gtk_label_new(ea->handle);
- set_status_label(ea, FALSE);
+ set_status_label(ea, TRUE);
gtk_box_pack_start(GTK_BOX(box), ea->pix, FALSE, FALSE, 1);
gtk_widget_show(ea->pix);
@@ -1161,6 +1171,9 @@
{
eb_log_status_changed(ea, RUN_SERVICE(ea)->get_status_string(ea));
buddy_update_status(ea);
+
+ if (!ea->account_contact->last_status)
+ ea->account_contact->last_status = strdup("dummy");
}
/* update the status info (pixmap and state) of an account */
@@ -1179,6 +1192,7 @@
set_status_label(ea, FALSE);
eb_update_status(ea, c);
+
g_free(c);
g_free(tmp);
@@ -1343,6 +1357,9 @@
ea->account_contact->online++;
ea->online = TRUE;
+
+ if (!ea->account_contact->last_status)
+ ea->account_contact->last_status = strdup("dummy");
if (iGetLocalPref("do_ignore_unknown") && !strcmp(_("Unknown"),
ea->account_contact->group->name))
return;
@@ -1381,6 +1398,9 @@
ea->account_contact->online--;
ea->online = FALSE;
+
+ if (!ea->account_contact->last_status)
+ ea->account_contact->last_status = strdup("dummy");
if (iGetLocalPref("do_ignore_unknown") && !strcmp(_("Unknown"),
ea->account_contact->group->name))
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src contact.h,1.7,1.8 status.c,1.56,1.57,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.346,1.347 configure.in,1.341,1.342
- Next by Date:
[Ayttm-commits] CVS: ayttm/src status.c,1.57,1.58
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.346,1.347 configure.in,1.341,1.342
- Next by thread:
[Ayttm-commits] CVS: ayttm/src status.c,1.57,1.58
- Index(es):