| 1 | # $Id: Logging.pm 2344 2007-08-09 21:37:41Z joern $ | ||
| 2 | |||
| 3 | #----------------------------------------------------------------------- | ||
| 4 | # Copyright (C) 2001-2006 Jörn Reder <joern AT zyn.de>. | ||
| 5 | # All Rights Reserved. See file COPYRIGHT for details. | ||
| 6 | # | ||
| 7 | # This module is part of Video::DVDRip, which is free software; you can | ||
| 8 | # redistribute it and/or modify it under the same terms as Perl itself. | ||
| 9 | #----------------------------------------------------------------------- | ||
| 10 | |||
| 11 | package Video::DVDRip::GUI::Project::Logging; | ||
| 12 | |||
| 13 | use base qw( Video::DVDRip::GUI::Base ); | ||
| 14 | |||
| 15 | use Locale::TextDomain qw (video.dvdrip); | ||
| 16 | |||
| 17 | use Carp; | ||
| 18 | use strict; | ||
| 19 | |||
| 20 | sub build_factory { | ||
| 21 | my $self = shift; | ||
| 22 | |||
| 23 | my $context = $self->get_context; | ||
| 24 | |||
| 25 | return Gtk2::Ex::FormFactory::VBox->new( | ||
| 26 | title => '[gtk-justify-left]'.__ "Logging", | ||
| 27 | object => "project", | ||
| 28 | active_cond => sub { | ||
| 29 | $self->project | ||
| 30 | && $self->project->created; | ||
| 31 | }, | ||
| 32 | active_depends => "project.created", | ||
| 33 | no_frame => 1, | ||
| 34 | $self->get_optimum_screen_size_options("page"), | ||
| 35 | content => [ | ||
| 36 | Gtk2::Ex::FormFactory::Table->new( | ||
| 37 | title => __ "Log messages", | ||
| 38 | expand => 1, | ||
| 39 | layout => " | ||
| 40 | +>>>>>>>>>>>>>>>>>>>>>>>>>>>>+ | ||
| 41 | ^ Text | | ||
| 42 | | | | ||
| 43 | +[>>>>>>>+-------+----------]+ | ||
| 44 | | Button | Label | Filename | | ||
| 45 | +----------------+-----------+ | ||
| 46 | ", | ||
| 47 | content => [ | ||
| 48 | Gtk2::Ex::FormFactory::TextView->new( | ||
| 49 | scrollbars => [ "never", "always" ], | ||
| 50 | expand => 1, | ||
| 51 | properties => { | ||
| 52 | editable => 0, | ||
| 53 | cursor_visible => 0, | ||
| 54 | wrap_mode => "word", | ||
| 55 | }, | ||
| 56 | customize_hook => sub { | ||
| 57 | my ($gtk_text_view) = @_; | ||
| 58 | my $font | ||
| 59 | = Gtk2::Pango::FontDescription->from_string( | ||
| 60 | "mono 7.2"); | ||
| 61 | $gtk_text_view->modify_font($font); | ||
| 62 | $self->logger->set_gtk_text_view($gtk_text_view); | ||
| 63 | my $tag_table = Gtk2::TextTagTable->new; | ||
| 64 | $tag_table->add( | ||
| 65 | $self->create_text_tag( | ||
| 66 | "date", foreground => "#666666", | ||
| 67 | ) | ||
| 68 | ); | ||
| 69 | my $buffer = Gtk2::TextBuffer->new($tag_table); | ||
| 70 | $gtk_text_view->set_buffer($buffer); | ||
| 71 | 1; | ||
| 72 | }, | ||
| 73 | ), | ||
| 74 | Gtk2::Ex::FormFactory::Button->new( | ||
| 75 | label => __ "Nuke log file", | ||
| 76 | stock => "gtk-delete", | ||
| 77 | clicked_hook => sub { | ||
| 78 | $self->logger->nuke; | ||
| 79 | }, | ||
| 80 | ), | ||
| 81 | Gtk2::Ex::FormFactory::Label->new( | ||
| 82 | label => " " . "<b>" | ||
| 83 | . __("Log filename") | ||
| 84 | . ":</b> ", | ||
| 85 | with_markup => 1, | ||
| 86 | ), | ||
| 87 | Gtk2::Ex::FormFactory::Label->new( | ||
| 88 | attr => "project.logfile", | ||
| 89 | properties => { selectable => 1, }, | ||
| 90 | ), | ||
| 91 | ], | ||
| 92 | ), | ||
| 93 | ], | ||
| 94 | ); | ||
| 95 | } | ||
| 96 | |||
| 97 | 1; |