gdm r5727 - in trunk: . gui/simple-greeter
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r5727 - in trunk: . gui/simple-greeter
- Date: Thu, 7 Feb 2008 23:44:39 +0000 (GMT)
Author: mccann
Date: Thu Feb 7 23:44:39 2008
New Revision: 5727
URL: http://svn.gnome.org/viewvc/gdm?rev=5727&view=rev
Log:
2008-02-07 William Jon McCann <jmccann redhat com>
* gui/simple-greeter/gdm-a11y-preferences-dialog.c:
(key_changed_cb):
* gui/simple-greeter/gdm-greeter-panel.c:
(on_a11y_dialog_response):
* gui/simple-greeter/gdm-greeter-session.c: (toggle_screen_reader),
(toggle_screen_magnifier), (toggle_screen_keyboard),
(on_a11y_key_changed), (setup_at_tools),
(gdm_greeter_session_init):
* gui/simple-greeter/gdm-session-client.c:
(gdm_session_client_get_enabled), (gdm_session_client_set_enabled),
(gdm_session_client_get_name), (gdm_session_client_set_name),
(gdm_session_client_get_command), (gdm_session_client_set_command),
(gdm_session_client_get_try_exec),
(gdm_session_client_set_try_exec),
(gdm_session_client_get_priority),
(gdm_session_client_set_priority),
(gdm_session_client_set_property),
(gdm_session_client_get_property), (gdm_session_client_class_init):
* gui/simple-greeter/gdm-session-client.h:
* gui/simple-greeter/gdm-session-manager.c:
(is_client_in_current_level), (on_client_enable_notify),
(gdm_session_manager_add_client), (_change_level):
* gui/simple-greeter/gdm-simple-greeter.schemas.in:
Start/stop orca etc in the greeter session.
Modified:
trunk/ChangeLog
trunk/gui/simple-greeter/gdm-a11y-preferences-dialog.c
trunk/gui/simple-greeter/gdm-greeter-panel.c
trunk/gui/simple-greeter/gdm-greeter-session.c
trunk/gui/simple-greeter/gdm-session-client.c
trunk/gui/simple-greeter/gdm-session-client.h
trunk/gui/simple-greeter/gdm-session-manager.c
trunk/gui/simple-greeter/gdm-simple-greeter.schemas.in
Modified: trunk/gui/simple-greeter/gdm-a11y-preferences-dialog.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-a11y-preferences-dialog.c (original)
+++ trunk/gui/simple-greeter/gdm-a11y-preferences-dialog.c Thu Feb 7 23:44:39 2008
@@ -46,9 +46,9 @@
#define KEY_MOUSE_KEYS_ENABLED KEY_A11Y_DIR "/keyboard/mousekeys_enable"
#define KEY_GDM_A11Y_DIR "/apps/gdm/simple-greeter/accessibility"
-#define KEY_SCREEN_KEYBOARD_ENABLED KEY_GDM_A11Y_DIR "screen_keyboard_enabled"
-#define KEY_SCREEN_MAGNIFIER_ENABLED KEY_GDM_A11Y_DIR "screen_magnifier_enabled"
-#define KEY_SCREEN_READER_ENABLED KEY_GDM_A11Y_DIR "screen_reader_enabled"
+#define KEY_SCREEN_KEYBOARD_ENABLED KEY_GDM_A11Y_DIR "/screen_keyboard_enabled"
+#define KEY_SCREEN_MAGNIFIER_ENABLED KEY_GDM_A11Y_DIR "/screen_magnifier_enabled"
+#define KEY_SCREEN_READER_ENABLED KEY_GDM_A11Y_DIR "/screen_reader_enabled"
#define KEY_GTK_THEME "/desktop/gnome/interface/gtk_theme"
#define KEY_COLOR_SCHEME "/desktop/gnome/interface/gtk_color_scheme"
@@ -491,11 +491,6 @@
GConfValue *value;
key = gconf_entry_get_key (entry);
-
- if (! g_str_has_prefix (key, KEY_A11Y_DIR)) {
- return;
- }
-
value = gconf_entry_get_value (entry);
if (strcmp (key, KEY_STICKY_KEYS_ENABLED) == 0) {
Modified: trunk/gui/simple-greeter/gdm-greeter-panel.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-panel.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-panel.c Thu Feb 7 23:44:39 2008
@@ -451,8 +451,7 @@
int response,
GdmGreeterPanel *panel)
{
- gtk_widget_destroy (GTK_WIDGET (dialog));
- panel->priv->a11y_dialog = NULL;
+ gtk_widget_hide (GTK_WIDGET (dialog));
}
static void
Modified: trunk/gui/simple-greeter/gdm-greeter-session.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-session.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-session.c Thu Feb 7 23:44:39 2008
@@ -28,6 +28,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
+#include <gconf/gconf-client.h>
#include "gdm-greeter-session.h"
#include "gdm-greeter-client.h"
@@ -39,11 +40,20 @@
#define GDM_GREETER_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_SESSION, GdmGreeterSessionPrivate))
+#define KEY_GDM_A11Y_DIR "/apps/gdm/simple-greeter/accessibility"
+#define KEY_SCREEN_KEYBOARD_ENABLED KEY_GDM_A11Y_DIR "/screen_keyboard_enabled"
+#define KEY_SCREEN_MAGNIFIER_ENABLED KEY_GDM_A11Y_DIR "/screen_magnifier_enabled"
+#define KEY_SCREEN_READER_ENABLED KEY_GDM_A11Y_DIR "/screen_reader_enabled"
+
struct GdmGreeterSessionPrivate
{
GdmGreeterClient *client;
GdmSessionManager *manager;
+ GdmSessionClient *screen_reader_client;
+ GdmSessionClient *screen_keyboard_client;
+ GdmSessionClient *screen_magnifier_client;
+
GtkWidget *login_window;
GtkWidget *panel;
};
@@ -327,6 +337,148 @@
}
}
+static void
+toggle_screen_reader (GdmGreeterSession *session,
+ gboolean enabled)
+{
+ g_debug ("GdmGreeterSession: screen reader toggled: %d", enabled);
+ gdm_session_client_set_enabled (session->priv->screen_reader_client, enabled);
+}
+
+static void
+toggle_screen_magnifier (GdmGreeterSession *session,
+ gboolean enabled)
+{
+ g_debug ("GdmGreeterSession: screen magnifier toggled: %d", enabled);
+ gdm_session_client_set_enabled (session->priv->screen_magnifier_client, enabled);
+}
+
+static void
+toggle_screen_keyboard (GdmGreeterSession *session,
+ gboolean enabled)
+{
+ g_debug ("GdmGreeterSession: screen keyboard toggled: %d", enabled);
+ gdm_session_client_set_enabled (session->priv->screen_keyboard_client, enabled);
+}
+
+static void
+on_a11y_key_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ GdmGreeterSession *session)
+{
+ const char *key;
+ GConfValue *value;
+
+ key = gconf_entry_get_key (entry);
+ value = gconf_entry_get_value (entry);
+
+ if (strcmp (key, KEY_SCREEN_READER_ENABLED) == 0) {
+ if (value->type == GCONF_VALUE_BOOL) {
+ gboolean enabled;
+
+ enabled = gconf_value_get_bool (value);
+ g_debug ("setting key %s = %d", key, enabled);
+ toggle_screen_reader (session, enabled);
+ } else {
+ g_warning ("Error retrieving configuration key '%s': Invalid type",
+ key);
+ }
+
+ } else if (strcmp (key, KEY_SCREEN_MAGNIFIER_ENABLED) == 0) {
+ if (value->type == GCONF_VALUE_BOOL) {
+ gboolean enabled;
+
+ enabled = gconf_value_get_bool (value);
+ g_debug ("setting key %s = %d", key, enabled);
+ toggle_screen_magnifier (session, enabled);
+ } else {
+ g_warning ("Error retrieving configuration key '%s': Invalid type",
+ key);
+ }
+
+ } else if (strcmp (key, KEY_SCREEN_KEYBOARD_ENABLED) == 0) {
+ if (value->type == GCONF_VALUE_BOOL) {
+ gboolean enabled;
+
+ enabled = gconf_value_get_bool (value);
+ g_debug ("setting key %s = %d", key, enabled);
+ toggle_screen_keyboard (session, enabled);
+ } else {
+ g_warning ("Error retrieving configuration key '%s': Invalid type",
+ key);
+ }
+
+ } else {
+ }
+}
+
+static void
+setup_at_tools (GdmGreeterSession *session)
+{
+ GConfClient *client;
+ gboolean enabled;
+
+ client = gconf_client_get_default ();
+ gconf_client_add_dir (client,
+ KEY_GDM_A11Y_DIR,
+ GCONF_CLIENT_PRELOAD_ONELEVEL,
+ NULL);
+ gconf_client_notify_add (client,
+ KEY_GDM_A11Y_DIR,
+ (GConfClientNotifyFunc)on_a11y_key_changed,
+ session,
+ NULL,
+ NULL);
+
+ session->priv->screen_keyboard_client = gdm_session_client_new ();
+ gdm_session_client_set_name (session->priv->screen_keyboard_client,
+ "On-screen Keyboard");
+ gdm_session_client_set_try_exec (session->priv->screen_keyboard_client,
+ "gok");
+ gdm_session_client_set_command (session->priv->screen_keyboard_client,
+ "gok");
+ enabled = gconf_client_get_bool (client, KEY_SCREEN_KEYBOARD_ENABLED, NULL);
+ gdm_session_client_set_enabled (session->priv->screen_keyboard_client,
+ enabled);
+
+
+ session->priv->screen_reader_client = gdm_session_client_new ();
+ gdm_session_client_set_name (session->priv->screen_reader_client,
+ "Screen Reader");
+ gdm_session_client_set_try_exec (session->priv->screen_reader_client,
+ "orca");
+ gdm_session_client_set_command (session->priv->screen_reader_client,
+ "orca -n");
+ enabled = gconf_client_get_bool (client, KEY_SCREEN_READER_ENABLED, NULL);
+ gdm_session_client_set_enabled (session->priv->screen_reader_client,
+ enabled);
+
+
+ session->priv->screen_magnifier_client = gdm_session_client_new ();
+ gdm_session_client_set_name (session->priv->screen_magnifier_client,
+ "Screen Magnifier");
+ gdm_session_client_set_try_exec (session->priv->screen_magnifier_client,
+ "magnifier");
+ gdm_session_client_set_command (session->priv->screen_magnifier_client,
+ "magnifier -v -m");
+ enabled = gconf_client_get_bool (client, KEY_SCREEN_MAGNIFIER_ENABLED, NULL);
+ gdm_session_client_set_enabled (session->priv->screen_magnifier_client,
+ enabled);
+
+ gdm_session_manager_add_client (session->priv->manager,
+ session->priv->screen_reader_client,
+ GDM_SESSION_LEVEL_LOGIN_WINDOW);
+ gdm_session_manager_add_client (session->priv->manager,
+ session->priv->screen_keyboard_client,
+ GDM_SESSION_LEVEL_LOGIN_WINDOW);
+ gdm_session_manager_add_client (session->priv->manager,
+ session->priv->screen_magnifier_client,
+ GDM_SESSION_LEVEL_LOGIN_WINDOW);
+
+ g_object_unref (client);
+}
+
static gboolean
start_settings_daemon (GdmGreeterSession *session)
{
@@ -514,6 +666,8 @@
G_CALLBACK (on_selected_user_changed),
session);
+ /* FIXME: we should really do this in settings daemon */
+ setup_at_tools (session);
}
static void
Modified: trunk/gui/simple-greeter/gdm-session-client.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-session-client.c (original)
+++ trunk/gui/simple-greeter/gdm-session-client.c Thu Feb 7 23:44:39 2008
@@ -49,6 +49,7 @@
enum {
PROP_0,
PROP_DESKTOP_FILE,
+ PROP_ENABLED,
};
static void gdm_session_client_class_init (GdmSessionClientClass *klass);
@@ -128,6 +129,97 @@
client->priv->desktop_filename = g_strdup (file);
}
+gboolean
+gdm_session_client_get_enabled (GdmSessionClient *client)
+{
+ g_return_val_if_fail (GDM_IS_SESSION_CLIENT (client), FALSE);
+
+ return client->priv->enabled;
+}
+
+void
+gdm_session_client_set_enabled (GdmSessionClient *client,
+ gboolean enabled)
+{
+ g_return_if_fail (GDM_IS_SESSION_CLIENT (client));
+
+ if (enabled != client->priv->enabled) {
+ client->priv->enabled = enabled;
+ g_object_notify (G_OBJECT (client), "enabled");
+ }
+}
+
+const char *
+gdm_session_client_get_name (GdmSessionClient *client)
+{
+ g_return_val_if_fail (GDM_IS_SESSION_CLIENT (client), NULL);
+
+ return client->priv->name;
+}
+
+void
+gdm_session_client_set_name (GdmSessionClient *client,
+ const char *name)
+{
+ g_return_if_fail (GDM_IS_SESSION_CLIENT (client));
+
+ g_free (client->priv->name);
+ client->priv->name = g_strdup (name);
+}
+
+const char *
+gdm_session_client_get_command (GdmSessionClient *client)
+{
+ g_return_val_if_fail (GDM_IS_SESSION_CLIENT (client), NULL);
+
+ return client->priv->command;
+}
+
+void
+gdm_session_client_set_command (GdmSessionClient *client,
+ const char *name)
+{
+ g_return_if_fail (GDM_IS_SESSION_CLIENT (client));
+
+ g_free (client->priv->command);
+ client->priv->command = g_strdup (name);
+}
+
+const char *
+gdm_session_client_get_try_exec (GdmSessionClient *client)
+{
+ g_return_val_if_fail (GDM_IS_SESSION_CLIENT (client), NULL);
+
+ return client->priv->try_exec;
+}
+
+void
+gdm_session_client_set_try_exec (GdmSessionClient *client,
+ const char *name)
+{
+ g_return_if_fail (GDM_IS_SESSION_CLIENT (client));
+
+ g_free (client->priv->try_exec);
+ client->priv->try_exec = g_strdup (name);
+}
+
+guint
+gdm_session_client_get_priority (GdmSessionClient *client)
+{
+ g_return_val_if_fail (GDM_IS_SESSION_CLIENT (client), 0);
+
+ return client->priv->priority;
+}
+
+void
+gdm_session_client_set_priority (GdmSessionClient *client,
+ guint priority)
+{
+ g_return_if_fail (GDM_IS_SESSION_CLIENT (client));
+
+ client->priv->priority = priority;
+}
+
static void
gdm_session_client_set_property (GObject *object,
guint prop_id,
@@ -142,6 +234,9 @@
case PROP_DESKTOP_FILE:
_gdm_session_client_set_desktop_file (self, g_value_get_string (value));
break;
+ case PROP_ENABLED:
+ gdm_session_client_set_enabled (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -162,6 +257,9 @@
case PROP_DESKTOP_FILE:
g_value_set_string (value, self->priv->desktop_filename);
break;
+ case PROP_ENABLED:
+ g_value_set_boolean (value, self->priv->enabled);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -243,6 +341,13 @@
object_class->finalize = gdm_session_client_finalize;
g_object_class_install_property (object_class,
+ PROP_ENABLED,
+ g_param_spec_boolean ("enabled",
+ "enabled",
+ "enabled",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
PROP_DESKTOP_FILE,
g_param_spec_string ("desktop-file",
"desktop file",
Modified: trunk/gui/simple-greeter/gdm-session-client.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-session-client.h (original)
+++ trunk/gui/simple-greeter/gdm-session-client.h Thu Feb 7 23:44:39 2008
@@ -50,16 +50,22 @@
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);
Modified: trunk/gui/simple-greeter/gdm-session-manager.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-session-manager.c (original)
+++ trunk/gui/simple-greeter/gdm-session-manager.c Thu Feb 7 23:44:39 2008
@@ -146,6 +146,54 @@
g_hash_table_insert (manager->priv->levels, GUINT_TO_POINTER (level), list);
}
+static gboolean
+is_client_in_current_level (GdmSessionManager *manager,
+ GdmSessionClient *client)
+{
+ GList *list;
+ GList *l;
+ gboolean ret;
+
+ ret = FALSE;
+
+ list = g_hash_table_lookup (manager->priv->levels, GUINT_TO_POINTER (manager->priv->level));
+ for (l = list; l != NULL; l = l->next) {
+ if (client == l->data) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+static void
+on_client_enable_notify (GdmSessionClient *client,
+ GParamSpec *spec,
+ GdmSessionManager *manager)
+{
+ g_debug ("GdmSessionManager: Client %s enabled changed: %d",
+ gdm_session_client_get_name (client),
+ gdm_session_client_get_enabled (client));
+ if (! is_client_in_current_level (manager, client)) {
+ return;
+ }
+
+ if (gdm_session_client_get_enabled (client)) {
+ GError *error;
+ gboolean res;
+
+ error = NULL;
+ res = gdm_session_client_start (client, &error);
+ if (! res) {
+ g_warning ("Unable to start client: %s", error->message);
+ g_error_free (error);
+ }
+ } else {
+ gdm_session_client_stop (client);
+ }
+}
+
void
gdm_session_manager_add_client (GdmSessionManager *manager,
GdmSessionClient *client,
@@ -155,6 +203,11 @@
g_return_if_fail (GDM_IS_SESSION_MANAGER (manager));
+ g_signal_connect (client,
+ "notify::enabled",
+ G_CALLBACK (on_client_enable_notify),
+ manager);
+
for (i = GDM_SESSION_LEVEL_NONE; i <= GDM_SESSION_LEVEL_SHUTDOWN; i = i << 1) {
if (levels & i) {
add_client_to_level (manager, client, i);
@@ -292,6 +345,12 @@
GError *error;
client = list->data;
+
+ if (! gdm_session_client_get_enabled (client)) {
+ g_debug ("Skipping disabled client");
+ continue;
+ }
+
error = NULL;
res = gdm_session_client_start (client, &error);
if (! res) {
Modified: trunk/gui/simple-greeter/gdm-simple-greeter.schemas.in
==============================================================================
--- trunk/gui/simple-greeter/gdm-simple-greeter.schemas.in (original)
+++ trunk/gui/simple-greeter/gdm-simple-greeter.schemas.in Thu Feb 7 23:44:39 2008
@@ -2,6 +2,40 @@
<schemalist>
<schema>
+ <key>/schemas/apps/gdm/simple-greeter/accessibility/screen_keyboard_enabled</key>
+ <applyto>/apps/gdm/simple-greeter/accessibility/screen_keyboard_enabled</applyto>
+ <owner>gdm-simple-greeter</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Enable on-screen keyboard</short>
+ <long>Set to True to enable the on-screen keyboard.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gdm/simple-greeter/accessibility/screen_reader_enabled</key>
+ <applyto>/apps/gdm/simple-greeter/accessibility/screen_reader_enabled</applyto>
+ <owner>gdm-simple-greeter</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Enable screen reader</short>
+ <long>Set to True to enable the screen reader.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gdm/simple-greeter/accessibility/screen_magnifier_enabled</key>
+ <applyto>/apps/gdm/simple-greeter/accessibility/screen_magnifier_enabled</applyto>
+ <owner>gdm-simple-greeter</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Enable screen magnifier</short>
+ <long>Set to True to enable the screen magnifier.</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gdm/simple-greeter/settings-manager-plugins/a11y-keyboard/active</key>
<applyto>/apps/gdm/simple-greeter/settings-manager-plugins/a11y-keyboard/active</applyto>
<owner>gdm-simple-greeter</owner>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]