4 * Copyright (c) Tuomo Valkonen 1999-2006.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
12 #include <libtu/map.h>
14 #include <ioncore/common.h>
15 #include <ioncore/reginfo.h>
16 #include <libextl/readconfig.h>
17 #include <ioncore/framep.h>
18 #include <ioncore/bindmaps.h>
19 #include <ioncore/bindmaps.h>
23 #include "placement.h"
27 /*{{{ Module information */
30 #include "../version.h"
32 char mod_panews_ion_api_version[]=ION_API_VERSION;
41 WBindmap *mod_panews_panews_bindmap=NULL;
42 WBindmap *mod_panews_frame_bindmap=NULL;
43 WBindmap *mod_panews_unusedwin_bindmap=NULL;
49 /*{{{ Module init & deinit */
52 void mod_panews_deinit()
54 mod_panews_unregister_exports();
55 ioncore_unregister_regclass(&CLASSDESCR(WPaneWS));
57 if(mod_panews_panews_bindmap!=NULL){
58 ioncore_free_bindmap("WPaneWS", mod_panews_panews_bindmap);
59 mod_panews_panews_bindmap=NULL;
62 if(mod_panews_unusedwin_bindmap!=NULL){
63 ioncore_free_bindmap("WUnusedWin", mod_panews_unusedwin_bindmap);
64 mod_panews_unusedwin_bindmap=NULL;
67 if(mod_panews_frame_bindmap!=NULL){
68 ioncore_free_bindmap("WFrame-on-WPaneWS", mod_panews_frame_bindmap);
69 mod_panews_frame_bindmap=NULL;
72 if(panews_init_layout_alt!=NULL){
73 destroy_obj((Obj*)panews_init_layout_alt);
74 panews_init_layout_alt=NULL;
77 if(panews_make_placement_alt!=NULL){
78 destroy_obj((Obj*)panews_make_placement_alt);
79 panews_make_placement_alt=NULL;
84 static bool register_regions()
86 if(!ioncore_register_regclass(&CLASSDESCR(WPaneWS),
87 (WRegionLoadCreateFn*)panews_load)){
95 #define INIT_HOOK_(NM) \
96 NM=mainloop_register_hook(#NM, create_hook()); \
97 if(NM==NULL) return FALSE;
100 static bool init_hooks()
102 INIT_HOOK_(panews_init_layout_alt);
103 INIT_HOOK_(panews_make_placement_alt);
109 bool mod_panews_init()
114 mod_panews_panews_bindmap=ioncore_alloc_bindmap("WPaneWS", NULL);
115 mod_panews_unusedwin_bindmap=ioncore_alloc_bindmap_frame("WUnusedWin");
116 mod_panews_frame_bindmap=ioncore_alloc_bindmap_frame("WFrame-on-WPaneWS");
118 if(mod_panews_panews_bindmap==NULL ||
119 mod_panews_unusedwin_bindmap==NULL ||
120 mod_panews_frame_bindmap==NULL){
124 if(!mod_panews_register_exports())
127 if(!register_regions())
130 /*ioncore_read_config("cfg_panews", NULL, FALSE);*/