Commit 830abf59 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Switch to using gnome-session 2.23.6+ for session management. The actual

2008-08-14  William Jon McCann  <jmccann@redhat.com>

	* configure.ac:
	* daemon/gdm-greeter-session.c (gdm_greeter_session_new):
	* gui/simple-greeter/Makefile.am:
	* gui/simple-greeter/at-spi-registryd-wrapper.desktop.in.in:
	* gui/simple-greeter/gdm-greeter-session.c (toggle_panel),
	(toggle_login_window), (gdm_greeter_session_start),
	(gdm_greeter_session_stop), (gdm_greeter_session_event_handler),
	(gdm_greeter_session_init):
	* gui/simple-greeter/gdm-session-client.c:
	* gui/simple-greeter/gdm-session-client.h:
	* gui/simple-greeter/gdm-session-manager.c:
	* gui/simple-greeter/gdm-session-manager.h:
	* gui/simple-greeter/gdm-simple-greeter.desktop.in.in:
	* gui/simple-greeter/greeter-main.c (session_manager_connect),
	(register_client), (main):
	Switch to using gnome-session 2.23.6+ for session management.
	The actual greeter that will be shown will be determined by
	autostart.  This means that we'll share a common SM framework
	and it will be easier to change greeter frontends.


svn path=/trunk/; revision=6380
parent 6117f349
2008-08-14 William Jon McCann <jmccann@redhat.com>
* configure.ac:
* daemon/gdm-greeter-session.c (gdm_greeter_session_new):
* gui/simple-greeter/Makefile.am:
* gui/simple-greeter/at-spi-registryd-wrapper.desktop.in.in:
* gui/simple-greeter/gdm-greeter-session.c (toggle_panel),
(toggle_login_window), (gdm_greeter_session_start),
(gdm_greeter_session_stop), (gdm_greeter_session_event_handler),
(gdm_greeter_session_init):
* gui/simple-greeter/gdm-session-client.c:
* gui/simple-greeter/gdm-session-client.h:
* gui/simple-greeter/gdm-session-manager.c:
* gui/simple-greeter/gdm-session-manager.h:
* gui/simple-greeter/gdm-simple-greeter.desktop.in.in:
* gui/simple-greeter/greeter-main.c (session_manager_connect),
(register_client), (main):
Switch to using gnome-session 2.23.6+ for session management.
The actual greeter that will be shown will be determined by
autostart. This means that we'll share a common SM framework
and it will be easier to change greeter frontends.
2008-08-14 Behdad Esfahbod <behdad@gnome.org>
Bug 547826 – Whitelist languages not known by fontconfig
......
......@@ -1359,6 +1359,8 @@ AC_OUTPUT([
Makefile
daemon/Makefile
gui/Makefile
gui/simple-greeter/gdm-simple-greeter.desktop.in
gui/simple-greeter/at-spi-registryd-wrapper.desktop.in
gui/simple-greeter/Makefile
gui/simple-greeter/libnotificationarea/Makefile
gui/simple-chooser/Makefile
......
......@@ -147,7 +147,7 @@ gdm_greeter_session_new (const char *display_name,
GObject *object;
object = g_object_new (GDM_TYPE_GREETER_SESSION,
"command", LIBEXECDIR "/gdm-simple-greeter",
"command", BINDIR "/gnome-session --autostart="DATADIR"/gdm/autostart/LoginWindow/",
"server-dbus-path", GDM_GREETER_SERVER_DBUS_PATH,
"server-dbus-interface", GDM_GREETER_SERVER_DBUS_INTERFACE,
"server-env-var-name", "GDM_GREETER_DBUS_ADDRESS",
......
......@@ -22,6 +22,14 @@ INCLUDES = \
$(POLKIT_GNOME_CFLAGS) \
$(NULL)
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(pkgdatadir)/autostart/LoginWindow
desktop_in_files = \
at-spi-registryd-wrapper.desktop.in \
gdm-simple-greeter.desktop.in \
$(NULL)
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_SCHEMAS_RULE@
schemasdir = @GCONF_SCHEMA_FILE_DIR@
......@@ -260,10 +268,6 @@ gdm_simple_greeter_SOURCES = \
gdm-greeter-client.c \
gdm-greeter-session.h \
gdm-greeter-session.c \
gdm-session-manager.h \
gdm-session-manager.c \
gdm-session-client.h \
gdm-session-client.c \
gdm-greeter-login-window.c \
gdm-greeter-login-window.h \
gdm-remote-login-window.c \
......@@ -318,6 +322,7 @@ glade_DATA = \
$(NULL)
EXTRA_DIST = \
$(desktop_in_files) \
$(schemas_in_files) \
$(glade_DATA) \
$(NULL)
......
[Desktop Entry]
Type=Application
_Name=AT SPI Registry Wrapper
Exec=@LIBDIR@/gnome-session/helpers/at-spi-registryd-wrapper
OnlyShowIn=GNOME;
AutostartCondition=GNOME /desktop/gnome/interface/accessibility
X-GNOME-Autostart-Phase=Initialization
X-GNOME-AutoRestart=true
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_SESSION_CLIENT_H
#define __GDM_SESSION_CLIENT_H
#include <glib-object.h>
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_CLIENT (gdm_session_client_get_type ())
#define GDM_SESSION_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CLIENT, GdmSessionClient))
#define GDM_SESSION_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CLIENT, GdmSessionClientClass))
#define GDM_IS_SESSION_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CLIENT))
#define GDM_IS_SESSION_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CLIENT))
#define GDM_SESSION_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CLIENT, GdmSessionClientClass))
typedef struct GdmSessionClientPrivate GdmSessionClientPrivate;
typedef struct
{
GObject parent;
GdmSessionClientPrivate *priv;
} GdmSessionClient;
typedef struct
{
GObjectClass parent_class;
void (* exited) (GdmSessionClient *client,
int exit_code);
void (* died) (GdmSessionClient *client,
int signal_number);
} GdmSessionClientClass;
GType gdm_session_client_get_type (void);
GdmSessionClient * gdm_session_client_new (void);
GdmSessionClient * gdm_session_client_new_from_desktop_file (const char *filename);
void gdm_session_client_set_name (GdmSessionClient *client,
const char *name);
void gdm_session_client_set_priority (GdmSessionClient *client,
guint priority);
void gdm_session_client_set_command (GdmSessionClient *client,
const char *command);
void gdm_session_client_set_try_exec (GdmSessionClient *client,
const char *try_exec);
void gdm_session_client_set_enabled (GdmSessionClient *client,
gboolean enabled);
const char * gdm_session_client_get_name (GdmSessionClient *client);
guint gdm_session_client_get_priority (GdmSessionClient *client);
const char * gdm_session_client_get_command (GdmSessionClient *client);
const char * gdm_session_client_get_try_exec (GdmSessionClient *client);
gboolean gdm_session_client_get_enabled (GdmSessionClient *client);
gboolean gdm_session_client_start (GdmSessionClient *client,
GError **error);
void gdm_session_client_stop (GdmSessionClient *cilent);
G_END_DECLS
#endif /* __GDM_SESSION_CLIENT_H */
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_SESSION_MANAGER_H
#define __GDM_SESSION_MANAGER_H
#include <glib-object.h>
#include "gdm-session-client.h"
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_MANAGER (gdm_session_manager_get_type ())
#define GDM_SESSION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_MANAGER, GdmSessionManager))
#define GDM_SESSION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_MANAGER, GdmSessionManagerClass))
#define GDM_IS_SESSION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_MANAGER))
#define GDM_IS_SESSION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_MANAGER))
#define GDM_SESSION_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_MANAGER, GdmSessionManagerClass))
typedef struct GdmSessionManagerPrivate GdmSessionManagerPrivate;
typedef enum {
GDM_SESSION_LEVEL_NONE = 1 << 0,
GDM_SESSION_LEVEL_STARTUP = 1 << 1,
GDM_SESSION_LEVEL_CONFIGURATION = 1 << 2,
GDM_SESSION_LEVEL_LOGIN_WINDOW = 1 << 3,
GDM_SESSION_LEVEL_HOST_CHOOSER = 1 << 4,
GDM_SESSION_LEVEL_REMOTE_HOST = 1 << 5,
GDM_SESSION_LEVEL_SHUTDOWN = 1 << 6,
} GdmSessionLevel;
#define GDM_SESSION_ALL_LEVELS (GDM_SESSION_LEVEL_STARTUP | GDM_SESSION_LEVEL_CONFIGURATION | GDM_SESSION_LEVEL_LOGIN_WINDOW | GDM_SESSION_LEVEL_HOST_CHOOSER | GDM_SESSION_LEVEL_REMOTE_HOST | GDM_SESSION_LEVEL_SHUTDOWN)
typedef struct
{
GObject parent;
GdmSessionManagerPrivate *priv;
} GdmSessionManager;
typedef struct
{
GObjectClass parent_class;
void (* level_changed) (GdmSessionManager *manager,
guint old_level,
guint new_level);
} GdmSessionManagerClass;
typedef gboolean (* GdmSessionLevelNotifyFunc) (GdmSessionManager *manager,
gboolean enabled,
gpointer data);
GType gdm_session_manager_get_type (void);
GdmSessionManager * gdm_session_manager_new (void);
void gdm_session_manager_add_client (GdmSessionManager *manager,
GdmSessionClient *client,
GdmSessionLevel levels);
guint gdm_session_manager_add_notify (GdmSessionManager *manager,
GdmSessionLevel levels,
GdmSessionLevelNotifyFunc func,
gpointer data);
void gdm_session_manager_load_autostart_dir (GdmSessionManager *manager,
const char *path,
GdmSessionLevel levels);
void gdm_session_manager_load_system_dirs (GdmSessionManager *manager);
void gdm_session_manager_set_level (GdmSessionManager *manager,
GdmSessionLevel level);
GdmSessionLevel gdm_session_manager_get_level (GdmSessionManager *manager);
G_END_DECLS
#endif /* __GDM_SESSION_MANAGER_H */
[Desktop Entry]
Type=Application
_Name=Login Window
Exec=@LIBEXECDIR@/gdm-simple-greeter
OnlyShowIn=GNOME;
X-GNOME-Autostart-Phase=Panel
X-GNOME-Autostart-Notify=true
X-GNOME-AutoRestart=true
\ No newline at end of file
......@@ -31,6 +31,8 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <dbus/dbus-glib.h>
#include "gdm-log.h"
#include "gdm-common.h"
#include "gdm-signal-handler.h"
......@@ -40,222 +42,18 @@
#include "gdm-greeter-session.h"
#define ACCESSIBILITY_KEY "/desktop/gnome/interface/accessibility"
#define DEBUG_KEY "/apps/gdm/simple-greeter/debug"
static Atom AT_SPI_IOR;
static gboolean
assistive_registry_launch (void)
{
GPid pid;
GError *error;
const char *command;
char **argv;
gboolean res;
gboolean ret;
ret = FALSE;
gdm_profile_start (NULL);
command = AT_SPI_REGISTRYD_DIR "/at-spi-registryd";
argv = NULL;
error = NULL;
res = g_shell_parse_argv (command, NULL, &argv, &error);
if (! res) {
g_warning ("Unable to parse command: %s", error->message);
goto out;
}
error = NULL;
res = g_spawn_async (NULL,
argv,
NULL,
G_SPAWN_SEARCH_PATH
| G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL,
NULL,
NULL,
&pid,
&error);
g_strfreev (argv);
if (! res) {
g_warning ("Unable to run command %s: %s", command, error->message);
goto out;
}
if (kill (pid, 0) < 0) {
g_warning ("at-spi-registryd not running");
goto out;
}
ret = TRUE;
out:
gdm_profile_end (NULL);
return ret;
}
static GdkFilterReturn
filter_watch (GdkXEvent *xevent,
GdkEvent *event,
GMainLoop *loop)
{
XEvent *xev = (XEvent *)xevent;
if (xev->xany.type == PropertyNotify
&& xev->xproperty.atom == AT_SPI_IOR) {
g_debug ("a11y registry started");
g_main_loop_quit (loop);
#define SM_DBUS_NAME "org.gnome.SessionManager"
#define SM_DBUS_PATH "/org/gnome/SessionManager"
#define SM_DBUS_INTERFACE "org.gnome.SessionManager"
return GDK_FILTER_REMOVE;
}
#define SM_CLIENT_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate"
return GDK_FILTER_CONTINUE;
}
static gboolean
filter_timeout (GMainLoop *loop)
{
g_warning ("The accessibility registry was not found.");
g_main_loop_quit (loop);
return FALSE;
}
static void
assistive_registry_start (void)
{
GdkWindow *root;
guint tid;
GMainLoop *loop;
gdm_profile_start (NULL);
g_debug ("Starting a11y registry");
root = gdk_get_default_root_window ();
if ( ! AT_SPI_IOR) {
AT_SPI_IOR = XInternAtom (GDK_DISPLAY (), "AT_SPI_IOR", False);
}
gdk_window_set_events (root, GDK_PROPERTY_CHANGE_MASK);
if ( ! assistive_registry_launch ()) {
g_warning ("The accessibility registry could not be started.");
return;
}
loop = g_main_loop_new (NULL, FALSE);
gdk_window_add_filter (root, (GdkFilterFunc)filter_watch, loop);
tid = g_timeout_add_seconds (5, (GSourceFunc)filter_timeout, loop);
g_main_loop_run (loop);
gdk_window_remove_filter (root, (GdkFilterFunc)filter_watch, loop);
g_source_remove (tid);
g_main_loop_unref (loop);
gdm_profile_end (NULL);
}
static void
at_set_gtk_modules (void)
{
GSList *modules_list;
GSList *l;
const char *old;
char **modules;
gboolean found_gail;
gboolean found_atk_bridge;
int n;
gdm_profile_start (NULL);
n = 0;
modules_list = NULL;
found_gail = FALSE;
found_atk_bridge = FALSE;
if ((old = g_getenv ("GTK_MODULES")) != NULL) {
modules = g_strsplit (old, ":", -1);
for (n = 0; modules[n]; n++) {
if (strcmp (modules[n], "gail") == 0) {
found_gail = TRUE;
} else if (strcmp (modules[n], "atk-bridge") == 0) {
found_atk_bridge = TRUE;
}
modules_list = g_slist_prepend (modules_list, modules[n]);
modules[n] = NULL;
}
g_free (modules);
}
if (!found_gail) {
modules_list = g_slist_prepend (modules_list, "gail");
++n;
}
if (!found_atk_bridge) {
modules_list = g_slist_prepend (modules_list, "atk-bridge");
++n;
}
modules = g_new (char *, n + 1);
modules[n--] = NULL;
for (l = modules_list; l; l = l->next) {
modules[n--] = g_strdup (l->data);
}
g_setenv ("GTK_MODULES", g_strjoinv (":", modules), TRUE);
g_strfreev (modules);
g_slist_free (modules_list);
gdm_profile_end (NULL);
}
static void
load_a11y (void)
{
const char *env_a_t_support;
gboolean a_t_support;
GConfClient *gconf_client;
gdm_profile_start (NULL);
gconf_client = gconf_client_get_default ();
env_a_t_support = g_getenv ("GNOME_ACCESSIBILITY");
if (env_a_t_support) {
a_t_support = atoi (env_a_t_support);
} else {
GConfValue *val;
a_t_support = TRUE;
val = gconf_client_get_without_default (gconf_client, ACCESSIBILITY_KEY, NULL);
if (val != NULL) {
a_t_support = gconf_value_get_bool (val);
gconf_value_free (val);
}
}
if (a_t_support) {
assistive_registry_start ();
at_set_gtk_modules ();
}
g_object_unref (gconf_client);
gdm_profile_end (NULL);
}
static DBusGConnection *bus_connection = NULL;
static DBusGProxy *sm_proxy = NULL;
static char *client_id = NULL;
static DBusGProxy *client_proxy = NULL;
static gboolean
is_debug_set (void)
......@@ -333,6 +131,66 @@ signal_cb (int signo,
return ret;
}
static gboolean
session_manager_connect (void)
{
if (bus_connection == NULL) {
GError *error;
error = NULL;
bus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (bus_connection == NULL) {
g_message ("Failed to connect to the session bus: %s",
error->message);
g_error_free (error);
exit (1);
}
}
sm_proxy = dbus_g_proxy_new_for_name (bus_connection,
SM_DBUS_NAME,
SM_DBUS_PATH,
SM_DBUS_INTERFACE);
return (sm_proxy != NULL);
}
static gboolean
register_client (void)
{
GError *error;
gboolean res;
const char *startup_id;
const char *app_id;
startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
app_id = "gdm-simple-greeter.desktop";
error = NULL;
res = dbus_g_proxy_call (sm_proxy,
"RegisterClient",
&error,
G_TYPE_STRING, app_id,
G_TYPE_STRING, startup_id,
G_TYPE_INVALID,
DBUS_TYPE_G_OBJECT_PATH, &client_id,
G_TYPE_INVALID);
if (! res) {
g_warning ("Failed to register client: %s", error->message);
g_error_free (error);
return FALSE;
}
g_debug ("Client registered with session manager: %s", client_id);
client_proxy = dbus_g_proxy_new_for_name (bus_connection,
SM_DBUS_NAME,
client_id,
SM_CLIENT_DBUS_INTERFACE);
g_unsetenv ("DESKTOP_AUTOSTART_ID");
return TRUE;
}
int
main (int argc, char *argv[])
{
......@@ -369,10 +227,6 @@ main (int argc, char *argv[])
gdm_log_init ();
gdm_log_set_debug (is_debug_set ());
gdk_init (&argc, &argv);
load_a11y ();
gtk_init (&argc, &argv);
signal_handler = gdm_signal_handler_new ();
......@@ -399,6 +253,17 @@ main (int argc, char *argv[])
exit (1);
}
res = session_manager_connect ();
if (! res) {
g_warning ("Unable to connect to session manager");
exit (1);
}
res = register_client ();
if (! res) {
g_warning ("Unable to register client with session manager");
}
gtk_main ();
if (session != NULL) {
......
2008-08-14 William Jon McCann <jmccann@redhat.com>
reviewed by: <delete if not using a buddy>
* POTFILES.in:
* POTFILES.skip:
2008-08-14 Ignacio Casal Quinteiro <nacho.resa@gmail.com>
gl.po: Updated Galician translation
......
......@@ -50,6 +50,7 @@ daemon/simple-slave-main.c
daemon/test-session.c
daemon/xdmcp-chooser-slave-main.c
data/gdm.schemas.in.in
gui/simple-greeter/at-spi-registryd-wrapper.desktop.in.in
gui/simple-chooser/gdm-host-chooser-dialog.c
gui/simple-chooser/gdm-host-chooser-widget.c
gui/simple-greeter/gdm-cell-renderer-timer.c
......@@ -71,6 +72,7 @@ gui/simple-greeter/gdm-option-widget.c
gui/simple-greeter/gdm-recent-option-widget.c
gui/simple-greeter/gdm-remote-login-window.c
gui/simple-greeter/gdm-session-option-widget.c
gui/simple-greeter/gdm-simple-greeter.desktop.in.in
gui/simple-greeter/gdm-simple-greeter.schemas.in
gui/simple-greeter/gdm-timer.c
gui/simple-greeter/gdm-user.c
......
......@@ -8,3 +8,5 @@
#
data/gdm.schemas.in
gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in
gui/simple-greeter/at-spi-registryd-wrapper.desktop.in
gui/simple-greeter/gdm-simple-greeter.desktop.in
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment