aboutsummaryrefslogtreecommitdiffstats
path: root/shell/es-event.c
blob: 72a05931bdd3fdcf6971c45a1579dbc40b210389 (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
194
195
196
197
198
199
200
201
202
203
204
205
206
/* -*- 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;
}

ESEventTargetUpgrade *
es_event_target_new_upgrade(ESEvent *eme, int major, int minor, int revision)
{
    ESEventTargetUpgrade *t = e_event_target_new(&eme->event, ES_EVENT_TARGET_UPGRADE, sizeof(*t));

    t->major = major;
    t->minor = minor;
    t->revision = revision;

    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 },
    { "upgrade", ES_EVENT_TARGET_UPGRADE, NULL },
    { 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;
}
cgi/freebsd-ports-gnome/log/games/allacrost?id=aaa622f1c9b14753cf86e9d54dd68b196ad012a5'>logstatsplain d---------amoebax141logstatsplain d---------an141logstatsplain d---------angband146logstatsplain d---------anki178logstatsplain d---------antipolix178logstatsplain d---------aop178logstatsplain d---------apoolGL178logstatsplain d---------apricots141logstatsplain d---------aquaria141logstatsplain d---------arkanoidsb178logstatsplain d---------armagetron146logstatsplain d---------arx-libertatis178logstatsplain d---------asc180logstatsplain d---------ascii-invaders141logstatsplain d---------asciiquarium109logstatsplain d---------assaultcube141logstatsplain d---------asteroid146logstatsplain d---------asteroids3d178logstatsplain d---------astromenace146logstatsplain d---------asylum178logstatsplain d---------atanks178logstatsplain d---------atomix146logstatsplain d---------atr3d178logstatsplain d---------atris-sounds146logstatsplain d---------atris146logstatsplain d---------auralquiz178logstatsplain d---------avanor141logstatsplain d---------avoision109logstatsplain d---------awale141logstatsplain d---------awele141logstatsplain d---------balazar109logstatsplain d---------ballerburg178logstatsplain d---------banihstypos141logstatsplain d---------barbie_seahorse_adventures178logstatsplain d---------barony141logstatsplain d---------barrage146logstatsplain d---------bass178logstatsplain d---------bastet141logstatsplain d---------battalion109logstatsplain d---------battletanks178logstatsplain d---------belooted178logstatsplain d---------beret178logstatsplain d---------billardgl141logstatsplain d---------biloba109logstatsplain d---------biniax2141logstatsplain d---------biorythm109logstatsplain d---------bitefusion141logstatsplain d---------black-box146logstatsplain d---------blackjackclient141logstatsplain d---------blackshadeselite180logstatsplain d---------blinken146logstatsplain d---------blinkensisters141logstatsplain d---------blobby178logstatsplain d---------blobwars178logstatsplain d---------block178logstatsplain d---------blockade141logstatsplain d---------blockout178logstatsplain d---------blockrage178logstatsplain d---------blokish141logstatsplain d---------bloodfrontier141logstatsplain d---------bluemoon141logstatsplain d---------bomber146logstatsplain d---------bomberclone178logstatsplain d---------bomberinstinct178logstatsplain d---------bombherman178logstatsplain d---------bombz178logstatsplain d---------bomns146logstatsplain d---------boswars178logstatsplain d---------bouncy178logstatsplain d---------bovo146logstatsplain d---------braincurses146logstatsplain d---------brainparty141logstatsplain d---------brainworkshop141logstatsplain d---------brickout109logstatsplain d---------brickshooter109logstatsplain d---------brikx109logstatsplain d---------briquolo178logstatsplain d---------brumbrumrally178logstatsplain d---------brutalchess178logstatsplain d---------bs141logstatsplain d---------bsdgames178logstatsplain d---------bsdrain109logstatsplain d---------bsdtris178logstatsplain d---------bsp146logstatsplain d---------bstone109logstatsplain d---------bubbros178logstatsplain d---------bugsquish146logstatsplain d---------bugsx141logstatsplain d---------bumprace109logstatsplain d---------bunnysay141logstatsplain d---------burgerspace146logstatsplain d---------burrtools141logstatsplain d---------bygfoot146logstatsplain d---------bzflag-server36logstatsplain d---------bzflag146logstatsplain d---------cake180logstatsplain d---------caph109logstatsplain d---------cardpics146logstatsplain d---------castlevox178logstatsplain d---------cataclysm-dda178logstatsplain d---------catesc109logstatsplain d---------cave9141logstatsplain d---------cavezofphear146logstatsplain d---------ceferino178logstatsplain d---------cgoban141logstatsplain d---------chanta178logstatsplain d---------chapping141logstatsplain d---------chessx141logstatsplain d---------childsplay146logstatsplain d---------chocolate-doom217logstatsplain d---------chroma141logstatsplain d---------chromium-bsu146logstatsplain d---------circuslinux141logstatsplain d---------cleanq3178logstatsplain d---------cockatrice178logstatsplain d---------coffeebreak109logstatsplain d---------colobot146logstatsplain d---------colorcode109logstatsplain d---------columns178logstatsplain d---------concentration141logstatsplain d---------connectagram146logstatsplain d---------connectfive141logstatsplain d---------conquest178logstatsplain d---------construo141logstatsplain d---------corsix-th217logstatsplain d---------cosmo178logstatsplain d---------cosmosmash146logstatsplain d---------cowsay178logstatsplain d---------crack-attack141logstatsplain d---------craft146logstatsplain d---------crafty-tablebase-no-pawn219logstatsplain d---------crafty251logstatsplain d---------crashtest141logstatsplain d---------cre141logstatsplain d---------cretan-hubris109logstatsplain d---------crimson178logstatsplain d---------criticalmass141logstatsplain d---------critterding141logstatsplain d---------crossfire-client146logstatsplain d---------crossfire-server178logstatsplain d---------crrcsim178logstatsplain d---------cryptoslam109logstatsplain d---------csmash178logstatsplain d---------ctris109logstatsplain d---------cube178logstatsplain d---------cultivation141logstatsplain d---------cursive141logstatsplain d---------cutemaze146logstatsplain d---------cuyo178logstatsplain d---------d2x-xl178logstatsplain d---------d2x180logstatsplain d---------dangen109logstatsplain d---------dangerdeep-data109logstatsplain d---------dangerdeep141logstatsplain d---------darkplaces178logstatsplain d---------defendguin178logstatsplain d---------dhewm3178logstatsplain d---------diameter141logstatsplain d---------diaspora141logstatsplain d---------digger-vgl223logstatsplain d---------divide-and-succeed178logstatsplain d---------dmjava146logstatsplain d---------dodgindiamond2178logstatsplain d---------domination178logstatsplain d---------dontspace146logstatsplain d---------doom-data222logstatsplain d---------doom-freedoom109logstatsplain d---------doom-hacx109logstatsplain d---------doom-hr146logstatsplain d---------doom-hr2109logstatsplain d---------doom-wolfendoom146logstatsplain d---------doom178logstatsplain d---------doomlegacy141logstatsplain d---------doomsday185logstatsplain d---------drcreep178logstatsplain d---------drm178logstatsplain d---------duckmaze178logstatsplain d---------duel178logstatsplain d---------dunelegacy178logstatsplain d---------dungeon109logstatsplain d---------dungeoncrawl141logstatsplain d---------dustrac178logstatsplain d---------dxx-rebirth180logstatsplain d---------easyrpg-player146logstatsplain d---------eboard217logstatsplain d---------ecwolf141logstatsplain d---------edge141logstatsplain d---------editss178logstatsplain d---------eduke32141logstatsplain d---------egl178logstatsplain d---------egoboo180logstatsplain d---------eif178logstatsplain d---------eights141logstatsplain d---------einstein217logstatsplain d---------el-data109logstatsplain d---------el141logstatsplain d---------emptyepsilon178logstatsplain d---------endgame-singularity-music146logstatsplain d---------endgame-singularity146logstatsplain d---------endless-sky-high-dpi148logstatsplain d---------endless-sky178logstatsplain d---------enigma178logstatsplain d---------ensemblist141logstatsplain d---------entombed146logstatsplain d---------enygma178logstatsplain d---------epiar178logstatsplain d---------epiphany-game109logstatsplain d---------etracer178logstatsplain d---------euchre109logstatsplain d---------evilfinder141logstatsplain d---------evq3178logstatsplain d---------excido178logstatsplain d---------exhaust-doc146logstatsplain d---------exhaust-ma180logstatsplain d---------exhaust180logstatsplain d---------exmars178logstatsplain d---------exult178logstatsplain d---------ezquake178logstatsplain d---------f1spirit-remake141logstatsplain d---------fairymax146logstatsplain d---------falconseye178logstatsplain d---------farblazer178logstatsplain d---------fargoal178logstatsplain d---------fbg2109logstatsplain d---------fightorperish178logstatsplain d---------fillets-ng109logstatsplain d---------filters178logstatsplain d---------fishsupper109logstatsplain d---------five-or-more185logstatsplain d---------fkiss109logstatsplain d---------flare-engine178logstatsplain d---------flare-game109logstatsplain d---------flightgear-aircraft109logstatsplain d---------flightgear-data109logstatsplain d---------flightgear-mb339-pan109logstatsplain d---------flightgear-terragear178logstatsplain d---------flightgear217logstatsplain d---------flobopuyo141logstatsplain d---------flyhard141logstatsplain d---------flying141logstatsplain d---------fmars146logstatsplain d---------foobillard178logstatsplain d---------formido141logstatsplain d---------fortunate146logstatsplain d---------fotaq178logstatsplain d---------four-in-a-row146logstatsplain d---------freeblocks178logstatsplain d---------freecell-solver178logstatsplain d---------freeciv-nox1136logstatsplain d---------freeciv-sounds146logstatsplain d---------freeciv146logstatsplain d---------freecol141logstatsplain d---------freedink-data178logstatsplain d---------freedink-dfarc146logstatsplain d---------freedink-engine178logstatsplain d---------freedink73logstatsplain d---------freedoko146logstatsplain d---------freedroid146logstatsplain d---------freedroidrpg146logstatsplain d---------freeminer-default109logstatsplain d---------freeminer217logstatsplain d---------freeorion178logstatsplain d---------freera141logstatsplain d---------freesweep141logstatsplain d---------freesynd178logstatsplain d---------freetennis141logstatsplain d---------fretsonfire-data146logstatsplain d---------fretsonfire178logstatsplain d---------frikqcc141logstatsplain d---------frobtads178logstatsplain d---------frogatto141logstatsplain d---------frotz141logstatsplain d---------frozen-bubble146logstatsplain d---------fteqw141logstatsplain d---------funnyboat178logstatsplain d---------galaxis109logstatsplain d---------galaxyhack141logstatsplain d---------garden-of-coloured-lights178logstatsplain d---------gbottler146logstatsplain d---------gbrainy178logstatsplain d---------gcompris-qt146logstatsplain d---------gcompris178logstatsplain d---------gemdropx146logstatsplain d---------gemrb178logstatsplain d---------genact109logstatsplain d---------ggz-client-libs178logstatsplain d---------ggz-gtk-client146logstatsplain d---------ggz-gtk-games146logstatsplain d---------ggz-sdl-games178logstatsplain d---------ggz-txt-client178logstatsplain d---------gigalomania146logstatsplain d---------gillo178logstatsplain d---------gl-117178logstatsplain d---------glaxium178logstatsplain d---------glbsp178logstatsplain d---------glchess185logstatsplain d---------glest-data109logstatsplain d---------glest178logstatsplain d---------glightoff146logstatsplain d---------glmaze178logstatsplain d---------glob2178logstatsplain d---------glsfcave109logstatsplain d---------gltron178logstatsplain d---------gmastermind178logstatsplain d---------gmines146logstatsplain d---------gnake109logstatsplain d---------gnarr178logstatsplain d---------gnome-2048146logstatsplain d---------gnome-chess146logstatsplain d---------gnome-games73logstatsplain d---------gnome-klotski146logstatsplain d---------gnome-mahjongg146logstatsplain d---------gnome-mines146logstatsplain d---------gnome-nibbles185logstatsplain d---------gnome-robots185logstatsplain d---------gnome-sudoku146logstatsplain d---------gnome-taquin146logstatsplain d---------gnome-tetravex146logstatsplain d---------gnubg146logstatsplain d---------gnubik178logstatsplain d---------gnuchess146logstatsplain d---------gnudoku146logstatsplain d---------gnugo141logstatsplain d---------gnujump178logstatsplain d---------gnurobbo109logstatsplain d---------gnurobots178logstatsplain d---------gnushogi221logstatsplain d---------gnustep-ladder178logstatsplain d---------gnustep-sudoku146logstatsplain d---------gogrepo141logstatsplain d---------golddig178logstatsplain d---------golly178logstatsplain d---------gomoku146logstatsplain d---------goonies178logstatsplain d---------gottet146logstatsplain d---------gracer178logstatsplain d---------granatier146logstatsplain d---------greed146logstatsplain d---------gretools146logstatsplain d---------griels-quest146logstatsplain d---------gru146logstatsplain d---------grubik178logstatsplain d---------gshisen146logstatsplain d---------gti109logstatsplain d---------gtkatlantic146logstatsplain d---------gtkballs178logstatsplain d---------gtkevemon146logstatsplain d---------gtkpool141logstatsplain d---------gtkradiant178logstatsplain d---------gtypist146logstatsplain d---------gunfudeadlands141logstatsplain d---------gzdoom141logstatsplain d---------hangman141logstatsplain d---------hedgewars109logstatsplain d---------help_hannahs_horse178logstatsplain d---------heretic178logstatsplain d---------heroes178logstatsplain d---------hex-a-hop178logstatsplain d---------hexalate146logstatsplain d---------hexxagon178logstatsplain d---------highmoon178logstatsplain d---------hinversi146logstatsplain d---------hitori146logstatsplain d---------hllib141logstatsplain d---------hohlin178logstatsplain d---------hoichess146logstatsplain d---------holotz-castle178logstatsplain d---------hoverboard-sdl141logstatsplain d---------hs-scroll109logstatsplain d---------hypatia_engine109logstatsplain d---------hyperrogue178logstatsplain d---------iagno146logstatsplain d---------icbm3d141logstatsplain d---------icebreaker178logstatsplain d---------iceicepenguin178logstatsplain d---------imaze178logstatsplain d---------impossible_mission_puzzle109logstatsplain d---------inform141logstatsplain d---------inform7178logstatsplain d---------instead146logstatsplain d---------interlogic109logstatsplain d---------ioquake3-server36logstatsplain d---------ioquake3180logstatsplain d---------iortcw178logstatsplain d---------iourbanterror-server36logstatsplain d---------iourbanterror144logstatsplain d---------irrlamb109logstatsplain d---------ishido146logstatsplain d---------ivan178logstatsplain d---------jaggedalliance2185logstatsplain d---------java-games-suite141logstatsplain d---------jchessboard141logstatsplain d---------jfk178logstatsplain d---------jfsw178logstatsplain d---------jigsaw146logstatsplain d---------jigzo141logstatsplain d---------jin178logstatsplain d---------jinput141logstatsplain d---------joequake217logstatsplain d---------jools178logstatsplain d---------jtans178logstatsplain d---------julius141logstatsplain d---------jumpnbump178logstatsplain d---------jutils109logstatsplain d---------jvgs141logstatsplain d---------jzip109logstatsplain d---------kajaani-kombat178logstatsplain d---------kanagram146logstatsplain d---------kapman146logstatsplain d---------kartofel141logstatsplain d---------katawa-shoujo109logstatsplain d---------katomic146logstatsplain d---------kblackbox146logstatsplain d---------kblocks146logstatsplain d---------kbounce146logstatsplain d---------kbreakout146logstatsplain d---------kdegames116logstatsplain d---------kdiamond146logstatsplain d---------keeperrl178logstatsplain d---------kevedit178logstatsplain d---------kfourinline146logstatsplain d---------kgoldrunner146logstatsplain d---------khangman146logstatsplain d---------kigo146logstatsplain d---------kiki141logstatsplain d---------killbots146logstatsplain d---------kiriki146logstatsplain d---------kjumpingcube146logstatsplain d---------klavaro146logstatsplain d---------klickety146logstatsplain d---------klines146logstatsplain d---------klondike178logstatsplain d---------kmahjongg146logstatsplain d---------kmines146logstatsplain d---------knavalbattle146logstatsplain d---------knetwalk146logstatsplain d---------knights146logstatsplain d---------kobodeluxe178logstatsplain d---------kolf146logstatsplain d---------kollision146logstatsplain d---------konquest146logstatsplain d---------kpat146logstatsplain d---------krank178logstatsplain d---------kreversi146logstatsplain d---------kshisen146logstatsplain d---------ksirk146logstatsplain d---------ksnakeduel146logstatsplain d---------kspaceduel146logstatsplain d---------ksquares146logstatsplain d---------ksudoku146logstatsplain d---------ktuberling146logstatsplain d---------kubrick146logstatsplain d---------kuklomenos178logstatsplain d---------kye178logstatsplain d---------ladder178logstatsplain d---------lander146logstatsplain d---------lapispuzzle146logstatsplain d---------lbreakout178logstatsplain d---------lbreakout2146logstatsplain d---------ldmud178logstatsplain d---------legend-of-edgar178logstatsplain d---------legends146logstatsplain d---------legesmotus178logstatsplain d---------lexter146logstatsplain d---------lgeneral178logstatsplain d---------libggz216logstatsplain d---------libgnome-games-support146logstatsplain d---------libkdegames146logstatsplain d---------libkmahjongg146logstatsplain d---------liblcf178logstatsplain d---------libmaitretarot146logstatsplain d---------libmt_client146logstatsplain d---------libshhcards178logstatsplain d---------lightsoff146logstatsplain d---------lightyears109logstatsplain d---------lincity-ng141logstatsplain d---------lincity178logstatsplain d---------linux-darwinia-demo217logstatsplain