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 <glib/gi18n.h>
28 #include "ea-addressbook-view.h"
29
30 static const gchar * ea_ab_view_get_name (AtkObject *accessible);
31 static const gchar * ea_ab_view_get_description (AtkObject *accessible);
32
33 static void ea_ab_view_class_init (EAddressbookViewClass *class);
34
35 GType
36 ea_ab_view_get_type (void)
37 {
38 static GType type = 0;
39 AtkObjectFactory *factory;
40 GTypeQuery query;
41 GType derived_atk_type;
42
43 if (!type) {
44 static GTypeInfo tinfo = {
45 sizeof (EAddressbookViewClass),
46 (GBaseInitFunc) NULL, /* base_init */
47 (GBaseFinalizeFunc) NULL, /* base_finalize */
48 (GClassInitFunc) ea_ab_view_class_init,
49 (GClassFinalizeFunc) NULL, /* class_finalize */
50 NULL, /* class_data */
51 sizeof (EAddressbookView),
52 0, /* n_preallocs */
53 (GInstanceInitFunc) NULL, /* instance init */
54 NULL /* value table */
55 };
56
57 /*
58 * Figure out the size of the class and instance
59 * we are run-time deriving from (GailWidget, in this case) */
60
61 factory = atk_registry_get_factory (
62 atk_get_default_registry (),
63 GTK_TYPE_EVENT_BOX);
64 derived_atk_type = atk_object_factory_get_accessible_type (factory);
65 g_type_query (derived_atk_type, &query);
66
67 tinfo.class_size = query.class_size;
68 tinfo.instance_size = query.instance_size;
69
70 type = g_type_register_static (
71 derived_atk_type,
72 "EaABView", &tinfo, 0);
73 }
74
75 return type;
76 }
77
78 static void
79 ea_ab_view_class_init (EAddressbookViewClass *class)
80 {
81 AtkObjectClass *atk_object_class;
82
83 atk_object_class = ATK_OBJECT_CLASS (class);
84 atk_object_class->get_name = ea_ab_view_get_name;
85 atk_object_class->get_description = ea_ab_view_get_description;
86 }
87
88 static const gchar *
89 ea_ab_view_get_name (AtkObject *accessible)
90 {
91 g_return_val_if_fail (EA_IS_AB_VIEW (accessible), NULL);
92 if (accessible->name)
93 return accessible->name;
94
95 return _("evolution address book");
96 }
97
98 static const gchar *
99 ea_ab_view_get_description (AtkObject *accessible)
100 {
101 if (accessible->description)
102 return accessible->description;
103
104 return _("evolution address book");
105 }
106
107 AtkObject *
108 ea_ab_view_new (GObject *obj)
109 {
110 GObject *object;
111 AtkObject *accessible;
112
113 g_return_val_if_fail (obj != NULL, NULL);
114 g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (obj), NULL);
115
116 object = g_object_new (EA_TYPE_AB_VIEW, NULL);
117
118 accessible = ATK_OBJECT (object);
119 atk_object_initialize (accessible, obj);
120 accessible->role = ATK_ROLE_CANVAS;
121
122 return accessible;
123 }