1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <unistd.h>
#include <X11/Xlib.h>
#include <gdk/gdkx.h>
#include "npsummary.h"
void compose_button_callback( GtkWidget *widget, gpointer data )
{
NP_Summary *summary = ( NP_Summary *)data;
if ( summary->compose_pid )
return;
if ( !strcmp( summary->group, "FOLLOW-UPS" ) ||
!strcmp( summary->group, "OUTBOX" ) ||
!strcmp( summary->group, "POSTED" ) ||
!strcmp( summary->group, "SENT-MAIL" ))
{
summary->show_message( "You cannot create articles for this group." );
return;
}
if ( !strcmp( summary->server, "Folders" ))
{
summary->show_message( "You cannot create articles in "
"the Folders tree.\nMessages are moved into"
" Folders using the \"file\" button." );
return;
}
switch( summary->compose_pid = fork() )
{
case -1:
perror( "fork" );
return;
break;
case 0:
close( ConnectionNumber( gdk_display ));
execlp( "npcompose", "npcompose", summary->server, summary->group,
"original", "-1", NULL );
perror( "execlp" );
_exit( 1 );
break;
default:
char buffer[ 128 ];
snprintf( buffer, sizeof buffer, "%d", summary->compose_pid );
if ( summary->children.add_item( buffer ))
summary->children.print_error();
break;
}
return;
}
|