summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2001-08-17 11:40:14 +0000
committerGeorge Lebl <jirka@src.gnome.org>2001-08-17 11:40:14 +0000
commite8abf2f1c109f9cd12262c913dbc8d30dc73f9a4 (patch)
tree643881706e691e9baf4e73e49aaddaa998247f4c /gui
parentef2598535b328c1fe3cfa318950b1cb4f87b791d (diff)
downloadgdm-e8abf2f1c109f9cd12262c913dbc8d30dc73f9a4.tar.gz
Finish implementation of flexible servers and lots of related cleanup and
Fri Aug 17 04:42:34 2001 George Lebl <jirka@5z.com> * daemon/auth.c, daemon/display.c, daemon/gdm-net.[ch], daemon/gdm.[ch], daemon/server.[ch], daemon/slave.[ch]: Finish implementation of flexible servers and lots of related cleanup and restructuring that was related. * daemon/server.c: close all fd's when running the X server. * gui/gdmflexiserver.c: implement the updated protocol and implement all the error codes * gui/Makefile.am, gui/gdmflexiserver(|-xnest).desktop.in, po/POTFILEs.in: Add launchers for new flexi server and new xnest flexiserver * gui/gdmlogin.c, daemon/slave.c: On flexi servers add the "Quit" menu thingie, since it's just as useful as in xdmcp case here. It should probably be a close button, not a Quit button. I dunno.
Diffstat (limited to 'gui')
-rw-r--r--gui/.cvsignore2
-rw-r--r--gui/Makefile.am5
-rw-r--r--gui/gdmflexiserver-xnest.desktop.in8
-rw-r--r--gui/gdmflexiserver.c119
-rw-r--r--gui/gdmflexiserver.desktop.in8
-rw-r--r--gui/gdmlogin.c5
6 files changed, 87 insertions, 60 deletions
diff --git a/gui/.cvsignore b/gui/.cvsignore
index 6e9a51b1..33329741 100644
--- a/gui/.cvsignore
+++ b/gui/.cvsignore
@@ -9,5 +9,7 @@ gdmchooser
gdmconfig
gdmconfig.desktop
gdmphotosetup.desktop
+gdmflexiserver.desktop
+gdmflexiserver-xnest.desktop
gdmflexiserver
gdmXnestchooser
diff --git a/gui/Makefile.am b/gui/Makefile.am
index af51c375..df0a7f42 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -125,7 +125,10 @@ Settings_in_files = gdmphotosetup.desktop.in
Settings_DATA = $(Settings_in_files:.desktop.in=.desktop)
Systemdir = $(datadir)/gnome/apps/System
-System_in_files = gdmconfig.desktop.in
+System_in_files = \
+ gdmconfig.desktop.in \
+ gdmflexiserver.desktop.in \
+ gdmflexiserver-xnest.desktop.in
System_DATA = $(System_in_files:.desktop.in=.desktop)
@XML_I18N_MERGE_DESKTOP_RULE@
diff --git a/gui/gdmflexiserver-xnest.desktop.in b/gui/gdmflexiserver-xnest.desktop.in
new file mode 100644
index 00000000..e0a08c9d
--- /dev/null
+++ b/gui/gdmflexiserver-xnest.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+_Name=New login in a nested window
+_Comment=Log in as another user inside a nested window
+TryExec=gdmflexiserver
+Exec=gdmflexiserver --xnest
+Icon=
+Terminal=0
+Type=Application
diff --git a/gui/gdmflexiserver.c b/gui/gdmflexiserver.c
index 57d9e7ce..9add952c 100644
--- a/gui/gdmflexiserver.c
+++ b/gui/gdmflexiserver.c
@@ -153,31 +153,22 @@ get_display (void)
}
static char *
-get_xauth_string (void)
+get_xauthfile (void)
{
- char *command;
- FILE *fp;
- char buf[1024];
- char *p;
-
- command = g_strdup_printf ("xauth nextract - %s", get_display ());
- fp = popen (command, "r");
- g_free (command);
-
- if (fp == NULL) {
- return NULL;
- }
- if (fgets (buf, sizeof (buf), fp) == NULL) {
- fclose (fp);
- return NULL;
+ static char *xauthfile = NULL;
+
+ if (xauthfile == NULL) {
+ xauthfile = g_strdup (g_getenv ("XAUTHORITY"));
+ if (ve_string_empty (xauthfile)) {
+ g_strdup (xauthfile);
+ xauthfile = g_concat_dir_and_file (g_get_home_dir (),
+ ".Xauthority");
+ /* FIXME: perhaps if it doesn't exist, run
+ * xauth generate on this */
+ }
}
- fclose (fp);
- p = strchr (buf, '\n');
- if (p != NULL)
- *p = '\0';
-
- return g_strdup (buf);
+ return xauthfile;
}
static gboolean use_xnest = FALSE;
@@ -192,12 +183,14 @@ struct poptOption options [] = {
int
main (int argc, char *argv[])
{
+ GtkWidget *dialog;
FILE *fp = NULL;
long pid;
char *pidfile;
char *command;
char *version;
char *ret;
+ char *message;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
@@ -221,37 +214,27 @@ main (int argc, char *argv[])
if (pid <= 1 ||
(kill (pid, 0) < 0 &&
errno != EPERM)) {
- GtkWidget *d;
- d = gnome_warning_dialog
+ dialog = gnome_warning_dialog
(_("GDM is not running.\n"
"Please ask your "
"system administrator to start it."));
- gnome_dialog_run_and_close (GNOME_DIALOG (d));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
return 0;
}
if (access (GDM_SUP_SOCKET, R_OK|W_OK)) {
- GtkWidget *d;
- d = gnome_warning_dialog
+ dialog = gnome_warning_dialog
(_("Cannot communicate with gdm, perhaps "
"you have an old version running."));
- gnome_dialog_run_and_close (GNOME_DIALOG (d));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
return 0;
}
if (use_xnest) {
- char *xauth_string = get_xauth_string ();
-
- if (xauth_string != NULL) {
- command = g_strdup_printf (GDM_SUP_FLEXI_XNEST
- " %s %s",
- get_display (),
- xauth_string);
- } else {
- command = g_strdup_printf (GDM_SUP_FLEXI_XNEST
- " %s",
- get_display ());
- }
+ command = g_strdup_printf (GDM_SUP_FLEXI_XNEST
+ " %s %s",
+ get_display (),
+ get_xauthfile ());
version = "2.2.3.2";
} else {
command = g_strdup (GDM_SUP_FLEXI_XSERVER);
@@ -259,27 +242,49 @@ main (int argc, char *argv[])
}
ret = call_gdm (command, version, 5);
- if (ret == NULL) {
- GtkWidget *d;
- d = gnome_warning_dialog
- (_("Cannot communicate with gdm, perhaps "
- "you have an old version running."));
- gnome_dialog_run_and_close (GNOME_DIALOG (d));
+ if (ret != NULL &&
+ strncmp (ret, "OK ", 3) == 0) {
+ /* all fine and dandy */
return 0;
+ }
+
+ /* These need a bit more refinement */
+ if (ret == NULL) {
+ message = _("Cannot communicate with gdm, perhaps "
+ "you have an old version running.");
} else if (strncmp (ret, "ERROR 0 ", strlen ("ERROR 0 ")) == 0) {
- GtkWidget *d;
- g_warning ("Command not implemented");
- d = gnome_warning_dialog
- (_("Cannot communicate with gdm, perhaps "
- "you have an old version running."));
- gnome_dialog_run_and_close (GNOME_DIALOG (d));
- } else if (strncmp (ret, "OK ", 3) != 0) {
- GtkWidget *d;
- d = gnome_warning_dialog (_("Unknown error occured."));
- gnome_dialog_run_and_close (GNOME_DIALOG (d));
+ message = _("Cannot communicate with gdm, perhaps "
+ "you have an old version running.");
+ } else if (strncmp (ret, "ERROR 1 ", strlen ("ERROR 1 ")) == 0) {
+ message = _("The allowed limit of flexible X servers reached.");
+ } else if (strncmp (ret, "ERROR 2 ", strlen ("ERROR 2 ")) == 0) {
+ message = _("There were errors trying to start the X server.");
+ } else if (strncmp (ret, "ERROR 3 ", strlen ("ERROR 3 ")) == 0) {
+ message = _("The X server failed. Perhaps it is not "
+ "configured well.");
+ } else if (strncmp (ret, "ERROR 4 ", strlen ("ERROR 4 ")) == 0) {
+ message = _("Too many X sessions running.");
+ } else if (strncmp (ret, "ERROR 5 ", strlen ("ERROR 5 ")) == 0) {
+ message = _("The nested X server (Xnest) cannot connect to "
+ "your current X server. You may be missing an "
+ "X authorization file.");
+ } else if (strncmp (ret, "ERROR 6 ", strlen ("ERROR 6 ")) == 0) {
+ if (use_xnest)
+ message = _("The nested X server (Xnest) is not "
+ "available, or gdm is badly configured.\n"
+ "Please install the Xnest package in "
+ "order to use the nested login.");
+ else
+ message = _("The X server is not available, "
+ "it is likely that gdm is badly "
+ "configured.");
+ } else {
+ message = _("Unknown error occured.");
}
- return 0;
+ dialog = gnome_warning_dialog (message);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ return 1;
}
/* Used for torture testing the socket */
diff --git a/gui/gdmflexiserver.desktop.in b/gui/gdmflexiserver.desktop.in
new file mode 100644
index 00000000..d18c2282
--- /dev/null
+++ b/gui/gdmflexiserver.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+_Name=New login
+_Comment=Log in as another user without loging out
+TryExec=gdmflexiserver
+Exec=gdmflexiserver
+Icon=
+Terminal=0
+Type=Application
diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c
index 0aea0d0b..a8a7e05b 100644
--- a/gui/gdmlogin.c
+++ b/gui/gdmlogin.c
@@ -2797,8 +2797,9 @@ gdm_login_gui_init (void)
}
}
- /* Add a quit item when in xdmcp mode */
- if (ve_string_empty (g_getenv ("GDM_IS_LOCAL"))) {
+ /* Add a quit item when in xdmcp mode or flexi mode */
+ if (ve_string_empty (g_getenv ("GDM_IS_LOCAL")) ||
+ ! ve_string_empty (g_getenv ("GDM_FLEXI_SERVER"))) {
item = gtk_menu_item_new_with_label (_("Quit"));
gtk_menu_bar_append (GTK_MENU_BAR (menubar), item);
gtk_widget_add_accelerator (item, "activate_item", accel,