From bd71077466edeaab67b19302f9a0b7a5ef4559db Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 14 Jul 2003 19:22:03 +0000 Subject: - (create_dialog) o add the stock option in order to be able to use a stock icon o add a new "small" option to net make dialogs too big - (err_dialog, warn_dialog) new wrappers upon create_dialog to use warning and error stock icons - add a new export tag for dialogs --- perl-install/ugtk2.pm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'perl-install/ugtk2.pm') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 66d6f0820..4c70a2081 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -25,6 +25,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @icon_paths $force_center $force_focus ask => [ qw(ask_browse_tree_info ask_browse_tree_info_given_widgets ask_dir ask_from_entry ask_okcancel ask_warn ask_yesorno ) ], + dialogs => [ qw(err_dialog warn_dialog) ], ); $EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; @@ -367,14 +368,19 @@ sub _create_dialog { } -# drakfloppy / drakfont / harddrake2 +# drakfloppy / drakfont / harddrake2 / mcc sub create_dialog { my ($title, $label, $o_options) = @_; my $ret = 0; my $dialog = _create_dialog($title, $o_options); $dialog->set_border_width(10); my $text = $o_options->{use_markup} ? gtkset_markup(Gtk2::Label->new(), $label) : Gtk2::Label->new($label); - $dialog->vbox->pack_start(create_scrolled_window($text, [ 'never', 'automatic' ]), 1, 1, 0); + gtkpack($dialog->vbox, + gtkpack_(Gtk2::HBox->new, + if_($o_options->{stock}, 0, Gtk2::Image->new_from_stock($o_options->{stock}, 'dialog')), + 1, create_scrolled_window($text, [ 'never', 'automatic' ]), + ), + ); $text->set_line_wrap(1); if ($o_options->{cancel}) { @@ -395,6 +401,18 @@ sub create_dialog { $ret; } +sub warn_dialog { + my ($title, $label, $o_options) = @_; + add2hash_($o_options, { small => 1, stock => 'gtk-dialog-warning', cancel => 1 }); + create_dialog($title, $label, $o_options); +} + +sub err_dialog { + my ($title, $label, $o_options) = @_; + add2hash_($o_options, { small => 1, stock => 'gtk-dialog-error' }); + create_dialog($title, $label, $o_options); +} + sub create_hbox { gtkset_layout(gtkset_border_width(Gtk2::HButtonBox->new, 3), $_[0] || 'spread') } sub create_vbox { gtkset_layout(Gtk2::VButtonBox->new, $_[0] || 'spread') } -- cgit v1.2.1