[PATCH] GDM-2.4.4.5 Alternative display optional info message before login
- From: Anton Altaparmakov <aia21 cam ac uk>
- To: George <jirka 5z com>
- Cc: gdm sunsite dk
- Subject: [PATCH] GDM-2.4.4.5 Alternative display optional info message before login
- Date: Tue, 4 Nov 2003 13:41:23 +0000 (GMT)
Hi,
On Thu, 2003-10-02 at 17:46, George wrote:
> I'm not sure I truly like this path to customizing the font and color
> there. We're not really talking about an "item" in the theme, so it
> really seemslike an utter hack. What could really happen is for the
> file to use pangomarkup optionally (or maybe just always use it, I don't
> think pango markup is dangerous in any way). This way you could not
> only specify a font for the whole thing, but you could change how
> certain parts of it look etc... I suppose for any sort of "usage rules"
> it would be useful to make certainparts larger and bold :)
For us using Pango is not an option because we share the same file with
Windows. )-:
However to address your "utter hack" objections, I have removed the
fontsize changes through the theme and have added a new gdm.conf option
"InfoMsgFont" (goes together with the "InfoMsgFile" specifying the file
itself). So InfoMsgfont=Sans 24 for example would modify the font
description before displaying the file contents to use Sans 24 font loaded
using pango_font_description_from_string().
I hope this is an acceptable alternative for you.
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
diff -urNp gdm-2.4.4.5.old/config/gdm.conf.in gdm-2.4.4.5/config/gdm.conf.in
--- gdm-2.4.4.5.old/config/gdm.conf.in 2003-10-10 21:57:25.000000000 +0100
+++ gdm-2.4.4.5/config/gdm.conf.in 2003-10-22 17:30:55.000000000 +0100
@@ -95,6 +95,12 @@ XKeepsCrashing= EXPANDED_SYSCONFDIR@/gdm
#RebootCommand=/usr/bin/reboot;/sbin/reboot;/sbin/shutdown -r now;/usr/sbin/shutdown -r now
#HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shutdown -h now
#SuspendCommand=
+# If InfoMsgFile points to a file, the greeter will display the contents of the
+# file in a modal dialog box before the user is allowed to log in.
+#InfoMsgFile=
+# If InfoMsgFile is present then InfoMsgFont can be used to specify the font
+# to be used when displaying the contents of the file.
+#InfoMsgFont=Sans 24
# Probably should not touch the below this is the standard setup
ServAuthDir= EXPANDED_AUTHDIR@
# This is our standard startup script. A bit different from a normal
diff -urNp gdm-2.4.4.5.old/daemon/gdm.h gdm-2.4.4.5/daemon/gdm.h
--- gdm-2.4.4.5.old/daemon/gdm.h 2003-10-09 19:57:28.000000000 +0100
+++ gdm-2.4.4.5/daemon/gdm.h 2003-10-22 17:32:21.000000000 +0100
@@ -149,6 +149,8 @@ enum {
#define GDM_KEY_BASEXSESSION "daemon/BaseXsession=" EXPANDED_SYSCONFDIR "/gdm/Xsession"
#define GDM_KEY_DEFAULTSESSION "daemon/DefaultSession=gnome.desktop"
#define GDM_KEY_SUSPEND "daemon/SuspendCommand="
+#define GDM_KEY_INFO_MSG_FILE "daemon/InfoMsgFile="
+#define GDM_KEY_INFO_MSG_FONT "daemon/InfoMsgFont="
#define GDM_KEY_UAUTHDIR "daemon/UserAuthDir="
#define GDM_KEY_UAUTHFB "daemon/UserAuthFBDir=/tmp"
diff -urNp gdm-2.4.4.5.old/gui/gdmlogin.c gdm-2.4.4.5/gui/gdmlogin.c
--- gdm-2.4.4.5.old/gui/gdmlogin.c 2003-10-17 18:34:02.000000000 +0100
+++ gdm-2.4.4.5/gui/gdmlogin.c 2003-10-22 17:55:29.000000000 +0100
@@ -90,6 +90,8 @@ static gchar *GdmSuspend;
static gboolean GdmConfigAvailable;
static gboolean GdmConfigAvailableReal;
static gchar *GdmConfigurator;
+static gchar *GdmInfoMsgFile;
+static gchar *GdmInfoMsgFont;
static gint GdmXineramaScreen;
static gchar *GdmLogo;
static gchar *GdmWelcome;
@@ -720,6 +722,8 @@ gdm_login_parse_config (void)
GdmSuspend = ve_config_get_string (config, GDM_KEY_SUSPEND);
GdmConfigAvailableReal = GdmConfigAvailable = ve_config_get_bool (config, GDM_KEY_CONFIG_AVAILABLE);
GdmConfigurator = ve_config_get_string (config, GDM_KEY_CONFIGURATOR);
+ GdmInfoMsgFile = ve_config_get_string (config, GDM_KEY_INFO_MSG_FILE);
+ GdmInfoMsgFont = ve_config_get_string (config, GDM_KEY_INFO_MSG_FONT);
GdmTitleBar = ve_config_get_bool (config, GDM_KEY_TITLE_BAR);
GdmLocaleFile = ve_config_get_string (config, GDM_KEY_LOCFILE);
GdmSessionDir = ve_config_get_string (config, GDM_KEY_SESSDIR);
@@ -3562,6 +3566,8 @@ gdm_reread_config (int sig, gpointer dat
* then just restarting */
/* Also we may not need to check ALL those keys but just a few */
if ( ! string_same (config, GdmGtkRC, GDM_KEY_GTKRC) ||
+ ! string_same (config, GdmInfoMsgFile, GDM_KEY_INFO_MSG_FILE) ||
+ ! string_same (config, GdmInfoMsgFont, GDM_KEY_INFO_MSG_FONT) ||
! int_same (config,
GdmXineramaScreen, GDM_KEY_XINERAMASCREEN) ||
! bool_same (config, GdmSystemMenu, GDM_KEY_SYSMENU) ||
@@ -3690,6 +3696,50 @@ gdm_reread_config (int sig, gpointer dat
return TRUE;
}
+void
+gdm_login_show_info_msg(void)
+{
+ GtkWidget *dialog, *label;
+ gchar *InfoMsg;
+ gsize InfoMsgLength;
+
+ if (!GdmInfoMsgFile ||
+ !strlen (GdmInfoMsgFile) ||
+ !g_file_test (GdmInfoMsgFile, G_FILE_TEST_EXISTS) ||
+ !g_file_get_contents (GdmInfoMsgFile, &InfoMsg, &InfoMsgLength, NULL) ||
+ !InfoMsgLength)
+ return;
+
+ gdm_wm_focus_new_windows (TRUE);
+ dialog = gtk_dialog_new_with_buttons (NULL /* Message */,
+ NULL /* parent */, GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+ label = gtk_label_new (InfoMsg);
+
+ if (GdmInfoMsgFont && strlen(GdmInfoMsgFont) > 0) {
+ PangoFontDescription *GdmInfoMsgFontDesc = pango_font_description_from_string (GdmInfoMsgFont);
+ if (GdmInfoMsgFontDesc) {
+ gtk_widget_modify_font (label, GdmInfoMsgFontDesc);
+ pango_font_description_free (GdmInfoMsgFontDesc);
+ }
+ }
+
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), label);
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ setup_cursor (GDK_LEFT_PTR);
+
+ gdm_wm_no_login_focus_push();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop();
+
+ g_free (InfoMsg);
+}
+
int
main (int argc, char *argv[])
{
@@ -4050,6 +4100,8 @@ main (int argc, char *argv[])
gdm_wm_restore_wm_order ();
+ gdm_login_show_info_msg ();
+
/* Only setup the cursor now since it will be a WATCH from before */
setup_cursor (GDK_LEFT_PTR);
diff -urNp gdm-2.4.4.5.old/gui/greeter/greeter.c gdm-2.4.4.5/gui/greeter/greeter.c
--- gdm-2.4.4.5.old/gui/greeter/greeter.c 2003-10-06 21:42:36.000000000 +0100
+++ gdm-2.4.4.5/gui/greeter/greeter.c 2003-10-22 17:55:41.000000000 +0100
@@ -69,6 +69,8 @@ gboolean GdmAllowRoot;
gboolean GdmAllowRemoteRoot;
gchar *GdmWelcome;
gchar *GdmServAuthDir;
+gchar *GdmInfoMsgFile;
+gchar *GdmInfoMsgFont;
gboolean GdmUseCirclesInEntry = FALSE;
@@ -138,6 +140,8 @@ greeter_parse_config (void)
GdmConfigurator = ve_config_get_string (config, GDM_KEY_CONFIGURATOR);
GdmGtkRC = ve_config_get_string (config, GDM_KEY_GTKRC);
GdmServAuthDir = ve_config_get_string (config, GDM_KEY_SERVAUTH);
+ GdmInfoMsgFile = ve_config_get_string (config, GDM_KEY_INFO_MSG_FILE);
+ GdmInfoMsgFont = ve_config_get_string (config, GDM_KEY_INFO_MSG_FONT);
GdmWelcome = ve_config_get_translated_string (config, greeter_Welcome_key);
/* A hack! */
@@ -923,6 +927,12 @@ greeter_reread_config (int sig, gpointer
! string_same (config,
GdmConfigurator,
GDM_KEY_CONFIGURATOR) ||
+ ! string_same (config,
+ GdmInfoMsgFile,
+ GDM_KEY_INFO_MSG_FILE) ||
+ ! string_same (config,
+ GdmInfoMsgFont,
+ GDM_KEY_INFO_MSG_FONT) ||
! bool_same (config,
GdmConfigAvailable,
GDM_KEY_CONFIG_AVAILABLE) ||
@@ -1114,6 +1124,50 @@ gdm_login_abort (const gchar *format, ..
_exit (DISPLAY_GREETERFAILED);
}
+void
+greeter_show_info_msg(void)
+{
+ GtkWidget *dialog, *label;
+ gchar *InfoMsg;
+ gsize InfoMsgLength;
+
+ if (!GdmInfoMsgFile ||
+ !strlen (GdmInfoMsgFile) ||
+ !g_file_test (GdmInfoMsgFile, G_FILE_TEST_EXISTS) ||
+ !g_file_get_contents (GdmInfoMsgFile, &InfoMsg, &InfoMsgLength, NULL) ||
+ !InfoMsgLength)
+ return;
+
+ gdm_wm_focus_new_windows (TRUE);
+ dialog = gtk_dialog_new_with_buttons (NULL /* Message */,
+ NULL /* parent */, GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+ label = gtk_label_new (InfoMsg);
+
+ if (GdmInfoMsgFont && strlen(GdmInfoMsgFont) > 0) {
+ PangoFontDescription *GdmInfoMsgFontDesc = pango_font_description_from_string (GdmInfoMsgFont);
+ if (GdmInfoMsgFontDesc) {
+ gtk_widget_modify_font (label, GdmInfoMsgFontDesc);
+ pango_font_description_free (GdmInfoMsgFontDesc);
+ }
+ }
+
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), label);
+ gtk_widget_show_all (dialog);
+ gdm_wm_center_window (GTK_WINDOW (dialog));
+
+ greeter_setup_cursor (GDK_LEFT_PTR);
+
+ gdm_wm_no_login_focus_push();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ gdm_wm_no_login_focus_pop();
+
+ g_free (InfoMsg);
+}
+
int
main (int argc, char *argv[])
{
@@ -1489,6 +1543,8 @@ main (int argc, char *argv[])
gdm_wm_restore_wm_order ();
+ greeter_show_info_msg ();
+
greeter_setup_cursor (GDK_LEFT_PTR);
gtk_main ();
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]