gdm r6082 - in trunk: . gui/user-switch-applet po



Author: mccann
Date: Tue Apr  1 00:59:12 2008
New Revision: 6082
URL: http://svn.gnome.org/viewvc/gdm?rev=6082&view=rev

Log:

2008-03-31  William Jon McCann  <jmccann redhat com>

	* gui/user-switch-applet/Makefile.am:
	* gui/user-switch-applet/gdm-user-switch-applet.glade:
	Remove some unused glade stuff.
	* gui/user-switch-applet/gdm-user-menu-item.c: (reset_sensitivity),
	(on_user_icon_changed):
	Fix some warnings.
	* gui/user-switch-applet/applet.c: (user_sessions_changed_cb),
	(maybe_add_user), (manager_user_added_cb), (fill_applet):
	Until we add support to GDM for preselecting the user during
	FUS we should only display the currently logged in users in the applet.



Removed:
   trunk/gui/user-switch-applet/gdm-user-switch-applet.glade
Modified:
   trunk/ChangeLog
   trunk/gui/user-switch-applet/Makefile.am
   trunk/gui/user-switch-applet/applet.c
   trunk/gui/user-switch-applet/gdm-user-menu-item.c
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/gui/user-switch-applet/Makefile.am
==============================================================================
--- trunk/gui/user-switch-applet/Makefile.am	(original)
+++ trunk/gui/user-switch-applet/Makefile.am	Tue Apr  1 00:59:12 2008
@@ -8,7 +8,7 @@
 	-DSYSCONFDIR=\""$(sysconfdir)"\"		\
 	-DLIBLOCALEDIR=\""$(prefix)/lib/locale"\"	\
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
-	-DGLADEDIR=\""$(pkgdatadir)"\" 	\
+	-DGLADEDIR=\""$(pkgdatadir)"\" 			\
 	-DLIBEXECDIR=\""$(libexecdir)"\" 		\
 	-DSBINDIR=\""$(sbindir)"\"		 	\
 	$(GTK_CFLAGS)					\
@@ -31,11 +31,6 @@
 	$(APPLET_LIBS)					\
 	$(NULL)
 
-gladedir = $(pkgdatadir)
-glade_DATA = 				\
-	gdm-user-switch-applet.glade	\
-	$(NULL)
-
 # Bonobo UI
 uidir =	$(datadir)/gnome-2.0/ui
 ui_DATA =					\
@@ -55,7 +50,6 @@
 @INTLTOOL_SERVER_RULE@
 
 EXTRA_DIST = 			\
-	$(glade_DATA)		\
 	$(ui_DATA)		\
 	GNOME_FastUserSwitchApplet.server.in.in	\
 	$(NULL)

Modified: trunk/gui/user-switch-applet/applet.c
==============================================================================
--- trunk/gui/user-switch-applet/applet.c	(original)
+++ trunk/gui/user-switch-applet/applet.c	Tue Apr  1 00:59:12 2008
@@ -60,6 +60,8 @@
         GtkWidget      *login_screen_item;
         GSList         *items;
 
+        gboolean        active_only;
+
         guint           client_notify_lockdown_id;
         guint           user_notify_id;
         GQuark          user_menu_item_quark;
@@ -104,33 +106,6 @@
         }
 }
 
