Mercurial > pidgin.yaz
changeset 6392:e9974608b319
[gaim-migrate @ 6897]
deryni absolutely rocks. Amazing guy. We now have these beautiful protocol
icons on tabs that update to reflect status. Away, grey on idle, even the
sign on/off doors. Wow. This will no doubt be known as the highlight of
0.67.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 06 Aug 2003 11:38:57 +0000 |
parents | 4b2d8d7d0118 |
children | 74ca311ceb2a |
files | ChangeLog plugins/spellchk.c src/blist.c src/dialogs.c src/gtkconv.c src/gtkconv.h src/gtkprefs.c src/server.c |
diffstat | 8 files changed, 141 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Aug 06 09:43:11 2003 +0000 +++ b/ChangeLog Wed Aug 06 11:38:57 2003 +0000 @@ -4,6 +4,8 @@ * Brought back the message notification plugin (Brian Tarricone) You'll need to reconfigure your settings for this plugin * IRC protocol plugin rewritten (Ethan Blanton) + * Protocol and status icons now optionally appear on tabs. + (Etan Reisner) * Various dialog rewrites (Jabber vCard, Add Group, Alias Chat, Rename Group, Privacy) * Shows "hiptop" icon for AIM buddies using hiptop
--- a/plugins/spellchk.c Wed Aug 06 09:43:11 2003 +0000 +++ b/plugins/spellchk.c Wed Aug 06 11:38:57 2003 +0000 @@ -518,7 +518,7 @@ VERSION, N_("Replaces text in outgoing messages according to user-defined rules."), N_("Replaces text in outgoing messages according to user-defined rules."), - "Eric Warmnenhoven <eric@warmenhoven.org>", + "Eric Warmenhoven <eric@warmenhoven.org>", GAIM_WEBSITE, plugin_load, NULL,
--- a/src/blist.c Wed Aug 06 09:43:11 2003 +0000 +++ b/src/blist.c Wed Aug 06 11:38:57 2003 +0000 @@ -167,6 +167,7 @@ static gboolean presence_update_timeout_cb(struct buddy *buddy) { struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; + GaimConversation *conv = gaim_find_conversation(buddy->name); if(buddy->present == GAIM_BUDDY_SIGNING_ON) { buddy->present = GAIM_BUDDY_ONLINE; @@ -179,6 +180,13 @@ if (ops) ops->update(gaimbuddylist, (GaimBlistNode*)buddy); + if (conv) { + if (buddy->present == GAIM_BUDDY_ONLINE) + gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE); + else if (buddy->present == GAIM_BUDDY_OFFLINE) + gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_OFFLINE); + } + return FALSE; }
--- a/src/dialogs.c Wed Aug 06 09:43:11 2003 +0000 +++ b/src/dialogs.c Wed Aug 06 11:38:57 2003 +0000 @@ -1784,6 +1784,7 @@ GAIM_DIALOG(b->window); gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); + gtk_window_set_role(GTK_WINDOW(b->window), "get_info"); gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); gtk_widget_realize(GTK_WIDGET(b->window)); g_signal_connect(G_OBJECT(b->window), "destroy", G_CALLBACK(info_dlg_free), b);
--- a/src/gtkconv.c Wed Aug 06 09:43:11 2003 +0000 +++ b/src/gtkconv.c Wed Aug 06 11:38:57 2003 +0000 @@ -3816,6 +3816,8 @@ gboolean new_ui; GaimConversationType conv_type; const char *name; + struct buddy *b = NULL; + GaimAccount *account; name = gaim_conversation_get_name(conv); conv_type = gaim_conversation_get_type(conv); @@ -3952,6 +3954,16 @@ g_signal_connect(G_OBJECT(gtkconv->close), "clicked", G_CALLBACK(close_conv_cb), conv); + /* Status icon. */ + account = gaim_conversation_get_account(conv); + b = gaim_find_buddy(account, name); + if (b != NULL) + gtkconv->icon = gtk_image_new_from_pixbuf( + gaim_gtk_blist_get_status_icon((GaimBlistNode *)b, + GAIM_STATUS_ICON_SMALL)); + else + gtkconv->icon = gtk_image_new(); + /* Tab label. */ gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); #if 0 @@ -3961,10 +3973,14 @@ /* Pack it all together. */ + gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) + gtk_widget_show_all(gtkconv->icon); + gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); gtk_widget_show(gtkconv->tab_label); + gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); - if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) gtk_widget_show_all(gtkconv->close); @@ -4754,6 +4770,29 @@ } static void +update_tab_icon(GaimConversation *conv) +{ + GaimGtkConversation *gtkconv; + GaimAccount *account; + const char *name; + struct buddy *b; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + name = gaim_conversation_get_name(conv); + account = gaim_conversation_get_account(conv); + b = gaim_find_buddy(account, name); + + if (b != NULL) + gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), + gaim_gtk_blist_get_status_icon((GaimBlistNode *)b, + GAIM_STATUS_ICON_SMALL)); + else { + g_object_unref(gtkconv->icon); + gtkconv->icon = gtk_image_new(); + } +} + +static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) { GaimWindow *win; @@ -4840,6 +4879,12 @@ type == GAIM_CONV_ACCOUNT_OFFLINE) { generate_send_as_items(win, NULL); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) + update_tab_icon(conv); + } + else if (type == GAIM_CONV_UPDATE_AWAY) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) + update_tab_icon(conv); } else if(type == GAIM_CONV_UPDATE_ADD || type == GAIM_CONV_UPDATE_REMOVE) { @@ -5491,8 +5536,31 @@ } static void +icons_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + GList *l; + GaimConversation *conv; + GaimGtkConversation *gtkconv; + + for (l = gaim_get_conversations(); l != NULL; l = l->next) { + conv = (GaimConversation *)l->data; + + if (!GAIM_IS_GTK_CONVERSATION(conv)) + continue; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + if (value) + gtk_widget_show(gtkconv->icon); + else + gtk_widget_hide(gtkconv->icon); + } +} + +static void close_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, - gpointer data) + gpointer data) { GList *l; GaimConversation *conv; @@ -5719,6 +5787,7 @@ { /* Conversations */ gaim_prefs_add_none("/gaim/gtk/conversations"); + gaim_prefs_add_bool("/gaim/gtk/conversations/icons_on_tabs", TRUE); gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); @@ -5773,6 +5842,8 @@ gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); /* Connect callbacks. */ + gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", + icons_on_tabs_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", close_on_tabs_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys",
--- a/src/gtkconv.h Wed Aug 06 09:43:11 2003 +0000 +++ b/src/gtkconv.h Wed Aug 06 11:38:57 2003 +0000 @@ -143,6 +143,7 @@ GtkWidget *send; GtkWidget *info; GtkWidget *close; + GtkWidget *icon; GtkWidget *tab_label; GtkSizeGroup *sg;
--- a/src/gtkprefs.c Wed Aug 06 09:43:11 2003 +0000 +++ b/src/gtkprefs.c Wed Aug 06 11:38:57 2003 +0000 @@ -886,7 +886,7 @@ GtkWidget *ret; GtkWidget *vbox; GtkWidget *label; - GtkWidget *button, *close_checkbox; + GtkWidget *button, *close_checkbox, *icons_checkbox; GtkSizeGroup *sg; GList *names = NULL; @@ -947,6 +947,17 @@ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), close_checkbox); + icons_checkbox = prefs_checkbox(_("Show status _icons on tabs."), + "/gaim/gtk/conversations/icons_on_tabs", + vbox); + + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { + gtk_widget_set_sensitive(GTK_WIDGET(icons_checkbox), FALSE); + } + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(gaim_gtk_toggle_sensitive), icons_checkbox); + gtk_widget_show_all(ret); return ret;
--- a/src/server.c Wed Aug 06 09:43:11 2003 +0000 +++ b/src/server.c Wed Aug 06 11:38:57 2003 +0000 @@ -1019,11 +1019,13 @@ int evil, time_t signon, time_t idle, int type) { GaimAccount *account; + GaimConversation *c; struct buddy *b; GSList *buddies; account = gaim_connection_get_account(gc); b = gaim_find_buddy(account, name); + c = gaim_find_conversation(b->name); if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options & OPT_PROTO_CORRECT_TIME)) { @@ -1075,30 +1077,29 @@ gaim_blist_update_buddy_status(b, type); - if (loggedin) { if (!GAIM_BUDDY_IS_ONLINE(b)) { - GaimConversation *c = gaim_find_conversation(b->name); - if (c != NULL && - gaim_prefs_get_bool("/core/conversations/im/show_login")) { + if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { + if (c != NULL) { - char *tmp = g_strdup_printf(_("%s logged in."), - gaim_get_buddy_alias(b)); + char *tmp = g_strdup_printf(_("%s logged in."), + gaim_get_buddy_alias(b)); - gaim_conversation_write(c, NULL, tmp, -1, - WFLAG_SYSTEM, time(NULL)); - g_free(tmp); - } - else if (awayqueue && find_queue_total_by_name(b->name)) { - struct queued_message *qm = g_new0(struct queued_message, 1); - g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); - qm->message = g_strdup_printf(_("%s logged in."), - gaim_get_buddy_alias(b)); - qm->account = gc->account; - qm->tm = time(NULL); - qm->flags = WFLAG_SYSTEM; - qm->len = -1; - message_queue = g_slist_append(message_queue, qm); + gaim_conversation_write(c, NULL, tmp, -1, + WFLAG_SYSTEM, time(NULL)); + g_free(tmp); + } + else if (awayqueue && find_queue_total_by_name(b->name)) { + struct queued_message *qm = g_new0(struct queued_message, 1); + g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); + qm->message = g_strdup_printf(_("%s logged in."), + gaim_get_buddy_alias(b)); + qm->account = gc->account; + qm->tm = time(NULL); + qm->flags = WFLAG_SYSTEM; + qm->len = -1; + message_queue = g_slist_append(message_queue, qm); + } } gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); gaim_pounce_execute(gc->account, b->name, GAIM_POUNCE_SIGNON); @@ -1106,25 +1107,26 @@ } } else { if (GAIM_BUDDY_IS_ONLINE(b)) { - GaimConversation *c = gaim_find_conversation(b->name); - if (c != NULL && - gaim_prefs_get_bool("/core/conversations/im/show_login")) { + + if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { + if (c != NULL) { - char *tmp = g_strdup_printf(_("%s logged out."), - gaim_get_buddy_alias(b)); - gaim_conversation_write(c, NULL, tmp, -1, - WFLAG_SYSTEM, time(NULL)); - g_free(tmp); - } else if (awayqueue && find_queue_total_by_name(b->name)) { - struct queued_message *qm = g_new0(struct queued_message, 1); - g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); - qm->message = g_strdup_printf(_("%s logged out."), - gaim_get_buddy_alias(b)); - qm->account = gc->account; - qm->tm = time(NULL); - qm->flags = WFLAG_SYSTEM; - qm->len = -1; - message_queue = g_slist_append(message_queue, qm); + char *tmp = g_strdup_printf(_("%s logged out."), + gaim_get_buddy_alias(b)); + gaim_conversation_write(c, NULL, tmp, -1, + WFLAG_SYSTEM, time(NULL)); + g_free(tmp); + } else if (awayqueue && find_queue_total_by_name(b->name)) { + struct queued_message *qm = g_new0(struct queued_message, 1); + g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); + qm->message = g_strdup_printf(_("%s logged out."), + gaim_get_buddy_alias(b)); + qm->account = gc->account; + qm->tm = time(NULL); + qm->flags = WFLAG_SYSTEM; + qm->len = -1; + message_queue = g_slist_append(message_queue, qm); + } } serv_got_typing_stopped(gc, name); /* obviously not typing */ gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); @@ -1133,6 +1135,9 @@ } } + if (c != NULL) + gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY); + gaim_blist_update_buddy_presence(b, loggedin); for (buddies = gaim_find_buddies(account, name); buddies; buddies = g_slist_remove(buddies, buddies->data)) {