comparison src/gtkrequest.c @ 11212:46086fcc82b7

[gaim-migrate @ 13343] Weird things happen when account is NULL in screenname_completion_match_selected_cb(). I fixed that. Then I fixed the bug I introduced that caused account to be NULL all the time. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 08 Aug 2005 19:56:41 +0000
parents 28ac54de3024
children a511b77a368b
comparison
equal deleted inserted replaced
11211:03a244acce57 11212:46086fcc82b7
761 GtkTreeModel *model, GtkTreeIter *iter, gpointer *user_data) { 761 GtkTreeModel *model, GtkTreeIter *iter, gpointer *user_data) {
762 762
763 GValue val = { 0, }; 763 GValue val = { 0, };
764 GaimRequestField *screen_field = user_data[1]; 764 GaimRequestField *screen_field = user_data[1];
765 GList *fields = screen_field->group->fields; 765 GList *fields = screen_field->group->fields;
766 GaimAccount *account;
766 767
767 gtk_tree_model_get_value(model, iter, 1, &val); 768 gtk_tree_model_get_value(model, iter, 1, &val);
768 gtk_entry_set_text(GTK_ENTRY(user_data[0]), g_value_get_string(&val)); 769 gtk_entry_set_text(GTK_ENTRY(user_data[0]), g_value_get_string(&val));
769 g_value_unset(&val); 770 g_value_unset(&val);
770 771
772 gtk_tree_model_get_value(model, iter, 4, &val);
773 account = g_value_get_pointer(&val);
774 g_value_unset(&val);
775
776 if (account == NULL)
777 return TRUE;
778
771 do { 779 do {
772 GaimRequestField *field = fields->data; 780 GaimRequestField *field = fields->data;
773 781
774 if (gaim_request_field_get_type(field) == GAIM_REQUEST_FIELD_ACCOUNT) { 782 if (gaim_request_field_get_type(field) == GAIM_REQUEST_FIELD_ACCOUNT) {
775 const char *type_hint = gaim_request_field_get_type_hint(field); 783 const char *type_hint = gaim_request_field_get_type_hint(field);
776 784
777 if (type_hint != NULL && !strcmp(type_hint, "account")) { 785 if (type_hint != NULL && !strcmp(type_hint, "account")) {
778 /* We found the corresponding account field. */ 786 /* We found the corresponding account field. */
779 GaimAccount *account;
780 GtkOptionMenu *optmenu = GTK_OPTION_MENU(field->ui_data); 787 GtkOptionMenu *optmenu = GTK_OPTION_MENU(field->ui_data);
781
782 gtk_tree_model_get_value(model, iter, 4, &val);
783 account = g_value_get_pointer(&val);
784 g_value_unset(&val);
785 788
786 /* Set the account in the request API. */ 789 /* Set the account in the request API. */
787 gaim_request_field_account_set_value(field, account); 790 gaim_request_field_account_set_value(field, account);
788 791
789 if (optmenu != NULL) { 792 if (optmenu != NULL) {
791 guint index = 0; 794 guint index = 0;
792 795
793 do { 796 do {
794 if (account == g_object_get_data(G_OBJECT(items->data), "account")) { 797 if (account == g_object_get_data(G_OBJECT(items->data), "account")) {
795 /* Set the account in the GUI. */ 798 /* Set the account in the GUI. */
796
797 gtk_option_menu_set_history(GTK_OPTION_MENU(field->ui_data), index); 799 gtk_option_menu_set_history(GTK_OPTION_MENU(field->ui_data), index);
798 return TRUE; 800 return TRUE;
799 } 801 }
800 index++; 802 index++;
801 } while ((items = items->next) != NULL); 803 } while ((items = items->next) != NULL);
912 setup_screenname_autocomplete(GtkWidget *entry, GaimRequestField *field, gboolean all) 914 setup_screenname_autocomplete(GtkWidget *entry, GaimRequestField *field, gboolean all)
913 { 915 {
914 #ifdef NEW_STYLE_COMPLETION 916 #ifdef NEW_STYLE_COMPLETION
915 /* Store the displayed completion value, the screenname, the UTF-8 normalized & casefolded screenname, 917 /* Store the displayed completion value, the screenname, the UTF-8 normalized & casefolded screenname,
916 * the UTF-8 normalized & casefolded value for comparison, and the account. */ 918 * the UTF-8 normalized & casefolded value for comparison, and the account. */
917 GtkListStore *store = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); 919 GtkListStore *store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
918 920
919 GaimBlistNode *gnode, *cnode, *bnode; 921 GaimBlistNode *gnode, *cnode, *bnode;
920 GHashTable *sets; 922 GHashTable *sets;
921 gpointer set_hash_data[] = {store, GINT_TO_POINTER(all)}; 923 gpointer set_hash_data[] = {store, GINT_TO_POINTER(all)};
922 GtkEntryCompletion *completion; 924 GtkEntryCompletion *completion;