MainWindow * get_window_data_struct(GtkWidget * widget);
-char * get_load_module(char ** load_module_name, int nb_module);
-char * get_unload_module(char ** loaded_module_name, int nb_module);
-char * get_remove_trace(char ** all_trace_name, int nb_trace);
-char * get_selection(char ** all_name, int nb, char *title, char * column_title);
+char * get_load_module(MainWindow *mw,
+ char ** load_module_name, int nb_module);
+char * get_unload_module(MainWindow *mw,
+ char ** loaded_module_name, int nb_module);
+char * get_remove_trace(MainWindow *mw, char ** all_trace_name, int nb_trace);
+char * get_selection(MainWindow *mw,
+ char ** all_name, int nb, char *title, char * column_title);
Tab* create_tab(MainWindow * mw, Tab *copy_tab,
GtkNotebook * notebook, char * label);
gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
case GTK_RESPONSE_ACCEPT:
GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a trace");
gtk_widget_hide( (file_selector)->file_list->parent) ;
gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
if(remember_trace_dir[0] != '\0')
gtk_file_selection_set_filename(file_selector, remember_trace_dir);
name[i] = g_quark_to_string(ltt_trace_name(trace));
}
- remove_trace_name = get_remove_trace(name, nb_trace);
+ remove_trace_name = get_remove_trace(mw_data, name, nb_trace);
if(remove_trace_name){
g_ptr_array_add(name, path);
}
- load_module_path = get_selection((char **)(name->pdata), name->len,
+ load_module_path = get_selection(mw_data,
+ (char **)(name->pdata), name->len,
"Select a library path", "Library paths");
if(load_module_path != NULL)
strncpy(load_module_path_alter, load_module_path, PATH_MAX-1); // -1 for /
gtk_file_selection_set_filename(file_selector, load_module_path_alter);
gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
str[0] = '\0';
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
gchar *path = lib_info[i].name;
g_ptr_array_add(name, path);
}
- lib_name = get_selection((char **)(name->pdata), name->len,
+ lib_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a library", "Libraries");
if(lib_name != NULL) {
for(i=0;i<nb;i++){
gchar *path = lib_info[i].name;
g_ptr_array_add(name, path);
}
- lib_name = get_selection((char **)(name->pdata), name->len,
+ lib_name = get_selection(mw_data,(char **)(name->pdata), name->len,
"Select a library", "Libraries");
if(lib_name != NULL) {
for(i=0;i<nb;i++){
gchar *path = module_info[i].name;
g_ptr_array_add(name, path);
}
- module_name = get_selection((char **)(name->pdata), name->len,
+ module_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a module", "Modules");
if(module_name != NULL) {
for(i=0;i<nb;i++){
gchar *path = lib_info[i].name;
g_ptr_array_add(name, path);
}
- lib_name = get_selection((char **)(name->pdata), name->len,
+ lib_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a library", "Libraries");
if(lib_name != NULL) {
for(i=0;i<nb;i++){
gchar *path = module_info[i].name;
if(module_info[i].use_count > 0) g_ptr_array_add(name, path);
}
- module_name = get_selection((char **)(name->pdata), name->len,
+ module_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a module", "Modules");
if(module_name != NULL) {
for(i=0;i<nb;i++){
on_add_library_search_path_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
+ MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
//GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select library path");
GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a trace");
gtk_widget_hide( (file_selector)->file_list->parent) ;
+
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
const char * dir;
gint id;
- MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
if(remember_plugins_dir[0] != '\0')
gtk_file_selection_set_filename(file_selector, remember_plugins_dir);
gchar *path = lttv_library_path_get(i);
g_ptr_array_add(name, path);
}
- lib_path = get_selection((char **)(name->pdata), name->len,
+ lib_path = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a library path", "Library paths");
g_ptr_array_free(name, TRUE);
/* Select a trace which will be removed from traceset
*/
-char * get_remove_trace(char ** all_trace_name, int nb_trace)
+char * get_remove_trace(MainWindow *mw_data,
+ char ** all_trace_name, int nb_trace)
{
- return get_selection(all_trace_name, nb_trace,
+ return get_selection(mw_data, all_trace_name, nb_trace,
"Select a trace", "Trace pathname");
}
/* Select a module which will be loaded
*/
-char * get_load_module(char ** load_module_name, int nb_module)
+char * get_load_module(MainWindow *mw_data,
+ char ** load_module_name, int nb_module)
{
- return get_selection(load_module_name, nb_module,
+ return get_selection(mw_data, load_module_name, nb_module,
"Select a module to load", "Module name");
}
/* Select a module which will be unloaded
*/
-char * get_unload_module(char ** loaded_module_name, int nb_module)
+char * get_unload_module(MainWindow *mw_data,
+ char ** loaded_module_name, int nb_module)
{
- return get_selection(loaded_module_name, nb_module,
+ return get_selection(mw_data, loaded_module_name, nb_module,
"Select a module to unload", "Module name");
}
* select one of them
*/
-char * get_selection(char ** loaded_module_name, int nb_module,
- char *title, char * column_title)
+char * get_selection(MainWindow *mw_data,
+ char ** loaded_module_name, int nb_module,
+ char *title, char * column_title)
{
GtkWidget * dialogue;
GtkWidget * scroll_win;
GTK_STOCK_CANCEL,GTK_RESPONSE_REJECT,
NULL);
gtk_window_set_default_size((GtkWindow*)dialogue, 500, 200);
+ gtk_window_set_transient_for(GTK_WINDOW(dialogue),
+ GTK_WINDOW(mw_data->mwindow));
scroll_win = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show ( scroll_win);
where all standard hooks under computation/.
i.e. modulename */
LttvTrace *trace; /* trace concerned */
+ GtkWidget *dialog; /* Dialog linked with the request, may be NULL */
} BackgroundRequest;
typedef struct _BackgroundNotify {
}
}
+static void destroy_dialog(BackgroundRequest *bg_req)
+{
+ gtk_widget_destroy(bg_req->dialog);
+ bg_req->dialog = NULL;
+}
+
/**
* Function to request data from a specific trace
trace,
NULL);
/* FIXME : show message in status bar, need context and message id */
- g_info("Background computation started for trace %p", trace);
+ g_info("Background computation for %s started for trace %p", module_name,
+ trace);
+ GtkWidget *dialog =
+ gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ "Background computation for %s started for trace %s",
+ module_name,
+ g_quark_to_string(ltt_trace_name(lttv_trace(trace))));
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (destroy_dialog),
+ bg_req);
+ bg_req->dialog = dialog;
+ gtk_widget_show(dialog);
}
/**
}
}
+/**
+ * Find a background request in a trace
+ *
+ */
+
+gboolean lttvwindowtraces_background_request_find
+ (LttvTrace *trace, gchar *module_name)
+{
+ LttvAttribute *attribute = lttv_trace_attribute(trace);
+ LttvAttributeValue value;
+ GSList *iter = NULL;
+ GSList **slist;
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_REQUESTS_QUEUE,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ for(iter=*slist;iter!=NULL;) {
+ BackgroundRequest *bg_req =
+ (BackgroundRequest *)iter->data;
+
+ if(bg_req->module_name == g_quark_from_string(module_name)) {
+ return TRUE;
+ } else {
+ iter=g_slist_next(iter);
+ }
+ }
+ return FALSE;
+}
/**
* Register a callback to be called when requested data is passed in the next
LttvHooks *after_request = (LttvHooks*)*(value.v_pointer);
if(after_request != NULL) lttv_hooks_call(after_request, tsc);
+
+ if(bg_req->dialog != NULL)
+ gtk_widget_destroy(bg_req->dialog);
+ GtkWidget *dialog =
+ gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ "Background computation %s finished for trace %s",
+ g_quark_to_string(bg_req->module_name),
+ g_quark_to_string(ltt_trace_name(lttv_trace(bg_req->trace))));
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+ gtk_widget_show(dialog);
+
/* - remove request */
remove = TRUE;
free_data = TRUE;
g_debug("Background computation scheduler stopped");
g_info("Background computation finished for trace %p", trace);
/* FIXME : remove status bar info, need context id and message id */
+
ret_val = FALSE;
} else {
ret_val = TRUE;