New module loading scheme
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 04 Mar 2010 19:51:17 +0200
changeset 11 dc7bcc0fa5e1
parent 10 ee45895bc62a
child 12 14cd74b518ea
New module loading scheme
CMakeLists.txt
env.c
env.rc
--- a/CMakeLists.txt	Mon Feb 15 17:53:36 2010 +0200
+++ b/CMakeLists.txt	Thu Mar 04 19:51:17 2010 +0200
@@ -22,10 +22,8 @@
 ## Check for build dependencies
 find_package(PkgConfig REQUIRED) 
 pkg_check_modules(GLIB REQUIRED glib-2.0) 
-pkg_check_modules(GMODULE REQUIRED gmodule-2.0) 
 pkg_check_modules(MCABBER REQUIRED mcabber)
 link_directories(${GLIB_LIBRARY_DIRS}
-				 ${GMODULE_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
 
 ## Target definitions
@@ -33,10 +31,8 @@
 
 ## Compiler setup
 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} 
-                    ${GMODULE_INCLUDE_DIRS}
                     ${MCABBER_INCLUDE_DIRS})
 target_link_libraries(env ${GLIB_LIBRARIES} 
-                      ${GMODULE_LIBRARIES}
 					  ${MCABBER_LIBRARIES})
 include_directories(${env_SOURCE_DIR} 
                     ${env_BINARY_DIR})
--- a/env.c	Mon Feb 15 17:53:36 2010 +0200
+++ b/env.c	Thu Mar 04 19:51:17 2010 +0200
@@ -20,7 +20,6 @@
  */
 
 #include <glib.h>
-#include <gmodule.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -29,6 +28,17 @@
 #include <mcabber/utils.h>
 #include <mcabber/compl.h>
 #include <mcabber/logprint.h>
+#include <mcabber/modules.h>
+
+static void env_load   (void);
+static void env_unload (void);
+
+module_info_t info_env = {
+	.mcabber_version = "0.10.0",
+	.requires        = NULL,
+	.init            = env_load,
+	.uninit          = env_unload,
+};
 
 extern char **environ;
 
@@ -130,16 +140,14 @@
 		scr_LogPrint (LPRINT_NORMAL, "Cannot change current working directory: %s.", strerror (errno));
 }
 
-const gchar *g_module_check_init(GModule *module)
+static void env_load (void)
 {
 	// command
 	cmd_add ("env", "", 0, 0, do_env, NULL);
 	cmd_add ("cd", "", COMPL_FILENAME, 0, do_cd, NULL);
-
-	return NULL;
 }
 
-void g_module_unload(GModule *module)
+static void env_unload (void)
 {
 	// command
 	cmd_del ("cd");
--- a/env.rc	Mon Feb 15 17:53:36 2010 +0200
+++ b/env.rc	Thu Mar 04 19:51:17 2010 +0200
@@ -1,3 +1,3 @@
 
-load env
+module load env