9c06aa83b5dad2176d2b6b2c6f71b3b7bcb3b800
[platform/upstream/glib.git] / gio / gcontextspecificgroup.h
1 /*
2  * Copyright © 2015 Canonical Limited
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 licence, 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, see <http://www.gnu.org/licenses/>.
16  *
17  * Author: Ryan Lortie <desrt@desrt.ca>
18  */
19
20 #ifndef __G_CONTEXT_SPECIFIC_GROUP_H__
21 #define __G_CONTEXT_SPECIFIC_GROUP_H__
22
23 #include <glib-object.h>
24
25 typedef struct
26 {
27   GHashTable *table;
28   GMutex      lock;
29   GCond       cond;
30   gboolean    requested_state;
31   GCallback   requested_func;
32   gboolean    effective_state;
33 } GContextSpecificGroup;
34
35 gpointer
36 g_context_specific_group_get (GContextSpecificGroup *group,
37                               GType                  type,
38                               goffset                context_offset,
39                               GCallback              start_func);
40
41 void
42 g_context_specific_group_remove (GContextSpecificGroup *group,
43                                  GMainContext          *context,
44                                  gpointer               instance,
45                                  GCallback              stop_func);
46
47 void
48 g_context_specific_group_emit (GContextSpecificGroup *group,
49                                guint                  signal_id);
50
51 #endif /* __G_CONTEXT_SPECIFIC_GROUP_H__ */