Browse Source

v3.0.0

tags/v5.1.2
guinux 3 years ago
parent
commit
00553e5e58
30 changed files with 3041 additions and 2381 deletions
  1. +63
    -52
      po/pamac.pot
  2. +235
    -103
      resources/manager_window.ui
  3. +1
    -2
      resources/progress_dialog.ui
  4. +115
    -37
      resources/updater_window.ui
  5. +16
    -19
      src/Makefile
  6. +180
    -130
      src/alpm_config.vala
  7. +11
    -48
      src/alpm_utils.vala
  8. +271
    -0
      src/aur_model.vala
  9. +4
    -22
      src/choose_dep_dialog.vala
  10. +5
    -23
      src/choose_ignorepkgs_dialog.vala
  11. +1
    -7
      src/choose_provider_dialog.vala
  12. +3
    -8
      src/common.vala
  13. +338
    -608
      src/daemon.vala
  14. +6
    -7
      src/installer.vala
  15. +2
    -3
      src/manager.vala
  16. +833
    -380
      src/manager_window.vala
  17. +28
    -30
      src/mirrors_config.vala
  18. +8
    -13
      src/package.vala
  19. +67
    -100
      src/packages_model.vala
  20. +100
    -76
      src/pamac_config.vala
  21. +46
    -33
      src/preferences_dialog.vala
  22. +1
    -15
      src/progress_dialog.vala
  23. +5
    -6
      src/refresh.vala
  24. +366
    -451
      src/transaction.vala
  25. +76
    -45
      src/tray.vala
  26. +2
    -2
      src/updater.vala
  27. +125
    -66
      src/updater_window.vala
  28. +26
    -37
      util/alpm-util.c
  29. +7
    -10
      util/alpm-util.h
  30. +100
    -48
      vapi/libalpm.vapi

+ 63
- 52
po/pamac.pot View File

@@ -21,8 +21,7 @@ msgstr ""
msgid "Authentication is required"
msgstr ""


#: ../src/daemon.vala
#: ../src/daemon.vala ../src/manager_window.vala ../src/preferences_dialog.vala
msgid "Failed to initialize alpm library"
msgstr ""

@@ -30,14 +29,6 @@ msgstr ""
msgid "Failed to synchronize any databases"
msgstr ""

#: ../src/daemon.vala
msgid "No"
msgstr ""

#: ../src/daemon.vala
msgid "Yes"
msgstr ""

#: ../src/daemon.vala
msgid "Failed to init transaction"
msgstr ""
@@ -90,7 +81,7 @@ msgstr ""
msgid "%s is invalid or corrupted"
msgstr ""

#: ../src/daemon.vala
#: ../src/daemon.vala ../src/transaction.vala
msgid "Authentication failed"
msgstr ""

@@ -110,6 +101,11 @@ msgstr ""
msgid "Preparing"
msgstr ""

#: ../src/transaction.vala
#, c-format
msgid "Choose a provider for %s"
msgstr ""

#: ../src/transaction.vala ../resources/transaction_sum_dialog.ui
msgid "Transaction Summary"
msgstr ""
@@ -146,6 +142,14 @@ msgstr ""
msgid "Building packages"
msgstr ""

#: ../src/transaction.vala
msgid "Running pre-transaction hooks"
msgstr ""

#: ../src/transaction.vala
msgid "Running post-transaction hooks"
msgstr ""

#: ../src/transaction.vala
msgid "Checking dependencies"
msgstr ""
@@ -259,19 +263,26 @@ msgstr ""

#: ../src/transaction.vala
#, c-format
msgid "%s installed as %s.pacorig"
msgid "Refreshing %s"
msgstr ""

#: ../src/transaction.vala
#, c-format
msgid "Refreshing %s"
msgid "Downloading %s"
msgstr ""

#: ../src/transaction.vala
#, c-format
msgid "Downloading %s"
msgid "About %u seconds remaining"
msgstr ""

#: ../src/transaction.vala
#, c-format
msgid "About %lu minute remaining"
msgid_plural "About %lu minutes remaining"
msgstr[0] ""
msgstr[1] ""

#: ../src/transaction.vala
msgid "Warning"
msgstr ""
@@ -281,7 +292,7 @@ msgstr ""
msgid "Error"
msgstr ""

#: ../src/transaction.vala ../src/progress_dialog.vala
#: ../src/transaction.vala
msgid "Transaction cancelled"
msgstr ""

@@ -324,22 +335,6 @@ msgstr[1] ""
msgid "Show available updates"
msgstr ""

#: ../src/choose_provider_dialog.vala
#, c-format
msgid "Choose a provider for %s"
msgstr ""

#: ../src/choose_dep_dialog.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] ""

#: ../src/manager_window.vala
msgid "Deselect"
msgstr ""
@@ -380,6 +375,10 @@ msgstr ""
msgid "Licenses"
msgstr ""

#: ../src/manager_window.vala
msgid "Unknown"
msgstr ""

#: ../src/manager_window.vala
msgid "Depends On"
msgstr ""
@@ -417,65 +416,76 @@ msgid "Groups"
msgstr ""

#: ../src/manager_window.vala
msgid "Maintainer"
msgid "Packager"
msgstr ""

#: ../src/manager_window.vala
msgid "First Submitted"
msgid "Build Date"
msgstr ""

#: ../src/manager_window.vala
msgid "Last Modified"
msgid "Install Date"
msgstr ""

#: ../src/manager_window.vala
msgid "Packager"
msgid "Explicitly installed"
msgstr ""

#: ../src/manager_window.vala
msgid "Build Date"
msgid "Installed as a dependency for another package"
msgstr ""

#: ../src/manager_window.vala
msgid "Install Date"
msgid "Install Reason"
msgstr ""

#: ../src/manager_window.vala
msgid "Explicitly installed"
msgid "Yes"
msgstr ""

#: ../src/manager_window.vala
msgid "Installed as a dependency for another package"
msgid "No"
msgstr ""

#: ../src/manager_window.vala
msgid "Unknown"
msgid "Signatures"
msgstr ""

#: ../src/manager_window.vala
msgid "Install Reason"
msgid "Backup files"
msgstr ""

#: ../src/manager_window.vala
msgid "Signatures"
msgid "Maintainer"
msgstr ""

#: ../src/manager_window.vala
msgid "Votes"
msgid "First Submitted"
msgstr ""

#: ../src/manager_window.vala
msgid "Out of Date"
msgid "Last Modified"
msgstr ""

#: ../src/manager_window.vala
msgid "Backup files"
#: ../src/manager_window.vala ../resources/manager_window.ui
msgid "Votes"
msgstr ""

