gnome-user-share r230 - in trunk: . src



Author: hadess
Date: Tue Mar 25 17:37:53 2008
New Revision: 230
URL: http://svn.gnome.org/viewvc/gnome-user-share?rev=230&view=rev

Log:
2008-03-25  Bastien Nocera  <hadess hadess net>

	* configure.in:
	* src/user_share.c (main): Use the GTK+ main loop, not our own,
	re-use the X Display opened by GTK+ for ourselves, rather than opening
	a different one, fixes httpd children not getting killed properly
	when exiting the session (Closes: #519804)



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/user_share.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Mar 25 17:37:53 2008
@@ -77,7 +77,7 @@
   AC_MSG_ERROR([Neither avahi nor howl detected. Gnome-user-share needs a mDNS implementation.])
 fi
 
-PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gtk+-2.0 gconf-2.0 dbus-glib-1 $DBUS_MODULES)
+PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gdk-x11-2.0 gtk+-2.0 gconf-2.0 dbus-glib-1 $DBUS_MODULES)
 AC_SUBST(USER_SHARE_CFLAGS)
 AC_SUBST(USER_SHARE_LIBS)
 

Modified: trunk/src/user_share.c
==============================================================================
--- trunk/src/user_share.c	(original)
+++ trunk/src/user_share.c	Tue Mar 25 17:37:53 2008
@@ -23,6 +23,7 @@
 
 #include "config.h"
 
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <X11/Xlib.h>
@@ -42,7 +43,6 @@
 #include <signal.h>
 #include <unistd.h>
 
-static GMainLoop *loop = NULL;
 static guint disabled_timeout_tag = 0;
 
 char *
@@ -234,21 +234,6 @@
 	_exit (2);
 }
 
-static gboolean
-x_input (GIOChannel  *io_channel,
-	 GIOCondition cond,
-	 gpointer     callback_data)
-{
-	Display *xdisplay;
-	XEvent ignored;
-
-	xdisplay = callback_data;
-	while (XPending (xdisplay)) {
-		XNextEvent (xdisplay, &ignored);
-	}
-	return TRUE;
-}
-
 int
 main (int argc, char **argv)
 {
@@ -259,15 +244,14 @@
 	Window selection_owner;
 	Atom xatom;
 
-	g_type_init ();
-	loop = g_main_loop_new (NULL, FALSE);
+	gtk_init (&argc, &argv);
 
 	signal (SIGPIPE, SIG_IGN);
 	signal (SIGINT, cleanup_handler);
 	signal (SIGHUP, cleanup_handler);
 	signal (SIGTERM, cleanup_handler);
 
-	xdisplay = XOpenDisplay (NULL);
+	xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 	if (xdisplay == NULL) {
 		fprintf (stderr, "Can't open display\n");
 		return 1;
@@ -301,14 +285,6 @@
 	x_fd = ConnectionNumber (xdisplay);
 	XSetIOErrorHandler (x_io_error_handler);
 
-	channel = g_io_channel_unix_new (x_fd);
-	g_io_add_watch (channel,
-			G_IO_IN,
-			x_input, xdisplay);
-	g_io_channel_unref (channel);
-
-	gtk_init (&argc, &argv);
-
 	if (http_init () == FALSE)
 		return 1;
 	if (obexftp_init () == FALSE)
@@ -379,7 +355,7 @@
 	file_sharing_bluetooth_obexpush_notify_changed (client, 0, NULL, NULL);
 	file_sharing_bluetooth_obexpush_enabled_changed (client, 0, NULL, NULL);
 
-	g_main_loop_run (loop);
+	gtk_main ();
 
 	return 0;
 }



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