[empathy] Fix some build errors when GSEAL is enabled



commit d8ee766305ccac5a7df6678e09938d95f63a2583
Author: Xavier Claessens <xclaesse gmail com>
Date:   Tue Apr 13 16:27:12 2010 +0200

    Fix some build errors when GSEAL is enabled

 configure.ac                            |    8 +++++-
 libempathy-gtk/empathy-chat-text-view.c |   33 ++++++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f9db12d..b30abc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,10 +47,14 @@ KEYRING_REQUIRED=2.22
 NETWORK_MANAGER_REQUIRED=0.7.0
 NAUTILUS_SENDTO_REQUIRED=2.28.1
 
-# Use --enable-maintainer-mode to disable deprecated symbols and single include.
-# If this is not a released empathy, maintainer mode is forced
+# Use --enable-maintainer-mode to disable deprecated symbols,
+# disable single include and enable GSEAL. If this is not a released empathy,
+# maintainer mode is forced
 ifelse(empathy_released, 1, [], [enable_maintainer_mode="yes"])
 GNOME_MAINTAINER_MODE_DEFINES
+#if test $USE_MAINTAINER_MODE = yes; then
+#  AC_DEFINE(GSEAL_ENABLE, [], [Seal public structs to force usage of accessors])
+#fi
 
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index 491b613..9e31e49 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.c
@@ -493,8 +493,13 @@ chat_text_view_size_allocate (GtkWidget     *widget,
 
 	if (down) {
 		GtkAdjustment *adj;
+		GtkWidget *sw;
 
-		adj = GTK_TEXT_VIEW (widget)->vadjustment;
+		sw = gtk_widget_get_parent (widget);
+		if (!GTK_IS_SCROLLED_WINDOW (sw))
+			return;
+
+		adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
 		gtk_adjustment_set_value (adj,
 					  gtk_adjustment_get_upper (adj) -
 					  gtk_adjustment_get_page_size (adj));
@@ -653,6 +658,18 @@ empathy_chat_text_view_init (EmpathyChatTextView *view)
 			  NULL);
 }
 
+static void
+chat_text_view_scroll_stop (EmpathyChatTextView *view)
+{
+	EmpathyChatTextViewPriv *priv = GET_PRIV (view);
+
+	g_timer_destroy (priv->scroll_time);
+	priv->scroll_time = NULL;
+
+	g_source_remove (priv->scroll_timeout);
+	priv->scroll_timeout = 0;
+}
+
 /* Code stolen from pidgin/gtkimhtml.c */
 static gboolean
 chat_text_view_scroll_cb (EmpathyChatTextView *view)
@@ -660,9 +677,17 @@ chat_text_view_scroll_cb (EmpathyChatTextView *view)
 	EmpathyChatTextViewPriv *priv;
 	GtkAdjustment      *adj;
 	gdouble             max_val;
+	GtkWidget          *sw;
 
 	priv = GET_PRIV (view);
-	adj = GTK_TEXT_VIEW (view)->vadjustment;
+
+	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));
 	max_val = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj);
 
 	g_return_val_if_fail (priv->scroll_time != NULL, FALSE);
@@ -670,9 +695,7 @@ chat_text_view_scroll_cb (EmpathyChatTextView *view)
 	if (g_timer_elapsed (priv->scroll_time, NULL) > MAX_SCROLL_TIME) {
 		/* time's up. jump to the end and kill the timer */
 		gtk_adjustment_set_value (adj, max_val);
-		g_timer_destroy (priv->scroll_time);
-		priv->scroll_time = NULL;
-		priv->scroll_timeout = 0;
+		chat_text_view_scroll_stop (view);
 		return FALSE;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]