diff options
author | Alex Larsson <alexl@redhat.com> | 2002-02-04 22:29:57 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2002-02-04 22:29:57 +0000 |
commit | e8221d89a288718d35076bbda2561d2be82ccf9e (patch) | |
tree | 66ebdbbc1d9a22abe060ecd840e2117650bd534e /gui | |
parent | 2451d13cf5057b9e8cd3ae6372fc2fbbe38b693d (diff) | |
download | gdm-e8221d89a288718d35076bbda2561d2be82ccf9e.tar.gz |
Add greeter_system.[ch].
2002-02-04 Alex Larsson <alexl@redhat.com>
* gui/greeter/Makefile.am:
Add greeter_system.[ch].
* gui/greeter/greeter.c (greeter_setup_items):
Call greeter_item_system_setup().
* gui/greeter/greeter_system.[ch]:
Add some system-menu item handling.
* gui/greeter/themes/circles/circles.xml:
Pack the bottom buttons in a box.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/greeter/Makefile.am | 4 | ||||
-rw-r--r-- | gui/greeter/greeter.c | 1 | ||||
-rw-r--r-- | gui/greeter/greeter_system.c | 97 | ||||
-rw-r--r-- | gui/greeter/greeter_system.h | 11 | ||||
-rw-r--r-- | gui/greeter/themes/circles/circles.xml | 13 |
5 files changed, 118 insertions, 8 deletions
diff --git a/gui/greeter/Makefile.am b/gui/greeter/Makefile.am index fdc6fc9f..5601e472 100644 --- a/gui/greeter/Makefile.am +++ b/gui/greeter/Makefile.am @@ -36,7 +36,9 @@ gdmgreeter_SOURCES = \ greeter_item_pam.c \ greeter_item_pam.h \ greeter_parser.c \ - greeter_parser.h + greeter_parser.h \ + greeter_system.c \ + greeter_system.h gdmgreeter_LDADD = \ ../libgdmwm.a \ diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c index 68a958f8..c919276a 100644 --- a/gui/greeter/greeter.c +++ b/gui/greeter/greeter.c @@ -430,6 +430,7 @@ greeter_setup_items (void) greeter_item_register_action_callback ("language_button", greeter_action_language, window); + greeter_item_system_setup (); } diff --git a/gui/greeter/greeter_system.c b/gui/greeter/greeter_system.c new file mode 100644 index 00000000..7fb86c4b --- /dev/null +++ b/gui/greeter/greeter_system.c @@ -0,0 +1,97 @@ +#include "config.h" + +#include <gtk/gtk.h> +#include "greeter.h" +#include "greeter_configuration.h" +#include "greeter_system.h" +#include "greeter_item.h" + +#include <syslog.h> + +#include "gdm.h" +#include "gdmwm.h" + +static gboolean +greeter_query (const gchar *msg) +{ + int ret; + GtkWidget *req; + + /* we should be now fine for focusing new windows */ + gdm_wm_focus_new_windows (TRUE); + + req = gtk_message_dialog_new (NULL /* parent */, + GTK_DIALOG_MODAL /* flags */, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", + msg); + + g_signal_connect (G_OBJECT (req), "destroy", + G_CALLBACK (gtk_widget_destroyed), + &req); + + gdm_wm_center_window (GTK_WINDOW (req)); + + gdm_wm_no_login_focus_push (); + ret = gtk_dialog_run (GTK_DIALOG (req)); + gdm_wm_no_login_focus_pop (); + + if (req != NULL) + gtk_widget_destroy (req); + + if (ret == GTK_RESPONSE_YES) + return TRUE; + else /* this includes window close */ + return FALSE; +} + + +static void +greeter_reboot_handler (GreeterItemInfo *info, + gpointer user_data) +{ + if (greeter_query (_("Are you sure you want to reboot the machine?"))) { + closelog(); + + _exit (DISPLAY_REBOOT); + } +} + + +static void +greeter_halt_handler (GreeterItemInfo *info, + gpointer user_data) +{ + if (greeter_query (_("Are you sure you want to shut down the machine?"))) { + closelog(); + + _exit (DISPLAY_HALT); + } +} + +static void +greeter_suspend_handler (GreeterItemInfo *info, + gpointer user_data) +{ + if (greeter_query (_("Are you sure you want to suspend the machine?"))) { + closelog(); + + _exit (DISPLAY_SUSPEND); + } +} + +void +greeter_item_system_setup (void) +{ + greeter_item_register_action_callback ("reboot_button", + greeter_reboot_handler, + NULL); + greeter_item_register_action_callback ("halt_button", + greeter_halt_handler, + NULL); + greeter_item_register_action_callback ("suspend_button", + greeter_suspend_handler, + NULL); + +} diff --git a/gui/greeter/greeter_system.h b/gui/greeter/greeter_system.h new file mode 100644 index 00000000..47cc53e9 --- /dev/null +++ b/gui/greeter/greeter_system.h @@ -0,0 +1,11 @@ +#ifndef __GREETER_SYSTEM_H__ +#define __GREETER_SYSTEM_H__ + +#include "greeter_item.h" +#include "greeter_events.h" + +void greeter_item_system_setup (void); + + +#endif + diff --git a/gui/greeter/themes/circles/circles.xml b/gui/greeter/themes/circles/circles.xml index c09feb7a..768c2c13 100644 --- a/gui/greeter/themes/circles/circles.xml +++ b/gui/greeter/themes/circles/circles.xml @@ -12,31 +12,30 @@ <item type="rect"> <normal color="#ffffff"/> <pos x="0" y="4" width="100%" height="100%"/> - <fixed> + <box orientation="horizontal" spacing="10" xpadding="10"> <item type="pixmap" id="language_button"> <normal file="options.png" tint="#dddddd"/> <prelight file="options.png"/> <active file="options.png" tint="#ff0000"/> - <pos x="10" y="50%" anchor="w"/> + <pos y="50%" anchor="w"/> </item> <item type="label"> <normal color="#000000" font="Sans 14"/> - <pos x="66" y="50%" anchor="w"/> + <pos y="50%" anchor="w"/> <text val="Option"/> </item> <item type="pixmap"> <normal file="help.png" tint="#dddddd"/> <prelight file="help.png"/> <active file="help.png" tint="#ff0000"/> - <pos x="160" y="50%" anchor="w"/> + <pos y="50%" anchor="w"/> </item> <item type="label"> <normal color="#000000" font="Sans 14"/> - <pos x="216" y="50%" anchor="w"/> + <pos y="50%" anchor="w"/> <text val="Help"/> </item> - - </fixed> + </box> </item> </fixed> </item> |