Statistics
| Revision:

root / trunk / glue / glue_signals.c @ 1834

History | View | Annotate | Download (2.7 KB)

1
/* 
2
    Copyright (C) 2005-2010  Erik van Pienbroek
3

                
4
    This program is free software; you can redistribute it and/or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation; either version 2 of the License, or
7
    (at your option) any later version.
8

                
9
    This program 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
12
    GNU General Public License for more details.
13

                
14
    You should have received a copy of the GNU General Public License
15
    along with this program; if not, write to the Free Software
16
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
*/
18

                
19
#ifdef HAVE_CONFIG_H
20
#include "config.h"
21
#endif
22

                
23
#include 
24
#include 
25

                
26
#include 
27
#include 
28

                
29
#include "nntpgrab_glue.h"
30
#include "nntpgrab_glue_internal.h"
31
#include "nntpgrab_utils.h"
32
#include "nntpgrab_internal.h"
33
#include "collections.h"
34

                
35
void
36
nntpgrab_glue_signal_connect(NntpgrabGlue *obj, const char *signal_name, NGCallback cb_handler, void *data)
37
{
38
    NntpgrabGlue *glue = NNTPGRAB_GLUE(obj);
39

                
40
    g_return_if_fail(glue != NULL);
41
    g_return_if_fail(signal_name != NULL);
42

                
43
    if (glue->standalone_core && strcmp(signal_name, "connection_lost")) {
44
        ng_signal_connect(glue->standalone_core, signal_name, cb_handler, data);
45
    } else {
46
        ng_signal_connect(glue, signal_name, cb_handler, data);
47
    }
48
}
49

                
50
void
51
nntpgrab_glue_signal_handlers_disconnect_by_func(NntpgrabGlue *obj, NGCallback cb_handler, void *data)
52
{
53
    NntpgrabGlue *glue = NNTPGRAB_GLUE(obj);
54

                
55
    g_return_if_fail(glue != NULL);
56

                
57
    if (glue->standalone_core) {
58
        ng_signal_handlers_disconnect_by_func(glue->standalone_core, cb_handler, data);
59
    } else {
60
        ng_signal_handlers_disconnect_by_func(glue, cb_handler, data);
61
    }
62
}
63

                
64
void
65
nntpgrab_glue_signal_handlers_block_by_func(NntpgrabGlue *obj, NGCallback cb_handler, void *data)
66
{
67
    NntpgrabGlue *glue = NNTPGRAB_GLUE(obj);
68

                
69
    g_return_if_fail(glue != NULL);
70

                
71
    if (glue->standalone_core) {
72
        ng_signal_handlers_block_by_func(glue->standalone_core, cb_handler, data);
73
    } else {
74
        ng_signal_handlers_block_by_func(glue, cb_handler, data);
75
    }
76
}
77

                
78
void
79
nntpgrab_glue_signal_handlers_unblock_by_func(NntpgrabGlue *obj, NGCallback cb_handler, void *data)
80
{
81
    NntpgrabGlue *glue = NNTPGRAB_GLUE(obj);
82

                
83
    g_return_if_fail(glue != NULL);
84

                
85
    if (glue->standalone_core) {
86
        ng_signal_handlers_unblock_by_func(glue->standalone_core, cb_handler, data);
87
    } else {
88
        ng_signal_handlers_unblock_by_func(glue, cb_handler, data);
89
    }
90
}