pidgin/plugins/gevolution/new_person_dialog.c

branch
next.minor
changeset 25889
26d9ca30335c
parent 23325
a374a26fe217
child 29935
d28b5dcc7554
equal deleted inserted replaced
25888:d0fdd378a635 25889:26d9ca30335c
65 { 65 {
66 delete_win_cb(NULL, NULL, dialog); 66 delete_win_cb(NULL, NULL, dialog);
67 } 67 }
68 68
69 static void 69 static void
70 screenname_changed_cb(GtkEntry *entry, GevoNewPersonDialog *dialog) 70 username_changed_cb(GtkEntry *entry, GevoNewPersonDialog *dialog)
71 { 71 {
72 gtk_widget_set_sensitive(dialog->add_button, 72 gtk_widget_set_sensitive(dialog->add_button,
73 *gtk_entry_get_text(entry) != '\0'); 73 *gtk_entry_get_text(entry) != '\0');
74 } 74 }
75 75
83 83
84 static void 84 static void
85 add_cb(GtkWidget *w, GevoNewPersonDialog *dialog) 85 add_cb(GtkWidget *w, GevoNewPersonDialog *dialog)
86 { 86 {
87 EContact *contact = NULL; 87 EContact *contact = NULL;
88 const char *screenname; 88 const char *username;
89 const char *firstname; 89 const char *firstname;
90 const char *lastname; 90 const char *lastname;
91 const char *email; 91 const char *email;
92 const char *im_service; 92 const char *im_service;
93 gboolean new_contact = FALSE; 93 gboolean new_contact = FALSE;
94 EContactField field = 0; 94 EContactField field = 0;
95 EContactName *name = NULL; 95 EContactName *name = NULL;
96 char *full_name = NULL; 96 char *full_name = NULL;
97 97
98 if (dialog->person_only) 98 if (dialog->person_only)
99 screenname = dialog->buddy->name; 99 username = dialog->buddy->name;
100 else 100 else
101 screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname)); 101 username = gtk_entry_get_text(GTK_ENTRY(dialog->username));
102 102
103 firstname = gtk_entry_get_text(GTK_ENTRY(dialog->firstname)); 103 firstname = gtk_entry_get_text(GTK_ENTRY(dialog->firstname));
104 lastname = gtk_entry_get_text(GTK_ENTRY(dialog->lastname)); 104 lastname = gtk_entry_get_text(GTK_ENTRY(dialog->lastname));
105 email = gtk_entry_get_text(GTK_ENTRY(dialog->email)); 105 email = gtk_entry_get_text(GTK_ENTRY(dialog->email));
106 106
141 if (*email) 141 if (*email)
142 e_contact_set(contact, E_CONTACT_EMAIL_1, (gpointer)email); 142 e_contact_set(contact, E_CONTACT_EMAIL_1, (gpointer)email);
143 143
144 if (!strcmp(im_service, "prpl-oscar")) 144 if (!strcmp(im_service, "prpl-oscar"))
145 { 145 {
146 if (isdigit(*screenname)) 146 if (isdigit(*username))
147 field = E_CONTACT_IM_ICQ; 147 field = E_CONTACT_IM_ICQ;
148 else 148 else
149 field = E_CONTACT_IM_AIM; 149 field = E_CONTACT_IM_AIM;
150 } 150 }
151 else if (!strcmp(im_service, "prpl-aim")) 151 else if (!strcmp(im_service, "prpl-aim"))
161 else if (!strcmp(im_service, "prpl-novell")) 161 else if (!strcmp(im_service, "prpl-novell"))
162 field = E_CONTACT_IM_GROUPWISE; 162 field = E_CONTACT_IM_GROUPWISE;
163 163
164 if (field > 0) 164 if (field > 0)
165 { 165 {
166 GList *list = g_list_append(NULL, g_strdup(screenname)); 166 GList *list = g_list_append(NULL, g_strdup(username));
167 167
168 e_contact_set(contact, field, list); 168 e_contact_set(contact, field, list);
169 169
170 g_free(list->data); 170 g_free(list->data);
171 g_list_free(list); 171 g_list_free(list);
201 { 201 {
202 const char *group_name; 202 const char *group_name;
203 203
204 group_name = pidgin_text_combo_box_entry_get_text(dialog->group_combo); 204 group_name = pidgin_text_combo_box_entry_get_text(dialog->group_combo);
205 205
206 gevo_add_buddy(dialog->account, group_name, screenname, full_name); 206 gevo_add_buddy(dialog->account, group_name, username, full_name);
207 } 207 }
208 208
209 if (name != NULL) 209 if (name != NULL)
210 e_contact_name_free(name); 210 e_contact_name_free(name);
211 211
287 pidgin_account_option_menu_new(account, FALSE, 287 pidgin_account_option_menu_new(account, FALSE,
288 G_CALLBACK(select_account_cb), 288 G_CALLBACK(select_account_cb),
289 NULL, dialog); 289 NULL, dialog);
290 add_pref_box(sg, vbox, _("Account type:"), dialog->accounts_menu); 290 add_pref_box(sg, vbox, _("Account type:"), dialog->accounts_menu);
291 291
292 /* Screen Name */ 292 /* Username */
293 dialog->screenname = gtk_entry_new(); 293 dialog->username = gtk_entry_new();
294 add_pref_box(sg, vbox, _("Username:"), dialog->screenname); 294 add_pref_box(sg, vbox, _("Username:"), dialog->username);
295 295
296 if (username != NULL) 296 if (username != NULL)
297 gtk_entry_set_text(GTK_ENTRY(dialog->screenname), username); 297 gtk_entry_set_text(GTK_ENTRY(dialog->username), username);
298 298
299 g_signal_connect(G_OBJECT(dialog->screenname), "changed", 299 g_signal_connect(G_OBJECT(dialog->username), "changed",
300 G_CALLBACK(screenname_changed_cb), dialog); 300 G_CALLBACK(username_changed_cb), dialog);
301 301
302 /* Group */ 302 /* Group */
303 dialog->group_combo = pidgin_text_combo_box_entry_new(NULL, 303 dialog->group_combo = pidgin_text_combo_box_entry_new(NULL,
304 gevo_get_groups()); 304 gevo_get_groups());
305 add_pref_box(sg, vbox, _("Group:"), dialog->group_combo); 305 add_pref_box(sg, vbox, _("Group:"), dialog->group_combo);

mercurial