1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/*******************************************************************************
**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
** 10 20 30 40 50 60 70 80
**
** notify-osd
**
** bubble-window.c - implements bubble window
**
** Copyright 2009 Canonical Ltd.
**
** Authors:
** Eitan Isaacson <eitan@ascender.com>
**
** This program is free software: you can redistribute it and/or modify it
** under the terms of the GNU General Public License version 3, as published
** by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranties of
** MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>.
**
*******************************************************************************/
#include "bubble-window.h"
#include "bubble.h"
#include "bubble-window-accessible-factory.h"
G_DEFINE_TYPE (BubbleWindow, bubble_window, GTK_TYPE_WINDOW);
static AtkObject* bubble_window_get_accessible (GtkWidget *widget);
static void
bubble_window_init (BubbleWindow *object)
{
/* TODO: Add initialization code here */
}
static void
bubble_window_finalize (GObject *object)
{
/* TODO: Add deinitalization code here */
G_OBJECT_CLASS (bubble_window_parent_class)->finalize (object);
}
static void
bubble_window_class_init (BubbleWindowClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
widget_class->get_accessible = bubble_window_get_accessible;
object_class->finalize = bubble_window_finalize;
}
GtkWidget *
bubble_window_new (void)
{
GtkWidget *bubble_window;
bubble_window = g_object_new (BUBBLE_TYPE_WINDOW,
"type", GTK_WINDOW_POPUP, NULL);
return bubble_window;
}
static AtkObject *
bubble_window_get_accessible (GtkWidget *widget)
{
static gboolean first_time = TRUE;
if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
GType derived_type;
GType derived_atk_type;
/*
* Figure out whether accessibility is enabled by looking at the
* type of the accessible object which would be created for
* the parent type WnckPager.
*/
derived_type = g_type_parent (BUBBLE_TYPE_WINDOW);
registry = atk_get_default_registry ();
factory = atk_registry_get_factory (registry,
derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
{
/*
* Specify what factory to use to create accessible
* objects
*/
atk_registry_set_factory_type (registry,
BUBBLE_TYPE_WINDOW,
BUBBLE_WINDOW_TYPE_ACCESSIBLE_FACTORY);
}
first_time = FALSE;
}
return GTK_WIDGET_CLASS (bubble_window_parent_class)->get_accessible (widget);
}
|