[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src away_window.c,1.13,1.14 chat_window.c,1.
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src away_window.c,1.13,1.14 chat_window.c,1.45,1.46 status.c,1.44,1.45 |
Date: |
Thu, 06 Feb 2003 05:08:53 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv22567/src
Modified Files:
away_window.c chat_window.c status.c
Log Message:
gtkText for away message
Index: away_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/away_window.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- away_window.c 29 Jan 2003 19:19:22 -0000 1.13
+++ away_window.c 6 Feb 2003 10:08:51 -0000 1.14
@@ -222,13 +222,16 @@
gint save = GTK_TOGGLE_BUTTON(save_later)->active;
away * my_away;
- gchar buff[2048];
+ gchar *buff = NULL;
- strcpy(buff, gtk_entry_get_text(GTK_ENTRY(title)));
- strcpy(buff, gtk_entry_get_text(GTK_ENTRY(away_message_text_entry)));
+ buff = strdup(gtk_entry_get_text(GTK_ENTRY(title)));
if (!buff || strlen(buff) == 0) {
- strcpy(buff,
gtk_entry_get_text(GTK_ENTRY(away_message_text_entry)));
+ buff=
gtk_editable_get_chars(GTK_EDITABLE(away_message_text_entry),0,-1);
+ if (strchr(buff,'\n') != NULL) {
+ char *t = strchr(buff,'\n');
+ *t = 0;
+ }
}
if (!buff || strlen(buff) == 0) {
do_error_dialog (_("Enter at least a message.\n"),_("Error"));
@@ -236,9 +239,17 @@
}
g_string_append(a_title, buff);
- strcpy(buff, gtk_entry_get_text(GTK_ENTRY(away_message_text_entry)));
+ free(buff);
+
+ buff =
gtk_editable_get_chars(GTK_EDITABLE(away_message_text_entry),0,-1);
+
+ if (!buff || strlen(buff) == 0) /* in this case title can't be empty */
+ buff = strdup(a_title->str);
+
g_string_append(a_message, buff);
+ free (buff);
+
if (save == 1) {
my_away = g_new0(away, 1);
strncpy(my_away->title, a_title->str, strlen(a_title->str));
@@ -299,7 +310,9 @@
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
gtk_widget_show(label);
- away_message_text_entry = gtk_entry_new();
+ away_message_text_entry = gtk_text_new(NULL,NULL);
+ gtk_text_set_editable(GTK_TEXT(away_message_text_entry), TRUE);
+ gtk_widget_set_usize(away_message_text_entry, 300, 60);
gtk_table_attach_defaults(GTK_TABLE(table),
away_message_text_entry, 1, 2, 1, 2);
gtk_widget_show(away_message_text_entry);
@@ -432,8 +445,12 @@
gtk_widget_show(label);
- away_message_text_entry = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(away_message_text_entry),
(strlen(a_message)>0 ? a_message : _("User is currently away")) );
+ away_message_text_entry = gtk_text_new(NULL,NULL);
+ gtk_text_set_editable(GTK_TEXT(away_message_text_entry), TRUE);
+ gtk_widget_set_usize(away_message_text_entry, 300, 60);
+ gtk_text_insert(GTK_TEXT(away_message_text_entry),
NULL,NULL,NULL,
+ a_message, strlen(a_message));
+
gtk_box_pack_start(GTK_BOX(vbox), away_message_text_entry,
TRUE, TRUE, 5);
gtk_widget_show(away_message_text_entry);
@@ -470,6 +487,6 @@
gchar * get_away_message()
{
- return gtk_entry_get_text(GTK_ENTRY(away_message_text_entry));
+ return
gtk_editable_get_chars(GTK_EDITABLE(away_message_text_entry),0,-1);
}
Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- chat_window.c 31 Jan 2003 13:05:31 -0000 1.45
+++ chat_window.c 6 Feb 2003 10:08:51 -0000 1.46
@@ -1269,15 +1269,16 @@
We might want to give the option of whether or not to always send the
message.*/
if(is_away && (time(NULL) - remote_contact->chatwindow->away_msg_sent)
> 300) {
+ char *awaymsg = get_away_message();
send_message(NULL, remote_contact->chatwindow);
- RUN_SERVICE(account)->send_im(account, remote,
get_away_message());
+ RUN_SERVICE(account)->send_im(account, remote, awaymsg);
time(&t);
cur_time = localtime(&t);
g_snprintf(buff, BUF_SIZE, "<FONT
COLOR=\"#0000ff\"><B>%d:%.2d:%.2d %s: </B></FONT>",
cur_time->tm_hour, cur_time->tm_min, cur_time->tm_sec,
account->alias);
gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
buff,0,0,0);
- gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
get_away_message(),
+ gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
awaymsg,
iGetLocalPref("do_ignore_back"),
iGetLocalPref("do_ignore_fore"), iGetLocalPref("do_ignore_font"));
gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
"<br>", 0,0,0);
@@ -1288,7 +1289,9 @@
/* Log it */
if ( iGetLocalPref("do_logging") )
- eb_log_message(remote_contact->chatwindow, buff,
get_away_message());
+ eb_log_message(remote_contact->chatwindow, buff,
awaymsg);
+
+ g_free(awaymsg);
}
free(message);
}
Index: status.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/status.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- status.c 6 Feb 2003 08:52:42 -0000 1.44
+++ status.c 6 Feb 2003 10:08:51 -0000 1.45
@@ -792,6 +792,34 @@
gtk_widget_show(eg->list_item);
}
+static void set_status_label(eb_account *ea)
+{
+ char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea), 20);
+ while (strchr(c,'\n') != NULL) {
+ char *t = strchr(c,'\n');
+ *t = ' ';
+ }
+ if(strlen(c) == 20) {
+ c[19] = c[18] = c[17] = '.';
+ if(!status_tips)
+ status_tips = gtk_tooltips_new();
+ /*
+ * that 3rd parameter is not a bug, it really is a useless
+ * parameter
+ */
+
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips), ea->list_item,
+ RUN_SERVICE(ea)->get_status_string(ea),
+ _("status info here"));
+ }
+ if (!ea->status)
+ ea->status = gtk_label_new(c);
+ else
+ gtk_label_set_text(GTK_LABEL(ea->status),c);
+
+ g_free(c);
+}
+
/* makes an account visible on the buddy list, making the contact visible
if necessary */
void add_account_line( eb_account * ea)
@@ -808,24 +836,7 @@
box = gtk_hbox_new(FALSE, 1);
ea->pix = gtk_pixmap_new(iconblank_pm, iconblank_bm);
label = gtk_label_new(ea->handle);
- {
- char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea),
20);
- if(strlen(c) == 20) {
- c[19] = c[18] = c[17] = '.';
- if(!status_tips)
- status_tips = gtk_tooltips_new();
- /*
- * that 3rd parameter is not a bug, it really is a
useless
- * parameter
- */
-
- gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips),
ea->list_item,
- RUN_SERVICE(ea)->get_status_string(ea),
- _("status info here"));
- }
- ea->status = gtk_label_new(c);
- g_free(c);
- }
+ set_status_label(ea);
gtk_box_pack_start(GTK_BOX(box), ea->pix, FALSE, FALSE, 1);
gtk_widget_show(ea->pix);
@@ -1067,25 +1078,8 @@
if (!ea)
return;
- {
- char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea),
20);
- if(strlen(c) == 20)
- {
- c[19] = c[18] = c[17] = '.';
- if(!status_tips)
- status_tips = gtk_tooltips_new();
- /*
- * that 3rd parameter is not a bug, it really is a
useless
- * parameter
- */
-
- gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips),
ec->list_item,
- RUN_SERVICE(ea)->get_status_string(ea),
- _("status info here"));
- }
- gtk_label_set_text(GTK_LABEL(ec->status), c);
- g_free(c);
- }
+ set_status_label(ea);
+
gtk_label_set_text(GTK_LABEL(ec->label), ec->nick);
/* set the icon if there isn't another timeout about to alter the icon
*/
@@ -1134,27 +1128,7 @@
if (!ea || !ea->list_item)
return;
- {
- char * c = g_strndup(RUN_SERVICE(ea)->get_status_string(ea),
20);
- if(strlen(c) == 20)
- {
- c[19] = c[18] = c[17] = '.';
- if(!status_tips)
- status_tips = gtk_tooltips_new();
- /*
- * that 3rd parameter is not a bug, it really is a
useless
- * parameter
- */
-
- gtk_tooltips_set_tip(GTK_TOOLTIPS(status_tips),
ea->list_item,
- RUN_SERVICE(ea)->get_status_string(ea),
- _("status info here"));
- }
- eb_update_status(ea, c);
- gtk_label_set_text(GTK_LABEL(ea->status), c);
-
- g_free(c);
- }
+ set_status_label(ea);
/* update the icon if another timeout isn't about to change it */
if (ea->icon_handler == -1) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src away_window.c,1.13,1.14 chat_window.c,1.45,1.46 status.c,1.44,1.45,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.278,1.279 configure.in,1.274,1.275
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.279,1.280 configure.in,1.275,1.276
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.278,1.279 configure.in,1.274,1.275
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.279,1.280 configure.in,1.275,1.276
- Index(es):