aboutsummaryrefslogtreecommitdiffstats
path: root/shell/es-event.c
blob: c49ce6616300bd16e0ea1aa16772e71a0d0f69d9 (plain) (blame)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 *  Authors: Michael Zucchi <notzed@ximian.com>
 *
 *  Copyright 2004 Ximian, Inc. (www.ximian.com)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY 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, write to the Free Software
 *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <string.h>
#include <stdlib.h>

#include <glib.h>

#include "es-event.h"

static GObjectClass *eme_parent;
static ESEvent *es_event;

static void
eme_init(GObject *o)
{
    /*ESEvent *eme = (ESEvent *)o; */
}

static void
eme_finalise(GObject *o)
{
    ((GObjectClass *)eme_parent)->finalize(o);
}

static void
eme_target_free(EEvent *ep, EEventTarget *t)
{
    switch (t->type) {
    case ES_EVENT_TARGET_STATE: {
        ESEventTargetState *s = (ESEventTargetState *)t;

        s = s;
        break; }
    }

    ((EEventClass *)eme_parent)->target_free(ep, t);
}

static void
eme_class_init(GObjectClass *klass)
{
    klass->finalize = eme_finalise;
    ((EEventClass *)klass)->target_free = eme_target_free;
}

GType
es_event_get_type(void)
{
    static GType type = 0;

    if (type == 0) {
        static const GTypeInfo info = {
            sizeof(ESEventClass),
            NULL, NULL,
            (GClassInitFunc)eme_class_init,
            NULL, NULL,
            sizeof(ESEvent), 0,
            (GInstanceInitFunc)eme_init
        };
        eme_parent = g_type_class_ref(e_event_get_type());
        type = g_type_register_static(e_event_get_type(), "ESEvent", &info, 0);
    }

    return type;
}

/**
 * es_event_peek:
 * @void: 
 * 
 * Get the singular instance of the shell event handler.
 * 
 * Return value: 
 **/
ESEvent *es_event_peek(void)
{
    if (es_event == NULL) {
        es_event = g_object_new(es_event_get_type(), 0);
        /** @HookPoint: Shell Events Hookpoint
         * Id: org.gnome.evolution.shell.events
         *
         * This is the hook point which emits shell events.
         */
        e_event_construct(&es_event->event, "org.gnome.evolution.shell.events");
    }

    return es_event;
}

ESEventTargetState *
es_event_target_new_state(ESEvent *eme, int state)
{
    ESEventTargetState *t = e_event_target_new(&eme->event, ES_EVENT_TARGET_STATE, sizeof(*t));
    guint32 mask = ~0;

    t->state = state;

    if (state)
        mask &= ~ES_EVENT_STATE_ONLINE;
    else
        mask &= ~ES_EVENT_STATE_OFFLINE;

    t->target.mask = mask;

    return t;
}

/* ********************************************************************** */

static void *emeh_parent_class;
#define emeh ((ESEventHook *)eph)

static const EEventHookTargetMask emeh_state_masks[] = {
    { "online", ES_EVENT_STATE_ONLINE },
    { "offline", ES_EVENT_STATE_OFFLINE },
    { 0 }
};

static const EEventHookTargetMap emeh_targets[] = {
    { "state", ES_EVENT_TARGET_STATE, emeh_state_masks },
    { 0 }
};

static void
emeh_finalise(GObject *o)
{
    /*EPluginHook *eph = (EPluginHook *)o;*/

    ((GObjectClass *)emeh_parent_class)->finalize(o);
}

static void
emeh_class_init(EPluginHookClass *klass)
{
    int i;

    /** @HookClass: Shell Main Menu
     * @Id: org.gnome.evolution.shell.events:1.0
     * @Target: ESEventTargetState
     * 
     * A hook for events coming from the shell.
     **/

    ((GObjectClass *)klass)->finalize = emeh_finalise;
    ((EPluginHookClass *)klass)->id = "org.gnome.evolution.shell.events:1.0";

    for (i=0;emeh_targets[i].type;i++)
        e_event_hook_class_add_target_map((EEventHookClass *)klass, &emeh_targets[i]);

    ((EEventHookClass *)klass)->event = (EEvent *)es_event_peek();
}

