aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-06 17:29:17 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-06 17:29:17 +0000
commit44a3f32a4153000d82f2dab15c1974ac9368e5ea (patch)
tree362ee0f0e965a21f6b73711f8f75213f3f3de4f6
parent15bf3e44c1848a71ab476fc0a01aee6e94e86477 (diff)
downloadpaludis-44a3f32a4153000d82f2dab15c1974ac9368e5ea.tar.gz
paludis-44a3f32a4153000d82f2dab15c1974ac9368e5ea.tar.xz
r3344@snowflake: ciaranm | 2007-06-06 18:27:41 +0100
More gtkpaludis work
-rw-r--r--paludis/tasks/sync_task.cc12
-rw-r--r--paludis/tasks/sync_task.hh14
-rw-r--r--src/clients/gtkpaludis/Makefile.am1
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/Makefile.am5
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc104
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh42
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/main_notebook.cc17
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/main_notebook.hh2
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/main_window.cc12
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/main_window.hh6
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/messages_page.cc21
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/messages_page.hh1
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/packages_filter.cc13
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc23
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/repository_buttons.hh4
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.cc50
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.hh27
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.cc63
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.hh41
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_window.cc175
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/task_window.hh41
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc48
22 files changed, 678 insertions, 44 deletions
diff --git a/paludis/tasks/sync_task.cc b/paludis/tasks/sync_task.cc
index 9c6b1fd..e5d6b8a 100644
--- a/paludis/tasks/sync_task.cc
+++ b/paludis/tasks/sync_task.cc
@@ -118,3 +118,15 @@ SyncTask::execute()
throw SyncFailedError("Sync aborted by hook");
}
+SyncTask::TargetsIterator
+SyncTask::begin_targets() const
+{
+ return TargetsIterator(_imp->targets.begin());
+}
+
+SyncTask::TargetsIterator
+SyncTask::end_targets() const
+{
+ return TargetsIterator(_imp->targets.end());
+}
+
diff --git a/paludis/tasks/sync_task.hh b/paludis/tasks/sync_task.hh
index e2856b2..61e5e1b 100644
--- a/paludis/tasks/sync_task.hh
+++ b/paludis/tasks/sync_task.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 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
@@ -23,6 +23,7 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/dep_list/dep_list.hh>
+#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
namespace paludis
{
@@ -75,10 +76,19 @@ namespace paludis
///\}
+ ///\name Target iteration
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<SyncTask, const RepositoryName> TargetsIterator;
+ TargetsIterator begin_targets() const;
+ TargetsIterator end_targets() const;
+
+ ///\}
+
/**
* Run the task.
*/
- void execute();
+ virtual void execute();
};
}
diff --git a/src/clients/gtkpaludis/Makefile.am b/src/clients/gtkpaludis/Makefile.am
index 6281e09..ed9464d 100644
--- a/src/clients/gtkpaludis/Makefile.am
+++ b/src/clients/gtkpaludis/Makefile.am
@@ -17,6 +17,7 @@ gtkpaludis_SOURCES = \
gtkpaludis_LDADD = \
libgtkpaludis/libgtkpaludis.a \
vtemm/libvtemm.a \
+ $(top_builddir)/paludis/tasks/libpaludistasks.la \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/environments/libpaludisenvironments.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
diff --git a/src/clients/gtkpaludis/libgtkpaludis/Makefile.am b/src/clients/gtkpaludis/libgtkpaludis/Makefile.am
index c07e40d..6d888a9 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/Makefile.am
+++ b/src/clients/gtkpaludis/libgtkpaludis/Makefile.am
@@ -5,6 +5,8 @@ noinst_LIBRARIES = libgtkpaludis.a
libgtkpaludis_a_SOURCES = \
categories_list.cc categories_list.hh \
categories_list_model.cc categories_list_model.hh \
+ gui_task.cc gui_task.hh \
+ gui_sync_task.cc gui_sync_task.hh \
main_notebook.cc main_notebook.hh \
main_notebook_page.cc main_notebook_page.hh \
main_window.cc main_window.hh \
@@ -32,6 +34,9 @@ libgtkpaludis_a_SOURCES = \
repository_buttons.cc repository_buttons.hh \
repository_info.cc repository_info.hh \
repository_info_model.cc repository_info_model.hh \
+ task_sequence_list.cc task_sequence_list.hh \
+ task_sequence_list_model.cc task_sequence_list_model.hh \
+ task_window.cc task_window.hh \
threaded_window.cc threaded_window.hh \
version_info.cc version_info.hh \
version_info_model.cc version_info_model.hh \
diff --git a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc
new file mode 100644
index 0000000..ff2a11c
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc
@@ -0,0 +1,104 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "gui_sync_task.hh"
+#include "main_window.hh"
+#include "main_notebook.hh"
+#include "task_window.hh"
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/stringify.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+
+using namespace gtkpaludis;
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<GuiSyncTask>
+ {
+ MainWindow * const main_window;
+ TaskWindow * task_window;
+
+ Implementation(MainWindow * const m, GuiSyncTask * const g) :
+ main_window(m),
+ task_window(new TaskWindow(m, g))
+ {
+ }
+ };
+}
+
+GuiSyncTask::GuiSyncTask(MainWindow * const m) :
+ SyncTask(m->environment()),
+ PrivateImplementationPattern<GuiSyncTask>(new Implementation<GuiSyncTask>(m, this)),
+ _imp(PrivateImplementationPattern<GuiSyncTask>::_imp)
+{
+}
+
+GuiSyncTask::~GuiSyncTask()
+{
+}
+
+void
+GuiSyncTask::on_sync_all_pre()
+{
+ for (TargetsIterator t(begin_targets()), t_end(end_targets()) ;
+ t != t_end ; ++t)
+ _imp->task_window->gui_thread_action(
+ sigc::bind(sigc::mem_fun(_imp->task_window, &TaskWindow::append_sequence_item),
+ stringify(*t), stringify(*t), "Pending..."));
+}
+
+void
+GuiSyncTask::on_sync_pre(const RepositoryName & r)
+{
+ _imp->task_window->gui_thread_action(
+ sigc::bind(sigc::mem_fun(_imp->task_window, &TaskWindow::set_sequence_item_status),
+ stringify(r), "Syncing..."));
+}
+
+void
+GuiSyncTask::on_sync_post(const RepositoryName &)
+{
+}
+
+void
+GuiSyncTask::on_sync_skip(const RepositoryName & r)
+{
+ _imp->task_window->gui_thread_action(
+ sigc::bind(sigc::mem_fun(_imp->task_window, &TaskWindow::set_sequence_item_status),
+ stringify(r), "Skipped"));
+}
+
+void
+GuiSyncTask::on_sync_fail(const RepositoryName & r, const SyncFailedError &)
+{
+ _imp->task_window->gui_thread_action(
+ sigc::bind(sigc::mem_fun(_imp->task_window, &TaskWindow::set_sequence_item_status),
+ stringify(r), "Failed"));
+}
+
+void
+GuiSyncTask::on_sync_succeed(const RepositoryName & r)
+{
+ _imp->task_window->gui_thread_action(
+ sigc::bind(sigc::mem_fun(_imp->task_window, &TaskWindow::set_sequence_item_status),
+ stringify(r), "Success"));
+}
+
+void
+GuiSyncTask::on_sync_all_post()
+{
+}
+
+void
+GuiSyncTask::run()
+{
+ _imp->task_window->run();
+}
+
+void
+GuiSyncTask::paludis_thread_execute()
+{
+ execute();
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh
new file mode 100644
index 0000000..be21f15
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh
@@ -0,0 +1,42 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#ifndef GTKPALUDIS_GUARD_LIBGTKPALUDIS_GUI_SYNC_TASK_HH
+#define GTKPALUDIS_GUARD_LIBGTKPALUDIS_GUI_SYNC_TASK_HH 1
+
+#include <paludis/tasks/sync_task.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <libgtkpaludis/gui_task.hh>
+
+namespace gtkpaludis
+{
+ class MainWindow;
+
+ class GuiSyncTask :
+ public GuiTask,
+ protected paludis::SyncTask,
+ private paludis::PrivateImplementationPattern<GuiSyncTask>
+ {
+ private:
+ paludis::PrivateImplementationPattern<GuiSyncTask>::ImpPtr & _imp;
+
+ protected:
+ virtual void on_sync_all_pre();
+ virtual void on_sync_pre(const paludis::RepositoryName &);
+ virtual void on_sync_post(const paludis::RepositoryName &);
+ virtual void on_sync_skip(const paludis::RepositoryName &);
+ virtual void on_sync_fail(const paludis::RepositoryName &, const paludis::SyncFailedError &);
+ virtual void on_sync_succeed(const paludis::RepositoryName &);
+ virtual void on_sync_all_post();
+
+ public:
+ GuiSyncTask(MainWindow * const);
+ ~GuiSyncTask();
+
+ using paludis::SyncTask::add_target;
+
+ virtual void run();
+ virtual void paludis_thread_execute();
+ };
+}
+
+#endif
diff --git a/src/clients/gtkpaludis/libgtkpaludis/main_notebook.cc b/src/clients/gtkpaludis/libgtkpaludis/main_notebook.cc
index f5e4f79..86f5b49 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/main_notebook.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/main_notebook.cc
@@ -22,6 +22,7 @@ namespace paludis
RepositoriesPage repositories_page;
MessagesPage messages_page;
+ int messages_page_index;
bool messages_starred;
std::map<int, MainNotebookPage *> pages_by_index;
@@ -52,7 +53,7 @@ MainNotebook::MainNotebook(MainWindow * const m) :
&_imp->repositories_page));
_imp->pages_by_index.insert(std::make_pair(
- append_page(_imp->messages_page, "Messages"),
+ _imp->messages_page_index = append_page(_imp->messages_page, "Messages"),
&_imp->messages_page));
_imp->signal_switch_page_connection = signal_switch_page().connect(
@@ -79,7 +80,7 @@ MainNotebook::handle_switch_page(GtkNotebookPage *, guint page)
void
MainNotebook::mark_messages_page()
{
- if (! _imp->messages_starred)
+ if ((! _imp->messages_starred) && (get_current_page() != _imp->messages_page_index))
{
_imp->messages_starred = true;
set_tab_label_text(_imp->messages_page, "Messages *");
@@ -96,3 +97,15 @@ MainNotebook::unmark_messages_page()
}
}
+void
+MainNotebook::show_messages_page()
+{
+ set_current_page(_imp->messages_page_index);
+}
+
+void
+MainNotebook::set_capture_output_options()
+{
+ _imp->messages_page.set_capture_output_options();
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/main_notebook.hh b/src/clients/gtkpaludis/libgtkpaludis/main_notebook.hh
index 1d0c4bd..8b98723 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/main_notebook.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/main_notebook.hh
@@ -25,6 +25,8 @@ namespace gtkpaludis
void mark_messages_page();
void unmark_messages_page();
+ void show_messages_page();
+ void set_capture_output_options();
};
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/main_window.cc b/src/clients/gtkpaludis/libgtkpaludis/main_window.cc
index 0affe10..9f01709 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/main_window.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/main_window.cc
@@ -68,3 +68,15 @@ MainWindow::do_set_sensitive(const bool v)
_imp->main_notebook.set_sensitive(v);
}
+MainNotebook *
+MainWindow::main_notebook()
+{
+ return &_imp->main_notebook;
+}
+
+void
+MainWindow::set_capture_output_options()
+{
+ _imp->main_notebook.set_capture_output_options();
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/main_window.hh b/src/clients/gtkpaludis/libgtkpaludis/main_window.hh
index 8e469b6..b3e74fd 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/main_window.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/main_window.hh
@@ -8,6 +8,8 @@
namespace gtkpaludis
{
+ class MainNotebook;
+
class MainWindow :
public ThreadedWindow,
private paludis::PrivateImplementationPattern<MainWindow>
@@ -25,8 +27,12 @@ namespace gtkpaludis
MainWindow(paludis::Environment * const);
~MainWindow();
+ MainNotebook * main_notebook();
+
using ThreadedWindow::sensitise;
using ThreadedWindow::desensitise;
+
+ void set_capture_output_options();
};
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/messages_page.cc b/src/clients/gtkpaludis/libgtkpaludis/messages_page.cc
index 13478f2..b31238b 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/messages_page.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/messages_page.cc
@@ -9,7 +9,6 @@
#include <paludis/util/pstream.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/log.hh>
-#include <gtkmm/scrolledwindow.h>
#include <vtemm/terminal_widget.hh>
#include <iostream>
#include <cstdlib>
@@ -25,8 +24,6 @@ namespace paludis
{
MainWindow * const main_window;
MainNotebook * const main_notebook;
-
- Gtk::ScrolledWindow terminal_scroll;
Vte::Terminal terminal;
int master_fd, slave_fd;
@@ -61,16 +58,11 @@ MessagesPage::MessagesPage(MainWindow * const m, MainNotebook * const n) :
PrivateImplementationPattern<MessagesPage>(new Implementation<MessagesPage>(m, this, n))
{
_imp->terminal.set_pty(dup(_imp->master_fd));
- set_run_command_stdout_fds(_imp->slave_fd, _imp->master_fd);
- set_run_command_stderr_fds(_imp->slave_fd, _imp->master_fd);
- PStream::set_stderr_fd(_imp->slave_fd, _imp->master_fd);
- Log::get_instance()->set_log_stream(_imp->messages_stream.get());
+ set_capture_output_options();
_imp->terminal.set_scroll_on_output(true);
- _imp->terminal_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
- _imp->terminal_scroll.add(_imp->terminal);
- attach(_imp->terminal_scroll, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 4, 4);
+ attach(_imp->terminal, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 4, 4);
_imp->terminal_cursor_moved_connection = _imp->terminal.signal_cursor_moved().connect(
sigc::mem_fun(this, &MessagesPage::handle_terminal_cursor_moved));
@@ -93,3 +85,12 @@ MessagesPage::handle_terminal_cursor_moved()
_imp->main_notebook->mark_messages_page();
}
+void
+MessagesPage::set_capture_output_options()
+{
+ set_run_command_stdout_fds(_imp->slave_fd, _imp->master_fd);
+ set_run_command_stderr_fds(_imp->slave_fd, _imp->master_fd);
+ PStream::set_stderr_fd(_imp->slave_fd, _imp->master_fd);
+ Log::get_instance()->set_log_stream(_imp->messages_stream.get());
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/messages_page.hh b/src/clients/gtkpaludis/libgtkpaludis/messages_page.hh
index 21c8788..81a2116 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/messages_page.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/messages_page.hh
@@ -25,6 +25,7 @@ namespace gtkpaludis
~MessagesPage();
void populate();
+ void set_capture_output_options();
};
}
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_filter.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_filter.cc
index 1eb15cb..6b1062d 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_filter.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_filter.cc
@@ -26,11 +26,7 @@ namespace paludis
PackagesTextFilter packages_text_filter;
Gtk::Expander standard_expander;
- Gtk::Expander extra_expander;
Gtk::Table standard_table;
- Gtk::Table extra_table;
-
- Gtk::Label extra_label;
Implementation(MainWindow * const m, PackagesPage * const p) :
main_window(m),
@@ -39,10 +35,7 @@ namespace paludis
packages_package_filter(m, p),
packages_text_filter(m, p),
standard_expander("Filters:"),
- extra_expander("More filters:"),
- standard_table(3, 1),
- extra_table(1, 1),
- extra_label("EXTRA STUFF")
+ standard_table(3, 1)
{
}
};
@@ -58,10 +51,6 @@ PackagesFilter::PackagesFilter(MainWindow * const m, PackagesPage * const p) :
_imp->standard_table.attach(_imp->packages_repository_filter, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 4, 4);
_imp->standard_table.attach(_imp->packages_package_filter, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 4, 4);
_imp->standard_table.attach(_imp->packages_text_filter, 2, 3, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::FILL, 0, 0);
-
- add(_imp->extra_expander);
- _imp->extra_expander.add(_imp->extra_table);
- _imp->extra_table.attach(_imp->extra_label, 0, 1, 0, 1);
}
PackagesFilter::~PackagesFilter()
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc b/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc
index 9c15763..2a63ca1 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc
@@ -2,6 +2,7 @@
#include "repository_buttons.hh"
#include "main_window.hh"
+#include "gui_sync_task.hh"
#include <gtkmm/button.h>
#include <paludis/environment.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -21,6 +22,8 @@ namespace paludis
Gtk::Button sync_button;
Gtk::Button sync_all_button;
+ tr1::shared_ptr<const RepositoryName> repository_name;
+
Implementation(MainWindow * const m) :
main_window(m),
sync_button("Sync"),
@@ -37,7 +40,10 @@ RepositoryButtons::RepositoryButtons(MainWindow * const m) :
set_layout(Gtk::BUTTONBOX_END);
set_spacing(10);
+ _imp->sync_button.signal_clicked().connect(sigc::mem_fun(this, &RepositoryButtons::handle_sync_button_clicked));
add(_imp->sync_button);
+
+ _imp->sync_all_button.signal_clicked().connect(sigc::mem_fun(this, &RepositoryButtons::handle_sync_all_button_clicked));
add(_imp->sync_all_button);
}
@@ -48,6 +54,7 @@ RepositoryButtons::~RepositoryButtons()
void
RepositoryButtons::set_repository(const RepositoryName & name)
{
+ _imp->repository_name.reset(new RepositoryName(name));
_imp->main_window->paludis_thread_action(
sigc::bind(sigc::mem_fun(this, &RepositoryButtons::set_repository_in_paludis_thread), name),
"Preparing repository buttons");
@@ -67,3 +74,19 @@ RepositoryButtons::set_repository_in_gui_thread(const bool v)
_imp->sync_button.set_sensitive(v);
}
+void
+RepositoryButtons::handle_sync_button_clicked()
+{
+ GuiSyncTask * task(new GuiSyncTask(_imp->main_window));
+ if (_imp->repository_name)
+ task->add_target(stringify(*_imp->repository_name));
+ task->run();
+}
+
+void
+RepositoryButtons::handle_sync_all_button_clicked()
+{
+ GuiSyncTask * task(new GuiSyncTask(_imp->main_window));
+ task->run();
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.hh b/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.hh
index fd2a16e..bf2c3ad 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/repository_buttons.hh
@@ -19,6 +19,10 @@ namespace gtkpaludis
void set_repository_in_paludis_thread(const paludis::RepositoryName &);
void set_repository_in_gui_thread(const bool);
+ protected:
+ void handle_sync_button_clicked();
+ void handle_sync_all_button_clicked();
+
public:
RepositoryButtons(MainWindow * const m);
~RepositoryButtons();
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.cc b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.cc
new file mode 100644
index 0000000..83a988a
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.cc
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "task_sequence_list.hh"
+#include "task_sequence_list_model.hh"
+#include <paludis/util/private_implementation_pattern-impl.hh>
+
+using namespace gtkpaludis;
+using namespace paludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<TaskSequenceList>
+ {
+ Glib::RefPtr<TaskSequenceListModel> model;
+
+ Implementation() :
+ model(new TaskSequenceListModel)
+ {
+ }
+ };
+}
+
+TaskSequenceList::TaskSequenceList() :
+ Gtk::TreeView(),
+ PrivateImplementationPattern<TaskSequenceList>(new Implementation<TaskSequenceList>())
+{
+ set_model(_imp->model);
+
+ append_column("Action", _imp->model->columns().col_description);
+ append_column("Status", _imp->model->columns().col_status);
+}
+
+TaskSequenceList::~TaskSequenceList()
+{
+}
+
+void
+TaskSequenceList::append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status)
+{
+ _imp->model->append_sequence_item(id, description, status);
+}
+
+void
+TaskSequenceList::set_sequence_item_status(const std::string & id, const std::string & status)
+{
+ _imp->model->set_sequence_item_status(id, status);
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.hh b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.hh
new file mode 100644
index 0000000..c72967f
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list.hh
@@ -0,0 +1,27 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#ifndef GTKPALUDIS_GUARD_LIBGTKPALUDIS_TASK_SEQUENCE_LIST_HH
+#define GTKPALUDIS_GUARD_LIBGTKPALUDIS_TASK_SEQUENCE_LIST_HH 1
+
+#include <paludis/util/private_implementation_pattern.hh>
+#include <gtkmm/treeview.h>
+
+namespace gtkpaludis
+{
+ class TaskSequenceList :
+ public Gtk::TreeView,
+ private paludis::PrivateImplementationPattern<TaskSequenceList>
+ {
+ public:
+ TaskSequenceList();
+ ~TaskSequenceList();
+
+ void append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status);
+
+ void set_sequence_item_status(const std::string & id, const std::string & status);
+ };
+}
+
+
+#endif
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.cc
new file mode 100644
index 0000000..4f9cc58
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.cc
@@ -0,0 +1,63 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "task_sequence_list_model.hh"
+#include <paludis/util/private_implementation_pattern-impl.hh>
+
+using namespace paludis;
+using namespace gtkpaludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<TaskSequenceListModel>
+ {
+ TaskSequenceListModel::Columns columns;
+ };
+}
+
+TaskSequenceListModel::TaskSequenceListModel() :
+ PrivateImplementationPattern<TaskSequenceListModel>(new Implementation<TaskSequenceListModel>()),
+ Gtk::ListStore(_imp->columns)
+{
+}
+
+TaskSequenceListModel::~TaskSequenceListModel()
+{
+}
+
+TaskSequenceListModel::Columns::Columns()
+{
+ add(col_id);
+ add(col_description);
+ add(col_status);
+}
+
+TaskSequenceListModel::Columns::~Columns()
+{
+}
+
+TaskSequenceListModel::Columns &
+TaskSequenceListModel::columns()
+{
+ return _imp->columns;
+}
+
+void
+TaskSequenceListModel::append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status)
+{
+ iterator r(append());
+ (*r)[_imp->columns.col_id] = id;
+ (*r)[_imp->columns.col_description] = description;
+ (*r)[_imp->columns.col_status] = status;
+}
+
+void
+TaskSequenceListModel::set_sequence_item_status(const std::string & id, const std::string & status)
+{
+ Children c(children());
+ for (iterator r(c.begin()), r_end(c.end()) ; r != r_end ; ++r)
+ if ((*r)[_imp->columns.col_id] == id)
+ (*r)[_imp->columns.col_status] = status;
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.hh
new file mode 100644
index 0000000..2b24ced
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_sequence_list_model.hh
@@ -0,0 +1,41 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#ifndef GTKPALUDIS_GUARD_LIBGTKPALUDIS_TASK_SEQUENCE_LIST_MODEL_HH
+#define GTKPALUDIS_GUARD_LIBGTKPALUDIS_TASK_SEQUENCE_LIST_MODEL_HH 1
+
+#include <gtkmm/liststore.h>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class TaskSequenceListModel :
+ private paludis::PrivateImplementationPattern<TaskSequenceListModel>,
+ public Gtk::ListStore
+ {
+ public:
+ TaskSequenceListModel();
+ ~TaskSequenceListModel();
+
+ class Columns :
+ public Gtk::TreeModelColumnRecord
+ {
+ public:
+ Columns();
+ ~Columns();
+
+ Gtk::TreeModelColumn<Glib::ustring> col_id;
+ Gtk::TreeModelColumn<Glib::ustring> col_description;
+ Gtk::TreeModelColumn<Glib::ustring> col_status;
+ };
+
+ Columns & columns();
+
+ void append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status);
+
+ void set_sequence_item_status(const std::string & id, const std::string & status);
+ };
+}
+
+
+#endif
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_window.cc b/src/clients/gtkpaludis/libgtkpaludis/task_window.cc
new file mode 100644
index 0000000..143c871
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_window.cc
@@ -0,0 +1,175 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "task_window.hh"
+#include "main_window.hh"
+#include "gui_task.hh"
+#include "task_sequence_list.hh"
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/tr1_memory.hh>
+#include <paludis/util/fd_output_stream.hh>
+#include <paludis/util/pstream.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/log.hh>
+#include <gtkmm/table.h>
+#include <gtkmm/button.h>
+#include <gtkmm/buttonbox.h>
+#include <gtkmm/stock.h>
+#include <gtkmm/statusbar.h>
+#include <gtkmm/scrolledwindow.h>
+#include <vtemm/terminal_widget.hh>
+#include <cstdlib>
+#include <fcntl.h>
+
+using namespace gtkpaludis;
+using namespace paludis;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<TaskWindow>
+ {
+ MainWindow * const main_window;
+ GuiTask * const task;
+
+ Gtk::Table main_table;
+ Gtk::HButtonBox main_button_box;
+ Gtk::Button ok_button;
+ Gtk::Statusbar status_bar;
+
+ Gtk::ScrolledWindow task_sequence_list_scroll;
+ TaskSequenceList task_sequence_list;
+
+ Vte::Terminal terminal;
+ int master_fd, slave_fd;
+
+ paludis::tr1::shared_ptr<FDOutputStream> messages_stream;
+
+ Implementation(MainWindow * const m, GuiTask * const t) :
+ main_window(m),
+ task(t),
+ main_table(4, 1),
+ ok_button(Gtk::Stock::OK),
+ master_fd(posix_openpt(O_RDWR | O_NOCTTY))
+ {
+ grantpt(master_fd);
+ unlockpt(master_fd);
+ slave_fd = open(ptsname(master_fd), O_RDWR);
+
+ messages_stream.reset(new FDOutputStream(slave_fd));
+ }
+
+ ~Implementation()
+ {
+ close(master_fd);
+ close(slave_fd);
+ }
+ };
+}
+
+TaskWindow::TaskWindow(MainWindow * const m, GuiTask * const t) :
+ ThreadedWindow(Gtk::WINDOW_TOPLEVEL, m->environment()),
+ PrivateImplementationPattern<TaskWindow>(new Implementation<TaskWindow>(m, t)),
+ _imp(PrivateImplementationPattern<TaskWindow>::_imp)
+{
+ m->desensitise();
+
+ set_modal(true);
+ set_transient_for(*m);
+ set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
+ set_title("Task");
+ set_default_size(700, 500);
+ set_border_width(4);
+
+ _imp->ok_button.signal_clicked().connect(sigc::mem_fun(this, &TaskWindow::handle_ok_button_clicked));
+
+ _imp->terminal.set_pty(dup(_imp->master_fd));
+ set_run_command_stdout_fds(_imp->slave_fd, _imp->master_fd);
+ set_run_command_stderr_fds(_imp->slave_fd, _imp->master_fd);
+ PStream::set_stderr_fd(_imp->slave_fd, _imp->master_fd);
+ Log::get_instance()->set_log_stream(_imp->messages_stream.get());
+
+ _imp->terminal.set_scroll_on_output(true);
+
+ _imp->main_button_box.set_layout(Gtk::BUTTONBOX_END);
+ _imp->main_button_box.set_spacing(10);
+ _imp->main_button_box.add(_imp->ok_button);
+
+ _imp->status_bar.set_has_resize_grip(true);
+
+ _imp->task_sequence_list_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _imp->task_sequence_list_scroll.add(_imp->task_sequence_list);
+ _imp->main_table.attach(_imp->task_sequence_list_scroll, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL,
+ Gtk::EXPAND | Gtk::FILL, 4, 4);
+
+ _imp->main_table.attach(_imp->terminal, 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL,
+ Gtk::EXPAND | Gtk::FILL, 4, 4);
+
+ _imp->main_table.attach(_imp->main_button_box, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL,
+ Gtk::FILL, 4, 4);
+ _imp->main_table.attach(_imp->status_bar, 0, 1, 3, 4, Gtk::EXPAND | Gtk::FILL,
+ Gtk::FILL, 4, 4);
+
+ add(_imp->main_table);
+
+ show_all();
+}
+
+TaskWindow::~TaskWindow()
+{
+ _imp->main_window->set_capture_output_options();
+ _imp->main_window->sensitise();
+}
+
+void
+TaskWindow::handle_ok_button_clicked()
+{
+ handle_delete_event(0);
+}
+
+bool
+TaskWindow::handle_delete_event(GdkEventAny * a)
+{
+ ThreadedWindow::handle_delete_event(a);
+ delete _imp->task;
+ delete this;
+ return false;
+}
+
+void
+TaskWindow::push_status_message(const std::string & s)
+{
+ _imp->status_bar.push(s);
+}
+
+void
+TaskWindow::pop_status_message()
+{
+ _imp->status_bar.pop();
+}
+
+void
+TaskWindow::do_set_sensitive(const bool v)
+{
+ _imp->main_button_box.set_sensitive(v);
+}
+
+void
+TaskWindow::run()
+{
+ show_all();
+ paludis_thread_action(sigc::mem_fun(_imp->task, &GuiTask::paludis_thread_execute), "Executing task");
+}
+
+void
+TaskWindow::append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status)
+{
+ _imp->task_sequence_list.append_sequence_item(id, description, status);
+}
+
+void
+TaskWindow::set_sequence_item_status(const std::string & id, const std::string & status)
+{
+ _imp->task_sequence_list.set_sequence_item_status(id, status);
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/task_window.hh b/src/clients/gtkpaludis/libgtkpaludis/task_window.hh
new file mode 100644
index 0000000..358c50b
--- /dev/null
+++ b/src/clients/gtkpaludis/libgtkpaludis/task_window.hh
@@ -0,0 +1,41 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#ifndef PALUDIS_GUARD_SRC_CLIENTS_GTKPALUDIS_LIBGTKPALUDIS_TASK_WINDOW_HH
+#define PALUDIS_GUARD_SRC_CLIENTS_GTKPALUDIS_LIBGTKPALUDIS_TASK_WINDOW_HH 1
+
+#include <libgtkpaludis/threaded_window.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+namespace gtkpaludis
+{
+ class MainWindow;
+ class GuiTask;
+
+ class TaskWindow :
+ public ThreadedWindow,
+ private paludis::PrivateImplementationPattern<TaskWindow>
+ {
+ private:
+ paludis::PrivateImplementationPattern<TaskWindow>::ImpPtr & _imp;
+
+ protected:
+ virtual bool handle_delete_event(GdkEventAny *);
+ void handle_ok_button_clicked();
+ virtual void do_set_sensitive(const bool);
+
+ virtual void push_status_message(const std::string &);
+ virtual void pop_status_message();
+
+ public:
+ TaskWindow(MainWindow * const, GuiTask * const);
+ ~TaskWindow();
+
+ void run();
+
+ void append_sequence_item(const std::string & id, const std::string & description,
+ const std::string & status);
+ void set_sequence_item_status(const std::string & id, const std::string & status);
+ };
+}
+
+#endif
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index 91ff451..ef4fa80 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -6,10 +6,13 @@
#include "markup.hh"
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/iterator.hh>
+#include <paludis/util/visitor-impl.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/query.hh>
+#include <paludis/eapi.hh>
+#include <paludis/dep_spec_pretty_printer.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <list>
@@ -103,27 +106,36 @@ VersionInfoModel::populate_in_paludis_thread(paludis::tr1::shared_ptr<const Pack
_imp->query_window->environment()->package_database()->fetch_repository(p->repository)->version_metadata(
p->name, p->version));
- data->items.push_back(PopulateDataItem("Description", markup_escape(metadata->description)));
-
- if (metadata->ebuild_interface)
+ if (metadata->eapi->supported)
{
- std::string km;
- paludis::tr1::shared_ptr<const KeywordNameCollection> keywords(metadata->ebuild_interface->keywords());
- for (KeywordNameCollection::Iterator k(keywords->begin()), k_end(keywords->end()) ;
- k != k_end ; ++k)
+ if (! metadata->description.empty())
+ data->items.push_back(PopulateDataItem("Description", markup_escape(metadata->description)));
+
+ DepSpecPrettyPrinter homepage_printer(0, false);
+ metadata->homepage()->accept(homepage_printer);
+ if (! stringify(homepage_printer).empty())
+ data->items.push_back(PopulateDataItem("Homepage", markup_escape(stringify(homepage_printer))));
+
+ if (metadata->ebuild_interface)
{
- if (! km.empty())
- km.append(" ");
-
- paludis::tr1::shared_ptr<KeywordNameCollection> kc(new KeywordNameCollection::Concrete);
- kc->insert(*k);
- if (_imp->query_window->environment()->accept_keywords(kc, *p))
- km.append(markup_bold(markup_escape(stringify(*k))));
- else
- km.append(markup_italic(markup_escape(stringify(*k))));
+ std::string km;
+ paludis::tr1::shared_ptr<const KeywordNameCollection> keywords(metadata->ebuild_interface->keywords());
+ for (KeywordNameCollection::Iterator k(keywords->begin()), k_end(keywords->end()) ;
+ k != k_end ; ++k)
+ {
+ if (! km.empty())
+ km.append(" ");
+
+ paludis::tr1::shared_ptr<KeywordNameCollection> kc(new KeywordNameCollection::Concrete);
+ kc->insert(*k);
+ if (_imp->query_window->environment()->accept_keywords(kc, *p))
+ km.append(markup_bold(markup_escape(stringify(*k))));
+ else
+ km.append(markup_italic(markup_escape(stringify(*k))));
+ }
+
+ data->items.push_back(PopulateDataItem("Keywords", km));
}
-
- data->items.push_back(PopulateDataItem("Keywords", km));
}
}