| 1497 gtk_box_pack_end(GTK_BOX(hbox), b->ok, FALSE, FALSE, 0); |
1497 gtk_box_pack_end(GTK_BOX(hbox), b->ok, FALSE, FALSE, 0); |
| 1498 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", GTK_SIGNAL_FUNC(do_change_password), b); |
1498 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", GTK_SIGNAL_FUNC(do_change_password), b); |
| 1499 |
1499 |
| 1500 |
1500 |
| 1501 gtk_widget_show(b->window); |
1501 gtk_widget_show(b->window); |
| 1502 } |
|
| 1503 |
|
| 1504 void do_user_icon(GtkWidget *w, gpointer data) |
|
| 1505 { |
|
| 1506 struct set_icon_dlg *b = (struct set_icon_dlg *)data; |
|
| 1507 char *file; |
|
| 1508 |
|
| 1509 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(icondlg)); |
|
| 1510 |
|
| 1511 if (file_is_dir(file, icondlg)) |
|
| 1512 return; |
|
| 1513 |
|
| 1514 if (b && b->entry) { |
|
| 1515 gtk_entry_set_text(GTK_ENTRY(b->entry), file); |
|
| 1516 } |
|
| 1517 |
|
| 1518 destroy_dialog(NULL, icondlg); |
|
| 1519 icondlg = NULL; |
|
| 1520 |
|
| 1521 } |
|
| 1522 |
|
| 1523 void show_icon_dialog(GtkWidget *w, gpointer data) |
|
| 1524 { |
|
| 1525 struct set_icon_dlg *b = (struct set_icon_dlg *)data; |
|
| 1526 char *buf = g_malloc(BUF_LEN); |
|
| 1527 |
|
| 1528 if (!icondlg) { |
|
| 1529 icondlg = gtk_file_selection_new(_("Gaim - Load User Icon")); |
|
| 1530 |
|
| 1531 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(icondlg)); |
|
| 1532 |
|
| 1533 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("HOME")); |
|
| 1534 |
|
| 1535 gtk_file_selection_set_filename(GTK_FILE_SELECTION(icondlg), buf); |
|
| 1536 gtk_signal_connect(GTK_OBJECT(icondlg), "destroy", |
|
| 1537 GTK_SIGNAL_FUNC(destroy_dialog), icondlg); |
|
| 1538 |
|
| 1539 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(icondlg)->ok_button), |
|
| 1540 "clicked", GTK_SIGNAL_FUNC(do_user_icon), b); |
|
| 1541 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(icondlg)->cancel_button), |
|
| 1542 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), icondlg); |
|
| 1543 |
|
| 1544 |
|
| 1545 } |
|
| 1546 |
|
| 1547 g_free(buf); |
|
| 1548 gtk_widget_show(icondlg); |
|
| 1549 gdk_window_raise(icondlg->window); |
|
| 1550 } |
|
| 1551 |
|
| 1552 void do_save_icon(GtkWidget *w, struct set_icon_dlg *b) |
|
| 1553 { |
|
| 1554 char *file = gtk_entry_get_text(GTK_ENTRY(b->entry)); |
|
| 1555 |
|
| 1556 if (file) |
|
| 1557 g_snprintf(b->user->iconfile, sizeof(b->user->iconfile), "%s", file); |
|
| 1558 else |
|
| 1559 b->user->iconfile[0] = 0; |
|
| 1560 |
|
| 1561 save_prefs(); |
|
| 1562 |
|
| 1563 destroy_dialog(NULL, b->window); |
|
| 1564 } |
|
| 1565 |
|
| 1566 void do_clear_icon(GtkWidget *w, struct set_icon_dlg *b) |
|
| 1567 { |
|
| 1568 gtk_entry_set_text(GTK_ENTRY(b->entry), ""); |
|
| 1569 } |
|
| 1570 |
|
| 1571 void show_set_icon(struct gaim_connection *gc) |
|
| 1572 { |
|
| 1573 GtkWidget *label; |
|
| 1574 GtkWidget *frame; |
|
| 1575 GtkWidget *buttons; |
|
| 1576 GtkWidget *button; |
|
| 1577 GtkWidget *vbox; |
|
| 1578 GtkWidget *hbox; |
|
| 1579 GtkWidget *hbox2; |
|
| 1580 GtkWidget *rbox; |
|
| 1581 /* GtkWidget *sep; */ |
|
| 1582 |
|
| 1583 struct aim_user *tmp; |
|
| 1584 struct set_icon_dlg *b = g_new0(struct set_icon_dlg, 1); |
|
| 1585 |
|
| 1586 if (!g_slist_find(connections, gc)) |
|
| 1587 gc = connections->data; |
|
| 1588 |
|
| 1589 tmp = gc->user; |
|
| 1590 b->user = tmp; |
|
| 1591 |
|
| 1592 b->window = gtk_window_new(GTK_WINDOW_DIALOG); |
|
| 1593 gtk_container_set_border_width(GTK_CONTAINER(b->window), 5); |
|
| 1594 gtk_window_set_wmclass(GTK_WINDOW(b->window), "set_icon", "Gaim"); |
|
| 1595 gtk_window_set_title(GTK_WINDOW(b->window), _("Gaim - Set User Icon")); |
|
| 1596 gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(destroy_dialog), b->window); |
|
| 1597 gtk_widget_realize(b->window); |
|
| 1598 aol_icon(b->window->window); |
|
| 1599 dialogwindows = g_list_prepend(dialogwindows, b->window); |
|
| 1600 |
|
| 1601 /* the box that holds everything */ |
|
| 1602 vbox = gtk_vbox_new(FALSE, 5); |
|
| 1603 gtk_widget_show(vbox); |
|
| 1604 gtk_container_add(GTK_CONTAINER(b->window), vbox); |
|
| 1605 |
|
| 1606 /* and the frame that umm frames shit */ |
|
| 1607 frame = gtk_frame_new(_("User Icon")); |
|
| 1608 gtk_container_set_border_width(GTK_CONTAINER(frame), 5); |
|
| 1609 gtk_widget_show(frame); |
|
| 1610 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); |
|
| 1611 |
|
| 1612 /* the inner boxie */ |
|
| 1613 hbox = gtk_hbox_new(FALSE, 0); |
|
| 1614 gtk_widget_show(hbox); |
|
| 1615 gtk_container_add(GTK_CONTAINER(frame), hbox); |
|
| 1616 |
|
| 1617 /* |
|
| 1618 sep = gtk_vseparator_new(); |
|
| 1619 gtk_widget_show(sep); |
|
| 1620 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 5); |
|
| 1621 */ |
|
| 1622 |
|
| 1623 /* A boxy */ |
|
| 1624 rbox = gtk_vbox_new(FALSE, 5); |
|
| 1625 gtk_widget_show(rbox); |
|
| 1626 gtk_box_pack_start(GTK_BOX(hbox), rbox, FALSE, FALSE, 5); |
|
| 1627 |
|
| 1628 label = gtk_label_new(_("Please select an icon to be viewed when you chat with\nother users.")); |
|
| 1629 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
|
| 1630 gtk_widget_show(label); |
|
| 1631 gtk_box_pack_start(GTK_BOX(rbox), label, FALSE, FALSE, 5); |
|
| 1632 |
|
| 1633 hbox2 = gtk_hbox_new(FALSE, 5); |
|
| 1634 gtk_widget_show(hbox2); |
|
| 1635 gtk_box_pack_start(GTK_BOX(rbox), hbox2, FALSE, FALSE, 5); |
|
| 1636 |
|
| 1637 b->entry = gtk_entry_new(); |
|
| 1638 |
|
| 1639 if (strlen(gc->user->iconfile)) { |
|
| 1640 gtk_entry_set_text(GTK_ENTRY(b->entry), gc->user->iconfile); |
|
| 1641 } |
|
| 1642 |
|
| 1643 gtk_widget_show(b->entry); |
|
| 1644 gtk_box_pack_start(GTK_BOX(hbox2), b->entry, TRUE, TRUE, 5); |
|
| 1645 |
|
| 1646 button = gtk_button_new_with_label(_("Browse")); |
|
| 1647 gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 5); |
|
| 1648 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(show_icon_dialog), b); |
|
| 1649 gtk_widget_show(button); |
|
| 1650 |
|
| 1651 button = gtk_button_new_with_label(_("Clear")); |
|
| 1652 gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 5); |
|
| 1653 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_clear_icon), b); |
|
| 1654 |
|
| 1655 gtk_widget_show(button); |
|
| 1656 |
|
| 1657 /* button buttons */ |
|
| 1658 buttons = gtk_hbox_new(FALSE, 5); |
|
| 1659 gtk_box_pack_start(GTK_BOX(vbox), buttons, FALSE, FALSE, 0); |
|
| 1660 gtk_widget_show(buttons); |
|
| 1661 |
|
| 1662 b->cancel = picture_button(b->window, _("Cancel"), cancel_xpm); |
|
| 1663 gtk_box_pack_end(GTK_BOX(buttons), b->cancel, FALSE, FALSE, 0); |
|
| 1664 gtk_signal_connect(GTK_OBJECT(b->cancel), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), b->window); |
|
| 1665 |
|
| 1666 b->ok = picture_button(b->window, _("Ok"), ok_xpm); |
|
| 1667 gtk_box_pack_end(GTK_BOX(buttons), b->ok, FALSE, FALSE, 0); |
|
| 1668 |
|
| 1669 gtk_signal_connect(GTK_OBJECT(b->ok), "clicked", GTK_SIGNAL_FUNC(do_save_icon), b); |
|
| 1670 |
|
| 1671 /* Show it */ |
|
| 1672 gtk_widget_show(b->window); |
|
| 1673 |
|
| 1674 } |
1502 } |
| 1675 |
1503 |
| 1676 void show_set_info(struct gaim_connection *gc) |
1504 void show_set_info(struct gaim_connection *gc) |
| 1677 { |
1505 { |
| 1678 GtkWidget *buttons; |
1506 GtkWidget *buttons; |