--- gdm2/ChangeLog.org	2007-01-20 12:34:49.000000000 +0000
+++ gdm2/ChangeLog	2007-01-21 19:38:20.000000000 +0000
@@ -0,0 +1,14 @@
+2007-01-21  Lukasz Zalewski  <lukas@dcs.qmul.ac.uk>
+
+	Fix for bug #352263
+	* gui/gdmsetup.c: Created more verbose warnings when defaults.conf or
+	  custom.conf are missing before terminating. Also all the error messages
+	  are displayed using dialogs rather than stdout. This is especially 
+	  useful when gdmsetup is run from within login mamaner as it doesn't
+	  leave users wondering why it didnt start-up. Also check if gdm daemon
+	  is running is made before check for config files. In such setup appropriate
+	  message is displayed rather than config file not found.
+	* daemon/gdmconfig.c: Daemon will not start if main configuration file (defaults.conf)
+	  is missing
+	* daemon/slave.c: gdmsetup will not be launched if coustom.conf config file is missing
+	
--- gdm2/daemon/slave.c.org	2007-01-21 19:25:09.000000000 +0000
+++ gdm2/daemon/slave.c	2007-01-21 19:31:25.000000000 +0000
@@ -1711,6 +1711,20 @@
 {
 	pid_t pid;
 
+	/* Lets check if custom.conf exists. If not there 
+	   is no point in launching gdmsetup as it will fail.
+	   We don't need to worry about defaults.conf as
+	   the daemon wont start without it
+	*/
+	if (gdm_get_custom_config_file() == NULL) {
+		gdm_error_box (d,
+			       GTK_MESSAGE_ERROR,
+			       _("Could not access configuration file (custom.conf). "
+				 "Make sure that the file exists before launching "
+				 " login manager config utility."));
+		return;
+	}
+	    
 	/* Set the busy cursor */
 	if (d->dsp != NULL) {
 		Cursor xcursor = XCreateFontCursor (d->dsp, GDK_WATCH);
--- gdm2/daemon/gdmconfig.c.org	2007-01-20 15:10:42.000000000 +0000
+++ gdm2/daemon/gdmconfig.c	2007-01-20 15:15:07.000000000 +0000
@@ -2013,10 +2013,15 @@
 
    /*
     * It is okay if the custom_cfg file is missing, then just use
-    * main configuration file.  If cfg is missing, then GDM will 
-    * use the built-in defaults found in gdm.h.
+    * main configuration file. However if main config file does 
+    * not exist we cannot continue and need to bail out.
     */
+
    cfg                      = gdm_get_default_config (&statbuf);
+
+   if (cfg == NULL)
+	   gdm_fail (_("%s: Main config file (defaults.conf) is missing. Aborting!"), "gdm_config_parse");
+
    config_file_mtime        = statbuf.st_mtime;
    custom_cfg               = gdm_get_custom_config (&statbuf);
    custom_config_file_mtime = statbuf.st_mtime;
--- gdm2/gui/gdmsetup.c.org	2007-01-20 12:21:52.000000000 +0000
+++ gdm2/gui/gdmsetup.c	2007-01-21 17:44:31.000000000 +0000
@@ -8370,28 +8370,50 @@
 
 	gtk_init (&argc, &argv);
 
+	/* Lets check if gdm daemon is running
+	   if no there is no point in continuing
+	*/
+	gdm_running = gdmcomm_check (TRUE);
+	if (gdm_running == FALSE)
+		exit (EXIT_FAILURE);
+
 	gtk_window_set_default_icon_from_file (DATADIR"/pixmaps/gdm-setup.png", NULL);	
 	glade_gnome_init();
-
+	
 	/* Start using socket */
 	gdmcomm_comm_bulk_start ();
-
+	
 	config_file = gdm_common_get_config_file ();
 	if (config_file == NULL) {
 		/* Done using socket */
 		gdmcomm_comm_bulk_stop ();
-		g_print (_("Could not access GDM configuration file.\n"));
+		GtkWidget *dialog = ve_hig_dialog_new (NULL /* parent */,
+						       GTK_DIALOG_MODAL /* flags */,
+						       GTK_MESSAGE_ERROR,
+						       GTK_BUTTONS_OK,
+						       _("Could not access configuration file (defaults.conf)"
+							 ""),
+						       _("Make sure that the file exists before launching login manager config utility."));
+		
+		gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
 		exit (EXIT_FAILURE);
 	}
 	custom_config_file = gdm_common_get_custom_config_file ();
 	if (custom_config_file == NULL) {
 		/* Done using socket */
 		gdmcomm_comm_bulk_stop ();
-		g_print (_("Could not access GDM configuration file.\n"));
+		GtkWidget *dialog = ve_hig_dialog_new (NULL /* parent */,
+						       GTK_DIALOG_MODAL /* flags */,
+						       GTK_MESSAGE_ERROR,
+						       GTK_BUTTONS_OK,
+						       _("Could not access configuration file (custom.conf)"
+							 ""),
+						       _("Make sure that the file exists before launching login manager config utility."));
+		gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
 		exit (EXIT_FAILURE);
-	}
-
-	gdm_running = gdmcomm_check (FALSE);
+	}	
 
 	if (RUNNING_UNDER_GDM) {
 		char *gtkrc;
