X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Fcallbacks.c;h=ea3c385023788b2aad0c777a7c7b7b16a3cb5e79;hb=95544594524c5193c0f0bbdde453e6412456893f;hp=34bce0a9bfd066e6e9832ea48a46e2657025bd8c;hpb=9aaa78dc9323698c4c44e5aaa24322d0c9e26dab;p=lttv.git diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 34bce0a9..ea3c3850 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -226,7 +226,6 @@ 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; @@ -710,7 +709,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data) gboolean lttvwindow_process_pending_requests(Tab *tab) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttvTracesetContext *tsc; LttvTracefileContext *tfc; GSList *list_in = NULL; @@ -987,11 +986,12 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* Process the traceset with only state hooks */ #ifdef DEBUG seek_count = -#endif + lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, events_request->start_position); +#endif g_assert(lttv_traceset_context_ctx_pos_compare(tsc, events_request->start_position) == 0); @@ -1500,8 +1500,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) static gboolean live_trace_update_handler(Tab *tab) { - unsigned int updated_count; #ifdef BABEL_CLEANUP + unsigned int updated_count; LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval initial_time_span = tsc->time_span; TimeInterval updated_time_span; @@ -1541,7 +1541,7 @@ live_trace_update_handler(Tab *tab) static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttvTraceset *traceset = tab->traceset_info->traceset; guint i; guint num_traces = lttv_traceset_number(traceset); @@ -1613,7 +1613,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) void add_trace(GtkWidget * widget, gpointer user_data) { - LttvTraceset * traceset; + LttvTraceset * traceset = NULL; const char * path; char abs_path[PATH_MAX]; gint id; @@ -1632,10 +1632,26 @@ void add_trace(GtkWidget * widget, gpointer user_data) ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); tab = ptab->tab; } + traceset = lttvwindow_get_traceset(tab); + if(traceset != NULL && lttv_traceset_number(traceset) > 0){ + GtkWidget *dialogue = + gtk_message_dialog_new( + GTK_WINDOW(gtk_widget_get_toplevel(widget)), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Loading multiple traces is not supported at the moment."); + gtk_dialog_run(GTK_DIALOG(dialogue)); + gtk_widget_destroy(dialogue); + return; + } + /* Create a new traceset*/ traceset = lttv_traceset_new(); /* File open dialog management */ - GtkWidget *extra_live_button; +#ifdef BABEL_CLEANUP + GtkWidget *extra_live_button; +#endif //babel_cleanup GtkFileChooser * file_chooser = GTK_FILE_CHOOSER( gtk_file_chooser_dialog_new ("Select a trace", @@ -1644,12 +1660,12 @@ void add_trace(GtkWidget * widget, gpointer user_data) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL)); - +#ifdef BABEL_CLEANUP /* Button to indicate the opening of a live trace */ extra_live_button = gtk_check_button_new_with_mnemonic ("Trace is live (currently being writen)"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra_live_button), FALSE); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (file_chooser), extra_live_button); - +#endif //babel_cleanup gtk_file_chooser_set_show_hidden (file_chooser, TRUE); if(remember_trace_dir[0] != '\0') gtk_file_chooser_set_filename(file_chooser, remember_trace_dir); @@ -1725,7 +1741,7 @@ void add_trace(GtkWidget * widget, gpointer user_data) void remove_trace(GtkWidget *widget, gpointer user_data) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -2067,7 +2083,7 @@ void save_as(GtkWidget * widget, gpointer user_data) void zoom(GtkWidget * widget, double size) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP TimeInterval time_span; TimeWindow new_time_window; LttTime current_time, time_delta; @@ -3347,30 +3363,23 @@ void current_time_change_manager (Tab *tab, tab->current_time_manager_lock = FALSE; } -void current_position_change_manager(Tab *tab, - LttvTracesetPosition *pos) +void current_position_change_manager(Tab *tab, LttvTracesetPosition *pos) { - #ifdef BABEL_CLEANUP - LttvTracesetContext *tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - int retval; - - retval= lttv_process_traceset_seek_position(tsc, pos); - g_assert_cmpint(retval, ==, 0); - LttTime new_time = lttv_traceset_context_position_get_time(pos); + lttv_traceset_seek_to_position( pos); + + LttTime new_time = lttv_traceset_position_get_time(pos); /* Put the context in a state coherent position */ - lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); - +#ifdef BABEL_CLEANUP + lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); +#endif /* BABEL_CLEANUP */ 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) { - Tab *tab = (Tab *)user_data; LttvTraceset * ts =tab->traceset_info->traceset; TimeInterval time_span = lttv_traceset_get_time_span(ts); @@ -3407,7 +3416,6 @@ static void on_timebar_starttime_changed(Timebar *timebar, static void on_timebar_endtime_changed(Timebar *timebar, gpointer user_data) { - Tab *tab = (Tab *)user_data; LttvTraceset * ts =tab->traceset_info->traceset; TimeInterval time_span = lttv_traceset_get_time_span(ts); @@ -3452,7 +3460,6 @@ static void on_timebar_currenttime_changed(Timebar *timebar, void scroll_value_changed_cb(GtkWidget *scrollbar, gpointer user_data) { - Tab *tab = (Tab *)user_data; TimeWindow new_time_window; LttTime time;