Logo Search packages:      
Sourcecode: ion3 version File versions

main.c

/*
 * ion/mod_floatws/main.c
 *
 * Copyright (c) Tuomo Valkonen 1999-2005. 
 *
 * Ion is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 */

#include <libextl/readconfig.h>
#include <libextl/extl.h>
#include <libmainloop/hooks.h>
#include <ioncore/bindmaps.h>
#include <ioncore/framep.h>
#include <ioncore/frame-pointer.h>
#include <ioncore/reginfo.h>
#include <ioncore/clientwin.h>

#include "floatws.h"
#include "floatframe.h"
#include "exports.h"


/*{{{ Module information */


#include "../version.h"

char mod_floatws_ion_api_version[]=ION_API_VERSION;


/*}}}*/


/*{{{ Bindmaps */


WBindmap *mod_floatws_floatws_bindmap=NULL;
WBindmap *mod_floatws_floatframe_bindmap=NULL;


static StringIntMap frame_areas[]={
    {"border",     FRAME_AREA_BORDER},
    {"tab",        FRAME_AREA_TAB},
    {"empty_tab",  FRAME_AREA_TAB},
    {"client",     FRAME_AREA_CLIENT},
    END_STRINGINTMAP
};


/*}}}*/


/*{{{ Init & deinit */


void mod_floatws_deinit()
{
    hook_remove(clientwin_do_manage_alt, 
                (WHookDummy*)mod_floatws_clientwin_do_manage);

    if(mod_floatws_floatws_bindmap!=NULL){
        ioncore_free_bindmap("WFloatWS", mod_floatws_floatws_bindmap);
        mod_floatws_floatws_bindmap=NULL;
    }
    
    if(mod_floatws_floatframe_bindmap!=NULL){
        ioncore_free_bindmap("WFloatFrame", mod_floatws_floatframe_bindmap);
        mod_floatws_floatframe_bindmap=NULL;
    }
    
    ioncore_unregister_regclass(&CLASSDESCR(WFloatWS));
    ioncore_unregister_regclass(&CLASSDESCR(WFloatFrame));
    
    mod_floatws_unregister_exports();
}



bool mod_floatws_init()
{
    mod_floatws_floatws_bindmap=ioncore_alloc_bindmap("WFloatWS", NULL);
       
    mod_floatws_floatframe_bindmap=ioncore_alloc_bindmap("WFloatFrame", 
                                                         frame_areas);

    if(mod_floatws_floatws_bindmap==NULL ||
       mod_floatws_floatframe_bindmap==NULL){
        goto err;
    }

    if(!mod_floatws_register_exports())
        goto err;
    
    if(!ioncore_register_regclass(&CLASSDESCR(WFloatWS),
                                  (WRegionLoadCreateFn*) floatws_load) ||
       !ioncore_register_regclass(&CLASSDESCR(WFloatFrame), 
                                  (WRegionLoadCreateFn*) floatframe_load)){
        goto err;
    }

    extl_read_config("cfg_floatws", NULL, TRUE);
    
    hook_add(clientwin_do_manage_alt, 
             (WHookDummy*)mod_floatws_clientwin_do_manage);

    return TRUE;
    
err:
    mod_floatws_deinit();
    return FALSE;
}


/*}}}*/


Generated by  Doxygen 1.6.0   Back to index