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

@ -11,8 +11,9 @@ MANAGER_RESOURCES_FILES = manager_window.ui \
UPDATER_RESOURCES_FILES = updater_window.ui
TRANSACTION_RESOURCES_FILES = progress_dialog.ui \
progress_box.ui \
INSTALLER_RESOURCES_FILES = progress_dialog.ui
TRANSACTION_RESOURCES_FILES = progress_box.ui \
choose_provider_dialog.ui \
transaction_sum_dialog.ui \
preferences_dialog.ui \
@ -24,7 +25,9 @@ MANAGER_GRESOURCE_FILE = pamac.manager.gresource.xml
UPDATER_GRESOURCE_FILE = pamac.updater.gresource.xml
resources: transaction_resources.c manager_resources.c updater_resources.c
INSTALLER_GRESOURCE_FILE = pamac.installer.gresource.xml
resources: transaction_resources.c manager_resources.c updater_resources.c installer_resources.c
clean:
rm -f *.c
@ -37,3 +40,6 @@ manager_resources.c: $(MANAGER_GRESOURCE_FILE) $(MANAGER_RESOURCES_FILES)
updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
glib-compile-resources $(UPDATER_GRESOURCE_FILE) --target=updater_resources.c --generate-source
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILE)
glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --target=installer_resources.c --generate-source

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/manjaro/pamac/installer">
<file preprocess="xml-stripblanks">progress_dialog.ui</file>
</gresource>
</gresources>

View File

@ -2,61 +2,20 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="PamacProgressDialog" parent="GtkDialog">
<template class="PamacProgressDialog" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="border_width">3</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Progress</property>
<property name="window_position">center-on-parent</property>
<property name="window_position">center</property>
<property name="default_width">600</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Hide</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
@ -79,14 +38,36 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</template>
</interface>

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,10 +103,23 @@ 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 ();
if (important_details) {
progress_dialog.close_button.visible = true;
} else {
this.release ();
}
}
public static int main (string[] args) {
var installer = new Installer();

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 ();
}
}