1
0
mirror of https://github.com/fspc/gbootroot.git synced 2025-02-23 09:03:23 -05:00

This adds more improvements to New Template, allowing a template of the same name to

be written over as a blank file, and puts a blank entry .. if the user attempts to write
to the blank entry, the dialog will ask if they want to save the original template.
This commit is contained in:
freesource 2001-11-29 19:16:41 +00:00
parent 0867ee47fb
commit 8223d83b88

View File

@ -1612,7 +1612,9 @@ sub save_as {
my $new_template; my $new_template;
my $entry = Gtk::Entry->new(); my $entry = Gtk::Entry->new();
$entry->set_editable( $true ); $entry->set_editable( $true );
$entry->set_text($template) if $template; if ( $whoami == 101 ) {
$entry->set_text($template) if $template;
}
$entry->signal_connect( "changed", sub { $entry->signal_connect( "changed", sub {
$new_template = $entry->get_text(); $new_template = $entry->get_text();
}); });
@ -1715,9 +1717,15 @@ sub save_as {
} }
$label->set_text("$new_template already exists, " . if ( $whoami == 101 ) {
"do\nyou want to write over it, " . $label->set_text("$new_template already exists, " .
"or\nsave $template with a different name?"); "do\nyou want to write over it, " .
"or\nsave $template with a different name?");
}
elsif ( $whoami == 103 ) {
$label->set_text("$new_template already exists, " .
"do\nyou want to write over it?");
}
$event_count++; $event_count++;
my $event = pop(@_); my $event = pop(@_);
@ -1728,7 +1736,15 @@ sub save_as {
open(NEW,">$new") or open(NEW,">$new") or
($error = error("Can't create $new")); ($error = error("Can't create $new"));
return if $error && $error eq "ERROR"; return if $error && $error eq "ERROR";
print NEW $changed_text_from_template; if ( $whoami == 101 ) {
print NEW $changed_text_from_template;
}
elsif ( $whoami == 103 ) {
my $text_length = $text->get_length();
$text->set_point($text_length);
$text->backward_delete($text->get_length());
print NEW "";
}
close(NEW); close(NEW);
$template = $new_template; $template = $new_template;