pidgin: e4a47fe9: Modified patch from John Moody to show a...
sadrul at pidgin.im
sadrul at pidgin.im
Thu May 8 01:05:40 EDT 2008
-----------------------------------------------------------------
Revision: e4a47fe98a9d4dd92ac57a9151cd63583fcf88cd
Ancestor: 85d457762640ae1f665e9ba6896004ac75132ef9
Author: sadrul at pidgin.im
Date: 2008-05-08T05:04:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e4a47fe98a9d4dd92ac57a9151cd63583fcf88cd
Modified files:
pidgin/gtkconv.c
ChangeLog:
Modified patch from John Moody to show aliases in the Invite dialog.
Closes #5722.
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c ed64fb67b2f5b1084f848a0fc6b3fa8920d16aaa
+++ pidgin/gtkconv.c f04b6ccf826b1d10029e7b6caa0c7fd1878862e0
@@ -150,7 +150,6 @@ static void gray_stuff_out(PidginConvers
static gboolean infopane_entry_activate(PidginConversation *gtkconv);
static void got_typing_keypress(PidginConversation *gtkconv, gboolean first);
static void gray_stuff_out(PidginConversation *gtkconv);
-static GList *generate_invite_user_names(PurpleConnection *gc);
static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name);
static gboolean tab_complete(PurpleConversation *conv);
static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type);
@@ -697,6 +696,22 @@ unblock_cb(GtkWidget *widget, PidginConv
gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry);
}
+static gboolean
+chat_invite_filter(const PidginBuddyCompletionEntry *entry, gpointer data)
+{
+ PurpleAccount *filter_account = data;
+ PurpleAccount *account = NULL;
+
+ if (entry->is_buddy) {
+ account = purple_buddy_get_account(entry->entry.buddy);
+ } else {
+ account = entry->entry.logged_buddy->account;
+ }
+ if (account == filter_account)
+ return TRUE;
+ return FALSE;
+}
+
static void
do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
{
@@ -706,7 +721,7 @@ do_invite(GtkWidget *w, int resp, Invite
gtkconv = PIDGIN_CONVERSATION(info->conv);
if (resp == GTK_RESPONSE_OK) {
- buddy = pidgin_text_combo_box_entry_get_text(info->entry);
+ buddy = gtk_entry_get_text(GTK_ENTRY(info->entry));
message = gtk_entry_get_text(GTK_ENTRY(info->message));
if (!g_ascii_strcasecmp(buddy, ""))
@@ -729,6 +744,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDr
{
InviteBuddyInfo *info = (InviteBuddyInfo *)data;
const char *convprotocol;
+ gboolean success = TRUE;
convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv));
@@ -751,11 +767,12 @@ invite_dnd_recv(GtkWidget *widget, GdkDr
purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
_("That buddy is not on the same protocol as this "
"chat."), NULL);
+ success = FALSE;
}
else
- pidgin_text_combo_box_entry_set_text(info->entry, buddy->name);
+ gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy));
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
}
else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
{
@@ -777,17 +794,18 @@ invite_dnd_recv(GtkWidget *widget, GdkDr
purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
_("That buddy is not on the same protocol as this "
"chat."), NULL);
+ success = FALSE;
}
else
{
- pidgin_text_combo_box_entry_set_text(info->entry, username);
+ gtk_entry_set_text(GTK_ENTRY(info->entry), username);
}
}
g_free(username);
g_free(protocol);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
}
}
@@ -878,7 +896,9 @@ invite_cb(GtkWidget *widget, PidginConve
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
/* Now the Buddy drop-down entry field. */
- info->entry = pidgin_text_combo_box_entry_new(NULL, generate_invite_user_names(gc));
+ info->entry = gtk_entry_new();
+ pidgin_setup_screenname_autocomplete_with_filter(info->entry, NULL, chat_invite_filter,
+ purple_conversation_get_account(conv));
gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry);
@@ -917,13 +937,12 @@ invite_cb(GtkWidget *widget, PidginConve
G_CALLBACK(invite_dnd_recv), info);
g_signal_connect(G_OBJECT(info->entry), "drag_data_received",
G_CALLBACK(invite_dnd_recv), info);
-
}
gtk_widget_show_all(invite_dialog);
if (info != NULL)
- gtk_widget_grab_focus(GTK_BIN(info->entry)->child);
+ gtk_widget_grab_focus(info->entry);
}
static void
@@ -3793,42 +3812,6 @@ generate_send_to_items(PidginWindow *win
update_send_to_selection(win);
}
-static GList *
-generate_invite_user_names(PurpleConnection *gc)
-{
- PurpleBlistNode *gnode,*cnode,*bnode;
- static GList *tmp = NULL;
-
- g_list_free(tmp);
- tmp = NULL;
-
- if (gc != NULL) {
- for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
- if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
- continue;
- for(cnode = gnode->child; cnode; cnode = cnode->next) {
- if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
- continue;
- for(bnode = cnode->child; bnode; bnode = bnode->next) {
- PurpleBuddy *buddy;
-
- if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
- continue;
-
- buddy = (PurpleBuddy *)bnode;
-
- if (buddy->account == gc->account &&
- PURPLE_BUDDY_IS_ONLINE(buddy))
- tmp = g_list_insert_sorted(tmp, buddy->name,
- (GCompareFunc)g_utf8_collate);
- }
- }
- }
- }
-
- return tmp;
-}
-
static GdkPixbuf *
get_chat_buddy_status_icon(PurpleConvChat *chat, const char *name, PurpleConvChatBuddyFlags flags)
{
More information about the Commits
mailing list