Commit c4365084 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

a bit of a hack, but create an interruption type for greeter restart. It's

Fri Apr 26 14:29:07 2002  George Lebl <jirka@5z.com>

	* daemon/gdm.h, daemon/slave.c: a bit of a hack, but create an
	  interruption type for greeter restart.  It's easier to do this
	  way then with just an exit since we avoid reentrancy issues and
	  all kinds of other fun stuff.  That is we trap the interruption
	  at defined points

	* gui/gdmlogin.c: minor fixes, and recheck config and if some stuff
	  changed (not the full set we care about, maybe we should do that)
	  just restart.

	* gui/greeter/greeter.c, gui/greeter/greeter_configuration.h,
	  gui/greeter/greeter_item.[ch], gui/greeter/greeter_parser.c,
	  gui/greeter/greeter_system.c:  Implement a config button handeling.
	  the timed, system and config showing is handled by show
	  types/subtypes so this is handled cleanly.  Request restart on HUP.
	  To allow a name change

	* gui/greeter/themes/circles/GdmGreeterTheme.info:  An idea (not used
	  currently) for the greeter theme information.  This is so that we
	  can do a theme browser and also handle theme installation and all
	  that fun sort of stuff.

	* gui/greeter/themes/circles/circles.xml: add a system show type
	  to the system button
