mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
Add -DMETACITY_LIBDIR to support loading of modules Add functions
2003-09-26 Padraig O'Briain <padraig.obriain@sun.com> * src/Makefile.am: Add -DMETACITY_LIBDIR to support loading of modules * src/main.c: Add functions find_accessibility_module, accessibility_invoke_module and accessibility_invoke (main); Check whether GConf accessibility key is true and if so load accessibility modules. This code is based on the libgnome code. src/tabpopup.c (meta_ui_tab_popup_new): Set accessible role of accessible for label containing window name to STATUSBAR so AT can be aware of window name. This fixes bug #120025
This commit is contained in:
parent
28fbdc611e
commit
922932d240
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2003-09-26 Padraig O'Briain <padraig.obriain@sun.com>
|
||||
|
||||
* src/Makefile.am: Add -DMETACITY_LIBDIR to support loading of modules
|
||||
* src/main.c: Add functions find_accessibility_module,
|
||||
accessibility_invoke_module and accessibility_invoke
|
||||
(main); Check whether GConf accessibility key is true and if so
|
||||
load accessibility modules. This code is based on the libgnome code.
|
||||
|
||||
src/tabpopup.c (meta_ui_tab_popup_new): Set accessible role of
|
||||
accessible for label containing window name to STATUSBAR so
|
||||
AT can be aware of window name.
|
||||
|
||||
This fixes bug #120025
|
||||
|
||||
2003-09-24 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* src/session.c (io_from_warning_dialog): fix hang when we get
|
||||
|
@ -2,7 +2,7 @@ lib_LTLIBRARIES = libmetacity-private.la
|
||||
|
||||
SUBDIRS=wm-tester tools themes
|
||||
|
||||
INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"metacity\" -DSN_API_NOT_YET_FROZEN=1
|
||||
INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DMETACITY_LIBDIR=\"$(libdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"metacity\" -DSN_API_NOT_YET_FROZEN=1
|
||||
|
||||
EGGFILES= \
|
||||
eggaccelerators.c \
|
||||
|
102
src/main.c
102
src/main.c
@ -29,6 +29,11 @@
|
||||
#include "prefs.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gmodule.h>
|
||||
#ifdef HAVE_GCONF
|
||||
#include <gconf/gconf-client.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@ -76,6 +81,89 @@ version (void)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#define GNOME_ACCESSIBILITY_KEY "/desktop/gnome/interface/accessibility"
|
||||
|
||||
static char *
|
||||
find_accessibility_module (const char *libname)
|
||||
{
|
||||
char *sub;
|
||||
char *path;
|
||||
char *fname;
|
||||
char *retval;
|
||||
|
||||
fname = g_strconcat (libname, "." G_MODULE_SUFFIX, NULL);
|
||||
path = g_strconcat (METACITY_LIBDIR"/gtk-2.0/modules", G_DIR_SEPARATOR_S, fname, NULL);
|
||||
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
retval = path;
|
||||
|
||||
if (path)
|
||||
retval = path;
|
||||
else
|
||||
g_free (path);
|
||||
|
||||
g_free (fname);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
accessibility_invoke_module (const char *libname,
|
||||
gboolean init)
|
||||
{
|
||||
GModule *handle;
|
||||
void (*invoke_fn) (void);
|
||||
const char *method;
|
||||
gboolean retval = FALSE;
|
||||
char *module_name;
|
||||
|
||||
if (init)
|
||||
method = "gnome_accessibility_module_init";
|
||||
else
|
||||
method = "gnome_accessibility_module_shutdown";
|
||||
|
||||
module_name = find_accessibility_module (libname);
|
||||
|
||||
if (!module_name)
|
||||
{
|
||||
g_warning ("Accessibility: failed to find module '%s' which "
|
||||
"is needed to make this application accessible",
|
||||
libname);
|
||||
|
||||
}
|
||||
else if (!(handle = g_module_open (module_name, G_MODULE_BIND_LAZY)))
|
||||
{
|
||||
g_warning ("Accessibility: failed to load module '%s': '%s'",
|
||||
libname, g_module_error ());
|
||||
|
||||
}
|
||||
else if (!g_module_symbol (handle, method, (gpointer *)&invoke_fn))
|
||||
{
|
||||
g_warning ("Accessibility: error library '%s' does not include "
|
||||
"method '%s' required for accessibility support",
|
||||
libname, method);
|
||||
g_module_close (handle);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = TRUE;
|
||||
invoke_fn ();
|
||||
}
|
||||
|
||||
g_free (module_name);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
accessibility_invoke (gboolean init)
|
||||
{
|
||||
accessibility_invoke_module ("libgail", init);
|
||||
accessibility_invoke_module ("libatk-bridge", init);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@ -358,6 +446,20 @@ main (int argc, char **argv)
|
||||
if (!meta_display_open (NULL))
|
||||
meta_exit (META_EXIT_ERROR);
|
||||
|
||||
{
|
||||
gboolean do_init_a11y;
|
||||
do_init_a11y = FALSE;
|
||||
|
||||
#ifdef HAVE_GCONF
|
||||
do_init_a11y = gconf_client_get_bool (
|
||||
gconf_client_get_default (),
|
||||
GNOME_ACCESSIBILITY_KEY, NULL);
|
||||
#endif
|
||||
|
||||
if (do_init_a11y)
|
||||
accessibility_invoke (TRUE);
|
||||
}
|
||||
|
||||
g_main_run (meta_main_loop);
|
||||
|
||||
{
|
||||
|
@ -118,6 +118,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
||||
GList *tmp;
|
||||
GtkWidget *frame;
|
||||
int max_label_width;
|
||||
AtkObject *obj;
|
||||
|
||||
popup = g_new (MetaTabPopup, 1);
|
||||
|
||||
@ -205,6 +206,9 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
||||
table);
|
||||
|
||||
popup->label = gtk_label_new ("");
|
||||
obj = gtk_widget_get_accessible (popup->label);
|
||||
atk_object_set_role (obj, ATK_ROLE_STATUSBAR);
|
||||
|
||||
gtk_misc_set_padding (GTK_MISC (popup->label), 3, 3);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (vbox), popup->label, FALSE, FALSE, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user