diff --git a/po/files_to_translate b/po/files_to_translate
index 1d3f40b..3f63c8c 100644
--- a/po/files_to_translate
+++ b/po/files_to_translate
@@ -12,7 +12,6 @@
../resources/choose_provider_dialog.ui
../resources/progress_dialog.ui
../resources/history_dialog.ui
-../resources/transaction_info_dialog.ui
../resources/transaction_sum_dialog.ui
../resources/choose_dep_dialog.ui
../resources/manager_window.ui
diff --git a/po/pamac.pot b/po/pamac.pot
index 263dd6d..30211ae 100644
--- a/po/pamac.pot
+++ b/po/pamac.pot
@@ -115,6 +115,10 @@ msgstr ""
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr ""
+#: ../src/transaction.vala
+msgid "A Gtk3 frontend for libalpm"
+msgstr ""
+
#: ../src/transaction.vala
msgid "Refreshing mirrors list"
msgstr ""
@@ -136,10 +140,6 @@ msgstr ""
msgid "Choose a provider for %s"
msgstr ""
-#: ../src/transaction.vala ../resources/transaction_sum_dialog.ui
-msgid "Transaction Summary"
-msgstr ""
-
#: ../src/transaction.vala
msgid "To remove"
msgstr ""
@@ -325,6 +325,10 @@ msgstr ""
msgid "Warning"
msgstr ""
+#: ../src/transaction.vala
+msgid "_Close"
+msgstr ""
+
#: ../src/transaction.vala
msgid "Nothing to do"
msgstr ""
@@ -341,11 +345,11 @@ msgstr ""
msgid "Your system is up-to-date"
msgstr ""
-#: ../src/tray.vala ../resources/updater_window.ui
+#: ../src/tray.vala
msgid "Update Manager"
msgstr ""
-#: ../src/tray.vala ../resources/manager_window.ui
+#: ../src/tray.vala
msgid "Package Manager"
msgstr ""
@@ -515,14 +519,8 @@ msgstr ""
#: ../src/manager_window.vala
#, c-format
-msgid ""
-"%s has %u uninstalled optional dependency.\n"
-"Choose if you would like to install it"
-msgid_plural ""
-"%s has %u uninstalled optional dependencies.\n"
-"Choose those you would like to install"
-msgstr[0] ""
-msgstr[1] ""
+msgid "Choose optional dependencies for %s"
+msgstr ""
#: ../src/manager_window.vala ../resources/manager_window.ui
msgid "Install Local Packages"
@@ -530,7 +528,8 @@ msgstr ""
#: ../src/manager_window.vala ../resources/progress_dialog.ui
#: ../resources/transaction_sum_dialog.ui ../resources/choose_dep_dialog.ui
-#: ../resources/manager_window.ui ../resources/choose_ignorepkgs_dialog.ui
+#: ../resources/manager_window.ui ../resources/updater_window.ui
+#: ../resources/choose_ignorepkgs_dialog.ui
msgid "_Cancel"
msgstr ""
@@ -542,10 +541,6 @@ msgstr ""
msgid "Alpm Package"
msgstr ""
-#: ../src/manager_window.vala
-msgid "A Gtk3 frontend for libalpm"
-msgstr ""
-
#: ../src/preferences_dialog.vala ../resources/preferences_dialog.ui
msgid "How often to check for updates, value in hours"
msgstr ""
@@ -562,18 +557,13 @@ msgstr ""
msgid "Random"
msgstr ""
-#: ../src/choose_ignorepkgs_dialog.vala
-msgid "Choose the packages you do not want to upgrade"
-msgstr ""
-
#: ../resources/choose_provider_dialog.ui
msgid "Choose a Provider"
msgstr ""
-#: ../resources/choose_provider_dialog.ui
-#: ../resources/transaction_sum_dialog.ui ../resources/choose_dep_dialog.ui
+#: ../resources/choose_provider_dialog.ui ../resources/choose_dep_dialog.ui
#: ../resources/choose_ignorepkgs_dialog.ui
-msgid "_OK"
+msgid "Choose"
msgstr ""
#: ../resources/progress_dialog.ui
@@ -584,8 +574,8 @@ msgstr ""
msgid "_Hide"
msgstr ""
-#: ../resources/progress_dialog.ui ../resources/transaction_info_dialog.ui
-#: ../resources/manager_window.ui
+#: ../resources/progress_dialog.ui ../resources/manager_window.ui
+#: ../resources/updater_window.ui
msgid "Details"
msgstr ""
@@ -593,29 +583,32 @@ msgstr ""
msgid "Pamac History"
msgstr ""
-#: ../resources/history_dialog.ui ../resources/transaction_info_dialog.ui
-#: ../resources/updater_window.ui ../resources/preferences_dialog.ui
-msgid "_Close"
+#: ../resources/transaction_sum_dialog.ui
+msgid "Transaction Summary"
+msgstr ""
+
+#: ../resources/transaction_sum_dialog.ui
+msgid "Commit"
msgstr ""
#: ../resources/choose_dep_dialog.ui
msgid "Choose Optional Dependencies"
msgstr ""
-#: ../resources/manager_window.ui
+#: ../resources/manager_window.ui ../resources/updater_window.ui
msgid "Refresh databases"
msgstr ""
-#: ../resources/manager_window.ui
+#: ../resources/manager_window.ui ../resources/updater_window.ui
msgid "View History"
msgstr ""
#: ../resources/manager_window.ui ../resources/updater_window.ui
-msgid "_Preferences"
+msgid "Preferences"
msgstr ""
-#: ../resources/manager_window.ui
-msgid "_About"
+#: ../resources/manager_window.ui ../resources/updater_window.ui
+msgid "About"
msgstr ""
#: ../resources/manager_window.ui
@@ -667,14 +660,6 @@ msgstr ""
msgid "Files"
msgstr ""
-#: ../resources/updater_window.ui
-msgid "_Refresh"
-msgstr ""
-
-#: ../resources/preferences_dialog.ui
-msgid "Preferences"
-msgstr ""
-
#: ../resources/preferences_dialog.ui
msgid "Remove unrequired dependencies"
msgstr ""
diff --git a/resources/Makefile b/resources/Makefile
index ba1e352..39cedbe 100644
--- a/resources/Makefile
+++ b/resources/Makefile
@@ -15,7 +15,6 @@ UPDATER_RESOURCES_FILES = updater_window.ui
TRANSACTION_RESOURCES_FILES = progress_dialog.ui \
choose_provider_dialog.ui \
transaction_sum_dialog.ui \
- transaction_info_dialog.ui \
preferences_dialog.ui \
choose_ignorepkgs_dialog.ui
diff --git a/resources/choose_dep_dialog.ui b/resources/choose_dep_dialog.ui
index b16e655..fcfb2ea 100644
--- a/resources/choose_dep_dialog.ui
+++ b/resources/choose_dep_dialog.ui
@@ -4,13 +4,15 @@
False
- 6
+ 3
Choose Optional Dependencies
True
center-on-parent
+ 600
system-software-install
dialog
True
+ False
False
@@ -58,23 +61,12 @@
0
-
-
-
- False
- True
- 1
-
-
diff --git a/resources/manager_window.ui b/resources/manager_window.ui
index edb4c52..93c3152 100644
--- a/resources/manager_window.ui
+++ b/resources/manager_window.ui
@@ -1,61 +1,100 @@
-
-
- True
+
+
True
False
- Package Manager
600
system-software-install
center
+ False
True
@@ -66,61 +105,12 @@
True
False
vertical
- 3
-
-
- True
- False
- 6
-
-
- True
- False
- center
- filters_stack
-
-
- True
- True
- 0
-
-
-
-
-
- False
- True
- end
- 3
-
-
-
-
- False
- True
- 0
-
-
+ 6
True
False
+ 3
3
@@ -132,7 +122,7 @@
True
False
vertical
- 6
+ 3
True
@@ -163,7 +153,6 @@
6
True
Search in AUR
- 0
False
@@ -609,13 +598,17 @@
True
True
- 2
+ 0
True
False
+ 6
+ 6
+ 6
+ 12
True
@@ -637,12 +630,12 @@
True
start
-
+
Details
True
True
True
-
+
True
@@ -651,14 +644,13 @@
-
+
_Apply
True
True
True
True
- 0.55000001192092896
-
+
True
@@ -667,13 +659,13 @@
-
+
_Cancel
True
True
True
True
-
+
True
@@ -692,7 +684,7 @@
False
True
- 4
+ 1
@@ -994,5 +986,43 @@
+
+
+
diff --git a/resources/pamac.manager.gresource.xml b/resources/pamac.manager.gresource.xml
index bff4ac1..18cb1a5 100644
--- a/resources/pamac.manager.gresource.xml
+++ b/resources/pamac.manager.gresource.xml
@@ -2,7 +2,6 @@
manager_window.ui
- history_dialog.ui
choose_dep_dialog.ui
package-available.png
package-available-locked.png
diff --git a/resources/pamac.transaction.gresource.xml b/resources/pamac.transaction.gresource.xml
index fe0dfc7..551a936 100644
--- a/resources/pamac.transaction.gresource.xml
+++ b/resources/pamac.transaction.gresource.xml
@@ -2,9 +2,9 @@
progress_dialog.ui
+ history_dialog.ui
choose_provider_dialog.ui
transaction_sum_dialog.ui
- transaction_info_dialog.ui
preferences_dialog.ui
diff --git a/resources/preferences_dialog.ui b/resources/preferences_dialog.ui
index e2ae869..0bc0b7c 100644
--- a/resources/preferences_dialog.ui
+++ b/resources/preferences_dialog.ui
@@ -11,8 +11,7 @@
False
- 6
- Preferences
+ 3
center-on-parent
system-software-install
dialog
@@ -26,18 +25,7 @@
False
end
-
- _Close
- True
- True
- True
- True
-
-
- False
- True
- 1
-
+
@@ -47,19 +35,6 @@
0
-
-
- True
- False
- center
- stack
-
-
- False
- True
- 0
-
-
True
@@ -677,8 +652,23 @@ All AUR users should be familiar with the build process.
-
- close_button
-
+
+
+
diff --git a/resources/progress_dialog.ui b/resources/progress_dialog.ui
index d5a171d..6761f5b 100644
--- a/resources/progress_dialog.ui
+++ b/resources/progress_dialog.ui
@@ -3,13 +3,14 @@
- 500
False
- 6
+ 3
Progress
center-on-parent
+ 600
system-software-install
dialog
+ False
True
@@ -60,6 +61,7 @@
True
False
+ 12
False
diff --git a/resources/transaction_info_dialog.ui b/resources/transaction_info_dialog.ui
deleted file mode 100644
index 69b66ff..0000000
--- a/resources/transaction_info_dialog.ui
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
- False
- 6
- True
- center-on-parent
- 300
- system-software-install
- dialog
- True
-
-
- False
- vertical
- 12
-
-
- False
- end
-
-
- _Close
- True
- True
- True
- False
- True
-
-
- True
- True
- 0
-
-
-
-
- False
- True
- end
- 0
-
-
-
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
- True
- True
- True
-
-
- 450
- 200
- True
- True
- in
-
-
- True
- True
- True
- True
- 3
- False
- 6
- 6
- False
-
-
-
-
-
-
- True
- False
- Details
-
-
-
-
- True
- True
- 2
-
-
-
-
-
- close_button
-
-
-
diff --git a/resources/transaction_sum_dialog.ui b/resources/transaction_sum_dialog.ui
index 3fb7df7..f0973ae 100644
--- a/resources/transaction_sum_dialog.ui
+++ b/resources/transaction_sum_dialog.ui
@@ -4,11 +4,13 @@
False
- 6
+ 3
Transaction Summary
center-on-parent
+ 600
system-software-install
dialog
+ False
False
@@ -23,7 +25,6 @@
_Cancel
True
True
- True
False
True
@@ -34,12 +35,14 @@
-
- _OK
+
+ Commit
True
True
+ True
+ True
+ True
False
- True
False
@@ -52,18 +55,19 @@
False
True
end
- 0
+ 2
True
False
+ 6
False
True
- 1
+ 0
@@ -137,25 +141,14 @@
True
True
- 2
-
-
-
-
- True
- False
-
-
- False
- True
- 3
+ 1
cancel_button
- valid_button
+ apply_button
diff --git a/resources/updater_window.ui b/resources/updater_window.ui
index 4338c02..bba78cf 100644
--- a/resources/updater_window.ui
+++ b/resources/updater_window.ui
@@ -1,27 +1,23 @@
-
-
- True
+
+
+
+ True
+ False
+ 600
+ system-software-update
+ center
+ False
+
+
+ True
+ False
+ True
+ True
+ vertical
+ 6
+
+
+ True
+ False
+ center
+ 6
+ stack
+
+
+ False
+ True
+ 0
+
+
True
@@ -241,45 +302,23 @@
True
True
- 2
+ 1
-
+
True
False
-
-
- False
- True
- 3
-
-
-
-
- True
- False
- 12
+ 6
+ 6
+ 6
+ vertical
+ 6
-
+
True
False
- start
-
-
- _Preferences
- True
- True
- False
- True
-
-
-
- False
- True
- 0
-
-
+ center
False
@@ -288,35 +327,75 @@
-
+
True
False
- 6
- end
+ 12
-
- _Refresh
+
True
- True
- False
- True
-
+ False
+ start
- False
+ True
True
0
-
- _Apply
+
True
- True
- True
- False
- True
-
+ False
+ 6
+ start
+
+
+ Details
+ True
+ True
+ True
+
+
+
+ True
+ True
+ 0
+
+
+
+
+ _Apply
+ True
+ True
+ True
+ True
+ True
+ False
+ True
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ _Cancel
+ True
+ True
+ True
+ True
+
+
+
+ True
+ True
+ 2
+
+
False
@@ -324,26 +403,10 @@
1
-
-
- _Close
- True
- True
- False
- True
-
-
-
- False
- True
- 2
-
-
False
True
- end
1
@@ -351,7 +414,37 @@
False
True
- 4
+ 2
+
+
+
+
+
+
diff --git a/src/Makefile b/src/Makefile
index 65d4f26..9701e92 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -25,9 +25,9 @@ COMMON_SOURCES = common.vala \
TRANSACTION_SOURCES = package.vala \
transaction.vala \
+ history_dialog.vala \
choose_provider_dialog.vala \
transaction_sum_dialog.vala \
- transaction_info_dialog.vala \
progress_dialog.vala
PREFERENCES_SOURCES = preferences_dialog.vala \
@@ -94,7 +94,7 @@ libpamac.so: $(COMMON_SOURCES) $(TRANSACTION_SOURCES) $(PREFERENCES_SOURCES) ../
$(TRANSACTION_SOURCES) \
$(PREFERENCES_SOURCES)
-pamac-manager: libpamac.so choose_dep_dialog.vala history_dialog.vala transaction_info_dialog.vala ../resources/manager_resources.c manager_window.vala manager.vala
+pamac-manager: libpamac.so choose_dep_dialog.vala ../resources/manager_resources.c manager_window.vala manager.vala
valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \
$(PAMAC_LIB_FLAGS) \
@@ -104,7 +104,6 @@ pamac-manager: libpamac.so choose_dep_dialog.vala history_dialog.vala transactio
--gresources=$(MANAGER_GRESOURCE_FILE) \
../resources/manager_resources.c \
choose_dep_dialog.vala \
- history_dialog.vala \
manager_window.vala \
manager.vala
diff --git a/src/choose_dep_dialog.vala b/src/choose_dep_dialog.vala
index 5d5e776..2c724a3 100644
--- a/src/choose_dep_dialog.vala
+++ b/src/choose_dep_dialog.vala
@@ -22,15 +22,13 @@ namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/manager/choose_dep_dialog.ui")]
class ChooseDependenciesDialog : Gtk.Dialog {
- [GtkChild]
- public Gtk.Label label;
[GtkChild]
public Gtk.TreeView treeview;
public Gtk.ListStore deps_list;
public ChooseDependenciesDialog (Gtk.ApplicationWindow? window) {
- Object (transient_for: window, use_header_bar: 0);
+ Object (transient_for: window, use_header_bar: 1);
deps_list = new Gtk.ListStore (2, typeof (bool), typeof (string));
treeview.set_model (deps_list);
diff --git a/src/choose_ignorepkgs_dialog.vala b/src/choose_ignorepkgs_dialog.vala
index cda0b1b..6ee9e5f 100644
--- a/src/choose_ignorepkgs_dialog.vala
+++ b/src/choose_ignorepkgs_dialog.vala
@@ -22,17 +22,14 @@ namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/preferences/choose_ignorepkgs_dialog.ui")]
class ChooseIgnorepkgsDialog : Gtk.Dialog {
- [GtkChild]
- public Gtk.Label label;
[GtkChild]
public Gtk.TreeView treeview;
public Gtk.ListStore pkgs_list;
public ChooseIgnorepkgsDialog (Gtk.Window window) {
- Object (transient_for: window, use_header_bar: 0);
+ Object (transient_for: window, use_header_bar: 1);
- label.set_markup ("%s".printf (dgettext (null, "Choose the packages you do not want to upgrade")));
pkgs_list = new Gtk.ListStore (2, typeof (bool), typeof (string));
treeview.set_model (pkgs_list);
}
@@ -40,10 +37,10 @@ namespace Pamac {
[GtkCallback]
void on_renderertoggle_toggled (string path) {
Gtk.TreeIter iter;
- GLib.Value selected;
+ bool selected;
if (pkgs_list.get_iter_from_string (out iter, path)) {
- pkgs_list.get_value (iter, 0, out selected);
- pkgs_list.set_value (iter, 0, !((bool) selected));
+ pkgs_list.get (iter, 0, out selected);
+ pkgs_list.set (iter, 0, !selected);
}
}
}
diff --git a/src/choose_provider_dialog.vala b/src/choose_provider_dialog.vala
index 12240b5..7faca81 100644
--- a/src/choose_provider_dialog.vala
+++ b/src/choose_provider_dialog.vala
@@ -22,13 +22,8 @@ namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/choose_provider_dialog.ui")]
class ChooseProviderDialog : Gtk.Dialog {
- [GtkChild]
- public Gtk.Label label;
- [GtkChild]
- public Gtk.ComboBoxText comboboxtext;
-
public ChooseProviderDialog (Gtk.ApplicationWindow? window) {
- Object (transient_for: window, use_header_bar: 0);
+ Object (transient_for: window, use_header_bar: 1);
}
}
}
diff --git a/src/history_dialog.vala b/src/history_dialog.vala
index 6c9eb09..f7ad77d 100644
--- a/src/history_dialog.vala
+++ b/src/history_dialog.vala
@@ -19,14 +19,14 @@
namespace Pamac {
- [GtkTemplate (ui = "/org/manjaro/pamac/manager/history_dialog.ui")]
+ [GtkTemplate (ui = "/org/manjaro/pamac/transaction/history_dialog.ui")]
class HistoryDialog : Gtk.Dialog {
[GtkChild]
public Gtk.TextView textview;
- public HistoryDialog (ManagerWindow window) {
- Object (transient_for: window, use_header_bar: 0);
+ public HistoryDialog (Gtk.ApplicationWindow window) {
+ Object (transient_for: window, use_header_bar: 1);
}
}
}
diff --git a/src/manager_window.vala b/src/manager_window.vala
index 0e042e1..4c72ea4 100644
--- a/src/manager_window.vala
+++ b/src/manager_window.vala
@@ -17,8 +17,6 @@
* along with this program. If not, see .
*/
-const string VERSION = "4.0.0";
-
namespace Pamac {
class ActivableCellRendererPixbuf : Gtk.CellRendererPixbuf {
@@ -61,6 +59,8 @@ namespace Pamac {
[GtkChild]
Gtk.Stack filters_stack;
[GtkChild]
+ Gtk.StackSwitcher filters_stackswitcher;
+ [GtkChild]
Gtk.SearchEntry search_entry;
[GtkChild]
Gtk.TreeView search_treeview;
@@ -101,9 +101,9 @@ namespace Pamac {
[GtkChild]
Gtk.Label transaction_infos_label;
[GtkChild]
- Gtk.Button transaction_infos_apply_button;
+ Gtk.Button apply_button;
[GtkChild]
- Gtk.Button transaction_infos_cancel_button;
+ Gtk.Button cancel_button;
// menu
Gtk.Menu right_click_menu;
@@ -300,6 +300,7 @@ namespace Pamac {
show_default_pkgs ();
search_entry.grab_focus ();
+ main_stack.notify["visible-child"].connect (on_main_stack_visible_child_changed);
filters_stack.notify["visible-child"].connect (on_filters_stack_visible_child_changed);
packages_stack.notify["visible-child"].connect (on_packages_stack_visible_child_changed);
@@ -965,16 +966,18 @@ namespace Pamac {
void choose_opt_dep (GLib.List pkgnames) {
foreach (unowned string pkgname in pkgnames) {
var choose_dep_dialog = new ChooseDependenciesDialog (this);
- int length = 0;
+//~ int length = 0;
foreach (unowned string optdep in transaction.get_pkg_uninstalled_optdeps (pkgname)) {
- length++;
+//~ length++;
choose_dep_dialog.deps_list.insert_with_values (null, -1,
0, false,
1, optdep);
}
- choose_dep_dialog.label.set_markup ("%s".printf (
- ngettext ("%s has %u uninstalled optional dependency.\nChoose if you would like to install it",
- "%s has %u uninstalled optional dependencies.\nChoose those you would like to install", length).printf (pkgname, length)));
+ choose_dep_dialog.title = dgettext (null, "Choose optional dependencies for %s").printf (pkgname);
+//~ var headerbar = choose_dep_dialog.get_header_bar () as Gtk.HeaderBar;
+//~ headerbar.subtitle = ngettext ("%s has %u uninstalled optional dependency",
+//~ "%s has %u uninstalled optional dependencies",
+//~ length).printf (pkgname, length);
if (choose_dep_dialog.run () == Gtk.ResponseType.OK) {
choose_dep_dialog.deps_list.foreach ((model, path, iter) => {
bool selected;
@@ -1390,44 +1393,30 @@ namespace Pamac {
}
}
+ void on_main_stack_visible_child_changed () {
+ switch (main_stack.visible_child_name) {
+ case "browse":
+ filters_stackswitcher.visible = true;
+ break;
+ case "details":
+ filters_stackswitcher.visible = false;
+ break;
+ default:
+ break;
+ }
+ }
+
void on_filters_stack_visible_child_changed () {
refresh_packages_list ();
}
[GtkCallback]
- void on_history_item_activate () {
- var file = GLib.File.new_for_path ("/var/log/pamac.log");
- if (!file.query_exists ()) {
- GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
- } else {
- StringBuilder text = new StringBuilder ();
- try {
- // Open file for reading and wrap returned FileInputStream into a
- // DataInputStream, so we can read line by line
- var dis = new DataInputStream (file.read ());
- string line;
- // Read lines until end of file (null) is reached
- while ((line = dis.read_line ()) != null) {
- // construct text in reverse order
- text.prepend (line + "\n");
- }
- } catch (GLib.Error e) {
- GLib.stderr.printf ("%s\n", e.message);
- }
- var history_dialog = new HistoryDialog (this);
- history_dialog.textview.buffer.set_text (text.str, (int) text.len);
- history_dialog.show ();
- history_dialog.response.connect (() => {
- history_dialog.destroy ();
- });
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
- }
- }
+ void on_history_button_clicked () {
+ transaction.run_history_dialog ();
}
[GtkCallback]
- void on_local_item_activate () {
+ void on_local_button_clicked () {
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
dgettext (null, "Install Local Packages"), this, Gtk.FileChooserAction.OPEN,
dgettext (null, "_Cancel"), Gtk.ResponseType.CANCEL,
@@ -1465,25 +1454,17 @@ namespace Pamac {
}
[GtkCallback]
- void on_preferences_item_activate () {
+ void on_preferences_button_clicked () {
transaction.run_preferences_dialog.begin ();
}
[GtkCallback]
- void on_about_item_activate () {
- Gtk.show_about_dialog (
- this,
- "program_name", "Pamac",
- "logo_icon_name", "system-software-install",
- "comments", dgettext (null, "A Gtk3 frontend for libalpm"),
- "copyright", "Copyright © 2016 Guillaume Benoit",
- "version", VERSION,
- "license_type", Gtk.License.GPL_3_0,
- "website", "http://manjaro.org");
+ void on_about_button_clicked () {
+ transaction.run_about_dialog ();
}
[GtkCallback]
- void on_transaction_infos_details_button_clicked () {
+ void on_details_button_clicked () {
if (transaction_running) {
transaction.show_progress ();
} else {
@@ -1500,14 +1481,13 @@ namespace Pamac {
}
[GtkCallback]
- void on_transaction_infos_apply_button_clicked () {
- //this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
+ void on_apply_button_clicked () {
transaction_running = true;
transaction.run ();
}
[GtkCallback]
- void on_transaction_infos_cancel_button_clicked () {
+ void on_cancel_button_clicked () {
if (transaction_running) {
transaction.cancel ();
} else {
@@ -1518,17 +1498,17 @@ namespace Pamac {
}
[GtkCallback]
- void on_refresh_item_activate () {
+ void on_refresh_button_clicked () {
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
refreshing = true;
transaction.start_refresh (false);
- transaction_infos_apply_button.visible = false;
+ apply_button.visible = false;
transaction_infobox.visible = true;
}
void on_start_transaction () {
- transaction_infos_cancel_button.visible = false;
- transaction_infos_apply_button.visible = false;
+ cancel_button.visible = false;
+ apply_button.visible = false;
}
void on_emit_action (string action) {
@@ -1546,8 +1526,8 @@ namespace Pamac {
refreshing = false;
} else {
transaction_running = false;
- transaction_infos_cancel_button.visible = true;
- transaction_infos_apply_button.visible = true;
+ cancel_button.visible = true;
+ apply_button.visible = true;
}
set_pendings_operations ();
}
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index 7beb3c3..04f8cb6 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -62,7 +62,7 @@ namespace Pamac {
uint64 previous_refresh_period;
public PreferencesDialog (Transaction transaction) {
- Object (transient_for: transaction.application_window, use_header_bar: 0);
+ Object (transient_for: transaction.application_window, use_header_bar: 1);
this.transaction = transaction;
refresh_period_label.set_markup (dgettext (null, "How often to check for updates, value in hours") +":");
diff --git a/src/progress_dialog.vala b/src/progress_dialog.vala
index b59d2ac..fe93b1d 100644
--- a/src/progress_dialog.vala
+++ b/src/progress_dialog.vala
@@ -37,7 +37,7 @@ namespace Pamac {
Vte.Pty pty;
public ProgressDialog (Gtk.ApplicationWindow? window) {
- Object (transient_for: window, use_header_bar: 0);
+ Object (transient_for: window, use_header_bar: 1);
//creating terminal
term = new Vte.Terminal ();
diff --git a/src/transaction.vala b/src/transaction.vala
index fdc7f9a..9e4ca6e 100644
--- a/src/transaction.vala
+++ b/src/transaction.vala
@@ -17,6 +17,8 @@
* along with this program. If not, see .
*/
+const string VERSION = "4.0.0";
+
namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
interface Daemon : Object {
@@ -141,10 +143,10 @@ namespace Pamac {
uint64 rates_nb;
Timer timer;
bool success;
+ StringBuilder dialog_textbuffer;
//dialogs
TransactionSumDialog transaction_sum_dialog;
- TransactionInfoDialog transaction_info_dialog;
ProgressDialog progress_dialog;
//parent window
public Gtk.ApplicationWindow? application_window { get; private set; }
@@ -180,10 +182,8 @@ namespace Pamac {
//creating dialogs
this.application_window = application_window;
transaction_sum_dialog = new TransactionSumDialog (application_window);
- transaction_info_dialog = new TransactionInfoDialog (application_window);
progress_dialog = new ProgressDialog (application_window);
progress_dialog.close_button.clicked.connect (hide_progress);
- progress_dialog.delete_event.connect (progress_dialog.hide_on_delete);
progress_dialog.cancel_button.clicked.connect (on_progress_dialog_cancel_button_clicked);
// connect to child_exited signal which will only be emit after a call to watch_child
progress_dialog.term.child_exited.connect (on_term_child_exited);
@@ -193,6 +193,38 @@ namespace Pamac {
sysupgrade_after_trans = false;
timer = new Timer ();
success = false;
+ dialog_textbuffer = new StringBuilder ();
+ }
+
+ public void run_history_dialog () {
+ var file = GLib.File.new_for_path ("/var/log/pamac.log");
+ if (!file.query_exists ()) {
+ GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
+ } else {
+ StringBuilder text = new StringBuilder ();
+ try {
+ // Open file for reading and wrap returned FileInputStream into a
+ // DataInputStream, so we can read line by line
+ var dis = new DataInputStream (file.read ());
+ string line;
+ // Read lines until end of file (null) is reached
+ while ((line = dis.read_line ()) != null) {
+ // construct text in reverse order
+ text.prepend (line + "\n");
+ }
+ } catch (GLib.Error e) {
+ GLib.stderr.printf ("%s\n", e.message);
+ }
+ var history_dialog = new HistoryDialog (application_window);
+ history_dialog.textview.buffer.set_text (text.str, (int) text.len);
+ history_dialog.show ();
+ history_dialog.response.connect (() => {
+ history_dialog.destroy ();
+ });
+ while (Gtk.events_pending ()) {
+ Gtk.main_iteration ();
+ }
+ }
}
public async void run_preferences_dialog () {
@@ -213,6 +245,18 @@ namespace Pamac {
daemon.disconnect (handler_id);
}
+ public void run_about_dialog () {
+ Gtk.show_about_dialog (
+ application_window,
+ "program_name", "Pamac",
+ "logo_icon_name", "system-software-install",
+ "comments", dgettext (null, "A Gtk3 frontend for libalpm"),
+ "copyright", "Copyright © 2016 Guillaume Benoit",
+ "version", VERSION,
+ "license_type", Gtk.License.GPL_3_0,
+ "website", "http://manjaro.org");
+ }
+
public ErrorInfos get_current_error () {
try {
return daemon.get_current_error ();
@@ -304,12 +348,6 @@ namespace Pamac {
string action = dgettext (null, "Synchronizing package databases") + "...";
reset_progress_dialog (action);
emit_action (action);
- if (mode != Mode.MANAGER) {
- progress_dialog.show ();
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
- }
- }
try {
daemon.refresh_finished.connect (on_refresh_finished);
daemon.start_refresh (force);
@@ -637,12 +675,6 @@ namespace Pamac {
success = false;
}
if (success) {
- if (mode != Mode.MANAGER) {
- progress_dialog.show ();
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
- }
- }
try {
daemon.start_trans_prepare ();
} catch (IOError e) {
@@ -718,12 +750,6 @@ namespace Pamac {
string action = dgettext (null, "Preparing") + "...";
reset_progress_dialog (action);
emit_action (action);
- if (mode != Mode.MANAGER) {
- progress_dialog.show ();
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
- }
- }
// run
if (to_install.length == 0
&& to_remove.length == 0
@@ -791,16 +817,36 @@ namespace Pamac {
void choose_provider (string depend, string[] providers) {
var choose_provider_dialog = new ChooseProviderDialog (application_window);
- choose_provider_dialog.label.set_markup ("%s".printf (dgettext (null, "Choose a provider for %s").printf (depend)));
+ choose_provider_dialog.title = dgettext (null, "Choose a provider for %s").printf (depend);
+ unowned Gtk.Box box = choose_provider_dialog.get_content_area ();
+ Gtk.RadioButton? last_radiobutton = null;
+ Gtk.RadioButton? first_radiobutton = null;
foreach (unowned string provider in providers) {
- choose_provider_dialog.comboboxtext.append_text (provider);
+ var radiobutton = new Gtk.RadioButton.with_label_from_widget (last_radiobutton, provider);
+ radiobutton.visible = true;
+ // active first provider
+ if (last_radiobutton == null) {
+ radiobutton.active = true;
+ first_radiobutton = radiobutton;
+ }
+ last_radiobutton = radiobutton;
+ box.add (radiobutton);
}
- choose_provider_dialog.comboboxtext.active = 0;
choose_provider_dialog.run ();
- try {
- daemon.choose_provider (choose_provider_dialog.comboboxtext.active);
- } catch (IOError e) {
- stderr.printf ("IOError: %s\n", e.message);
+ // get active provider
+ int index = 0;
+ // list is given in reverse order so reverse it !
+ SList list = last_radiobutton.get_group ().copy ();
+ list.reverse ();
+ foreach (var radiobutton in list) {
+ if (radiobutton.active) {
+ try {
+ daemon.choose_provider (index);
+ } catch (IOError e) {
+ stderr.printf ("IOError: %s\n", e.message);
+ }
+ }
+ index++;
}
choose_provider_dialog.destroy ();
while (Gtk.events_pending ()) {
@@ -814,7 +860,6 @@ namespace Pamac {
uint64 dsize = 0;
transaction_summary.remove_all ();
var summary = TransactionSummary ();
- transaction_sum_dialog.top_label.set_markup ("%s".printf (dgettext (null, "Transaction Summary")));
transaction_sum_dialog.sum_list.clear ();
try {
summary = daemon.get_transaction_summary ();
@@ -908,10 +953,10 @@ namespace Pamac {
}
}
if (dsize == 0) {
- transaction_sum_dialog.bottom_label.visible = false;
+ transaction_sum_dialog.top_label.visible = false;
} else {
- transaction_sum_dialog.bottom_label.set_markup ("%s: %s".printf (dgettext (null, "Total download size"), format_size (dsize)));
- transaction_sum_dialog.bottom_label.visible = true;
+ transaction_sum_dialog.top_label.set_markup ("%s: %s".printf (dgettext (null, "Total download size"), format_size (dsize)));
+ transaction_sum_dialog.top_label.visible = true;
}
return type;
}
@@ -970,11 +1015,7 @@ namespace Pamac {
progress_dialog.hide ();
progress_dialog.spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_dialog.expander.expanded = false;
- Gtk.TextIter start_iter;
- Gtk.TextIter end_iter;
- transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
+ dialog_textbuffer = new StringBuilder ();
}
public void release () {
@@ -1097,10 +1138,7 @@ namespace Pamac {
break;
case 33: //Alpm.Event.Type.OPTDEP_REMOVAL
detailed_action = dgettext (null, "%s optionally requires %s").printf (details[0], details[1]);
- Gtk.TextIter end_iter;
- string msg = detailed_action + "\n";
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length);
+ dialog_textbuffer.append (detailed_action + "\n");
break;
case 34: //Alpm.Event.Type.DATABASE_MISSING
detailed_action = dgettext (null, "Database file for %s does not exist").printf (details[0]);
@@ -1312,7 +1350,6 @@ namespace Pamac {
void on_emit_log (uint level, string msg) {
// msg ends with \n
string? line = null;
- Gtk.TextIter end_iter;
if (level == 1) { //Alpm.LogLevel.ERROR
if (previous_filename != "") {
line = dgettext (null, "Error") + ": " + previous_filename + ": " + msg;
@@ -1327,65 +1364,60 @@ namespace Pamac {
} else {
line = dgettext (null, "Warning") + ": " + msg;
}
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length);
+ dialog_textbuffer.append (msg);
}
}
if (line != null) {
- display_error (line, {});
+ progress_dialog.spawn_in_term ({"echo", "-n", line});
}
}
void show_warnings () {
- if (transaction_info_dialog.textbuffer.text != "") {
- transaction_info_dialog.title = dgettext (null, "Warning");
- transaction_info_dialog.label.visible = false;
- transaction_info_dialog.expander.visible = true;
- transaction_info_dialog.expander.expanded = true;
- transaction_info_dialog.run ();
- transaction_info_dialog.hide ();
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
- }
- Gtk.TextIter start_iter;
- Gtk.TextIter end_iter;
- transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
+ if (dialog_textbuffer.len > 0) {
+ var dialog = new Gtk.Dialog.with_buttons (dgettext (null, "Warning"),
+ application_window,
+ Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR);
+ dialog.deletable = false;
+ unowned Gtk.Widget widget = dialog.add_button (dgettext (null, "_Close"), Gtk.ResponseType.CLOSE);
+ widget.can_focus = true;
+ widget.has_focus = true;
+ widget.can_default = true;
+ widget.has_default = true;
+ var scrolledwindow = new Gtk.ScrolledWindow (null, null);
+ var label = new Gtk.Label (dialog_textbuffer.str);
+ label.margin = 12;
+ scrolledwindow.visible = true;
+ label.visible = true;
+ scrolledwindow.add (label);
+ scrolledwindow.expand = true;
+ unowned Gtk.Box box = dialog.get_content_area ();
+ box.add (scrolledwindow);
+ dialog.default_width = 600;
+ dialog.default_height = 300;
+ dialog.run ();
+ dialog.destroy ();
+ dialog_textbuffer = new StringBuilder ();
}
}
void display_error (string message, string[] details) {
progress_dialog.spawn_in_term ({"echo", "-n", message});
- Gtk.TextIter start_iter;
- Gtk.TextIter end_iter;
- transaction_info_dialog.title = dgettext (null, "Error");
- transaction_info_dialog.label.visible = true;
- transaction_info_dialog.label.label = message;
+ var dialog = new Gtk.MessageDialog (application_window,
+ Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
+ message);
if (details.length != 0) {
- transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
- transaction_info_dialog.expander.visible = true;
- transaction_info_dialog.expander.expanded = true;
+ var textbuffer = new StringBuilder ();
progress_dialog.spawn_in_term ({"echo", ":"});
foreach (unowned string detail in details) {
progress_dialog.spawn_in_term ({"echo", detail});
- string str = detail + "\n";
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.insert (ref end_iter, str, str.length);
+ textbuffer.append (detail + "\n");
}
- } else {
- transaction_info_dialog.expander.visible = false;
- }
- transaction_info_dialog.run ();
- transaction_info_dialog.hide ();
- transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
- transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
- transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
- while (Gtk.events_pending ()) {
- Gtk.main_iteration ();
+ dialog.secondary_text = textbuffer.str;
}
+ dialog.run ();
+ dialog.destroy ();
}
void handle_error (ErrorInfos error) {
diff --git a/src/transaction_info_dialog.vala b/src/transaction_info_dialog.vala
deleted file mode 100644
index 3a33df5..0000000
--- a/src/transaction_info_dialog.vala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * pamac-vala
- *
- * Copyright (C) 2014-2016 Guillaume Benoit
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 get of the GNU General Public License
- * along with this program. If not, see .
- */
-
-namespace Pamac {
-
- [GtkTemplate (ui = "/org/manjaro/pamac/transaction/transaction_info_dialog.ui")]
- class TransactionInfoDialog : Gtk.Dialog {
-
- [GtkChild]
- public Gtk.Label label;
- [GtkChild]
- public Gtk.Expander expander;
- [GtkChild]
- Gtk.TextView textview;
-
- public Gtk.TextBuffer textbuffer;
-
- public TransactionInfoDialog (Gtk.ApplicationWindow? window) {
- Object (transient_for: window, use_header_bar: 0);
-
- textbuffer = textview.get_buffer ();
- }
- }
-}
diff --git a/src/transaction_sum_dialog.vala b/src/transaction_sum_dialog.vala
index cef4797..2ebf303 100644
--- a/src/transaction_sum_dialog.vala
+++ b/src/transaction_sum_dialog.vala
@@ -25,14 +25,12 @@ namespace Pamac {
[GtkChild]
public Gtk.Label top_label;
[GtkChild]
- public Gtk.Label bottom_label;
- [GtkChild]
Gtk.TreeView treeview;
public Gtk.ListStore sum_list;
public TransactionSumDialog (Gtk.ApplicationWindow? window) {
- Object (transient_for: window, use_header_bar: 0);
+ Object (transient_for: window, use_header_bar: 1);
sum_list = new Gtk.ListStore (4, typeof (string), typeof (string), typeof (string), typeof (string));
treeview.set_model (sum_list);
diff --git a/src/updater_window.vala b/src/updater_window.vala
index b1a2bd4..1eeebc9 100644
--- a/src/updater_window.vala
+++ b/src/updater_window.vala
@@ -23,7 +23,7 @@ namespace Pamac {
class UpdaterWindow : Gtk.ApplicationWindow {
[GtkChild]
- Gtk.Label top_label;
+ Gtk.HeaderBar headerbar;
[GtkChild]
Gtk.StackSwitcher stackswitcher;
[GtkChild]
@@ -41,7 +41,15 @@ namespace Pamac {
[GtkChild]
Gtk.Label bottom_label;
[GtkChild]
+ Gtk.Box transaction_infobox;
+ [GtkChild]
+ Gtk.Label transaction_infos_label;
+ [GtkChild]
+ Gtk.Button details_button;
+ [GtkChild]
Gtk.Button apply_button;
+ [GtkChild]
+ Gtk.Button cancel_button;
Gtk.ListStore repos_updates_list;
Gtk.ListStore aur_updates_list;
@@ -52,7 +60,10 @@ namespace Pamac {
Object (application: application);
bottom_label.visible = false;
- apply_button.sensitive = false;
+ apply_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
+ details_button.visible = false;
+ cancel_button.visible = false;
+ transaction_infobox.visible = false;
stackswitcher.visible = false;
aur_scrolledwindow.visible = false;
@@ -69,6 +80,8 @@ namespace Pamac {
transaction = new Transaction (this as Gtk.ApplicationWindow);
transaction.mode = Mode.UPDATER;
+ transaction.start_transaction.connect (on_start_transaction);
+ transaction.emit_action.connect (on_emit_action);
transaction.finished.connect (populate_updates_list);
transaction.get_updates_finished.connect (on_get_updates_finished);
@@ -77,23 +90,23 @@ namespace Pamac {
return false;
}
- void set_apply_button_sensitive () {
- bool sensitive = false;
+ void set_transaction_infobox_visible () {
+ bool visible = false;
repos_updates_list.foreach ((model, path, iter) => {
bool selected;
repos_updates_list.get (iter, 0, out selected);
- sensitive = selected;
- return sensitive;
+ visible = selected;
+ return visible;
});
- if (!sensitive) {
+ if (!visible) {
aur_updates_list.foreach ((model, path, iter) => {
bool selected;
aur_updates_list.get (iter, 0, out selected);
- sensitive = selected;
- return sensitive;
+ visible = selected;
+ return visible;
});
}
- apply_button.sensitive = sensitive;
+ transaction_infobox.visible = visible;
}
[GtkCallback]
@@ -110,7 +123,7 @@ namespace Pamac {
repos_updates_list.set (iter, 0, true);
transaction.temporary_ignorepkgs.remove (pkgname);
}
- set_apply_button_sensitive ();
+ set_transaction_infobox_visible ();
}
[GtkCallback]
@@ -127,7 +140,7 @@ namespace Pamac {
aur_updates_list.set (iter, 0, true);
transaction.temporary_ignorepkgs.remove (pkgname);
}
- set_apply_button_sensitive ();
+ set_transaction_infobox_visible ();
}
[GtkCallback]
@@ -139,8 +152,9 @@ namespace Pamac {
[GtkCallback]
void on_apply_button_clicked () {
- this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
transaction.sysupgrade (false);
+ details_button.visible = true;
+ cancel_button.visible = true;
}
[GtkCallback]
@@ -150,17 +164,46 @@ namespace Pamac {
}
[GtkCallback]
- void on_close_button_clicked () {
- this.application.quit ();
+ void on_history_button_clicked () {
+ transaction.run_history_dialog ();
+ }
+
+ [GtkCallback]
+ void on_about_button_clicked () {
+ transaction.run_about_dialog ();
+ }
+
+ [GtkCallback]
+ void on_details_button_clicked () {
+ transaction.show_progress ();
+ }
+
+ [GtkCallback]
+ void on_cancel_button_clicked () {
+ transaction.cancel ();
+ }
+
+ void on_start_transaction () {
+ cancel_button.visible = false;
+ apply_button.visible = false;
+ }
+
+ void on_emit_action (string action) {
+ transaction_infos_label.label = action;
}
void populate_updates_list () {
+ apply_button.visible = true;
+ apply_button.grab_default ();
+ details_button.visible = false;
+ cancel_button.visible = false;
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
+ transaction_infos_label.label = "";
transaction.start_get_updates ();
}
void on_get_updates_finished (Updates updates) {
- top_label.set_markup ("");
+ headerbar.title = "";
repos_updates_list.clear ();
stackswitcher.visible = false;
repos_scrolledwindow.visible = true;
@@ -192,11 +235,11 @@ namespace Pamac {
}
uint updates_nb = repos_updates_nb + aur_updates_nb;
if (updates_nb == 0) {
- top_label.set_markup("%s".printf (dgettext (null, "Your system is up-to-date")));
+ headerbar.title = dgettext (null, "Your system is up-to-date");
} else {
- top_label.set_markup("%s".printf (dngettext (null, "%u available update", "%u available updates", updates_nb).printf (updates_nb)));
+ headerbar.title = dngettext (null, "%u available update", "%u available updates", updates_nb).printf (updates_nb);
}
- set_apply_button_sensitive ();
+ set_transaction_infobox_visible ();
if (dsize != 0) {
bottom_label.set_markup("%s: %s".printf (dgettext (null, "Total download size"), format_size(dsize)));
bottom_label.visible = true;