aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-05 15:57:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-05 15:57:18 +0000
commitf341d924ad309f0a0342279b5169b74390348acc (patch)
treec17aba89d343c44b0a8f926073c45df28a62e967
parent5d7117e71f637c4bbc2066ac757abf4a4ef1534d (diff)
downloadpaludis-f341d924ad309f0a0342279b5169b74390348acc.tar.gz
paludis-f341d924ad309f0a0342279b5169b74390348acc.tar.xz
Improve CellRendererButton somewhat
-rw-r--r--src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc16
-rw-r--r--src/gtkpaludis/queue_list.cc12
-rw-r--r--src/gtkpaludis/tasks_page.cc2
3 files changed, 27 insertions, 3 deletions
diff --git a/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc b/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
index 2650616..3fc5268 100644
--- a/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
+++ b/src/gtkpaludis/cellrendererbutton/cellrendererbutton.cc
@@ -27,6 +27,7 @@ CellRendererButton::CellRendererButton() :
Gtk::CellRendererText()
{
property_alignment() = Pango::ALIGN_CENTER;
+ property_xalign() = 0.5;
}
CellRendererButton::~CellRendererButton()
@@ -34,9 +35,10 @@ CellRendererButton::~CellRendererButton()
}
void
-CellRendererButton::get_size_vfunc(Gtk::Widget &, const Gdk::Rectangle * cell_area,
+CellRendererButton::get_size_vfunc(Gtk::Widget & widget, const Gdk::Rectangle * cell_area,
int * x_offset, int * y_offset, int * width, int * height) const
{
+#if 0
const unsigned int x_pad = property_xpad();
const unsigned int y_pad = property_ypad();
const unsigned int x_align = property_xalign();
@@ -57,6 +59,18 @@ CellRendererButton::get_size_vfunc(Gtk::Widget &, const Gdk::Rectangle * cell_ar
if (y_offset)
*y_offset = std::max<int>(0, y_align * (cell_area->get_height() - calculated_height));
}
+#else
+ Gtk::CellRendererText::get_size_vfunc(widget, cell_area, x_offset, y_offset,
+ width, height);
+ if (width)
+ *width += 10;
+ if (height)
+ *height += 6;
+ if (x_offset)
+ *x_offset = 0;
+ if (y_offset)
+ *y_offset = 0;
+#endif
}
void
diff --git a/src/gtkpaludis/queue_list.cc b/src/gtkpaludis/queue_list.cc
index a49809a..dd79238 100644
--- a/src/gtkpaludis/queue_list.cc
+++ b/src/gtkpaludis/queue_list.cc
@@ -23,6 +23,7 @@
#include "install.hh"
#include "paludis_thread.hh"
#include <gtkmm/liststore.h>
+#include <cellrendererbutton/cellrendererbutton.hh>
#include <paludis/util/stringify.hh>
#include <list>
@@ -172,6 +173,7 @@ QueueList::Populate::display_entry(const paludis::DepListEntry & e)
Gtk::TreeModel::Row row = *(_model->append());
row[_q->_imp->columns.col_package] = stringify(e.package);
+ row[_q->_imp->columns.col_why] = " ... ";
}
void
@@ -185,11 +187,17 @@ void
QueueList::set_model_show_dep_columns(Glib::RefPtr<Gtk::ListStore> new_model)
{
remove_all_columns();
- append_column("Package", _imp->columns.col_package);
+ get_column(append_column("Package", _imp->columns.col_package) - 1)->set_expand(true);
append_column("", _imp->columns.col_status);
append_column("Use", _imp->columns.col_use);
append_column("Tags", _imp->columns.col_tags);
- append_column("Why", _imp->columns.col_why);
+ {
+ CellRendererButton * const renderer = new CellRendererButton;
+ Gtk::TreeViewColumn * const column = new Gtk::TreeViewColumn("Why",
+ *Gtk::manage(renderer));
+ column->add_attribute(renderer->property_text(), _imp->columns.col_why);
+ append_column(*column);
+ }
_imp->model.swap(new_model);
set_model(_imp->model);
diff --git a/src/gtkpaludis/tasks_page.cc b/src/gtkpaludis/tasks_page.cc
index f66b630..cdcdb68 100644
--- a/src/gtkpaludis/tasks_page.cc
+++ b/src/gtkpaludis/tasks_page.cc
@@ -70,10 +70,12 @@ namespace
{
append_column("Icon", columns.col_icon);
get_column(append_column("Text", columns.col_text) - 1)->set_expand(true);
+
CellRendererButton * const renderer = new CellRendererButton;
Gtk::TreeViewColumn * const column = new Gtk::TreeViewColumn("Button",
*Gtk::manage(renderer));
column->add_attribute(renderer->property_text(), columns.col_button);
+ renderer->property_width_chars() = 10;
append_column(*column);
}