Mercurial > pidgin.yaz
changeset 5237:757d680f923d
[gaim-migrate @ 5607]
I guess I shouldn't force the aliases on everyone...now they're optional.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 26 Apr 2003 21:44:00 +0000 |
parents | 0d4b8ca97c17 |
children | c6973001473d |
files | src/blist.c src/dialogs.c src/gtkblist.c |
diffstat | 3 files changed, 72 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.c Sat Apr 26 20:42:30 2003 +0000 +++ b/src/blist.c Sat Apr 26 21:44:00 2003 +0000 @@ -203,11 +203,13 @@ { struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; - if(!alias || !strlen(alias)) - return; + g_free(chat->alias); - g_free(chat->alias); - chat->alias = g_strdup(alias); + if(alias && strlen(alias)) + chat->alias = g_strdup(alias); + else + chat->alias = NULL; + if(ops) ops->update(gaimbuddylist, (GaimBlistNode*)chat); } @@ -247,12 +249,13 @@ struct chat *chat; struct gaim_blist_ui_ops *ops; - if(!alias || !strlen(alias) || !components) + if(!components) return NULL; chat = g_new0(struct chat, 1); chat->account = account; - chat->alias = g_strdup(alias); + if(alias && strlen(alias)) + chat->alias = g_strdup(alias); chat->components = components; ((GaimBlistNode*)chat)->type = GAIM_BLIST_CHAT_NODE; @@ -1215,7 +1218,7 @@ } else if(!strcmp(element_name, "chat")) { struct gaim_account *account = gaim_account_find(blist_parser_account_name, blist_parser_account_protocol); - if(account && blist_parser_chat_alias) { + if(account) { struct chat *chat = gaim_chat_new(account, blist_parser_chat_alias, blist_parser_chat_components); struct group *g = gaim_find_group(blist_parser_group_name); gaim_blist_add_chat(chat,g,NULL); @@ -1560,13 +1563,17 @@ } else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) { struct chat *chat = (struct chat *)bnode; if(!exp_acct || chat->account == exp_acct) { - char *chat_alias = g_markup_escape_text(chat->alias, -1); char *acct_name = g_markup_escape_text(chat->account->username, -1); fprintf(file, "\t\t\t<chat protocol=\"%d\" account=\"%s\">\n", chat->account->protocol, acct_name); - fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); + if(chat->alias) { + char *chat_alias = g_markup_escape_text(chat->alias, -1); + fprintf(file, "\t\t\t\t<alias>%s</alias>\n", chat_alias); + g_free(chat_alias); + } g_hash_table_foreach(chat->components, blist_print_chat_components, file); fprintf(file, "\t\t\t</chat>\n"); + g_free(acct_name); } } }
--- a/src/dialogs.c Sat Apr 26 20:42:30 2003 +0000 +++ b/src/dialogs.c Sat Apr 26 21:44:00 2003 +0000 @@ -1229,8 +1229,10 @@ gaim_blist_add_group(group, NULL); } - gaim_blist_add_chat(chat, group, NULL); - gaim_blist_save(); + if(chat) { + gaim_blist_add_chat(chat, group, NULL); + gaim_blist_save(); + } gtk_widget_destroy(ac->window); g_list_free(ac->entries); @@ -1252,6 +1254,7 @@ static void rebuild_addchat_entries(struct addchat *ac) { GList *list, *tmp; struct proto_chat_entry *pce; + gboolean focus = TRUE; while(GTK_BOX(ac->entries_box)->children) gtk_container_remove(GTK_CONTAINER(ac->entries_box), @@ -1296,6 +1299,11 @@ if(pce->def) gtk_entry_set_text(GTK_ENTRY(entry), pce->def); + if(focus) { + gtk_widget_grab_focus(entry); + focus = FALSE; + } + gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(entry), "activate", @@ -1420,6 +1428,12 @@ create_online_account_menu_for_add_chat(ac); + ac->entries_box = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(ac->entries_box), 0); + gtk_box_pack_start(GTK_BOX(vbox), ac->entries_box, TRUE, TRUE, 0); + + rebuild_addchat_entries(ac); + rowbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); @@ -1431,12 +1445,6 @@ ac->alias_entry = gtk_entry_new(); gtk_box_pack_end(GTK_BOX(rowbox), ac->alias_entry, TRUE, TRUE, 0); - ac->entries_box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(ac->entries_box), 0); - gtk_box_pack_start(GTK_BOX(vbox), ac->entries_box, TRUE, TRUE, 0); - - rebuild_addchat_entries(ac); - rowbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); @@ -1454,8 +1462,6 @@ g_signal_connect(G_OBJECT(ac->window), "response", G_CALLBACK(do_add_chat_resp), ac); - gtk_widget_grab_focus(ac->alias_entry); - gtk_widget_show_all(ac->window); } @@ -3569,10 +3575,8 @@ if(resp == GTK_RESPONSE_OK) { GtkWidget *entry = g_object_get_data(G_OBJECT(w), "alias_entry"); const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); - if(text && strlen(text)) { - gaim_blist_alias_chat(chat, text); - gaim_blist_save(); - } + gaim_blist_alias_chat(chat, text); + gaim_blist_save(); } gtk_widget_destroy(w); }
--- a/src/gtkblist.c Sat Apr 26 20:42:30 2003 +0000 +++ b/src/gtkblist.c Sat Apr 26 21:44:00 2003 +0000 @@ -763,15 +763,33 @@ static char *gaim_get_tooltip_text(GaimBlistNode *node) { + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info = NULL; char *text = NULL; if(GAIM_BLIST_NODE_IS_CHAT(node)) { struct chat *chat = (struct chat *)node; + char *name = NULL; + + if(chat->alias) { + name = g_markup_escape_text(chat->alias, -1); + } else { + struct proto_chat_entry *pce; + GList *parts; + prpl = gaim_find_prpl(chat->account->protocol); + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + + parts = prpl_info->chat_info(chat->account->gc); + pce = parts->data; + name = g_markup_escape_text(g_hash_table_lookup(chat->components, + pce->identifier), -1); + g_list_free(parts); + } + text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", - chat->alias); + name); + g_free(name); } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) { - GaimPlugin *prpl; - GaimPluginProtocolInfo *prpl_info = NULL; struct buddy *b = (struct buddy *)node; char *statustext = NULL; char *aliastext = NULL, *nicktext = NULL; @@ -1686,20 +1704,33 @@ if (GAIM_BLIST_NODE_IS_CHAT(node) && ((struct chat*)node)->account->gc) { GdkPixbuf *status; - char *mark; + struct chat *chat = (struct chat *)node; + char *name; status = gaim_gtk_blist_get_status_icon(node, blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL); - mark = g_markup_escape_text(((struct chat*)node)->alias, -1); + if(chat->alias) { + name = g_markup_escape_text(chat->alias, -1); + } else { + struct proto_chat_entry *pce; + GList *parts; + + parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); + pce = parts->data; + name = g_markup_escape_text(g_hash_table_lookup(chat->components, + pce->identifier), -1); + g_list_free(parts); + } + gtk_tree_store_set(gtkblist->treemodel, &iter, STATUS_ICON_COLUMN, status, STATUS_ICON_VISIBLE_COLUMN, TRUE, - NAME_COLUMN, mark, + NAME_COLUMN, name, NODE_COLUMN, node, -1); - g_free(mark); + g_free(name); if (status != NULL) g_object_unref(status); } else if(GAIM_BLIST_NODE_IS_CHAT(node) && !((struct chat *)node)->account->gc) {