X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Flttvwindow.c;h=66639b4f72e7c1f63a396fa25e0dc55772bc33a4;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=ee3f9246063d47ce243fa6aa5a5a3c867158ed04;hpb=8d8c5ea79a434752faf43cd66acc38196d25268d;p=lttv.git diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index ee3f9246..66639b4f 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -12,8 +12,8 @@ * * 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. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ /*! \file lttvwindow.c @@ -32,13 +32,14 @@ #include #endif -#include #include #include +#include +#ifdef BABEL_CLEANUP #include -#include +#endif /* BABEL_CLEANUP */ #include -#include +#include #include #include #include @@ -115,13 +116,13 @@ void set_current_time(Tab *tab, const LttTime *current_time) * This is called whenever the current time value changes. */ -void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos) +void set_current_position(Tab *tab, const LttvTracesetPosition *pos) { LttvAttributeValue value; LttvHooks * tmp; gboolean retval; - tab->current_time = lttv_traceset_context_position_get_time(pos); + tab->current_time = lttv_traceset_position_get_time(pos); retval= lttv_iattribute_find_by_path(tab->attributes, "hooks/updatecurrentposition", LTTV_POINTER, &value); @@ -467,6 +468,53 @@ __EXPORT void lttvwindow_unregister_time_window_notify(Tab *tab, lttv_hooks_remove_data(tmp, hook, hook_data); } +/** + * Function to register a hook function for a viewer to set/update its + * allowed time span. + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ +__EXPORT void lttvwindow_register_timespan_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetimespan", LTTV_POINTER, &value); + g_assert(retval); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook,hook_data, LTTV_PRIO_DEFAULT); +} +/** + * Function to unregister a viewer's hook function which is used to + * set/update the time span allowed for the viewer. + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +__EXPORT void lttvwindow_unregister_timespan_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + gboolean retval; + + retval= lttv_iattribute_find_by_path(tab->attributes, + "hooks/updatetimespan", LTTV_POINTER, &value); + g_assert(retval); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_remove_data(tmp, hook, hook_data); +} + /** * Function to register a hook function for a viewer to set/update its * traceset. @@ -961,7 +1009,7 @@ __EXPORT void lttvwindow_report_current_time(Tab *tab, */ __EXPORT void lttvwindow_report_current_position(Tab *tab, - LttvTracesetContextPosition *pos) + LttvTracesetPosition *pos) { current_position_change_manager(tab, pos); } @@ -1093,8 +1141,12 @@ __EXPORT gboolean lttvwindow_events_request_pending(Tab *tab) { GSList *element = tab->events_requests; - if(element == NULL) return FALSE; - else return TRUE; + if(element == NULL){ + return FALSE; + } + else { + return TRUE; + } } @@ -1167,7 +1219,7 @@ void lttvwindow_report_filter(Tab *tab, LttvFilter *filter) lttv_hooks_call(tmp, filter); } - +#ifdef BABEL_CLEANUP /** * Function to get the stats of the traceset @@ -1178,26 +1230,32 @@ __EXPORT LttvTracesetStats* lttvwindow_get_traceset_stats(Tab *tab) { return tab->traceset_info->traceset_context; } +#endif /*BABEL_CLEANUP*/ -__EXPORT LttvTracesetContext* lttvwindow_get_traceset_context(Tab *tab) +__EXPORT LttvTraceset *lttvwindow_get_traceset(Tab *tab) { - return (LttvTracesetContext*)tab->traceset_info->traceset_context; + return tab->traceset_info->traceset; } - void events_request_free(EventsRequest *events_request) { + if(events_request == NULL) return; if(events_request->start_position != NULL) - lttv_traceset_context_position_destroy(events_request->start_position); + lttv_traceset_destroy_position(events_request->start_position); if(events_request->end_position != NULL) - lttv_traceset_context_position_destroy(events_request->end_position); - if(events_request->hooks != NULL) { + lttv_traceset_destroy_position(events_request->end_position); +#ifdef BABEL_CLEANUP + if(events_request->hooks != NULL) { GArray *hooks = events_request->hooks; + lttv_trace_hook_remove_all(&hooks); + g_array_free(events_request->hooks, TRUE); + } + if(events_request->before_chunk_traceset != NULL) lttv_hooks_destroy(events_request->before_chunk_traceset); if(events_request->before_chunk_trace != NULL) @@ -1206,8 +1264,6 @@ void events_request_free(EventsRequest *events_request) lttv_hooks_destroy(events_request->before_chunk_tracefile); if(events_request->event != NULL) lttv_hooks_destroy(events_request->event); - if(events_request->event_by_id_channel != NULL) - lttv_hooks_by_id_channel_destroy(events_request->event_by_id_channel); if(events_request->after_chunk_tracefile != NULL) lttv_hooks_destroy(events_request->after_chunk_tracefile); if(events_request->after_chunk_trace != NULL) @@ -1218,10 +1274,11 @@ void events_request_free(EventsRequest *events_request) lttv_hooks_destroy(events_request->before_request); if(events_request->after_request != NULL) lttv_hooks_destroy(events_request->after_request); - +#endif /*BABEL_CLEANUP*/ g_free(events_request); -} + +} __EXPORT GtkWidget *main_window_get_widget(Tab *tab)