aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat-text-view.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-05-05 15:30:03 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-06-12 08:07:20 +0800
commitfeda58b5da761dce7c18a2cb2d4531481fe3bfce (patch)
tree38a576ce342915b5d92d8cee600ea35f9504beef /libempathy-gtk/empathy-chat-text-view.c
parent9e495e95ae426f691c8682285b698f84e0a942d3 (diff)
downloadgsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar.gz
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar.bz2
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar.lz
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar.xz
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.tar.zst
gsoc2013-empathy-feda58b5da761dce7c18a2cb2d4531481fe3bfce.zip
Use gtk_text_view_get_vadjustment() instead of assuming parent is a GtkScrolledWindow
Diffstat (limited to 'libempathy-gtk/empathy-chat-text-view.c')
-rw-r--r--libempathy-gtk/empathy-chat-text-view.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index 9e31e4987..0f7400f1d 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.c
@@ -333,23 +333,18 @@ chat_text_view_populate_popup (EmpathyChatTextView *view,
static gboolean
chat_text_view_is_scrolled_down (EmpathyChatTextView *view)
{
- GtkWidget *sw;
-
- sw = gtk_widget_get_parent (GTK_WIDGET (view));
- if (GTK_IS_SCROLLED_WINDOW (sw)) {
- GtkAdjustment *vadj;
- gdouble value;
- gdouble upper;
- gdouble page_size;
-
- vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
- value = gtk_adjustment_get_value (vadj);
- upper = gtk_adjustment_get_upper (vadj);
- page_size = gtk_adjustment_get_page_size (vadj);
-
- if (value < upper - page_size) {
- return FALSE;
- }
+ GtkAdjustment *vadj;
+ gdouble value;
+ gdouble upper;
+ gdouble page_size;
+
+ vadj = gtk_text_view_get_vadjustment (GTK_TEXT_VIEW (view));
+ value = gtk_adjustment_get_value (vadj);
+ upper = gtk_adjustment_get_upper (vadj);
+ page_size = gtk_adjustment_get_page_size (vadj);
+
+ if (value < upper - page_size) {
+ return FALSE;
}
return TRUE;
@@ -493,13 +488,8 @@ chat_text_view_size_allocate (GtkWidget *widget,
if (down) {
GtkAdjustment *adj;
- GtkWidget *sw;
-
- sw = gtk_widget_get_parent (widget);
- if (!GTK_IS_SCROLLED_WINDOW (sw))
- return;
- adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
+ adj = gtk_text_view_get_vadjustment (GTK_TEXT_VIEW (widget));
gtk_adjustment_set_value (adj,
gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_page_size (adj));
@@ -677,17 +667,10 @@ chat_text_view_scroll_cb (EmpathyChatTextView *view)
EmpathyChatTextViewPriv *priv;
GtkAdjustment *adj;
gdouble max_val;
- GtkWidget *sw;
priv = GET_PRIV (view);
- sw = gtk_widget_get_parent (GTK_WIDGET (view));
- if (!GTK_IS_SCROLLED_WINDOW (sw)) {
- chat_text_view_scroll_stop (view);
- return FALSE;
- }
-
- adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
+ adj = gtk_text_view_get_vadjustment (GTK_TEXT_VIEW (view));
max_val = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj);
g_return_val_if_fail (priv->scroll_time != NULL, FALSE);