#include <utmp.h>
#include <sys/wait.h>
#include <sys/poll.h>
+#include <errno.h>
#define MAX_ARGS_LEN PATH_MAX * 10
pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)TraceControlStart_xpm);
image = gtk_image_new_from_pixbuf(pixbuf);
tcd->start_button = gtk_button_new_with_label("start");
- gtk_button_set_image(GTK_BUTTON(tcd->start_button), image);
+ //2.6 gtk_button_set_image(GTK_BUTTON(tcd->start_button), image);
+ g_object_set(G_OBJECT(tcd->start_button), "image", image, NULL);
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);
tcd->pause_button = gtk_button_new_with_label("pause");
- gtk_button_set_image(GTK_BUTTON(tcd->pause_button), image);
+ //2.6 gtk_button_set_image(GTK_BUTTON(tcd->pause_button), image);
+ g_object_set(G_OBJECT(tcd->pause_button), "image", image, NULL);
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 **)TraceControlPause_xpm);
image = gtk_image_new_from_pixbuf(pixbuf);
tcd->unpause_button = gtk_button_new_with_label("unpause");
- gtk_button_set_image(GTK_BUTTON(tcd->unpause_button), image);
+ //2.6 gtk_button_set_image(GTK_BUTTON(tcd->unpause_button), image);
+ g_object_set(G_OBJECT(tcd->unpause_button), "image", image, NULL);
gtk_button_set_alignment(GTK_BUTTON(tcd->unpause_button), 0.0, 0.0);
gtk_widget_show (tcd->unpause_button);
gtk_table_attach( GTK_TABLE(tcd->main_box),tcd->unpause_button,6,7,2,3,GTK_FILL,GTK_FILL,2,2);
pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)TraceControlStop_xpm);
image = gtk_image_new_from_pixbuf(pixbuf);
tcd->stop_button = gtk_button_new_with_label("stop");
- gtk_button_set_image(GTK_BUTTON(tcd->stop_button), image);
+ //2.6 gtk_button_set_image(GTK_BUTTON(tcd->stop_button), image);
+ g_object_set(G_OBJECT(tcd->stop_button), "image", image, NULL);
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,3,4,GTK_FILL,GTK_FILL,2,2);
gtk_container_set_focus_chain(GTK_CONTAINER(tcd->main_box), focus_chain);
+ g_list_free(focus_chain);
+
g_signal_connect(G_OBJECT(tcd->start_button), "clicked",
(GCallback)start_clicked, tcd);
g_signal_connect(G_OBJECT(tcd->pause_button), "clicked",
/* Read the output from the child terminal before the prompt. If no data in
* 200 ms, we stop reading to give the password */
g_info("Reading from child console...");
+ sleep(1); /* make sure the child is ready */
while(1) {
pollfd.fd = fdpty;
- pollfd.events = POLLIN|POLLPRI;
+ pollfd.events = POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL;
num_rdy = poll(&pollfd, 1, 200);
#if 0
while(1) {
int num_hup = 0;
pollfd.fd = fdpty;
- pollfd.events = POLLIN|POLLPRI;
+ pollfd.events = POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL;
num_rdy = poll(&pollfd, 1, -1);
#if 0
g_info("Waiting for child exit...");
ret = waitpid(pid, &status, 0);
-
- if(WIFEXITED(status))
- if(WEXITSTATUS(status) != 0) {
- retval = WEXITSTATUS(status);
- g_warning("An error occured in the su command : %s",
- strerror(retval));
- }
+
+ if(ret == -1) {
+ g_warning("An error occured in wait : %s",
+ strerror(errno));
+ } else {
+ if(WIFEXITED(status))
+ if(WEXITSTATUS(status) != 0) {
+ retval = WEXITSTATUS(status);
+ g_warning("An error occured in the su command : %s",
+ strerror(retval));
+ }
+ }
g_info("Child exited.");
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_sel;
+ GtkTreeIter iter;
+
+ gtk_combo_box_get_active_iter(GTK_COMBO_BOX(tcd->trace_mode_combo), &iter);
+ gtk_tree_model_get(
+ gtk_combo_box_get_model(GTK_COMBO_BOX(tcd->trace_mode_combo)),
+ &iter, 0, &trace_mode_sel, -1);
+ //const gchar *trace_mode_sel =
+ //2.6+ 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";