aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-11 18:28:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-11 18:28:40 +0000
commit5e1eefcf8649d971f4b00e0c616657ccd4e213c2 (patch)
treece5c220b6a7067f2981357b6ef50eec0ba38a9ba
parentc2c4ec5e8e44b82e329dcec15f32ae6480e66634 (diff)
downloadpaludis-5e1eefcf8649d971f4b00e0c616657ccd4e213c2.tar.gz
paludis-5e1eefcf8649d971f4b00e0c616657ccd4e213c2.tar.xz
Stop using CellRendererButton for now. Make Tasks work.
-rw-r--r--src/gtkpaludis/main_window.cc8
-rw-r--r--src/gtkpaludis/main_window.hh2
-rw-r--r--src/gtkpaludis/queue_list.cc14
-rw-r--r--src/gtkpaludis/queue_options.cc12
-rw-r--r--src/gtkpaludis/queue_page.cc11
-rw-r--r--src/gtkpaludis/queue_page.hh1
-rw-r--r--src/gtkpaludis/repositories_list.cc1
-rw-r--r--src/gtkpaludis/repositories_page.cc38
-rw-r--r--src/gtkpaludis/repositories_page.hh2
-rw-r--r--src/gtkpaludis/tasks_page.cc98
-rw-r--r--src/gtkpaludis/tasks_page.hh12
11 files changed, 179 insertions, 20 deletions
diff --git a/src/gtkpaludis/main_window.cc b/src/gtkpaludis/main_window.cc
index a707120..d38e67b 100644
--- a/src/gtkpaludis/main_window.cc
+++ b/src/gtkpaludis/main_window.cc
@@ -79,7 +79,7 @@ MainWindow::MainWindow() :
{
set_title("gtkpaludis");
set_border_width(2);
- set_default_size(700, 550);
+ set_default_size(600, 400);
_imp->main_notebook.set_border_width(5);
_imp->main_notebook.signal_switch_page().connect(sigc::mem_fun(this,
@@ -189,6 +189,12 @@ MainWindow::queue_page()
return &_imp->queue_page;
}
+RepositoriesPage *
+MainWindow::repositories_page()
+{
+ return &_imp->repositories_page;
+}
+
void
MainWindow::message_window_changed()
{
diff --git a/src/gtkpaludis/main_window.hh b/src/gtkpaludis/main_window.hh
index cf6b39f..7e9860f 100644
--- a/src/gtkpaludis/main_window.hh
+++ b/src/gtkpaludis/main_window.hh
@@ -28,6 +28,7 @@
namespace gtkpaludis
{
class QueuePage;
+ class RepositoriesPage;
class MainWindow :
public paludis::InstantiationPolicy<MainWindow, paludis::instantiation_method::SingletonAsNeededTag>,
@@ -62,6 +63,7 @@ namespace gtkpaludis
void message_window_changed();
QueuePage * queue_page();
+ RepositoriesPage * repositories_page();
};
}
diff --git a/src/gtkpaludis/queue_list.cc b/src/gtkpaludis/queue_list.cc
index d520df0..d1f1207 100644
--- a/src/gtkpaludis/queue_list.cc
+++ b/src/gtkpaludis/queue_list.cc
@@ -23,10 +23,13 @@
#include "install.hh"
#include "paludis_thread.hh"
#include <gtkmm/liststore.h>
-#include <cellrendererbutton/cellrendererbutton.hh>
#include <paludis/util/stringify.hh>
#include <list>
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
+# include <cellrendererbutton/cellrendererbutton.hh>
+#endif
+
using namespace paludis;
using namespace gtkpaludis;
@@ -40,7 +43,9 @@ namespace
Gtk::TreeModelColumn<Glib::ustring> col_status;
Gtk::TreeModelColumn<Glib::ustring> col_use;
Gtk::TreeModelColumn<Glib::ustring> col_tags;
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
Gtk::TreeModelColumn<Glib::ustring> col_why;
+#endif
Columns()
{
@@ -48,7 +53,9 @@ namespace
add(col_status);
add(col_use);
add(col_tags);
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
add(col_why);
+#endif
}
};
}
@@ -173,7 +180,9 @@ QueueList::Populate::display_entry(const paludis::DepListEntry & e)
Gtk::TreeModel::Row row = *(_model->append());
row[_q->_imp->columns.col_package] = stringify(e.package);
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
row[_q->_imp->columns.col_why] = " ... ";
+#endif
}
void
@@ -191,6 +200,8 @@ QueueList::set_model_show_dep_columns(Glib::RefPtr<Gtk::ListStore> new_model)
append_column("", _imp->columns.col_status);
append_column("Use", _imp->columns.col_use);
append_column("Tags", _imp->columns.col_tags);
+
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
{
CellRendererButton * const renderer = new CellRendererButton(*this);
renderer->property_text_x_pad() = 0;
@@ -202,6 +213,7 @@ QueueList::set_model_show_dep_columns(Glib::RefPtr<Gtk::ListStore> new_model)
renderer->set_column(column);
append_column(*column);
}
+#endif
_imp->model.swap(new_model);
set_model(_imp->model);
diff --git a/src/gtkpaludis/queue_options.cc b/src/gtkpaludis/queue_options.cc
index 5b18d43..3c80053 100644
--- a/src/gtkpaludis/queue_options.cc
+++ b/src/gtkpaludis/queue_options.cc
@@ -73,14 +73,14 @@ namespace paludis
dependencies_page(2, 1, false),
installed_deps_frame("Installed packages"),
installed_deps_table(2, 3, false),
- installed_deps_pre_label("Pre dependencies:", Gtk::ALIGN_LEFT),
- installed_deps_runtime_label("Runtime dependencies:", Gtk::ALIGN_LEFT),
- installed_deps_post_label("Post dependencies:", Gtk::ALIGN_LEFT),
+ installed_deps_pre_label("Pre:", Gtk::ALIGN_LEFT),
+ installed_deps_runtime_label("Runtime:", Gtk::ALIGN_LEFT),
+ installed_deps_post_label("Post:", Gtk::ALIGN_LEFT),
uninstalled_deps_frame("Uninstalled packages"),
uninstalled_deps_table(2, 3, false),
- uninstalled_deps_pre_label("Pre dependencies:", Gtk::ALIGN_LEFT),
- uninstalled_deps_runtime_label("Runtime dependencies:", Gtk::ALIGN_LEFT),
- uninstalled_deps_post_label("Post dependencies:", Gtk::ALIGN_LEFT)
+ uninstalled_deps_pre_label("Pre:", Gtk::ALIGN_LEFT),
+ uninstalled_deps_runtime_label("Runtime:", Gtk::ALIGN_LEFT),
+ uninstalled_deps_post_label("Post:", Gtk::ALIGN_LEFT)
{
}
};
diff --git a/src/gtkpaludis/queue_page.cc b/src/gtkpaludis/queue_page.cc
index 43e4c78..d3b37a1 100644
--- a/src/gtkpaludis/queue_page.cc
+++ b/src/gtkpaludis/queue_page.cc
@@ -41,12 +41,14 @@ namespace paludis
Gtk::Button recalculate_button;
Gtk::Button install_button;
Gtk::Button clear_button;
+ Gtk::Button why_button;
Implementation(QueuePage * const page) :
queue_list(page),
recalculate_button("Recalculate"),
install_button("Install"),
- clear_button("Clear")
+ clear_button("Clear"),
+ why_button("Why?")
{
}
};
@@ -68,6 +70,7 @@ QueuePage::QueuePage() :
_imp->queue_buttons.add(_imp->recalculate_button);
_imp->queue_buttons.add(_imp->install_button);
_imp->queue_buttons.add(_imp->clear_button);
+ _imp->queue_buttons.add(_imp->why_button);
attach(_imp->queue_buttons, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
_imp->queue_list.invalidate();
@@ -108,6 +111,12 @@ QueuePage::_recalculate_button_clicked()
}
void
+QueuePage::recalculate()
+{
+ _imp->queue_list.calculate();
+}
+
+void
QueuePage::_clear_button_clicked()
{
clear();
diff --git a/src/gtkpaludis/queue_page.hh b/src/gtkpaludis/queue_page.hh
index 049499c..6e0bda9 100644
--- a/src/gtkpaludis/queue_page.hh
+++ b/src/gtkpaludis/queue_page.hh
@@ -39,6 +39,7 @@ namespace gtkpaludis
void clear();
void add_target(const std::string &);
+ void recalculate();
void set_queue_list_calculated(bool);
};
}
diff --git a/src/gtkpaludis/repositories_list.cc b/src/gtkpaludis/repositories_list.cc
index f0cd721..f8a1c94 100644
--- a/src/gtkpaludis/repositories_list.cc
+++ b/src/gtkpaludis/repositories_list.cc
@@ -131,4 +131,3 @@ RepositoriesList::current_repository()
return RepositoryName("no-repository");
}
-
diff --git a/src/gtkpaludis/repositories_page.cc b/src/gtkpaludis/repositories_page.cc
index 4db5eee..5388c70 100644
--- a/src/gtkpaludis/repositories_page.cc
+++ b/src/gtkpaludis/repositories_page.cc
@@ -46,9 +46,11 @@ namespace paludis
Gtk::HButtonBox buttons_box;
Gtk::Button sync_button;
+ Gtk::Button sync_all_button;
Implementation() :
- sync_button("Sync")
+ sync_button("Sync"),
+ sync_all_button("Sync all")
{
}
};
@@ -74,10 +76,14 @@ RepositoriesPage::RepositoriesPage() :
_imp->buttons_box.set_spacing(5);
_imp->buttons_box.set_layout(Gtk::BUTTONBOX_END);
_imp->buttons_box.add(_imp->sync_button);
+ _imp->buttons_box.add(_imp->sync_all_button);
attach(_imp->buttons_box, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions(0));
_imp->sync_button.signal_clicked().connect(sigc::mem_fun(this,
&RepositoriesPage::_sync_button_clicked));
+ _imp->sync_button.set_sensitive(false);
+ _imp->sync_all_button.signal_clicked().connect(sigc::mem_fun(this,
+ &RepositoriesPage::_sync_all_button_clicked));
_imp->repositories_list.get_selection()->signal_changed().connect(sigc::mem_fun(this,
&RepositoriesPage::_repository_list_selection_changed));
}
@@ -96,6 +102,8 @@ void
RepositoriesPage::_repository_list_selection_changed()
{
_imp->repository_info.populate(_imp->repositories_list.current_repository());
+ _imp->sync_button.set_sensitive(_imp->repositories_list.current_repository().data()
+ != "no-repository");
}
namespace
@@ -104,23 +112,35 @@ namespace
public PaludisThread::Launchable
{
private:
+ bool _all;
RepositoryName _name;
public:
Sync(const RepositoryName & name) :
+ _all(false),
_name(name)
{
}
+ Sync() :
+ _all(true),
+ _name("dummy")
+ {
+ }
+
virtual void operator() ();
};
void
Sync::operator() ()
{
- StatusBarMessage m1(this, "Syncing repository '" + stringify(_name) + "'...");
+ StatusBarMessage m1(this, _all ?
+ "Syncing all repositories..." :
+ "Syncing repository '" + stringify(_name) + "'...");
+
OurSyncTask task(this);
- task.add_target(stringify(_name));
+ if (! _all)
+ task.add_target(stringify(_name));
task.execute();
}
}
@@ -135,3 +155,15 @@ RepositoriesPage::_sync_button_clicked()
PaludisThread::get_instance()->launch(Sync::Pointer(new Sync(current_repository)));
}
+void
+RepositoriesPage::_sync_all_button_clicked()
+{
+ sync_all();
+}
+
+void
+RepositoriesPage::sync_all()
+{
+ PaludisThread::get_instance()->launch(Sync::Pointer(new Sync));
+}
+
diff --git a/src/gtkpaludis/repositories_page.hh b/src/gtkpaludis/repositories_page.hh
index f7ee480..8c97429 100644
--- a/src/gtkpaludis/repositories_page.hh
+++ b/src/gtkpaludis/repositories_page.hh
@@ -32,12 +32,14 @@ namespace gtkpaludis
private:
void _repository_list_selection_changed();
void _sync_button_clicked();
+ void _sync_all_button_clicked();
public:
RepositoriesPage();
virtual ~RepositoriesPage();
void populate();
+ void sync_all();
};
}
diff --git a/src/gtkpaludis/tasks_page.cc b/src/gtkpaludis/tasks_page.cc
index 6870bdc..fa6cf04 100644
--- a/src/gtkpaludis/tasks_page.cc
+++ b/src/gtkpaludis/tasks_page.cc
@@ -18,7 +18,13 @@
*/
#include "tasks_page.hh"
+#include "repositories_page.hh"
+#include "main_window.hh"
+#include "queue_page.hh"
+
#include <gtkmm/box.h>
+#include <gtkmm/button.h>
+#include <gtkmm/buttonbox.h>
#include <gtkmm/image.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
@@ -26,12 +32,16 @@
#include <gtkmm/table.h>
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
+#include <gtkmm/scrolledwindow.h>
#include <gtkmm/stock.h>
-#include <cellrendererbutton/cellrendererbutton.hh>
#include <limits>
#include "config.h"
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
+# include <cellrendererbutton/cellrendererbutton.hh>
+#endif
+
using namespace paludis;
using namespace gtkpaludis;
@@ -42,13 +52,19 @@ namespace
{
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > col_icon;
Gtk::TreeModelColumn<Glib::ustring> col_text;
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
Gtk::TreeModelColumn<Glib::ustring> col_button;
+#endif
+ Gtk::TreeModelColumn<sigc::slot<void> > col_action;
Columns()
{
add(col_icon);
add(col_text);
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
add(col_button);
+#endif
+ add(col_action);
}
};
@@ -58,7 +74,7 @@ namespace
Columns columns;
Glib::RefPtr<Gtk::ListStore> model;
- TasksList() :
+ TasksList(TasksPage * const page) :
model(Gtk::ListStore::create(columns))
{
set_model(model);
@@ -72,6 +88,7 @@ namespace
set_fixed_size(40, 40);
get_column(append_column("Text", columns.col_text) - 1)->set_expand(true);
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
CellRendererButton * const renderer = new CellRendererButton(*this);
Gtk::TreeViewColumn * const column = new Gtk::TreeViewColumn("Button",
*Gtk::manage(renderer));
@@ -79,22 +96,32 @@ namespace
renderer->property_width_chars() = 10;
renderer->set_column(column);
append_column(*column);
+#endif
}
Gtk::TreeModel::Row row = *(model->append());
row[columns.col_icon] = render_icon(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
row[columns.col_text] = "Sync all repositories";
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
row[columns.col_button] = "Sync";
+#endif
+ row[columns.col_action] = sigc::mem_fun(page, &TasksPage::sync_action);
row = *(model->append());
row[columns.col_icon] = render_icon(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
row[columns.col_text] = "Show security updates";
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
row[columns.col_button] = "Preview";
+#endif
+ row[columns.col_action] = sigc::mem_fun(page, &TasksPage::security_action);
row = *(model->append());
row[columns.col_icon] = render_icon(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
row[columns.col_text] = "Show world updates";
+#ifdef USE_BROKEN_CELL_RENDERER_BUTTON
row[columns.col_button] = "Preview";
+#endif
+ row[columns.col_action] = sigc::mem_fun(page, &TasksPage::world_action);
}
};
}
@@ -105,18 +132,79 @@ namespace paludis
struct Implementation<TasksPage> :
InternalCounted<Implementation<TasksPage> >
{
+ Gtk::ScrolledWindow tasks_list_window;
TasksList tasks_list;
+ Gtk::HButtonBox buttons_box;
+ Gtk::Button go_button;
+
+ Implementation(TasksPage * const page) :
+ tasks_list(page),
+ go_button("Go")
+ {
+ }
};
}
TasksPage::TasksPage() :
- PrivateImplementationPattern<TasksPage>(new Implementation<TasksPage>)
+ PrivateImplementationPattern<TasksPage>(new Implementation<TasksPage>(this))
{
- set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
- add(_imp->tasks_list);
+ _imp->tasks_list_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
+ _imp->tasks_list_window.add(_imp->tasks_list);
+ pack_start(_imp->tasks_list_window, Gtk::PACK_EXPAND_WIDGET);
+ pack_start(_imp->buttons_box, Gtk::PACK_SHRINK);
+
+ _imp->buttons_box.set_border_width(5);
+ _imp->buttons_box.set_spacing(5);
+ _imp->buttons_box.set_layout(Gtk::BUTTONBOX_END);
+ _imp->buttons_box.add(_imp->go_button);
+
+ _imp->go_button.set_sensitive(false);
+ _imp->go_button.signal_clicked().connect(sigc::mem_fun(this,
+ &TasksPage::_go_button_clicked));
+ _imp->tasks_list.get_selection()->signal_changed().connect(sigc::mem_fun(this,
+ &TasksPage::_task_list_selection_changed));
}
TasksPage::~TasksPage()
{
}
+void
+TasksPage::_task_list_selection_changed()
+{
+ _imp->go_button.set_sensitive(_imp->tasks_list.get_selection()->get_selected());
+}
+
+void
+TasksPage::sync_action()
+{
+ MainWindow::get_instance()->repositories_page()->sync_all();
+}
+
+void
+TasksPage::security_action()
+{
+ MainWindow::get_instance()->queue_page()->add_target("security");
+ MainWindow::get_instance()->show_queue_page();
+ MainWindow::get_instance()->queue_page()->recalculate();
+}
+
+void
+TasksPage::world_action()
+{
+ MainWindow::get_instance()->queue_page()->add_target("world");
+ MainWindow::get_instance()->show_queue_page();
+ MainWindow::get_instance()->queue_page()->recalculate();
+}
+
+void
+TasksPage::_go_button_clicked()
+{
+ Gtk::TreeModel::iterator i(_imp->tasks_list.get_selection()->get_selected());
+ if (i)
+ {
+ sigc::slot<void> slot = (*i)[_imp->tasks_list.columns.col_action];
+ slot();
+ }
+}
+
diff --git a/src/gtkpaludis/tasks_page.hh b/src/gtkpaludis/tasks_page.hh
index 84cd60a..262b824 100644
--- a/src/gtkpaludis/tasks_page.hh
+++ b/src/gtkpaludis/tasks_page.hh
@@ -22,17 +22,25 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/name.hh>
-#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/box.h>
namespace gtkpaludis
{
class TasksPage :
- public Gtk::ScrolledWindow,
+ public Gtk::VBox,
private paludis::PrivateImplementationPattern<TasksPage>
{
+ private:
+ void _task_list_selection_changed();
+ void _go_button_clicked();
+
public:
TasksPage();
virtual ~TasksPage();
+
+ void sync_action();
+ void security_action();
+ void world_action();
};
}