aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-03 18:58:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-03 18:58:46 +0000
commit24229aaf1b00d4f51ea0008d3a30ea174febbca0 (patch)
treecc8266b7d10f2ff33f140682196bab756a8bdb46
parenta5390f64190d646bf0cfdc488c396bbd9c33b0df (diff)
downloadpaludis-24229aaf1b00d4f51ea0008d3a30ea174febbca0.tar.gz
paludis-24229aaf1b00d4f51ea0008d3a30ea174febbca0.tar.xz
Start of basic queue functionality
-rw-r--r--paludis/dep_list.cc6
-rw-r--r--paludis/dep_list.hh5
-rw-r--r--paludis/dep_list_TEST.cc3
-rw-r--r--paludis/tasks/install_task.cc21
-rw-r--r--paludis/tasks/install_task.hh8
-rw-r--r--src/gtkpaludis/Makefile.am10
-rw-r--r--src/gtkpaludis/install.cc196
-rw-r--r--src/gtkpaludis/install.hh94
-rw-r--r--src/gtkpaludis/main_window.cc45
-rw-r--r--src/gtkpaludis/main_window.hh11
-rw-r--r--src/gtkpaludis/messages.cc15
-rw-r--r--src/gtkpaludis/messages.hh3
-rw-r--r--src/gtkpaludis/package_info.cc26
-rw-r--r--src/gtkpaludis/package_info.hh3
-rw-r--r--src/gtkpaludis/queue_list.cc199
-rw-r--r--src/gtkpaludis/queue_list.hh51
-rw-r--r--src/gtkpaludis/queue_options.cc195
-rw-r--r--src/gtkpaludis/queue_options.hh38
-rw-r--r--src/gtkpaludis/queue_page.cc107
-rw-r--r--src/gtkpaludis/queue_page.hh45
-rw-r--r--src/gtkpaludis/sets_page.cc22
-rw-r--r--src/gtkpaludis/sets_page.hh2
22 files changed, 1088 insertions, 17 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 37a32f7..9cd09bb 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -576,6 +576,12 @@ DepList::~DepList()
}
void
+DepList::clear()
+{
+ _imp.assign(new Implementation<DepList>(_imp->env, _imp->opts));
+}
+
+void
DepList::add_in_role(DepAtom::ConstPointer atom, const std::string & role)
{
Context context("When adding " + role + ":");
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 2084385..6d15a54 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -276,6 +276,11 @@ namespace paludis
void add(DepAtom::ConstPointer);
/**
+ * Clear the list.
+ */
+ void clear();
+
+ /**
* Is an atom structure already installed?
*/
bool already_installed(DepAtom::ConstPointer) const;
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index 47108f9..e743c36 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -107,6 +107,9 @@ namespace test_cases
++exp;
++got;
}
+
+ d.clear();
+ TEST_CHECK(d.begin() == d.end());
}
public:
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index a1a7383..1278b51 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -80,6 +80,15 @@ InstallTask::~InstallTask()
}
void
+InstallTask::clear()
+{
+ _imp->targets.assign(new AllDepAtom);
+ _imp->had_set_targets = false;
+ _imp->had_package_targets = false;
+ _imp->dep_list.clear();
+}
+
+void
InstallTask::add_target(const std::string & target)
{
Context context("When adding install target '" + target + "':");
@@ -390,3 +399,15 @@ InstallTask::set_preserve_world(const bool value)
_imp->preserve_world = value;
}
+InstallTask::TargetsIterator
+InstallTask::begin_targets() const
+{
+ return TargetsIterator(_imp->raw_targets.begin());
+}
+
+InstallTask::TargetsIterator
+InstallTask::end_targets() const
+{
+ return TargetsIterator(_imp->raw_targets.end());
+}
+
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index 7e72cab..98bedcb 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -23,6 +23,7 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/dep_list.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
namespace paludis
{
@@ -88,10 +89,15 @@ namespace paludis
///\}
- ///\name Add targets
+ ///\name Targets
///\{
void add_target(const std::string &);
+ void clear();
+
+ typedef libwrapiter::ForwardIterator<InstallTask, const std::string> TargetsIterator;
+ TargetsIterator begin_targets() const;
+ TargetsIterator end_targets() const;
///\}
diff --git a/src/gtkpaludis/Makefile.am b/src/gtkpaludis/Makefile.am
index 68c9b80..82d7d94 100644
--- a/src/gtkpaludis/Makefile.am
+++ b/src/gtkpaludis/Makefile.am
@@ -20,6 +20,7 @@ bin_PROGRAMS = gtkpaludis
gtkpaludis_SOURCES = \
categories_list.cc categories_list.hh \
command_line.cc command_line.hh \
+ install.cc install.hh \
main_window.cc main_window.hh \
messages.cc messages.hh \
package_info.cc package_info.hh \
@@ -27,12 +28,15 @@ gtkpaludis_SOURCES = \
packages_list.cc packages_list.hh \
packages_page.cc packages_page.hh \
paludis_thread.cc paludis_thread.hh \
+ queue_list.cc queue_list.hh \
+ queue_options.cc queue_options.hh \
+ queue_page.cc queue_page.hh \
repositories_list.cc repositories_list.hh \
repositories_page.cc repositories_page.hh \
repository_overview.cc repository_overview.hh \
- set_overview.hh set_overview.cc \
- sets_list.hh sets_list.cc \
- sets_page.hh sets_page.cc \
+ set_overview.cc set_overview.hh \
+ sets_list.cc sets_list.hh \
+ sets_page.cc sets_page.hh \
sync.cc sync.hh \
tasks_page.cc tasks_page.hh \
gtkpaludis.cc
diff --git a/src/gtkpaludis/install.cc b/src/gtkpaludis/install.cc
new file mode 100644
index 0000000..4d2d7f0
--- /dev/null
+++ b/src/gtkpaludis/install.cc
@@ -0,0 +1,196 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "install.hh"
+#include <paludis/environment/default/default_environment.hh>
+#include <paludis/util/save.hh>
+
+using namespace paludis;
+using namespace gtkpaludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<OurInstallTask> :
+ InternalCounted<Implementation<OurInstallTask> >
+ {
+ OurInstallTask::Callbacks * callbacks;
+ };
+}
+
+OurInstallTask::OurInstallTask() :
+ InstallTask(DefaultEnvironment::get_instance(), DepListOptions()),
+ PrivateImplementationPattern<OurInstallTask>(new Implementation<OurInstallTask>)
+{
+}
+
+OurInstallTask::~OurInstallTask()
+{
+}
+
+void
+OurInstallTask::on_build_deplist_pre()
+{
+}
+
+void
+OurInstallTask::on_build_deplist_post()
+{
+}
+
+void
+OurInstallTask::on_build_cleanlist_pre(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_build_cleanlist_post(const DepListEntry &)
+{
+}
+
+
+void
+OurInstallTask::on_display_merge_list_pre()
+{
+}
+
+void
+OurInstallTask::on_display_merge_list_post()
+{
+}
+
+void
+OurInstallTask::on_display_merge_list_entry(const DepListEntry & e)
+{
+ if (! PrivateImplementationPattern<OurInstallTask>::_imp->callbacks)
+ throw InternalError(PALUDIS_HERE, "_imp->callbacks is 0");
+
+ PrivateImplementationPattern<OurInstallTask>::_imp->callbacks->display_entry(e);
+}
+
+void
+OurInstallTask::on_fetch_all_pre()
+{
+}
+
+void
+OurInstallTask::on_fetch_pre(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_fetch_post(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_fetch_all_post()
+{
+}
+
+
+void
+OurInstallTask::on_install_all_pre()
+{
+}
+
+void
+OurInstallTask::on_install_pre(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_install_post(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_install_all_post()
+{
+}
+
+void
+OurInstallTask::on_no_clean_needed(const DepListEntry &)
+{
+}
+
+void
+OurInstallTask::on_clean_all_pre(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+{
+}
+
+void
+OurInstallTask::on_clean_pre(const DepListEntry &,
+ const PackageDatabaseEntry &)
+{
+}
+
+void
+OurInstallTask::on_clean_post(const DepListEntry &,
+ const PackageDatabaseEntry &)
+{
+}
+
+void
+OurInstallTask::on_clean_all_post(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+{
+}
+
+void
+OurInstallTask::on_update_world_pre()
+{
+}
+
+void
+OurInstallTask::on_update_world(const PackageDepAtom &)
+{
+}
+
+void
+OurInstallTask::on_update_world_skip(const PackageDepAtom &, const std::string &)
+{
+}
+
+void
+OurInstallTask::on_update_world_post()
+{
+}
+
+void
+OurInstallTask::on_preserve_world()
+{
+}
+
+OurInstallTask::Callbacks::Callbacks()
+{
+}
+
+OurInstallTask::Callbacks::~Callbacks()
+{
+}
+
+void
+OurInstallTask::execute(OurInstallTask::Callbacks * const c)
+{
+ Save<OurInstallTask::Callbacks *> save_callback(&PrivateImplementationPattern<OurInstallTask>::_imp->callbacks, c);
+ InstallTask::execute();
+}
+
diff --git a/src/gtkpaludis/install.hh b/src/gtkpaludis/install.hh
new file mode 100644
index 0000000..9f080eb
--- /dev/null
+++ b/src/gtkpaludis/install.hh
@@ -0,0 +1,94 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_GTKPALUDIS_INSTALL_HH
+#define PALUDIS_GUARD_SRC_GTKPALUDIS_INSTALL_HH 1
+
+#include <paludis/tasks/install_task.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class OurInstallTask :
+ protected paludis::InstallTask,
+ private paludis::PrivateImplementationPattern<OurInstallTask>
+ {
+ protected:
+ virtual void on_build_deplist_pre();
+ virtual void on_build_deplist_post();
+
+ virtual void on_build_cleanlist_pre(const paludis::DepListEntry &);
+ virtual void on_build_cleanlist_post(const paludis::DepListEntry &);
+
+ virtual void on_display_merge_list_pre();
+ virtual void on_display_merge_list_post();
+ virtual void on_display_merge_list_entry(const paludis::DepListEntry &);
+
+ virtual void on_fetch_all_pre();
+ virtual void on_fetch_pre(const paludis::DepListEntry &);
+ virtual void on_fetch_post(const paludis::DepListEntry &);
+ virtual void on_fetch_all_post();
+
+ virtual void on_install_all_pre();
+ virtual void on_install_pre(const paludis::DepListEntry &);
+ virtual void on_install_post(const paludis::DepListEntry &);
+ virtual void on_install_all_post();
+
+ virtual void on_no_clean_needed(const paludis::DepListEntry &);
+ virtual void on_clean_all_pre(const paludis::DepListEntry &,
+ const paludis::PackageDatabaseEntryCollection &);
+ virtual void on_clean_pre(const paludis::DepListEntry &,
+ const paludis::PackageDatabaseEntry &);
+ virtual void on_clean_post(const paludis::DepListEntry &,
+ const paludis::PackageDatabaseEntry &);
+ virtual void on_clean_all_post(const paludis::DepListEntry &,
+ const paludis::PackageDatabaseEntryCollection &);
+
+ virtual void on_update_world_pre();
+ virtual void on_update_world(const paludis::PackageDepAtom &);
+ virtual void on_update_world_skip(const paludis::PackageDepAtom &, const std::string &);
+ virtual void on_update_world_post();
+ virtual void on_preserve_world();
+
+ public:
+ OurInstallTask();
+ virtual ~OurInstallTask();
+
+ class Callbacks
+ {
+ protected:
+ Callbacks();
+
+ public:
+ virtual ~Callbacks();
+
+ virtual void display_entry(const paludis::DepListEntry & e) = 0;
+ };
+
+ void execute(Callbacks * const);
+
+ using InstallTask::clear;
+ using InstallTask::add_target;
+ using InstallTask::begin_targets;
+ using InstallTask::end_targets;
+ using InstallTask::set_pretend;
+ };
+}
+
+#endif
diff --git a/src/gtkpaludis/main_window.cc b/src/gtkpaludis/main_window.cc
index 0a95d10..a707120 100644
--- a/src/gtkpaludis/main_window.cc
+++ b/src/gtkpaludis/main_window.cc
@@ -23,6 +23,7 @@
#include "repositories_page.hh"
#include "messages.hh"
#include "tasks_page.hh"
+#include "queue_page.hh"
#include <paludis/util/log.hh>
@@ -55,12 +56,14 @@ namespace paludis
PackagesPage packages_page;
SetsPage sets_page;
RepositoriesPage repositories_page;
+ QueuePage queue_page;
Gtk::Table messages_page;
Messages messages;
Gtk::Statusbar status_bar;
int messages_page_id;
+ int queue_page_id;
Implementation() :
lock_count(0),
@@ -76,13 +79,17 @@ MainWindow::MainWindow() :
{
set_title("gtkpaludis");
set_border_width(2);
- set_default_size(600, 400);
+ set_default_size(700, 550);
_imp->main_notebook.set_border_width(5);
-// _imp->main_notebook.append_page(_imp->tasks_page, "Common Tasks");
+ _imp->main_notebook.signal_switch_page().connect(sigc::mem_fun(this,
+ &MainWindow::_main_notebook_page_switched));
+
+ _imp->main_notebook.append_page(_imp->tasks_page, "Common Tasks");
_imp->main_notebook.append_page(_imp->packages_page, "Packages");
_imp->main_notebook.append_page(_imp->sets_page, "Sets");
_imp->main_notebook.append_page(_imp->repositories_page, "Repositories");
+ _imp->queue_page_id = _imp->main_notebook.append_page(_imp->queue_page, "Queue");
_imp->messages_page_id = _imp->main_notebook.append_page(_imp->messages_page, "Messages");
add(_imp->main_table);
@@ -146,6 +153,12 @@ MainWindow::show_messages_page()
}
void
+MainWindow::show_queue_page()
+{
+ _imp->main_notebook.set_current_page(_imp->queue_page_id);
+}
+
+void
MainWindow::show_exception(const std::string & what, const std::string & message, bool fatal)
{
Gtk::MessageDialog dialog(*this, fatal ? "Fatal Error" : "Error", false, Gtk::MESSAGE_ERROR);
@@ -157,8 +170,36 @@ MainWindow::show_exception(const std::string & what, const std::string & message
}
void
+MainWindow::show_error_dialog(const std::string & title, const std::string & message)
+{
+ Gtk::MessageDialog dialog(*this, title, false, Gtk::MESSAGE_ERROR);
+ dialog.set_secondary_text(message);
+ dialog.run();
+}
+
+void
MainWindow::message(const std::string & s)
{
_imp->messages.message(s);
}
+QueuePage *
+MainWindow::queue_page()
+{
+ return &_imp->queue_page;
+}
+
+void
+MainWindow::message_window_changed()
+{
+ if (_imp->main_notebook.get_current_page() != _imp->messages_page_id)
+ _imp->main_notebook.set_tab_label_text(_imp->messages_page, "Messages *");
+}
+
+void
+MainWindow::_main_notebook_page_switched(GtkNotebookPage *, guint)
+{
+ if (_imp->main_notebook.get_current_page() == _imp->messages_page_id)
+ _imp->main_notebook.set_tab_label_text(_imp->messages_page, "Messages");
+}
+
diff --git a/src/gtkpaludis/main_window.hh b/src/gtkpaludis/main_window.hh
index b0c7d20..cf6b39f 100644
--- a/src/gtkpaludis/main_window.hh
+++ b/src/gtkpaludis/main_window.hh
@@ -21,11 +21,14 @@
#define PALUDIS_GUARD_SRC_GTKPALUDIS_MAIN_WINDOW_HH 1
#include <gtkmm/window.h>
+#include <gtkmm/notebook.h>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
namespace gtkpaludis
{
+ class QueuePage;
+
class MainWindow :
public paludis::InstantiationPolicy<MainWindow, paludis::instantiation_method::SingletonAsNeededTag>,
private paludis::PrivateImplementationPattern<MainWindow>,
@@ -38,6 +41,7 @@ namespace gtkpaludis
virtual ~MainWindow();
void _set_lock(bool value);
+ void _main_notebook_page_switched(GtkNotebookPage *, guint);
public:
virtual void populate();
@@ -46,11 +50,18 @@ namespace gtkpaludis
void maybe_unlock_controls();
void show_exception(const std::string & what, const std::string & message, bool fatal);
+ void show_error_dialog(const std::string & title, const std::string & message);
+
void message(const std::string &);
void push_status(const std::string &);
void pop_status();
void show_messages_page();
+ void show_queue_page();
+
+ void message_window_changed();
+
+ QueuePage * queue_page();
};
}
diff --git a/src/gtkpaludis/messages.cc b/src/gtkpaludis/messages.cc
index 1480c38..a5aeac1 100644
--- a/src/gtkpaludis/messages.cc
+++ b/src/gtkpaludis/messages.cc
@@ -18,10 +18,13 @@
*/
#include "messages.hh"
+#include "main_window.hh"
+
#include <vtemm/terminal_widget.hh>
#include <paludis/util/fd_output_stream.hh>
#include <paludis/util/log.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/pstream.hh>
#include <cstdlib>
#include <fcntl.h>
#include <unistd.h>
@@ -101,7 +104,12 @@ Messages::Messages() :
set_run_command_stdout_fds(_imp->term_pty.slave_fd(), _imp->term_pty.master_fd());
set_run_command_stderr_fds(_imp->term_pty.slave_fd(), _imp->term_pty.master_fd());
+ PStream::set_stderr_fd(_imp->term_pty.slave_fd(), _imp->term_pty.master_fd());
+
Log::get_instance()->set_log_stream(&_imp->messages_stream);
+
+ Glib::signal_idle().connect(sigc::bind_return(sigc::mem_fun(this,
+ &Messages::_install_signal_handlers), false));
}
Messages::~Messages()
@@ -116,3 +124,10 @@ Messages::message(const std::string & s)
write(_imp->term_pty.slave_fd(), msg.c_str(), msg.length());
}
+void
+Messages::_install_signal_handlers()
+{
+ _imp->term.signal_cursor_moved().connect(sigc::mem_fun(MainWindow::get_instance(),
+ &MainWindow::message_window_changed));
+}
+
diff --git a/src/gtkpaludis/messages.hh b/src/gtkpaludis/messages.hh
index 9ff5ca7..0f6ee81 100644
--- a/src/gtkpaludis/messages.hh
+++ b/src/gtkpaludis/messages.hh
@@ -29,6 +29,9 @@ namespace gtkpaludis
private paludis::PrivateImplementationPattern<Messages>,
public Gtk::ScrolledWindow
{
+ private:
+ void _install_signal_handlers();
+
public:
Messages();
virtual ~Messages();
diff --git a/src/gtkpaludis/package_info.cc b/src/gtkpaludis/package_info.cc
index 574ac7b..edbfee6 100644
--- a/src/gtkpaludis/package_info.cc
+++ b/src/gtkpaludis/package_info.cc
@@ -19,6 +19,8 @@
#include "package_info.hh"
#include "package_overview.hh"
+#include "main_window.hh"
+#include "queue_page.hh"
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
@@ -37,16 +39,19 @@ namespace paludis
Gtk::ScrolledWindow overview_page_main;
Gtk::VButtonBox overview_page_buttons;
- Gtk::Button install_button;
+ Gtk::Button queue_button;
Gtk::Button uninstall_button;
Gtk::ScrolledWindow metadata_page;
PackageOverview overview;
+ QualifiedPackageName current_package;
+
Implementation() :
- install_button("Install"),
- uninstall_button("Uninstall")
+ queue_button("Queue"),
+ uninstall_button("Uninstall"),
+ current_package("no-category/no-package")
{
}
};
@@ -67,8 +72,12 @@ PackageInfo::PackageInfo() :
_imp->overview_page_buttons.set_border_width(5);
_imp->overview_page_buttons.set_spacing(5);
_imp->overview_page_buttons.set_layout(Gtk::BUTTONBOX_START);
- _imp->overview_page_buttons.add(_imp->install_button);
+ _imp->overview_page_buttons.add(_imp->queue_button);
_imp->overview_page_buttons.add(_imp->uninstall_button);
+
+ _imp->queue_button.signal_clicked().connect(sigc::mem_fun(this,
+ &PackageInfo::_queue_button_clicked));
+ _imp->queue_button.set_sensitive(false);
}
PackageInfo::~PackageInfo()
@@ -79,5 +88,14 @@ void
PackageInfo::populate(const QualifiedPackageName & n)
{
_imp->overview.populate(n);
+ _imp->current_package = n;
+ _imp->queue_button.set_sensitive(stringify(n) != "no-category/no-package");
+}
+
+void
+PackageInfo::_queue_button_clicked()
+{
+ MainWindow::get_instance()->show_queue_page();
+ MainWindow::get_instance()->queue_page()->add_target(stringify(_imp->current_package));
}
diff --git a/src/gtkpaludis/package_info.hh b/src/gtkpaludis/package_info.hh
index 51a439a..629e020 100644
--- a/src/gtkpaludis/package_info.hh
+++ b/src/gtkpaludis/package_info.hh
@@ -30,6 +30,9 @@ namespace gtkpaludis
private paludis::PrivateImplementationPattern<PackageInfo>,
public Gtk::Notebook
{
+ private:
+ void _queue_button_clicked();
+
public:
PackageInfo();
virtual ~PackageInfo();
diff --git a/src/gtkpaludis/queue_list.cc b/src/gtkpaludis/queue_list.cc
new file mode 100644
index 0000000..a49809a
--- /dev/null
+++ b/src/gtkpaludis/queue_list.cc
@@ -0,0 +1,199 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "queue_list.hh"
+#include "queue_page.hh"
+#include "main_window.hh"
+#include "install.hh"
+#include "paludis_thread.hh"
+#include <gtkmm/liststore.h>
+#include <paludis/util/stringify.hh>
+#include <list>
+
+using namespace paludis;
+using namespace gtkpaludis;
+
+namespace
+{
+ class Columns :
+ public Gtk::TreeModel::ColumnRecord
+ {
+ public:
+ Gtk::TreeModelColumn<Glib::ustring> col_package;
+ Gtk::TreeModelColumn<Glib::ustring> col_status;
+ Gtk::TreeModelColumn<Glib::ustring> col_use;
+ Gtk::TreeModelColumn<Glib::ustring> col_tags;
+ Gtk::TreeModelColumn<Glib::ustring> col_why;
+
+ Columns()
+ {
+ add(col_package);
+ add(col_status);
+ add(col_use);
+ add(col_tags);
+ add(col_why);
+ }
+ };
+}
+
+namespace paludis
+{
+ template<>
+ struct Implementation<QueueList> :
+ InternalCounted<Implementation<QueueList> >
+ {
+ QueuePage * const page;
+
+ Columns columns;
+ Glib::RefPtr<Gtk::ListStore> model;
+ OurInstallTask install_task;
+
+ Implementation(QueuePage * const p) :
+ page(p),
+ model(Gtk::ListStore::create(columns))
+ {
+ }
+ };
+}
+
+QueueList::QueueList(QueuePage * const page) :
+ PrivateImplementationPattern<QueueList>(new Implementation<QueueList>(page))
+{
+ set_model(_imp->model);
+}
+
+QueueList::~QueueList()
+{
+}
+
+void
+QueueList::clear()
+{
+ _imp->install_task.clear();
+ invalidate();
+}
+
+void
+QueueList::add_target(const std::string & s)
+{
+ try
+ {
+ _imp->install_task.add_target(s);
+ invalidate();
+ }
+ catch (const HadBothPackageAndSetTargets &)
+ {
+ MainWindow::get_instance()->show_error_dialog("Cannot add target '" + s + "'",
+ "Cannot add target '" + s + "' because the queue already includes package targets. Package "
+ "and set targets cannot both be specified in the same transaction.");
+ }
+ catch (const MultipleSetTargetsSpecified &)
+ {
+ MainWindow::get_instance()->show_error_dialog("Cannot add target '" + s + "'",
+ "Cannot add target '" + s + "' because the queue already includes a set target. Multiple "
+ "set targets cannot be specified in the same transaction.");
+ }
+}
+
+void
+QueueList::invalidate()
+{
+ _imp->page->set_queue_list_calculated(false);
+ remove_all_columns();
+ append_column("Target", _imp->columns.col_package);
+
+ Glib::RefPtr<Gtk::ListStore> new_model(Gtk::ListStore::create(_imp->columns));
+
+ for (InstallTask::TargetsIterator i(_imp->install_task.begin_targets()),
+ i_end(_imp->install_task.end_targets()) ; i != i_end ; ++i)
+ {
+ Gtk::TreeModel::Row row = *(new_model->append());
+ row[_imp->columns.col_package] = stringify(*i);
+ }
+
+ _imp->model.swap(new_model);
+ set_model(_imp->model);
+}
+
+namespace gtkpaludis
+{
+ class QueueList::Populate :
+ public PaludisThread::Launchable,
+ public OurInstallTask::Callbacks
+ {
+ private:
+ QueueList * const _q;
+ Glib::RefPtr<Gtk::ListStore> _model;
+
+ public:
+ Populate(QueueList * const q, Glib::RefPtr<Gtk::ListStore> model) :
+ _q(q),
+ _model(model)
+ {
+ }
+
+ virtual void operator() ();
+ virtual void display_entry(const paludis::DepListEntry & e);
+ };
+}
+
+void
+QueueList::Populate::operator() ()
+{
+ StatusBarMessage m1(this, "Building dependency list...");
+
+ _q->_imp->install_task.set_pretend(true);
+ _q->_imp->install_task.execute(this);
+
+ dispatch(sigc::bind<1>(sigc::mem_fun(_q, &QueueList::set_model_show_dep_columns), _model));
+}
+
+void
+QueueList::Populate::display_entry(const paludis::DepListEntry & e)
+{
+ if (e.already_installed)
+ return;
+
+ Gtk::TreeModel::Row row = *(_model->append());
+ row[_q->_imp->columns.col_package] = stringify(e.package);
+}
+
+void
+QueueList::calculate()
+{
+ PaludisThread::get_instance()->launch(Populate::Pointer(new Populate(this,
+ Gtk::ListStore::create(_imp->columns))));
+}
+
+void
+QueueList::set_model_show_dep_columns(Glib::RefPtr<Gtk::ListStore> new_model)
+{
+ remove_all_columns();
+ append_column("Package", _imp->columns.col_package);
+ 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);
+
+ _imp->model.swap(new_model);
+ set_model(_imp->model);
+
+ _imp->page->set_queue_list_calculated(true);
+}
+
diff --git a/src/gtkpaludis/queue_list.hh b/src/gtkpaludis/queue_list.hh
new file mode 100644
index 0000000..49863c8
--- /dev/null
+++ b/src/gtkpaludis/queue_list.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_LIST_HH
+#define PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_LIST_HH 1
+
+#include <gtkmm/treeview.h>
+#include <gtkmm/liststore.h>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class QueuePage;
+
+ class QueueList :
+ public Gtk::TreeView,
+ private paludis::PrivateImplementationPattern<QueueList>
+ {
+ class Populate;
+ friend class Populate;
+
+ public:
+ QueueList(QueuePage * const);
+ virtual ~QueueList();
+
+ void clear();
+ void invalidate();
+ void calculate();
+ void add_target(const std::string &);
+
+ void set_model_show_dep_columns(Glib::RefPtr<Gtk::ListStore>);
+ };
+}
+
+#endif
diff --git a/src/gtkpaludis/queue_options.cc b/src/gtkpaludis/queue_options.cc
new file mode 100644
index 0000000..cf8749c
--- /dev/null
+++ b/src/gtkpaludis/queue_options.cc
@@ -0,0 +1,195 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "queue_options.hh"
+#include <gtkmm/table.h>
+#include <gtkmm/checkbutton.h>
+#include <gtkmm/label.h>
+#include <gtkmm/comboboxtext.h>
+#include <gtkmm/frame.h>
+
+using namespace paludis;
+using namespace gtkpaludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<QueueOptions> :
+ InternalCounted<Implementation<QueueOptions> >
+ {
+ Gtk::Table basic_options_page;
+ Gtk::CheckButton preserve_world_box;
+ Gtk::CheckButton fetch_only_box;
+ Gtk::Label reinstall_label;
+ Gtk::ComboBoxText reinstall_box;
+ Gtk::Label upgrade_label;
+ Gtk::ComboBoxText upgrade_box;
+ Gtk::Label circular_label;
+ Gtk::ComboBoxText circular_box;
+
+ Gtk::Table dependencies_page;
+
+ Gtk::Frame installed_deps_frame;
+ Gtk::Table installed_deps_table;
+ Gtk::Label installed_deps_pre_label;
+ Gtk::Label installed_deps_runtime_label;
+ Gtk::Label installed_deps_post_label;
+ Gtk::ComboBoxText installed_deps_pre_box;
+ Gtk::ComboBoxText installed_deps_runtime_box;
+ Gtk::ComboBoxText installed_deps_post_box;
+
+ Gtk::Frame uninstalled_deps_frame;
+ Gtk::Table uninstalled_deps_table;
+ Gtk::Label uninstalled_deps_pre_label;
+ Gtk::Label uninstalled_deps_runtime_label;
+ Gtk::Label uninstalled_deps_post_label;
+ Gtk::ComboBoxText uninstalled_deps_pre_box;
+ Gtk::ComboBoxText uninstalled_deps_runtime_box;
+ Gtk::ComboBoxText uninstalled_deps_post_box;
+
+ Implementation() :
+ basic_options_page(3, 3, false),
+ preserve_world_box("Preserve world"),
+ fetch_only_box("Fetch only"),
+ reinstall_label("Reinstall:", Gtk::ALIGN_LEFT),
+ upgrade_label("Upgrade:", Gtk::ALIGN_LEFT),
+ circular_label("Circular dependencies:", Gtk::ALIGN_LEFT),
+ 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),
+ 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)
+ {
+ }
+ };
+}
+
+namespace
+{
+ void
+ populate_deps_box(Gtk::ComboBoxText & box)
+ {
+ box.append_text("Pre");
+ box.append_text("Pre or post");
+ box.append_text("Post");
+ box.append_text("Try post");
+ box.append_text("Discard");
+ }
+}
+
+QueueOptions::QueueOptions() :
+ PrivateImplementationPattern<QueueOptions>(new Implementation<QueueOptions>)
+{
+ append_page(_imp->basic_options_page, "Basic Options");
+
+ _imp->basic_options_page.set_col_spacings(5);
+ _imp->basic_options_page.set_row_spacings(5);
+ _imp->basic_options_page.set_border_width(5);
+
+ _imp->basic_options_page.attach(_imp->preserve_world_box, 0, 1, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->fetch_only_box, 0, 1, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ _imp->basic_options_page.attach(_imp->reinstall_label, 1, 2, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->upgrade_label, 1, 2, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->circular_label, 1, 2, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->reinstall_box, 2, 3, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->upgrade_box, 2, 3, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->basic_options_page.attach(_imp->circular_box, 2, 3, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ _imp->reinstall_box.append_text("Never");
+ _imp->reinstall_box.append_text("Always");
+ _imp->reinstall_box.append_text("If USE changed");
+
+ _imp->circular_box.append_text("Error");
+ _imp->circular_box.append_text("Discard");
+
+ _imp->upgrade_box.append_text("Always");
+ _imp->upgrade_box.append_text("As needed");
+
+ append_page(_imp->dependencies_page, "Dependencies");
+ _imp->dependencies_page.attach(_imp->uninstalled_deps_frame, 0, 1, 0, 1);
+ _imp->dependencies_page.attach(_imp->installed_deps_frame, 1, 2, 0, 1);
+
+ _imp->uninstalled_deps_frame.add(_imp->uninstalled_deps_table);
+ _imp->uninstalled_deps_frame.set_border_width(5);
+ _imp->installed_deps_frame.add(_imp->installed_deps_table);
+ _imp->installed_deps_frame.set_border_width(5);
+
+ _imp->uninstalled_deps_table.set_row_spacings(5);
+ _imp->uninstalled_deps_table.set_col_spacings(5);
+ _imp->uninstalled_deps_table.set_border_width(5);
+ _imp->installed_deps_table.set_row_spacings(5);
+ _imp->installed_deps_table.set_col_spacings(5);
+ _imp->installed_deps_table.set_border_width(5);
+
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_pre_label, 0, 1, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_runtime_label, 0, 1, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_post_label, 0, 1, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ _imp->installed_deps_table.attach(_imp->installed_deps_pre_label, 0, 1, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->installed_deps_table.attach(_imp->installed_deps_runtime_label, 0, 1, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->installed_deps_table.attach(_imp->installed_deps_post_label, 0, 1, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_pre_box, 1, 2, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_runtime_box, 1, 2, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->uninstalled_deps_table.attach(_imp->uninstalled_deps_post_box, 1, 2, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ _imp->installed_deps_table.attach(_imp->installed_deps_pre_box, 1, 2, 0, 1,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->installed_deps_table.attach(_imp->installed_deps_runtime_box, 1, 2, 1, 2,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->installed_deps_table.attach(_imp->installed_deps_post_box, 1, 2, 2, 3,
+ Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(0));
+
+ populate_deps_box(_imp->installed_deps_pre_box);
+ populate_deps_box(_imp->installed_deps_runtime_box);
+ populate_deps_box(_imp->installed_deps_post_box);
+
+ populate_deps_box(_imp->uninstalled_deps_pre_box);
+ populate_deps_box(_imp->uninstalled_deps_runtime_box);
+ populate_deps_box(_imp->uninstalled_deps_post_box);
+}
+
+QueueOptions::~QueueOptions()
+{
+}
+
diff --git a/src/gtkpaludis/queue_options.hh b/src/gtkpaludis/queue_options.hh
new file mode 100644
index 0000000..6a5ae35
--- /dev/null
+++ b/src/gtkpaludis/queue_options.hh
@@ -0,0 +1,38 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_OPTIONS_HH
+#define PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_OPTIONS_HH 1
+
+#include <gtkmm/notebook.h>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class QueueOptions :
+ public Gtk::Notebook,
+ private paludis::PrivateImplementationPattern<QueueOptions>
+ {
+ public:
+ QueueOptions();
+ virtual ~QueueOptions();
+ };
+}
+
+#endif
diff --git a/src/gtkpaludis/queue_page.cc b/src/gtkpaludis/queue_page.cc
new file mode 100644
index 0000000..68801f9
--- /dev/null
+++ b/src/gtkpaludis/queue_page.cc
@@ -0,0 +1,107 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "queue_page.hh"
+#include "queue_list.hh"
+#include "queue_options.hh"
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/button.h>
+#include <gtkmm/buttonbox.h>
+
+using namespace gtkpaludis;
+using namespace paludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<QueuePage> :
+ InternalCounted<Implementation<QueuePage> >
+ {
+ Gtk::ScrolledWindow queue_list_scroll;
+ QueueList queue_list;
+ QueueOptions queue_options;
+
+ Gtk::VButtonBox queue_buttons;
+ Gtk::Button recalculate_button;
+ Gtk::Button install_button;
+ Gtk::Button clear_button;
+
+ Implementation(QueuePage * const page) :
+ queue_list(page),
+ recalculate_button("Recalculate"),
+ install_button("Install"),
+ clear_button("Clear")
+ {
+ }
+ };
+}
+
+QueuePage::QueuePage() :
+ Gtk::Table(2, 2, false),
+ PrivateImplementationPattern<QueuePage>(new Implementation<QueuePage>(this))
+{
+ _imp->queue_list_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _imp->queue_list_scroll.add(_imp->queue_list);
+ attach(_imp->queue_list_scroll, 0, 2, 0, 1);
+
+ attach(_imp->queue_options, 0, 1, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions(0));
+
+ _imp->queue_buttons.set_border_width(5);
+ _imp->queue_buttons.set_spacing(5);
+ _imp->queue_buttons.set_layout(Gtk::BUTTONBOX_START);
+ _imp->queue_buttons.add(_imp->recalculate_button);
+ _imp->queue_buttons.add(_imp->install_button);
+ _imp->queue_buttons.add(_imp->clear_button);
+ attach(_imp->queue_buttons, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
+
+ _imp->queue_list.invalidate();
+
+ _imp->recalculate_button.signal_clicked().connect(sigc::mem_fun(this,
+ &QueuePage::_recalculate_button_clicked));
+}
+
+QueuePage::~QueuePage()
+{
+}
+
+void
+QueuePage::clear()
+{
+ _imp->queue_list.clear();
+}
+
+void
+QueuePage::add_target(const std::string & s)
+{
+ _imp->queue_list.add_target(s);
+}
+
+void
+QueuePage::set_queue_list_calculated(bool b)
+{
+ _imp->install_button.set_sensitive(b);
+ _imp->recalculate_button.set_sensitive(! b);
+}
+
+void
+QueuePage::_recalculate_button_clicked()
+{
+ _imp->queue_list.calculate();
+}
+
diff --git a/src/gtkpaludis/queue_page.hh b/src/gtkpaludis/queue_page.hh
new file mode 100644
index 0000000..6b58b60
--- /dev/null
+++ b/src/gtkpaludis/queue_page.hh
@@ -0,0 +1,45 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_PAGE_HH
+#define PALUDIS_GUARD_SRC_GTKPALUDIS_QUEUE_PAGE_HH 1
+
+#include <gtkmm/table.h>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class QueuePage :
+ public Gtk::Table,
+ private paludis::PrivateImplementationPattern<QueuePage>
+ {
+ private:
+ void _recalculate_button_clicked();
+
+ public:
+ QueuePage();
+ virtual ~QueuePage();
+
+ void clear();
+ void add_target(const std::string &);
+ void set_queue_list_calculated(bool);
+ };
+}
+
+#endif
diff --git a/src/gtkpaludis/sets_page.cc b/src/gtkpaludis/sets_page.cc
index d9c5af5..b6f99cd 100644
--- a/src/gtkpaludis/sets_page.cc
+++ b/src/gtkpaludis/sets_page.cc
@@ -20,6 +20,8 @@
#include "sets_page.hh"
#include "sets_list.hh"
#include "set_overview.hh"
+#include "main_window.hh"
+#include "queue_page.hh"
#include <gtkmm/button.h>
#include <gtkmm/entry.h>
@@ -46,10 +48,10 @@ namespace paludis
SetOverview set_overview;
Gtk::HButtonBox buttons_box;
- Gtk::Button install_button;
+ Gtk::Button queue_button;
Implementation() :
- install_button("Install")
+ queue_button("Queue")
{
}
};
@@ -74,13 +76,15 @@ SetsPage::SetsPage() :
_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->install_button);
+ _imp->buttons_box.add(_imp->queue_button);
attach(_imp->buttons_box, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions(0));
- _imp->install_button.signal_clicked().connect(sigc::mem_fun(this,
- &SetsPage::_install_button_clicked));
+ _imp->queue_button.signal_clicked().connect(sigc::mem_fun(this,
+ &SetsPage::_queue_button_clicked));
+ _imp->queue_button.set_sensitive(false);
_imp->sets_list.get_selection()->signal_changed().connect(sigc::mem_fun(this,
&SetsPage::_sets_list_selection_changed));
+
}
SetsPage::~SetsPage()
@@ -97,10 +101,16 @@ void
SetsPage::_sets_list_selection_changed()
{
_imp->set_overview.populate(_imp->sets_list.current_set());
+ _imp->queue_button.set_sensitive(! _imp->sets_list.current_set().empty());
}
void
-SetsPage::_install_button_clicked()
+SetsPage::_queue_button_clicked()
{
+ if (! _imp->sets_list.current_set().empty())
+ {
+ MainWindow::get_instance()->show_queue_page();
+ MainWindow::get_instance()->queue_page()->add_target(_imp->sets_list.current_set());
+ }
}
diff --git a/src/gtkpaludis/sets_page.hh b/src/gtkpaludis/sets_page.hh
index 408e016..3ebf36e 100644
--- a/src/gtkpaludis/sets_page.hh
+++ b/src/gtkpaludis/sets_page.hh
@@ -31,7 +31,7 @@ namespace gtkpaludis
{
private:
void _sets_list_selection_changed();
- void _install_button_clicked();
+ void _queue_button_clicked();
public:
SetsPage();