changeset 15259:cfdd47296dbc

[gaim-migrate @ 18048] Fixes for compiling and running with Gtk 2.0 ! committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 22 Dec 2006 19:15:38 +0000
parents b380e326d602
children c7acd154bcb3
files gtk/gtkscrollbook.c gtk/gtkscrollbook.h gtk/gtkstatusbox.c gtk/gtkutils.c gtk/gtkutils.h
diffstat 5 files changed, 60 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkscrollbook.c	Fri Dec 22 08:41:29 2006 +0000
+++ b/gtk/gtkscrollbook.c	Fri Dec 22 19:15:38 2006 +0000
@@ -133,8 +133,9 @@
 static void
 switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, GtkGaimScrollBook *scroll_book)
 {
+	int count;
 #if GTK_CHECK_VERSION(2,2,0)
-	int count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
+	count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
 #else
 	count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
 #endif
--- a/gtk/gtkscrollbook.h	Fri Dec 22 08:41:29 2006 +0000
+++ b/gtk/gtkscrollbook.h	Fri Dec 22 19:15:38 2006 +0000
@@ -28,6 +28,9 @@
 
 #include <gtk/gtk.h>
 
+#if !GTK_CHECK_VERSION(2,4,0)
+#include "gaimcombobox.h"
+#endif
 
 G_BEGIN_DECLS
 
--- a/gtk/gtkstatusbox.c	Fri Dec 22 08:41:29 2006 +0000
+++ b/gtk/gtkstatusbox.c	Fri Dec 22 19:15:38 2006 +0000
@@ -1190,9 +1190,11 @@
 static void
 gtk_gaim_status_box_list_position (GtkGaimStatusBox *status_box, int *x, int *y, int *width, int *height)
 {
+#if GTK_CHECK_VERSION(2,2,0)
   GdkScreen *screen;
   gint monitor_num;
   GdkRectangle monitor;
+#endif
   GtkRequisition popup_req;
   GtkPolicyType hpolicy, vpolicy;
   
@@ -1218,6 +1220,7 @@
 
   *height = popup_req.height;
 
+#if GTK_CHECK_VERSION(2,2,0)
   screen = gtk_widget_get_screen (GTK_WIDGET (status_box));
   monitor_num = gdk_screen_get_monitor_at_window (screen, 
 						  GTK_WIDGET (status_box)->window);
@@ -1250,6 +1253,7 @@
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
 				      hpolicy, vpolicy);
     }
+#endif
 }
 
 static gboolean
@@ -1268,8 +1272,13 @@
 	return TRUE;
       else
 	{
+#if GTK_CHECK_VERSION(2,2,0)
 	  gdk_display_pointer_ungrab (gdk_drawable_get_display (window),
 				      activate_time);
+#else
+	  gdk_pointer_ungrab(activate_time);
+	  gdk_keyboard_ungrab(activate_time);
+#endif
 	  return FALSE;
 	}
     }
@@ -1526,8 +1535,10 @@
 	}
 
 	gtk_window_set_resizable (GTK_WINDOW (status_box->popup_window), FALSE);
+#if GTK_CHECK_VERSION(2,2,0)
 	gtk_window_set_screen (GTK_WINDOW (status_box->popup_window),
 			gtk_widget_get_screen (GTK_WIDGET (status_box)));
+#endif
 	status_box->popup_frame = gtk_frame_new (NULL);
 	gtk_frame_set_shadow_type (GTK_FRAME (status_box->popup_frame),
 			GTK_SHADOW_ETCHED_IN);
@@ -1554,8 +1565,10 @@
 	gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view),
 			FALSE);
+#if GTK_CHECK_VERSION(2,6,0)
 	gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view),
 			TRUE);
+#endif
 	gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view),
 			GTK_TREE_MODEL(status_box->dropdown_store));
 	status_box->column = gtk_tree_view_column_new ();
--- a/gtk/gtkutils.c	Fri Dec 22 08:41:29 2006 +0000
+++ b/gtk/gtkutils.c	Fri Dec 22 19:15:38 2006 +0000
@@ -2466,6 +2466,7 @@
 	char **prpl_formats;
 	int width, height;
 	char **pixbuf_formats = NULL;
+	struct stat st;
 	GdkPixbufFormat *format;
 	GdkPixbuf *pixbuf;
 #if !GTK_CHECK_VERSION(2,4,0)
@@ -2477,7 +2478,6 @@
 	const char *dirname;
 	char *random;
 	char *filename;
-	struct stat st;
 
 	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin);
 
@@ -2815,7 +2815,7 @@
 
 	return pixbuf;
 }
-#endif
+#endif /* ! Gtk 2.6.0 */
 
 void gaim_gtk_set_custom_buddy_icon(GaimAccount *account, const char *who, const char *filename)
 {
@@ -3092,3 +3092,28 @@
 	return result;
 }
 
+
+#if !GTK_CHECK_VERSION(2,2,0)
+GtkTreePath *
+gtk_tree_path_new_from_indices (gint first_index, ...)
+{
+	int arg;
+	va_list args;
+	GtkTreePath *path;
+
+	path = gtk_tree_path_new ();
+
+	va_start (args, first_index);
+	arg = first_index;
+
+	while (arg != -1)
+	{
+		gtk_tree_path_append_index (path, arg);
+		arg = va_arg (args, gint);
+	}
+
+	va_end (args);
+
+	return path;
+}
+#endif
--- a/gtk/gtkutils.h	Fri Dec 22 08:41:29 2006 +0000
+++ b/gtk/gtkutils.h	Fri Dec 22 19:15:38 2006 +0000
@@ -533,5 +533,20 @@
 gboolean gaim_gtk_tree_view_search_equal_func(GtkTreeModel *model, gint column,
 			const gchar *key, GtkTreeIter *iter, gpointer data);
 
+#if !GTK_CHECK_VERSION(2,2,0)
+/**
+ * This is copied from Gtk to support Gtk 2.0
+ *
+ * Creates a new path with @first_index and @varargs as indices.
+ *
+ * @param first_index    first integer
+ * @param varargs        list of integers terminated by -1
+ *
+ * @return               A newly created GtkTreePath.
+ *
+ */
+GtkTreePath *gtk_tree_path_new_from_indices (gint first_index, ...);
+#endif
+
 #endif /* _GAIM_GTKUTILS_H_ */