Make modules more flexible (builtin or loaded are identical). Add a test module
[lttv.git] / ltt / branches / poly / lttv / modules / gui / main / src / init_module.c
index 2201eadc1f6d5167055fab578fdebcb5a2d4783b..781844ad04d2f7804b7173042098211dfa3fede7 100644 (file)
@@ -1,3 +1,21 @@
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2003-2004 Mathieu Desnoyers and XangXiu Yang
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * 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 Place - Suite 330, Boston, 
+ * MA 02111-1307, USA.
+ */
+
 /*
  * Initial main.c file generated by Glade. Edit as required.
  * Glade will not overwrite this file.
 
 #include "interface.h"
 #include "support.h"
-#include <lttv/mainWindow.h>
+#include <lttv/mainwindow.h>
 #include "callbacks.h"
 #include <ltt/trace.h>
 
 
-/* global variable */
-static WindowCreationData  win_creation_data;
-
 /** Array containing instanced objects. */
 GSList * g_main_window_list = NULL ;
 
@@ -61,9 +76,7 @@ void lttv_trace_option(void *hook_data)
 
 static gboolean window_creation_hook(void *hook_data, void *call_data)
 {
-  WindowCreationData* window_creation_data = (WindowCreationData*)hook_data;
-
-  g_critical("GUI window_creation_hook()");
+  g_debug("GUI window_creation_hook()");
 #ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -71,27 +84,27 @@ static gboolean window_creation_hook(void *hook_data, void *call_data)
 #endif
 
   gtk_set_locale ();
-  gtk_init (&(window_creation_data->argc), &(window_creation_data->argv));
+  gtk_init (&lttv_argc, &lttv_argv);
 
   add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
   add_pixmap_directory ("pixmaps");
-  add_pixmap_directory ("modules/gui/mainWin/pixmaps");
+  add_pixmap_directory ("../modules/gui/main/pixmaps");
 
-  construct_main_window(NULL, window_creation_data);
+  construct_main_window(NULL);
 
   gtk_main ();
 
   return FALSE;
 }
 
-G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
+static void init() {
 
   LttvAttributeValue value;
  
   // Global attributes only used for interaction with main() here.
   LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
   
-  g_critical("GUI init()");
+  g_debug("GUI init()");
   
   lttv_option_add("trace", 't', 
       "add a trace to the trace set to analyse", 
@@ -102,10 +115,7 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
       LTTV_POINTER, &value));
   g_assert((main_hooks = *(value.v_pointer)) != NULL);
 
-  win_creation_data.argc = argc;
-  win_creation_data.argv = argv;
-  
-  lttv_hooks_add(main_hooks, window_creation_hook, &win_creation_data);
+  lttv_hooks_add(main_hooks, window_creation_hook, NULL);
 
 }
 
@@ -156,16 +166,16 @@ void main_window_destroy_walk(gpointer data, gpointer user_data)
  * This function releases the memory reserved by the module and unregisters
  * everything that has been registered in the gtkTraceSet API.
  */
-G_MODULE_EXPORT void destroy() {
+static void destroy() {
 
   LttvAttributeValue value;  
   LttvTrace *trace;
 
   lttv_option_remove("trace");
 
-  lttv_hooks_remove_data(main_hooks, window_creation_hook, &win_creation_data);
+  lttv_hooks_remove_data(main_hooks, window_creation_hook, NULL);
 
-  g_critical("GUI destroy()");
+  g_debug("GUI destroy()");
 
   if(g_main_window_list){
     g_slist_foreach(g_main_window_list, main_window_destroy_walk, NULL );
@@ -175,5 +185,6 @@ G_MODULE_EXPORT void destroy() {
 }
 
 
-
-
+LTTV_MODULE("mainwin", "Viewer main window", \
+    "Viewer with multiple windows, tabs and panes for graphical modules", \
+           init, destroy, "stats")
This page took 0.024096 seconds and 4 git commands to generate.