show the content of a dialog window
- From: soudant cogenit fr
- To: gtk-app-devel-list gnome org
- Cc: gtk-devel-list gnome org
- Subject: show the content of a dialog window
- Date: Fri, 26 Oct 2001 15:01:28 +0200
Hi all,
I am a newbie in GTK. Perhaps my question is stupid.
I have made an application with Glade using GTK. The
GUI application loads a text application in a child
process. Both are communicating via pipes.
The standard input and output of the text application
are redirect in the pipes.
The text application needs interactivity. The goal of
the GUI application is to propose a user-friendly
application. Times to times I need show a window,
who propose some commands. This window contains a label
with the commands, a text entry to type the command
and a button to apply the command.
When this window appears, it is blank. They are no
label, no button, and the text entry is not usable.
What's happened ? Who could help me ?
I will be vrey gratefull if someone could help me.
Here is a short example.
/*
* main.c
*/
GtkWidget *dialogConfigure;
[...]
int main(int argc, char *argv[])
{
#ifdef ENABLE_NLS
bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
textdomain(PACKAGE);
#endif
gnome_init("ohphone", VERSION, argc, argv);
init_param();
dialogConfigure = create_dialogConfigure();
gtk_widget_show(dialogConfigure);
dialogSumUp = create_dialogSumUp();
fileselectionConfigFile = create_fileselectionConfigFile();
dialogCommand = create_dialogCommand();
//gtk_widget_show((GtkWidget *) dialogCommand);
gtk_main();
return 0;
}
with callback we execute start_OhPhone
void start_OhPhone(void)
{
char in[LINE_SIZE_MAX];
char out[LINE_SIZE_MAX];
int status;
int pid;
configure_OhPhone();
gtk_widget_hide_all((GtkWidget *) dialogConfigure);
gtk_widget_hide_all((GtkWidget *) dialogSumUp);
if ((pipe(pipe1) == -1) || (pipe(pipe2) == -1)) {
perror("pipe");
return;
}
pid = fork();
switch (pid) {
case -1:
perror("fork");
return;
break;
case 0:
close(pipe1[1]);
close(pipe2[0]);
close(STDIN_FILENO);
(void) dup(pipe1[0]);
close(pipe1[0]);
close(STDOUT_FILENO);
(void) dup(pipe2[1]);
close(pipe2[1]);
if (execvp(args[0], args) == -1)
perror("FILS: exec ");
default:
close(pipe1[0]);
close(pipe2[1]);
if (memset(in, 0, LINE_SIZE_MAX) == NULL)
break;
if (memset(out, 0, LINE_SIZE_MAX) == NULL)
break;
while (!exit_OhPhone) {
read(pipe2[0], in, (size_t) LINE_SIZE_MAX);
printf("%s:%d:%s\n", __FUNCTION__, __LINE__, in);
if (conf.calledEP == TRUE) {
if (called_main(in, out))
break;
} else {
if (caller_main(in, out))
break;
}
fflush(stdout);
if (memset(in, 0, LINE_SIZE_MAX) == NULL)
break;
if (memset(out, 0, LINE_SIZE_MAX) == NULL)
break;
}
fflush(stdout);
fflush(stdin);
waitpid(pid, &status, 0);
close(pipe1[1]);
close(pipe2[0]);
//safe_exit ();
gtk_main_quit();
}
return;
}
examine the called_main function, the dialog window windowCommand
appears blank, no label, no button and the text entry is not editable
int called_main(char *in, char *out)
{
char *tmp;
int ret = 0;
if (conf.use_no_config_file == FALSE) {
tmp = strstr(in, MSG_LDAP_CN);
if (tmp != NULL) {
char *result;
result = prepare_LDAP(tmp);
printf("LDAP :\n%s\n", result);
// affiche la fenetre du dialogue LDAP
}
}
printf("%s:%d\n", __FUNCTION__, __LINE__);
tmp = strstr(in, MSG_INCOMING_CALL);
if (tmp != NULL) {
fgets(out, LINE_SIZE_MAX, stdin);
do_command(out);
if (strcasecmp(out, EXIT_CHAR) == 0)
ret = 1;
}
printf("%s:%d\n", __FUNCTION__, __LINE__);
tmp = strstr(in, MSG_COMMAND);
if (tmp != NULL) {
// affiche la fenetre du dialogue Command
fgets(out, LINE_SIZE_MAX, stdin);
//do_command(out);
gtk_widget_hide_all((GtkWidget *) dialogSumUp);
gtk_widget_show_now((GtkWidget *) dialogCommand);
gtk_window_activate_focus((GtkWindow *) dialogCommand);
if (strcasecmp(out, EXIT_CHAR) == 0)
ret = 1;
}
printf("%s:%d\n", __FUNCTION__, __LINE__);
return ret;
}
Who could help me ?
I will be vrey gratefull if someone could help me.
--
Sandrine Soudant, soudant cogenit fr
Cogenit, http://www.cogenit.fr
53, rue Sainte-Anne
75002 Paris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]