parent e34a1789
Fri Apr 26 14:29:07 2002 George Lebl <jirka@5z.com>
* daemon/gdm.h, daemon/slave.c: a bit of a hack, but create an
interruption type for greeter restart. It's easier to do this
way then with just an exit since we avoid reentrancy issues and
all kinds of other fun stuff. That is we trap the interruption
at defined points
* gui/gdmlogin.c: minor fixes, and recheck config and if some stuff
changed (not the full set we care about, maybe we should do that)
just restart.
* gui/greeter/greeter.c, gui/greeter/greeter_configuration.h,
gui/greeter/greeter_item.[ch], gui/greeter/greeter_parser.c,
gui/greeter/greeter_system.c: Implement a config button handeling.
the timed, system and config showing is handled by show
types/subtypes so this is handled cleanly. Request restart on HUP.
To allow a name change
* gui/greeter/themes/circles/GdmGreeterTheme.info: An idea (not used
currently) for the greeter theme information. This is so that we
can do a theme browser and also handle theme installation and all
that fun sort of stuff.
* gui/greeter/themes/circles/circles.xml: add a system show type
to the system button
Fri Apr 26 10:18:07 2002 George Lebl <jirka@5z.com> Fri Apr 26 10:18:07 2002 George Lebl <jirka@5z.com>
* gui/gdmsetup.(c|glade): implement the greeter selection option menu * gui/gdmsetup.(c|glade): implement the greeter selection option menu
......
...@@ -108,6 +108,7 @@ enum { ...@@ -108,6 +108,7 @@ enum {
/* Different login interruptions */ /* Different login interruptions */
#define GDM_INTERRUPT_TIMED_LOGIN 'T' #define GDM_INTERRUPT_TIMED_LOGIN 'T'
#define GDM_INTERRUPT_CONFIGURE 'C' #define GDM_INTERRUPT_CONFIGURE 'C'
#define GDM_INTERRUPT_RESTART_GREETER 'R'
/* The dreaded miscellaneous category */ /* The dreaded miscellaneous category */
#define FIELD_SIZE 256 #define FIELD_SIZE 256
......
...@@ -69,6 +69,8 @@ static gboolean do_timed_login = FALSE; /* if this is true, ...@@ -69,6 +69,8 @@ static gboolean do_timed_login = FALSE; /* if this is true,
login the timed login */ login the timed login */
static gboolean do_configurator = FALSE; /* if this is true, login as root static gboolean do_configurator = FALSE; /* if this is true, login as root
* and start the configurator */ * and start the configurator */
static gboolean do_restart_greeter = FALSE; /* if this is true, whack the
greeter and try again */
static gchar *ParsedAutomaticLogin = NULL; static gchar *ParsedAutomaticLogin = NULL;
static gchar *ParsedTimedLogin = NULL; static gchar *ParsedTimedLogin = NULL;
...@@ -336,6 +338,30 @@ gdm_screen_init (GdmDisplay *display) ...@@ -336,6 +338,30 @@ gdm_screen_init (GdmDisplay *display)
} }
} }
static void
gdm_slave_whack_greeter (void)
{
gdm_sigchld_block_push ();
greet = FALSE;
/* do what you do when you quit, this will hang until the
* greeter decides to print an STX\n and die, meaning it can do some
* last minute cleanup */
gdm_slave_greeter_ctl_no_ret (GDM_QUIT, "");
/* Wait for the greeter to really die, the check is just
* being very anal, the pid is always set to something */
if (d->greetpid > 0)
waitpid (d->greetpid, 0, 0);
d->greetpid = 0;
gdm_slave_send_num (GDM_SOP_GREETPID, 0);
gdm_sigchld_block_pop ();
}
static gboolean do_xfailed_on_xio_error = FALSE; static gboolean do_xfailed_on_xio_error = FALSE;
static void static void
...@@ -500,6 +526,14 @@ gdm_slave_run (GdmDisplay *display) ...@@ -500,6 +526,14 @@ gdm_slave_run (GdmDisplay *display)
do { do {
gdm_slave_wait_for_login (); /* wait for a password */ gdm_slave_wait_for_login (); /* wait for a password */
if (do_restart_greeter) {
do_restart_greeter = FALSE;
if (greet)
gdm_slave_whack_greeter ();
gdm_slave_greeter (); /* Start the greeter */
continue;
}
d->logged_in = TRUE; d->logged_in = TRUE;
gdm_slave_send_num (GDM_SOP_LOGGED_IN, TRUE); gdm_slave_send_num (GDM_SOP_LOGGED_IN, TRUE);
...@@ -531,29 +565,6 @@ gdm_slave_run (GdmDisplay *display) ...@@ -531,29 +565,6 @@ gdm_slave_run (GdmDisplay *display)
} }
} }
static void
gdm_slave_whack_greeter (void)
{
gdm_sigchld_block_push ();
greet = FALSE;
/* do what you do when you quit, this will hang until the
* greeter decides to print an STX\n and die, meaning it can do some
* last minute cleanup */
gdm_slave_greeter_ctl_no_ret (GDM_QUIT, "");
/* Wait for the greeter to really die, the check is just
* being very anal, the pid is always set to something */
if (d->greetpid > 0)
waitpid (d->greetpid, 0, 0);
d->greetpid = 0;
gdm_slave_send_num (GDM_SOP_GREETPID, 0);
gdm_sigchld_block_pop ();
}
/* A hack really, this will wait around until the first mapped window /* A hack really, this will wait around until the first mapped window
* with this class and focus it */ * with this class and focus it */
static void static void
...@@ -2868,6 +2879,9 @@ gdm_slave_greeter_check_interruption (const char *msg) ...@@ -2868,6 +2879,9 @@ gdm_slave_greeter_check_interruption (const char *msg)
do_configurator = TRUE; do_configurator = TRUE;
} }
break; break;
case GDM_INTERRUPT_RESTART_GREETER:
do_restart_greeter = TRUE;
break;
default: default:
break; break;
} }
......
...@@ -756,7 +756,7 @@ gdm_run_gdmconfig (GtkWidget *w, gpointer data) ...@@ -756,7 +756,7 @@ gdm_run_gdmconfig (GtkWidget *w, gpointer data)
/* configure interruption */ /* configure interruption */
login_entry = FALSE; /* no matter where we are, login_entry = FALSE; /* no matter where we are,
this is no longer a login_entry */ this is no longer a login_entry */
/* timed interruption */ /* configure interruption */
g_print ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CONFIGURE); g_print ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CONFIGURE);
} }
...@@ -3644,14 +3644,73 @@ enum { ...@@ -3644,14 +3644,73 @@ enum {
RESPONSE_CLOSE RESPONSE_CLOSE
}; };
static gboolean
string_same (const char *cur, const char *key)
{
char *val = gnome_config_get_string (key);
if (strcmp (ve_sure_string (cur), ve_sure_string (val)) == 0) {
g_free (val);
return TRUE;
} else {
g_free (val);
return FALSE;
}
}
static gboolean
bool_same (gboolean cur, const char *key)
{
gboolean val = gnome_config_get_bool (key);
if (ve_bool_equal (cur, val)) {
return TRUE;
} else {
return FALSE;
}
}
static gboolean
int_same (int cur, const char *key)
{
int val = gnome_config_get_int (key);
if (cur == val) {
return TRUE;
} else {
return FALSE;
}
}
static void static void
gdm_reread_config (int sig) gdm_reread_config (int sig)
{ {
char *str; char *str;
/* FIXME: reparse config stuff here. At least ones we care about */ /* reparse config stuff here. At least ones we care about */
gnome_config_push_prefix ("=" GDM_CONFIG_FILE "=/"); gnome_config_push_prefix ("=" GDM_CONFIG_FILE "=/");
/* FIXME: The following is evil, we should update on the fly rather
* then just restarting */
/* Also we may not need to check ALL those keys but just a few */
if ( ! string_same (GdmBackgroundProg, GDM_KEY_BACKGROUNDPROG) ||
! string_same (GdmBackgroundImage, GDM_KEY_BACKGROUNDIMAGE) ||
! string_same (GdmBackgroundColor, GDM_KEY_BACKGROUNDCOLOR) ||
! int_same (GdmBackgroundType, GDM_KEY_BACKGROUNDTYPE) ||
! bool_same (GdmBackgroundScaleToFit,
GDM_KEY_BACKGROUNDSCALETOFIT) ||
! bool_same (GdmBackgroundRemoteOnlyColor,
GDM_KEY_BACKGROUNDREMOTEONLYCOLOR) ||
! string_same (GdmGtkRC, GDM_KEY_GTKRC) ||
! int_same (GdmXineramaScreen, GDM_KEY_XINERAMASCREEN) ||
! string_same (GdmLogo, GDM_KEY_LOGO) ||
! bool_same (GdmSystemMenu, GDM_KEY_SYSMENU) ||
! bool_same (GdmBrowser, GDM_KEY_BROWSER) ||
! bool_same (GdmConfigAvailable, GDM_KEY_CONFIG_AVAILABLE) ||
! bool_same (GdmTimedLoginEnable, GDM_KEY_TIMED_LOGIN_ENABLE)) {
/* restart interruption */
g_print ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_RESTART_GREETER);
gnome_config_pop_prefix ();
return;
}
GdmUse24Clock = gnome_config_get_bool (GDM_KEY_USE_24_CLOCK); GdmUse24Clock = gnome_config_get_bool (GDM_KEY_USE_24_CLOCK);
update_clock (NULL); update_clock (NULL);
...@@ -3681,8 +3740,6 @@ gdm_reread_config (int sig) ...@@ -3681,8 +3740,6 @@ gdm_reread_config (int sig)
g_free (str); g_free (str);
} }
/* FIXME: background, position, xinerama screen, config available,
* system menu, chooser/failsafe/last sessions */
gnome_config_pop_prefix(); gnome_config_pop_prefix();
} }
......
...@@ -38,7 +38,11 @@ gboolean GdmShowXtermFailsafeSession = FALSE; ...@@ -38,7 +38,11 @@ gboolean GdmShowXtermFailsafeSession = FALSE;
gboolean GdmShowLastSession = FALSE; gboolean GdmShowLastSession = FALSE;
gchar *GdmSessionDir = NULL; gchar *GdmSessionDir = NULL;
gchar *GdmLocaleFile = NULL; gchar *GdmLocaleFile = NULL;
gchar *GdmHalt = NULL;
gchar *GdmReboot = NULL;
gchar *GdmSuspend = NULL;
gboolean GdmSystemMenu = TRUE; gboolean GdmSystemMenu = TRUE;
gboolean GdmConfigAvailable = TRUE;
gboolean greeter_use_circles_in_entry = FALSE; gboolean greeter_use_circles_in_entry = FALSE;
...@@ -69,6 +73,10 @@ greeter_parse_config (void) ...@@ -69,6 +73,10 @@ greeter_parse_config (void)
GdmSessionDir = gnome_config_get_string (GDM_KEY_SESSDIR); GdmSessionDir = gnome_config_get_string (GDM_KEY_SESSDIR);
GdmLocaleFile = gnome_config_get_string (GDM_KEY_LOCFILE); GdmLocaleFile = gnome_config_get_string (GDM_KEY_LOCFILE);
GdmSystemMenu = gnome_config_get_bool (GDM_KEY_SYSMENU); GdmSystemMenu = gnome_config_get_bool (GDM_KEY_SYSMENU);
GdmConfigAvailable = gnome_config_get_bool (GDM_KEY_CONFIG_AVAILABLE);
GdmHalt = gnome_config_get_string (GDM_KEY_HALT);
GdmReboot = gnome_config_get_string (GDM_KEY_REBOOT);
GdmSuspend = gnome_config_get_string (GDM_KEY_SUSPEND);
gnome_config_pop_prefix(); gnome_config_pop_prefix();
...@@ -587,7 +595,10 @@ greeter_abort (const gchar *format, ...) ...@@ -587,7 +595,10 @@ greeter_abort (const gchar *format, ...)
static void static void
greeter_reread_config (int sig) greeter_reread_config (int sig)
{ {
/* FIXME: reparse config stuff here */ /* FIXME: actually reparse config stuff here, instead of
* just requesting a restart */
/* restart interruption */
g_print ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_RESTART_GREETER);
} }
static void static void
......
...@@ -7,5 +7,10 @@ extern gboolean GdmShowGnomeChooserSession; ...@@ -7,5 +7,10 @@ extern gboolean GdmShowGnomeChooserSession;
extern gboolean GdmShowGnomeFailsafeSession; extern gboolean GdmShowGnomeFailsafeSession;
extern gboolean GdmShowXtermFailsafeSession; extern gboolean GdmShowXtermFailsafeSession;
extern gboolean GdmShowLastSession; extern gboolean GdmShowLastSession;
extern gboolean GdmSystemMenu;
extern gboolean GdmConfigAvailable;
extern gchar *GdmHalt;
extern gchar *GdmReboot;
extern gchar *GdmSuspend;
extern gchar *GdmSessionDir; extern gchar *GdmSessionDir;
extern gchar *GdmDefaultLocale; extern gchar *GdmDefaultLocale;
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
#include <unistd.h> #include <unistd.h>
#include "greeter_item.h" #include "greeter_item.h"
#include "greeter_configuration.h"
#ifndef _ #ifndef _
#define _(x) (x) #define _(x) (x)
#endif #endif
extern gboolean GdmSystemMenu;
GreeterItemInfo * GreeterItemInfo *
greeter_item_info_new (GreeterItemInfo *parent, greeter_item_info_new (GreeterItemInfo *parent,
GreeterItemType type) GreeterItemType type)
...@@ -57,6 +56,8 @@ greeter_item_info_free (GreeterItemInfo *info) ...@@ -57,6 +56,8 @@ greeter_item_info_free (GreeterItemInfo *info)
g_free (info->id); g_free (info->id);
g_free (info->orig_text); g_free (info->orig_text);
g_free (info->show_type);
g_free (info->show_subtype);
g_free (info); g_free (info);
} }
...@@ -205,26 +206,33 @@ greeter_item_is_visible (GreeterItemInfo *info) ...@@ -205,26 +206,33 @@ greeter_item_is_visible (GreeterItemInfo *info)
! (info->show_modes & GREETER_ITEM_SHOW_REMOTE)) ! (info->show_modes & GREETER_ITEM_SHOW_REMOTE))
return FALSE; return FALSE;
/* FIXME: this is somewhat evil, maybe it should be part of the show if ( ! GdmConfigAvailable &&
* modes */ info->show_type != NULL &&
if ( ! GdmSystemMenu && strcmp (info->show_type, "config") == 0)
info->id != NULL && return FALSE;
(strcmp (info->id, "system_button") == 0 ||
/* FIXME: reboot, halt and suspend should depend on the commands
* being set */
strcmp (info->id, "reboot_button") == 0 ||
strcmp (info->id, "halt_button") == 0 ||
strcmp (info->id, "suspend_button") == 0)) {
return FALSE;
}
/* FIXME: this is somewhat evil, maybe it should be part of the show if ( ! GdmSystemMenu &&
* modes */ info->show_type != NULL &&
if ( ! GDM_TIMED_LOGIN_OK && info->id != NULL) strcmp (info->show_type, "system") == 0)
{ return FALSE;
if (strncmp (info->id, "timed_login", strlen ("timed_login")) == 0)
return FALSE; if (GdmHalt == NULL &&
} info->show_subtype != NULL &&
strcmp (info->show_subtype, "halt") == 0)
return FALSE;
if (GdmReboot == NULL &&
info->show_subtype != NULL &&
strcmp (info->show_subtype, "reboot") == 0)
return FALSE;
if (GdmSuspend == NULL &&
info->show_subtype != NULL &&
strcmp (info->show_subtype, "suspend") == 0)
return FALSE;
if ( ! GDM_TIMED_LOGIN_OK &&
info->show_type != NULL &&
strcmp (info->show_type, "timed") == 0)
return FALSE;
return TRUE; return TRUE;
} }
......
...@@ -59,6 +59,8 @@ struct _GreeterItemInfo { ...@@ -59,6 +59,8 @@ struct _GreeterItemInfo {
double y; double y;
GreeterItemShowModes show_modes; GreeterItemShowModes show_modes;
char *show_type; /* timed, system, config */
char *show_subtype; /* halt, suspend, reboot */
GreeterItemSizeType width_type; GreeterItemSizeType width_type;
GreeterItemSizeType height_type; GreeterItemSizeType height_type;
......
...@@ -273,6 +273,22 @@ parse_show (xmlNodePtr node, ...@@ -273,6 +273,22 @@ parse_show (xmlNodePtr node,
xmlChar *prop; xmlChar *prop;
char **argv = NULL; char **argv = NULL;
int i; int i;
prop = xmlGetProp (node, "type");
if (prop != NULL)
{
g_free (info->show_type);
info->show_type = g_strdup (prop);
xmlFree (prop);
}
prop = xmlGetProp (node, "subtype");
if (prop != NULL)
{
g_free (info->show_subtype);
info->show_subtype = g_strdup (prop);
xmlFree (prop);
}
prop = xmlGetProp (node, "modes"); prop = xmlGetProp (node, "modes");
if (prop != NULL) if (prop != NULL)
......
...@@ -43,6 +43,24 @@ greeter_suspend_handler (void) ...@@ -43,6 +43,24 @@ greeter_suspend_handler (void)
} }
} }
static void
greeter_config_handler (GreeterItemInfo *info,
gpointer user_data)
{
/* we should be now fine for focusing new windows */
gdm_wm_focus_new_windows (TRUE);
#if 0
/* Taken from gdmlogin, does this apply? */
/* configure interruption */
login_entry = FALSE; /* no matter where we are,
this is no longer a login_entry */
#endif
/* configure interruption */
g_print ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CONFIGURE);
}
static void static void
greeter_system_handler (GreeterItemInfo *info, greeter_system_handler (GreeterItemInfo *info,
gpointer user_data) gpointer user_data)
...@@ -126,4 +144,7 @@ greeter_item_system_setup (void) ...@@ -126,4 +144,7 @@ greeter_item_system_setup (void)
greeter_item_register_action_callback ("system_button", greeter_item_register_action_callback ("system_button",
(ActionFunc)greeter_system_handler, (ActionFunc)greeter_system_handler,
NULL); NULL);
greeter_item_register_action_callback ("config_button",
(ActionFunc)greeter_config_handler,
NULL);
} }
# Not yet implemented but this is description about the theme and all that
# fun kind of stuff
[GdmGreeterTheme]
Greeter=circles.xml
Name=Circles
Name[cs]=Kruhy
ShortDescription=Theme with lots of circles
Author=Bond, James Bond
Copyright=(c) 2002 Bond, James Bond
Screenshot=
circlesdir = $(datadir)/gdm/themes/circles circlesdir = $(datadir)/gdm/themes/circles
circles_DATA = \ circles_DATA = \
GdmGreeterTheme.info \
circles.xml \ circles.xml \
background.svg \ background.svg \
flower.png \ flower.png \
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</item> </item>
<item type="rect" id="system_button" button="true"> <item type="rect" id="system_button" button="true">
<normal color="#ffffff"/> <normal color="#ffffff"/>
<show modes="console"/> <show modes="console" type="system"/>
<pos y="50%" anchor="w" width="box" height="box"/> <pos y="50%" anchor="w" width="box" height="box"/>
<box orientation="horizontal" spacing="10" xpadding="10"> <box orientation="horizontal" spacing="10" xpadding="10">
<item type="pixmap"> <item type="pixmap">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment