gdm r5847 - in trunk: . daemon



Author: halfline
Date: Mon Feb 25 20:29:18 2008
New Revision: 5847
URL: http://svn.gnome.org/viewvc/gdm?rev=5847&view=rev

Log:
2008-02-25  Ray Strode  <rstrode redhat com>

	* daemon/gdm-session-private.h:
	* daemon/gdm-session.h:
	* daemon/gdm-session.c:
	(gdm_session_class_init),
	(_gdm_session_default_language_name_changed),
	(_gdm_session_default_session_name_changed),
	(_gdm_session_default_session_name_changed),
	* daemon/gdm-session-direct.c:
	(get_default_language_name),
	(get_default_session_name),
	(gdm_session_direct_defaults_changed),
	(gdm_session_direct_select_user),
	(gdm_session_direct_handle_username_changed),
	(gdm_session_direct_handle_saved_language),
	(gdm_session_direct_setup),
	(gdm_session_direct_setup_for_user),
	(get_language_name),
	(get_session_name):
	* daemon/gdm-simple-slave:
	(on_default_language_name_changed):
	(on_default_session_name_changed):
	(create_new_session):
	* daemon/gdm-greeter-server.[ch]:
	(gdm_greeter_server_default_language_name_changed),
	(gdm_greeter_server_default_session_name_changed),
	(do_introspect):
	Change "SavedLanguageNameRead"/"SavedSessionNameRead"
	to "DefaultLanguageNameChanged"/"DefaultSessionNameChanged"
	and call it with system fallbacks whenever a new user is
	authenticating before ~/.dmrc is read.


Modified:
   trunk/ChangeLog
   trunk/daemon/gdm-greeter-server.c
   trunk/daemon/gdm-greeter-server.h
   trunk/daemon/gdm-session-direct.c
   trunk/daemon/gdm-session-private.h
   trunk/daemon/gdm-session.c
   trunk/daemon/gdm-session.h
   trunk/daemon/gdm-simple-slave.c

Modified: trunk/daemon/gdm-greeter-server.c
==============================================================================
--- trunk/daemon/gdm-greeter-server.c	(original)
+++ trunk/daemon/gdm-greeter-server.c	Mon Feb 25 20:29:18 2008
@@ -223,17 +223,17 @@
 }
 
 void
-gdm_greeter_server_saved_language_name_read (GdmGreeterServer *greeter_server,
-                                             const char       *language_name)
+gdm_greeter_server_default_language_name_changed (GdmGreeterServer *greeter_server,
+                                                  const char       *language_name)
 {
-        send_dbus_string_signal (greeter_server, "SavedLanguageNameRead", language_name);
+        send_dbus_string_signal (greeter_server, "DefaultLanguageNameChanged", language_name);
 }
 
 void
-gdm_greeter_server_saved_session_name_read (GdmGreeterServer *greeter_server,
-                                            const char       *session_name)
+gdm_greeter_server_default_session_name_changed (GdmGreeterServer *greeter_server,
+                                                 const char       *session_name)
 {
-        send_dbus_string_signal (greeter_server, "SavedSessionNameRead", session_name);
+        send_dbus_string_signal (greeter_server, "DefaultSessionNameChanged", session_name);
 }
 
 /* Note: Use abstract sockets like dbus does by default on Linux. Abstract
@@ -611,10 +611,10 @@
                                "    <signal name=\"SelectedUserChanged\">\n"
                                "      <arg name=\"username\" type=\"s\"/>\n"
                                "    </signal>\n"
-                               "    <signal name=\"SavedLanguageNameRead\">\n"
+                               "    <signal name=\"DefaultLanguageNameChanged\">\n"
                                "      <arg name=\"language_name\" type=\"s\"/>\n"
                                "    </signal>\n"
-                               "    <signal name=\"SavedSessionNameRead\">\n"
+                               "    <signal name=\"DefaultSessionNameChanged\">\n"
                                "      <arg name=\"session_name\" type=\"s\"/>\n"
                                "    </signal>\n"
                                "    <signal name=\"Ready\">\n"

Modified: trunk/daemon/gdm-greeter-server.h
==============================================================================
--- trunk/daemon/gdm-greeter-server.h	(original)
+++ trunk/daemon/gdm-greeter-server.h	Mon Feb 25 20:29:18 2008
@@ -84,10 +84,10 @@
 gboolean            gdm_greeter_server_ready                 (GdmGreeterServer *greeter_server);
 void                gdm_greeter_server_selected_user_changed (GdmGreeterServer *greeter_server,
                                                               const char       *text);
-void                gdm_greeter_server_saved_language_name_read (GdmGreeterServer *greeter_server,
-                                                                 const char       *text);
-void                gdm_greeter_server_saved_session_name_read (GdmGreeterServer *greeter_server,
-                                                                const char       *text);
+void                gdm_greeter_server_default_language_name_changed (GdmGreeterServer *greeter_server,
+                                                                      const char       *text);
+void                gdm_greeter_server_default_session_name_changed (GdmGreeterServer *greeter_server,
+                                                                     const char       *text);
 
 G_END_DECLS
 

Modified: trunk/daemon/gdm-session-direct.c
==============================================================================
--- trunk/daemon/gdm-session-direct.c	(original)
+++ trunk/daemon/gdm-session-direct.c	Mon Feb 25 20:29:18 2008
@@ -448,6 +448,35 @@
         return DBUS_HANDLER_RESULT_HANDLED;
 }
 
+static const char *
+get_default_language_name (GdmSessionDirect *session)
+{
+    if (session->priv->saved_language != NULL) {
+                return session->priv->saved_language;
+    }
+
+    return setlocale (LC_MESSAGES, NULL);
+}
+
+static const char *
+get_default_session_name (GdmSessionDirect *session)
+{
+        if (session->priv->saved_session != NULL) {
+                return session->priv->saved_session;
+        }
+
+        return "gnome";
+}
+
+static void
+gdm_session_direct_defaults_changed (GdmSessionDirect *session)
+{
+        _gdm_session_default_language_name_changed (GDM_SESSION (session),
+                                                    get_default_language_name (session));
+        _gdm_session_default_session_name_changed (GDM_SESSION (session),
+                                                   get_default_session_name (session));
+}
+
 static void
 gdm_session_direct_select_user (GdmSession *session,
                                 const char *text)
@@ -458,6 +487,12 @@
 
         g_free (impl->priv->selected_user);
         impl->priv->selected_user = g_strdup (text);
+
+        g_free (impl->priv->saved_session);
+        impl->priv->saved_session = NULL;
+
+        g_free (impl->priv->saved_language);
+        impl->priv->saved_language = NULL;
 }
 
 static DBusHandlerResult
@@ -488,6 +523,8 @@
 
         _gdm_session_selected_user_changed (GDM_SESSION (session), session->priv->selected_user);
 
+        gdm_session_direct_defaults_changed (session);
+
         return DBUS_HANDLER_RESULT_HANDLED;
 }
 
@@ -792,8 +829,15 @@
         dbus_connection_send (connection, reply, NULL);
         dbus_message_unref (reply);
 
-        _gdm_session_saved_language_name_read (GDM_SESSION (session), language_name);
-        session->priv->saved_language = g_strdup (language_name);
+        if (strcmp (language_name,
+                    get_default_language_name (session)) != 0) {
+                g_free (session->priv->saved_language);
+                session->priv->saved_language = g_strdup (language_name);
+
+                _gdm_session_default_language_name_changed (GDM_SESSION (session),
+                                                            language_name);
+        }
+
 
         return DBUS_HANDLER_RESULT_HANDLED;
 }
@@ -818,9 +862,14 @@
         dbus_connection_send (connection, reply, NULL);
         dbus_message_unref (reply);
 
-        _gdm_session_saved_session_name_read (GDM_SESSION (session), session_name);
+        if (strcmp (session_name,
+                    get_default_session_name (session)) != 0) {
+                g_free (session->priv->saved_session);
+                session->priv->saved_session = g_strdup (session_name);
 
-        session->priv->saved_session = g_strdup (session_name);
+                _gdm_session_default_session_name_changed (GDM_SESSION (session),
+                                                           session_name);
+        }
 
         return DBUS_HANDLER_RESULT_HANDLED;
 }
@@ -1459,6 +1508,7 @@
         g_return_if_fail (dbus_connection_get_is_connected (impl->priv->worker_connection));
 
         send_setup (impl, service_name);
+        gdm_session_direct_defaults_changed (impl);
 }
 
 static void
@@ -1475,6 +1525,7 @@
         gdm_session_direct_select_user (session, username);
 
         send_setup_for_user (impl, service_name);
+        gdm_session_direct_defaults_changed (impl);
 }
 
 static void
@@ -1666,11 +1717,9 @@
 {
         if (session->priv->selected_language != NULL) {
                 return session->priv->selected_language;
-        } else if (session->priv->saved_language != NULL) {
-                return session->priv->saved_language;
-        } else {
-                return setlocale (LC_MESSAGES, NULL);
         }
+
+        return get_default_language_name (session);
 }
 
 static const char *
@@ -1678,11 +1727,9 @@
 {
         if (session->priv->selected_session != NULL) {
                 return session->priv->selected_session;
-        } else if (session->priv->saved_session != NULL) {
-                return session->priv->saved_session;
-        } else {
-                return "gnome";
         }
+
+        return get_default_session_name (session);
 }
 
 static char *

Modified: trunk/daemon/gdm-session-private.h
==============================================================================
--- trunk/daemon/gdm-session-private.h	(original)
+++ trunk/daemon/gdm-session-private.h	Mon Feb 25 20:29:18 2008
@@ -52,11 +52,11 @@
                                                             int           signal_number);
 void             _gdm_session_closed                       (GdmSession   *session);
 
-/* user settings read from ~/.dmrc */
-void             _gdm_session_saved_language_name_read     (GdmSession   *session,
-                                                            const char   *language_name);
-void             _gdm_session_saved_session_name_read      (GdmSession   *session,
-                                                            const char   *session_name);
+/* user settings read from ~/.dmrc / system defaults */
+void             _gdm_session_default_language_name_changed     (GdmSession   *session,
+                                                                 const char   *language_name);
+void             _gdm_session_default_session_name_changed      (GdmSession   *session,
+                                                                 const char   *session_name);
 /* user is selected/changed internally */
 void             _gdm_session_selected_user_changed        (GdmSession   *session,
                                                             const char   *text);

Modified: trunk/daemon/gdm-session.c
==============================================================================
--- trunk/daemon/gdm-session.c	(original)
+++ trunk/daemon/gdm-session.c	Mon Feb 25 20:29:18 2008
@@ -49,8 +49,8 @@
         SESSION_EXITED,
         SESSION_DIED,
         SELECTED_USER_CHANGED,
-        SAVED_LANGUAGE_NAME_READ,
-        SAVED_SESSION_NAME_READ,
+        DEFAULT_LANGUAGE_NAME_CHANGED,
+        DEFAULT_SESSION_NAME_CHANGED,
         LAST_SIGNAL
 };
 
@@ -417,22 +417,22 @@
                               G_TYPE_NONE,
                               1,
                               G_TYPE_STRING);
-        signals [SAVED_LANGUAGE_NAME_READ] =
-                g_signal_new ("saved-language-name-read",
+        signals [DEFAULT_LANGUAGE_NAME_CHANGED] =
+                g_signal_new ("default-language-name-changed",
                               iface_type,
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSessionIface, saved_language_name_read),
+                              G_STRUCT_OFFSET (GdmSessionIface, default_language_name_changed),
                               NULL,
                               NULL,
                               g_cclosure_marshal_VOID__STRING,
                               G_TYPE_NONE,
                               1,
                               G_TYPE_STRING);
-        signals [SAVED_SESSION_NAME_READ] =
-                g_signal_new ("saved-session-name-read",
+        signals [DEFAULT_SESSION_NAME_CHANGED] =
+                g_signal_new ("default-session-name-changed",
                               iface_type,
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSessionIface, saved_session_name_read),
+                              G_STRUCT_OFFSET (GdmSessionIface, default_session_name_changed),
                               NULL,
                               NULL,
                               g_cclosure_marshal_VOID__STRING,
@@ -599,21 +599,21 @@
 }
 
 void
