From 77ef407ff850ab39cf3eb8ddd6e86ea86f94ba02 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 14 Sep 2005 23:34:57 +0000 Subject: [PATCH] trace control work in progress git-svn-id: http://ltt.polymtl.ca/svn@1190 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/tracecontrol/Makefile.am | 1 + .../modules/gui/tracecontrol/tracecontrol.c | 386 ++++++++++++------ 2 files changed, 252 insertions(+), 135 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/tracecontrol/Makefile.am b/ltt/branches/poly/lttv/modules/gui/tracecontrol/Makefile.am index 9a471464..d08bcebe 100644 --- a/ltt/branches/poly/lttv/modules/gui/tracecontrol/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/tracecontrol/Makefile.am @@ -6,6 +6,7 @@ AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS += $(GTK_CFLAGS) +AM_CFLAGS += -DPACKAGE_DATA_DIR=\""$(datadir)"\" LIBS += $(GLIB_LIBS) LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow diff --git a/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c b/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c index d3251b8b..e68f7eda 100644 --- a/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c +++ b/ltt/branches/poly/lttv/modules/gui/tracecontrol/tracecontrol.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -39,6 +38,11 @@ #include "TraceControlPause.xpm" #include "TraceControlStop.xpm" +#include +#include +#include + +#define MAX_ARGS 26 /* Max number of args for lttctl */ GSList *g_control_list = NULL ; @@ -65,20 +69,49 @@ void control_destroy_walk(gpointer data, gpointer user_data); * Callback functions */ +static void start_clicked (GtkButton *button, gpointer user_data); +static void pause_clicked (GtkButton *button, gpointer user_data); +static void stop_clicked (GtkButton *button, gpointer user_data); /** * @struct _ControlData * - * @brief Main structure of gui filter - * Main struct for the filter gui module + * @brief Main structure of gui control */ struct _ControlData { Tab *tab; /**< current tab of module */ - GtkWidget *f_window; /**< filter window */ + GtkWidget *window; /**< window */ - GtkWidget *f_main_box; /**< main container */ - + GtkWidget *main_box; /**< main container */ + GtkWidget *start_button; + GtkWidget *pause_button; + GtkWidget *stop_button; + GtkWidget *username_label; + GtkWidget *username_entry; + GtkWidget *password_label; + GtkWidget *password_entry; + GtkWidget *channel_dir_label; + GtkWidget *channel_dir_entry; + GtkWidget *trace_dir_label; + GtkWidget *trace_dir_entry; + GtkWidget *trace_name_label; + GtkWidget *trace_name_entry; + GtkWidget *trace_mode_label; + GtkWidget *trace_mode_combo; + GtkWidget *start_daemon_label; + GtkWidget *start_daemon_check; + GtkWidget *optional_label; + GtkWidget *subbuf_size_label; + GtkWidget *subbuf_size_entry; + GtkWidget *subbuf_num_label; + GtkWidget *subbuf_num_entry; + GtkWidget *lttctl_path_label; + GtkWidget *lttctl_path_entry; + GtkWidget *lttd_path_label; + GtkWidget *lttd_path_entry; + GtkWidget *fac_path_label; + GtkWidget *fac_path_entry; }; /** @@ -92,7 +125,7 @@ struct _ControlData { GtkWidget* guicontrol_get_widget(ControlData *tcd) { - return tcd->f_window; + return tcd->window; } /** @@ -115,18 +148,18 @@ gui_control(Tab *tab) tcd->tab = tab; - tcd->f_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(tcd->f_window), "LTTng Trace Control"); + tcd->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(tcd->window), "LTTng Trace Control"); /* * Initiating GtkTable layout * starts with 2 rows and 5 columns and * expands when expressions added */ - tcd->f_main_box = gtk_table_new(14,7,FALSE); - gtk_table_set_row_spacings(GTK_TABLE(tcd->f_main_box),5); - gtk_table_set_col_spacings(GTK_TABLE(tcd->f_main_box),5); + tcd->main_box = gtk_table_new(14,7,FALSE); + gtk_table_set_row_spacings(GTK_TABLE(tcd->main_box),5); + gtk_table_set_col_spacings(GTK_TABLE(tcd->main_box),5); - gtk_container_add(GTK_CONTAINER(tcd->f_window), GTK_WIDGET(tcd->f_main_box)); + gtk_container_add(GTK_CONTAINER(tcd->window), GTK_WIDGET(tcd->main_box)); /* * start/pause/stop buttons @@ -135,150 +168,156 @@ gui_control(Tab *tab) GtkWidget *image; pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)TraceControlStart_xpm); image = gtk_image_new_from_pixbuf(pixbuf); - GtkWidget *start_button = gtk_button_new_with_label("start"); - gtk_button_set_image(GTK_BUTTON(start_button), image); - gtk_button_set_alignment(GTK_BUTTON(start_button), 0.0, 0.0); - gtk_widget_show (start_button); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),start_button,6,7,0,1,GTK_FILL,GTK_FILL,2,2); + tcd->start_button = gtk_button_new_with_label("start"); + gtk_button_set_image(GTK_BUTTON(tcd->start_button), image); + gtk_button_set_alignment(GTK_BUTTON(tcd->start_button), 0.0, 0.0); + gtk_widget_show (tcd->start_button); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->start_button,6,7,0,1,GTK_FILL,GTK_FILL,2,2); pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)TraceControlPause_xpm); image = gtk_image_new_from_pixbuf(pixbuf); - GtkWidget *pause_button = gtk_button_new_with_label("pause"); - gtk_button_set_image(GTK_BUTTON(pause_button), image); - gtk_button_set_alignment(GTK_BUTTON(pause_button), 0.0, 0.0); - gtk_widget_show (pause_button); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),pause_button,6,7,1,2,GTK_FILL,GTK_FILL,2,2); + tcd->pause_button = gtk_button_new_with_label("pause"); + gtk_button_set_image(GTK_BUTTON(tcd->pause_button), image); + gtk_button_set_alignment(GTK_BUTTON(tcd->pause_button), 0.0, 0.0); + gtk_widget_show (tcd->pause_button); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->pause_button,6,7,1,2,GTK_FILL,GTK_FILL,2,2); pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)TraceControlStop_xpm); image = gtk_image_new_from_pixbuf(pixbuf); - GtkWidget *stop_button = gtk_button_new_with_label("stop"); - gtk_button_set_image(GTK_BUTTON(stop_button), image); - gtk_button_set_alignment(GTK_BUTTON(stop_button), 0.0, 0.0); - gtk_widget_show (stop_button); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),stop_button,6,7,2,3,GTK_FILL,GTK_FILL,2,2); + tcd->stop_button = gtk_button_new_with_label("stop"); + gtk_button_set_image(GTK_BUTTON(tcd->stop_button), image); + gtk_button_set_alignment(GTK_BUTTON(tcd->stop_button), 0.0, 0.0); + gtk_widget_show (tcd->stop_button); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->stop_button,6,7,2,3,GTK_FILL,GTK_FILL,2,2); /* * First half of the filter window * - textual entry of filter expression * - processing button */ - GtkWidget *username_label = gtk_label_new("Username:"); - gtk_widget_show (username_label); - GtkWidget *username_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(username_entry),"root"); - gtk_widget_show (username_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),username_label,0,2,0,1,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),username_entry,2,6,0,1,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - - - GtkWidget *password_label = gtk_label_new("Password:"); - gtk_widget_show (password_label); - GtkWidget *password_entry = gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE); - gtk_widget_show (password_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),password_label,0,2,1,2,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),password_entry,2,6,1,2,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - - GtkWidget *channel_dir_label = gtk_label_new("Channel directory:"); - gtk_widget_show (channel_dir_label); - GtkWidget *channel_dir_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(channel_dir_entry),"/mnt/relayfs/ltt"); - gtk_widget_show (channel_dir_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),channel_dir_label,0,2,2,3,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),channel_dir_entry,2,6,2,3,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *trace_dir_label = gtk_label_new("Trace directory:"); - gtk_widget_show (trace_dir_label); - GtkWidget *trace_dir_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(trace_dir_entry),"/tmp/trace1"); - gtk_widget_show (trace_dir_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_dir_label,0,2,3,4,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_dir_entry,2,6,3,4,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *trace_name_label = gtk_label_new("Trace name:"); - gtk_widget_show (trace_name_label); - GtkWidget *trace_name_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(trace_name_entry),"trace"); - gtk_widget_show (trace_name_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_name_label,0,2,4,5,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_name_entry,2,6,4,5,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *trace_mode_label = gtk_label_new("Trace mode "); - gtk_widget_show (trace_mode_label); - GtkWidget *trace_mode_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(trace_mode_combo), + tcd->username_label = gtk_label_new("Username:"); + gtk_widget_show (tcd->username_label); + tcd->username_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(tcd->username_entry),"root"); + gtk_widget_show (tcd->username_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->username_label,0,2,0,1,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->username_entry,2,6,0,1,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + + + tcd->password_label = gtk_label_new("Password:"); + gtk_widget_show (tcd->password_label); + tcd->password_entry = gtk_entry_new(); + gtk_entry_set_visibility(GTK_ENTRY(tcd->password_entry), FALSE); + gtk_widget_show (tcd->password_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->password_label,0,2,1,2,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->password_entry,2,6,1,2,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + + tcd->channel_dir_label = gtk_label_new("Channel directory:"); + gtk_widget_show (tcd->channel_dir_label); + tcd->channel_dir_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(tcd->channel_dir_entry),"/mnt/relayfs/ltt"); + gtk_widget_show (tcd->channel_dir_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->channel_dir_label,0,2,2,3,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->channel_dir_entry,2,6,2,3,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->trace_dir_label = gtk_label_new("Trace directory:"); + gtk_widget_show (tcd->trace_dir_label); + tcd->trace_dir_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(tcd->trace_dir_entry),"/tmp/trace1"); + gtk_widget_show (tcd->trace_dir_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_dir_label,0,2,3,4,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_dir_entry,2,6,3,4,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->trace_name_label = gtk_label_new("Trace name:"); + gtk_widget_show (tcd->trace_name_label); + tcd->trace_name_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(tcd->trace_name_entry),"trace"); + gtk_widget_show (tcd->trace_name_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_name_label,0,2,4,5,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_name_entry,2,6,4,5,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->trace_mode_label = gtk_label_new("Trace mode "); + gtk_widget_show (tcd->trace_mode_label); + tcd->trace_mode_combo = gtk_combo_box_new_text(); + gtk_combo_box_append_text(GTK_COMBO_BOX(tcd->trace_mode_combo), "normal"); - gtk_combo_box_append_text(GTK_COMBO_BOX(trace_mode_combo), + gtk_combo_box_append_text(GTK_COMBO_BOX(tcd->trace_mode_combo), "flight recorder"); - gtk_combo_box_set_active(GTK_COMBO_BOX(trace_mode_combo), 0); - gtk_widget_show (trace_mode_combo); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_mode_label,0,2,5,6,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),trace_mode_combo,2,6,5,6,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *start_daemon_label = gtk_label_new("Start daemon "); - gtk_widget_show (start_daemon_label); - GtkWidget *start_daemon_check = gtk_check_button_new(); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(start_daemon_check), TRUE); - gtk_widget_show (start_daemon_check); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),start_daemon_label,0,2,6,7,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),start_daemon_check,2,6,6,7,GTK_FILL,GTK_FILL,0,0); - - GtkWidget *optional_label = gtk_label_new("Optional fields "); - gtk_widget_show (optional_label); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),optional_label,0,6,7,8,GTK_FILL,GTK_FILL,2,2); - - GtkWidget *subbuf_size_label = gtk_label_new("Subbuffer size:"); - gtk_widget_show (subbuf_size_label); - GtkWidget *subbuf_size_entry = gtk_entry_new(); - gtk_widget_show (subbuf_size_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),subbuf_size_label,0,2,8,9,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),subbuf_size_entry,2,6,8,9,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *subbuf_num_label = gtk_label_new("Number of subbuffers:"); - gtk_widget_show (subbuf_num_label); - GtkWidget *subbuf_num_entry = gtk_entry_new(); - gtk_widget_show (subbuf_num_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),subbuf_num_label,0,2,9,10,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),subbuf_num_entry,2,6,9,10,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - GtkWidget *lttctl_path_label = gtk_label_new("path to lttctl:"); - gtk_widget_show (lttctl_path_label); - GtkWidget *lttctl_path_entry = gtk_entry_new(); - gtk_widget_show (lttctl_path_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),lttctl_path_label,0,2,10,11,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),lttctl_path_entry,2,6,10,11,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - - - GtkWidget *lttd_path_label = gtk_label_new("path to lttd:"); - gtk_widget_show (lttd_path_label); - GtkWidget *lttd_path_entry = gtk_entry_new(); - gtk_widget_show (lttd_path_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),lttd_path_label,0,2,11,12,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),lttd_path_entry,2,6,11,12,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + gtk_combo_box_set_active(GTK_COMBO_BOX(tcd->trace_mode_combo), 0); + gtk_widget_show (tcd->trace_mode_combo); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_mode_label,0,2,5,6,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->trace_mode_combo,2,6,5,6,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->start_daemon_label = gtk_label_new("Start daemon "); + gtk_widget_show (tcd->start_daemon_label); + tcd->start_daemon_check = gtk_check_button_new(); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tcd->start_daemon_check), TRUE); + gtk_widget_show (tcd->start_daemon_check); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->start_daemon_label,0,2,6,7,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->start_daemon_check,2,6,6,7,GTK_FILL,GTK_FILL,0,0); + + tcd->optional_label = gtk_label_new("Optional fields "); + gtk_widget_show (tcd->optional_label); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->optional_label,0,6,7,8,GTK_FILL,GTK_FILL,2,2); + + tcd->subbuf_size_label = gtk_label_new("Subbuffer size:"); + gtk_widget_show (tcd->subbuf_size_label); + tcd->subbuf_size_entry = gtk_entry_new(); + gtk_widget_show (tcd->subbuf_size_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->subbuf_size_label,0,2,8,9,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->subbuf_size_entry,2,6,8,9,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->subbuf_num_label = gtk_label_new("Number of subbuffers:"); + gtk_widget_show (tcd->subbuf_num_label); + tcd->subbuf_num_entry = gtk_entry_new(); + gtk_widget_show (tcd->subbuf_num_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->subbuf_num_label,0,2,9,10,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->subbuf_num_entry,2,6,9,10,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + tcd->lttctl_path_label = gtk_label_new("path to lttctl:"); + gtk_widget_show (tcd->lttctl_path_label); + tcd->lttctl_path_entry = gtk_entry_new(); + gtk_widget_show (tcd->lttctl_path_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->lttctl_path_label,0,2,10,11,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->lttctl_path_entry,2,6,10,11,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + + tcd->lttd_path_label = gtk_label_new("path to lttd:"); + gtk_widget_show (tcd->lttd_path_label); + tcd->lttd_path_entry = gtk_entry_new(); + gtk_widget_show (tcd->lttd_path_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->lttd_path_label,0,2,11,12,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->lttd_path_entry,2,6,11,12,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - GtkWidget *fac_path_label = gtk_label_new("path to facilities:"); - gtk_widget_show (fac_path_label); - GtkWidget *fac_path_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(fac_path_entry),"/usr/share/LinuxTraceToolkitViewer/facilities"); - gtk_widget_set_size_request(fac_path_entry, 250, -1); - gtk_widget_show (fac_path_entry); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),fac_path_label,0,2,12,13,GTK_FILL,GTK_FILL,2,2); - gtk_table_attach( GTK_TABLE(tcd->f_main_box),fac_path_entry,2,6,12,13,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); - + tcd->fac_path_label = gtk_label_new("path to facilities:"); + gtk_widget_show (tcd->fac_path_label); + tcd->fac_path_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(tcd->fac_path_entry),PACKAGE_DATA_DIR "/facilities"); + gtk_widget_set_size_request(tcd->fac_path_entry, 250, -1); + gtk_widget_show (tcd->fac_path_entry); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->fac_path_label,0,2,12,13,GTK_FILL,GTK_FILL,2,2); + gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->fac_path_entry,2,6,12,13,GTK_FILL|GTK_EXPAND|GTK_SHRINK,GTK_FILL,0,0); + + g_signal_connect(G_OBJECT(tcd->start_button), "clicked", + (GCallback)start_clicked, tcd); + g_signal_connect(G_OBJECT(tcd->pause_button), "clicked", + (GCallback)pause_clicked, tcd); + g_signal_connect(G_OBJECT(tcd->stop_button), "clicked", + (GCallback)stop_clicked, tcd); /* * show main container */ - gtk_widget_show(tcd->f_main_box); - gtk_widget_show(tcd->f_window); + gtk_widget_show(tcd->main_box); + gtk_widget_show(tcd->window); g_object_set_data_full( - G_OBJECT(guifilter_get_widget(tcd)), - "filter_viewer_data", + G_OBJECT(guicontrol_get_widget(tcd)), + "control_viewer_data", tcd, (GDestroyNotify)gui_control_destructor); @@ -302,7 +341,7 @@ gui_control_destructor(ControlData *tcd) Tab *tab = tcd->tab; /* May already been done by GTK window closing */ - if(GTK_IS_WIDGET(guifilter_get_widget(tcd))){ + if(GTK_IS_WIDGET(guicontrol_get_widget(tcd))){ g_info("widget still exists"); } // if(tab != NULL) { @@ -317,6 +356,83 @@ gui_control_destructor(ControlData *tcd) g_free(tcd); } +/* Callbacks */ + +void start_clicked (GtkButton *button, gpointer user_data) +{ + ControlData *tcd = (ControlData*)user_data; + + const gchar *username = gtk_entry_get_text(GTK_ENTRY(tcd->username_entry)); + const gchar *password = gtk_entry_get_text(GTK_ENTRY(tcd->password_entry)); + const gchar *channel_dir = + gtk_entry_get_text(GTK_ENTRY(tcd->channel_dir_entry)); + const gchar *trace_dir = gtk_entry_get_text(GTK_ENTRY(tcd->trace_dir_entry)); + const gchar *trace_name = + gtk_entry_get_text(GTK_ENTRY(tcd->trace_name_entry)); + + const gchar *trace_mode_sel = + gtk_combo_box_get_active_text(GTK_COMBO_BOX(tcd->trace_mode_combo)); + const gchar *trace_mode; + if(strcmp(trace_mode_sel, "normal") == 0) + trace_mode = "normal"; + else + trace_mode = "flight"; + + gboolean start_daemon = + gtk_toggle_button_get_mode(GTK_TOGGLE_BUTTON(tcd->start_daemon_check)); + + const gchar *subbuf_size = + gtk_entry_get_text(GTK_ENTRY(tcd->subbuf_size_entry)); + const gchar *subbuf_num = + gtk_entry_get_text(GTK_ENTRY(tcd->subbuf_num_entry)); + const gchar *lttctl_path = + gtk_entry_get_text(GTK_ENTRY(tcd->lttctl_path_entry)); + const gchar *lttd_path = gtk_entry_get_text(GTK_ENTRY(tcd->lttd_path_entry)); + const gchar *fac_path = gtk_entry_get_text(GTK_ENTRY(tcd->fac_path_entry)); + + pid_t pid = fork(); + + if(pid > 0) { + /* parent */ + + + } else if(pid == 0) { + /* child */ + char *argv[MAX_ARGS]; + if(strcmp(lttctl_path, "") == 0) + lttctl_path = "lttctl"; + if(strcmp(lttd_path, "") != 0) + setenv("LTT_DAEMON", lttd_path, 1); + if(strcmp(fac_path, "") != 0) + setenv("LTT_FACILITIES", fac_path, 1); + + system("echo blah"); + exit(0); + + //gint ret = execvp(); + + } else { + /* error */ + + } + +} + + +void pause_clicked (GtkButton *button, gpointer user_data) +{ + ControlData *tcd = (ControlData*)user_data; + + +} + +void stop_clicked (GtkButton *button, gpointer user_data) +{ + ControlData *tcd = (ControlData*)user_data; + + +} + /** * @fn GtkWidget* h_guicontrol(Tab*) -- 2.34.1