comparison pidgin/gtkconv.c @ 20028:a2b4eac83902

Part of #1332 to introduce pidgin_text_combo_box_new_entry and accessor functions. I made some changes to: * Not leak * Popup the dropdown when up/down arrows are pressed, to imitate the old behaviour to some extent. * Change the accessor defines to accessor functions. I think this all works OK now. Yell at me if things don't work, and then fix it. :-P
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 14 Sep 2007 08:27:26 +0000
parents 959b3aaba0b6
children 7af1af2b7ad3 dd4c3d712835
comparison
equal deleted inserted replaced
20014:a1c5518c445c 20028:a2b4eac83902
705 PidginConversation *gtkconv; 705 PidginConversation *gtkconv;
706 706
707 gtkconv = PIDGIN_CONVERSATION(info->conv); 707 gtkconv = PIDGIN_CONVERSATION(info->conv);
708 708
709 if (resp == GTK_RESPONSE_OK) { 709 if (resp == GTK_RESPONSE_OK) {
710 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); 710 buddy = pidgin_text_combo_box_entry_get_text(info->entry);
711 message = gtk_entry_get_text(GTK_ENTRY(info->message)); 711 message = gtk_entry_get_text(GTK_ENTRY(info->message));
712 712
713 if (!g_ascii_strcasecmp(buddy, "")) 713 if (!g_ascii_strcasecmp(buddy, ""))
714 return; 714 return;
715 715
752 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, 752 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
753 _("That buddy is not on the same protocol as this " 753 _("That buddy is not on the same protocol as this "
754 "chat."), NULL); 754 "chat."), NULL);
755 } 755 }
756 else 756 else
757 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); 757 pidgin_text_combo_box_entry_set_text(info->entry, buddy->name);
758 758
759 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); 759 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
760 } 760 }
761 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) 761 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
762 { 762 {
779 _("That buddy is not on the same protocol as this " 779 _("That buddy is not on the same protocol as this "
780 "chat."), NULL); 780 "chat."), NULL);
781 } 781 }
782 else 782 else
783 { 783 {
784 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); 784 pidgin_text_combo_box_entry_set_text(info->entry, username);
785 } 785 }
786 } 786 }
787 787
788 g_free(username); 788 g_free(username);
789 g_free(protocol); 789 g_free(protocol);
877 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); 877 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:"));
878 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 878 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
879 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); 879 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
880 880
881 /* Now the Buddy drop-down entry field. */ 881 /* Now the Buddy drop-down entry field. */
882 info->entry = gtk_combo_new(); 882 info->entry = pidgin_text_combo_box_entry_new(NULL, generate_invite_user_names(gc));
883 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE);
884 gtk_entry_set_activates_default(
885 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE);
886
887 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); 883 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1);
888 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); 884 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry);
889
890 /* Fill in the names. */
891 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry),
892 generate_invite_user_names(gc));
893
894 885
895 /* Now the label for "Message" */ 886 /* Now the label for "Message" */
896 label = gtk_label_new(NULL); 887 label = gtk_label_new(NULL);
897 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); 888 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:"));
898 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 889 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
931 } 922 }
932 923
933 gtk_widget_show_all(invite_dialog); 924 gtk_widget_show_all(invite_dialog);
934 925
935 if (info != NULL) 926 if (info != NULL)
936 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); 927 gtk_widget_grab_focus(GTK_BIN(info->entry)->child);
937 } 928 }
938 929
939 static void 930 static void
940 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) 931 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget)
941 { 932 {
3651 { 3642 {
3652 PurpleBlistNode *gnode,*cnode,*bnode; 3643 PurpleBlistNode *gnode,*cnode,*bnode;
3653 static GList *tmp = NULL; 3644 static GList *tmp = NULL;
3654 3645
3655 g_list_free(tmp); 3646 g_list_free(tmp);
3656 3647 tmp = NULL;
3657 tmp = g_list_append(NULL, "");
3658 3648
3659 if (gc != NULL) { 3649 if (gc != NULL) {
3660 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { 3650 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
3661 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) 3651 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
3662 continue; 3652 continue;