diff options
author | George Lebl <jirka@5z.com> | 2003-12-13 01:15:05 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2003-12-13 01:15:05 +0000 |
commit | 677ba0e9a2d8243e4e1c5c3f41885988dd7866d0 (patch) | |
tree | 559c08174ee9edfb11bdbff6a09278c6b67d2896 /gui | |
parent | 27bf566efb567c6c50a83b46fb3ff0fb058c19fb (diff) | |
download | gdm-677ba0e9a2d8243e4e1c5c3f41885988dd7866d0.tar.gz |
There's now the ability to reap flexiservers that are inactive for a
Fri Dec 12 17:14:41 2003 George Lebl <jirka@5z.com>
* daemon/gdm.h, gui/gdmlogin.c, gui/greeter/greeter.c,
config/gdm.conf.in, docs/C/gdm.xml: There's now the ability to
reap flexiservers that are inactive for a period of time. The
default time is 5 minutes.
* gui/gdmcomm.c: add the new error codes (7 and 200) to the error
message table
Diffstat (limited to 'gui')
-rw-r--r-- | gui/gdmcomm.c | 6 | ||||
-rw-r--r-- | gui/gdmlogin.c | 60 | ||||
-rw-r--r-- | gui/greeter/greeter.c | 61 |
3 files changed, 127 insertions, 0 deletions
diff --git a/gui/gdmcomm.c b/gui/gdmcomm.c index 558460c4..49ef0e40 100644 --- a/gui/gdmcomm.c +++ b/gui/gdmcomm.c @@ -468,12 +468,18 @@ gdmcomm_get_error_message (const char *ret, gboolean use_xnest) return _("The X server is not available, " "it is likely that gdm is badly " "configured."); + } else if (strncmp (ret, "ERROR 7 ", strlen ("ERROR 7 ")) == 0) { + return _("Trying to set an unknown logout action, or trying " + "to set a logout action which is not available."); } else if (strncmp (ret, "ERROR 50 ", strlen ("ERROR 50 ")) == 0) { return _("Trying to update an unsupported configuration key."); } else if (strncmp (ret, "ERROR 100 ", strlen ("ERROR 100 ")) == 0) { return _("You do not seem to have authentication needed " "be for this operation. Perhaps your .Xauthority " "file is not set up correctly."); + } else if (strncmp (ret, "ERROR 200 ", strlen ("ERROR 200 ")) == 0) { + return _("Too many messages were sent to gdm and it hung up" + "on us."); } else { return _("Unknown error occured."); } diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c index e5ab4b68..196ae820 100644 --- a/gui/gdmlogin.c +++ b/gui/gdmlogin.c @@ -129,6 +129,7 @@ static gboolean GdmShowXtermFailsafeSession; static gboolean GdmShowLastSession; static gboolean GdmUseCirclesInEntry; +static gint GdmFlexiReapDelayMinutes; /* FIXME: Should move everything to externs and move reading to gdmcommon.c */ gchar *GdmInfoMsgFile; @@ -236,9 +237,34 @@ gdm_timer_up_delay (GSignalInvocationHint *ihint, if (curdelay < GdmTimedLoginDelay) curdelay = GdmTimedLoginDelay; return TRUE; +} + +/* The reaping stuff */ +static time_t last_reap_delay = 0; + +static gboolean +delay_reaping (GSignalInvocationHint *ihint, + guint n_param_values, + const GValue *param_values, + gpointer data) +{ + last_reap_delay = time (NULL); + return TRUE; } static gboolean +reap_flexiserver (gpointer data) +{ + if (GdmFlexiReapDelayMinutes > 0 && + ((time (NULL) - last_reap_delay) / 60) > GdmFlexiReapDelayMinutes) { + gdm_kill_thingies (); + _exit (DISPLAY_REMANAGE); + } + return TRUE; +} + + +static gboolean gdm_event (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, @@ -687,6 +713,7 @@ gdm_login_parse_config (void) GdmTimedLoginDelay = 5; } + GdmFlexiReapDelayMinutes = ve_config_get_int (config, GDM_KEY_FLEXI_REAP_DELAY_MINUTES); GdmUse24Clock = ve_config_get_bool (config, GDM_KEY_USE_24_CLOCK); if (GdmIconMaxWidth < 0) GdmIconMaxWidth = 128; @@ -3810,6 +3837,39 @@ main (int argc, char *argv[]) NULL /* destroy_notify */); } + /* if a flexiserver, reap self after some time */ + if (GdmFlexiReapDelayMinutes > 0 && + ! ve_string_empty (g_getenv ("GDM_FLEXI_SERVER")) && + /* but don't reap Xnest flexis */ + ve_string_empty (g_getenv ("GDM_PARENT_DISPLAY"))) { + guint sid = g_signal_lookup ("activate", + GTK_TYPE_MENU_ITEM); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + sid = g_signal_lookup ("key_press_event", + GTK_TYPE_WIDGET); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + sid = g_signal_lookup ("button_press_event", + GTK_TYPE_WIDGET); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + last_reap_delay = time (NULL); + g_timeout_add (60*1000, reap_flexiserver, NULL); + } + if G_LIKELY (g_getenv ("RUNNING_UNDER_GDM") != NULL) { guint sid = g_signal_lookup ("event", GTK_TYPE_WIDGET); diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c index 1ace5779..96222f52 100644 --- a/gui/greeter/greeter.c +++ b/gui/greeter/greeter.c @@ -72,6 +72,7 @@ gchar *GdmWelcome; gchar *GdmServAuthDir; gchar *GdmInfoMsgFile; gchar *GdmInfoMsgFont; +gint GdmFlexiReapDelayMinutes; gboolean GdmUseCirclesInEntry = FALSE; @@ -184,6 +185,8 @@ greeter_parse_config (void) } greeter_current_delay = GdmTimedLoginDelay; + GdmFlexiReapDelayMinutes = ve_config_get_int (config, GDM_KEY_FLEXI_REAP_DELAY_MINUTES); + GdmUse24Clock = ve_config_get_bool (config, GDM_KEY_USE_24_CLOCK); GdmIconMaxWidth = ve_config_get_int (config, GDM_KEY_ICONWIDTH); @@ -964,6 +967,30 @@ setup_background_color (void) } } +/* The reaping stuff */ +static time_t last_reap_delay = 0; + +static gboolean +delay_reaping (GSignalInvocationHint *ihint, + guint n_param_values, + const GValue *param_values, + gpointer data) +{ + last_reap_delay = time (NULL); + return TRUE; +} + +static gboolean +reap_flexiserver (gpointer data) +{ + if (GdmFlexiReapDelayMinutes > 0 && + ((time (NULL) - last_reap_delay) / 60) > GdmFlexiReapDelayMinutes) { + _exit (DISPLAY_REMANAGE); + } + return TRUE; +} + + void gdm_kill_thingies (void) { @@ -1344,6 +1371,40 @@ main (int argc, char *argv[]) gdm_wm_no_login_focus_pop (); } + /* if a flexiserver, reap self after some time */ + if (GdmFlexiReapDelayMinutes > 0 && + ! ve_string_empty (g_getenv ("GDM_FLEXI_SERVER")) && + /* but don't reap Xnest flexis */ + ve_string_empty (g_getenv ("GDM_PARENT_DISPLAY"))) + { + guint sid = g_signal_lookup ("activate", + GTK_TYPE_MENU_ITEM); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + sid = g_signal_lookup ("key_press_event", + GTK_TYPE_WIDGET); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + sid = g_signal_lookup ("button_press_event", + GTK_TYPE_WIDGET); + g_signal_add_emission_hook (sid, + 0 /* detail */, + delay_reaping, + NULL /* data */, + NULL /* destroy_notify */); + + last_reap_delay = time (NULL); + g_timeout_add (60*1000, reap_flexiserver, NULL); + } + gdm_wm_restore_wm_order (); gdm_common_show_info_msg (); |