Fixing badly sent parent pid.
This commit is contained in:
parent
cd46914add
commit
1dcfe0788e
@ -122,7 +122,8 @@ sub _tempdir_previews($self) {
|
||||
}
|
||||
}
|
||||
|
||||
sub start($self, $exd_file = undef) {
|
||||
sub start( $self, $exd_file = undef ) {
|
||||
$self->_daemon_script_runner;
|
||||
my $app = Gtk4::Application->new( 'me.sergiotarxz.Exd', 'default-flags' );
|
||||
$self->_app($app);
|
||||
$app->signal_connect(
|
||||
@ -236,13 +237,12 @@ sub _open_action($self) {
|
||||
);
|
||||
}
|
||||
|
||||
sub _open_file($self, $file) {
|
||||
sub _open_file( $self, $file ) {
|
||||
$self->_save_path($file);
|
||||
my $window = $self->window;
|
||||
$window->set_title( "Exd (Thermal Printer) "
|
||||
. path( $self->_save_path )->basename );
|
||||
$self->_file_format(
|
||||
Exd::FileFormat->from_zip_file($file) );
|
||||
$window->set_title(
|
||||
"Exd (Thermal Printer) " . path( $self->_save_path )->basename );
|
||||
$self->_file_format( Exd::FileFormat->from_zip_file($file) );
|
||||
$self->_update_editor_buffer;
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ sub _daemon_script_runner($self) {
|
||||
while (1) {
|
||||
my $fh = $self->_read_from_parent;
|
||||
my $line = <$fh>;
|
||||
if (!kill 0, $self->parent_pid) {
|
||||
if ( defined $self->parent_pid && !kill 0, $self->parent_pid ) {
|
||||
say 'Parent died at main fork loop, exiting...';
|
||||
exit 1;
|
||||
}
|
||||
@ -348,6 +348,11 @@ sub _daemon_script_runner($self) {
|
||||
$self->_on_save_packet( $packet->{data} );
|
||||
next;
|
||||
}
|
||||
if ( $packet->{type} eq 'parent-pid' ) {
|
||||
$self->parent_pid($packet->{data});
|
||||
say 'Got parent pid ' . $self->parent_pid;
|
||||
next;
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
@ -472,7 +477,7 @@ sub _monitor_run($self) {
|
||||
my $data = $packet->{data};
|
||||
$data =~ s/\s+$//;
|
||||
$data =~ s/^\s+//;
|
||||
if ($data =~ /^\s*$/) {
|
||||
if ( $data =~ /^\s*$/ ) {
|
||||
next;
|
||||
}
|
||||
$data .= "\n";
|
||||
@ -635,7 +640,7 @@ sub _open_gallery($self) {
|
||||
}
|
||||
|
||||
sub _log( $self, $message ) {
|
||||
if ($message =~ /Fontconfig error: No writable cache directories/) {
|
||||
if ( $message =~ /Fontconfig error: No writable cache directories/ ) {
|
||||
return;
|
||||
}
|
||||
$self->_write_to_parent->say(
|
||||
@ -750,14 +755,25 @@ sub _create_gallery_image( $self, $hash ) {
|
||||
}
|
||||
|
||||
sub _open_fonts_gallery($self) {
|
||||
my $font_gallery = Exd::Gui::FontGallery->new(app => $self);
|
||||
my $font_gallery = Exd::Gui::FontGallery->new( app => $self );
|
||||
$font_gallery->start;
|
||||
}
|
||||
|
||||
sub _activate($self, $exd_file = undef) {
|
||||
sub _send_parent_pid($self) {
|
||||
$self->_write_to_script->say(
|
||||
JSON::to_json(
|
||||
{
|
||||
type => 'parent-pid',
|
||||
data => $self->parent_pid,
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub _activate( $self, $exd_file = undef ) {
|
||||
say "My pid is $$.";
|
||||
$self->parent_pid($$);
|
||||
$self->_daemon_script_runner;
|
||||
$self->_send_parent_pid;
|
||||
Glib::Timeout->add(
|
||||
1000,
|
||||
sub {
|
||||
@ -800,11 +816,14 @@ sub _activate($self, $exd_file = undef) {
|
||||
$select_printer->signal_connect(
|
||||
'clicked',
|
||||
sub {
|
||||
if ($self->_can_open_printer_configure) {
|
||||
if ( $self->_can_open_printer_configure ) {
|
||||
$self->_can_open_printer_configure(0);
|
||||
Exd::Gui::PrinterConfigure->new( app => $self, on_close => sub {
|
||||
Exd::Gui::PrinterConfigure->new(
|
||||
app => $self,
|
||||
on_close => sub {
|
||||
$self->_can_open_printer_configure(1);
|
||||
})->start;
|
||||
}
|
||||
)->start;
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -860,7 +879,7 @@ sub _activate($self, $exd_file = undef) {
|
||||
$execute_log_window->set_child($execute_log);
|
||||
$box_vertical->append($execute_log_window);
|
||||
$win->set_child($box_vertical);
|
||||
if (defined $exd_file) {
|
||||
if ( defined $exd_file ) {
|
||||
$self->_open_file($exd_file);
|
||||
}
|
||||
$win->present;
|
||||
|
Loading…
Reference in New Issue
Block a user