#: ../src/manager_window.vala
msgid "No package found"
msgid "Out of Date"
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] ""

#: ../src/manager_window.vala
msgid "Uninstalled"
msgstr ""
@@ -595,7 +605,7 @@ msgstr ""
msgid "State"
msgstr ""

#: ../resources/manager_window.ui
#: ../resources/manager_window.ui ../resources/updater_window.ui
msgid "Repositories"
msgstr ""

@@ -611,6 +621,11 @@ msgstr ""
msgid "Size"
msgstr ""

#: ../resources/manager_window.ui ../resources/updater_window.ui
#: ../resources/preferences_dialog.ui
msgid "AUR"
msgstr ""

#: ../resources/manager_window.ui
msgid "Description"
msgstr ""
@@ -708,10 +723,6 @@ msgstr ""
msgid "Do not ask for confirmation when building packages"
msgstr ""

#: ../resources/preferences_dialog.ui
msgid "AUR"
msgstr ""

#: ../resources/choose_ignorepkgs_dialog.ui
msgid "Choose Ignored Upgrades"
msgstr ""

+ 235
- 103
resources/manager_window.ui View File

@@ -207,8 +207,8 @@
<object class="GtkLabel" id="search_aur_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="margin_start">6</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Search in AUR</property>
<property name="xalign">0</property>
</object>
@@ -437,117 +437,242 @@
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow6">
<property name="width_request">500</property>
<property name="height_request">200</property>
<object class="GtkNotebook" id="packages_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<signal name="switch-page" handler="on_packages_notebook_switch_page" after="yes" swapped="no"/>
<child>
<object class="GtkTreeView" id="packages_treeview">
<object class="GtkScrolledWindow" id="packages_scrolledwindow">
<property name="width_request">500</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<signal name="button-press-event" handler="on_packages_treeview_button_press_event" swapped="no"/>
<signal name="row-activated" handler="on_packages_treeview_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="packages_treeview_selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_packages_treeview_selection_changed" swapped="no"/>
</object>
</child>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeViewColumn" id="state_column">
<property name="resizable">True</property>
<property name="fixed_width">40</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">State</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_state_column_clicked" swapped="no"/>
<object class="GtkTreeView" id="packages_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<signal name="button-press-event" handler="on_packages_treeview_button_press_event" swapped="no"/>
<signal name="row-activated" handler="on_packages_treeview_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_packages_treeview_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="state_rendererpixbuf"/>
<attributes>
<attribute name="pixbuf">1</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="packages_state_column">
<property name="resizable">True</property>
<property name="fixed_width">40</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">State</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_packages_state_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf" id="packages_state_rendererpixbuf"/>
<attributes>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="name_column">
<property name="resizable">True</property>
<property name="fixed_width">150</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Name</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_name_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="name_renderertext"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="packages_name_column">
<property name="resizable">True</property>
<property name="fixed_width">150</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Name</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_packages_name_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="packages_name_renderertext"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="version_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Version</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_version_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="version_renderertext"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="packages_version_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Version</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_packages_version_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="packages_version_renderertext"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="repo_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Repository</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_repo_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="repo_renderertext"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="packages_repo_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Repository</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_packages_repo_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="packages_repo_renderertext"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="packages_size_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Size</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_packages_size_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="packages_size_renderertext"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Repositories</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="aur_scrolledwindow">
<property name="width_request">500</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeViewColumn" id="size_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Size</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_size_column_clicked" swapped="no"/>
<object class="GtkTreeView" id="aur_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<signal name="button-press-event" handler="on_aur_treeview_button_press_event" swapped="no"/>
<signal name="row-activated" handler="on_aur_treeview_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection12">
<property name="mode">multiple</property>
<signal name="changed" handler="on_aur_treeview_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="size_renderertext"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="aur_state_column">
<property name="resizable">True</property>
<property name="fixed_width">40</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">State</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_aur_state_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf" id="aur_state_rendererpixbuf"/>
<attributes>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="aur_name_column">
<property name="resizable">True</property>
<property name="fixed_width">150</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Name</property>
<property name="expand">True</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_aur_name_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="aur_name_renderertext"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="aur_version_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Version</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_aur_version_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="aur_version_renderertext"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="aur_votes_column">
<property name="resizable">True</property>
<property name="fixed_width">90</property>
<property name="min_width">20</property>
<property name="title" translatable="yes">Votes</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_aur_votes_column_clicked" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="aur_votes_renderertext"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">AUR</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
@@ -563,11 +688,11 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<object class="GtkViewport" id="viewport2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box5">
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -575,8 +700,10 @@
<child>
<object class="GtkLabel" id="name_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -592,8 +719,10 @@
<child>
<object class="GtkLabel" id="desc_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -609,9 +738,10 @@
<child>
<object class="GtkLabel" id="link_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -626,8 +756,10 @@
<child>
<object class="GtkLabel" id="licenses_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
@@ -647,7 +779,7 @@
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Description</property>
@@ -670,7 +802,7 @@
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="deps_treeview_selection">
<object class="GtkTreeSelection" id="treeview-selection8">
<property name="mode">none</property>
</object>
</child>
@@ -678,7 +810,7 @@
<object class="GtkTreeViewColumn" id="dep_type">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext12">
<object class="GtkCellRendererText" id="cellrenderertext3">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
@@ -692,7 +824,7 @@
<object class="GtkTreeViewColumn" id="deps">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext13"/>
<object class="GtkCellRendererText" id="cellrenderertext5"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
@@ -707,7 +839,7 @@
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label2">
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dependencies</property>
@@ -732,7 +864,7 @@
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection6">
<object class="GtkTreeSelection" id="treeview-selection10">
<property name="mode">none</property>
</object>
</child>
@@ -740,7 +872,7 @@
<object class="GtkTreeViewColumn" id="infotype">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1">
<object class="GtkCellRendererText" id="cellrenderertext6">
<property name="yalign">0</property>
<property name="weight">600</property>
<property name="wrap_mode">word</property>
@@ -752,10 +884,10 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="type">
<object class="GtkTreeViewColumn" id="info">
<property name="sizing">autosize</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext4">
<object class="GtkCellRendererText" id="cellrenderertext7">
<property name="wrap_mode">word</property>
</object>
<attributes>
@@ -772,7 +904,7 @@
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label3">
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Details</property>
@@ -824,7 +956,7 @@
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>

+ 1
- 2
resources/progress_dialog.ui View File

