gdm r5914 - in trunk: . gui/user-switch-applet
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r5914 - in trunk: . gui/user-switch-applet
- Date: Mon, 3 Mar 2008 16:32:38 +0000 (GMT)
Author: mccann
Date: Mon Mar 3 16:32:37 2008
New Revision: 5914
URL: http://svn.gnome.org/viewvc/gdm?rev=5914&view=rev
Log:
2008-03-03 William Jon McCann <jmccann redhat com>
* gui/user-switch-applet/gdm-user-menu-item.c: (reset_icon),
(reset_sensitivity), (on_user_notify), (on_user_icon_changed),
(on_user_sessions_changed), (_gdm_user_menu_item_set_user):
Desensitize the current user.
Modified:
trunk/ChangeLog
trunk/gui/user-switch-applet/gdm-user-menu-item.c
Modified: trunk/gui/user-switch-applet/gdm-user-menu-item.c
==============================================================================
--- trunk/gui/user-switch-applet/gdm-user-menu-item.c (original)
+++ trunk/gui/user-switch-applet/gdm-user-menu-item.c Mon Mar 3 16:32:37 2008
@@ -84,8 +84,9 @@
{
GdkPixbuf *pixbuf;
- if (!item->user || !gtk_widget_has_screen (GTK_WIDGET (item)))
+ if (item->user == NULL || !gtk_widget_has_screen (GTK_WIDGET (item))) {
return;
+ }
g_assert (item->icon_size != 0);
@@ -97,33 +98,49 @@
}
static void
-user_notify_cb (GObject *object,
- GParamSpec *pspec,
- gpointer data)
+reset_sensitivity (GdmUserMenuItem *item)
{
- if (!pspec || !pspec->name)
+ if (item->user == NULL) {
return;
+ }
- if (strcmp (pspec->name, "user-name") == 0 ||
- strcmp (pspec->name, "display-name") == 0)
- reset_label (data);
+ if (gdm_user_get_uid (item->user) == getuid ()) {
+ gtk_widget_set_sensitive (item, (gdm_user_get_num_sessions (item->user) > 1));
+ } else {
+ gtk_widget_set_sensitive (item, TRUE);
+ }
+}
+
+static void
+on_user_notify (GObject *object,
+ GParamSpec *pspec,
+ GdmUserMenuItem *item)
+{
+ if (!pspec || !pspec->name) {
+ return;
+ }
+
+ if (strcmp (pspec->name, "user-name") == 0
+ || strcmp (pspec->name, "display-name") == 0) {
+ reset_label (item);
+ }
}
static void
-user_icon_changed_cb (GdmUser *user,
- gpointer data)
+on_user_icon_changed (GdmUser *user,
+ GdmUserMenuItem *item)
{
- if (gtk_widget_has_screen (data))
- reset_icon (data);
+ if (gtk_widget_has_screen (item)) {
+ reset_icon (item);
+ }
}
static void
-user_sessions_changed_cb (GdmUser *user,
- gpointer data)
+on_user_sessions_changed (GdmUser *user,
+ GdmUserMenuItem *item)
{
- if (gdm_user_get_uid (user) == getuid ())
- gtk_widget_set_sensitive (data, (gdm_user_get_num_sessions (user) > 1));
+ reset_sensitivity (item);
}
static void
@@ -132,17 +149,24 @@
{
item->user = user;
g_object_weak_ref (G_OBJECT (item->user), user_weak_notify, item);
- item->user_notify_id = g_signal_connect (item->user, "notify",
- G_CALLBACK (user_notify_cb), item);
- item->user_icon_changed_id = g_signal_connect (item->user, "icon-changed",
- G_CALLBACK (user_icon_changed_cb), item);
- item->user_sessions_changed_id = g_signal_connect (item->user, "sessions-changed",
- G_CALLBACK (user_sessions_changed_cb), item);
+ item->user_notify_id = g_signal_connect (item->user,
+ "notify",
+ G_CALLBACK (on_user_notify),
+ item);
+ item->user_icon_changed_id = g_signal_connect (item->user,
+ "icon-changed",
+ G_CALLBACK (on_user_icon_changed),
+ item);
+ item->user_sessions_changed_id = g_signal_connect (item->user,
+ "sessions-changed",
+ G_CALLBACK (on_user_sessions_changed),
+ item);
if (gtk_widget_get_style (GTK_WIDGET (item))) {
reset_icon (item);
reset_label (item);
}
+ reset_sensitivity (item);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]