gdm r6391 - in trunk: . gui/simple-greeter
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6391 - in trunk: . gui/simple-greeter
- Date: Tue, 19 Aug 2008 17:25:39 +0000 (UTC)
Author: mccann
Date: Tue Aug 19 17:25:39 2008
New Revision: 6391
URL: http://svn.gnome.org/viewvc/gdm?rev=6391&view=rev
Log:
2008-08-19 William Jon McCann <jmccann redhat com>
* gui/simple-greeter/gdm-chooser-widget.c (activate_if_one_item),
(_grab_focus), (on_grow_animation_complete),
(skip_resize_animation), (gdm_chooser_widget_show),
(gdm_chooser_widget_focus), (gdm_chooser_widget_focus_in_event):
* gui/simple-greeter/gdm-greeter-login-window.c (set_focus):
* gui/simple-greeter/gdm-user-chooser-widget.c (add_user),
(on_user_added), (on_user_removed), (on_user_is_logged_in_changed),
(on_user_login_frequency_changed), (on_users_loaded),
(gdm_user_chooser_widget_constructor),
(gdm_user_chooser_widget_class_init),
(gdm_user_chooser_widget_init):
Don't load the user manager if local users are disabled.
Fix focus handling.
Modified:
trunk/ChangeLog
trunk/gui/simple-greeter/gdm-chooser-widget.c
trunk/gui/simple-greeter/gdm-greeter-login-window.c
trunk/gui/simple-greeter/gdm-user-chooser-widget.c
Modified: trunk/gui/simple-greeter/gdm-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-chooser-widget.c (original)
+++ trunk/gui/simple-greeter/gdm-chooser-widget.c Tue Aug 19 17:25:39 2008
@@ -87,7 +87,6 @@
guint update_idle_id;
guint timer_animation_timeout_id;
- guint activate_idle_id;
guint32 should_hide_inactive_items : 1;
guint32 emit_activated_after_resize_animation : 1;
@@ -599,12 +598,11 @@
{
char *id;
- widget->priv->activate_idle_id = 0;
-
if (gdm_chooser_widget_get_number_of_items (widget) != 1) {
return FALSE;
}
+ g_debug ("GdmChooserWidget: activating single item");
id = get_first_item (widget);
gdm_chooser_widget_set_active_item (widget, id);
g_free (id);
@@ -613,6 +611,26 @@
}
static void
+_grab_focus (GtkWidget *widget)
+{
+ GtkWidget *foc_widget;
+
+ foc_widget = GDM_CHOOSER_WIDGET (widget)->priv->items_view;
+ g_debug ("GdmChooserWidget: grabbing focus");
+ if (! GTK_WIDGET_REALIZED (foc_widget)) {
+ g_debug ("GdmChooserWidget: not grabbing focus - not realized");
+ return;
+ }
+
+ if (GTK_WIDGET_HAS_FOCUS (foc_widget)) {
+ g_debug ("GdmChooserWidget: not grabbing focus - already has it");
+ return;
+ }
+
+ gtk_widget_grab_focus (foc_widget);
+}
+
+static void
on_grow_animation_complete (GdmScrollableWidget *scrollable_widget,
GdmChooserWidget *widget)
{
@@ -621,7 +639,7 @@
widget->priv->was_fully_grown = TRUE;
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (widget->priv->items_view), TRUE);
- gtk_widget_grab_focus (GTK_WIDGET (widget));
+ _grab_focus (GTK_WIDGET (widget));
}
static int
@@ -724,7 +742,7 @@
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (widget->priv->items_view), TRUE);
widget->priv->state = GDM_CHOOSER_WIDGET_STATE_GROWN;
widget->priv->was_fully_grown = FALSE;
- gtk_widget_grab_focus (GTK_WIDGET (widget));
+ _grab_focus (GTK_WIDGET (widget));
}
}
@@ -1029,6 +1047,7 @@
gdm_chooser_widget_show (GtkWidget *widget)
{
skip_resize_animation (GDM_CHOOSER_WIDGET (widget));
+
GTK_WIDGET_CLASS (gdm_chooser_widget_parent_class)->show (widget);
}
@@ -1062,10 +1081,12 @@
* 2) if it doesn't already have focus, then grab it
*/
if (GTK_CONTAINER (widget)->focus_child != NULL) {
+ g_debug ("GdmChooserWidget: not focusing - focus child not null");
return FALSE;
}
- gtk_widget_grab_focus (GDM_CHOOSER_WIDGET (widget)->priv->items_view);
+ _grab_focus (widget);
+
return TRUE;
}
@@ -1076,7 +1097,7 @@
/* We don't ever want the chooser widget itself to have focus.
* Focus should always go to the tree view.
*/
- gtk_widget_grab_focus (GDM_CHOOSER_WIDGET (widget)->priv->items_view);
+ _grab_focus (widget);
return FALSE;
}
Modified: trunk/gui/simple-greeter/gdm-greeter-login-window.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-login-window.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-login-window.c Tue Aug 19 17:25:39 2008
@@ -129,7 +129,6 @@
char *timed_login_username;
guint timed_login_timeout_id;
- guint animation_timeout_id;
guint sensitize_power_buttons_timeout_id;
guint login_button_handler_id;
@@ -243,6 +242,8 @@
if (GTK_WIDGET_REALIZED (entry) && ! GTK_WIDGET_HAS_FOCUS (entry)) {
gtk_widget_grab_focus (entry);
+ } else if (GTK_WIDGET_REALIZED (login_window->priv->user_chooser) && ! GTK_WIDGET_HAS_FOCUS (login_window->priv->user_chooser)) {
+ gtk_widget_grab_focus (login_window->priv->user_chooser);
}
}
Modified: trunk/gui/simple-greeter/gdm-user-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-user-chooser-widget.c (original)
+++ trunk/gui/simple-greeter/gdm-user-chooser-widget.c Tue Aug 19 17:25:39 2008
@@ -257,25 +257,182 @@
return result;
}
+static void
+add_user (GdmUserChooserWidget *widget,
+ GdmUser *user)
+{
+ GdkPixbuf *pixbuf;
+ char *tooltip;
+ gboolean is_logged_in;
+
+ if (!widget->priv->show_normal_users) {
+ return;
+ }
+
+ pixbuf = gdm_user_render_icon (user, ICON_SIZE);
+ if (pixbuf == NULL && widget->priv->stock_person_pixbuf != NULL) {
+ pixbuf = g_object_ref (widget->priv->stock_person_pixbuf);
+ }
+
+ tooltip = g_strdup_printf (_("Log in as %s"),
+ gdm_user_get_user_name (user));
+
+ is_logged_in = gdm_user_get_num_sessions (user) > 0;
+
+ g_debug ("GdmUserChooserWidget: User added name:%s logged-in:%d pixbuf:%p",
+ gdm_user_get_user_name (user),
+ is_logged_in,
+ pixbuf);
+
+ gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
+ gdm_user_get_user_name (user),
+ pixbuf,
+ gdm_user_get_real_name (user),
+ tooltip,
+ gdm_user_get_login_frequency (user),
+ is_logged_in,
+ FALSE);
+ g_free (tooltip);
+
+ if (pixbuf != NULL) {
+ g_object_unref (pixbuf);
+ }
+}
+
+static void
+on_user_added (GdmUserManager *manager,
+ GdmUser *user,
+ GdmUserChooserWidget *widget)
+{
+ /* wait for all users to be loaded */
+ if (! widget->priv->loaded) {
+ return;
+ }
+ add_user (widget, user);
+}
+
+static void
+on_user_removed (GdmUserManager *manager,
+ GdmUser *user,
+ GdmUserChooserWidget *widget)
+{
+ const char *user_name;
+
+ g_debug ("GdmUserChooserWidget: User removed: %s", gdm_user_get_user_name (user));
+ /* wait for all users to be loaded */
+ if (! widget->priv->loaded) {
+ return;
+ }
+
+ user_name = gdm_user_get_user_name (user);
+
+ gdm_chooser_widget_remove_item (GDM_CHOOSER_WIDGET (widget),
+ user_name);
+}
+
+static void
+on_user_is_logged_in_changed (GdmUserManager *manager,
+ GdmUser *user,
+ GdmUserChooserWidget *widget)
+{
+ const char *user_name;
+ gboolean is_logged_in;
+
+ g_debug ("GdmUserChooserWidget: User logged in changed: %s", gdm_user_get_user_name (user));
+
+ user_name = gdm_user_get_user_name (user);
+ is_logged_in = gdm_user_get_num_sessions (user) > 0;
+
+ gdm_chooser_widget_set_item_in_use (GDM_CHOOSER_WIDGET (widget),
+ user_name,
+ is_logged_in);
+}
+
+static void
+on_user_login_frequency_changed (GdmUserManager *manager,
+ GdmUser *user,
+ GdmUserChooserWidget *widget)
+{
+ const char *user_name;
+ gulong freq;
+
+ g_debug ("GdmUserChooserWidget: User login frequency changed: %s", gdm_user_get_user_name (user));
+
+ user_name = gdm_user_get_user_name (user);
+ freq = gdm_user_get_login_frequency (user);
+
+ gdm_chooser_widget_set_item_priority (GDM_CHOOSER_WIDGET (widget),
+ user_name,
+ freq);
+}
+
+static void
+on_users_loaded (GdmUserManager *manager,
+ GdmUserChooserWidget *widget)
+{
+ GSList *users;
+
+ widget->priv->loaded = TRUE;
+
+ g_debug ("GdmUserChooserWidget: Users loaded");
+
+ users = gdm_user_manager_list_users (manager);
+ while (users != NULL) {
+ add_user (widget, users->data);
+ users = g_slist_delete_link (users, users);
+ }
+
+ gtk_widget_grab_focus (GTK_WIDGET (widget));
+ gdm_chooser_widget_activate_on_one_item (GDM_CHOOSER_WIDGET (widget),
+ TRUE);
+}
+
static GObject *
gdm_user_chooser_widget_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
- GdmUserChooserWidget *user_chooser_widget;
+ GdmUserChooserWidget *widget;
- user_chooser_widget = GDM_USER_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->constructor (type,
+ widget = GDM_USER_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_user_chooser_widget_parent_class)->constructor (type,
n_construct_properties,
construct_properties));
/* FIXME: make these construct properties */
- gdm_user_chooser_widget_set_show_guest_user (user_chooser_widget, FALSE);
- gdm_user_chooser_widget_set_show_auto_user (user_chooser_widget, FALSE);
- gdm_user_chooser_widget_set_show_other_user (user_chooser_widget, TRUE);
-
- user_chooser_widget->priv->show_normal_users = !is_user_list_disabled (user_chooser_widget);
+ gdm_user_chooser_widget_set_show_guest_user (widget, FALSE);
+ gdm_user_chooser_widget_set_show_auto_user (widget, FALSE);
+ gdm_user_chooser_widget_set_show_other_user (widget, TRUE);
+
+ widget->priv->show_normal_users = !is_user_list_disabled (widget);
+
+ if (widget->priv->show_normal_users) {
+ widget->priv->manager = gdm_user_manager_ref_default ();
+ g_signal_connect (widget->priv->manager,
+ "user-added",
+ G_CALLBACK (on_user_added),
+ widget);
+ g_signal_connect (widget->priv->manager,
+ "user-removed",
+ G_CALLBACK (on_user_removed),
+ widget);
+ g_signal_connect (widget->priv->manager,
+ "users-loaded",
+ G_CALLBACK (on_users_loaded),
+ widget);
+ g_signal_connect (widget->priv->manager,
+ "user-is-logged-in-changed",
+ G_CALLBACK (on_user_is_logged_in_changed),
+ widget);
+ g_signal_connect (widget->priv->manager,
+ "user-login-frequency-changed",
+ G_CALLBACK (on_user_login_frequency_changed),
+ widget);
+ } else {
+ gdm_chooser_widget_activate_on_one_item (GDM_CHOOSER_WIDGET (widget),
+ TRUE);
+ }
- return G_OBJECT (user_chooser_widget);
+ return G_OBJECT (widget);
}
static void
@@ -301,7 +458,8 @@
static void
gdm_user_chooser_widget_class_init (GdmUserChooserWidgetClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
object_class->get_property = gdm_user_chooser_widget_get_property;
object_class->set_property = gdm_user_chooser_widget_set_property;
object_class->constructor = gdm_user_chooser_widget_constructor;
@@ -415,136 +573,6 @@
}
static void
-add_user (GdmUserChooserWidget *widget,
- GdmUser *user)
-{
- GdkPixbuf *pixbuf;
- char *tooltip;
- gboolean is_logged_in;
-
- if (!widget->priv->show_normal_users) {
- return;
- }
-
- pixbuf = gdm_user_render_icon (user, ICON_SIZE);
- if (pixbuf == NULL && widget->priv->stock_person_pixbuf != NULL) {
- pixbuf = g_object_ref (widget->priv->stock_person_pixbuf);
- }
-
- tooltip = g_strdup_printf (_("Log in as %s"),
- gdm_user_get_user_name (user));
-
- is_logged_in = gdm_user_get_num_sessions (user) > 0;
-
- g_debug ("GdmUserChooserWidget: User added name:%s logged-in:%d pixbuf:%p",
- gdm_user_get_user_name (user),
- is_logged_in,
- pixbuf);
-
- gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
- gdm_user_get_user_name (user),
- pixbuf,
- gdm_user_get_real_name (user),
- tooltip,
- gdm_user_get_login_frequency (user),
- is_logged_in,
- FALSE);
- g_free (tooltip);
-
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
-}
-
-static void
-on_users_loaded (GdmUserManager *manager,
- GdmUserChooserWidget *widget)
-{
- GSList *users;
-
- widget->priv->loaded = TRUE;
-
- g_debug ("GdmUserChooserWidget: Users loaded");
-
- users = gdm_user_manager_list_users (manager);
- while (users != NULL) {
- add_user (widget, users->data);
- users = g_slist_delete_link (users, users);
- }
-
- gtk_widget_grab_focus (widget);
- gdm_chooser_widget_activate_on_one_item (GDM_CHOOSER_WIDGET (widget),
- TRUE);
-}
-
-static void
-on_user_added (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- /* wait for all users to be loaded */
- if (! widget->priv->loaded) {
- return;
- }
- add_user (widget, user);
-}
-
-static void
-on_user_removed (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- const char *user_name;
-
- g_debug ("GdmUserChooserWidget: User removed: %s", gdm_user_get_user_name (user));
- /* wait for all users to be loaded */
- if (! widget->priv->loaded) {
- return;
- }
-
- user_name = gdm_user_get_user_name (user);
-
- gdm_chooser_widget_remove_item (GDM_CHOOSER_WIDGET (widget),
- user_name);
-}
-
-static void
-on_user_is_logged_in_changed (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- const char *user_name;
- gboolean is_logged_in;
-
- g_debug ("GdmUserChooserWidget: User logged in changed: %s", gdm_user_get_user_name (user));
-
- user_name = gdm_user_get_user_name (user);
- is_logged_in = gdm_user_get_num_sessions (user) > 0;
-
- gdm_chooser_widget_set_item_in_use (GDM_CHOOSER_WIDGET (widget),
- user_name,
- is_logged_in);
-}
-
-static void
-on_user_login_frequency_changed (GdmUserManager *manager,
- GdmUser *user,
- GdmUserChooserWidget *widget)
-{
- const char *user_name;
- gulong freq;
-
- g_debug ("GdmUserChooserWidget: User login frequency changed: %s", gdm_user_get_user_name (user));
-
- user_name = gdm_user_get_user_name (user);
- freq = gdm_user_get_login_frequency (user);
-
- gdm_chooser_widget_set_item_priority (GDM_CHOOSER_WIDGET (widget),
- user_name,
- freq);
-}
-
-static void
gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
{
widget->priv = GDM_USER_CHOOSER_WIDGET_GET_PRIVATE (widget);
@@ -554,28 +582,6 @@
gdm_chooser_widget_set_in_use_message (GDM_CHOOSER_WIDGET (widget),
_("Currently logged in"));
- widget->priv->manager = gdm_user_manager_ref_default ();
- g_signal_connect (widget->priv->manager,
- "user-added",
- G_CALLBACK (on_user_added),
- widget);
- g_signal_connect (widget->priv->manager,
- "user-removed",
- G_CALLBACK (on_user_removed),
- widget);
- g_signal_connect (widget->priv->manager,
- "users-loaded",
- G_CALLBACK (on_users_loaded),
- widget);
- g_signal_connect (widget->priv->manager,
- "user-is-logged-in-changed",
- G_CALLBACK (on_user_is_logged_in_changed),
- widget);
- g_signal_connect (widget->priv->manager,
- "user-login-frequency-changed",
- G_CALLBACK (on_user_login_frequency_changed),
- widget);
-
setup_icons (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]