@@ -6,7 +6,7 @@
<property name="title" translatable="yes">Progress</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">500</property>
<property name="width_request">500</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
@@ -29,7 +29,6 @@
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>

+ 115
- 37
resources/updater_window.ui View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="PamacUpdaterWindow" parent="GtkApplicationWindow">
@@ -30,64 +30,142 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width_request">400</property>
<property name="height_request">400</property>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="updates_treeview">
<object class="GtkScrolledWindow" id="repos_scrolledwindow">
<property name="width_request">400</property>
<property name="height_request">400</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<object class="GtkTreeView" id="repos_updates_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkCellRendererToggle" id="select_update">
<signal name="toggled" handler="on_select_update_toggled" swapped="no"/>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<child>
<object class="GtkCellRendererToggle" id="repos_select_update">
<signal name="toggled" handler="on_repos_select_update_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="update_name"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="repos_update_name"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<child>
<object class="GtkCellRendererText" id="repos_update_download_size"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Repositories</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="aur_scrolledwindow">
<property name="width_request">400</property>
<property name="height_request">400</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<object class="GtkTreeView" id="aur_updates_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<property name="mode">none</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="download_size"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<child>
<object class="GtkCellRendererToggle" id="aur_select_update">
<signal name="toggled" handler="on_aur_select_update_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="aur_update_name"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">AUR</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>

+ 16
- 19
src/Makefile View File

@@ -1,23 +1,28 @@

COMMON_VALA_FLAGS = -X -w \
COMMON_VALA_FLAGS = -g --save-temps -X -w \
--pkg=libalpm \
--pkg=gio-2.0 \
--pkg=posix \
--pkg=json-glib-1.0 \
--pkg=libsoup-2.4 \
--vapidir=../vapi \
--Xcc=-I../util \
-X -D_FILE_OFFSET_BITS=64 \
-X -DGETTEXT_PACKAGE="pamac" \
--target-glib=2.38

TRANSACTION_VALA_FLAGS = --pkg=json-glib-1.0 \
--pkg=gtk+-3.0 \
TRANSACTION_VALA_FLAGS = --pkg=gtk+-3.0 \
--pkg=gmodule-2.0 \
--pkg=gdk-3.0 \
--pkg=vte-2.91
--pkg=vte-2.91 \
-X -lm

COMMON_SOURCES = ../util/alpm-util.c \
common.vala \
pamac_config.vala \
package.vala \
alpm_config.vala \
alpm_utils.vala \
aur.vala \

TRANSACTION_SOURCES = transaction.vala \
choose_provider_dialog.vala \
@@ -44,37 +49,28 @@ pamac-refresh: pamac_config.vala refresh.vala
valac -o pamac-refresh \
-X -w \
--pkg=gio-2.0 \
--pkg=posix \
pamac_config.vala \
refresh.vala

pamac-tray: ../vapi/libalpm.vapi ../util/alpm-util.c common.vala alpm_config.vala pamac_config.vala tray.vala
pamac-tray: ../vapi/libalpm.vapi $(COMMON_SOURCES) tray.vala
valac -o pamac-tray \
$(COMMON_VALA_FLAGS) \
../util/alpm-util.c \
--pkg=posix \
--pkg=gtk+-3.0 \
--pkg=libnotify \
common.vala \
alpm_config.vala \
pamac_config.vala \
$(COMMON_SOURCES) \
tray.vala

pamac-daemon: ../vapi/libalpm.vapi ../vapi/polkit-gobject-1.vapi $(COMMON_SOURCES) mirrors_config.vala alpm_config.vala alpm_utils.vala aur.vala daemon.vala
pamac-daemon: ../vapi/libalpm.vapi ../vapi/polkit-gobject-1.vapi $(COMMON_SOURCES) mirrors_config.vala daemon.vala
valac -o pamac-daemon \
$(COMMON_VALA_FLAGS) \
--pkg=posix \
--pkg=json-glib-1.0 \
--pkg=libsoup-2.4 \
--pkg=polkit-gobject-1 \
--thread \
$(COMMON_SOURCES) \
mirrors_config.vala \
alpm_config.vala \
aur.vala \
alpm_utils.vala \
daemon.vala

pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) $(PREFERENCES_SOURCES) choose_dep_dialog.vala history_dialog.vala ../resources/manager_resources.c packages_model.vala manager_window.vala manager.vala
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) $(PREFERENCES_SOURCES) choose_dep_dialog.vala history_dialog.vala ../resources/manager_resources.c packages_model.vala aur_model.vala manager_window.vala manager.vala
valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \
$(TRANSACTION_VALA_FLAGS) \
@@ -86,6 +82,7 @@ pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) $(P
choose_dep_dialog.vala \
history_dialog.vala \
packages_model.vala \
aur_model.vala \
manager_window.vala \
manager.vala


+ 180
- 130
src/alpm_config.vala View File

@@ -1,7 +1,7 @@
/*
* pamac-vala
*
* Copyright (C) 2014-2015 Guillaume Benoit <guillaume@manjaro.org>
* Copyright (C) 2014-2016 Guillaume Benoit <guillaume@manjaro.org>
*
* 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
@@ -18,112 +18,163 @@
*/

namespace Alpm {
class Repo {
[Compact]
public class Repo {
public string name;
public Signature.Level siglevel;
public Signature.Level siglevel_mask;
public DB.Usage usage;
public string[] urls;
public GLib.List<string> urls;

public Repo (string name) {
this.name = name;
siglevel = Signature.Level.USE_DEFAULT;
usage = 0;
urls = {};
}
urls = new GLib.List<string> ();
}

public static int compare_name (Repo a, Repo b) {
return strcmp (a.name, b.name);
}

public static int search_name (Repo a, string name) {
return strcmp (a.name, name);
}

}

[Compact]
public class Config {
string conf_path;
string rootdir;
string dbpath;
string gpgdir;
string logfile;
string arch;
double deltaratio;
int usesyslog;
public string conf_path;
public string? rootdir;
public string? dbpath;
public string? logfile;
public string? gpgdir;
public string? arch;
public double deltaratio;
public int usesyslog;
public int checkspace;
Alpm.List<string> *cachedirs;
Alpm.List<string> *ignoregroups;
public Alpm.List<string> *ignorepkgs;
Alpm.List<string> *noextracts;
Alpm.List<string> *noupgrades;
public GLib.List<string> holdpkgs;
public GLib.List<string> syncfirsts;
Signature.Level defaultsiglevel;
Signature.Level localfilesiglevel;
Signature.Level remotefilesiglevel;
Repo[] repo_order;
public unowned Handle? handle;
public Alpm.List<string>? cachedirs;
public Alpm.List<string?>? hookdirs;
public Alpm.List<string>? ignoregroups;
public Alpm.List<string>? ignorepkgs;
public Alpm.List<string>? noextracts;
public Alpm.List<string>? noupgrades;
public GLib.List<string>? holdpkgs;
public GLib.List<string>? syncfirsts;
public Signature.Level siglevel;
public Signature.Level localfilesiglevel;
public Signature.Level remotefilesiglevel;
public Signature.Level siglevel_mask;
public Signature.Level localfilesiglevel_mask;
public Signature.Level remotefilesiglevel_mask;
public GLib.List<Repo> repo_order;
public Handle? handle;

public Config (string path) {
conf_path = path;
handle = null;
reload ();
}

public void reload () {
// set default options
rootdir = "/";
dbpath = "/var/lib/pacman";
gpgdir = "/etc/pacman.d/gnupg/";
logfile = "/var/log/pacman.log";
string default_cachedir = "/var/cache/pacman/pkg/";
arch = Posix.utsname().machine;
holdpkgs = new GLib.List<string> ();
syncfirsts = new GLib.List<string> ();
Alpm.List.free_all (cachedirs);
Alpm.List.free_all (ignoregroups);
Alpm.List.free_all (ignorepkgs);
Alpm.List.free_all (noextracts);
Alpm.List.free_all (noupgrades);
cachedirs = new Alpm.List<string> ();
cachedirs->add_str (default_cachedir);
ignoregroups = new Alpm.List<string> ();
ignorepkgs = new Alpm.List<string> ();
noextracts = new Alpm.List<string> ();
noupgrades = new Alpm.List<string> ();
// free internal data of alpm lists
if (cachedirs != null) {
cachedirs.free_data ();
}
if (hookdirs != null) {
hookdirs.free_data ();
}
if (ignoregroups != null) {
ignoregroups.free_data ();
}
if (ignorepkgs != null) {
ignorepkgs.free_data ();
}
if (noextracts != null) {
noextracts.free_data ();
}
if (noupgrades != null) {
noupgrades.free_data ();
}
usesyslog = 0;
checkspace = 0;
deltaratio = 0.7;
defaultsiglevel = Signature.Level.PACKAGE | Signature.Level.PACKAGE_OPTIONAL | Signature.Level.DATABASE | Signature.Level.DATABASE_OPTIONAL;
siglevel = Signature.Level.PACKAGE | Signature.Level.PACKAGE_OPTIONAL | Signature.Level.DATABASE | Signature.Level.DATABASE_OPTIONAL;
localfilesiglevel = Signature.Level.USE_DEFAULT;
remotefilesiglevel = Signature.Level.USE_DEFAULT;
repo_order = {};
repo_order = new GLib.List<Repo> ();
// parse conf file
parse_file (conf_path);
// if rootdir is set and dbpath/logfile are not
// set, then set those as well to reside under the root.
if (rootdir != null) {
if (dbpath == null) {
dbpath = Path.build_path ("/", rootdir, "var/lib/pacman/");
}
if (logfile == null) {
logfile = Path.build_path ("/", rootdir, "var/log/pacman.log");
}
} else {
rootdir = "/";
if (dbpath == null) {
dbpath = "/var/lib/pacman/";
}
if (logfile == null) {
logfile = "/var/log/pacman.log";
}
}
if (cachedirs.length == 0) {
cachedirs.add ("/var/cache/pacman/pkg/");
}
if (hookdirs.length == 0) {
hookdirs.add ("/etc/pacman.d/hooks/");
}
if (gpgdir == null) {
// gpgdir it is not relative to rootdir, even if
// rootdir is defined because it contains configuration data.
gpgdir = "/etc/pacman.d/gnupg/";
}
if (arch == null) {
arch = Posix.utsname().machine;
}
}

public void get_handle () {
Alpm.Errno error;
if (handle != null) {
Handle.release (handle);
}
handle = Handle.new (rootdir, dbpath, out error);
if (handle == null) {
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf(Alpm.strerror (error)));
return;
}
// define options
handle.gpgdir = gpgdir;
handle.logfile = logfile;
handle.gpgdir = gpgdir;
handle.arch = arch;
handle.deltaratio = deltaratio;
handle.usesyslog = usesyslog;
handle.checkspace = checkspace;
handle.defaultsiglevel = defaultsiglevel;
localfilesiglevel = merge_siglevel (defaultsiglevel, localfilesiglevel);
remotefilesiglevel = merge_siglevel (defaultsiglevel, remotefilesiglevel);
handle.defaultsiglevel = siglevel;
localfilesiglevel = merge_siglevel (siglevel, localfilesiglevel, localfilesiglevel_mask);
remotefilesiglevel = merge_siglevel (siglevel, remotefilesiglevel, remotefilesiglevel_mask);
handle.localfilesiglevel = localfilesiglevel;
handle.remotefilesiglevel = remotefilesiglevel;
handle.cachedirs = cachedirs;
// add hook directories 1-by-1 to avoid overwriting the system directory
foreach (unowned string hookdir in hookdirs) {
handle.add_hookdir (hookdir);
}
handle.ignoregroups = ignoregroups;
handle.ignorepkgs = ignorepkgs;
handle.noextracts = noextracts;
handle.noupgrades = noupgrades;
// register dbs
foreach (var repo in repo_order) {
foreach (unowned Repo repo in repo_order) {
repo.siglevel = merge_siglevel (siglevel, repo.siglevel, repo.siglevel_mask);
unowned DB db = handle.register_syncdb (repo.name, repo.siglevel);
foreach (var url in repo.urls) {
foreach (unowned string url in repo.urls) {
db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch));
}
if (repo.usage == 0) {
@@ -158,21 +209,37 @@ namespace Alpm {
current_section = line[1:-1];
if (current_section != "options") {
var repo = new Repo (current_section);
repo_order += repo;
if (repo_order.find_custom (repo, Repo.compare_name) == null) {
repo_order.append ((owned) repo);
}
}
continue;
}
splitted = line.split ("=", 2);
string key = splitted[0].strip ();
string? val = null;
if (splitted[1] != null) {
val = splitted[1].strip ();
unowned string key = splitted[0]._strip ();
unowned string? val = null;
if (splitted.length == 2) {
val = splitted[1]._strip ();
}
if (key == "Include") {
parse_file (val, current_section);
}
if (current_section == "options") {
if (key == "GPGDir") {
if (key == "RootDir") {
rootdir = val;
} else if (key == "DBPath") {
dbpath = val;
} else if (key == "CacheDir") {
foreach (unowned string dir in val.split (" ")) {
cachedirs.add (dir);
}
} else if (key == "HookDir") {
foreach (unowned string dir in val.split (" ")) {
hookdirs.add (dir);
}
} else if (key == "LogFile") {
logfile = val;
} else if (key == "GPGDir") {
gpgdir = val;
} else if (key == "LogFile") {
logfile = val;
@@ -189,53 +256,46 @@ namespace Alpm {
} else if (key == "CheckSpace") {
checkspace = 1;
} else if (key == "SigLevel") {
defaultsiglevel = define_siglevel (defaultsiglevel, val);
process_siglevel (val, ref siglevel, ref siglevel_mask);
} else if (key == "LocalFileSigLevel") {
localfilesiglevel = define_siglevel (localfilesiglevel, val);
process_siglevel (val, ref localfilesiglevel, ref localfilesiglevel_mask);
} else if (key == "RemoteFileSigLevel") {
remotefilesiglevel = define_siglevel (remotefilesiglevel, val);
process_siglevel (val, ref remotefilesiglevel, ref remotefilesiglevel_mask);
} else if (key == "HoldPkg") {
foreach (string name in val.split (" ")) {
foreach (unowned string name in val.split (" ")) {
holdpkgs.append (name);
}
} else if (key == "SyncFirst") {
foreach (string name in val.split (" ")) {
foreach (unowned string name in val.split (" ")) {
syncfirsts.append (name);
}
} else if (key == "CacheDir") {
foreach (string dir in val.split (" ")) {
cachedirs->add_str (dir);
}
} else if (key == "IgnoreGroup") {
foreach (string name in val.split (" ")) {
ignoregroups->add_str (name);
foreach (unowned string name in val.split (" ")) {
ignoregroups.add (name);
}
} else if (key == "IgnorePkg") {
foreach (string name in val.split (" ")) {
ignorepkgs->add_str (name);
foreach (unowned string name in val.split (" ")) {
ignorepkgs.add (name);
}
} else if (key == "Noextract") {
foreach (string name in val.split (" ")) {
noextracts->add_str (name);
foreach (unowned string name in val.split (" ")) {
noextracts.add (name);
}
} else if (key == "NoUpgrade") {
foreach (string name in val.split (" ")) {
noupgrades->add_str (name);
foreach (unowned string name in val.split (" ")) {
noupgrades.add (name);
}
}
} else {
foreach (var repo in repo_order) {
if (repo.name == current_section) {
if (key == "Server") {
repo.urls += val;
} else if (key == "SigLevel") {
if (repo.siglevel == Signature.Level.USE_DEFAULT) {
repo.siglevel = defaultsiglevel;
}
repo.siglevel = define_siglevel (repo.siglevel, val);
} else if (key == "Usage") {
repo.usage = define_usage (val);
}
unowned GLib.List<Repo>? found = repo_order.search (current_section, (SearchFunc) Repo.search_name);
if (found != null) {
unowned Repo repo = found.data;
if (key == "Server") {
repo.urls.append (val);
} else if (key == "SigLevel") {
process_siglevel (val, ref repo.siglevel, ref repo.siglevel_mask);
} else if (key == "Usage") {
repo.usage = define_usage (val);
}
}
}
@@ -295,7 +355,7 @@ namespace Alpm {
file.delete ();
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (string new_line in data) {
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
@@ -309,7 +369,7 @@ namespace Alpm {

public DB.Usage define_usage (string conf_string) {
DB.Usage usage = 0;
foreach (string directive in conf_string.split(" ")) {
foreach (unowned string directive in conf_string.split(" ")) {
if (directive == "Sync") {
usage |= DB.Usage.SYNC;
} else if (directive == "Search") {
@@ -325,8 +385,8 @@ namespace Alpm {
return usage;
}

public Signature.Level define_siglevel (Signature.Level default_level, string conf_string) {
foreach (string directive in conf_string.split(" ")) {
public void process_siglevel (string conf_string, ref Signature.Level siglevel, ref Signature.Level siglevel_mask) {
foreach (unowned string directive in conf_string.split(" ")) {
bool affect_package = false;
bool affect_database = false;
if ("Package" in directive) {
@@ -339,72 +399,62 @@ namespace Alpm {
}
if ("Never" in directive) {
if (affect_package) {
default_level &= ~Signature.Level.PACKAGE;
default_level |= Signature.Level.PACKAGE_SET;
siglevel &= ~Signature.Level.PACKAGE;
siglevel_mask |= Signature.Level.PACKAGE;
}
if (affect_database) {
default_level &= ~Signature.Level.DATABASE;
siglevel &= ~Signature.Level.DATABASE;
siglevel_mask |= Signature.Level.DATABASE;
}
} else if ("Optional" in directive) {
if (affect_package) {
default_level |= Signature.Level.PACKAGE;
default_level |= Signature.Level.PACKAGE_OPTIONAL;
default_level |= Signature.Level.PACKAGE_SET;
siglevel |= (Signature.Level.PACKAGE | Signature.Level.PACKAGE_OPTIONAL);
siglevel_mask |= (Signature.Level.PACKAGE | Signature.Level.PACKAGE_OPTIONAL);
}
if (affect_database) {
default_level |= Signature.Level.DATABASE;
default_level |= Signature.Level.DATABASE_OPTIONAL;
siglevel |= (Signature.Level.DATABASE | Signature.Level.DATABASE_OPTIONAL);
siglevel_mask |= (Signature.Level.DATABASE | Signature.Level.DATABASE_OPTIONAL);
}
} else if ("Required" in directive) {
if (affect_package) {
default_level |= Signature.Level.PACKAGE;
default_level &= ~Signature.Level.PACKAGE_OPTIONAL;
default_level |= Signature.Level.PACKAGE_SET;
siglevel |= Signature.Level.PACKAGE;
siglevel_mask |= Signature.Level.PACKAGE;
siglevel &= ~Signature.Level.PACKAGE_OPTIONAL;
siglevel_mask |= Signature.Level.PACKAGE_OPTIONAL;
}
if (affect_database) {
default_level |= Signature.Level.DATABASE;
default_level &= ~Signature.Level.DATABASE_OPTIONAL;
siglevel |= Signature.Level.DATABASE;
siglevel_mask |= Signature.Level.DATABASE;
siglevel &= ~Signature.Level.DATABASE_OPTIONAL;
siglevel_mask |= Signature.Level.DATABASE_OPTIONAL;
}
} else if ("TrustedOnly" in directive) {
if (affect_package) {
default_level &= ~Signature.Level.PACKAGE_MARGINAL_OK;
default_level &= ~Signature.Level.PACKAGE_UNKNOWN_OK;
default_level |= Signature.Level.PACKAGE_TRUST_SET;
siglevel &= ~(Signature.Level.PACKAGE_MARGINAL_OK | Signature.Level.PACKAGE_UNKNOWN_OK);
siglevel_mask |= (Signature.Level.PACKAGE_MARGINAL_OK | Signature.Level.PACKAGE_UNKNOWN_OK);
}
if (affect_database) {
default_level &= ~Signature.Level.DATABASE_MARGINAL_OK;
default_level &= ~Signature.Level.DATABASE_UNKNOWN_OK;
siglevel &= ~(Signature.Level.DATABASE_MARGINAL_OK | Signature.Level.DATABASE_UNKNOWN_OK);
siglevel_mask |= (Signature.Level.DATABASE_MARGINAL_OK | Signature.Level.DATABASE_UNKNOWN_OK);
}
} else if ("TrustAll" in directive) {
if (affect_package) {
default_level |= Signature.Level.PACKAGE_MARGINAL_OK;
default_level |= Signature.Level.PACKAGE_UNKNOWN_OK;
default_level |= Signature.Level.PACKAGE_TRUST_SET;
siglevel |= (Signature.Level.PACKAGE_MARGINAL_OK | Signature.Level.PACKAGE_UNKNOWN_OK);
siglevel_mask |= (Signature.Level.PACKAGE_MARGINAL_OK | Signature.Level.PACKAGE_UNKNOWN_OK);
}
if (affect_database) {
default_level |= Signature.Level.DATABASE_MARGINAL_OK;
default_level |= Signature.Level.DATABASE_UNKNOWN_OK;
siglevel |= (Signature.Level.DATABASE_MARGINAL_OK | Signature.Level.DATABASE_UNKNOWN_OK);
siglevel_mask |= (Signature.Level.DATABASE_MARGINAL_OK | Signature.Level.DATABASE_UNKNOWN_OK);
}
} else {
GLib.stderr.printf("unrecognized siglevel: %s\n", conf_string);
}
}
default_level &= ~Signature.Level.USE_DEFAULT;
return default_level;
siglevel &= ~Signature.Level.USE_DEFAULT;
}

public Signature.Level merge_siglevel (Signature.Level base_level, Signature.Level over_level) {
if ((over_level & Signature.Level.USE_DEFAULT) == 0) {
if ((over_level & Signature.Level.PACKAGE_SET) == 0) {
over_level |= base_level & Signature.Level.PACKAGE;
over_level |= base_level & Signature.Level.PACKAGE_OPTIONAL;
}
if ((over_level & Signature.Level.PACKAGE_TRUST_SET) == 0) {
over_level |= base_level & Signature.Level.PACKAGE_MARGINAL_OK;
over_level |= base_level & Signature.Level.PACKAGE_UNKNOWN_OK;
}
}
return over_level;
public Signature.Level merge_siglevel(Signature.Level sigbase, Signature.Level sigover, Signature.Level sigmask) {
return (sigmask != 0) ? (sigover & sigmask) | (sigbase & ~sigmask) : sigover;
}
}
}

+ 11
- 48
src/alpm_utils.vala View File

@@ -17,59 +17,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

public int pkgcmp (Alpm.Package pkg1, Alpm.Package pkg2) {
return strcmp (pkg1.name, pkg2.name);
public int compare_name (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return strcmp (pkg_a.name, pkg_b.name);
}

public Alpm.List<unowned Alpm.Package?> search_all_dbs (Alpm.Handle handle, Alpm.List<string?> needles) {
var syncpkgs = new Alpm.List<unowned Alpm.Package?> ();
var result = handle.localdb.search (needles);

foreach (var db in handle.syncdbs) {
if (syncpkgs.length == 0)
syncpkgs = db.search (needles);
else {
syncpkgs.join (db.search (needles).diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp));
}
}

result.join (syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp));
//result.sort ((Alpm.List.CompareFunc) pkgcmp);

return result;
public int compare_state (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return (int) (pkg_a.origin > pkg_b.origin) - (int) (pkg_a.origin < pkg_b.origin);
}

public Alpm.List<unowned Alpm.Package?> group_pkgs (Alpm.Handle handle, string grp_name) {
var result = new Alpm.List<unowned Alpm.Package?> ();

unowned Alpm.Group? grp = handle.localdb.get_group (grp_name);
if (grp != null) {
foreach (var pkg in grp.packages)
result.add (pkg);
}

result.join (Alpm.find_group_pkgs (handle.syncdbs, grp_name).diff (result, (Alpm.List.CompareFunc) pkgcmp));

//result.sort ((Alpm.List.CompareFunc) pkgcmp);

return result;
public int compare_version (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return Alpm.pkg_vercmp (pkg_a.version, pkg_b.version);
}

public Alpm.List<unowned Alpm.Package?> all_pkgs (Alpm.Handle handle) {
var syncpkgs = new Alpm.List<unowned Alpm.Package?> ();
var result = new Alpm.List<unowned Alpm.Package?> ();
result = handle.localdb.pkgcache.copy ();

foreach (var db in handle.syncdbs) {
if (syncpkgs.length == 0)
syncpkgs = db.pkgcache.copy ();
else {
syncpkgs.join (db.pkgcache.diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp));
}
}

result.join (syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp));
//result.sort ((Alpm.List.CompareFunc) pkgcmp);
public int compare_repo (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return strcmp (pkg_a.db.name, pkg_b.db.name);
}

return result;
public int compare_size (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return (int) (pkg_a.isize > pkg_b.isize) - (int) (pkg_a.isize < pkg_b.isize);
}

+ 271
- 0
src/aur_model.vala View File

@@ -0,0 +1,271 @@
/*
* pamac-vala
*
* Copyright (C) 2014-2016 Guillaume Benoit <guillaume@manjaro.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/

Pamac.ManagerWindow manager_window;

// custom sort functions
public int aur_compare_name (Json.Object pkg_a, Json.Object pkg_b) {
return strcmp (pkg_a.get_string_member ("Name"), pkg_b.get_string_member ("Name"));
}

public int aur_compare_state (Json.Object pkg_a, Json.Object pkg_b) {
unowned Alpm.Package? alpm_pkg_a = manager_window.alpm_config.handle.localdb.get_pkg (pkg_a.get_string_member ("Name"));
unowned Alpm.Package? alpm_pkg_b = manager_window.alpm_config.handle.localdb.get_pkg (pkg_b.get_string_member ("Name"));
if (pkg_a != null) {
if (pkg_b != null) {
return (int) (alpm_pkg_a.origin > alpm_pkg_b.origin) - (int) (alpm_pkg_a.origin < alpm_pkg_b.origin);
} else {
return 1;
}
} else {
if (pkg_b != null) {
return -1;
} else {
return 0;
}
}
}

public int aur_compare_version (Json.Object pkg_a, Json.Object pkg_b) {
return Alpm.pkg_vercmp (pkg_a.get_string_member ("Version"), pkg_b.get_string_member ("Version"));
}

public int aur_compare_votes (Json.Object pkg_a, Json.Object pkg_b) {
return (int) (pkg_a.get_int_member ("NumVotes") > pkg_b.get_int_member ("NumVotes")) - (int) (pkg_a.get_int_member ("NumVotes") < pkg_b.get_int_member ("NumVotes"));
}

namespace Pamac {

public class AURModel : Object, Gtk.TreeModel {
private Json.Array pkgs_infos;
private GLib.List<Json.Object?> pkgs;

public AURModel (Json.Array? pkgs_infos, ManagerWindow _manager_window) {
manager_window = _manager_window;
this.pkgs_infos = pkgs_infos;
pkgs = new GLib.List<Json.Object?> ();
if (pkgs_infos != null) {
pkgs_infos.foreach_element ((array, index, node) => {
pkgs.append (node.get_object ());
});
}
}

// TreeModel interface
public Type get_column_type (int index) {
switch (index) {
case 0: // name
case 2: // version
return typeof (string);
case 3: // votes
return typeof (int64);
case 1: // icon
return typeof (Gdk.Pixbuf);
default:
return Type.INVALID;
}
}

public Gtk.TreeModelFlags get_flags () {
return Gtk.TreeModelFlags.LIST_ONLY | Gtk.TreeModelFlags.ITERS_PERSIST;
}

public void get_value (Gtk.TreeIter iter, int column, out Value val) {
unowned Json.Object? pkg_info = pkgs.nth_data (iter.stamp);
switch (column) {
case 0:
val = Value (typeof (string));
if (pkg_info == null) {
val.set_string (dgettext (null, "No package found"));
} else {
val.set_string (pkg_info.get_string_member ("Name"));
}
break;
case 1:
val = Value (typeof (Object));
if (pkg_info != null) {
unowned Alpm.Package? pkg = manager_window.alpm_config.handle.localdb.get_pkg (pkg_info.get_string_member ("Name"));
if (pkg != null) {
if (manager_window.alpm_config.holdpkgs.find_custom (pkg.name, strcmp) != null) {
val.set_object (manager_window.locked_icon);
} else if (manager_window.transaction.to_add.contains (pkg.name)) {
val.set_object (manager_window.to_reinstall_icon);
} else if (manager_window.transaction.to_remove.contains (pkg.name)) {
val.set_object (manager_window.to_remove_icon);
} else {
val.set_object (manager_window.installed_icon);
}
} else if (manager_window.transaction.to_build.contains (pkg_info.get_string_member ("Name"))) {
val.set_object (manager_window.to_install_icon);
} else {
val.set_object (manager_window.uninstalled_icon);
}
}
break;
case 2:
val = Value (typeof (string));
if (pkg_info != null) {
unowned Alpm.Package? pkg = manager_window.alpm_config.handle.localdb.get_pkg (pkg_info.get_string_member ("Name"));
if (pkg != null) {
val.set_string (pkg.version);
} else {
val.set_string (pkg_info.get_string_member ("Version"));
}
}
break;
case 3:
if (pkg_info != null) {
val = Value (typeof (int64));
val.set_int64 (pkg_info.get_int_member ("NumVotes"));
} else {
// if pkg_info is null, set val to an empty string to not display "0"
val = Value (typeof (string));
}
break;
default:
val = Value (Type.INVALID);
break;
}
}

public bool get_iter (out Gtk.TreeIter iter, Gtk.TreePath path) {;
if (path.get_depth () != 1) {
return invalid_iter (out iter);
}
iter = Gtk.TreeIter ();
int pos = path.get_indices ()[0];
iter.stamp = pos;
return true;
}

public int get_n_columns () {
// name, icon, version, votes
return 4;
}

public Gtk.TreePath? get_path (Gtk.TreeIter iter) {
return new Gtk.TreePath.from_indices (iter.stamp);
}

public int iter_n_children (Gtk.TreeIter? iter) {
return 0;
}

public bool iter_next (ref Gtk.TreeIter iter) {
int pos = (iter.stamp) + 1;
if (pos >= pkgs.length ()) {
return false;
}
iter.stamp = pos;
return true;
}

public bool iter_previous (ref Gtk.TreeIter iter) {
int pos = iter.stamp;
if (pos >= 0) {
return false;
}
iter.stamp = (--pos);
return true;
}

public bool iter_nth_child (out Gtk.TreeIter iter, Gtk.TreeIter? parent, int n) {
return invalid_iter (out iter);
}

public bool iter_children (out Gtk.TreeIter iter, Gtk.TreeIter? parent) {
return invalid_iter (out iter);
}

public bool iter_has_child (Gtk.TreeIter iter) {
return false;
}

public bool iter_parent (out Gtk.TreeIter iter, Gtk.TreeIter child) {
return invalid_iter (out iter);
}

private bool invalid_iter (out Gtk.TreeIter iter) {
iter = Gtk.TreeIter ();
iter.stamp = -1;
return false;
}

// custom get pkg function
public unowned Json.Object? get_pkg_at_path (Gtk.TreePath path) {
return pkgs.nth_data (path.get_indices ()[0]);
}

public void sort_by_name (Gtk.SortType order) {
pkgs.sort ((GLib.CompareFunc) aur_compare_name);
if (order == Gtk.SortType.DESCENDING) {
pkgs.reverse ();
}
manager_window.aur_name_column.sort_order = order;
manager_window.aur_state_column.sort_indicator = false;
manager_window.aur_name_column.sort_indicator = true;
manager_window.aur_version_column.sort_indicator = false;
manager_window.aur_votes_column.sort_indicator = false;
manager_window.sortinfo.column_number = 0;
manager_window.sortinfo.sort_type = order;
}

public void sort_by_state (Gtk.SortType order) {
pkgs.sort ((GLib.CompareFunc) aur_compare_state);
if (order == Gtk.SortType.DESCENDING) {
pkgs.reverse ();
}
manager_window.aur_state_column.sort_order = order;
manager_window.aur_state_column.sort_indicator = true;
manager_window.aur_name_column.sort_indicator = false;
manager_window.aur_version_column.sort_indicator = false;
manager_window.aur_votes_column.sort_indicator = false;
manager_window.sortinfo.column_number = 1;
manager_window.sortinfo.sort_type = order;
}

public void sort_by_version (Gtk.SortType order) {
pkgs.sort ((GLib.CompareFunc) aur_compare_version);
if (order == Gtk.SortType.DESCENDING) {
pkgs.reverse ();
}
manager_window.aur_version_column.sort_order = order;
manager_window.aur_state_column.sort_indicator = false;
manager_window.aur_name_column.sort_indicator = false;
manager_window.aur_version_column.sort_indicator = true;
manager_window.aur_votes_column.sort_indicator = false;
manager_window.sortinfo.column_number = 2;
manager_window.sortinfo.sort_type = order;
}

public void sort_by_votes (Gtk.SortType order) {
pkgs.sort ((GLib.CompareFunc) aur_compare_votes);
if (order == Gtk.SortType.DESCENDING) {
pkgs.reverse ();
}
manager_window.aur_votes_column.sort_order = order;
manager_window.aur_state_column.sort_indicator = false;
manager_window.aur_name_column.sort_indicator = false;
manager_window.aur_version_column.sort_indicator = false;
manager_window.aur_votes_column.sort_indicator = true;
manager_window.sortinfo.column_number = 3;
manager_window.sortinfo.sort_type = order;
}
}
}

+ 4
- 22
src/choose_dep_dialog.vala View File

@@ -31,38 +31,20 @@ namespace Pamac {

public Gtk.ListStore deps_list;

Transaction transaction;

public ChooseDependenciesDialog (Transaction transaction, string pkgname, Gtk.ApplicationWindow? window) {
public ChooseDependenciesDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 0);

this.transaction = transaction;

string[] optdeps = transaction.get_pkg_uninstalled_optdeps (pkgname);
label.set_markup ("<b>%s</b>".printf (
dngettext (null, "%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", optdeps.length).printf (pkgname, optdeps.length)));
deps_list = new Gtk.ListStore (3, typeof (bool), typeof (string), typeof (string));
treeview.set_model (deps_list);
Gtk.TreeIter iter;
foreach (var optdep in optdeps) {
string[] split = optdep.split (":", 2);
deps_list.insert_with_values (out iter, -1,
0, false,
1, split[0],
2, split[1]);
}
}

[GtkCallback]
void on_renderertoggle_toggled (string path) {
Gtk.TreeIter iter;
GLib.Value val;
bool selected;
GLib.Value selected;
if (deps_list.get_iter_from_string (out iter, path)) {;
deps_list.get_value (iter, 0, out val);
selected = val.get_boolean ();
deps_list.set_value (iter, 0, !selected);
deps_list.get_value (iter, 0, out selected);
deps_list.set_value (iter, 0, !((bool) selected));
}
}
}

+ 5
- 23
src/choose_ignorepkgs_dialog.vala View File

@@ -31,39 +31,21 @@ namespace Pamac {

public Gtk.ListStore pkgs_list;

Transaction transaction;

public ChooseIgnorepkgsDialog (Gtk.Window window, Transaction transaction) {
public ChooseIgnorepkgsDialog (Gtk.Window window) {
Object (transient_for: window, use_header_bar: 0);

this.transaction = transaction;

label.set_markup ("<b>%s</b>".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);
transaction.get_installed_pkgs.begin ((obj, res) => {
Pamac.Package[] pkgs = transaction.get_installed_pkgs.end (res);
Gtk.TreeIter iter;
string[] already_ignorepkgs = transaction.get_ignorepkgs ();
foreach (var pkg in pkgs) {
if (pkg.name in already_ignorepkgs) {
pkgs_list.insert_with_values (out iter, -1, 0, true, 1, pkg.name);
} else {
pkgs_list.insert_with_values (out iter, -1, 0, false, 1, pkg.name);
}
}
});
}

[GtkCallback]
void on_renderertoggle_toggled (string path) {
Gtk.TreeIter iter;
GLib.Value val;
bool selected;
if (pkgs_list.get_iter_from_string (out iter, path)) {;
pkgs_list.get_value (iter, 0, out val);
selected = val.get_boolean ();
pkgs_list.set_value (iter, 0, !selected);
GLib.Value 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));
}
}
}

+ 1
- 7
src/choose_provider_dialog.vala View File

@@ -27,14 +27,8 @@ namespace Pamac {
[GtkChild]
public Gtk.ComboBoxText comboboxtext;

public ChooseProviderDialog (string depend, string[] providers, Gtk.ApplicationWindow? window) {
public ChooseProviderDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 0);

label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s").printf (depend)));
foreach (string provider in providers) {
comboboxtext.append_text (provider);
}
comboboxtext.active = 0;
}
}
}

+ 3
- 8
src/common.vala View File

@@ -18,7 +18,7 @@
*/

namespace Pamac {
public struct UpdateInfos {
public struct PackageInfos {
public string name;
public string version;
public string db_name;
@@ -27,13 +27,8 @@ namespace Pamac {

public struct Updates {
public bool is_syncfirst;
public UpdateInfos[] repos_updates;
public UpdateInfos[] aur_updates;
public Updates () {
is_syncfirst = false;
repos_updates = {};
aur_updates = {};
}
public PackageInfos[] repos_updates;
public PackageInfos[] aur_updates;
}

public struct ErrorInfos {

+ 338
- 608
src/daemon.vala
File diff suppressed because it is too large
View File


+ 6
- 7
src/installer.vala View File

@@ -46,13 +46,13 @@ namespace Pamac {
transaction_info_dialog.hide ();
} else {
transaction = new Pamac.Transaction (null);
transaction.finished.connect (on_emit_trans_finished);
transaction.finished.connect (on_transaction_finished);
this.hold ();
}
}

public override void activate () {
if (pamac_run == false) {
if (!pamac_run) {
print ("\nError: Path(s) of tarball(s) to install is needed\n");
transaction.stop_daemon ();
this.release ();
@@ -60,10 +60,9 @@ namespace Pamac {
}

public override void open (File[] files, string hint) {
if (pamac_run == false) {
foreach (File file in files) {
string? path = file.get_path ();
transaction.to_load.add ((owned) path);
if (!pamac_run) {
foreach (unowned File file in files) {
transaction.to_load.add (file.get_path ());
}
transaction.run ();
}