Update Scottish Gaelic translation
[platform/upstream/atk.git] / atk / atkmisc.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright 2007 Sun Microsystems Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "atkmisc.h"
23
24 /**
25  * SECTION:atkmisc
26  * @Short_description: A set of ATK utility functions for thread locking
27  * @Title:AtkMisc
28  *
29  * A set of utility functions for thread locking. This interface and
30  * all his related methods are deprecated since 2.12.
31  */
32
33 static void atk_misc_class_init (AtkMiscClass *klass);
34
35 GType
36 atk_misc_get_type (void)
37 {
38   static GType type = 0;
39
40   if (!type)
41     {
42       static const GTypeInfo typeInfo =
43       {
44         sizeof (AtkMiscClass),
45         (GBaseInitFunc) NULL,
46         (GBaseFinalizeFunc) NULL,
47         (GClassInitFunc) atk_misc_class_init,
48         (GClassFinalizeFunc) NULL,
49         NULL,
50         sizeof (AtkMisc),
51         0,
52         (GInstanceInitFunc) NULL,
53       } ;
54       type = g_type_register_static (G_TYPE_OBJECT, "AtkMisc", &typeInfo, 0) ;
55     }
56   return type;
57 }
58
59 static void
60 atk_misc_class_init (AtkMiscClass *klass)
61 {
62   klass->threads_enter = NULL;
63   klass->threads_leave = NULL;
64 }
65
66 /**
67  * atk_misc_threads_enter:
68  * @misc: an AtkMisc instance for this application. 
69  *
70  * Take the thread mutex for the GUI toolkit, 
71  * if one exists. 
72  * (This method is implemented by the toolkit ATK implementation layer;
73  *  for instance, for GTK+, GAIL implements this via GDK_THREADS_ENTER).
74  *
75  * Deprecated: Since 2.12.
76  *
77  * Since: 1.13
78  *
79  **/
80 void
81 atk_misc_threads_enter (AtkMisc *misc)
82 {
83   AtkMiscClass *klass;
84
85   if (misc == NULL)
86     return;
87
88   klass = ATK_MISC_GET_CLASS (misc);
89
90   if (klass->threads_enter)
91     {
92       klass->threads_enter (misc);
93     }
94 }
95
96 /**
97  * atk_misc_threads_leave:
98  * @misc: an AtkMisc instance for this application. 
99  *
100  * Release the thread mutex for the GUI toolkit, 
101  * if one exists. This method, and atk_misc_threads_enter, 
102  * are needed in some situations by threaded application code which 
103  * services ATK requests, since fulfilling ATK requests often
104  * requires calling into the GUI toolkit.  If a long-running or
105  * potentially blocking call takes place inside such a block, it should
106  * be bracketed by atk_misc_threads_leave/atk_misc_threads_enter calls.
107  * (This method is implemented by the toolkit ATK implementation layer;
108  *  for instance, for GTK+, GAIL implements this via GDK_THREADS_LEAVE).
109  *
110  * Deprecated: Since 2.12.
111  *
112  * Since: 1.13
113  *
114  **/
115 void
116 atk_misc_threads_leave (AtkMisc *misc)
117 {
118   AtkMiscClass *klass;
119
120   if (misc == NULL)
121     return;
122
123   klass = ATK_MISC_GET_CLASS (misc);
124
125   if (klass->threads_leave)
126     {
127       klass->threads_leave (misc);
128     }
129 }
130
131 AtkMisc *atk_misc_instance = NULL;
132
133 /**
134  * atk_misc_get_instance:
135  *
136  * Obtain the singleton instance of AtkMisc for this application.
137  * 
138  * Since: 1.13
139  *
140  * Deprecated: Since 2.12.
141  *
142  * Returns: The singleton instance of AtkMisc for this application.
143  *
144  **/
145 const AtkMisc *
146 atk_misc_get_instance (void)
147 {
148   return atk_misc_instance;
149 }