GType
es_event_hook_get_type(void)
{
    static GType type = 0;
    
    if (!type) {
        static const GTypeInfo info = {
            sizeof(ESEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL,
            sizeof(ESEventHook), 0, (GInstanceInitFunc) NULL,
        };

        emeh_parent_class = g_type_class_ref(e_event_hook_get_type());
        type = g_type_register_static(e_event_hook_get_type(), "ESEventHook", &info, 0);
    }
    
    return type;
}
>| | | - Install traydoc plugin, customized logo PR: ports/73635 Submitted by: Jorge Mario G. Mazo <jgutie11@eafit.edu.co> Approved by: Ying-Chieh Chen <yinjieh@csie.nctu.edu.tw> (maintainer) * - Fix build on 4.xpav2004-11-141-0/+16 | | | | Submitted by: Matthew Luckie <mjl@luckie.org.nz> * Chase the Gaim 1.0.3 update.marcus2004-11-133-3/+3 | * Update to 1.0.2.marcus2004-11-132-4/+3 | * * Update to 1.0.3 [1]marcus2004-11-134-16/+13 | | | | | | * Add optional Evolution support Submitted by: Matthew Luckie <mjl@luckie.org.nz> [1] * Bump PORTREVISIONS for all ports that depend on atk or pango to ease in themarcus2004-11-0812-4/+12 | | | | big upgrade. * Update to 0.99.6krion2004-11-072-3/+3 | * Update to jabber 1.4.3.1. Jabber 1.4.3 contains a remotely exploitableseanc2004-11-014-9/+13 | | | | | | | | | | | vulnerability detailed here. All jabber 1.4.3 users are strongly advised to upgrade now: http://mail.jabber.org/pipermail/jabberd/2004-September/002004.html Reset maintainership back to ports@ (not using 1.X any more). Submitted by: Randy Bush <randy -at- psg.com> * Update to 0.17.2.marcus2004-10-312-3/+3 | | | | | PR: 73329 Submitted by: Andrey Slusar <anray@inet.ua> * Now builds on FreeBSD >= 5.x.kris2004-10-291-4/+0 | * - Update to 2.0.s4pav2004-10-282-6/+5 | | | | | PR: ports/73138 Submitted by: Kirk Strauser <kirk@strauser.com> (maintainer) * Chase libraries for new devel/libidn version.krion2004-10-261-1/+2 | * Add a file I forgot to add during update.demon2004-10-261-0/+13 | * Update to version 0.7.5.demon2004-10-258-35/+113 | | | | | PR: 72981 Submitted by: maintainer * Chase the Gaim 1.0.2 upgrade.marcus2004-10-214-0/+4 | * Update to 1.0.2. This is mainly a bug-fix release for MSN users.marcus2004-10-212-3/+3 | | | | Submitted by: Matthew Luckie <mjl@luckie.org.nz> * Add kf, simple Jabber client using the GTK+ 2.0 toolkit.pav2004-10-206-0/+190 | | | | | PR: ports/72858 Submitted by: Andrey Slusar <anray@inet.ua> * Update to 1.0.1.marcus2004-10-202-4/+3 | * Update to 2.4.marcus2004-10-174-6/+6 | * Add gaim-openq, a QQ-liked protocol plugin for Gaim.pav2004-10-1710-0/+741 | | | | | PR: ports/72697 Submitted by: hamigua <hamigua@cuc.cn> * - update to 0.92.0.2 [1]netchild2004-10-166-12/+42 | | | | | | | - list some known good and some probably bad soundcards [2] PR: 72068 [1] With help from: eculp@prodigy.ne [2] * Fix build if WITHOUT_SSL and WITHOUT_KDE are specifiedmarkus2004-10-156-2/+34 | | | | | Reported by: Eugene Ossintsev <eugos@gmx.net> Peter Seipel <webghost@lego-hc11.de> * Update to 2.3.marcus2004-10-156-10/+8 | | | | | PR: 72678 Submitted by: maintainer * - Fix gcc regression in STABLEdinoex2004-10-132-1/+21 | * - add USE_GCC=2.95, update related patch, and unbreak this portleeym2004-10-133-32/+11 | | | | | | | | | - replace pkg-plist with PLIST_FILES and PLIST_DIRS - cosmetic fix which makes portlint happier PR: 71825 Submitted by: leeym Approved by: maintainer timeout * Update to 0.99.5krion2004-10-122-3/+3 | * Add p5-Net-OSCAR 1.907, perl extension for the AOL Instant Messengermat2004-10-124-0/+71 | | | | | | | OSCAR protocol. PR: ports/72103 Submitted by: Kelly Cochran <kcochran@trolans.net> * Update to 4.12.0.clsung2004-10-123-12/+3 | | | | | | PR: ports/72166 Submitted by: Dima Panov <redfox@Fluffy.Khv.RU> Approved by: mentor (vanilla) * - update to 1.3.0dinoex2004-10-129-53/+259 | * update to 0.93.clsung2004-10-124-525/+617 | | | | | | PR: ports/71375 Submitted by: voise@tiscali.es Approved by: maintainer, mentor (vanilla) * Update to 2.2.marcus2004-10-126-6/+12 | | | | | PR: 71986 Submitted by: maintainer * Update to 1.0.0.marcus2004-10-122-3/+4 | * Update to 1.0.1. See http://gaim.sourceforge.net/ChangeLog for a listmarcus2004-10-123-3/+5 | | | | of all the changes. * Increase USE_GCC to 3.4 for those ports which compile with it.kris2004-09-301-1/+1 | | | | Approved by: portmgr * BROKEN on 5.x: Configure failskris2004-09-29