summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2003-06-03 20:45:42 +0000
committerGeorge Lebl <jirka@src.gnome.org>2003-06-03 20:45:42 +0000
commit5d162dd3196916ebcce6d22b1fec9000a7c60ea1 (patch)
tree270fe3e41c9483d908ea62d072c6bd1e51daaac9
parent009a8f3facf516ff14cf5f792aa326e19f207fbb (diff)
downloadgdm-5d162dd3196916ebcce6d22b1fec9000a7c60ea1.tar.gz
whack gdmmktemp since it wasn't being used, move gdmaskpass and gdmopen to
Tue Jun 03 13:37:31 2003 George Lebl <jirka@5z.com> * gdm.spec.in, configure.in, utils/Makefile.am, daemon/server.c, daemon/misc.c, daemon/gdm.c, config/XkeepsCrashing: whack gdmmktemp since it wasn't being used, move gdmaskpass and gdmopen to libexec since that's where they really belong * daemon/gdm.h, config/gdm.conf.in, gui/gdmchooser.(c|glade): add an "Add" entry and button so that, we can add random hosts by typing their name. Add chooser/AllowAdd config key (default to true) that controls if this is available. Also fix up the updating of the icon list. it was incredibly evil and rebuilt the list each time a host packet came in, this compounded with the fact that we were pinging 3 times (at least the broadcast to which everyone answers). Also make this run fairly sanely outside of GDM, so that you can really just run it from anywhere if you really wish (mostly for debugging, though I imagine some other uses might pop up).
-rw-r--r--ChangeLog19
-rw-r--r--acconfig.h1
-rwxr-xr-xconfig/XKeepsCrashing9
-rw-r--r--config/gdm.conf.in7
-rw-r--r--configure.in5
-rw-r--r--daemon/gdm.c3
-rw-r--r--daemon/gdm.h1
-rw-r--r--daemon/misc.c12
-rw-r--r--daemon/server.c2
-rw-r--r--gdm.spec.in1
-rw-r--r--gui/gdmchooser-strings.c10
-rw-r--r--gui/gdmchooser.c236
-rw-r--r--gui/gdmchooser.glade90
-rw-r--r--utils/Makefile.am15
14 files changed, 324 insertions, 87 deletions
diff --git a/ChangeLog b/ChangeLog
index ee363d91..8cd11bf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Tue Jun 03 13:37:31 2003 George Lebl <jirka@5z.com>
+
+ * gdm.spec.in, configure.in, utils/Makefile.am, daemon/server.c,
+ daemon/misc.c, daemon/gdm.c, config/XkeepsCrashing:
+ whack gdmmktemp since it wasn't being used, move gdmaskpass and
+ gdmopen to libexec since that's where they really belong
+
+ * daemon/gdm.h, config/gdm.conf.in, gui/gdmchooser.(c|glade): add an
+ "Add" entry and button so that, we can add random hosts by typing
+ their name. Add chooser/AllowAdd config key (default to true)
+ that controls if this is available. Also fix up the updating of
+ the icon list. it was incredibly evil and rebuilt the list each
+ time a host packet came in, this compounded with the fact that
+ we were pinging 3 times (at least the broadcast to which everyone
+ answers). Also make this run fairly sanely outside of GDM,
+ so that you can really just run it from anywhere if you really
+ wish (mostly for debugging, though I imagine some other uses might
+ pop up).
+
Tue Jun 03 11:11:20 2003 George Lebl <jirka@5z.com>
* gui/greeter/greeter_item.[ch], gui/greeter/greeter_parser.c:
diff --git a/acconfig.h b/acconfig.h
index 2f5c81f7..f67eb310 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -22,6 +22,7 @@
#undef EXPANDED_PIXMAPDIR
#undef EXPANDED_BINDIR
#undef EXPANDED_SBINDIR
+#undef EXPANDED_LIBEXECDIR
#undef EXPANDED_GDMCONFIGDIR
#undef EXPANDED_LOCALEDIR
#undef EXPANDED_AUTHDIR
diff --git a/config/XKeepsCrashing b/config/XKeepsCrashing
index 8aafada9..6b3dcb0e 100755
--- a/config/XKeepsCrashing
+++ b/config/XKeepsCrashing
@@ -11,6 +11,7 @@ MSG8=`gettext -s "I cannot start the X server (your graphical interface). It is
# XLOG = the log file for the X server
# BINDIR = location of gdm binaries
# SBINDIR = location of gdm system binaries
+# LIBEXECDIR = location of gdm libexec binaries (gdmaskpass, gdmopen)
# return values are
# 0 = try again, runs this server again
@@ -49,8 +50,8 @@ if test "x$DIALOG" = "x" ; then
DIALOG=`which whiptail`
fi
fi
-if test -x "$SBINDIR/gdmaskpass" ; then
- ASKPASS="$SBINDIR/gdmaskpass"
+if test -x "$LIBEXECDIR/gdmaskpass" ; then
+ ASKPASS="$LIBEXECDIR/gdmaskpass"
else
ASKPASS=
fi
@@ -79,7 +80,7 @@ fi
# we require 'gdmopen', to open a console, because we really dont
# have one. Perhaps someone should try to figure out some shell
# black magic to get this to work on other then linux systems
-if test ! -x "$SBINDIR/gdmopen" ; then
+if test ! -x "$LIBEXECDIR/gdmopen" ; then
exit 32
fi
@@ -91,7 +92,7 @@ else
# We do a lot of work wastefully over again, but oh well,
# perhaps this needs fixing.
#
- "$SBINDIR/gdmopen" -l /bin/sh -c "$0 -noopen $@"
+ "$LIBEXECDIR/gdmopen" -l /bin/sh -c "$0 -noopen $@"
exit $?
fi
diff --git a/config/gdm.conf.in b/config/gdm.conf.in
index 3efd6a3a..c5652bed 100644
--- a/config/gdm.conf.in
+++ b/config/gdm.conf.in
@@ -272,14 +272,15 @@ GraphicalTheme=circles
GraphicalThemeDir=@EXPANDED_DATADIR@/gdm/themes/
# The chooser is what's displayed when a user wants an indirect XDMCP
-# session
+# session, or selects Run XDMCP chooser from the system menu
[chooser]
# Default image for hosts
DefaultHostImg=@EXPANDED_PIXMAPDIR@/nohost.png
# Directory with host images, they are named by the hosts: host or host.png
HostImageDir=@EXPANDED_DATADIR@/hosts/
# Time we scan for hosts (well only the time we tell the user we are
-# scanning actually)
+# scanning actually, we continue to listen even after this has
+# expired)
ScanTime=3
# A comma separated lists of hosts to automatically add (if they answer to
# a query of course). You can use this to reach hosts that broadcast cannot
@@ -287,6 +288,8 @@ ScanTime=3
Hosts=
# Broadcast a query to get all hosts on the current network that answer
Broadcast=true
+# Allow adding random hosts to the list by typing in their names
+AllowAdd=true
[debug]
# This will enable debugging into the syslog, usually not neccessary
diff --git a/configure.in b/configure.in
index 4f0cbab5..43337338 100644
--- a/configure.in
+++ b/configure.in
@@ -434,6 +434,11 @@ EXPANDED_SBINDIR=`eval echo $SBINDIR_TMP`
AC_SUBST(EXPANDED_SBINDIR)
AC_DEFINE_UNQUOTED(EXPANDED_SBINDIR,"$EXPANDED_SBINDIR")
+LIBEXECDIR_TMP="$libexecdir"
+EXPANDED_LIBEXECDIR=`eval echo $LIBEXECDIR_TMP`
+AC_SUBST(EXPANDED_LIBEXECDIR)
+AC_DEFINE_UNQUOTED(EXPANDED_LIBEXECDIR,"$EXPANDED_LIBEXECDIR")
+
dnl This is where the binary actually resides,
dnl not the console helper link
if test "x$enable_console_helper" = "xyes"; then
diff --git a/daemon/gdm.c b/daemon/gdm.c
index fcb8d36a..c6e03963 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -931,6 +931,7 @@ deal_with_x_crashes (GdmDisplay *d)
gnome_setenv ("XLOG", xlog, TRUE);
gnome_setenv ("BINDIR", EXPANDED_BINDIR, TRUE);
gnome_setenv ("SBINDIR", EXPANDED_SBINDIR, TRUE);
+ gnome_setenv ("LIBEXECDIR", EXPANDED_LIBEXECDIR, TRUE);
/* To enable gettext stuff in the script */
gnome_setenv ("TEXTDOMAIN", GETTEXT_PACKAGE, TRUE);
@@ -968,7 +969,7 @@ deal_with_x_crashes (GdmDisplay *d)
/* if we have "open" we can talk to the user, not as user
* friendly as the above script, but getting there */
if ( ! just_abort &&
- access (EXPANDED_SBINDIR "/gdmopen", X_OK) == 0) {
+ access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
/* Shit if we knew what the program was to tell the user,
* the above script would have been defined and we'd run
* it for them */
diff --git a/daemon/gdm.h b/daemon/gdm.h
index 03fa2cc9..2645e3f0 100644
--- a/daemon/gdm.h
+++ b/daemon/gdm.h
@@ -245,6 +245,7 @@ enum {
#define GDM_KEY_HOSTDIR "chooser/HostImageDir=" EXPANDED_DATADIR "/hosts/"
#define GDM_KEY_HOSTS "chooser/Hosts="
#define GDM_KEY_BROADCAST "chooser/Broadcast=true"
+#define GDM_KEY_ALLOWADD "chooser/AllowAdd=true"
#define GDM_KEY_DEBUG "debug/Enable=false"
diff --git a/daemon/misc.c b/daemon/misc.c
index 61fc5d63..5d09dc69 100644
--- a/daemon/misc.c
+++ b/daemon/misc.c
@@ -375,7 +375,7 @@ gdm_text_message_dialog (const char *msg)
char *dialog; /* do we have dialog?*/
char *msg_quoted;
- if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) != 0)
+ if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
return FALSE;
msg_quoted = g_shell_quote (msg);
@@ -388,7 +388,7 @@ gdm_text_message_dialog (const char *msg)
if (dialog != NULL) {
char *argv[6];
- argv[0] = EXPANDED_SBINDIR "/gdmopen";
+ argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
argv[2] = "/bin/sh";
argv[3] = "-c";
@@ -408,7 +408,7 @@ gdm_text_message_dialog (const char *msg)
} else {
char *argv[6];
- argv[0] = EXPANDED_SBINDIR "/gdmopen";
+ argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
argv[2] = "/bin/sh";
argv[3] = "-c";
@@ -436,7 +436,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
char *dialog; /* do we have dialog?*/
char *msg_quoted;
- if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) != 0)
+ if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
return FALSE;
if (ret != NULL)
@@ -453,7 +453,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
char *argv[6];
int retint;
- argv[0] = EXPANDED_SBINDIR "/gdmopen";
+ argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
argv[2] = "/bin/sh";
argv[3] = "-c";
@@ -493,7 +493,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
close (tempfd);
- argv[0] = EXPANDED_SBINDIR "/gdmopen";
+ argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
argv[2] = "/bin/sh";
argv[3] = "-c";
diff --git a/daemon/server.c b/daemon/server.c
index 9be11111..12eba886 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -251,7 +251,7 @@ static gboolean
busy_ask_user (GdmDisplay *disp)
{
/* if we have "open" we can talk to the user */
- if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) == 0) {
+ if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
char *error = g_strdup_printf
(_("There already appears to be an X server "
"running on display %s. Should I try another "
diff --git a/gdm.spec.in b/gdm.spec.in
index 27cc2c99..fcccddf1 100644
--- a/gdm.spec.in
+++ b/gdm.spec.in
@@ -106,6 +106,7 @@ exit 0
%doc AUTHORS COPYING ChangeLog NEWS README
%{_bindir}/*
%{_sbindir}/*
+%{_libexecdir}/*
%config %{sysconfdir}/pam.d/*
%config %{sysconfdir}/X11/*
%config %{sysconfdir}/security/console.apps/*
diff --git a/gui/gdmchooser-strings.c b/gui/gdmchooser-strings.c
index 55f9ee6e..d9c2a017 100644
--- a/gui/gdmchooser-strings.c
+++ b/gui/gdmchooser-strings.c
@@ -1,7 +1,7 @@
/*
- * Translatable strings file generated by Glade.
- * Add this file to your project's POTFILES.in.
- * DO NOT compile it as part of your application.
+ * Soubor s přeložitelnými řetězci generovaný programem Glade.
+ * Přidejte tento soubor do POTFILES.in svého projektu.
+ * NEPŘEKLÁDEJTE JEJ jako součást své aplikace.
*/
gchar *s = N_("GDM Host Chooser");
@@ -11,6 +11,10 @@ gchar *s = N_("C_onnect");
gchar *s = N_("Probe the network");
gchar *s = N_("Exit the application");
gchar *s = N_("Status");
+gchar *s = N_("Add host: ");
+gchar *s = N_("*");
+gchar *s = N_("Query and add this host to the above list");
+gchar *s = N_("Add");
gchar *s = N_("The main area of this application shows the hosts on the local network that have \"XDMCP\" enabled. This allows users to login remotely to other machines as if they were logged on using the console.\n"
"\n"
"You can rescan the network for new hosts by clicking \"Refresh\". When you have selected a host click \"Connect\" to open a session to that machine.");
diff --git a/gui/gdmchooser.c b/gui/gdmchooser.c
index 87c8a192..b1c202be 100644
--- a/gui/gdmchooser.c
+++ b/gui/gdmchooser.c
@@ -54,12 +54,6 @@
#include "misc.h"
#include "gdmwm.h"
-/* set the DOING_GDM_DEVELOPMENT env variable if you want to
- * search for the glade file in the current dir and not the system
- * install dir, better then something you have to change
- * in the source and recompile */
-static gboolean DOING_GDM_DEVELOPMENT = FALSE;
-
static gboolean RUNNING_UNDER_GDM = FALSE;
typedef struct _GdmChooserHost GdmChooserHost;
@@ -69,6 +63,7 @@ struct _GdmChooserHost {
struct in_addr ia;
GdkPixbuf *picture;
gboolean willing;
+ int pos;
};
@@ -81,11 +76,15 @@ static gchar *xdm_address = NULL;
static gchar *client_address = NULL;
static gint connection_type = 0;
+/* if this is received, select that host automatically */
+struct in_addr *select_addr = NULL;
+
static void gdm_chooser_abort (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
static void gdm_chooser_warn (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
/* Exported for glade */
-gboolean gdm_chooser_cancel (void);
+void gdm_chooser_cancel (void);
+void gdm_chooser_add_host (void);
void gdm_chooser_manage (GtkButton *button, gpointer data);
void gdm_chooser_browser_select (GtkWidget *widget,
gint selected,
@@ -134,6 +133,7 @@ static gchar *GdmHostDefaultIcon;
static gchar *GdmGtkRC;
static gchar *GdmHosts;
static gboolean GdmBroadcast;
+static gboolean GdmAllowAdd;
static gchar *GdmBackgroundColor;
static int GdmBackgroundType;
enum {
@@ -143,7 +143,7 @@ enum {
};
static GladeXML *chooser_app;
-static GtkWidget *chooser, *manage, *rescan, *cancel;
+static GtkWidget *chooser, *manage, *rescan, *cancel, *add_entry;
static GtkWidget *status_label;
static GIOChannel *channel;
@@ -201,6 +201,7 @@ gdm_chooser_host_alloc (const char *hostname,
GList *hostl;
host = g_new0 (GdmChooserHost, 1);
+ host->pos = -1;
host->name = g_strdup (hostname);
host->desc = g_strdup (description);
memcpy (&host->ia, ia, sizeof (struct in_addr));
@@ -263,46 +264,34 @@ gdm_chooser_host_alloc (const char *hostname,
}
static void
-gdm_chooser_browser_update (void)
+gdm_chooser_browser_add_host (GdmChooserHost *host)
{
- GList *li;
- gboolean any;
-
- gnome_icon_list_freeze (GNOME_ICON_LIST (browser));
- gnome_icon_list_clear (GNOME_ICON_LIST (browser));
-
- any = FALSE;
- for (li = hosts; li != NULL; li = li->next) {
- GdmChooserHost *host = (GdmChooserHost *) li->data;
-
- if (host->willing) {
- /* FIXME: the \n doesn't actually propagate
- * since the icon list is a broken piece of horsedung */
- char *temp = g_strconcat (host->name, " \n",
- host->desc, NULL);
+ if (host->willing) {
+ /* FIXME: the \n doesn't actually propagate
+ * since the icon list is a broken piece of horsedung */
+ char *temp = g_strconcat (host->name, " \n",
+ host->desc, NULL);
+ host->pos =
gnome_icon_list_append_pixbuf (GNOME_ICON_LIST (browser),
host->picture,
NULL /* icon_filename */,
temp);
- g_free (temp);
- any = TRUE;
+ g_free (temp);
+
+ if (select_addr != NULL &&
+ memcmp (&host->ia, select_addr,
+ sizeof (struct in_addr)) == 0) {
+ gnome_icon_list_select_icon (GNOME_ICON_LIST (browser),
+ host->pos);
+ gtk_widget_grab_focus (manage);
}
+ select_addr = NULL;
}
- gnome_icon_list_thaw (GNOME_ICON_LIST (browser));
-
- if (any) {
- gtk_label_set_text (GTK_LABEL (status_label), _(active_network));
- } else {
- gtk_label_set_text (GTK_LABEL (status_label), _(empty_network));
- }
- gtk_widget_set_sensitive (GTK_WIDGET (manage), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (rescan), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (browser), TRUE);
}
-
-static gboolean
+static GdmChooserHost *
gdm_host_known (struct in_addr *ia)
{
GList *li;
@@ -310,10 +299,10 @@ gdm_host_known (struct in_addr *ia)
for (li = hosts; li != NULL; li = li->next) {
GdmChooserHost *host = li->data;
if (memcmp (&host->ia, ia, sizeof (struct in_addr)) == 0) {
- return TRUE;
+ return host;
}
}
- return FALSE;
+ return NULL;
}
static gboolean
@@ -342,6 +331,7 @@ gdm_chooser_decode_packet (GIOChannel *source,
gchar *hostname = NULL;
gchar *status = NULL;
ARRAY8 auth, host, stat;
+ GdmChooserHost *gh;
if (! XdmcpFill (sockfd, &buf, (XdmcpNetaddr) &clnt_sa, &sa_len))
return TRUE;
@@ -390,14 +380,28 @@ gdm_chooser_decode_packet (GIOChannel *source,
}
}
- gdm_chooser_host_alloc (hostname,
- status,
- &clnt_sa.sin_addr,
- header.opcode == WILLING);
+ gh = gdm_host_known (&clnt_sa.sin_addr);
+ if (gh == NULL) {
+ gh = gdm_chooser_host_alloc (hostname,
+ status,
+ &clnt_sa.sin_addr,
+ header.opcode == WILLING);
- g_free (hostname);
- gdm_chooser_browser_update ();
+ gdm_chooser_browser_add_host (gh);
+ } else {
+ /* server changed it's mind */
+ if (header.opcode == WILLING &&
+ ! gh->willing) {
+ gh->willing = TRUE;
+ gdm_chooser_browser_add_host (gh);
+ }
+ /* hmmm what about the other change, just ignore
+ for now, it's kind of confusing to just remove
+ servers really */
+ }
+
+ g_free (hostname);
done:
if (header.opcode == WILLING) {
@@ -476,8 +480,19 @@ gdm_chooser_find_bcaddr (void)
static gboolean
chooser_scan_time_update (gpointer data)
{
+ GList *li;
scan_time_handler = 0;
- gdm_chooser_browser_update ();
+ for (li = hosts; li != NULL; li = li->next) {
+ GdmChooserHost *host = (GdmChooserHost *) li->data;
+ if (host->willing)
+ break;
+ }
+ if (li != NULL /* something was found */) {
+ gtk_label_set_text (GTK_LABEL (status_label), _(active_network));
+ } else {
+ gtk_label_set_text (GTK_LABEL (status_label), _(empty_network));
+ }
+ gtk_widget_set_sensitive (GTK_WIDGET (rescan), TRUE);
return FALSE;
}
@@ -528,6 +543,7 @@ gdm_chooser_xdmcp_discover (void)
GList *hl = hosts;
gtk_widget_set_sensitive (GTK_WIDGET (manage), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (rescan), FALSE);
gnome_icon_list_clear (GNOME_ICON_LIST (browser));
gtk_widget_set_sensitive (GTK_WIDGET (browser), FALSE);
gtk_label_set_text (GTK_LABEL (status_label),
@@ -716,8 +732,91 @@ gdm_chooser_choose_host (const char *hostname)
}
}
+void
+gdm_chooser_add_host (void)
+{
+ struct hostent *hostent;
+ struct sockaddr_in qa;
+ struct in_addr *ia;
+ GdmChooserHost *host;
+ struct sockaddr_in sock;
+ const char *name;
+
+ name = gtk_entry_get_text (GTK_ENTRY (add_entry));
+ if (ve_string_empty (name))
+ return;
+
+ if (strlen (name) == 8 &&
+ from_hex (name, (char *) &qa.sin_addr, strlen (name)) == 0)
+ qa.sin_family = AF_INET;
+ else if ((qa.sin_addr.s_addr = inet_addr (name)) != -1)
+ qa.sin_family = AF_INET;
+ else if ((hostent = gethostbyname (name)) != NULL
+ && hostent->h_addrtype == AF_INET
+ && hostent->h_length == 4) {
+ qa.sin_family = AF_INET;
+ memmove (&qa.sin_addr, hostent->h_addr, 4);
+ } else {
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new
+ (GTK_WINDOW (chooser) /* parent */,
+ GTK_DIALOG_MODAL /* flags */,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("I cannot find the host \"%s\", "
+ "perhaps you have mistyped it."),
+ name);
+
+ if (RUNNING_UNDER_GDM)
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ gdm_wm_no_login_focus_push ();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop ();
+ return; /* not a valid address */
+ }
+
+ sock.sin_family = AF_INET;
+ sock.sin_port = htons (XDM_UDP_PORT);
+
+ ia = g_new0 (struct in_addr, 1);
+ ia->s_addr = qa.sin_addr.s_addr;
+
+ host = gdm_host_known (ia);
+ if (host != NULL) {
+ if (host->pos >= 0) {
+ gnome_icon_list_select_icon (GNOME_ICON_LIST (browser),
+ host->pos);
+ gtk_widget_grab_focus (manage);
+ } else {
+ /* hmm, probably not willing, ping the host then for
+ good measure */
+ sock.sin_addr.s_addr = ia->s_addr;
+ XdmcpFlush (sockfd, &querybuf, (XdmcpNetaddr) &sock,
+ (int)sizeof (struct sockaddr_in));
+ }
+
+ /* empty the text entry to indicate success */
+ gtk_entry_set_text (GTK_ENTRY (add_entry), "");
+
+ g_free (ia);
+ return;
+ }
+
+ queryaddr = g_slist_append (queryaddr, ia);
+ select_addr = ia;
+
+ /* and send out the query */
+ sock.sin_addr.s_addr = ia->s_addr;
+ XdmcpFlush (sockfd, &querybuf, (XdmcpNetaddr) &sock, (int)sizeof (struct sockaddr_in));
-gboolean
+ /* empty the text entry to indicate success */
+ gtk_entry_set_text (GTK_ENTRY (add_entry), "");
+}
+
+void
gdm_chooser_cancel (void)
{
if (scan_time_handler > 0) {
@@ -729,8 +828,6 @@ gdm_chooser_cancel (void)
/* exit rather gtk_main_quit, it's just safer this way we don't
have to worry about random whackiness happening */
exit (EXIT_SUCCESS);
-
- return TRUE;
}
@@ -807,6 +904,8 @@ gdm_chooser_parse_config (void)
GdmBackgroundColor = gnome_config_get_string (GDM_KEY_BACKGROUNDCOLOR);
GdmBackgroundType = gnome_config_get_int (GDM_KEY_BACKGROUNDTYPE);
+ GdmAllowAdd = gnome_config_get_bool (GDM_KEY_ALLOWADD);
+
/* note that command line arguments will prevail over these */
GdmHosts = gnome_config_get_string (GDM_KEY_HOSTS);
GdmBroadcast = gnome_config_get_bool (GDM_KEY_BROADCAST);
@@ -886,7 +985,8 @@ display_chooser_information (void)
"\"Refresh\". When you have selected a host click "
"\"Connect\" to open a session to that machine."));
- gdm_wm_center_window (GTK_WINDOW (dialog));
+ if (RUNNING_UNDER_GDM)
+ gdm_wm_center_window (GTK_WINDOW (dialog));
gdm_wm_no_login_focus_push ();
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -934,6 +1034,8 @@ gdm_chooser_gui_init (void)
GTK_TYPE_BUTTON);
status_label = glade_helper_get (chooser_app, "status_label",
GTK_TYPE_LABEL);
+ add_entry = glade_helper_get (chooser_app, "add_entry",
+ GTK_TYPE_ENTRY);
browser = glade_helper_get (chooser_app, "chooser_iconlist",
GNOME_TYPE_ICON_LIST);
@@ -947,6 +1049,12 @@ gdm_chooser_gui_init (void)
(gint) gdk_screen_width() * 0.4,
(gint) gdk_screen_height() * 0.6);
+ if ( ! GdmAllowAdd) {
+ GtkWidget *w = glade_helper_get (chooser_app, "add_hbox",
+ GTK_TYPE_HBOX);
+ gtk_widget_hide (w);
+ }
+
gdm_wm_center_window (GTK_WINDOW (chooser));
}
@@ -1059,8 +1167,6 @@ main (int argc, char *argv[])
int nextopt;
const char *gdm_version;
- if (g_getenv ("DOING_GDM_DEVELOPMENT") != NULL)
- DOING_GDM_DEVELOPMENT = TRUE;
if (g_getenv ("RUNNING_UNDER_GDM") != NULL)
RUNNING_UNDER_GDM = TRUE;
@@ -1086,17 +1192,20 @@ main (int argc, char *argv[])
}
/* Should be a watch already, but just in case */
- setup_cursor (GDK_WATCH);
+ if (RUNNING_UNDER_GDM)
+ setup_cursor (GDK_WATCH);
glade_init();
gdm_chooser_parse_config();
- gdm_wm_screen_init (GdmXineramaScreen);
+ if (RUNNING_UNDER_GDM)
+ gdm_wm_screen_init (GdmXineramaScreen);
gdm_version = g_getenv ("GDM_VERSION");
- if (gdm_version != NULL &&
+ if (RUNNING_UNDER_GDM &&
+ gdm_version != NULL &&
strcmp (gdm_version, VERSION) != 0) {
GtkWidget *dialog;
@@ -1127,7 +1236,8 @@ main (int argc, char *argv[])
gdm_chooser_gui_init();
gdm_chooser_signals_init();
- set_background ();
+ if (RUNNING_UNDER_GDM)
+ set_background ();
hosts = (char **)poptGetArgs (ctx);
/* when no hosts on the command line, take them from the config */
@@ -1155,10 +1265,12 @@ main (int argc, char *argv[])
gtk_widget_queue_resize (chooser);
gtk_widget_show_now (chooser);
- gdm_wm_center_window (GTK_WINDOW (chooser));
+ if (RUNNING_UNDER_GDM)
+ gdm_wm_center_window (GTK_WINDOW (chooser));
- /* can it ever happen that it'd be NULL here ??? */
- if (chooser->window != NULL) {
+ if (RUNNING_UNDER_GDM &&
+ /* can it ever happen that it'd be NULL here ??? */
+ chooser->window != NULL) {
gdm_wm_init (GDK_WINDOW_XWINDOW (chooser->window));
/* Run the focus, note that this will work no matter what
@@ -1167,7 +1279,11 @@ main (int argc, char *argv[])
gdm_wm_focus_window (GDK_WINDOW_XWINDOW (chooser->window));
}
- setup_cursor (GDK_LEFT_PTR);
+ if (RUNNING_UNDER_GDM)
+ setup_cursor (GDK_LEFT_PTR);
+
+ if (GdmAllowAdd)
+ gtk_widget_grab_focus (add_entry);
gtk_main();
diff --git a/gui/gdmchooser.glade b/gui/gdmchooser.glade
index e00dbd60..a99e0521 100644
--- a/gui/gdmchooser.glade
+++ b/gui/gdmchooser.glade
@@ -23,10 +23,8 @@
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="border_width">5</property>
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">10</property>
<child>
<widget class="GtkButton" id="help_button">
@@ -159,6 +157,9 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
+ <accessibility>
+ <atkrelation target="chooser_iconlist" type="label-for"/>
+ </accessibility>
</widget>
<packing>
<property name="padding">0</property>
@@ -187,6 +188,9 @@
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
+ <accessibility>
+ <atkrelation target="status_label" type="labelled-by"/>
+ </accessibility>
<signal name="select_icon" handler="gdm_chooser_browser_select" last_modification_time="Tue, 09 Jul 2002 02:43:48 GMT"/>
<signal name="unselect_icon" handler="gdm_chooser_browser_unselect" last_modification_time="Tue, 09 Jul 2002 02:44:00 GMT"/>
</widget>
@@ -198,6 +202,87 @@
<property name="fill">True</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkHBox" id="add_hbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="add_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Add host: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <accessibility>
+ <atkrelation target="add_button" type="label-for"/>
+ <atkrelation target="add_entry" type="label-for"/>
+ </accessibility>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="add_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ <accessibility>
+ <atkrelation target="add_label" type="labelled-by"/>
+ </accessibility>
+ <signal name="activate" handler="gdm_chooser_add_host" last_modification_time="Tue, 03 Jun 2003 19:25:52 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="add_button">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Query and add this host to the above list</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Add</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <accessibility>
+ <atkrelation target="add_label" type="labelled-by"/>
+ </accessibility>
+ <signal name="clicked" handler="gdm_chooser_add_host" last_modification_time="Tue, 03 Jun 2003 19:26:04 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -226,7 +311,6 @@ You can rescan the network for new hosts by clicking &quot;Refresh&quot;. When y
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button6">
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 3a5b002a..eeb7c951 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -11,12 +11,13 @@ INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
$(UTILS_CFLAGS)
-sbin_PROGRAMS = \
+libexec_PROGRAMS = \
@GDMASKPASS@ \
@GDMOPEN@
-bin_PROGRAMS = \
- gdmmktemp
+# This is not useful anymore
+# bin_PROGRAMS = \
+# gdmmktemp
EXTRA_PROGRAMS = gdmaskpass gdmopen
@@ -26,8 +27,8 @@ gdmaskpass_SOURCES = \
gdmopen_SOURCES = \
gdmopen.c
-gdmmktemp_SOURCES = \
- gdmmktemp.c
+#gdmmktemp_SOURCES = \
+# gdmmktemp.c
gdmaskpass_LDADD = \
$(INTLLIBS) \
@@ -37,5 +38,5 @@ gdmaskpass_LDADD = \
gdmopen_LDADD = \
$(INTLLIBS)
-gdmmktemp_LDADD = \
- $(INTLLIBS)
+#gdmmktemp_LDADD = \
+# $(INTLLIBS)