| 1701 /* Restart the typing timeout if arrow keys are pressed while editing the message */ |
1701 /* Restart the typing timeout if arrow keys are pressed while editing the message */ |
| 1702 PidginStatusBox *status_box = data; |
1702 PidginStatusBox *status_box = data; |
| 1703 if (status_box->typing == 0) |
1703 if (status_box->typing == 0) |
| 1704 return; |
1704 return; |
| 1705 imhtml_changed_cb(NULL, status_box); |
1705 imhtml_changed_cb(NULL, status_box); |
| |
1706 } |
| |
1707 |
| |
1708 static void |
| |
1709 treeview_cursor_changed_cb(GtkTreeView *treeview, gpointer data) |
| |
1710 { |
| |
1711 GtkTreeSelection *sel = gtk_tree_view_get_selection (treeview); |
| |
1712 GtkTreeModel *model = GTK_TREE_MODEL (data); |
| |
1713 GtkTreeIter iter; |
| |
1714 GtkTreePath *cursor; |
| |
1715 GtkTreePath *selection; |
| |
1716 gint cmp; |
| |
1717 |
| |
1718 if (gtk_tree_selection_get_selected (sel, NULL, &iter)) { |
| |
1719 if ((selection = gtk_tree_model_get_path (model, &iter)) == NULL) { |
| |
1720 /* Shouldn't happen, but ignore anyway */ |
| |
1721 return; |
| |
1722 } |
| |
1723 } else { |
| |
1724 /* I don't think this can happen, but we'll just ignore it */ |
| |
1725 return; |
| |
1726 } |
| |
1727 |
| |
1728 gtk_tree_view_get_cursor (treeview, &cursor, NULL); |
| |
1729 if (cursor == NULL) { |
| |
1730 /* Probably won't happen in a 'cursor-changed' event? */ |
| |
1731 gtk_tree_path_free (selection); |
| |
1732 return; |
| |
1733 } |
| |
1734 |
| |
1735 cmp = gtk_tree_path_compare (cursor, selection); |
| |
1736 if (cmp < 0) { |
| |
1737 /* The cursor moved up without moving the selection, so move it up again */ |
| |
1738 gtk_tree_path_prev (cursor); |
| |
1739 gtk_tree_view_set_cursor (treeview, cursor, NULL, FALSE); |
| |
1740 } else if (cmp > 0) { |
| |
1741 /* The cursor moved down without moving the selection, so move it down again */ |
| |
1742 gtk_tree_path_next (cursor); |
| |
1743 gtk_tree_view_set_cursor (treeview, cursor, NULL, FALSE); |
| |
1744 } |
| |
1745 |
| |
1746 gtk_tree_path_free (selection); |
| |
1747 gtk_tree_path_free (cursor); |
| 1706 } |
1748 } |
| 1707 |
1749 |
| 1708 static void |
1750 static void |
| 1709 pidgin_status_box_init (PidginStatusBox *status_box) |
1751 pidgin_status_box_init (PidginStatusBox *status_box) |
| 1710 { |
1752 { |
| 1867 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); |
1909 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); |
| 1868 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", |
1910 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", |
| 1869 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); |
1911 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); |
| 1870 g_signal_connect(G_OBJECT(status_box->popup_window), "button_release_event", G_CALLBACK(treeview_button_release_cb), status_box); |
1912 g_signal_connect(G_OBJECT(status_box->popup_window), "button_release_event", G_CALLBACK(treeview_button_release_cb), status_box); |
| 1871 g_signal_connect(G_OBJECT(status_box->popup_window), "key_press_event", G_CALLBACK(treeview_key_press_event), status_box); |
1913 g_signal_connect(G_OBJECT(status_box->popup_window), "key_press_event", G_CALLBACK(treeview_key_press_event), status_box); |
| |
1914 g_signal_connect(G_OBJECT(status_box->tree_view), "cursor-changed", |
| |
1915 G_CALLBACK(treeview_cursor_changed_cb), status_box->dropdown_store); |
| 1872 |
1916 |
| 1873 #if GTK_CHECK_VERSION(2,6,0) |
1917 #if GTK_CHECK_VERSION(2,6,0) |
| 1874 gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(status_box->tree_view), dropdown_store_row_separator_func, NULL, NULL); |
1918 gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(status_box->tree_view), dropdown_store_row_separator_func, NULL, NULL); |
| 1875 #endif |
1919 #endif |
| 1876 |
1920 |