diff options
author | George Lebl <jirka@5z.com> | 2002-08-14 19:10:50 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2002-08-14 19:10:50 +0000 |
commit | 86a35bf4adb8974167ab6168ac51d0cc40a196e0 (patch) | |
tree | 0665977357623c2759cb724ccf5851ac5ff11b4b /gui | |
parent | af3513c228834755bcd9c4d1416afcb1582d08b5 (diff) | |
download | gdm-86a35bf4adb8974167ab6168ac51d0cc40a196e0.tar.gz |
whack old debug printf (it wasn't harmful due to the way we do things, but
Wed Aug 14 12:16:30 2002 George Lebl <jirka@5z.com>
* gui/gdmlogin.c: whack old debug printf (it wasn't harmful due to
the way we do things, but still it was evil)
* gui/gdmlogin.c, gui/greeter/greeter.c,
gui/greeter/greeter_canvas_item.c, gui/greeter/greeter_item_pam.c:
Do the focus stuff correctly instead of trapping tab and all that,
unset CAN_FOCUS on widgets other then the entry. Make sure that
an entry exists in the graphical greeter. Add a fake menubar
below the entry in the graphical greeter so that we always can get
to all the commands even on a whacked out theme. Plus it may be
nicer to use then the mnemonics if you just use F10. Now the whole
thing should be more accessibility friendly as well. When
'doing_development' make the entry sensitive. Must make a
theme tester.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/gdmlogin.c | 51 | ||||
-rw-r--r-- | gui/greeter/greeter.c | 12 | ||||
-rw-r--r-- | gui/greeter/greeter_canvas_item.c | 82 | ||||
-rw-r--r-- | gui/greeter/greeter_item_pam.c | 52 |
4 files changed, 118 insertions, 79 deletions
diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c index b99326f4..c3939dac 100644 --- a/gui/gdmlogin.c +++ b/gui/gdmlogin.c @@ -89,10 +89,12 @@ static gint GdmIconMaxHeight; static gint GdmIconMaxWidth; static gboolean GdmQuiver; static gboolean GdmSystemMenu; +static gboolean GdmSystemMenuReal; static gchar *GdmHalt; static gchar *GdmReboot; static gchar *GdmSuspend; static gboolean GdmConfigAvailable; +static gboolean GdmConfigAvailableReal; static gchar *GdmConfigurator; static gint GdmXineramaScreen; static gchar *GdmLogo; @@ -865,11 +867,11 @@ gdm_login_parse_config (void) GdmIcon = g_strdup (EXPANDED_PIXMAPDIR "/gdm.png"); } GdmQuiver = ve_config_get_bool (config, GDM_KEY_QUIVER); - GdmSystemMenu = ve_config_get_bool (config, GDM_KEY_SYSMENU); + GdmSystemMenuReal = GdmSystemMenu = ve_config_get_bool (config, GDM_KEY_SYSMENU); GdmHalt = ve_config_get_string (config, GDM_KEY_HALT); GdmReboot = ve_config_get_string (config, GDM_KEY_REBOOT); GdmSuspend = ve_config_get_string (config, GDM_KEY_SUSPEND); - GdmConfigAvailable = ve_config_get_bool (config, GDM_KEY_CONFIG_AVAILABLE); + GdmConfigAvailableReal = GdmConfigAvailable = ve_config_get_bool (config, GDM_KEY_CONFIG_AVAILABLE); GdmConfigurator = ve_config_get_string (config, GDM_KEY_CONFIGURATOR); GdmTitleBar = ve_config_get_bool (config, GDM_KEY_TITLE_BAR); GdmLocaleFile = ve_config_get_string (config, GDM_KEY_LOCFILE); @@ -940,8 +942,8 @@ gdm_login_parse_config (void) /* Disable System menu on non-local displays */ if (ve_string_empty (g_getenv ("GDM_IS_LOCAL"))) { - GdmSystemMenu = FALSE; - GdmConfigAvailable = FALSE; + GdmSystemMenuReal = FALSE; + GdmConfigAvailableReal = FALSE; if (GdmBackgroundRemoteOnlyColor && GdmBackgroundType == GDM_BACKGROUND_IMAGE) GdmBackgroundType = GDM_BACKGROUND_COLOR; @@ -1306,37 +1308,6 @@ gdm_login_ok_button_press (GtkButton *button, GtkWidget *entry) } static gboolean -gdm_login_entry_handler (GtkWidget *widget, GdkEventKey *event) -{ - if (event == NULL) - return FALSE; - - switch (event->keyval) { - - case GDK_Return: - case GDK_KP_Enter: - gdm_login_enter (entry); - return TRUE; - - case GDK_Up: - case GDK_Down: - case GDK_Tab: - case GDK_ISO_Left_Tab: - case GDK_KP_Up: - case GDK_KP_Down: - case GDK_KP_Tab: - g_signal_stop_emission_by_name (G_OBJECT (entry), "key_press_event"); - return TRUE; - - default: - g_print ("0x%x\n", (int)event->keyval); - break; - } - - return FALSE; -} - -static gboolean gdm_login_focus_in (GtkWidget *widget, GdkEventFocus *event) { if (title_box != NULL) @@ -3029,11 +3000,11 @@ gdm_login_gui_init (void) gtk_widget_show (GTK_WIDGET (langmenu)); } - if (GdmSystemMenu) { + if (GdmSystemMenuReal) { gboolean got_anything = FALSE; menu = gtk_menu_new(); - if (GdmConfigAvailable && + if (GdmConfigAvailableReal && bin_exists (GdmConfigurator)) { item = gtk_menu_item_new_with_mnemonic (_("_Configure...")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -3339,8 +3310,8 @@ gdm_login_gui_init (void) gtk_table_attach (GTK_TABLE (stack), entry, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 10, 0); - g_signal_connect (G_OBJECT(entry), "key_press_event", - G_CALLBACK (gdm_login_entry_handler), + g_signal_connect (G_OBJECT(entry), "activate", + G_CALLBACK (gdm_login_enter), NULL); hline2 = gtk_hseparator_new (); @@ -3365,9 +3336,11 @@ gdm_login_gui_init (void) /* FIXME: No Documentation yet.... */ /*help_button = gtk_button_new_from_stock (GTK_STOCK_OK); + GTK_WIDGET_UNSET_FLAGS (help_button, GTK_CAN_FOCUS); gtk_widget_show (help_button);*/ ok_button = gtk_button_new_from_stock (GTK_STOCK_OK); + GTK_WIDGET_UNSET_FLAGS (ok_button, GTK_CAN_FOCUS); g_signal_connect (G_OBJECT (ok_button), "clicked", G_CALLBACK (gdm_login_ok_button_press), entry); diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c index 4a1cb18e..96024bc4 100644 --- a/gui/greeter/greeter.c +++ b/gui/greeter/greeter.c @@ -1060,6 +1060,7 @@ main (int argc, char *argv[]) G_CALLBACK (key_press_event), NULL); canvas = gnome_canvas_new_aa (); + GTK_WIDGET_UNSET_FLAGS (canvas, GTK_CAN_FOCUS); gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, (double) gdm_wm_screen.width, @@ -1092,6 +1093,17 @@ main (int argc, char *argv[]) NULL); } + /* FIXME: beter information should be printed */ + if (greeter_lookup_id ("user-pw-entry") == NULL) + root = NULL; + + /* FIXME: beter information should be printed */ + if (DOING_GDM_DEVELOPMENT && root == NULL) + { + g_warning ("No theme could be loaded"); + exit(1); + } + if (root == NULL) { GtkWidget *dialog; diff --git a/gui/greeter/greeter_canvas_item.c b/gui/greeter/greeter_canvas_item.c index 81f60983..b0fafe29 100644 --- a/gui/greeter/greeter_canvas_item.c +++ b/gui/greeter/greeter_canvas_item.c @@ -3,7 +3,9 @@ #include <math.h> #include <string.h> #include <gtk/gtk.h> +#include <libgnome/libgnome.h> #include <librsvg/rsvg.h> +#include "vicious.h" #include "greeter.h" #include "greeter_item.h" @@ -96,13 +98,72 @@ transform_pixbuf (GdkPixbuf *orig, } static void -fake_button_clicked (GtkWidget *widget, gpointer data) +activate_button (GtkWidget *widget, gpointer data) { const char *id = data; if (id != NULL) greeter_item_run_action_callback (id); } +static GtkWidget * +make_menubar (void) +{ + GtkWidget *w, *menu; + GtkWidget *menubar = gtk_menu_bar_new(); + + /* FIXME: add translatable string here */ + w = gtk_menu_item_new_with_label ("Menu"); + gtk_menu_shell_append (GTK_MENU_SHELL (menubar), w); + gtk_widget_show (GTK_WIDGET (w)); + + menu = gtk_menu_new(); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), menu); + + w = gtk_menu_item_new_with_mnemonic (_("_Language")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), w); + gtk_widget_show (GTK_WIDGET (w)); + g_signal_connect (G_OBJECT (w), "activate", + G_CALLBACK (activate_button), + "language_button"); + + w = gtk_menu_item_new_with_mnemonic (_("_Session")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), w); + gtk_widget_show (GTK_WIDGET (w)); + g_signal_connect (G_OBJECT (w), "activate", + G_CALLBACK (activate_button), + "session_button"); + + if (GdmSystemMenu && + ! ve_string_empty (g_getenv ("GDM_IS_LOCAL"))) { + w = gtk_menu_item_new_with_mnemonic (_("S_ystem")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), w); + gtk_widget_show (GTK_WIDGET (w)); + g_signal_connect (G_OBJECT (w), "activate", + G_CALLBACK (activate_button), + "system_button"); + } + + /* Add a quit/disconnect item when in xdmcp mode or flexi mode */ + /* Do note that the order is important, we always want "Quit" for + * flexi, even if not local (non-local xnest). and Disconnect + * only for xdmcp */ + if ( ! ve_string_empty (g_getenv ("GDM_FLEXI_SERVER"))) { + w = gtk_menu_item_new_with_mnemonic (_("_Quit")); + } else if (ve_string_empty (g_getenv ("GDM_IS_LOCAL"))) { + w = gtk_menu_item_new_with_mnemonic (_("D_isconnect")); + } else { + w = NULL; + } + if (w != NULL) { + gtk_menu_shell_append (GTK_MENU_SHELL (menu), w); + gtk_widget_show (GTK_WIDGET (w)); + g_signal_connect (G_OBJECT (w), "activate", + G_CALLBACK (gtk_main_quit), NULL); + } + + return menubar; +} + void greeter_item_create_canvas_item (GreeterItemInfo *item) { @@ -205,7 +266,7 @@ greeter_item_create_canvas_item (GreeterItemInfo *item) GreeterItemInfo *button; GtkWidget *fake_button = gtk_button_new_with_mnemonic (item->orig_text); gtk_widget_show (fake_button); - GTK_WIDGET_SET_FLAGS (fake_button, GTK_CAN_FOCUS); + GTK_WIDGET_UNSET_FLAGS (fake_button, GTK_CAN_FOCUS); gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), GNOME_TYPE_CANVAS_WIDGET, "widget", fake_button, @@ -218,7 +279,7 @@ greeter_item_create_canvas_item (GreeterItemInfo *item) if (button == NULL) button = item; g_signal_connect_data (G_OBJECT (fake_button), "clicked", - G_CALLBACK (fake_button_clicked), + G_CALLBACK (activate_button), g_strdup (button->id), (GClosureNotify)g_free, 0 /* connect_flags */); @@ -234,6 +295,20 @@ greeter_item_create_canvas_item (GreeterItemInfo *item) if (GdmUseCirclesInEntry) gtk_entry_set_invisible_char (GTK_ENTRY (entry), 0x25cf); + if (item->id != NULL && strcmp (item->id, "user-pw-entry") == 0) { + /* HACK! Add a menubar, this is kind of evil isn't it */ + GtkWidget *menubar = make_menubar (); + + gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), + GNOME_TYPE_CANVAS_WIDGET, + "widget", menubar, + "x", (double)x1, + "y", (double)y1, + "height", (double)rect.height, + "width", (double)rect.width, + NULL); + } + item->item = gnome_canvas_item_new (group, GNOME_TYPE_CANVAS_WIDGET, "widget", entry, @@ -242,6 +317,7 @@ greeter_item_create_canvas_item (GreeterItemInfo *item) "height", (double)rect.height, "width", (double)rect.width, NULL); + break; } diff --git a/gui/greeter/greeter_item_pam.c b/gui/greeter/greeter_item_pam.c index 92a51ec2..d4d10f68 100644 --- a/gui/greeter/greeter_item_pam.c +++ b/gui/greeter/greeter_item_pam.c @@ -1,6 +1,7 @@ #include "config.h" #include <gtk/gtk.h> +#include <libgnome/libgnome.h> #include <gdk/gdkkeysyms.h> #include "greeter_item_pam.h" #include "greeter_parser.h" @@ -14,6 +15,9 @@ static gboolean replace_msg = TRUE; static guint err_box_clear_handler = 0; static gboolean entry_is_login = FALSE; +extern gboolean DOING_GDM_DEVELOPMENT; +extern gboolean GdmSystemMenu; + gchar *greeter_current_user = NULL; void @@ -61,32 +65,6 @@ user_pw_activate (GtkEntry *entry, GreeterItemInfo *info) g_free (tmp); } -static gboolean -key_press_handler (GtkWidget *widget, GdkEventKey *event) -{ - if (event == NULL) - return FALSE; - - switch (event->keyval) { - - case GDK_Up: - case GDK_Down: - case GDK_Tab: - case GDK_ISO_Left_Tab: - case GDK_KP_Up: - case GDK_KP_Down: - case GDK_KP_Tab: - g_signal_stop_emission_by_name (G_OBJECT (widget), - "key_press_event"); - return TRUE; - - default: - break; - } - - return FALSE; -} - gboolean greeter_item_pam_setup (void) { @@ -100,20 +78,20 @@ greeter_item_pam_setup (void) entry = GNOME_CANVAS_WIDGET (entry_info->item)->widget; gtk_widget_grab_focus (entry); - /* hack. For some reason if we leave it blank, - * we'll get a little bit of activity on first keystroke, - * this way we get rid of it, it will be cleared for the - * first prompt anyway. */ - gtk_entry_set_text (GTK_ENTRY (entry), "..."); - - /* initially insensitive */ - gtk_widget_set_sensitive (entry, FALSE); + if ( ! DOING_GDM_DEVELOPMENT) + { + /* hack. For some reason if we leave it blank, + * we'll get a little bit of activity on first keystroke, + * this way we get rid of it, it will be cleared for the + * first prompt anyway. */ + gtk_entry_set_text (GTK_ENTRY (entry), "..."); + + /* initially insensitive */ + gtk_widget_set_sensitive (entry, FALSE); + } g_signal_connect (entry, "activate", GTK_SIGNAL_FUNC (user_pw_activate), entry_info); - g_signal_connect (entry, "key_press_event", - G_CALLBACK (key_press_handler), - NULL); } return TRUE; } |