changeset 27804:d44a96d49ee5

propagate from branch 'im.pidgin.pidgin' (head c8a7475750a83a32c26d2f40066500a948844beb) to branch 'im.pidgin.pidgin.yaz' (head 38fad68b8e6001671317c1785ae40a493a29a443)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 19 Mar 2008 19:23:41 +0000
parents 8dfe3a985fc1 (current diff) 6bd3a83e9d8c (diff)
children 80d3f4ff1cae
files configure.ac pidgin/gtkconv.c pidgin/gtkmain.c pidgin/gtkutils.c
diffstat 14 files changed, 83 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Mar 19 19:16:07 2008 +0000
+++ b/configure.ac	Wed Mar 19 19:23:41 2008 +0000
@@ -658,14 +658,21 @@
 dnl #######################################################################
 dnl # Check for GStreamer
 dnl #######################################################################
+dnl
+dnl TODO: Depend on gstreamer >= 0.10.10, and remove the conditional use of
+dnl       gst_registry_fork_set_enabled.
 AC_ARG_ENABLE(gstreamer,
 	[AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
 	enable_gst="$enableval", enable_gst="yes")
 if test "x$enable_gst" != "xno"; then
-	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10 >= 0.10.10], [
+	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
 		AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
 		AC_SUBST(GSTREAMER_CFLAGS)
 		AC_SUBST(GSTREAMER_LIBS)
+		AC_CHECK_LIB(gstreamer-0.10, gst_registry_fork_set_enabled,
+			[ AC_DEFINE(GST_CAN_DISABLE_FORKING, [],
+			  [Define if gst_registry_fork_set_enabled exists])],
+			[], [$GSTREAMER_LIBS])
 	], [
 		AC_MSG_RESULT(no)
 		enable_gst="no"
--- a/finch/libgnt/gntwm.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/finch/libgnt/gntwm.c	Wed Mar 19 19:23:41 2008 +0000
@@ -101,6 +101,7 @@
 static gboolean idle_update;
 static GList *act = NULL; /* list of WS with unseen activitiy */
 static gboolean ignore_keys = FALSE;
+static gboolean started_python = FALSE;
 
 static GList *
 g_list_bring_to_front(GList *list, gpointer data)
@@ -1342,7 +1343,10 @@
 		wm->workspaces = g_list_delete_link(wm->workspaces, wm->workspaces);
 	}
 #ifdef USE_PYTHON
-	Py_Finalize();
+	if (started_python) {
+		Py_Finalize();
+		started_python = FALSE;
+	}
 #endif
 }
 
@@ -1523,8 +1527,11 @@
 #ifdef USE_PYTHON
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python,
 				GNT_KEY_F3, NULL);
-	Py_SetProgramName("gnt");
-	Py_Initialize();
+	if (!Py_IsInitialized()) {
+		Py_SetProgramName("gnt");
+		Py_Initialize();
+		started_python = TRUE;
+	}
 #endif
 
 	gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
--- a/libpurple/internal.h	Wed Mar 19 19:16:07 2008 +0000
+++ b/libpurple/internal.h	Wed Mar 19 19:23:41 2008 +0000
@@ -182,6 +182,14 @@
 #	endif
 #endif
 
+#ifndef G_GSIZE_MODIFIER
+#	if GLIB_SIZEOF_LONG == 8
+#		define G_GSIZE_MODIFIER "l"
+#	else
+#		define G_GSIZE_MODIFIER ""
+#	endif
+#endif
+
 #ifndef G_GSIZE_FORMAT
 #	if GLIB_SIZEOF_LONG == 8
 #		define G_GSIZE_FORMAT "lu"
@@ -190,6 +198,14 @@
 #	endif
 #endif
 
+#ifndef G_GSSIZE_FORMAT
+#	if GLIB_SIZEOF_LONG == 8
+#		define G_GSSIZE_FORMAT "li"
+#	else
+#		define G_GSSIZE_FORMAT "i"
+#	endif
+#endif
+
 #ifndef G_GNUC_NULL_TERMINATED
 #	if     __GNUC__ >= 4
 #		define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
--- a/libpurple/protocols/jabber/Makefile.mingw	Wed Mar 19 19:16:07 2008 +0000
+++ b/libpurple/protocols/jabber/Makefile.mingw	Wed Mar 19 19:23:41 2008 +0000
@@ -83,7 +83,7 @@
 			-lpurple
 
 ifeq ($(CYRUS_SASL), 1)
