comparison src/gtkconv.c @ 4378:194507c83612

[gaim-migrate @ 4644] - Removed some debug_printf statements. - Added GAIM_CONV_UPDATE_AWAY. - Couple other things I'll be making use of later. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 21 Jan 2003 06:16:42 +0000
parents dcc6c130c6d9
children 76223649765b
comparison
equal deleted inserted replaced
4377:0ffdb9b6a5e9 4378:194507c83612
99 99
100 char fontface[128] = { 0 }; 100 char fontface[128] = { 0 };
101 int fontsize = 3; 101 int fontsize = 3;
102 102
103 static GtkWidget *invite_dialog = NULL; 103 static GtkWidget *invite_dialog = NULL;
104 #if 0
105 static GtkWidget *invite_entry;
106 static GtkWidget *invite_mess;
107 #endif
108 104
109 static volatile gboolean state_lock = FALSE; 105 static volatile gboolean state_lock = FALSE;
110 106
111 /* Prototypes. <-- because Paco-Paco hates this comment. */ 107 /* Prototypes. <-- because Paco-Paco hates this comment. */
112 static void check_everything(GtkTextBuffer *buffer); 108 static void check_everything(GtkTextBuffer *buffer);
1495 struct gaim_gtk_window *gtkwin; 1491 struct gaim_gtk_window *gtkwin;
1496 gint nb_x, nb_y, x_rel, y_rel; 1492 gint nb_x, nb_y, x_rel, y_rel;
1497 GList *l; 1493 GList *l;
1498 int tab_clicked; 1494 int tab_clicked;
1499 1495
1500 debug_printf("notebook_press_cb\n");
1501 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) 1496 if (e->button != 1 || e->type != GDK_BUTTON_PRESS)
1502 return FALSE; 1497 return FALSE;
1503 1498
1504 gtkwin = GAIM_GTK_WINDOW(win); 1499 gtkwin = GAIM_GTK_WINDOW(win);
1505 1500
1506 debug_printf("notebook_press_cb: 1\n");
1507 if (gtkwin->in_drag) { 1501 if (gtkwin->in_drag) {
1508 debug_printf("Already in the middle of a window " 1502 debug_printf("Already in the middle of a window "
1509 "drag at tab_press_cb\n"); 1503 "drag at tab_press_cb\n");
1510 return FALSE; 1504 return FALSE;
1511 } 1505 }
1514 * Make sure a tab was actually clicked. The arrow buttons 1508 * Make sure a tab was actually clicked. The arrow buttons
1515 * mess things up. 1509 * mess things up.
1516 */ 1510 */
1517 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); 1511 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root);
1518 1512
1519 printf("tab_clicked == %d\n", tab_clicked);
1520
1521 if (tab_clicked == -1) 1513 if (tab_clicked == -1)
1522 return FALSE; 1514 return FALSE;
1523 1515
1524 /* 1516 /*
1525 * Get the relative position of the press event, with regards to 1517 * Get the relative position of the press event, with regards to
1539 /* Find out which tab was dragged. */ 1531 /* Find out which tab was dragged. */
1540 for (l = gaim_window_get_conversations(win); l != NULL; l = l->next) { 1532 for (l = gaim_window_get_conversations(win); l != NULL; l = l->next) {
1541 struct gaim_conversation *conv = l->data; 1533 struct gaim_conversation *conv = l->data;
1542 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; 1534 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby;
1543 1535
1544 debug_printf("Tab: %d\n", gaim_conversation_get_index(conv));
1545 if (!GTK_WIDGET_VISIBLE(tab)) 1536 if (!GTK_WIDGET_VISIBLE(tab))
1546 continue; 1537 continue;
1547 1538
1548 debug_printf("Tab Visible.\n");
1549 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) 1539 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel)
1550 break; 1540 break;
1551 1541
1552 /* Save the borders of the tab. */ 1542 /* Save the borders of the tab. */
1553 gtkwin->drag_min_x = tab->allocation.x + nb_x; 1543 gtkwin->drag_min_x = tab->allocation.x + nb_x;
1554 gtkwin->drag_min_y = tab->allocation.y + nb_y; 1544 gtkwin->drag_min_y = tab->allocation.y + nb_y;
1555 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; 1545 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x;
1556 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; 1546 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y;
1557 } 1547 }
1558 1548
1559 debug_printf("notebook_press_cb: 3\n");
1560
1561 /* Make sure the click occurred in the tab. */ 1549 /* Make sure the click occurred in the tab. */
1562 if (e->x_root < gtkwin->drag_min_x || 1550 if (e->x_root < gtkwin->drag_min_x ||
1563 e->x_root >= gtkwin->drag_max_x || 1551 e->x_root >= gtkwin->drag_max_x ||
1564 e->y_root < gtkwin->drag_min_y || 1552 e->y_root < gtkwin->drag_min_y ||
1565 e->y_root >= gtkwin->drag_max_y) { 1553 e->y_root >= gtkwin->drag_max_y) {
1566 1554
1567 debug_printf("Passing this down.\n");
1568 return FALSE; 1555 return FALSE;
1569 } 1556 }
1570 1557
1571 debug_printf("notebook_press_cb: 4\n");
1572 gtkwin->in_predrag = TRUE; 1558 gtkwin->in_predrag = TRUE;
1573 1559
1574 /* Connect the new motion signals. */ 1560 /* Connect the new motion signals. */
1575 gtkwin->drag_motion_signal = 1561 gtkwin->drag_motion_signal =
1576 g_signal_connect(G_OBJECT(widget), "motion_notify_event", 1562 g_signal_connect(G_OBJECT(widget), "motion_notify_event",
1578 1564
1579 gtkwin->drag_leave_signal = 1565 gtkwin->drag_leave_signal =
1580 g_signal_connect(G_OBJECT(widget), "leave_notify_event", 1566 g_signal_connect(G_OBJECT(widget), "leave_notify_event",
1581 G_CALLBACK(notebook_leave_cb), win); 1567 G_CALLBACK(notebook_leave_cb), win);
1582 1568
1583 debug_printf("notebook_press_cb: 5\n");
1584 return FALSE; 1569 return FALSE;
1585 } 1570 }
1586 1571
1587 static gboolean 1572 static gboolean
1588 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, 1573 notebook_release_cb(GtkWidget *widget, GdkEventButton *e,
1609 } 1594 }
1610 1595
1611 gtkwin = GAIM_GTK_WINDOW(win); 1596 gtkwin = GAIM_GTK_WINDOW(win);
1612 1597
1613 if (!gtkwin->in_predrag && !gtkwin->in_drag) { 1598 if (!gtkwin->in_predrag && !gtkwin->in_drag) {
1614 printf("Not in predrag.\n");
1615 return TRUE; 1599 return TRUE;
1616 } 1600 }
1617 1601
1618 /* Disconnect the motion signal. */ 1602 /* Disconnect the motion signal. */
1619 if (gtkwin->drag_motion_signal) { 1603 if (gtkwin->drag_motion_signal) {
1639 } 1623 }
1640 1624
1641 /* If we're not in drag... */ 1625 /* If we're not in drag... */
1642 /* We're perfectly normal people! */ 1626 /* We're perfectly normal people! */
1643 if (!gtkwin->in_drag) { 1627 if (!gtkwin->in_drag) {
1644 debug_printf("Not in drag.\n");
1645 return FALSE; 1628 return FALSE;
1646 } 1629 }
1647 1630
1648 gtkwin->in_drag = FALSE; 1631 gtkwin->in_drag = FALSE;
1649 1632
1697 gaim_window_switch_conversation(dest_win, dest_page_num); 1680 gaim_window_switch_conversation(dest_win, dest_page_num);
1698 } 1681 }
1699 1682
1700 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); 1683 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
1701 1684
1702 debug_printf("release cb returning.\n");
1703 return TRUE; 1685 return TRUE;
1704 } 1686 }
1705 1687
1706 static void 1688 static void
1707 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, 1689 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
1713 struct gaim_gtk_window *gtkwin; 1695 struct gaim_gtk_window *gtkwin;
1714 struct gaim_connection *gc; 1696 struct gaim_connection *gc;
1715 1697
1716 if (gaim_gtk_is_state_locked()) 1698 if (gaim_gtk_is_state_locked())
1717 return; 1699 return;
1718
1719 debug_printf("Switching conversation\n");
1720 1700
1721 win = (struct gaim_window *)user_data; 1701 win = (struct gaim_window *)user_data;
1722 1702
1723 conv = gaim_window_get_conversation_at(win, page_num); 1703 conv = gaim_window_get_conversation_at(win, page_num);
1724 gc = gaim_conversation_get_gc(conv); 1704 gc = gaim_conversation_get_gc(conv);
3388 3368
3389 /* Er, bug in notebooks? Switch to the page manually. */ 3369 /* Er, bug in notebooks? Switch to the page manually. */
3390 if (gaim_window_get_conversation_count(win) == 1) 3370 if (gaim_window_get_conversation_count(win) == 1)
3391 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); 3371 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0);
3392 3372
3393 debug_printf("*** Current page = %d\n",
3394 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)));
3395
3396 if ((gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)) == 0) || 3373 if ((gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)) == 0) ||
3397 (conv == g_list_nth_data(gaim_window_get_conversations(win), 0))) { 3374 (conv == g_list_nth_data(gaim_window_get_conversations(win), 0))) {
3398 3375
3399 gtk_widget_grab_focus(gtkconv->entry); 3376 gtk_widget_grab_focus(gtkconv->entry);
3400 } 3377 }
3590 { 3567 {
3591 struct gaim_gtk_conversation *gtkconv; 3568 struct gaim_gtk_conversation *gtkconv;
3592 3569
3593 gtkconv = GAIM_GTK_CONVERSATION(conv); 3570 gtkconv = GAIM_GTK_CONVERSATION(conv);
3594 3571
3595 debug_printf("Write IM\n");
3596
3597 if (gtkconv->make_sound) { 3572 if (gtkconv->make_sound) {
3598 if (flags & WFLAG_RECV) { 3573 if (flags & WFLAG_RECV) {
3599 if (gtkconv->u.im->a_virgin && 3574 if (gtkconv->u.im->a_virgin &&
3600 (sound_options & OPT_SOUND_FIRST_RCV)) { 3575 (sound_options & OPT_SOUND_FIRST_RCV)) {
3601 3576
3603 } 3578 }
3604 else 3579 else
3605 play_sound(SND_RECEIVE); 3580 play_sound(SND_RECEIVE);
3606 } 3581 }
3607 else { 3582 else {
3608 debug_printf("Playing SND_SEND\n");
3609 play_sound(SND_SEND); 3583 play_sound(SND_SEND);
3610 } 3584 }
3611 } 3585 }
3612 3586
3613 gtkconv->u.im->a_virgin = FALSE; 3587 gtkconv->u.im->a_virgin = FALSE;