JaM
view release on metacpan or search on metacpan
lib/JaM/GUI/Search.pm view on Meta::CPAN
use strict;
use JaM::GUI::Window;
use JaM::GUI::Subjects;
use JaM::GUI::IO_Filter;
sub multi_instance_window { 1 }
sub search_rules { my $s = shift; $s->{search_rules}
= shift if @_; $s->{search_rules} }
sub search_operation { my $s = shift; $s->{search_operation}
= shift if @_; $s->{search_operation} }
sub search_folder_id { my $s = shift; $s->{search_folder_id}
= shift if @_; $s->{search_folder_id} }
sub search_recursive { my $s = shift; $s->{search_recursive}
= shift if @_; $s->{search_recursive} }
sub build {
my $self = shift;
# build subjects widget
$self->SUPER::build (
without_quick_search => 1,
without_resize_tracking => 1,
);
my $win = Gtk::Window->new;
$win->set_position ("center");
$win->set_title ("Advanced Search");
$win->border_width(3);
$win->set_default_size (530, 500);
$win->realize;
$win->show;
my $vpane = Gtk::VPaned->new();
$vpane->show();
$win->add ($vpane);
$vpane->set_handle_size( 10 );
$vpane->set_gutter_size( 15 );
my $folder_hbox = Gtk::HBox->new (0,5);
$folder_hbox->show;
my $folder_menu = $self->comp('folders')->build_menu_of_folders (
callback => sub {
my ($folder_id) = @_;
$self->folder_chosen($folder_id);
}
);
my $folder_label = Gtk::Label->new ("Search in folder");
$folder_label->show;
my $folder_entry = Gtk::Entry->new;
$folder_entry->show;
$folder_entry->set_text("Click to select folder");
$folder_entry->set_editable(0);
$folder_entry->set_usize(200, 20);
$folder_entry->signal_connect('button_press_event', sub {
my ($widget, $event) = @_;
$folder_menu->popup (undef, undef, undef, $event->{button});
});
my $folder_recursive = Gtk::CheckButton->new ("Include subfolders");
$folder_recursive->show;
$folder_recursive->set_active(0);
$folder_recursive->signal_connect ('clicked', sub {
$self->search_recursive ( $folder_recursive->get_active );
});
my $search_button = Gtk::Button->new (" Start Query ");
$search_button->show;
$search_button->signal_connect ("clicked", sub { $self->start_query } );
my $op_hbox = Gtk::HBox->new (0, 5);
$op_hbox->show;
my $op_label = Gtk::Label->new(" Rules are combined with... ");
$op_label->show;
my $op_radio_and = Gtk::RadioButton->new ("and");
$op_radio_and->show;
my $op_radio_or = Gtk::RadioButton->new ("or", $op_radio_and);
$op_radio_or->show;
my $rule_add_button = Gtk::Button->new ("Add new rule");
$rule_add_button->show;
$rule_add_button->signal_connect ("clicked", sub { $self->add_new_rule } );
$self->search_operation ('and');
$op_radio_and->signal_connect ('clicked', sub {
$self->search_operation ('and');
});
$op_radio_or->signal_connect ('clicked', sub {
$self->search_operation ('or');
});
$folder_hbox->pack_start($folder_label, 0, 0, 0);
$folder_hbox->pack_start($folder_entry, 0, 0, 0);
$folder_hbox->pack_start($folder_recursive, 0, 0, 0);
$folder_hbox->pack_start($search_button, 0, 0, 0);
$op_hbox->pack_start($op_label, 0, 1, 0);
$op_hbox->pack_start($op_radio_and, 0, 1, 0);
$op_hbox->pack_start($op_radio_or, 0, 1, 0);
$op_hbox->pack_start($rule_add_button, 0, 1, 0);
my $filter_vbox = Gtk::VBox->new (0,5);
$filter_vbox->show;
my $filter_sw = Gtk::ScrolledWindow->new;
$filter_sw->set_usize (undef, 100);
$filter_sw->set_policy ('never','automatic');
$filter_sw->show;
$filter_sw->add_with_viewport($filter_vbox);
my $hsep = Gtk::HSeparator->new;
$hsep->show;
my $top_vbox = Gtk::VBox->new(0,5);
$top_vbox->show;
$top_vbox->pack_start($folder_hbox, 0, 0, 0);
( run in 0.861 second using v1.01-cache-2.11-cpan-364913b4093 )