-CYRUS_SASL_TOP := $(WIN32_DEV_TOP)/cyrus-sasl-2.1.22
+CYRUS_SASL_TOP := $(WIN32_DEV_TOP)/cyrus-sasl-2.1.22-daa1
 INCLUDE_PATHS += -I$(CYRUS_SASL_TOP)/include
 LIB_PATHS += -L$(CYRUS_SASL_TOP)/lib
 LIBS += -llibsasl
--- a/libpurple/protocols/simple/simple.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/libpurple/protocols/simple/simple.c	Wed Mar 19 19:23:41 2008 +0000
@@ -1209,7 +1209,7 @@
 			while (ssparts[i])
 			{
 				g_strchug(ssparts[i]);
-				if (g_str_has_prefix(ssparts[i], "terminated"))
+				if (purple_str_has_prefix(ssparts[i], "terminated"))
 				{
 					purple_debug_info("simple", "Subscription expired!");
 					g_free(b->dialog->ourtag);
--- a/libpurple/win32/libc_interface.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/libpurple/win32/libc_interface.c	Wed Mar 19 19:23:41 2008 +0000
@@ -320,12 +320,16 @@
 		switch(errornum) {
 			case WSAECONNABORTED: /* 10053 */
 				snprintf(errbuf, sizeof(errbuf), _("Connection interrupted by other software on your computer."));
+				break;
 			case WSAECONNRESET: /* 10054 */
 				snprintf(errbuf, sizeof(errbuf), _("Remote host closed connection."));
+				break;
 			case WSAETIMEDOUT: /* 10060 */
 				snprintf(errbuf, sizeof(errbuf), _("Connection timed out."));
+				break;
 			case WSAECONNREFUSED: /*10061 */
 				snprintf(errbuf, sizeof(errbuf), _("Connection refused."));
+				break;
 			default:
 				snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum);
 		}
@@ -452,6 +456,11 @@
 int wpurple_rename (const char *oldname, const char *newname) {
 	struct stat oldstat, newstat;
 
+	/* As of Glib 2.8.5, g_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING to behave more sanely */
+	if (glib_check_version(2, 8, 5) == NULL) {
+		return g_rename(oldname, newname);
+	}
+
 	if(g_stat(oldname, &oldstat) == 0) {
 		/* newname exists */
 		if(g_stat(newname, &newstat) == 0) {
--- a/pidgin/gtkconv.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtkconv.c	Wed Mar 19 19:23:41 2008 +0000
@@ -4440,9 +4440,9 @@
 	int wrapped_lines;
 	int lines;
 	GdkRectangle oneline;
-	GtkRequisition sr;
 	int height, diff;
 	int pad_top, pad_inside, pad_bottom;
+	int max_height = gtkconv->tab_cont->allocation.height / 2;
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
 
@@ -4454,9 +4454,8 @@
 
 	lines = gtk_text_buffer_get_line_count(buffer);
 
-	/* Show a maximum of 4 lines */
-	lines = MIN(lines, 4);
-	wrapped_lines = MIN(MAX(wrapped_lines, 2), 4);
+	/* Show at least two lines */
+	wrapped_lines = MAX(wrapped_lines, 2);
 
 	pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
 	pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4466,11 +4465,11 @@
 	if (wrapped_lines > lines)
 		height += (oneline.height + pad_inside) * (wrapped_lines - lines);
 
+	height = MIN(height, max_height);
+
 	diff = height - gtkconv->entry->allocation.height;
 	if (diff <= 0)
 		return FALSE;
-
-	gtk_widget_size_request(gtkconv->lower_hbox, &sr);
 	gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
 				    diff + gtkconv->lower_hbox->allocation.height);
 	return FALSE;
--- a/pidgin/gtkmain.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtkmain.c	Wed Mar 19 19:23:41 2008 +0000
@@ -99,6 +99,9 @@
 	SIGTERM,
 	SIGQUIT,
 	SIGCHLD,
+#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+	SIGALRM,
+#endif
 	-1
 };
 
@@ -184,15 +187,31 @@
 		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
 		purple_connections_disconnect_all();
 		break;
-#if 1
 	case SIGSEGV:
 		fprintf(stderr, "%s", segfault_message);
 		abort();
 		break;
-#endif
+#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+/* By default, gstreamer forks when you initialize it, and waitpids for the
+ * child.  But if libpurple reaps the child rather than leaving it to
+ * gstreamer, gstreamer's initialization fails.  So, we wait a second before
+ * reaping child processes, to give gst a chance to reap it if it wants to.
+ *
+ * This is not needed in later gstreamers, which let us disable the forking.
+ * And, it breaks the world on some Real Unices.
+ */
 	case SIGCHLD:
+		/* Restore signal catching */
+		signal(SIGCHLD, sighandler);
+		alarm(1);
+		break;
+	case SIGALRM:
+#else
+	case SIGCHLD:
+#endif
 		clean_pid();
-		signal(SIGCHLD, sighandler);    /* restore signal catching on this one! */
+		/* Restore signal catching */
+		signal(SIGCHLD, sighandler);
 		break;
 	default:
 		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
--- a/pidgin/gtkscrollbook.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtkscrollbook.c	Wed Mar 19 19:23:41 2008 +0000
@@ -268,7 +268,9 @@
 	/* Close */
 	eb = gtk_event_box_new();
 	gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION(2,4,0)
 	gtk_event_box_set_visible_window(GTK_EVENT_BOX(eb), FALSE);
+#endif
 	gtk_widget_set_events(eb, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
 	close_button = gtk_label_new("×");
 	g_signal_connect(G_OBJECT(eb), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_button);
--- a/pidgin/gtksession.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtksession.c	Wed Mar 19 19:23:41 2008 +0000
@@ -37,6 +37,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <gdk/gdk.h>
+#include <gtk/gtk.h>
 
 #define ERROR_LENGTH 512
 
@@ -162,8 +163,10 @@
 		ret[j++] = g_strdup(config_dir);
 	}
 
+#if GTK_CHECK_VERSION(2,2,0)
 	ret[j++] = g_strdup("--display");
 	ret[j++] = g_strdup((gchar *)gdk_display_get_name(gdk_display_get_default()));
+#endif
 
 	ret[j++] = NULL;
 
--- a/pidgin/gtksound.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtksound.c	Wed Mar 19 19:23:41 2008 +0000
@@ -302,7 +302,9 @@
 
 #ifdef USE_GSTREAMER
 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+#ifdef GST_CAN_DISABLE_FORKING
 	gst_registry_fork_set_enabled (FALSE);
+#endif
 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
 		purple_notify_error(NULL, _("GStreamer Failure"),
 					_("GStreamer failed to initialize."),
--- a/pidgin/gtkutils.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/gtkutils.c	Wed Mar 19 19:23:41 2008 +0000
@@ -3413,6 +3413,7 @@
 	return FALSE;
 #endif
 #else
+#if GTK_CHECK_VERSION(2,4,0)
 	/* This finds the currently active window and makes that the parent window. */
 	GList *windows = NULL;
 	GtkWidget *parent = NULL;
@@ -3455,6 +3456,7 @@
 		gtk_window_set_transient_for(GTK_WINDOW(widget), GTK_WINDOW(parent));
 		return TRUE;
 	}
+#endif
 	return FALSE;
 #endif
 }
--- a/pidgin/minidialog.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/minidialog.c	Wed Mar 19 19:23:41 2008 +0000
@@ -51,7 +51,7 @@
 pidgin_mini_dialog_get_type (void)
 {
 	static GType g_define_type_id = 0;
-	if (G_UNLIKELY (g_define_type_id == 0))
+	if (g_define_type_id == 0)
 	{
 		static const GTypeInfo g_define_type_info = {
 			sizeof (PidginMiniDialogClass),
--- a/pidgin/win32/winpidgin.c	Wed Mar 19 19:16:07 2008 +0000
+++ b/pidgin/win32/winpidgin.c	Wed Mar 19 19:23:41 2008 +0000
@@ -498,7 +498,7 @@
 		return;
 	}
 
-	if (!(msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL))) {
+	if (!(msg_win = FindWindowEx(NULL, NULL, TEXT("WinpidginMsgWinCls"), NULL))) {
 		printf("Unable to find an instance of Pidgin to handle protocol message.\n");
 		return;
 	}