summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorBrian Cameron <Brian.Cameron@sun.com>2005-10-14 18:18:14 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-10-14 18:18:14 +0000
commit00f9738b902eae9b8ed37db88608aadaf92421c1 (patch)
tree613be7d989a33c9af7d1443639547a2c52621437 /gui
parentccf1d0b7d753b9ba2242fbff77b8cd28446075bb (diff)
downloadgdm-00f9738b902eae9b8ed37db88608aadaf92421c1.tar.gz
No longer set tooltips for menu items in gdmlogin. These are distracting,
2005-10-14 Brian Cameron <Brian.Cameron@sun.com> * gui/gdmlogin.c: No longer set tooltips for menu items in gdmlogin. These are distracting, and do not work with accessibility. After talking with Owen Taylor at the GNOME Boston Summit, he said no GNOME programs do this, and it is not recommended. Fix for bug #144869. * gui/gdmchooser.c: Now use gdm_common_setup_cursor instead of its own copy of the same function. * gui/gdmcommon.[ch]: gdmlogin, gdmgreeter and gdmchooser were all using their own functions to set the background color. Now they use a common function in gdmcommon. * gui/gdmlogin.c, gui/gdmchooser.c, gui/greeter/greeter.c: Now sets background color and sets cursor to a watch as soon as GTK is initialized and the configure file read. This shortens the amount of time the background is Xserver default gray.
Diffstat (limited to 'gui')
-rw-r--r--gui/gdmchooser.c69
-rw-r--r--gui/gdmcommon.c34
-rw-r--r--gui/gdmcommon.h2
-rw-r--r--gui/gdmlogin.c75
-rw-r--r--gui/greeter/greeter.c46
5 files changed, 68 insertions, 158 deletions
diff --git a/gui/gdmchooser.c b/gui/gdmchooser.c
index a910d5ac..0951959e 100644
--- a/gui/gdmchooser.c
+++ b/gui/gdmchooser.c
@@ -90,7 +90,6 @@ static gint connection_type = 0;
static void gdm_chooser_abort (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
static void gdm_chooser_warn (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
-static void set_background (void);
/* Exported for glade */
void gdm_chooser_cancel (void);
@@ -218,14 +217,6 @@ find_host_in_list (GdmChooserHost *host, GtkTreeIter *iter)
}
static void
-setup_cursor (GdkCursorType type)
-{
- GdkCursor *cursor = gdk_cursor_new (type);
- gdk_window_set_cursor (gdk_get_default_root_window (), cursor);
- gdk_cursor_unref (cursor);
-}
-
-static void
gdm_chooser_host_dispose (GdmChooserHost *host)
{
if (!host)
@@ -1920,8 +1911,7 @@ gdm_reread_config (int sig, gpointer data)
! bool_same (config, GdmDebug, GDM_KEY_DEBUG)) {
if (RUNNING_UNDER_GDM) {
/* Set busy cursor */
- setup_cursor (GDK_WATCH);
-
+ gdm_common_setup_cursor (GDK_WATCH);
gdm_wm_save_wm_order ();
}
@@ -1934,7 +1924,10 @@ gdm_reread_config (int sig, gpointer data)
/* we only use the color and do it for all types except NONE */
if ( ! string_same (config, GdmBackgroundColor, GDM_KEY_BACKGROUNDCOLOR) ||
! int_same (config, GdmBackgroundType, GDM_KEY_BACKGROUNDTYPE)) {
- set_background ();
+
+ if (GdmBackgroundType != GDM_BACKGROUND_NONE) {
+ setup_background_color (GdmBackgroundColor);
+ }
}
return TRUE;
@@ -1991,37 +1984,6 @@ struct poptOption xdm_options [] = {
{ NULL, 0, 0, NULL, 0}
};
-static void
-set_background (void)
-{
- if (GdmBackgroundType != GDM_BACKGROUND_NONE) {
- GdkColor color;
- GdkColormap *colormap;
-
- if (ve_string_empty (GdmBackgroundColor) ||
- ! gdk_color_parse (GdmBackgroundColor, &color)) {
- gdk_color_parse ("#007777", &color);
- }
-
- colormap = gdk_drawable_get_colormap
- (gdk_get_default_root_window ());
- /* paranoia */
- if (colormap != NULL) {
- gboolean success;
- gdk_error_trap_push ();
-
- gdk_colormap_alloc_colors (colormap, &color, 1,
- FALSE, TRUE, &success);
-
- gdk_window_set_background (gdk_get_default_root_window (), &color);
- gdk_window_clear (gdk_get_default_root_window ());
-
- gdk_flush ();
- gdk_error_trap_pop ();
- }
- }
-}
-
static gboolean
gdm_event (GSignalInvocationHint *ihint,
guint n_param_values,
@@ -2088,10 +2050,6 @@ main (int argc, char *argv[])
exit (1);
}
- /* Should be a watch already, but just in case */
- if (RUNNING_UNDER_GDM)
- setup_cursor (GDK_WATCH);
-
glade_init();
config_file = gdm_common_get_config_file ();
@@ -2107,6 +2065,16 @@ main (int argc, char *argv[])
gdm_version = g_getenv ("GDM_VERSION");
+ /* Load the background as early as possible so GDM does not leave */
+ /* the background unfilled. The cursor should be a watch already */
+ /* but just in case */
+ if (RUNNING_UNDER_GDM) {
+ if (GdmBackgroundType != GDM_BACKGROUND_NONE)
+ setup_background_color (GdmBackgroundColor);
+
+ gdm_common_setup_cursor (GDK_WATCH);
+ }
+
if (RUNNING_UNDER_GDM &&
gdm_version != NULL &&
strcmp (gdm_version, VERSION) != 0) {
@@ -2134,7 +2102,7 @@ main (int argc, char *argv[])
gtk_widget_show_all (dialog);
gdm_wm_center_window (GTK_WINDOW (dialog));
- setup_cursor (GDK_LEFT_PTR);
+ gdm_common_setup_cursor (GDK_LEFT_PTR);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -2144,9 +2112,6 @@ main (int argc, char *argv[])
gdm_chooser_gui_init();
gdm_chooser_signals_init();
- if (RUNNING_UNDER_GDM)
- set_background ();
-
hosts = (char **)poptGetArgs (ctx);
/* when no hosts on the command line, take them from the config */
if (hosts == NULL ||
@@ -2192,7 +2157,7 @@ main (int argc, char *argv[])
if (RUNNING_UNDER_GDM) {
gdm_wm_restore_wm_order ();
- setup_cursor (GDK_LEFT_PTR);
+ gdm_common_setup_cursor (GDK_LEFT_PTR);
}
gtk_main();
diff --git a/gui/gdmcommon.c b/gui/gdmcommon.c
index 04d25642..b1837adc 100644
--- a/gui/gdmcommon.c
+++ b/gui/gdmcommon.c
@@ -348,3 +348,37 @@ gdm_common_select_time_format (VeConfig *config)
return TRUE;
}
+/* Not to look too shaby on Xinerama setups */
+void
+setup_background_color (gchar *bg_color)
+{
+ GdkColormap *colormap;
+ GdkColor color;
+
+ if (bg_color == NULL ||
+ bg_color[0] == '\0' ||
+ ! gdk_color_parse (bg_color, &color))
+ {
+ gdk_color_parse ("#007777", &color);
+ }
+
+ g_free (bg_color);
+
+ colormap = gdk_drawable_get_colormap
+ (gdk_get_default_root_window ());
+ /* paranoia */
+ if (colormap != NULL)
+ {
+ gboolean success;
+ gdk_error_trap_push ();
+
+ gdk_colormap_alloc_colors (colormap, &color, 1,
+ FALSE, TRUE, &success);
+ gdk_window_set_background (gdk_get_default_root_window (), &color);
+ gdk_window_clear (gdk_get_default_root_window ());
+
+ gdk_flush ();
+ gdk_error_trap_pop ();
+ }
+}
+
diff --git a/gui/gdmcommon.h b/gui/gdmcommon.h
index e3e94acb..570fafd9 100644
--- a/gui/gdmcommon.h
+++ b/gui/gdmcommon.h
@@ -65,4 +65,6 @@ gchar* gdm_common_get_config_file (void);
gboolean gdm_common_select_time_format (VeConfig *config);
+void setup_background_color (gchar *bg_color);
+
#endif /* GDM_COMMON_H */
diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c
index 3ad48aa9..71bc7833 100644
--- a/gui/gdmlogin.c
+++ b/gui/gdmlogin.c
@@ -177,7 +177,6 @@ static gboolean require_quarter = FALSE;
static GtkWidget *icon_win = NULL;
static GtkWidget *sessmenu;
static GtkWidget *langmenu;
-static GtkTooltips *tooltips;
static gboolean login_is_local = FALSE;
static gboolean used_defaults = FALSE;
@@ -1446,11 +1445,6 @@ gdm_login_session_init (GtkWidget *menu)
G_CALLBACK (gdm_login_session_handler),
NULL);
gtk_widget_show (GTK_WIDGET (item));
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Log in using the session that you have used "
- "last time you logged in"),
- NULL);
-
item = gtk_menu_item_new();
gtk_widget_set_sensitive (item, FALSE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -1479,10 +1473,6 @@ gdm_login_session_init (GtkWidget *menu)
g_object_set_data_full (G_OBJECT (item), SESSION_NAME,
g_strdup (file), (GDestroyNotify) g_free);
- if ( ! ve_string_empty (session->comment))
- gtk_tooltips_set_tip
- (tooltips, GTK_WIDGET (item), session->comment, NULL);
-
sessgrp = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (G_OBJECT (item), "activate",
@@ -1573,10 +1563,6 @@ gdm_login_language_menu_new (void)
g_object_set_data (G_OBJECT (item),
"Language",
LAST_LANGUAGE);
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Log in using the language that you have used "
- "last time you logged in"),
- NULL);
item = gtk_radio_menu_item_new_with_mnemonic (languages, _("_System Default"));
languages = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
@@ -1588,9 +1574,6 @@ gdm_login_language_menu_new (void)
g_object_set_data (G_OBJECT (item),
"Language",
DEFAULT_LANGUAGE);
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Log in using the default system language"),
- NULL);
item = gtk_menu_item_new();
gtk_widget_set_sensitive (item, FALSE);
@@ -1808,8 +1791,6 @@ gdm_login_theme_menu_new (void)
gtk_widget_show (GTK_WIDGET (item));
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (gdm_theme_handler), theme_name);
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item), _(theme_name), NULL);
-
g_free (menu_item_name);
}
g_slist_free (theme_list);
@@ -2853,11 +2834,6 @@ gdm_login_gui_init (void)
G_CALLBACK (gdm_login_use_chooser_handler),
NULL);
gtk_widget_show (item);
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Run an XDMCP chooser which will allow "
- "you to log into available remote "
- "computers, if there are any."),
- NULL);
got_anything = TRUE;
}
@@ -2869,10 +2845,6 @@ gdm_login_gui_init (void)
G_CALLBACK (gdm_run_gdmconfig),
NULL);
gtk_widget_show (item);
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Configure GDM (this login manager). "
- "This will require the root password."),
- NULL);
got_anything = TRUE;
}
@@ -2883,9 +2855,6 @@ gdm_login_gui_init (void)
G_CALLBACK (gdm_login_restart_handler),
NULL);
gtk_widget_show (GTK_WIDGET (item));
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Restart your computer"),
- NULL);
got_anything = TRUE;
}
@@ -2896,10 +2865,6 @@ gdm_login_gui_init (void)
G_CALLBACK (gdm_login_halt_handler),
NULL);
gtk_widget_show (GTK_WIDGET (item));
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Shut down the system so that "
- "you may safely turn off the computer."),
- NULL);
got_anything = TRUE;
}
@@ -2910,9 +2875,6 @@ gdm_login_gui_init (void)
G_CALLBACK (gdm_login_suspend_handler),
NULL);
gtk_widget_show (GTK_WIDGET (item));
- gtk_tooltips_set_tip (tooltips, GTK_WIDGET (item),
- _("Suspend your computer"),
- NULL);
got_anything = TRUE;
}
@@ -3423,29 +3385,7 @@ setup_background (void)
}
/* Load background color */
} else if (GdmBackgroundType != GDM_BACKGROUND_NONE) {
- GdkColormap *colormap;
-
- if (GdmBackgroundColor == NULL ||
- GdmBackgroundColor[0] == '\0' ||
- ! gdk_color_parse (GdmBackgroundColor, &color)) {
- gdk_color_parse ("#007777", &color);
- }
-
- colormap = gdk_drawable_get_colormap
- (gdk_get_default_root_window ());
- /* paranoia */
- if (colormap != NULL) {
- gboolean success;
- gdk_error_trap_push ();
-
- gdk_colormap_alloc_colors (colormap, &color, 1,
- FALSE, TRUE, &success);
- gdk_window_set_background (gdk_get_default_root_window (), &color);
- gdk_window_clear (gdk_get_default_root_window ());
-
- gdk_flush ();
- gdk_error_trap_pop ();
- }
+ setup_background_color (GdmBackgroundColor);
}
}
@@ -3650,9 +3590,6 @@ main (int argc, char *argv[])
gtk_init (&argc, &argv);
- /* Should be a watch already, but just in case */
- gdm_common_setup_cursor (GDK_WATCH);
-
config_file = gdm_common_get_config_file ();
if (config_file == NULL) {
g_print (_("Could not access GDM configuration file.\n"));
@@ -3663,13 +3600,17 @@ main (int argc, char *argv[])
setlocale (LC_ALL, "");
- tooltips = gtk_tooltips_new ();
-
gdm_wm_screen_init (GdmXineramaScreen);
gdm_version = g_getenv ("GDM_VERSION");
gdm_protocol_version = g_getenv ("GDM_GREETER_PROTOCOL_VERSION");
+ /* Load the background as early as possible so GDM does not leave */
+ /* the background unfilled. The cursor should be a watch already */
+ /* but just in case */
+ setup_background ();
+ gdm_common_setup_cursor (GDK_WATCH);
+
if ( ! DOING_GDM_DEVELOPMENT &&
((gdm_protocol_version != NULL &&
strcmp (gdm_protocol_version, GDM_GREETER_PROTOCOL_VERSION) != 0) ||
@@ -3869,8 +3810,6 @@ main (int argc, char *argv[])
gdm_common_abort (_("Could not set signal mask!"));
}
- /* Load the background stuff, the image and program */
- setup_background ();
g_atexit (gdm_kill_thingies);
back_prog_launch_after_timeout ();
diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c
index f9c7e913..9a1417c4 100644
--- a/gui/greeter/greeter.c
+++ b/gui/greeter/greeter.c
@@ -1145,42 +1145,6 @@ get_theme_file (const char *in, char **theme_dir)
return file;
}
-/* Not to look too shaby on Xinerama setups */
-static void
-setup_background_color (void)
-{
- GdkColormap *colormap;
- GdkColor color;
- VeConfig *config = ve_config_get (config_file);
- char *bg_color = ve_config_get_string (config, GDM_KEY_BACKGROUNDCOLOR);
-
- if (bg_color == NULL ||
- bg_color[0] == '\0' ||
- ! gdk_color_parse (bg_color, &color))
- {
- gdk_color_parse ("#007777", &color);
- }
-
- g_free (bg_color);
-
- colormap = gdk_drawable_get_colormap
- (gdk_get_default_root_window ());
- /* paranoia */
- if (colormap != NULL)
- {
- gboolean success;
- gdk_error_trap_push ();
-
- gdk_colormap_alloc_colors (colormap, &color, 1,
- FALSE, TRUE, &success);
- gdk_window_set_background (gdk_get_default_root_window (), &color);
- gdk_window_clear (gdk_get_default_root_window ());
-
- gdk_flush ();
- gdk_error_trap_pop ();
- }
-}
-
/* The reaping stuff */
static time_t last_reap_delay = 0;
@@ -1259,6 +1223,8 @@ gdm_event (GSignalInvocationHint *ihint,
int
main (int argc, char *argv[])
{
+ VeConfig *config;
+ char *bg_color;
struct sigaction hup;
struct sigaction term;
sigset_t mask;
@@ -1312,6 +1278,12 @@ main (int argc, char *argv[])
if (r != 0)
return r;
+ /* Load the background as early as possible so GDM does not leave */
+ /* the background unfilled. The cursor should be a watch already */
+ /* but just in case */
+ config = ve_config_get (config_file);
+ bg_color = ve_config_get_string (config, GDM_KEY_BACKGROUNDCOLOR);
+ setup_background_color (bg_color);
greeter_session_init ();
ve_signal_add (SIGHUP, greeter_reread_config, NULL);
@@ -1545,8 +1517,6 @@ main (int argc, char *argv[])
gtk_window_move (GTK_WINDOW (window), gdm_wm_screen.x, gdm_wm_screen.y);
gtk_widget_show_now (window);
- setup_background_color ();
-
/* can it ever happen that it'd be NULL here ??? */
if G_UNLIKELY (window->window != NULL)
{