Mercurial > pidgin
changeset 2787:feea7103a235
[gaim-migrate @ 2800]
i wish i had a spine
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 21 Nov 2001 12:16:15 +0000 |
parents | 318f846120e2 |
children | 3bf63f1882c8 |
files | ChangeLog src/buddy.c src/conversation.c src/gaim.h src/prefs.c src/server.c src/ui.h |
diffstat | 7 files changed, 67 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Nov 21 01:52:41 2001 +0000 +++ b/ChangeLog Wed Nov 21 12:16:15 2001 +0000 @@ -6,6 +6,7 @@ * Updated Russian translation (thanks Grigory Bakunov) * Updated Korean translation (thanks Ho-seok Lee, also for resized ICQ icons) + * Option to show aliases in conversation tabs version 0.48 (11/18/2001): * Right-click on links to open/copy URL
--- a/src/buddy.c Wed Nov 21 01:52:41 2001 +0000 +++ b/src/buddy.c Wed Nov 21 12:16:15 2001 +0000 @@ -239,6 +239,7 @@ void handle_buddy_rename(struct buddy *b, char *prevname) { + struct conversation *cnv; struct buddy_show *bs; struct group_show *gs; struct group *g; @@ -255,6 +256,9 @@ g_snprintf(buf, sizeof(buf), "%s", b->name); gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, buf); + if ((cnv = find_conversation(b->name)) != NULL) + set_convo_title(cnv); + gs = find_group_show(prevname); g = find_group_by_buddy(b->gc, b->name);
--- a/src/conversation.c Wed Nov 21 01:52:41 2001 +0000 +++ b/src/conversation.c Wed Nov 21 12:16:15 2001 +0000 @@ -60,6 +60,8 @@ #include "pixmaps/mrt.xpm" #include "pixmaps/download.xpm" +static GtkTooltips *tabtips = NULL; + static gchar *ispell_cmd[] = { "ispell", "-a", NULL }; int state_lock = 0; @@ -200,20 +202,13 @@ void rm_log(struct log_conversation *a) { struct conversation *cnv = find_conversation(a->name); - char buf[128]; log_conversations = g_list_remove(log_conversations, a); save_prefs(); - if (cnv) { - if (!(logging_options & OPT_LOG_ALL)) - g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name); - else - g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name); - if (!(im_options & OPT_IM_ONE_WINDOW)) - gtk_window_set_title(GTK_WINDOW(cnv->window), buf); - } + if (cnv && !(im_options & OPT_IM_ONE_WINDOW)) + set_convo_title(cnv); } struct log_conversation *find_log_info(char *name) @@ -1873,6 +1868,8 @@ cnv->gc = c; + set_convo_title(cnv); + update_buttons_by_protocol(cnv); update_icon(cnv); @@ -2029,6 +2026,8 @@ c->gc = gc; + set_convo_title(c); + update_buttons_by_protocol(c); update_icon(c); @@ -2126,7 +2125,6 @@ { GtkWidget *win; GtkWidget *cont; - char buf[256]; GtkWidget *text; GtkWidget *sw; GtkWidget *send; @@ -2160,6 +2158,7 @@ c->hasfg = 0; if (im_options & OPT_IM_ONE_WINDOW) { + GtkWidget *page; if (!all_convos) { win = all_convos = c->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); @@ -2172,6 +2171,11 @@ GTK_SIGNAL_FUNC(delete_all_convo), NULL); convo_notebook = gtk_notebook_new(); + if (!tabtips) { + tabtips = gtk_tooltips_new(); + if (!(im_options & OPT_IM_ALIAS_TAB)) + gtk_tooltips_disable(tabtips); + } if (im_options & OPT_IM_SIDE_TAB) { if (im_options & OPT_IM_BR_TAB) { gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), @@ -2200,8 +2204,14 @@ cont = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(cont), 5); + /* this doesn't actually matter since we're resetting it once we're out of the if/else */ gtk_notebook_append_page(GTK_NOTEBOOK(convo_notebook), cont, gtk_label_new(c->name)); gtk_widget_show(cont); + + page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(convo_notebook), + g_list_index(conversations, c)); + page = gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook), page); + gtk_tooltips_set_tip(tabtips, page->parent, c->name, c->name); } else { cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); c->window = win; @@ -2211,14 +2221,10 @@ gtk_container_border_width(GTK_CONTAINER(win), 10); gtk_widget_realize(win); aol_icon(win->window); - if ((find_log_info(c->name)) || ((logging_options & OPT_LOG_ALL))) - g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); - else - g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); - gtk_window_set_title(GTK_WINDOW(win), buf); gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); } + set_convo_title(c); paned = gtk_vpaned_new(); gtk_paned_set_gutter_size(GTK_PANED(paned), 15); @@ -2503,14 +2509,40 @@ } } -void set_convo_tab_label(struct conversation *c, char *text) +void set_convo_title(struct conversation *c) { - gtk_label_set_text(GTK_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook), - gtk_notebook_get_nth_page(GTK_NOTEBOOK - (convo_notebook), - g_list_index - (conversations, - c)))), text); + struct buddy *b; + char *text; + int index; + GtkNotebook *nb; + + if (!convo_notebook) { + char buf[256]; + if ((find_log_info(c->name)) || (logging_options & OPT_LOG_ALL)) + g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); + else + g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); + gtk_window_set_title(GTK_WINDOW(c->window), buf); + return; + } + + if ((im_options & OPT_IM_ALIAS_TAB) && c->gc && ((b = find_buddy(c->gc, c->name)) != NULL)) + text = b->show; + else + text = c->name; + + nb = GTK_NOTEBOOK(convo_notebook); + index = g_list_index(conversations, c); + gtk_notebook_set_tab_label_text(nb, gtk_notebook_get_nth_page(nb, index), text); +} + +void set_convo_titles() +{ + GList *c = conversations; + while (c) { + set_convo_title(c->data); + c = c->next; + } } void raise_convo_tab(struct conversation *c)
--- a/src/gaim.h Wed Nov 21 01:52:41 2001 +0000 +++ b/src/gaim.h Wed Nov 21 12:16:15 2001 +0000 @@ -242,6 +242,7 @@ #define OPT_IM_SIDE_TAB 0x00000020 #define OPT_IM_BR_TAB 0x00000040 #define OPT_IM_HIDE_ICONS 0x00000080 +#define OPT_IM_ALIAS_TAB 0x00002000 extern guint chat_options; #define OPT_CHAT_ONE_WINDOW 0x00000001
--- a/src/prefs.c Wed Nov 21 01:52:41 2001 +0000 +++ b/src/prefs.c Wed Nov 21 12:16:15 2001 +0000 @@ -906,6 +906,7 @@ vbox2); gaim_button(_("Raise windows on events"), &im_options, OPT_IM_POPUP, vbox2); gaim_button(_("Show logins in window"), &im_options, OPT_IM_LOGON, vbox2); + gaim_button(_("Show aliases in tabs"), &im_options, OPT_IM_ALIAS_TAB, vbox2); frame = gtk_frame_new(_("Window Sizes")); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); @@ -2629,6 +2630,9 @@ if (option == OPT_IM_HIDE_ICONS) set_hide_icons(); + if (option == OPT_IM_ALIAS_TAB) + set_convo_titles(); + save_prefs(); }
--- a/src/server.c Wed Nov 21 01:52:41 2001 +0000 +++ b/src/server.c Wed Nov 21 12:16:15 2001 +0000 @@ -665,34 +665,7 @@ /* server with what's in our record. We want to */ /* store things how THEY want it... */ if (strcmp(name, b->name)) { - GList *cnv = conversations; - struct conversation *cv; - - char *who = g_malloc(80); - - strcpy(who, normalize(name)); - - while (cnv) { - cv = (struct conversation *)cnv->data; - if (!g_strcasecmp(who, normalize(cv->name))) { - if (im_options & OPT_IM_ONE_WINDOW) { - set_convo_tab_label(cv, b->name); - } else { - g_snprintf(cv->name, sizeof(cv->name), "%s", name); - if (find_log_info(name) || (logging_options & OPT_LOG_ALL)) - g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); - else - g_snprintf(who, 63, CONVERSATION_TITLE, name); - gtk_window_set_title(GTK_WINDOW(cv->window), who); - /* was g_free(buf), but break gives us that - * and freeing twice is not good --Sumner */ - break; - } - } - cnv = cnv->next; - } - g_free(who); - who = g_strdup(b->name); + char *who = g_strdup(b->name); g_snprintf(b->name, sizeof(b->name), "%s", name); handle_buddy_rename(b, who); g_free(who);
--- a/src/ui.h Wed Nov 21 01:52:41 2001 +0000 +++ b/src/ui.h Wed Nov 21 12:16:15 2001 +0000 @@ -336,7 +336,7 @@ extern void gaim_setup_imhtml(GtkWidget *); extern void update_convo_add_button(struct conversation *); extern void raise_convo_tab(struct conversation *); -extern void set_convo_tab_label(struct conversation *, char *); +extern void set_convo_title(struct conversation *); extern void show_conv(struct conversation *); extern struct conversation *new_conversation(char *); extern void delete_conversation(struct conversation *); @@ -373,6 +373,7 @@ extern void update_convo_color(); extern void update_convo_font(); extern void set_hide_icons(); +extern void set_convo_titles(); /* Functions in dialogs.c */ extern void alias_dialog_bud(struct buddy *);