-static GladeXML *
-get_glade_xml (const char *root)
-{
-        GladeXML *xml;
-
-        xml = glade_xml_new (GLADEDIR "/gdm-user-switch-applet.glade", root, NULL);
-
-        if (xml == NULL) {
-                GtkWidget *dialog;
-
-                dialog = gtk_message_dialog_new (NULL,
-                                                 0,
-                                                 GTK_MESSAGE_ERROR,
-                                                 GTK_BUTTONS_CLOSE,
-                                                 _("Missing Required File"));
-                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                          _("The User Selector's interfaces file, `%s', could not be opened. It is likely that this application was not properly installed or configured."),
-                                                          GLADEDIR "/gdm-user-switch-applet.glade");
-                gtk_dialog_run (GTK_DIALOG (dialog));
-                gtk_widget_destroy (dialog);
-                bonobo_main_quit ();
-                return NULL;
-        }
-
-        return xml;
-}
-
 /*
  * gnome-panel/applets/wncklet/window-menu.c:window_filter_button_press()
  *
@@ -855,12 +830,27 @@
 {
         GtkWidget *menuitem;
 
+        g_debug ("Sessions changed for %s", gdm_user_get_user_name (user));
+
         menuitem = g_object_get_qdata (G_OBJECT (user), adata->user_menu_item_quark);
         if (menuitem == NULL) {
                 return;
         }
 
-        gtk_widget_show (menuitem);
+        if (adata->active_only) {
+                guint num_sessions;
+
+                num_sessions = gdm_user_get_num_sessions (user);
+                g_debug ("Sessions changed for %s num=%u", gdm_user_get_user_name (user), num_sessions);
+
+                if (num_sessions > 0) {
+                        gtk_widget_show (menuitem);
+                } else {
+                        gtk_widget_hide (menuitem);
+                }
+        } else {
+                gtk_widget_show (menuitem);
+        }
 
         sort_menu (adata);
 }
@@ -896,13 +886,32 @@
                           adata);
 }
 
+static gboolean
+maybe_add_user (GdmAppletData  *adata,
+                GdmUser        *user)
+{
+        if (adata->active_only) {
+                guint num_sessions;
+
+                num_sessions = gdm_user_get_num_sessions (user);
+                if (num_sessions < 1) {
+                        return FALSE;
+                }
+        }
+
+        add_user (adata, user);
+
+        return TRUE;
+}
+
 static void
 manager_user_added_cb (GdmUserManager *manager,
                        GdmUser        *user,
                        GdmAppletData  *adata)
 {
-        add_user (adata, user);
-        sort_menu (adata);
+        if (maybe_add_user (adata, user)) {
+                sort_menu (adata);
+        }
 }
 
 static void
@@ -983,6 +992,9 @@
         adata = g_new0 (GdmAppletData, 1);
         adata->applet = applet;
 
+        /* Until we add user selecting to GDM */
+        adata->active_only = TRUE;
+
         adata->client = gconf_client_get_default ();
         adata->manager = gdm_user_manager_ref_default ();
 
@@ -1127,7 +1139,7 @@
          */
         users = gdm_user_manager_list_users (adata->manager);
         while (users != NULL) {
-                add_user (adata, users->data);
+                maybe_add_user (adata, users->data);
 
                 users = g_slist_delete_link (users, users);
         }

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	Tue Apr  1 00:59:12 2008
@@ -105,9 +105,10 @@
         }
 
         if (gdm_user_get_uid (item->user) == getuid ()) {
-                gtk_widget_set_sensitive (item, (gdm_user_get_num_sessions (item->user) > 1));
+                gtk_widget_set_sensitive (GTK_WIDGET (item),
+                                          (gdm_user_get_num_sessions (item->user) > 1));
         } else {
-                gtk_widget_set_sensitive (item, TRUE);
+                gtk_widget_set_sensitive (GTK_WIDGET(item), TRUE);
         }
 }
 
@@ -131,7 +132,7 @@
 on_user_icon_changed (GdmUser         *user,
                       GdmUserMenuItem *item)
 {
-        if (gtk_widget_has_screen (item)) {
+        if (gtk_widget_has_screen (GTK_WIDGET (item))) {
                 reset_icon (item);
         }
 }

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Apr  1 00:59:12 2008
@@ -75,7 +75,6 @@
 gui/simple-greeter/greeter-main.c
 gui/user-switch-applet/applet.c
 gui/user-switch-applet/gdm-user-menu-item.c
-gui/user-switch-applet/gdm-user-switch-applet.glade
 gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
 gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
 utils/gdmflexiserver.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]