aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 20:14:26 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 20:42:20 +0000
commit8b3c84cf0755942cbe88f1bd56c5eca1169a1071 (patch)
tree2450769890157d6e07aadbd816e2931c347232bc
parent32e294bf995eb3880fc5dfe22849b258ac797231 (diff)
downloadqarepo-8b3c84cf0755942cbe88f1bd56c5eca1169a1071.tar
qarepo-8b3c84cf0755942cbe88f1bd56c5eca1169a1071.tar.gz
qarepo-8b3c84cf0755942cbe88f1bd56c5eca1169a1071.tar.bz2
qarepo-8b3c84cf0755942cbe88f1bd56c5eca1169a1071.tar.xz
qarepo-8b3c84cf0755942cbe88f1bd56c5eca1169a1071.zip
Convert error dialogue window to general purpose dialogue window...
...in preparation for next commit.
-rw-r--r--qarepo.pl60
1 files changed, 31 insertions, 29 deletions
diff --git a/qarepo.pl b/qarepo.pl
index 5a9cefb..fd6df5e 100644
--- a/qarepo.pl
+++ b/qarepo.pl
@@ -227,46 +227,45 @@ $grid->attach($button4, 7, 6, 1, 1);
$window->add($grid);
###############################################################################
-# GUI Error Dialogue
+# GUI Dialogue Window
###############################################################################
-my $error_window = Gtk3::Window->new('toplevel');
+my $dialogue_window = Gtk3::Window->new('toplevel');
-my $error_grid = Gtk3::Grid->new();
+my $dialogue_grid = Gtk3::Grid->new();
-my $error_label = Gtk3::Label->new('The following error(s) occurred:');
+my $dialogue_label = Gtk3::Label->new();
-my $error_text = Gtk3::TextView->new();
+my $dialogue_text = Gtk3::TextView->new();
-my $error_scroll = Gtk3::ScrolledWindow->new();
+my $dialogue_scroll = Gtk3::ScrolledWindow->new();
-my $error_button = Gtk3::Button->new('Dismiss');
+my $dialogue_button = Gtk3::Button->new('Dismiss');
-$error_window->set_title("Error");
-$error_window->set_default_size(600, 300);
-$error_window->set_border_width(10);
-$error_window->set_type_hint('dialog');
-$error_window->signal_connect(delete_event => \&error_dismiss);
+$dialogue_window->set_default_size(600, 300);
+$dialogue_window->set_border_width(10);
+$dialogue_window->set_type_hint('dialog');
+$dialogue_window->signal_connect(delete_event => \&dialogue_dismiss);
-$error_grid->set_row_spacing(10);
-$error_grid->set_column_spacing(10);
+$dialogue_grid->set_row_spacing(10);
+$dialogue_grid->set_column_spacing(10);
-$error_label->set_halign('GTK_ALIGN_START');
+$dialogue_label->set_halign('GTK_ALIGN_START');
-$error_text->set_editable(FALSE);
+$dialogue_text->set_editable(FALSE);
-$error_scroll->set_hexpand(TRUE);
-$error_scroll->set_vexpand(TRUE);
-$error_scroll->add($error_text);
+$dialogue_scroll->set_hexpand(TRUE);
+$dialogue_scroll->set_vexpand(TRUE);
+$dialogue_scroll->add($dialogue_text);
-$error_button->signal_connect(clicked => \&error_dismiss);
-$error_button->set_halign('GTK_ALIGN_CENTER');
+$dialogue_button->signal_connect(clicked => \&dialogue_dismiss);
+$dialogue_button->set_halign('GTK_ALIGN_CENTER');
-$error_grid->attach($error_label, 0, 0, 1, 1);
-$error_grid->attach($error_scroll, 0, 1, 1, 1);
-$error_grid->attach($error_button, 0, 2, 1, 1);
+$dialogue_grid->attach($dialogue_label, 0, 0, 1, 1);
+$dialogue_grid->attach($dialogue_scroll, 0, 1, 1, 1);
+$dialogue_grid->attach($dialogue_button, 0, 2, 1, 1);
-$error_window->add($error_grid);
+$dialogue_window->add($dialogue_grid);
###############################################################################
# GUI Start
@@ -344,11 +343,11 @@ sub clear {
$entry5->get_buffer()->set_text('');
}
-sub error_dismiss {
+sub dialogue_dismiss {
if ($fatal_error) {
Gtk3->main_quit();
} else {
- $error_window->hide_on_delete()
+ $dialogue_window->hide_on_delete()
}
}
@@ -681,8 +680,11 @@ sub wildcard_to_regexp {
}
sub show_error_dialogue {
- $error_text->get_buffer()->set_text(join("\n", @_));
- $error_window->show_all();
+ $dialogue_window->set_title('Error');
+ $dialogue_label->set_text('The following error(s) occurred:');
+ $dialogue_text->get_buffer()->set_text(join("\n", @_));
+ $dialogue_text->set_wrap_mode('GTK_WRAP_NONE');
+ $dialogue_window->show_all();
}
sub print_error {