X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Fcallbacks.c;h=832923c9ae9333dedc60ef0bbcb6de9ec13c3fb8;hb=451aaf275d421d71097d479eb0ae64fe908d8b6f;hp=310607d78af172e20f05f1b22466b4336ca4853b;hpb=1e3594a344fc57ed19aed95efa9e27bedb287df4;p=lttv.git diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 310607d7..832923c9 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -37,9 +37,12 @@ #include #include #include +#include +#ifdef BABEL_CLEANUP #include -#include #include +#endif /* BABEL_CLEANUP */ +#include #include #include #include @@ -49,6 +52,10 @@ #include #include +#include +#include +#include + static LttTime lttvwindow_default_time_width = { 1, 0 }; #define CLIP_BUF 256 // size of clipboard buffer @@ -75,6 +82,8 @@ char * get_selection(MainWindow *mw, void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, GtkNotebook * notebook, char * label); +int update_traceset(Tab *tab, LttvTraceset *traceset); + static void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor); LttvPluginTab *create_new_tab(GtkWidget* widget, gpointer user_data); @@ -216,13 +225,13 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) int SetTraceset(Tab * tab, LttvTraceset *traceset) { + guint i; TimeInterval time_span; TimeWindow new_time_window; LttTime new_current_time; - LttvTracesetContext *tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); +#ifdef BABEL_CLEANUP // Perform time synchronization on the traces if (syncTraceset(tsc)) { @@ -272,11 +281,17 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); } +#endif /*BABEL_CLEANUP*/ - time_span = tsc->time_span; - new_time_window = tab->time_window; - new_current_time = tab->current_time; + time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(traceset)); + time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(traceset)); + + tab->traceset_info->traceset = traceset; + + new_time_window = tab->time_window; + new_current_time = tab->current_time; + /* Set the tab's time window and current time if * out of bounds */ if(ltt_time_compare(tab->time_window.start_time, time_span.start_time) < 0 @@ -303,12 +318,13 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) } /* Finally, call the update hooks of the viewers */ - gint retval = update_traceset(tab,traceset); + gint retval = update_traceset(tab, traceset); time_change_manager(tab, new_time_window); current_time_change_manager(tab, new_current_time); return retval; + } /** @@ -626,7 +642,8 @@ void delete_viewer(GtkWidget * widget, gpointer user_data) g_object_set_data(G_OBJECT(tab->viewer_container), "focused_viewer", NULL); } - +#if UNFINISHED_FEATURE +/* TODO ybrosseau 2012-03-15: Function is half implemented. Should be removed */ /* open_traceset will open a traceset saved in a file * Right now, it is not finished yet, (not working) * FIXME @@ -663,7 +680,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data) } } - +#endif /* lttvwindow_process_pending_requests * * Process requests for parts of the trace from viewers. @@ -695,6 +712,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data) gboolean lttvwindow_process_pending_requests(Tab *tab) { + #ifdef BABEL_CLEANUP LttvTracesetContext *tsc; LttvTracefileContext *tfc; GSList *list_in = NULL; @@ -906,7 +924,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) tfc = lttv_traceset_context_get_current_tfc(tsc); g_assert(g_slist_length(list_in)>0); EventsRequest *events_request = g_slist_nth_data(list_in, 0); +#ifdef DEBUG guint seek_count; +#endif /* 1.2.1 If first request in list_in is a time request */ if(events_request->start_position == NULL) { @@ -921,7 +941,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) events_request->start_time); /* Process the traceset with only state hooks */ +#ifdef DEBUG seek_count = +#endif //DEBUG lttv_process_traceset_middle(tsc, events_request->start_time, G_MAXUINT, NULL); @@ -965,7 +987,9 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) pos_time); /* Process the traceset with only state hooks */ +#ifdef DEBUG seek_count = +#endif lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, @@ -1467,6 +1491,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) NULL); return FALSE; */ + + #endif /* BABEL_CLEANUP */ } #undef list_out @@ -1477,7 +1503,7 @@ static gboolean live_trace_update_handler(Tab *tab) { unsigned int updated_count; - +#ifdef BABEL_CLEANUP LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval initial_time_span = tsc->time_span; TimeInterval updated_time_span; @@ -1512,10 +1538,12 @@ live_trace_update_handler(Tab *tab) /* Timer will be recalled as long as there is files to update */ return (updated_count > 0); +#endif /* BABEL_CLEANUP */ } static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) { + #ifdef BABEL_CLEANUP LttvTraceset *traceset = tab->traceset_info->traceset; guint i; guint num_traces = lttv_traceset_number(traceset); @@ -1576,7 +1604,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) (GSourceFunc) live_trace_update_handler, tab); } - +#endif /* BABEL_CLEANUP */ } /* add_trace adds a trace into the current traceset. It first displays a @@ -1586,6 +1614,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) void add_trace(GtkWidget * widget, gpointer user_data) { +#ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -1690,6 +1719,8 @@ void add_trace(GtkWidget * widget, gpointer user_data) break; } gtk_widget_destroy((GtkWidget*)file_chooser); + +#endif /* BABEL_CLEANUP */ } @@ -1707,6 +1738,7 @@ void add_trace(GtkWidget * widget, gpointer user_data) void remove_trace(GtkWidget *widget, gpointer user_data) { + #ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -1795,6 +1827,7 @@ void remove_trace(GtkWidget *widget, gpointer user_data) SetTraceset(tab, (gpointer)traceset); } g_free(name); +#endif /* BABEL_CLEANUP */ } #if 0 @@ -2047,6 +2080,7 @@ void save_as(GtkWidget * widget, gpointer user_data) void zoom(GtkWidget * widget, double size) { + #ifdef BABEL_CLEANUP TimeInterval time_span; TimeWindow new_time_window; LttTime current_time, time_delta; @@ -2130,6 +2164,8 @@ void zoom(GtkWidget * widget, double size) } else { time_change_manager(tab, new_time_window); } + +#endif /* BABEL_CLEANUP */ } void zoom_in(GtkWidget * widget, gpointer user_data) @@ -2230,7 +2266,9 @@ void on_open_activate (GtkMenuItem *menuitem, gpointer user_data) { +#ifdef UNFINISHED_FEATURE open_traceset((GtkWidget*)menuitem, user_data); +#endif } @@ -2906,6 +2944,18 @@ void on_content_activate (GtkMenuItem *menuitem, gpointer user_data) { + char* filename = NULL, + *path; + GdkScreen *screen; + const char* relativePath = "doc/user/user_guide/html/index.html"; + filename = g_build_filename (g_get_current_dir(), relativePath, NULL); + path = g_strdup_printf ("ghelp://%s", filename); + + screen = gdk_screen_get_default(); + gtk_show_uri (screen, path, gtk_get_current_event_time(), NULL); + + g_free(filename); + g_free(path); g_info("Content\n"); } @@ -2927,7 +2977,6 @@ on_about_activate (GtkMenuItem *menuitem, GtkWidget *window_widget = main_window->mwindow; GtkWidget *about_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWindow *about_window = GTK_WINDOW(about_widget); - gint window_width, window_height; gtk_window_set_title(about_window, "About Linux Trace Toolkit"); @@ -2937,16 +2986,12 @@ on_about_activate (GtkMenuItem *menuitem, gtk_window_set_modal(about_window, FALSE); /* Put the about window at the center of the screen */ - gtk_window_get_size(about_window, &window_width, &window_height); - gtk_window_move (about_window, - (gdk_screen_width() - window_width)/2, - (gdk_screen_height() - window_height)/2); - + gtk_window_set_position(about_window, GTK_WIN_POS_CENTER_ALWAYS); + GtkWidget *vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(about_widget), vbox); - /* Text to show */ GtkWidget *label1 = gtk_label_new(""); gtk_misc_set_padding(GTK_MISC(label1), 10, 20); @@ -3020,7 +3065,9 @@ void on_button_open_clicked (GtkButton *button, gpointer user_data) { +#ifdef UNFINISHED_FEATURE open_traceset((GtkWidget*)button, user_data); +#endif } @@ -3214,14 +3261,19 @@ on_MNotebook_switch_page (GtkNotebook *notebook, void time_change_manager (Tab *tab, TimeWindow new_time_window) -{ +{ + /* Only one source of time change */ if(tab->time_manager_lock == TRUE) return; tab->time_manager_lock = TRUE; + TimeInterval time_span; + + LttvTraceset *ts = tab->traceset_info->traceset; + time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts)); + time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts)); + - LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - TimeInterval time_span = tsc->time_span; LttTime start_time = new_time_window.start_time; LttTime end_time = new_time_window.end_time; @@ -3229,7 +3281,8 @@ void time_change_manager (Tab *tab, /* Set scrollbar */ GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar)); - LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time); + LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time); + #if 0 gtk_range_set_increments(GTK_RANGE(tab->scrollbar), ltt_time_to_double(new_time_window.time_width) @@ -3284,6 +3337,8 @@ void time_change_manager (Tab *tab, set_time_window(tab, &new_time_window); tab->time_manager_lock = FALSE; + + } @@ -3306,8 +3361,9 @@ void current_time_change_manager (Tab *tab, } void current_position_change_manager(Tab *tab, - LttvTracesetContextPosition *pos) + LttvTracesetPosition *pos) { + #ifdef BABEL_CLEANUP LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); int retval; @@ -3321,11 +3377,13 @@ void current_position_change_manager(Tab *tab, current_time_change_manager(tab, new_time); set_current_position(tab, pos); + #endif /* BABEL_CLEANUP */ } static void on_timebar_starttime_changed(Timebar *timebar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; LttvTracesetContext * tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); @@ -3357,12 +3415,13 @@ static void on_timebar_starttime_changed(Timebar *timebar, /* Notify the time_manager */ time_change_manager(tab, new_time_window); - +#endif /* BABEL_CLEANUP */ } static void on_timebar_endtime_changed(Timebar *timebar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; LttvTracesetContext * tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); @@ -3394,6 +3453,7 @@ static void on_timebar_endtime_changed(Timebar *timebar, /* Notify the time_manager */ time_change_manager(tab, new_time_window); + #endif /* BABEL_CLEANUP*/ } static void on_timebar_currenttime_changed(Timebar *timebar, gpointer user_data) @@ -3408,6 +3468,7 @@ static void on_timebar_currenttime_changed(Timebar *timebar, void scroll_value_changed_cb(GtkWidget *scrollbar, gpointer user_data) { + #ifdef BABEL_CLEANUP Tab *tab = (Tab *)user_data; TimeWindow new_time_window; LttTime time; @@ -3465,6 +3526,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, /* call viewer hooks for new time window */ set_time_window(tab, &time_window); #endif //0 +#endif /* BABEL_CLEANUP */ } @@ -3708,8 +3770,7 @@ MainWindow *construct_main_window(MainWindow * parent) LttvIAttribute *attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL)); LttvAttributeValue value; - Tab *new_tab; - + new_m_window = g_new(MainWindow, 1); // Add the object's information to the module's array @@ -3770,7 +3831,6 @@ MainWindow *construct_main_window(MainWindow * parent) "Tab_Plugin", ptab, (GDestroyNotify)tab_destructor); - new_tab = ptab->tab; } else { LttvPluginTab *ptab = g_object_new(LTTV_TYPE_PLUGIN_TAB, NULL); init_tab(ptab->tab, new_m_window, NULL, notebook, "Traceset"); @@ -3780,7 +3840,6 @@ MainWindow *construct_main_window(MainWindow * parent) "Tab_Plugin", ptab, (GDestroyNotify)tab_destructor); - new_tab = ptab->tab; } /* Insert default viewers */ @@ -3838,6 +3897,7 @@ MainWindow *construct_main_window(MainWindow * parent) void tab_destructor(LttvPluginTab * ptab) { +#ifdef BABEL_CLEANUP int i, nb, ref_count; LttvTrace * trace; Tab *tab = ptab->tab; @@ -3876,6 +3936,7 @@ void tab_destructor(LttvPluginTab * ptab) g_free(tab->traceset_info); //g_free(tab); g_object_unref(ptab); +#endif /* BABEL_CLEANUP */ } @@ -3885,6 +3946,7 @@ void tab_destructor(LttvPluginTab * ptab) void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, GtkNotebook * notebook, char * label) { + GList * list; //Tab * tab; //LttvFilter *filter = NULL; @@ -3902,9 +3964,13 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, /* Copy the previous tab's filter */ /* We can clone the filter, as we copy the trace set also */ /* The filter must always be in sync with the trace set */ + +#ifdef BABEL_CLEANUP tab->filter = lttv_filter_clone(copy_tab->filter); +#endif /* BABEL_CLEANUP */ } else { tab->traceset_info->traceset = lttv_traceset_new(); + tab->filter = NULL; } #ifdef DEBUG @@ -3914,21 +3980,17 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, 0, 4); fflush(stdout); #endif //DEBUG - +// tab->time_manager_lock = FALSE; tab->current_time_manager_lock = FALSE; - +#ifdef BABEL_CLEANUP //FIXME copy not implemented in lower level tab->traceset_info->traceset_context = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); - g_assert(tab->traceset_info->traceset_context != NULL); - lttv_context_init( - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context), - tab->traceset_info->traceset); //add state update hooks lttv_state_add_event_hooks( (LttvTracesetState*)tab->traceset_info->traceset_context); - +#endif //BABEL_CLEANUP //determine the current_time and time_window of the tab #if 0 if(copy_tab != NULL){ @@ -4093,7 +4155,7 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, lttvwindow_report_time_window(tab, time_window); lttvwindow_report_current_time(tab, ltt_time_zero); } - + LttvTraceset *traceset = tab->traceset_info->traceset; SetTraceset(tab, traceset); } @@ -4111,8 +4173,9 @@ gboolean execute_events_requests(Tab *tab) } -__EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_live) +__EXPORT void create_main_window_with_trace_list(GSList *traces) { + GSList *iter = NULL; /* Create window */ @@ -4132,24 +4195,19 @@ __EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_liv ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); tab = ptab->tab; } - + + LttvTraceset * traceset = lttv_traceset_new(); for(iter=traces; iter!=NULL; iter=g_slist_next(iter)) { gchar *path = (gchar*)iter->data; /* Add trace */ gchar abs_path[PATH_MAX]; - LttvTrace *trace_v; - LttTrace *trace; + get_absolute_pathname(path, abs_path); - trace_v = lttvwindowtraces_get_trace_by_name(abs_path); - if(trace_v == NULL) { - if(is_live) { - trace = ltt_trace_open_live(abs_path); - } else { - trace = ltt_trace_open(abs_path); - } - if(trace == NULL) { - g_warning("cannot open trace %s", abs_path); + + if(lttv_traceset_add_path(traceset,abs_path) != 0 ){ /*failure*/ + + g_warning("cannot open trace %s", abs_path); GtkWidget *dialogue = gtk_message_dialog_new( @@ -4161,19 +4219,10 @@ __EXPORT void create_main_window_with_trace_list(GSList *traces, gboolean is_liv "to select it ?"); gtk_dialog_run(GTK_DIALOG(dialogue)); gtk_widget_destroy(dialogue); - } else { - trace_v = lttv_trace_new(trace); - lttvwindowtraces_add_trace(trace_v); - lttvwindow_add_trace(tab, trace_v); - } - } else { - lttvwindow_add_trace(tab, trace_v); } - } - - LttvTraceset *traceset; - - traceset = tab->traceset_info->traceset; - SetTraceset(tab, traceset); + else{ + SetTraceset(tab, traceset); + } + } }