fix installer

This commit is contained in:
guinux
2016-05-18 16:25:31 +02:00
parent 9c3c27f64c
commit bd084718ff
6 changed files with 84 additions and 65 deletions

View File

@@ -28,8 +28,7 @@ TRANSACTION_SOURCES = package.vala \
history_dialog.vala \
choose_provider_dialog.vala \
transaction_sum_dialog.vala \
progress_box.vala \
progress_dialog.vala
progress_box.vala
PREFERENCES_SOURCES = preferences_dialog.vala \
choose_ignorepkgs_dialog.vala \
@@ -119,10 +118,13 @@ pamac-updater: libpamac.so ../resources/updater_resources.c updater_window.vala
updater_window.vala \
updater.vala
pamac-install: libpamac.so installer.vala
pamac-install: libpamac.so ../resources/installer_resources.c progress_dialog.vala installer.vala
valac -o pamac-install \
$(COMMON_VALA_FLAGS) \
$(PAMAC_LIB_FLAGS) \
--pkg=json-glib-1.0 \
--pkg=gtk+-3.0 \
--gresources=$(INSTALLER_GRESOURCE_FILE) \
../resources/installer_resources.c \
progress_dialog.vala \
installer.vala

View File

@@ -21,7 +21,9 @@ namespace Pamac {
public class Installer: Gtk.Application {
Transaction transaction;
ProgressDialog progress_dialog;
bool pamac_run;
bool important_details;
public Installer () {
application_id = "org.manjaro.pamac.install";
@@ -45,8 +47,17 @@ namespace Pamac {
msg.run ();
msg.destroy ();
} else {
transaction = new Pamac.Transaction (null);
important_details = false;
// integrate progress box and term widget
progress_dialog = new ProgressDialog ();
transaction = new Pamac.Transaction (progress_dialog as Gtk.ApplicationWindow);
transaction.finished.connect (on_transaction_finished);
transaction.important_details_outpout.connect (on_important_details_outpout);
progress_dialog.box.pack_start (transaction.progress_box);
progress_dialog.box.reorder_child (transaction.progress_box, 0);
progress_dialog.expander.add (transaction.term_grid);
progress_dialog.close_button.clicked.connect (on_close_button_clicked);
progress_dialog.close_button.visible = false;
this.hold ();
}
}
@@ -65,6 +76,7 @@ namespace Pamac {
transaction.to_load.add (file.get_path ());
}
transaction.run ();
progress_dialog.show ();
}
}
@@ -91,9 +103,22 @@ namespace Pamac {
return run;
}
void on_important_details_outpout (bool must_show) {
important_details = true;
progress_dialog.expander.expanded = true;
}
void on_close_button_clicked () {
this.release ();
}
void on_transaction_finished () {
transaction.stop_daemon ();
this.release ();
if (important_details) {
progress_dialog.close_button.visible = true;
} else {
this.release ();
}
}
public static int main (string[] args) {

View File

@@ -19,19 +19,18 @@
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/progress_dialog.ui")]
class ProgressDialog : Gtk.Dialog {
[GtkTemplate (ui = "/org/manjaro/pamac/installer/progress_dialog.ui")]
class ProgressDialog : Gtk.ApplicationWindow {
[GtkChild]
public Gtk.Button cancel_button;
public Gtk.Box box;
[GtkChild]
public Gtk.Button close_button;
[GtkChild]
public Gtk.Expander expander;
public ProgressDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 1);
public ProgressDialog () {
Object ();
}
}