Custumize ldm gtk greeter

Raphael RIGNIER <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Hello dev list :

I've modified greeter.c file so that it could display a custom message 
under the logo and  hide Halt button.
I need it for some kiosk PCs with inaccessible power button.

it coud be defined in lts.conf with GREETER_MESSAGE and 
GREETER_ALLOW_SHUTDOWN vars.
Var names could of course be changed. I've choosed GREETER_ as it is 
greeter specific but LDM_ is perhaps better ?

example of lts.conf :

[kiosk1]
GREETER_MESSAGE="If you don't like LTSP please do not login !"
GREETER_ALLOW_SHUTDOWN=NO

I've joined the patch from ltsp-5.0.39

Thanks for the nice project !

Raphaël

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
confgreet.patch (text/plain, 2 KB)
--- ../../../../ltsp-5.0.39.orig/client/ldmgtkgreet/src/greeter.c	2007-10-08 11:19:03.000000000 +0200
+++ greeter.c	2008-04-02 17:29:17.000000000 +0200
@@ -175,6 +175,8 @@
 static void
 popup_menu(GtkWidget * widget, GtkWindow * window)
 {
+    char* env; /*returned by getenv()*/
+
     GtkWidget *menu, *lang_item, *sess_item, *host_item, *quit_item,
         *reboot_item;
     GtkWidget *sep, *langico, *sessico, *hostico, *rebootico, *haltico;
@@ -223,7 +225,10 @@
         gtk_menu_shell_append(GTK_MENU_SHELL(menu), host_item);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), sep);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), reboot_item);
-    gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit_item);
+
+    env = getenv("GREETER_ALLOW_SHUTDOWN");
+    if ( ! (env !=NULL && (strcasecmp(env,"NO")== 0)) )   
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit_item);
 
     gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
                    0, gtk_get_current_event_time());
@@ -239,6 +244,8 @@
 {
     int pw, ph, spheight, w, h;
     const char *hoststring = 0;
+    char* env; /*returned by getenv()*/
+    GtkWidget *WelcomeMessage;      /* Welcome message below logo */
 
     gint lw, lh;
 
@@ -350,6 +357,12 @@
     gtk_misc_set_alignment((GtkMisc *) UserPrompt, 1, 0.5);
     gtk_widget_set_size_request(UserPrompt, (lw / 2), 0);
 
+    env = getenv("GREETER_MESSAGE");
+    if (env)
+        WelcomeMessage = gtk_label_new(env);
+    else
+        WelcomeMessage = gtk_label_new("");
+
     StatusMessages = gtk_label_new("");
     entry = gtk_entry_new();
     gtk_entry_set_width_chars(GTK_ENTRY(entry), 12);
@@ -361,6 +374,7 @@
 
     gtk_box_pack_start(GTK_BOX(vbox), spacer, FALSE, FALSE, spheight);
     gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 5);
+    gtk_box_pack_start(GTK_BOX(vbox), WelcomeMessage, TRUE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(vbox), EntryBox, TRUE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(vbox), StatusMessages, TRUE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, FALSE, 0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.