diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-03-19 11:59:00 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-03-19 11:59:00 +0000 |
commit | 11a59d50d65496659fd9a7a09873f19ae4832996 (patch) | |
tree | a95a8740e59ed3130bf286f19915bbeb44a06426 | |
parent | c221282cd2106f0d0e17f12dc7eeeb4e8239fc57 (diff) | |
download | rpmdrake-11a59d50d65496659fd9a7a09873f19ae4832996.tar rpmdrake-11a59d50d65496659fd9a7a09873f19ae4832996.tar.gz rpmdrake-11a59d50d65496659fd9a7a09873f19ae4832996.tar.bz2 rpmdrake-11a59d50d65496659fd9a7a09873f19ae4832996.tar.xz rpmdrake-11a59d50d65496659fd9a7a09873f19ae4832996.zip |
(run_treeview_dialog,ask_browse_tree_given_widgets_for_rpmdrake) split
pixbuf column into a Toggle one and a Pixbuf one, thus enabling to use
a true (themable) ToggleButton instead of a manually randered one.
since we now use the proper signals, we can kill an old gc's uglyness btw
-rw-r--r-- | Rpmdrake/gui.pm | 12 | ||||
-rwxr-xr-x | rpmdrake | 6 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index 7e283d85..ba795cc4 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -55,6 +55,7 @@ our %pkg_columns = ( text => 0, state_icon => 1, state => 2, + selected => 3, ); @@ -183,6 +184,7 @@ sub set_node_state_flat { $model ||= $w->{tree_model}; $model->set($iter, $pkg_columns{state_icon} => $pix{$state}); $model->set($iter, $pkg_columns{state} => $state); + $model->set($iter, $pkg_columns{selected} => to_bool(member($state, qw(base installed to_install)))); #$pkg->{selected})); } sub set_node_state_tree { @@ -387,13 +389,11 @@ sub ask_browse_tree_given_widgets_for_rpmdrake { $model && $iter or return; $common->{display_info}($model->get($iter, $pkg_columns{text})); }); - $w->{detail_list}->signal_connect(button_press_event => sub { #- not too good, but CellRendererPixbuf does not have the needed signals :( - my ($path, $column) = $w->{detail_list}->get_path_at_pos($_[1]->x, $_[1]->y); - if ($path && $column && $column->{is_pix}) { - my $iter = $w->{detail_list_model}->get_iter($path); + ($w->{detail_list}->get_column(0)->get_cell_renderers)[0]->signal_connect(toggled => sub { + my ($cell, $path) = @_; #text_ + my $iter = $w->{detail_list_model}->get_iter_from_string($path); $fast_toggle->($iter) if $iter; - } - 0; + 1; }); $w->{detail_list}->signal_connect(key_press_event => sub { my $c = chr($_[1]->keyval & 0xff); @@ -187,8 +187,12 @@ sub run_treeview_dialog { $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::MDV::CellRendererPixWithLabel->new, 'pixbuf' => $grp_columns{icon}, label => $grp_columns{label})); $tree->set_headers_visible(0); - $detail_list_model = Gtk2::ListStore->new("Glib::String", "Gtk2::Gdk::Pixbuf", "Glib::String"); + $detail_list_model = Gtk2::ListStore->new("Glib::String", "Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Boolean"); $detail_list = Gtk2::TreeView->new_with_model($detail_list_model); + $detail_list->append_column(my $col1 = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererToggle->new, active => $pkg_columns{selected})); + $col1->set_fixed_width(20); # w/o this the toggle cells are not displayed + $col1->set_sizing('fixed'); + $detail_list->append_column(my $pixcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, my $rdr = Gtk2::CellRendererPixbuf->new, 'pixbuf' => $pkg_columns{state_icon})); $rdr->set_fixed_size(42, 24); $pixcolumn->set_fixed_width(48); # w/o this the pixbuf cells is empty |