evolution-3.6.4/addressbook/gui/widgets/ea-addressbook.c

No issues found

 1 /*
 2  * This program is free software; you can redistribute it and/or
 3  * modify it under the terms of the GNU Lesser General Public
 4  * License as published by the Free Software Foundation; either
 5  * version 2 of the License, or (at your option) version 3.
 6  *
 7  * This program is distributed in the hope that it will be useful,
 8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with the program; if not, see <http://www.gnu.org/licenses/>
14  *
15  *
16  * Authors:
17  *		Leon Zhang <leon.zhang@sun.com>
18  *
19  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
20  *
21  */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <text/e-text.h>
28 #include "a11y/ea-factory.h"
29 #include "ea-addressbook.h"
30 #include "ea-minicard.h"
31 #include "ea-minicard-view.h"
32 #include "ea-addressbook-view.h"
33 
34 EA_FACTORY_GOBJECT (EA_TYPE_MINICARD, ea_minicard, ea_minicard_new)
35 EA_FACTORY_GOBJECT (EA_TYPE_MINICARD_VIEW, ea_minicard_view, ea_minicard_view_new)
36 EA_FACTORY_GOBJECT (EA_TYPE_AB_VIEW, ea_ab_view, ea_ab_view_new)
37 
38 static gboolean ea_addressbook_focus_watcher (GSignalInvocationHint *ihint,
39                                               guint n_param_values,
40                                               const GValue *param_values,
41                                               gpointer data);
42 
43 void e_minicard_a11y_init (void)
44 {
45 	EA_SET_FACTORY (e_minicard_get_type (), ea_minicard);
46 }
47 
48 void e_minicard_view_a11y_init (void)
49 {
50 	EA_SET_FACTORY (e_minicard_view_get_type (), ea_minicard_view);
51 
52 	if (atk_get_root ()) {
53 		g_signal_add_emission_hook (
54 			g_signal_lookup ("event",
55 			e_minicard_get_type ()),
56 			0, ea_addressbook_focus_watcher,
57 			NULL, (GDestroyNotify) NULL);
58 	}
59 }
60 
61 void eab_view_a11y_init (void)
62 {
63 	EA_SET_FACTORY (E_TYPE_ADDRESSBOOK_VIEW, ea_ab_view);
64 }
65 
66 static gboolean
67 ea_addressbook_focus_watcher (GSignalInvocationHint *ihint,
68                               guint n_param_values,
69                               const GValue *param_values,
70                               gpointer data)
71 {
72 	GObject *object;
73 	GdkEvent *event;
74 	AtkObject *ea_event = NULL;
75 
76 	object = g_value_get_object (param_values + 0);
77 	event = g_value_get_boxed (param_values + 1);
78 
79 	if (E_IS_MINICARD (object)) {
80 		GnomeCanvasItem *item = GNOME_CANVAS_ITEM (object);
81 		ea_event = atk_gobject_accessible_for_object (object);
82 		if (event->type == GDK_FOCUS_CHANGE) {
83 			if ((event->focus_change.in) &&
84 			    (E_IS_MINICARD (item->canvas->focused_item)))
85 				atk_focus_tracker_notify (ea_event);
86 		}
87 	}
88 
89 	return TRUE;
90 }