state update hooks fixes
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 4 May 2004 22:50:34 +0000 (22:50 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 4 May 2004 22:50:34 +0000 (22:50 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@512 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/main.c [deleted file]
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/test_main.c [new file with mode: 0644]

index 663471e38fa7fbfe4298433e2ea4e2fbda6a5032..ecbde8e751c62092a8cdce4c1fcfd31c80b22bc2 100644 (file)
@@ -504,9 +504,13 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       trace_v = lttv_trace_new(trace);
       traceset = mw_data->current_tab->traceset_info->traceset;
       if(mw_data->current_tab->traceset_info->traceset_context != NULL){
-       lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
-                                               traceset_info->traceset_context));
-       g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
+      //remove state update hooks
+      lttv_state_remove_event_hooks(
+           (LttvTracesetState*)mw_data->current_tab->traceset_info->
+                                traceset_context);
+       lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
+                                               traceset_info->traceset_context));
+       g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
       }
       lttv_traceset_add(traceset, trace_v);
       mw_data->current_tab->traceset_info->traceset_context =
@@ -514,6 +518,11 @@ void add_trace(GtkWidget * widget, gpointer user_data)
       lttv_context_init(
        LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->
                              traceset_context),traceset); 
+      //add state update hooks
+      lttv_state_add_event_hooks(
+      (LttvTracesetState*)mw_data->current_tab->traceset_info->traceset_context);
+  
       add_trace_into_traceset_selector(mw_data->current_tab->multi_vpaned, trace);
 
       gtk_widget_destroy((GtkWidget*)file_selector);
@@ -636,6 +645,10 @@ void remove_trace(GtkWidget * widget, gpointer user_data)
            ltt_trace_close(lttv_trace(trace_v));
 
          if(mw_data->current_tab->traceset_info->traceset_context != NULL){
+      //remove state update hooks
+      lttv_state_remove_event_hooks(
+           (LttvTracesetState*)mw_data->current_tab->traceset_info->
+                                traceset_context);
            lttv_context_fini(LTTV_TRACESET_CONTEXT(mw_data->current_tab->
                                                    traceset_info->traceset_context));
            g_object_unref(mw_data->current_tab->traceset_info->traceset_context);
@@ -645,9 +658,12 @@ void remove_trace(GtkWidget * widget, gpointer user_data)
             lttv_trace_destroy(trace_v);
          mw_data->current_tab->traceset_info->traceset_context =
            g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
-         lttv_context_init(
+           lttv_context_init(
                            LTTV_TRACESET_CONTEXT(mw_data->current_tab->
                                      traceset_info->traceset_context),traceset);      
+      //add state update hooks
+      lttv_state_add_event_hooks(
+      (LttvTracesetState*)mw_data->current_tab->traceset_info->traceset_context);
          //update current tab
          update_traceset(mw_data);
          if(nb_trace > 1){
@@ -1862,6 +1878,10 @@ void tab_destructor(Tab * tab_instance)
   }
 
   if(tab_instance->traceset_info->traceset_context != NULL){
+    //remove state update hooks
+    lttv_state_remove_event_hooks(
+         (LttvTracesetState*)tab_instance->traceset_info->
+                              traceset_context);
     lttv_context_fini(LTTV_TRACESET_CONTEXT(tab_instance->traceset_info->
                                            traceset_context));
     g_object_unref(tab_instance->traceset_info->traceset_context);
@@ -1929,7 +1949,11 @@ void * create_tab(MainWindow * parent, MainWindow* current_window,
   lttv_context_init(
            LTTV_TRACESET_CONTEXT(tmp_tab->traceset_info->traceset_context),
                                  tmp_tab->traceset_info->traceset);
-
+  //add state update hooks
+  lttv_state_add_event_hooks(
+       (LttvTracesetState*)tmp_tab->traceset_info->traceset_context);
+  
   //determine the current_time and time_window of the tab
   if(mw_data->current_tab){
     // Will have to read directly at the main window level, as we want
@@ -1972,11 +1996,7 @@ void * create_tab(MainWindow * parent, MainWindow* current_window,
           tmp_tab,
           (GDestroyNotify)tab_destructor);
 
-  //add state update hooks
-  lttv_state_add_event_hooks(
-       (LttvTracesetState*)tmp_tab->traceset_info->traceset_context);
-  
-  //insert tab into notebook
+ //insert tab into notebook
   gtk_notebook_append_page(notebook, (GtkWidget*)tmp_tab->multi_vpaned, tmp_tab->label);  
   list = gtk_container_get_children(GTK_CONTAINER(notebook));
   gtk_notebook_set_current_page(notebook,g_list_length(list)-1);
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/main.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/main.c
deleted file mode 100644 (file)
index 7b31ac6..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Initial main.c file generated by Glade. Edit as required.
- * Glade will not overwrite this file.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <gmodule.h>
-
-#include "interface.h"
-#include "support.h"
-#include <lttvwindow/mainWindow.h>
-#include "callbacks.h"
-
-/* global variable */
-systemView * gSysView;
-
-typedef view_constructor (* constructor)();
-constructor get_constructor = NULL;
-typedef void (*call_Event_Selected_Hook)(void * call_data);
-call_Event_Selected_Hook selected_hook = NULL;
-GModule *gm;
-view_constructor gConstructor = NULL;
-
-int
-main (int argc, char *argv[])
-{
-  GModule *gm;
-  GtkWidget * ToolMenuTitle_menu, *insert_view;
-  GtkWidget *window1;
-  mainWindow * mw = g_new(mainWindow, 1);
-  gSysView = g_new(systemView, 1);
-
-#ifdef ENABLE_NLS
-  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-  textdomain (GETTEXT_PACKAGE);
-#endif
-
-  gtk_set_locale ();
-  gtk_init (&argc, &argv);
-
-  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
-  add_pixmap_directory ("pixmaps");
-  add_pixmap_directory ("../pixmaps");
-
-  /*
-   * The following code was added by Glade to create one of each component
-   * (except popup menus), just so that you see something after building
-   * the project. Delete any components that you don't want shown initially.
-   */
-  window1 = create_MWindow ();
-  gtk_widget_show (window1);
-
-  mw->MWindow = window1;
-  mw->SystemView = gSysView;
-  mw->Tab = NULL;
-  mw->CurrentTab = NULL;
-  //  mw->Attributes = lttv_attributes_new();
-
-  //test
-
-  gm = g_module_open("/home1/yangxx/poly/lttv/modules/libguiEvents.la",0);
-  printf("Main : the address of gm : %d\n", gm);
-  if(!g_module_symbol(gm, "get_constructor", (gpointer)&get_constructor)){
-    g_error("can not get constructor\n");
-  }  
-  if(!g_module_symbol(gm, "call_Event_Selected_Hook", (gpointer)&selected_hook)){
-    g_error("can not get selected hook\n");
-  }  
-
-  gConstructor = get_constructor();
-  ToolMenuTitle_menu = lookup_widget(mw->MWindow,"ToolMenuTitle_menu");
-  insert_view = gtk_menu_item_new_with_mnemonic ("insert_view");
-  gtk_widget_show (insert_view);
-  gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), insert_view);
-  g_signal_connect ((gpointer) insert_view, "activate",
-                    G_CALLBACK (insertViewTest),
-                    NULL);  
-  //end
-
-  gSysView->EventDB = NULL;
-  gSysView->SystemInfo = NULL;
-  gSysView->Options  = NULL;
-  gSysView->Window = mw;
-  gSysView->Next = NULL;
-
-  g_object_set_data(G_OBJECT(window1), "systemView", (gpointer)gSysView);
-  g_object_set_data(G_OBJECT(window1), "mainWindow", (gpointer)mw);
-
-  gtk_main ();
-  return 0;
-}
-
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/test_main.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/test_main.c
new file mode 100644 (file)
index 0000000..7b31ac6
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Initial main.c file generated by Glade. Edit as required.
+ * Glade will not overwrite this file.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <gmodule.h>
+
+#include "interface.h"
+#include "support.h"
+#include <lttvwindow/mainWindow.h>
+#include "callbacks.h"
+
+/* global variable */
+systemView * gSysView;
+
+typedef view_constructor (* constructor)();
+constructor get_constructor = NULL;
+typedef void (*call_Event_Selected_Hook)(void * call_data);
+call_Event_Selected_Hook selected_hook = NULL;
+GModule *gm;
+view_constructor gConstructor = NULL;
+
+int
+main (int argc, char *argv[])
+{
+  GModule *gm;
+  GtkWidget * ToolMenuTitle_menu, *insert_view;
+  GtkWidget *window1;
+  mainWindow * mw = g_new(mainWindow, 1);
+  gSysView = g_new(systemView, 1);
+
+#ifdef ENABLE_NLS
+  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+#endif
+
+  gtk_set_locale ();
+  gtk_init (&argc, &argv);
+
+  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
+  add_pixmap_directory ("pixmaps");
+  add_pixmap_directory ("../pixmaps");
+
+  /*
+   * The following code was added by Glade to create one of each component
+   * (except popup menus), just so that you see something after building
+   * the project. Delete any components that you don't want shown initially.
+   */
+  window1 = create_MWindow ();
+  gtk_widget_show (window1);
+
+  mw->MWindow = window1;
+  mw->SystemView = gSysView;
+  mw->Tab = NULL;
+  mw->CurrentTab = NULL;
+  //  mw->Attributes = lttv_attributes_new();
+
+  //test
+
+  gm = g_module_open("/home1/yangxx/poly/lttv/modules/libguiEvents.la",0);
+  printf("Main : the address of gm : %d\n", gm);
+  if(!g_module_symbol(gm, "get_constructor", (gpointer)&get_constructor)){
+    g_error("can not get constructor\n");
+  }  
+  if(!g_module_symbol(gm, "call_Event_Selected_Hook", (gpointer)&selected_hook)){
+    g_error("can not get selected hook\n");
+  }  
+
+  gConstructor = get_constructor();
+  ToolMenuTitle_menu = lookup_widget(mw->MWindow,"ToolMenuTitle_menu");
+  insert_view = gtk_menu_item_new_with_mnemonic ("insert_view");
+  gtk_widget_show (insert_view);
+  gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), insert_view);
+  g_signal_connect ((gpointer) insert_view, "activate",
+                    G_CALLBACK (insertViewTest),
+                    NULL);  
+  //end
+
+  gSysView->EventDB = NULL;
+  gSysView->SystemInfo = NULL;
+  gSysView->Options  = NULL;
+  gSysView->Window = mw;
+  gSysView->Next = NULL;
+
+  g_object_set_data(G_OBJECT(window1), "systemView", (gpointer)gSysView);
+  g_object_set_data(G_OBJECT(window1), "mainWindow", (gpointer)mw);
+
+  gtk_main ();
+  return 0;
+}
+
This page took 0.029343 seconds and 4 git commands to generate.