首页 | 数据结构 | 文件列表 | 数据字段 | 全局定义

infodlg.c

浏览该文件的文档。
00001 
00023 // START OF FILE
00024 /*****************************************************************************/
00025 #include "debug.h"              // gaim_debug
00026 #include "internal.h"           // strlen, _("get_text")
00027 #include "notify.h"             // gaim_notify_error
00028 
00029 #include "utils.h"              // get_face_gdkpixbuf
00030 #include "char_conv.h"          // qq_to_utf8
00031 #include "show.h"               // qq_show_get_image
00032 #include "infodlg.h"
00033 
00034 // must be defined after qq_infodlg.h to have <gtk/gtk.h>
00035 #include "gtkdialogs.h"         // GAIM_DIALOG, mainwindow
00036 
00037 
00038 // the follwoing definition is in UTF-8
00039 const gint blood_types_count = 5;
00040 const gchar *blood_types[] = {
00041         "鍏跺畠", "A", "B", "O", "AB",
00042 };
00043 
00044 const gint country_names_count = 6;
00045 const gchar *country_names[] = {
00046         "涓浗", "涓浗棣欐腐", "涓浗婢抽棬", "涓浗鍙版咕",
00047         "鏂板姞鍧", "椹潵瑗夸簹", "缇庡浗",
00048 };
00049 
00050 const gint province_names_count = 34;
00051 const gchar *province_names[] = {
00052         "鍖椾含", "澶╂触", "涓婃捣", "閲嶅簡", "棣欐腐",
00053         "娌冲寳", "灞辫タ", "鍐呰挋鍙", "杈藉畞", "鍚夋灄",
00054         "榛戦緳姹", "姹熻タ", "娴欐睙", "姹熻嫃", "瀹夊窘",
00055         "绂忓缓", "灞变笢", "娌冲崡", "婀栧寳", "婀栧崡",
00056         "骞夸笢", "骞胯タ", "娴峰崡", "鍥涘窛", "璐靛窞",
00057         "浜戝崡", "瑗胯棌", "闄曡タ", "鐢樿們", "瀹佸",
00058         "闈掓捣", "鏂扮枂", "鍙版咕", "婢抽棬",
00059 };
00060 
00061 const gint zodiac_names_count = 13;
00062 const gchar *zodiac_names[] = {
00063         "-", "榧", "鐗", "铏", "鍏",
00064         "榫", "铔", "椹", "缇", "鐚",
00065         "楦", "鐙", "鐚",
00066 };
00067 
00068 const gint horoscope_names_count = 13;
00069 const gchar *horoscope_names[] = {
00070         "-", "姘寸摱搴", "鍙岄奔搴", "鐗$緤搴", "閲戠墰搴",
00071         "鍙屽瓙搴", "宸ㄨ煿搴", "鐙瓙搴", "澶勫コ搴", "澶╃Г搴",
00072         "澶╄潕搴", "灏勬墜搴", "榄旂警搴",
00073 };
00074 
00075 const gint occupation_names_count = 15;
00076 const gchar *occupation_names[] = {
00077         "鍏ㄨ亴", "鍏艰亴", "鍒堕犱笟", "鍟嗕笟", "澶变笟涓",
00078         "瀛︾敓", "宸ョ▼甯", "鏀垮簻閮ㄩ棬", "鏁欒偛涓", "鏈嶅姟琛屼笟",
00079         "鑰佹澘", "璁$畻鏈轰笟", "閫浼", "閲戣瀺涓",
00080         "閿鍞/骞垮憡/甯傚満",
00081 };
00082 
00083 enum {
00084         QQ_CONTACT_OPEN = 0x00,
00085         QQ_CONTACT_ONLY_FRIENDS = 0x01,
00086         QQ_CONTACT_CLOSE = 0x02,
00087 };
00088 
00089 
00090 enum {
00091         QQ_AUTH_NO_AUTH = 0x00,
00092         QQ_AUTH_NEED_AUTH = 0x01,
00093         QQ_AUTH_NO_ADD = 0x02,
00094 };
00095 
00096 typedef struct _change_icon_widgets change_icon_widgets;
00097 
00098 struct _change_icon_widgets {
00099         GtkWidget *dialog;      // dialog that shows all icons
00100         GtkWidget *face;        // the image widget we are going to change
00101 };
00102 
00103 /*****************************************************************************/
00104 void _window_deleteevent(GtkWidget * widget, GdkEvent * event, gpointer data) {
00105         gtk_widget_destroy(widget);     // this will call _window_destroy
00106 }                               // _window_deleteevent
00107 
00108 /*****************************************************************************/
00109 void _window_close(GtkWidget * widget, gpointer data)
00110 {
00111         // this will call _info_window_destroy if it is info-window
00112         gtk_widget_destroy(GTK_WIDGET(data));
00113 }                               // _window_close
00114 
00115 /*****************************************************************************/
00116 void _no_edit(GtkWidget * w)
00117 {
00118         gtk_editable_set_editable(GTK_EDITABLE(w), FALSE);
00119 }                               // _no_edit
00120 
00121 /*****************************************************************************/
00122 GtkWidget *_qq_entry_new()
00123 {
00124         GtkWidget *entry;
00125         entry = gtk_entry_new();
00126         gtk_entry_set_max_length(GTK_ENTRY(entry), 255);        // set the max length
00127         return entry;
00128 }                               // _qq_entry_new
00129 
00130 /*****************************************************************************/
00131 void _qq_set_entry(GtkWidget * entry, gchar * text)
00132 {
00133         gchar *text_utf8;
00134 
00135         text_utf8 = qq_to_utf8(text, QQ_CHARSET_DEFAULT);
00136         gtk_entry_set_text(GTK_ENTRY(entry), text_utf8);
00137 
00138         g_free(text_utf8);
00139 }                               // _qq_set_entry
00140 
00141 /*****************************************************************************/
00142 gchar *_qq_get_entry(GtkWidget * entry)
00143 {
00144         return utf8_to_qq(gtk_entry_get_text(GTK_ENTRY(entry)), QQ_CHARSET_DEFAULT);
00145 }                               // _qq_get_entry
00146 
00147 /*****************************************************************************/
00148 void _qq_set_text(GtkWidget * entry, gchar * text)
00149 {
00150         gchar *text_utf8;
00151 
00152         text_utf8 = qq_to_utf8(text, QQ_CHARSET_DEFAULT);
00153         gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)), text_utf8, -1);
00154 
00155         g_free(text_utf8);
00156 }                               // _qq_set_text
00157 
00158 /*****************************************************************************/
00159 gchar *_qq_get_text(GtkWidget * entry)
00160 {
00161         gchar *str, *ret;
00162         GtkTextIter start, end;
00163 
00164         gtk_text_buffer_get_bounds(gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)), &start, &end);
00165         str = gtk_text_buffer_get_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)), &start, &end, FALSE);
00166         ret = utf8_to_qq(str, QQ_CHARSET_DEFAULT);
00167 
00168         return ret;
00169 }                               // _qq_get_text
00170 
00171 /*****************************************************************************/
00172 void _qq_set_image(GtkWidget * entry, gint index)
00173 {
00174         GdkPixbuf *pixbuf;
00175 
00176         g_return_if_fail(entry != NULL && index >= 0);
00177 
00178         pixbuf = get_face_gdkpixbuf(index);
00179         gtk_image_set_from_pixbuf(GTK_IMAGE(entry), pixbuf);
00180         g_object_unref(pixbuf);
00181         g_object_set_data(G_OBJECT(entry), "user_data", GINT_TO_POINTER(index));
00182 }                               // _qq_set_image
00183 
00184 
00185 /*****************************************************************************/
00186 void _qq_change_face(GtkWidget * w, gpointer * user_data)
00187 {
00188         gint index;
00189         change_icon_widgets *change_icon;
00190 
00191         change_icon = (change_icon_widgets *) user_data;
00192 
00193         index = (gint) g_object_get_data(G_OBJECT(w), "user_data");
00194 
00195         _qq_set_image(change_icon->face, index);
00196         _window_close(NULL, change_icon->dialog);
00197 
00198         g_free(change_icon);
00199 
00200 }                               // _qq_change_face
00201 
00202 /*****************************************************************************/
00203 GList *_get_list_by_array(gchar ** array, gint size)
00204 {
00205         gint i;
00206         GList *cbitems;
00207 
00208         cbitems = NULL;
00209         for (i = 0; i < size; i++)
00210                 cbitems = g_list_append(cbitems, array[i]);
00211         return cbitems;
00212 }                               // _get_list_by_array
00213 
00214 /*****************************************************************************/
00215 void _qq_set_open_contact_radio(contact_info_window * info_window, gchar * is_open_contact) {
00216         gint open;
00217         GtkWidget **radio;
00218 
00219         open = atoi(is_open_contact);
00220         radio = info_window->open_contact_radio;
00221 
00222         if (open == QQ_CONTACT_OPEN)
00223                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[0]), TRUE);
00224         else if (open == QQ_CONTACT_ONLY_FRIENDS)
00225                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[1]), TRUE);
00226         else
00227                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[2]), TRUE);
00228 }                               // _qq_set_open_contact_radio
00229 
00230 /*****************************************************************************/
00231 void _qq_set_auth_type_radio(contact_info_window * info_window, gchar * auth_type_str) {
00232         gint auth_type;
00233         GtkWidget **radio;
00234 
00235         auth_type = atoi(auth_type_str);
00236         radio = info_window->auth_radio;
00237 
00238         if (auth_type == QQ_AUTH_NO_AUTH)
00239                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[0]), TRUE);
00240         else if (auth_type == QQ_AUTH_NEED_AUTH)
00241                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[1]), TRUE);
00242         else
00243                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[2]), TRUE);
00244 }                               // _qq_set_auth_type_radio
00245 
00246 /*****************************************************************************/
00247 void _info_window_destroy(GtkWidget * widget, gpointer data)
00248 {
00249         GList *list;
00250         qq_data *qd;
00251         GaimConnection *gc;
00252         contact_info_window *info_window;
00253 
00254         gc = (GaimConnection *) data;
00255 
00256         g_return_if_fail(gc != NULL && gc->proto_data != NULL);
00257 
00258         if (QQ_DEBUG)
00259                 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Destroy info window.\n");
00260         qd = (qq_data *) gc->proto_data;
00261         list = qd->contact_info_window;
00262 
00263         while (list) {
00264                 info_window = (contact_info_window *) (list->data);
00265                 if (info_window->window != widget)
00266                         list = list->next;
00267                 else {
00268                         if (info_window->old_info)
00269                                 g_strfreev((gchar **) info_window->old_info);
00270                         qd->contact_info_window = g_list_remove(qd->contact_info_window, info_window);
00271                         g_free(info_window);
00272                         break;
00273                 }
00274         }                       // while
00275 }                               // _info_window_destory
00276 
00277 /*****************************************************************************/
00278 void qq_contact_info_window_free(qq_data * qd)
00279 {
00280         gint i;
00281         contact_info_window *info;
00282 
00283         g_return_if_fail(qd != NULL);
00284 
00285         i = 0;
00286         while (qd->contact_info_window) {
00287                 info = (contact_info_window *) qd->contact_info_window->data;
00288                 // remove the entry before free it
00289                 // in some rare cases, system might automatically (stupidly) 
00290                 // remove the entry from the list when user free the entry, 
00291                 // then, qd->contact_info_window becomes NULL and it causes crash
00292                 qd->contact_info_window = g_list_remove(qd->contact_info_window, info);
00293                 if (info->window)
00294                         gtk_widget_destroy(info->window);
00295                 g_free(info);
00296                 i++;
00297         }
00298         gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d conatct_info_window are freed\n", i);
00299 }                               // qq_contact_info_window_free
00300 
00301 /*****************************************************************************/
00302 void _info_window_refresh(GtkWidget * widget, gpointer data)
00303 {
00304         GaimConnection *gc;
00305         contact_info_window *info_window;
00306 
00307         gc = (GaimConnection *) data;
00308         info_window = (contact_info_window *)
00309             g_object_get_data(G_OBJECT(widget), "user_data");
00310 
00311         qq_send_packet_get_info(gc, info_window->uid, TRUE);
00312         gtk_widget_set_sensitive(info_window->refresh_button, FALSE);
00313 }                               // _info_window_refresh
00314 
00315 /*****************************************************************************/
00316 void _info_window_change(GtkWidget * widget, gpointer data)
00317 {
00318         gchar *passwd[3];
00319         gboolean is_modify_passwd;
00320         guint8 icon, auth_type, open_contact;
00321         qq_data *qd;
00322         GaimAccount *a;
00323         GaimConnection *gc;
00324         contact_info *info;
00325         contact_info_window *info_window;
00326 
00327         gc = (GaimConnection *) data;
00328         a = gc->account;
00329         qd = gc->proto_data;
00330         info_window = (contact_info_window *)
00331             g_object_get_data(G_OBJECT(widget), "user_data");
00332         info = info_window->old_info;
00333 
00334         is_modify_passwd = FALSE;
00335         passwd[0] = passwd[1] = passwd[2] = NULL;
00336 
00337         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->is_modify_passwd)))
00338                 is_modify_passwd = TRUE;
00339 
00340         if (is_modify_passwd) {
00341                 passwd[0] = _qq_get_entry(info_window->old_password);
00342                 passwd[1] = _qq_get_entry(info_window->password[0]);
00343                 passwd[2] = _qq_get_entry(info_window->password[1]);
00344 
00345                 if (g_ascii_strcasecmp(a->password, passwd[0])) {
00346                         gaim_notify_error(gc, _("Error"), _("Old password is wrong"), NULL);
00347                         g_free(passwd[0]);
00348                         g_free(passwd[1]);
00349                         g_free(passwd[2]);
00350                         return;
00351                 }
00352                 if (passwd[1][0] == '\0') {
00353                         gaim_notify_error(gc, _("Error"), _("Password can not be empty"), NULL);
00354                         g_free(passwd[0]);
00355                         g_free(passwd[1]);
00356                         g_free(passwd[2]);
00357                         return;
00358                 }
00359                 if (g_ascii_strcasecmp(passwd[1], passwd[2])) {
00360                         gaim_notify_error(gc, _("Error"),
00361                                           _("Confirmed password is not the same as new password"), NULL);
00362                         g_free(passwd[0]);
00363                         g_free(passwd[1]);
00364                         g_free(passwd[2]);
00365                         return;
00366                 }
00367                 if (strlen(passwd[1]) > 16) {
00368                         gaim_notify_error(gc, _("Error"), _("Password can not longer than 16 characters"), NULL);
00369                         g_free(passwd[0]);
00370                         g_free(passwd[1]);
00371                         g_free(passwd[2]);
00372                         return;
00373                 }
00374         }                       // if (is_modify_passwd)
00375 
00376         icon = (gint) g_object_get_data(G_OBJECT(info_window->face), "user_data");
00377 
00378         info->face = g_strdup_printf("%d", icon);
00379         info->nick = _qq_get_entry(info_window->nick);
00380         info->age = _qq_get_entry(info_window->age);
00381         info->gender = _qq_get_entry(info_window->gender);
00382         info->country = _qq_get_entry(info_window->country);
00383         info->province = _qq_get_entry(info_window->province);
00384         info->city = _qq_get_entry(info_window->city);
00385         info->email = _qq_get_entry(info_window->email);
00386         info->address = _qq_get_entry(info_window->address);
00387         info->zipcode = _qq_get_entry(info_window->zipcode);
00388         info->tel = _qq_get_entry(info_window->tel);
00389         info->name = _qq_get_entry(info_window->name);
00390         info->college = _qq_get_entry(info_window->college);
00391         info->occupation = _qq_get_entry(info_window->occupation);
00392         info->homepage = _qq_get_entry(info_window->homepage);
00393         info->intro = _qq_get_text(info_window->intro);
00394 
00395         info->blood =
00396             get_index_str_by_name((gchar **) blood_types,
00397                                   gtk_entry_get_text(GTK_ENTRY(info_window->blood)), blood_types_count);
00398         info->zodiac =
00399             get_index_str_by_name((gchar **) zodiac_names,
00400                                   gtk_entry_get_text(GTK_ENTRY(info_window->zodiac)), zodiac_names_count);
00401         info->horoscope =
00402             get_index_str_by_name((gchar **) horoscope_names,
00403                                   gtk_entry_get_text(GTK_ENTRY(info_window->horoscope)), horoscope_names_count);
00404 
00405         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->auth_radio[0])))
00406                 auth_type = QQ_AUTH_NO_AUTH;
00407         else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->auth_radio[1])))
00408                 auth_type = QQ_AUTH_NEED_AUTH;
00409         else
00410                 auth_type = QQ_AUTH_NO_ADD;
00411 
00412         info->auth_type = g_strdup_printf("%d", auth_type);
00413 
00414         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->open_contact_radio[0])))
00415                 open_contact = QQ_CONTACT_OPEN;
00416         else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->open_contact_radio[1])))
00417                 open_contact = QQ_CONTACT_ONLY_FRIENDS;
00418         else
00419                 open_contact = QQ_CONTACT_CLOSE;
00420 
00421         info->is_open_contact = g_strdup_printf("%d", open_contact);
00422 
00423         qq_send_packet_modify_info(gc, info, passwd[1]);
00424         qq_refresh_buddy_and_myself(info, gc);
00425 
00426         gtk_widget_destroy(info_window->window);        //close window
00427 }
00428 
00429 /*****************************************************************************/
00430 void _info_window_change_face(GtkWidget * widget, GdkEvent * event, contact_info_window * info_window) {
00431         gint i;
00432         GdkPixbuf *pixbuf;
00433         GtkWidget *dialog, *image, *button, *vbox, *smiley_box;
00434         change_icon_widgets *change_icon;
00435 
00436         change_icon = g_new0(change_icon_widgets, 1);
00437 
00438         smiley_box = NULL;
00439         GAIM_DIALOG(dialog);    // learned from gtkimhtmltoolbar.c
00440         gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
00441         gtk_window_set_modal(GTK_WINDOW(dialog), FALSE);
00442 
00443         g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(_window_deleteevent), NULL);
00444 
00445         gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
00446         gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
00447 
00448         change_icon->dialog = dialog;
00449         change_icon->face = info_window->face;
00450 
00451         vbox = gtk_vbox_new(TRUE, 5);
00452 
00453         for (i = 0; i < 85; i++) {
00454                 if (i % 8 == 0) {
00455                         smiley_box = gtk_toolbar_new();
00456                         gtk_box_pack_start(GTK_BOX(vbox), smiley_box, TRUE, TRUE, 0);
00457                 }
00458                 pixbuf = get_face_gdkpixbuf(i * 3);
00459                 image = gtk_image_new_from_pixbuf(pixbuf);
00460                 g_object_unref(pixbuf);
00461                 button = gtk_toolbar_append_item(GTK_TOOLBAR(smiley_box),
00462                                                  NULL, NULL, NULL, image, G_CALLBACK(_qq_change_face), change_icon);
00463                 g_object_set_data(G_OBJECT(button), "user_data", GINT_TO_POINTER(i * 3));
00464                 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
00465         }                       // for i
00466 
00467         gtk_container_add(GTK_CONTAINER(dialog), vbox);
00468         gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
00469         gtk_window_set_title(GTK_WINDOW(dialog), _("Choose my head icon"));
00470         gtk_widget_show_all(dialog);
00471 }                               // _info_window_change_face
00472 
00473 /*****************************************************************************/
00474 void _change_passwd_checkbutton_callback(GtkWidget * widget, contact_info_window * info_window) {
00475         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
00476                 gtk_widget_set_sensitive(info_window->old_password, TRUE);
00477                 gtk_widget_set_sensitive(info_window->password[0], TRUE);
00478                 gtk_widget_set_sensitive(info_window->password[1], TRUE);
00479         } else {
00480                 gtk_widget_set_sensitive(info_window->old_password, FALSE);
00481                 gtk_widget_set_sensitive(info_window->password[0], FALSE);
00482                 gtk_widget_set_sensitive(info_window->password[1], FALSE);
00483         }
00484 }                               // _change_passwd_checkbutton_callback
00485 
00486 /*****************************************************************************/
00487 GtkWidget *_create_page_basic
00488     (gint is_myself, contact_info * info, GaimConnection * gc, contact_info_window * info_window) {
00489         GdkPixbuf *pixbuf;
00490         GList *cbitems;
00491         GtkWidget *hbox, *pixmap, *frame, *label, *table;
00492         GtkWidget *entry, *combo, *alignment;
00493         GtkWidget *event_box, *qq_show;
00494         GtkTooltips *tooltips;
00495 
00496         tooltips = gtk_tooltips_new();
00497 
00498         cbitems = NULL;
00499 
00500         hbox = gtk_hbox_new(FALSE, 0);
00501         frame = gtk_frame_new("");
00502         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00503         gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
00504 
00505         table = gtk_table_new(7, 3, FALSE);
00506         gtk_table_set_row_spacings(GTK_TABLE(table), 2);
00507         gtk_table_set_col_spacings(GTK_TABLE(table), 5);
00508         gtk_container_set_border_width(GTK_CONTAINER(table), 5);
00509         gtk_container_add(GTK_CONTAINER(frame), table);
00510 
00511         pixbuf = get_face_gdkpixbuf((guint8) strtol(info->face, NULL, 10));
00512         pixmap = gtk_image_new_from_pixbuf(pixbuf);
00513         info_window->face = pixmap;
00514 
00515         alignment = gtk_alignment_new(0.25, 0, 0, 0);
00516 
00517         // set up icon
00518         if (is_myself) {
00519                 g_object_set_data(G_OBJECT(info_window->face), "user_data",
00520                                   GINT_TO_POINTER(strtol(info->face, NULL, 10)));
00521                 event_box = gtk_event_box_new();
00522                 g_signal_connect(G_OBJECT(event_box), "button_press_event",
00523                                  G_CALLBACK(_info_window_change_face), info_window);
00524                 gtk_container_add(GTK_CONTAINER(event_box), pixmap);
00525                 gtk_container_add(GTK_CONTAINER(alignment), event_box);
00526                 gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), event_box, _("Click to change icon"), NULL);
00527         } else
00528                 gtk_container_add(GTK_CONTAINER(alignment), pixmap);
00529 
00530         gtk_table_attach(GTK_TABLE(table), alignment, 2, 3, 0, 2, GTK_FILL, 0, 0, 0);
00531 
00532         // set up qq_show image and event
00533         qq_show = qq_show_default(info);
00534         g_object_set_data(G_OBJECT(qq_show), "user_data", GINT_TO_POINTER((gint) atoi(info->uid)));
00535 
00536         frame = gtk_frame_new("");
00537         gtk_container_set_border_width(GTK_CONTAINER(frame), 0);
00538 
00539         if (strtol(info->qq_show, NULL, 10) != 0) {     // buddy has qq_show
00540                 event_box = gtk_event_box_new();
00541                 gtk_container_add(GTK_CONTAINER(frame), event_box);
00542                 gtk_container_add(GTK_CONTAINER(event_box), qq_show);
00543                 g_signal_connect(G_OBJECT(event_box), "button_press_event", G_CALLBACK(qq_show_get_image), qq_show);
00544                 gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), event_box, _("Click to refresh"), NULL);
00545         } else                  // no event_box
00546                 gtk_container_add(GTK_CONTAINER(frame), qq_show);
00547 
00548         gtk_table_attach(GTK_TABLE(table), frame, 2, 3, 2, 7, GTK_EXPAND, 0, 0, 0);
00549 
00550         label = gtk_label_new(_("QQid"));
00551         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00552         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
00553 
00554         label = gtk_label_new(_("Nickname"));
00555         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00556         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
00557 
00558         entry = _qq_entry_new();
00559         info_window->uid_entry = entry;
00560         _qq_set_entry(info_window->uid_entry, info->uid);
00561         gtk_widget_set_size_request(entry, 120, -1);
00562         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
00563 
00564         entry = _qq_entry_new();
00565         info_window->nick = entry;
00566         _qq_set_entry(info_window->nick, info->nick);
00567         gtk_widget_set_size_request(entry, 120, -1);
00568         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
00569 
00570         label = gtk_label_new(_("Age"));
00571         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00572         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
00573 
00574         label = gtk_label_new(_("Gender"));
00575         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00576         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
00577 
00578         label = gtk_label_new(_("Country/Region"));
00579         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00580         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, 0, 0, 0);
00581 
00582         combo = gtk_combo_new();
00583         cbitems = _get_list_by_array((gchar **) country_names, country_names_count);
00584         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00585         g_list_free(cbitems);
00586         cbitems = NULL;
00587         info_window->country = GTK_COMBO(combo)->entry;
00588         _qq_set_entry(info_window->country, info->country);
00589         gtk_widget_set_size_request(combo, 150, -1);
00590         gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
00591         if (!is_myself)
00592                 gtk_widget_set_sensitive(combo, FALSE);
00593 
00594         entry = _qq_entry_new();
00595         info_window->age = entry;
00596         _qq_set_entry(info_window->age, info->age);
00597         gtk_widget_set_size_request(entry, 40, -1);
00598         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
00599 
00600         combo = gtk_combo_new();
00601         cbitems = g_list_append(cbitems, _("Male"));
00602         cbitems = g_list_append(cbitems, _("Female"));
00603         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00604         g_list_free(cbitems);
00605         cbitems = NULL;
00606         info_window->gender = GTK_COMBO(combo)->entry;
00607         gtk_widget_set_size_request(combo, 60, -1);
00608         _qq_set_entry(info_window->gender, info->gender);
00609         gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
00610         gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
00611         if (!is_myself)
00612                 gtk_widget_set_sensitive(combo, FALSE);
00613 
00614         label = gtk_label_new(_("Province"));
00615         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00616         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, 0, 0, 0);
00617 
00618         label = gtk_label_new(_("City"));
00619         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00620         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7, GTK_FILL, 0, 0, 0);
00621 
00622         combo = gtk_combo_new();
00623         cbitems = _get_list_by_array((gchar **) province_names, province_names_count);
00624         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00625         g_list_free(cbitems);
00626         cbitems = NULL;
00627         info_window->province = GTK_COMBO(combo)->entry;
00628         _qq_set_entry(info_window->province, info->province);
00629         gtk_widget_set_size_request(combo, 150, -1);
00630         gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 5, 6, GTK_FILL, 0, 0, 0);
00631         if (!is_myself)
00632                 gtk_widget_set_sensitive(combo, FALSE);
00633 
00634         entry = _qq_entry_new();
00635         info_window->city = entry;
00636         gtk_widget_set_size_request(entry, 120, -1);
00637         _qq_set_entry(info_window->city, info->city);
00638         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 6, 7, GTK_FILL, 0, 0, 0);
00639 
00640         return hbox;
00641 }                               // _create_page_basic
00642 
00643 /*****************************************************************************/
00644 GtkWidget *_create_page_contact
00645     (int is_myself, contact_info * info, GaimConnection * gc, contact_info_window * info_window) {
00646         GtkWidget *vbox1, *frame;
00647         GtkWidget *hbox1, *entry, *label;
00648         GtkWidget *hbox, *radio, *table;
00649 
00650         hbox = gtk_hbox_new(FALSE, 0);
00651         vbox1 = gtk_vbox_new(FALSE, 0);
00652         gtk_box_pack_start(GTK_BOX(hbox), vbox1, TRUE, TRUE, 0);
00653 
00654         frame = gtk_frame_new("");
00655         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00656         gtk_box_pack_start(GTK_BOX(vbox1), frame, TRUE, TRUE, 0);
00657 
00658         table = gtk_table_new(2, 5, FALSE);
00659         gtk_table_set_row_spacings(GTK_TABLE(table), 2);
00660         gtk_table_set_col_spacings(GTK_TABLE(table), 5);
00661         gtk_container_set_border_width(GTK_CONTAINER(table), 5);
00662         gtk_container_add(GTK_CONTAINER(frame), table);
00663 
00664         label = gtk_label_new(_("Email"));
00665         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00666         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
00667 
00668         label = gtk_label_new(_("Address"));
00669         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00670         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
00671 
00672         label = gtk_label_new(_("Zipcode"));
00673         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00674         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
00675 
00676         label = gtk_label_new(_("Tel"));
00677         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00678         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
00679 
00680         label = gtk_label_new(_("Homepage"));
00681         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00682         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, 0, 0, 0);
00683 
00684         entry = _qq_entry_new();
00685         info_window->email = entry;
00686         gtk_widget_set_size_request(entry, 240, -1);
00687         _qq_set_entry(info_window->email, info->email);
00688         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
00689 
00690         entry = _qq_entry_new();
00691         info_window->address = entry;
00692         _qq_set_entry(info_window->address, info->address);
00693         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
00694 
00695         entry = _qq_entry_new();
00696         info_window->zipcode = entry;
00697         _qq_set_entry(info_window->zipcode, info->zipcode);
00698         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
00699 
00700         entry = _qq_entry_new();
00701         info_window->tel = entry;
00702         _qq_set_entry(info_window->tel, info->tel);
00703         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
00704 
00705         entry = _qq_entry_new();
00706         info_window->homepage = entry;
00707         _qq_set_entry(info_window->homepage, info->homepage);
00708         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
00709 
00710         frame = gtk_frame_new(_("Above infomation"));
00711         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00712         if (!is_myself)
00713                 gtk_widget_set_sensitive(frame, FALSE);
00714         gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 0);
00715 
00716         hbox1 = gtk_hbox_new(FALSE, 5);
00717         gtk_container_add(GTK_CONTAINER(frame), hbox1);
00718 
00719         radio = gtk_radio_button_new_with_label(NULL, _("Open to all"));
00720         info_window->open_contact_radio[0] = radio;
00721         gtk_box_pack_start(GTK_BOX(hbox1), radio, FALSE, FALSE, 0);
00722 
00723         radio = gtk_radio_button_new_with_label_from_widget
00724             (GTK_RADIO_BUTTON(radio), _("Only accessible by my frineds"));
00725         info_window->open_contact_radio[1] = radio;
00726         gtk_box_pack_start(GTK_BOX(hbox1), radio, FALSE, FALSE, 0);
00727 
00728         radio = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio), _("Close to all"));
00729         info_window->open_contact_radio[2] = radio;
00730         gtk_box_pack_start(GTK_BOX(hbox1), radio, FALSE, FALSE, 0);
00731 
00732         _qq_set_open_contact_radio(info_window, info->is_open_contact);
00733 
00734         return hbox;
00735 }                               // _create_page_contact
00736 
00737 /*****************************************************************************/
00738 GtkWidget *_create_page_details
00739     (int is_myself, contact_info * info, GaimConnection * gc, contact_info_window * info_window) {
00740         GList *cbitems;
00741         GtkWidget *text, *hbox, *frame;
00742         GtkWidget *combo, *table, *label, *entry, *scrolled_window;
00743 
00744         cbitems = NULL;
00745 
00746         hbox = gtk_hbox_new(FALSE, 0);
00747         frame = gtk_frame_new("");
00748         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00749         gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
00750 
00751         table = gtk_table_new(4, 4, FALSE);
00752         gtk_table_set_row_spacings(GTK_TABLE(table), 2);
00753         gtk_table_set_col_spacings(GTK_TABLE(table), 5);
00754         gtk_container_set_border_width(GTK_CONTAINER(table), 5);
00755         gtk_container_add(GTK_CONTAINER(frame), table);
00756 
00757         label = gtk_label_new(_("Real Name"));
00758         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00759         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
00760 
00761         label = gtk_label_new(_(" Zodiac"));
00762         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00763         gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
00764 
00765         label = gtk_label_new(_(" Blood Type"));
00766         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00767         gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
00768 
00769         label = gtk_label_new(_(" Horoscope"));
00770         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00771         gtk_table_attach(GTK_TABLE(table), label, 2, 3, 2, 3, GTK_FILL, 0, 0, 0);
00772 
00773         label = gtk_label_new(_("College"));
00774         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00775         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
00776 
00777         label = gtk_label_new(_("Career"));
00778         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00779         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
00780 
00781         label = gtk_label_new(_("Intro"));
00782         gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
00783         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
00784 
00785         entry = _qq_entry_new();
00786         info_window->name = entry;
00787         gtk_widget_set_size_request(entry, 120, -1);
00788         _qq_set_entry(info_window->name, info->name);
00789         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
00790 
00791         entry = _qq_entry_new();
00792         info_window->college = entry;
00793         gtk_widget_set_size_request(entry, 120, -1);
00794         _qq_set_entry(info_window->college, info->college);
00795         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
00796 
00797         combo = gtk_combo_new();
00798         cbitems = _get_list_by_array((gchar **) zodiac_names, zodiac_names_count);
00799         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00800         g_list_free(cbitems);
00801         cbitems = NULL;
00802         info_window->zodiac = GTK_COMBO(combo)->entry;
00803         gtk_entry_set_text(GTK_ENTRY(info_window->zodiac),
00804                            get_name_by_index_str((gchar **) zodiac_names, info->zodiac, zodiac_names_count));
00805         gtk_widget_set_size_request(combo, 70, -1);
00806         gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
00807         gtk_table_attach(GTK_TABLE(table), combo, 3, 4, 0, 1, GTK_FILL, 0, 0, 0);
00808         if (!is_myself)
00809                 gtk_widget_set_sensitive(combo, FALSE);
00810 
00811         combo = gtk_combo_new();
00812         cbitems = _get_list_by_array((gchar **) blood_types, blood_types_count);
00813         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00814         g_list_free(cbitems);
00815         cbitems = NULL;
00816         info_window->blood = GTK_COMBO(combo)->entry;
00817         gtk_entry_set_text(GTK_ENTRY(info_window->blood),
00818                            get_name_by_index_str((gchar **) blood_types, info->blood, blood_types_count));
00819         gtk_widget_set_size_request(combo, 70, -1);
00820         gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
00821         gtk_table_attach(GTK_TABLE(table), combo, 3, 4, 1, 2, GTK_FILL, 0, 0, 0);
00822         if (!is_myself)
00823                 gtk_widget_set_sensitive(combo, FALSE);
00824 
00825         combo = gtk_combo_new();
00826         cbitems = _get_list_by_array((gchar **) horoscope_names, horoscope_names_count);
00827         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00828         g_list_free(cbitems);
00829         cbitems = NULL;
00830         info_window->horoscope = GTK_COMBO(combo)->entry;
00831         gtk_entry_set_text(GTK_ENTRY(info_window->horoscope), get_name_by_index_str((gchar **)
00832                                                                                     horoscope_names,
00833                                                                                     info->horoscope,
00834                                                                                     horoscope_names_count));
00835         gtk_widget_set_size_request(combo, 70, -1);
00836         gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), FALSE);
00837         gtk_table_attach(GTK_TABLE(table), combo, 3, 4, 2, 3, GTK_FILL, 0, 0, 0);
00838         if (!is_myself)
00839                 gtk_widget_set_sensitive(combo, FALSE);
00840 
00841         combo = gtk_combo_new();
00842         cbitems = _get_list_by_array((gchar **) occupation_names, occupation_names_count);
00843         gtk_combo_set_popdown_strings(GTK_COMBO(combo), cbitems);
00844         g_list_free(cbitems);
00845         cbitems = NULL;
00846         info_window->occupation = GTK_COMBO(combo)->entry;
00847         _qq_set_entry(info_window->occupation, info->occupation);
00848         gtk_widget_set_size_request(combo, 120, -1);
00849         gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
00850         if (!is_myself)
00851                 gtk_widget_set_sensitive(combo, FALSE);
00852 
00853         text = gtk_text_view_new();
00854         gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
00855         info_window->intro = text;
00856         gtk_widget_set_size_request(text, -1, 90);
00857         _qq_set_text(info_window->intro, info->intro);
00858 
00859         scrolled_window = gtk_scrolled_window_new(NULL, NULL);
00860         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
00861         gtk_container_add(GTK_CONTAINER(scrolled_window), text);
00862         gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
00863         gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2);
00864         gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 2);
00865 
00866         gtk_table_attach(GTK_TABLE(table), scrolled_window, 1, 4, 3, 4, GTK_FILL, 0, 0, 0);
00867         return hbox;
00868 }                               // _create_page_details
00869 
00870 /*****************************************************************************/
00871 GtkWidget *_create_page_security
00872     (int is_myself, contact_info * info, GaimConnection * gc, contact_info_window * info_window) {
00873         GtkWidget *hbox, *frame, *vbox1, *vbox2;
00874         GtkWidget *entry, *table, *label, *check_button;
00875         GtkWidget *radio, *alignment;
00876 
00877         hbox = gtk_hbox_new(FALSE, 0);
00878         vbox1 = gtk_vbox_new(FALSE, 0);
00879         gtk_box_pack_start(GTK_BOX(hbox), vbox1, TRUE, TRUE, 0);
00880 
00881         frame = gtk_frame_new(_("Change Password"));
00882         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00883         gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 0);
00884 
00885         table = gtk_table_new(3, 3, FALSE);
00886         gtk_table_set_row_spacings(GTK_TABLE(table), 2);
00887         gtk_table_set_col_spacings(GTK_TABLE(table), 5);
00888         gtk_container_set_border_width(GTK_CONTAINER(table), 5);
00889         gtk_container_add(GTK_CONTAINER(frame), table);
00890 
00891         label = gtk_label_new(_("Old Passwd"));
00892         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00893         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
00894 
00895         check_button = gtk_check_button_new_with_label(_("I wanna change"));
00896         info_window->is_modify_passwd = check_button;
00897         g_signal_connect(G_OBJECT(check_button), "toggled",
00898                          G_CALLBACK(_change_passwd_checkbutton_callback), info_window);
00899         gtk_table_attach(GTK_TABLE(table), check_button, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
00900 
00901         label = gtk_label_new(_("New Passwd"));
00902         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00903         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
00904 
00905         label = gtk_label_new(_("(less than 16 char)"));
00906         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00907         gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
00908 
00909         label = gtk_label_new(_("Confirm"));
00910         gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
00911         gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
00912 
00913         entry = _qq_entry_new();
00914         gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
00915         gtk_widget_set_sensitive(entry, FALSE);
00916         info_window->old_password = entry;
00917         gtk_widget_set_size_request(entry, 160, -1);
00918         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
00919 
00920         entry = _qq_entry_new();
00921         gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
00922         gtk_widget_set_sensitive(entry, FALSE);
00923         info_window->password[0] = entry;
00924         gtk_widget_set_size_request(entry, 160, -1);
00925         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
00926 
00927         entry = _qq_entry_new();
00928         gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
00929         gtk_widget_set_sensitive(entry, FALSE);
00930         info_window->password[1] = entry;
00931         gtk_widget_set_size_request(entry, 160, -1);
00932         gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
00933 
00934         alignment = gtk_alignment_new(0, 0, 0, 0);
00935         gtk_widget_set_size_request(alignment, -1, 5);
00936         gtk_box_pack_start(GTK_BOX(vbox1), alignment, FALSE, FALSE, 0);
00937 
00938         frame = gtk_frame_new(_("Authentication"));
00939         gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
00940         gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 0);
00941 
00942         vbox2 = gtk_vbox_new(FALSE, 1);
00943         gtk_container_add(GTK_CONTAINER(frame), vbox2);
00944 
00945         radio = gtk_radio_button_new_with_label(NULL, _("Anyone can add me"));
00946         info_window->auth_radio[0] = radio;
00947         gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0);
00948 
00949         radio = gtk_radio_button_new_with_label_from_widget
00950             (GTK_RADIO_BUTTON(radio), _("User needs to be authenticated to add me"));
00951         info_window->auth_radio[1] = radio;
00952         gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0);
00953 
00954         radio = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio), _("Nobody can add me"));
00955         info_window->auth_radio[2] = radio;
00956         gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0);
00957 
00958         _qq_set_auth_type_radio(info_window, info->auth_type);
00959 
00960         return hbox;
00961 }                               // _create_page_security 
00962 
00963 /*****************************************************************************/
00964 void qq_show_contact_info_dialog(contact_info * info, GaimConnection * gc, contact_info_window * info_window) {
00965 
00966         GaimAccount *a = gc->account;
00967         gboolean is_myself;
00968         GtkWidget *label, *window, *notebook, *vbox, *bbox, *button;
00969 
00970         is_myself = (!strcmp(info->uid, a->username));
00971         window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
00972         gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(mainwindow));
00973         info_window->window = window;
00974 
00975         // we need to duplicate here, 
00976         // as the passed-in info structure will be freed in his function
00977         info_window->old_info = (contact_info *) g_strdupv((gchar **) info);
00978 
00979         /* When the window is given the "delete_event" signal (this is given
00980          * by the window manager, usually by the "close" option, or on the
00981          * titlebar), we ask it to call the delete_event () function
00982          * as defined above. The data passed to the callback  
00983          * function is NULL and is ignored in the callback function. 
00984          */
00985         g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(_window_deleteevent), NULL);
00986 
00987         /* Here we connect the "destroy" event to a signal handler.  
00988          * This event occurs when we call gtk_widget_destroy() on the window,
00989          * or if we return FALSE in the "delete_event" callback. 
00990          */
00991         g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(_info_window_destroy), gc);
00992 
00993         gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
00994 
00995         if (is_myself)
00996                 gtk_window_set_title(GTK_WINDOW(window), _("My Information"));
00997         else
00998                 gtk_window_set_title(GTK_WINDOW(window), _("My Buddy's Information"));
00999         gtk_container_set_border_width(GTK_CONTAINER(window), 5);
01000 
01001         vbox = gtk_vbox_new(FALSE, 0);
01002         gtk_container_add(GTK_CONTAINER(window), vbox);
01003 
01004         notebook = gtk_notebook_new();
01005         gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_LEFT);
01006 
01007         label = gtk_label_new(_("Basic"));
01008         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), _create_page_basic(is_myself, info, gc, info_window), label);
01009 
01010         label = gtk_label_new(_("Contact"));
01011         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), _create_page_contact(is_myself, info, gc, info_window), label);
01012 
01013         label = gtk_label_new(_("Details"));
01014         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), _create_page_details(is_myself, info, gc, info_window), label);
01015 
01016         if (is_myself) {
01017                 label = gtk_label_new(_("Security"));
01018                 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
01019                                          _create_page_security(is_myself, info, gc, info_window), label);
01020         }
01021 
01022         gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
01023 
01024         bbox = gtk_hbutton_box_new();
01025         gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
01026         gtk_box_set_spacing(GTK_BOX(bbox), 10);
01027 
01028         button = gtk_button_new_with_label(_("Modify"));
01029         g_object_set_data(G_OBJECT(button), "user_data", (gpointer) info_window);
01030         g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_info_window_change), gc);
01031         gtk_container_add(GTK_CONTAINER(bbox), button);
01032 
01033         if (is_myself)
01034                 gtk_widget_set_sensitive(button, TRUE);
01035         else
01036                 gtk_widget_set_sensitive(button, FALSE);
01037 
01038         button = gtk_button_new_with_label(_("Refresh"));
01039         info_window->refresh_button = button;
01040         g_object_set_data(G_OBJECT(button), "user_data", (gpointer) info_window);
01041         g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_info_window_refresh), gc);
01042         gtk_container_add(GTK_CONTAINER(bbox), button);
01043 
01044         button = gtk_button_new_with_label(_("Close"));
01045         g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_window_close), info_window->window);
01046         gtk_container_add(GTK_CONTAINER(bbox), button);
01047 
01048         gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5);
01049 
01050         _no_edit(info_window->uid_entry);       // uid entry cannot be changed
01051         if (!is_myself) {
01052                 _no_edit(info_window->nick);
01053                 _no_edit(info_window->country);
01054                 _no_edit(info_window->age);
01055                 _no_edit(info_window->gender);
01056                 _no_edit(info_window->province);
01057                 _no_edit(info_window->city);
01058                 _no_edit(info_window->email);
01059                 _no_edit(info_window->address);
01060                 _no_edit(info_window->zipcode);
01061                 _no_edit(info_window->tel);
01062                 _no_edit(info_window->name);
01063                 _no_edit(info_window->blood);
01064                 _no_edit(info_window->college);
01065                 _no_edit(info_window->occupation);
01066                 _no_edit(info_window->zodiac);
01067                 _no_edit(info_window->horoscope);
01068                 _no_edit(info_window->homepage);
01069                 gtk_text_view_set_editable(GTK_TEXT_VIEW(info_window->intro), FALSE);
01070         }
01071         gtk_widget_show_all(window);
01072 }                               // qq_show_contact_info_dialog
01073 
01074 /*****************************************************************************/
01075 void qq_refresh_contact_info_dialog(contact_info * new_info, GaimConnection * gc, contact_info_window * info_window) {
01076         GaimAccount *a;
01077         gboolean is_myself;
01078         contact_info *info;
01079         a = gc->account;
01080 
01081         if (info_window->old_info)
01082                 g_strfreev((gchar **) info_window->old_info);
01083 
01084         // we need to duplicate here, 
01085         // as the passed-in info structure will be freed in his function
01086         info = (contact_info *) g_strdupv((gchar **) new_info);
01087         info_window->old_info = info;
01088 
01089         is_myself = !(g_ascii_strcasecmp(info->uid, a->username));
01090         gtk_widget_set_sensitive(info_window->refresh_button, TRUE);
01091 
01092         if (is_myself) {
01093                 _qq_set_auth_type_radio(info_window, info->auth_type);
01094                 _qq_set_open_contact_radio(info_window, info->is_open_contact);
01095         }
01096 
01097         _qq_set_entry(info_window->uid_entry, info->uid);
01098         _qq_set_entry(info_window->nick, info->nick);
01099         _qq_set_entry(info_window->country, info->country);
01100         _qq_set_entry(info_window->age, info->age);
01101         _qq_set_entry(info_window->gender, info->gender);
01102         _qq_set_entry(info_window->province, info->province);
01103         _qq_set_entry(info_window->city, info->city);
01104         _qq_set_entry(info_window->email, info->email);
01105         _qq_set_entry(info_window->address, info->address);
01106         _qq_set_entry(info_window->zipcode, info->zipcode);
01107         _qq_set_entry(info_window->tel, info->tel);
01108         _qq_set_entry(info_window->name, info->name);
01109         gtk_entry_set_text(GTK_ENTRY(info_window->zodiac),
01110                            get_name_by_index_str((gchar **) zodiac_names, info->zodiac, zodiac_names_count));
01111         gtk_entry_set_text(GTK_ENTRY(info_window->horoscope), get_name_by_index_str((gchar **)
01112                                                                                     horoscope_names,
01113                                                                                     info->horoscope,
01114                                                                                     horoscope_names_count));
01115         gtk_entry_set_text(GTK_ENTRY(info_window->blood),
01116                            get_name_by_index_str((gchar **) blood_types, info->blood, blood_types_count));
01117         _qq_set_entry(info_window->college, info->college);
01118         _qq_set_entry(info_window->occupation, info->occupation);
01119         _qq_set_entry(info_window->homepage, info->homepage);
01120 
01121         _qq_set_image(info_window->face, (guint8) atoi(info->face));
01122 
01123         _qq_set_text(info_window->intro, info->intro);
01124 }                               // qq_refresh_contact_info_dialog
01125 
01126 /*****************************************************************************/
01127 // END OF FILE

Generated at Mon May 8 15:41:24 2006 for OpenQ by  doxygen 1.4.4