-_gdm_session_saved_language_name_read (GdmSession   *session,
-                                       const char   *language_name)
+_gdm_session_default_language_name_changed (GdmSession   *session,
+                                            const char   *language_name)
 {
         g_return_if_fail (GDM_IS_SESSION (session));
 
-        g_signal_emit (session, signals [SAVED_LANGUAGE_NAME_READ], 0, language_name);
+        g_signal_emit (session, signals [DEFAULT_LANGUAGE_NAME_CHANGED], 0, language_name);
 }
 
 void
-_gdm_session_saved_session_name_read (GdmSession   *session,
-                                      const char   *session_name)
+_gdm_session_default_session_name_changed (GdmSession   *session,
+                                           const char   *session_name)
 {
         g_return_if_fail (GDM_IS_SESSION (session));
 
-        g_signal_emit (session, signals [SAVED_SESSION_NAME_READ], 0, session_name);
+        g_signal_emit (session, signals [DEFAULT_SESSION_NAME_CHANGED], 0, session_name);
 }
 
 void

Modified: trunk/daemon/gdm-session.h
==============================================================================
--- trunk/daemon/gdm-session.h	(original)
+++ trunk/daemon/gdm-session.h	Mon Feb 25 20:29:18 2008
@@ -104,10 +104,11 @@
         void (* closed)                      (GdmSession   *session);
         void (* selected_user_changed)       (GdmSession   *session,
                                               const char   *text);
-        void (* saved_language_name_read)    (GdmSession   *session,
-                                              const char   *text);
-        void (* saved_session_name_read)     (GdmSession   *session,
-                                              const char   *text);
+
+        void (* default_language_name_changed)    (GdmSession   *session,
+                                                   const char   *text);
+        void (* default_session_name_changed)     (GdmSession   *session,
+                                                   const char   *text);
 };
 
 GType    gdm_session_get_type                    (void) G_GNUC_CONST;

Modified: trunk/daemon/gdm-simple-slave.c
==============================================================================
--- trunk/daemon/gdm-simple-slave.c	(original)
+++ trunk/daemon/gdm-simple-slave.c	Mon Feb 25 20:29:18 2008
@@ -377,23 +377,23 @@
 }
 
 static void
-on_saved_language_name_read (GdmSession     *session,
-                             const char     *text,
-                             GdmSimpleSlave *slave)
+on_default_language_name_changed (GdmSession     *session,
+                                  const char     *text,
+                                  GdmSimpleSlave *slave)
 {
-        g_debug ("GdmSimpleSlave: Saved language name read: %s", text);
+        g_debug ("GdmSimpleSlave: Default language name changed: %s", text);
 
-        gdm_greeter_server_saved_language_name_read (slave->priv->greeter_server, text);
+        gdm_greeter_server_default_language_name_changed (slave->priv->greeter_server, text);
 }
 
 static void
-on_saved_session_name_read (GdmSession     *session,
-                            const char     *text,
-                            GdmSimpleSlave *slave)
+on_default_session_name_changed (GdmSession     *session,
+                                 const char     *text,
+                                 GdmSimpleSlave *slave)
 {
-        g_debug ("GdmSimpleSlave: Saved session name read: %s", text);
+        g_debug ("GdmSimpleSlave: Default session name changed: %s", text);
 
-        gdm_greeter_server_saved_session_name_read (slave->priv->greeter_server, text);
+        gdm_greeter_server_default_session_name_changed (slave->priv->greeter_server, text);
 }
 
 static void
@@ -512,13 +512,13 @@
                           slave);
 
         g_signal_connect (slave->priv->session,
-                          "saved-language-name-read",
-                          G_CALLBACK (on_saved_language_name_read),
+                          "default-language-name-changed",
+                          G_CALLBACK (on_default_language_name_changed),
                           slave);
 
         g_signal_connect (slave->priv->session,
-                          "saved-session-name-read",
-                          G_CALLBACK (on_saved_session_name_read),
+                          "default-session-name-changed",
+                          G_CALLBACK (on_default_session_name_changed),
                           slave);
 }
 



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