~ubuntu-branches/ubuntu/quantal/libbonobo/quantal-201207170711

« back to all changes in this revision

Viewing changes to bonobo/bonobo-listener.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-02-18 14:40:51 UTC
  • mto: (3.1.1 etch) (1.1.25 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050218144051-fo4h9qh2gim8x3wt
Tags: upstream-2.8.1
ImportĀ upstreamĀ versionĀ 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
                        G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE, event_name,
53
53
                        BONOBO_TYPE_STATIC_CORBA_ANY,               args,
54
54
                        BONOBO_TYPE_STATIC_CORBA_EXCEPTION,         ev,
55
 
                        0);
 
55
                        G_TYPE_INVALID);
56
56
                
57
57
        g_signal_emit (G_OBJECT (listener),
58
58
                       signals [EVENT_NOTIFY], 0,
62
62
}
63
63
 
64
64
static void
 
65
bonobo_listener_destroy (BonoboObject *object)
 
66
{
 
67
        BonoboListener *listener = (BonoboListener *) object;
 
68
 
 
69
        if (listener->priv->event_callback) {
 
70
                g_closure_unref (listener->priv->event_callback);
 
71
                listener->priv->event_callback = NULL;
 
72
        }
 
73
        
 
74
        ((BonoboObjectClass *)bonobo_listener_parent_class)->destroy (object);
 
75
}
 
76
 
 
77
static void
65
78
bonobo_listener_finalize (GObject *object)
66
79
{
67
80
        BonoboListener *listener;
68
81
 
69
82
        listener = BONOBO_LISTENER (object);
70
83
 
71
 
        if (listener->priv)
72
 
        {
73
 
                g_closure_unref (listener->priv->event_callback);
 
84
        if (listener->priv) {
74
85
                g_free (listener->priv);
75
 
                listener->priv = 0;
 
86
                listener->priv = NULL;
76
87
        }
77
88
 
78
89
        bonobo_listener_parent_class->finalize (object);
81
92
static void
82
93
bonobo_listener_class_init (BonoboListenerClass *klass)
83
94
{
84
 
        GObjectClass *oclass = (GObjectClass *)klass;
 
95
        GObjectClass *oclass = (GObjectClass *) klass;
 
96
        BonoboObjectClass *boclass = (BonoboObjectClass *) klass;
85
97
        POA_Bonobo_Listener__epv *epv = &klass->epv;
86
98
 
87
99
        bonobo_listener_parent_class = g_type_class_peek_parent (klass);
88
100
 
89
101
        oclass->finalize = bonobo_listener_finalize;
 
102
        boclass->destroy = bonobo_listener_destroy;
90
103
 
91
104
        signals [EVENT_NOTIFY] = g_signal_new (
92
105
                "event_notify", G_TYPE_FROM_CLASS (oclass), G_SIGNAL_RUN_LAST,
108
121
 
109
122
        listener = BONOBO_LISTENER(object);
110
123
        listener->priv = g_new (BonoboListenerPrivate, 1);
111
 
        listener->priv->event_callback = 0;
 
124
        listener->priv->event_callback = NULL;
112
125
}
113
126
 
114
127
BONOBO_TYPE_FUNC_FULL (BonoboListener, 
115
128
                       Bonobo_Listener,
116
129
                       PARENT_TYPE,
117
 
                       bonobo_listener);
 
130
                       bonobo_listener)
118
131
 
119
132
/**
120
133
 * bonobo_listener_new_closure:
154
167
 
155
168
/**
156
169
 * bonobo_listener_new:
157
 
 * @event_callback: function to be invoked when an event is emitted by the EventSource.
 
170
 * @event_cb: function to be invoked when an event is emitted by the EventSource.
158
171
 * @user_data: data passed to the functioned pointed by @event_call.
159
172
 *
160
173
 * Creates a generic event listener.  The listener calls the @event_callback