Browse Source

update alpm bindings and menus

tags/v5.1.2
guinux 6 years ago
parent
commit
ebe01e5d44
30 changed files with 1058 additions and 1002 deletions
  1. +2
    -2
      files_to_translate
  2. +143
    -101
      pamac.pot
  3. +1
    -0
      pot_head
  4. +4
    -9
      resources/choose_provider_dialog.ui
  5. +2
    -5
      resources/history_dialog.ui
  6. +14
    -32
      resources/manager_window.ui
  7. +4
    -7
      resources/packages_chooser_dialog.ui
  8. +1
    -1
      resources/pamac.installer.gresource.xml
  9. +1
    -1
      resources/pamac.manager.gresource.xml
  10. +1
    -1
      resources/pamac.updater.gresource.xml
  11. +8
    -13
      resources/preferences_dialog.ui
  12. +44
    -52
      resources/progress_dialog.ui
  13. +4
    -8
      resources/transaction_info_dialog.ui
  14. +4
    -10
      resources/transaction_sum_dialog.ui
  15. +8
    -8
      resources/updater_window.ui
  16. +10
    -14
      src/Makefile
  17. +107
    -43
      src/alpm_config.vala
  18. +12
    -41
      src/common.vala
  19. +402
    -391
      src/daemon.vala
  20. +1
    -1
      src/installer.vala
  21. +62
    -54
      src/manager_window.vala
  22. +1
    -1
      src/packages_chooser_dialog.vala
  23. +5
    -5
      src/packages_model.vala
  24. +4
    -4
      src/progress_dialog.vala
  25. +153
    -154
      src/transaction.vala
  26. +9
    -12
      src/tray.vala
  27. +3
    -4
      src/updater_window.vala
  28. +4
    -0
      util/alpm-util.c
  29. +1
    -0
      util/alpm-util.h
  30. +43
    -28
      vapi/libalpm.vapi

+ 2
- 2
files_to_translate View File

@@ -1,6 +1,6 @@
resources/choose_provider_dialog.ui
resources/packages_chooser_dialog.ui
resources/progress_window.ui
resources/progress_dialog.ui
resources/history_dialog.ui
resources/transaction_info_dialog.ui
resources/transaction_sum_dialog.ui
@@ -21,6 +21,6 @@ src/preferences_dialog.vala
src/updater.vala
src/choose_provider_dialog.vala
src/manager_window.vala
src/progress_window.vala
src/progress_dialog.vala
src/updater_window.vala
src/common.vala

+ 143
- 101
pamac.pot View File

@@ -3,6 +3,7 @@
# This file is distributed under the same license as the Pamac package.
# Guillaume Benoit <guillaume@manjaro.org>, 2013-2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pamac 2.0\n"
@@ -20,19 +21,40 @@ msgstr ""
msgid "Authentication is required"
msgstr ""


#: resources/choose_provider_dialog.ui:7
msgid "Choose a Provider"
msgstr ""

#: resources/packages_chooser_dialog.ui:7 resources/manager_window.ui:789
#: resources/choose_provider_dialog.ui:23
#: resources/transaction_sum_dialog.ui:35 resources/preferences_dialog.ui:22
msgid "_OK"
msgstr ""

#: resources/packages_chooser_dialog.ui:7 resources/manager_window.ui:775
msgid "Install local packages"
msgstr ""

#: resources/progress_window.ui:16
#: resources/packages_chooser_dialog.ui:29 resources/progress_dialog.ui:29
#: resources/transaction_sum_dialog.ui:21
msgid "_Cancel"
msgstr ""

#: resources/packages_chooser_dialog.ui:42
msgid "_Open"
msgstr ""

#: resources/progress_dialog.ui:7
msgid "Progress"
msgstr ""

#: resources/progress_window.ui:63 resources/transaction_info_dialog.ui:84
#: resources/progress_dialog.ui:41 resources/history_dialog.ui:23
#: resources/transaction_info_dialog.ui:21 resources/updater_window.ui:163
#: resources/preferences_dialog.ui:36
msgid "_Close"
msgstr ""

#: resources/progress_dialog.ui:91 resources/transaction_info_dialog.ui:81
#: resources/manager_window.ui:707
msgid "Details"
msgstr ""
@@ -41,7 +63,7 @@ msgstr ""
msgid "Pamac History"
msgstr ""

#: resources/transaction_sum_dialog.ui:6 src/transaction.vala:356
#: resources/transaction_sum_dialog.ui:6 src/transaction.vala:359
msgid "Transaction Summary"
msgstr ""

@@ -50,7 +72,7 @@ msgid "Package Manager"
msgstr ""

#: resources/manager_window.ui:23
msgid "Refresh"
msgid "Refresh databases"
msgstr ""

#: resources/manager_window.ui:47
@@ -58,7 +80,7 @@ msgid "Apply changes"
msgstr ""

#: resources/manager_window.ui:71
msgid "Cancel"
msgid "Cancel all planned changes"
msgstr ""

#: resources/manager_window.ui:170
@@ -69,7 +91,7 @@ msgstr ""
msgid "Search"
msgstr ""

#: resources/manager_window.ui:279 src/manager_window.vala:336
#: resources/manager_window.ui:279 src/manager_window.vala:337
msgid "Groups"
msgstr ""

@@ -89,7 +111,7 @@ msgstr ""
msgid "Version"
msgstr ""

#: resources/manager_window.ui:463 src/manager_window.vala:328
#: resources/manager_window.ui:463 src/manager_window.vala:329
msgid "Repository"
msgstr ""

@@ -109,42 +131,58 @@ msgstr ""
msgid "Files"
msgstr ""

#: resources/manager_window.ui:779
#: resources/manager_window.ui:767
msgid "View History"
msgstr ""

#: resources/updater_window.ui:14 src/tray.vala:73 src/tray.vala:166
#: src/tray.vala:238
#: resources/manager_window.ui:783 resources/updater_window.ui:108
msgid "_Preferences"
msgstr ""

#: resources/manager_window.ui:792
msgid "_About"
msgstr ""

#: resources/updater_window.ui:14 src/tray.vala:73 src/tray.vala:163
#: src/tray.vala:235
msgid "Update Manager"
msgstr ""

#: resources/updater_window.ui:135
msgid "_Refresh"
msgstr ""

#: resources/updater_window.ui:149
msgid "_Apply"
msgstr ""

#: resources/preferences_dialog.ui:6
msgid "Pamac Preferences"
msgstr ""

#: resources/preferences_dialog.ui:74
#: resources/preferences_dialog.ui:71
msgid "Enable AUR support"
msgstr ""

#: resources/preferences_dialog.ui:87
#: resources/preferences_dialog.ui:84
msgid "Allow Pamac to search and install packages from AUR"
msgstr ""

#: resources/preferences_dialog.ui:105
#: resources/preferences_dialog.ui:102
msgid "Remove unrequired dependencies"
msgstr ""

#: resources/preferences_dialog.ui:118
#: resources/preferences_dialog.ui:115
msgid ""
"When removing a package, also remove its dependencies that are not required "
"by other packages"
msgstr ""

#: resources/preferences_dialog.ui:152 src/preferences_dialog.vala:37
#: resources/preferences_dialog.ui:149 src/preferences_dialog.vala:37
msgid "How often to check for updates, value in hours"
msgstr ""

#: resources/preferences_dialog.ui:177
#: resources/preferences_dialog.ui:173
msgid "Options"
msgstr ""

@@ -152,342 +190,346 @@ msgstr ""
msgid "Packages"
msgstr ""

#: src/daemon.vala:113 src/daemon.vala:120
#: src/daemon.vala:64
msgid "Failed to initialize alpm library"
msgstr ""

#: src/daemon.vala:112 src/daemon.vala:118
msgid "Failed to synchronize any databases"
msgstr ""

#: src/daemon.vala:162
#: src/daemon.vala:161
msgid "Failed to init transaction"
msgstr ""

#: src/daemon.vala:174 src/daemon.vala:192 src/daemon.vala:204
#: src/daemon.vala:218 src/daemon.vala:230 src/daemon.vala:245
#: src/daemon.vala:252 src/daemon.vala:266 src/daemon.vala:316
#: src/daemon.vala:173 src/daemon.vala:191 src/daemon.vala:203
#: src/daemon.vala:217 src/daemon.vala:229 src/daemon.vala:246
#: src/daemon.vala:253 src/daemon.vala:267 src/daemon.vala:317
msgid "Failed to prepare transaction"
msgstr ""

#: src/daemon.vala:193 src/daemon.vala:246
#: src/daemon.vala:192 src/daemon.vala:247
#, c-format
msgid "target not found: %s"
msgstr ""

#: src/daemon.vala:274
#: src/daemon.vala:275
#, c-format
msgid "package %s does not have a valid architecture"
msgstr ""

#: src/daemon.vala:283
#: src/daemon.vala:284
#, c-format
msgid "%s: requires %s"
msgstr ""

#: src/daemon.vala:291
#: src/daemon.vala:292
#, c-format
msgid "%s and %s are in conflict"
msgstr ""

#: src/daemon.vala:310
#: src/daemon.vala:311
#, c-format
msgid "%s needs to be removed but it is a locked package"
msgstr ""

#: src/daemon.vala:378
#: src/daemon.vala:380
msgid "Failed to commit transaction"
msgstr ""

#: src/daemon.vala:392
#: src/daemon.vala:394
#, c-format
msgid "%s exists in both %s and %s"
msgstr ""

#: src/daemon.vala:395
#: src/daemon.vala:397
#, c-format
msgid "%s: %s already exists in filesystem"
msgstr ""

#: src/daemon.vala:408
#: src/daemon.vala:410
#, c-format
msgid "%s is invalid or corrupted"
msgstr ""

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

#: src/transaction.vala:154
#: src/transaction.vala:164
msgid "Synchronizing package databases"
msgstr ""

#: src/transaction.vala:210
#: src/transaction.vala:216
msgid "Starting full system upgrade"
msgstr ""

#: src/transaction.vala:254
#: src/transaction.vala:259
msgid "Preparing"
msgstr ""

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

#: src/transaction.vala:386 src/manager_window.vala:187
#: src/transaction.vala:389 src/manager_window.vala:188
#: src/manager_window.vala:731
msgid "To remove"
msgstr ""

#: src/transaction.vala:399
#: src/transaction.vala:402
msgid "To downgrade"
msgstr ""

#: src/transaction.vala:412
#: src/transaction.vala:415
msgid "To build"
msgstr ""

#: src/transaction.vala:425 src/manager_window.vala:186
#: src/transaction.vala:428 src/manager_window.vala:187
#: src/manager_window.vala:720
msgid "To install"
msgstr ""

#: src/transaction.vala:438
#: src/transaction.vala:441
msgid "To reinstall"
msgstr ""

#: src/transaction.vala:452
#: src/transaction.vala:455
msgid "To update"
msgstr ""

#: src/transaction.vala:465 src/updater_window.vala:180
#: src/transaction.vala:468 src/updater_window.vala:179
msgid "Total download size"
msgstr ""

#: src/transaction.vala:483
#: src/transaction.vala:485
msgid "Building packages"
msgstr ""

#: src/transaction.vala:540
#: src/transaction.vala:542
msgid "Checking dependencies"
msgstr ""

#: src/transaction.vala:545
#: src/transaction.vala:547
msgid "Checking file conflicts"
msgstr ""

#: src/transaction.vala:550
#: src/transaction.vala:552
msgid "Resolving dependencies"
msgstr ""

#: src/transaction.vala:555
#: src/transaction.vala:557
msgid "Checking inter-conflicts"
msgstr ""

#: src/transaction.vala:562 src/transaction.vala:564
#: src/transaction.vala:564 src/transaction.vala:566
#, c-format
msgid "Installing %s"
msgstr ""

#: src/transaction.vala:570 src/transaction.vala:572
#: src/transaction.vala:572 src/transaction.vala:574
#, c-format
msgid "Reinstalling %s"
msgstr ""

#: src/transaction.vala:578 src/transaction.vala:580
#: src/transaction.vala:580 src/transaction.vala:582
#, c-format
msgid "Removing %s"
msgstr ""

#: src/transaction.vala:586 src/transaction.vala:588
#: src/transaction.vala:588 src/transaction.vala:590
#, c-format
msgid "Upgrading %s"
msgstr ""

#: src/transaction.vala:594 src/transaction.vala:596
#: src/transaction.vala:596 src/transaction.vala:598
#, c-format
msgid "Downgrading %s"
msgstr ""

#: src/transaction.vala:600
#: src/transaction.vala:602
msgid "Checking integrity"
msgstr ""

#: src/transaction.vala:605
#: src/transaction.vala:608
msgid "Checking keyring"
msgstr ""

#: src/transaction.vala:610
#: src/transaction.vala:613
msgid "Downloading required keys"
msgstr ""

#: src/transaction.vala:615
#: src/transaction.vala:618
msgid "Loading packages files"
msgstr ""

#: src/transaction.vala:620
#: src/transaction.vala:623
msgid "Checking delta integrity"
msgstr ""

#: src/transaction.vala:625
#: src/transaction.vala:628
msgid "Applying deltas"
msgstr ""

#: src/transaction.vala:630
#: src/transaction.vala:633
#, c-format
msgid "Generating %s with %s"
msgstr ""

#: src/transaction.vala:635
#: src/transaction.vala:638
msgid "Generation succeeded"
msgstr ""

#: src/transaction.vala:640
#: src/transaction.vala:643
msgid "Generation failed"
msgstr ""

#: src/transaction.vala:645
#: src/transaction.vala:648
#, c-format
msgid "Configuring %s"
msgstr ""

#: src/transaction.vala:650
#: src/transaction.vala:654
msgid "Downloading"
msgstr ""

#: src/transaction.vala:655
#: src/transaction.vala:659
msgid "Checking available disk space"
msgstr ""

#: src/transaction.vala:660
#: src/transaction.vala:664
#, c-format
msgid "%s optionally requires %s"
msgstr ""

#: src/transaction.vala:663
#: src/transaction.vala:667
#, c-format
msgid "Database file for %s does not exist"
msgstr ""

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

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

#: src/transaction.vala:754 src/transaction.vala:768
#: src/transaction.vala:758 src/transaction.vala:772
msgid "Warning"
msgstr ""

#: src/transaction.vala:758 src/transaction.vala:787
#: src/transaction.vala:762 src/transaction.vala:791
msgid "Error"
msgstr ""

#: src/transaction.vala:851 src/transaction.vala:866
#: src/progress_window.vala:55
#: src/transaction.vala:855 src/transaction.vala:870
#: src/progress_dialog.vala:55
msgid "Transaction cancelled"
msgstr ""

#: src/transaction.vala:877
#: src/transaction.vala:881
msgid "Nothing to do"
msgstr ""

#: src/transaction.vala:897 src/transaction.vala:913
#: src/transaction.vala:901 src/transaction.vala:917
msgid "Transaction successfully finished"
msgstr ""

#: src/tray.vala:24 src/updater_window.vala:176
#: src/tray.vala:24 src/updater_window.vala:175
#, c-format
msgid "%u available updates"
msgstr ""

#: src/tray.vala:25 src/updater_window.vala:173
#: src/tray.vala:25 src/updater_window.vala:172
msgid "1 available update"
msgstr ""

#: src/tray.vala:27 src/updater_window.vala:56 src/updater_window.vala:170
#: src/tray.vala:27 src/updater_window.vala:56 src/updater_window.vala:169
msgid "Your system is up-to-date"
msgstr ""

#: src/tray.vala:79
msgid "Quit"
msgid "_Quit"
msgstr ""

#: src/tray.vala:167
#: src/tray.vala:164
msgid "Show available updates"
msgstr ""

#: src/manager_window.vala:179 src/manager_window.vala:777
#: src/manager_window.vala:180 src/manager_window.vala:777
msgid "local"
msgstr ""

#: src/manager_window.vala:183 src/manager_window.vala:250
#: src/manager_window.vala:262 src/manager_window.vala:737
#: src/manager_window.vala:184 src/manager_window.vala:251
#: src/manager_window.vala:263 src/manager_window.vala:737
msgid "Installed"
msgstr ""

#: src/manager_window.vala:185 src/manager_window.vala:751
#: src/manager_window.vala:186 src/manager_window.vala:751
msgid "Orphans"
msgstr ""

#: src/manager_window.vala:210
#: src/manager_window.vala:211
msgid "Licenses"
msgstr ""

#: src/manager_window.vala:232
#: src/manager_window.vala:233
msgid "Depends On"
msgstr ""

#: src/manager_window.vala:252
#: src/manager_window.vala:253
msgid "Optional Dependencies"
msgstr ""

#: src/manager_window.vala:272
#: src/manager_window.vala:273
msgid "Required By"
msgstr ""

#: src/manager_window.vala:286
#: src/manager_window.vala:287
msgid "Provides"
msgstr ""

#: src/manager_window.vala:299
#: src/manager_window.vala:300
msgid "Replaces"
msgstr ""

#: src/manager_window.vala:312
#: src/manager_window.vala:313
msgid "Conflicts With"
msgstr ""

#: src/manager_window.vala:346
#: src/manager_window.vala:347
msgid "Packager"
msgstr ""

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

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

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

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

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

#: src/manager_window.vala:367
#: src/manager_window.vala:368
msgid "Signatures"
msgstr ""

#: src/manager_window.vala:375
#: src/manager_window.vala:376
msgid "Backup files"
msgstr ""

@@ -503,12 +545,12 @@ msgstr ""
msgid "A Gtk3 frontend for libalpm"
msgstr ""

#: src/common.vala:62
#: src/common.vala:48
#, c-format
msgid "%.0f KiB"
msgstr ""

#: src/common.vala:65
#: src/common.vala:51
#, c-format
msgid "%.2f MiB"
msgstr ""

+ 1
- 0
pot_head View File

@@ -3,6 +3,7 @@
# This file is distributed under the same license as the Pamac package.
# Guillaume Benoit <guillaume@manjaro.org>, 2013-2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pamac 2.0\n"


+ 4
- 9
resources/choose_provider_dialog.ui View File

@@ -19,18 +19,17 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="valid_button">
<property name="label" translatable="yes">_OK</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
@@ -38,7 +37,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -56,7 +54,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -67,20 +64,18 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">button</action-widget>
<action-widget response="-5">valid_button</action-widget>
</action-widgets>
</template>
</interface>

+ 2
- 5
resources/history_dialog.ui View File

@@ -20,17 +20,16 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
@@ -38,7 +37,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -63,7 +61,6 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>


+ 14
- 32
resources/manager_window.ui View File

@@ -20,14 +20,14 @@
<child>
<object class="GtkButton" id="refresh_button">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Refresh</property>
<property name="tooltip_text" translatable="yes">Refresh databases</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="refresh-icon">
<object class="GtkImage" id="refresh_icon">
<property name="visible">True</property>
<property name="icon-name">view-refresh-symbolic</property>
<property name="icon-size">1</property>
@@ -51,7 +51,7 @@
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="valid-icon">
<object class="GtkImage" id="valid_icon">
<property name="visible">True</property>
<property name="icon-name">emblem-ok-symbolic</property>
<property name="icon-size">1</property>
@@ -68,14 +68,14 @@
<child>
<object class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Cancel</property>
<property name="tooltip_text" translatable="yes">Cancel all planned changes</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="cancel-icon">
<object class="GtkImage" id="cancel_icon">
<property name="visible">True</property>
<property name="icon-name">edit-delete-symbolic</property>
<property name="icon-size">1</property>
@@ -106,7 +106,7 @@
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="menu-icon">
<object class="GtkImage" id="menu_icon">
<property name="visible">True</property>
<property name="icon-name">emblem-system-symbolic</property>
<property name="icon-size">1</property>
@@ -759,58 +759,40 @@
</object>
</child>
</template>
<object class="GtkImage" id="file_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
</object>
<object class="GtkImage" id="local_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">16</property>
<property name="icon_name">emblem-package</property>
</object>
<object class="GtkMenu" id="main_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="history_item">
<object class="GtkMenuItem" id="history_item">
<property name="label" translatable="yes">View History</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">file_icon</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_history_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="local_item">
<object class="GtkMenuItem" id="local_item">
<property name="label" translatable="yes">Install local packages</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">local_icon</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_local_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="preferences_item">
<property name="label">gtk-preferences</property>
<object class="GtkMenuItem" id="preferences_item">
<property name="label" translatable="yes">_Preferences</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_preferences_item_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="about_item">
<property name="label">gtk-about</property>
<object class="GtkMenuItem" id="about_item">
<property name="label" translatable="yes">_About</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_about_item_activate" swapped="no"/>
</object>
</child>


+ 4
- 7
resources/packages_chooser_dialog.ui View File

@@ -26,32 +26,30 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="package_cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="package_open_button">
<property name="label">gtk-open</property>
<property name="label" translatable="yes">_Open</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
@@ -59,7 +57,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>


+ 1
- 1
resources/pamac.installer.gresource.xml View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/manjaro/pamac/transaction">
<file preprocess="xml-stripblanks">progress_window.ui</file>
<file preprocess="xml-stripblanks">progress_dialog.ui</file>
<file preprocess="xml-stripblanks">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_dialog.ui</file>


+ 1
- 1
resources/pamac.manager.gresource.xml View File

@@ -15,7 +15,7 @@
<file preprocess="xml-stripblanks">preferences_dialog.ui</file>
</gresource>
<gresource prefix="/org/manjaro/pamac/transaction">
<file preprocess="xml-stripblanks">progress_window.ui</file>
<file preprocess="xml-stripblanks">progress_dialog.ui</file>
<file preprocess="xml-stripblanks">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_dialog.ui</file>


+ 1
- 1
resources/pamac.updater.gresource.xml View File

@@ -7,7 +7,7 @@
<file preprocess="xml-stripblanks">preferences_dialog.ui</file>
</gresource>
<gresource prefix="/org/manjaro/pamac/transaction">
<file preprocess="xml-stripblanks">progress_window.ui</file>
<file preprocess="xml-stripblanks">progress_dialog.ui</file>
<file preprocess="xml-stripblanks">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_dialog.ui</file>


+ 8
- 13
resources/preferences_dialog.ui View File

@@ -18,32 +18,30 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="preferences_valid_button">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="valid_button">
<property name="label" translatable="yes">_OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="preferences_close_button">
<property name="label">gtk-close</property>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
@@ -51,7 +49,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -165,7 +162,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
@@ -184,14 +180,13 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">preferences_valid_button</action-widget>
<action-widget response="-7">preferences_close_button</action-widget>
<action-widget response="-5">valid_button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</template>
<object class="GtkAdjustment" id="adjustment">


resources/progress_window.ui → resources/progress_dialog.ui View File

@@ -1,29 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="PamacProgressWindow" parent="GtkWindow">
<template class="PamacProgressDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<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="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="manager_headerbar">
<property name="visible">True</property>
<property name="title" translatable="yes">Progress</property>
<property name="show_close_button">True</property>
</object>
</child>
<child>
<object class="GtkBox" id="box8">
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">0</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="action_label">
<property name="visible">True</property>
@@ -32,7 +62,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -45,7 +74,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
@@ -67,49 +95,13 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</template>
</interface>

+ 4
- 8
resources/transaction_info_dialog.ui View File

@@ -17,18 +17,17 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
@@ -36,7 +35,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -47,7 +45,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
@@ -88,13 +85,12 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</template>
</interface>

+ 4
- 10
resources/transaction_sum_dialog.ui View File

@@ -18,31 +18,29 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="use_underline">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="valid_button">
<property name="label">gtk-ok</property>
<property name="label" translatable="yes">_OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
@@ -50,7 +48,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
@@ -61,7 +58,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
@@ -120,7 +116,6 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
@@ -131,7 +126,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>


+ 8
- 8
resources/updater_window.ui View File

@@ -105,11 +105,11 @@
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="preferences_button">
<property name="label">gtk-preferences</property>
<property name="label" translatable="yes">_Preferences</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_preferences_button_clicked" swapped="no"/>
</object>
<packing>
@@ -132,11 +132,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="refresh_button">
<property name="label">gtk-refresh</property>
<property name="label" translatable="yes">_Refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
</object>
<packing>
@@ -146,11 +146,11 @@
</child>
<child>
<object class="GtkButton" id="apply_button">
<property name="label">gtk-apply</property>
<property name="label" translatable="yes">_Apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_apply_button_clicked" swapped="no"/>
</object>
<packing>
@@ -160,11 +160,11 @@
</child>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
</object>
<packing>


+ 10
- 14
src/Makefile View File

@@ -6,6 +6,7 @@ COMMON_VALA_FLAGS = --pkg=libalpm \
--vapidir=../vapi \
--Xcc=-I../util \
-X -D_FILE_OFFSET_BITS=64 \
-X -DGETTEXT_PACKAGE="pamac" \
--target-glib=2.38

COMMON_SOURCES = ../util/alpm-util.c \
@@ -20,7 +21,7 @@ MANAGER_RESOURCES_FILES = ../resources/manager_window.ui \
../resources/packages_chooser_dialog.ui \
../resources/history_dialog.ui \
../resources/preferences_dialog.ui \
../resources/progress_window.ui \
../resources/progress_dialog.ui \
../resources/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \
../resources/transaction_info_dialog.ui \
@@ -35,14 +36,14 @@ UPDATER_GRESOURCE_FILE = ../resources/pamac.updater.gresource.xml

UPDATER_RESOURCES_FILES = ../resources/updater_window.ui \
../resources/preferences_dialog.ui \
../resources/progress_window.ui \
../resources/progress_dialog.ui \
../resources/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \
../resources/transaction_info_dialog.ui

INSTALLER_GRESOURCE_FILE = ../resources/pamac.installer.gresource.xml

INSTALLER_RESOURCES_FILES = ../resources/progress_window.ui \
INSTALLER_RESOURCES_FILES = ../resources/progress_dialog.ui \
../resources/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \
../resources/transaction_info_dialog.ui
@@ -50,23 +51,21 @@ INSTALLER_RESOURCES_FILES = ../resources/progress_window.ui \
DIALOGS_FILES = choose_provider_dialog.vala \
transaction_sum_dialog.vala \
transaction_info_dialog.vala \
progress_window.vala
progress_dialog.vala

pamac-daemon: $(COMMON_SOURCES) daemon.vala
pamac-daemon: ../vapi/libalpm.vapi ../vapi/polkit-gobject-1.vapi $(COMMON_SOURCES) daemon.vala
valac -o pamac-daemon \
$(COMMON_VALA_FLAGS) \
--pkg=polkit-gobject-1 \
-X -DGETTEXT_PACKAGE="pacman" \
--thread \
$(COMMON_SOURCES) \
daemon.vala

pamac-tray: $(COMMON_SOURCES) tray.vala
pamac-tray: ../vapi/libalpm.vapi $(COMMON_SOURCES) tray.vala
valac -o pamac-tray \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=libnotify \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \
tray.vala

@@ -79,7 +78,7 @@ updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES)
glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --sourcedir=../resources --target=installer_resources.c --generate-source

pamac-manager: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala
valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
@@ -87,7 +86,6 @@ pamac-manager: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala histor
--pkg=gdk-3.0 \
--pkg=vte-2.91 \
--gresources=$(MANAGER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \
$(DIALOGS_FILES) \
preferences_dialog.vala \
@@ -100,14 +98,13 @@ pamac-manager: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala histor
manager_window.vala \
manager.vala

pamac-updater: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala updater_resources.c transaction.vala updater_window.vala updater.vala
pamac-updater: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala updater_resources.c transaction.vala updater_window.vala updater.vala
valac -o pamac-updater \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=gmodule-2.0 \
--pkg=vte-2.91 \
--gresources=$(UPDATER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \
$(DIALOGS_FILES) \
preferences_dialog.vala \
@@ -116,14 +113,13 @@ pamac-updater: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala update
updater_window.vala \
updater.vala

pamac-install: $(COMMON_SOURCES) $(DIALOGS_FILES) installer_resources.c transaction.vala installer.vala
pamac-install: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) installer_resources.c transaction.vala installer.vala
valac -o pamac-install \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=gmodule-2.0 \
--pkg=vte-2.91 \
--gresources=$(INSTALLER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \
$(DIALOGS_FILES) \
installer_resources.c \


+ 107
- 43
src/alpm_config.vala View File

@@ -30,38 +30,103 @@ namespace Alpm {
}

public class Config {
public Handle handle;
private string[] priv_holdpkg;
private string[] priv_syncfirst;
public string[] holdpkg;
public string[] syncfirst;
SigLevel siglevel;
string rootdir;
string dbpath;
string gpgdir;
string logfile;
string arch;
double deltaratio;
int usesyslog;
int checkspace;
string[] cachedir;
string[] ignoregroup;
string[] ignorepkg;
string[] noextract;
string[] noupgrade;
string[] holdpkg;
string[] syncfirst;
SigLevel defaultsiglevel;
SigLevel localfilesiglevel;
SigLevel remotefilesiglevel;
Repo[] repo_order;

public Config (string path) {
// rootdir and dbpath are hardcoded so we parse config file only once
const string rootdir = "/";
const string dbpath = "/var/lib/pacman";
Alpm.Errno error;
handle = new Handle (rootdir, dbpath, out error);
const string gpgdir = "/etc/pacman.d/gnupg/";
const string logfile = "/var/log/pacman.log";
const string cachedir = "/var/cache/pacman/pkg/";
priv_holdpkg = {};
priv_syncfirst = {};
siglevel = SigLevel.PACKAGE | SigLevel.PACKAGE_OPTIONAL | SigLevel.DATABASE | SigLevel.DATABASE_OPTIONAL;
rootdir = "/";
dbpath = "/var/lib/pacman";
gpgdir = "/etc/pacman.d/gnupg/";
logfile = "/var/log/pacman.log";
arch = Posix.utsname().machine;
cachedir = {"/var/cache/pacman/pkg/"};
holdpkg = {};
syncfirst = {};
ignoregroup = {};
ignorepkg = {};
noextract = {};
noupgrade = {};
usesyslog = 0;
checkspace = 0;
deltaratio = 0.7;
defaultsiglevel = SigLevel.PACKAGE | SigLevel.PACKAGE_OPTIONAL | SigLevel.DATABASE | SigLevel.DATABASE_OPTIONAL;
localfilesiglevel = SigLevel.USE_DEFAULT;
remotefilesiglevel = SigLevel.USE_DEFAULT;
repo_order = {};
// parse conf file
parse_file (path);
// check essential settings
if (handle.gpgdir == null) handle.gpgdir = gpgdir;
if (handle.logfile == null) handle.logfile = logfile;
if (handle.arch == null) handle.arch = Posix.utsname().machine;
if (handle.cachedirs == null) handle.add_cachedir(cachedir);
}

public string[] get_syncfirst () {
return syncfirst;
}

public string[] get_holdpkg () {
return holdpkg;
}

public string[] get_ignore_pkgs () {
string[] ignore_pkgs = {};
unowned Group? group = null;
Handle? handle = this.get_handle ();
if (handle != null) {
foreach (string name in ignorepkg)
ignore_pkgs += name;
foreach (string grp_name in ignoregroup) {
group = handle.localdb.get_group (grp_name);
if (group != null) {
foreach (unowned Package found_pkg in group.packages)
ignore_pkgs += found_pkg.name;
}
}
}
return ignore_pkgs;
}

public Handle? get_handle () {
Alpm.Errno error;
Handle? handle = new Handle (rootdir, dbpath, out error);
if (handle == null) {
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf(Alpm.strerror (error)));
return handle;
}
// define options
handle.gpgdir = gpgdir;
handle.logfile = logfile;
handle.arch = arch;
handle.deltaratio = deltaratio;
handle.usesyslog = usesyslog;
handle.checkspace = checkspace;
handle.defaultsiglevel = defaultsiglevel;
handle.localfilesiglevel = localfilesiglevel;
handle.remotefilesiglevel = remotefilesiglevel;
foreach (string dir in cachedir)
handle.add_cachedir (dir);
foreach (string name in ignoregroup)
handle.add_ignoregroup (name);
foreach (string name in ignorepkg)
handle.add_ignorepkg (name);
foreach (string name in noextract)
handle.add_noextract (name);
foreach (string name in noupgrade)
handle.add_noupgrade (name);
// register dbs
foreach (Repo repo in repo_order) {
unowned DB db = handle.register_syncdb (repo.name, repo.siglevel);
@@ -69,6 +134,7 @@ namespace Alpm {
db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch));
}
}
return handle;
}

public void parse_file (string path, string? section = null) {
@@ -91,7 +157,7 @@ namespace Alpm {
current_section = line[1:-1];
if (current_section != "options") {
Repo repo = new Repo (current_section);
repo.siglevel = siglevel;
repo.siglevel = defaultsiglevel;
repo_order += repo;
}
continue;
@@ -105,53 +171,53 @@ namespace Alpm {
parse_file (_value, current_section);
if (current_section == "options") {
if (_key == "GPGDir")
handle.gpgdir = _value;
gpgdir = _value;
else if (_key == "LogFile")
handle.logfile = _value;
logfile = _value;
else if (_key == "Architecture") {
if (_value == "auto")
handle.arch = Posix.utsname ().machine;
arch = Posix.utsname ().machine;
else
handle.arch = _value;
arch = _value;
} else if (_key == "UseDelta")
handle.deltaratio = double.parse (_value);
deltaratio = double.parse (_value);
else if (_key == "UseSysLog")
handle.usesyslog = 1;
usesyslog = 1;
else if (_key == "CheckSpace")
handle.checkspace = 1;
checkspace = 1;
else if (_key == "SigLevel")
siglevel = define_siglevel (siglevel, _value);
defaultsiglevel = define_siglevel (defaultsiglevel, _value);
else if (_key == "LocalSigLevel")
handle.localfilesiglevel = merge_siglevel (siglevel, define_siglevel (localfilesiglevel, _value));
localfilesiglevel = merge_siglevel (defaultsiglevel, define_siglevel (localfilesiglevel, _value));
else if (_key == "RemoteSigLevel")
handle.remotefilesiglevel = merge_siglevel (siglevel, define_siglevel (remotefilesiglevel, _value));
remotefilesiglevel = merge_siglevel (defaultsiglevel, define_siglevel (remotefilesiglevel, _value));
else if (_key == "HoldPkg") {
foreach (string name in _value.split (" ")) {
priv_holdpkg += name;
holdpkg += name;
}
} else if (_key == "SyncFirst") {
foreach (string name in _value.split (" ")) {
priv_syncfirst += name;
syncfirst += name;
}
} else if (_key == "CacheDir") {
foreach (string dir in _value.split (" ")) {
handle.add_cachedir (dir);
cachedir += dir;
}
} else if (_key == "IgnoreGroup") {
foreach (string name in _value.split (" ")) {
handle.add_ignoregroup (name);
ignoregroup += name;
}
} else if (_key == "IgnorePkg") {
foreach (string name in _value.split (" ")) {
handle.add_ignorepkg (name);
ignorepkg += name;
}
} else if (_key == "Noextract") {
foreach (string name in _value.split (" ")) {
handle.add_noextract (name);
noextract += name;
}
} else if (_key == "NoUpgrade") {
foreach (string name in _value.split (" ")) {
handle.add_noupgrade (name);
noupgrade += name;
}
}
} else {
@@ -160,7 +226,7 @@ namespace Alpm {
if (_key == "Server")
_repo.urls += _value;
else if (_key == "SigLevel")
_repo.siglevel = define_siglevel(siglevel, _value);
_repo.siglevel = define_siglevel (defaultsiglevel, _value);
}
}
}
@@ -168,8 +234,6 @@ namespace Alpm {
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
holdpkg = priv_holdpkg;
syncfirst = priv_syncfirst;
}
}



+ 12
- 41
src/common.vala View File

@@ -26,25 +26,11 @@ namespace Pamac {
public uint64 download_size;
}

public struct Updates {
public bool syncfirst;
public UpdatesInfos[] infos;
}

public enum Mode {
MANAGER,
UPDATER,
NO_CONFIRM
}
public struct TransactionData {
public Alpm.TransFlag flags;
// those hashtables will be used as set
public HashTable<string, string> to_add;
public HashTable<string, string> to_remove;
public HashTable<string, string> to_load;
public HashTable<string, string> to_build;
}

public struct ErrorInfos {
public string str;
@@ -159,15 +145,15 @@ public unowned Alpm.Package? get_syncpkg (Alpm.Handle handle, string name) {
return pkg;
}

public Pamac.UpdatesInfos[] get_syncfirst_updates (Alpm.Config alpm_config) {
public Pamac.UpdatesInfos[] get_syncfirst_updates (Alpm.Handle handle, string[] syncfirst) {
Pamac.UpdatesInfos infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] syncfirst_infos = {};
unowned Alpm.Package? pkg = null;
unowned Alpm.Package? candidate = null;
foreach (string name in alpm_config.syncfirst) {
pkg = Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, name);
foreach (string name in syncfirst) {
pkg = Alpm.find_satisfier (handle.localdb.pkgcache, name);
if (pkg != null) {
candidate = Alpm.sync_newversion (pkg, alpm_config.handle.syncdbs);
candidate = Alpm.sync_newversion (pkg, handle.syncdbs);
if (candidate != null) {
infos.name = candidate.name;
infos.version = candidate.version;
@@ -181,29 +167,14 @@ public Pamac.UpdatesInfos[] get_syncfirst_updates (Alpm.Config alpm_config) {
return syncfirst_infos;
}

public string[] get_ignore_pkgs (Alpm.Config alpm_config) {
string[] ignore_pkgs = {};
unowned Alpm.Group? group = null;
foreach (string name in alpm_config.handle.ignorepkgs)
ignore_pkgs += name;
foreach (string grp_name in alpm_config.handle.ignoregroups) {
group = alpm_config.handle.localdb.get_group (grp_name);
if (group != null) {
foreach (unowned Alpm.Package found_pkg in group.packages)
ignore_pkgs += found_pkg.name;
}
}
return ignore_pkgs;
}

public Pamac.UpdatesInfos[] get_repos_updates (Alpm.Config alpm_config, string[] ignore_pkgs) {
public Pamac.UpdatesInfos[] get_repos_updates (Alpm.Handle handle, string[] ignore_pkgs) {
unowned Alpm.Package? candidate = null;
Pamac.UpdatesInfos infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] updates = {};
foreach (unowned Alpm.Package local_pkg in alpm_config.handle.localdb.pkgcache) {
foreach (unowned Alpm.Package local_pkg in handle.localdb.pkgcache) {
// continue only if the local pkg is not in IgnorePkg or IgnoreGroup
if ((local_pkg.name in ignore_pkgs) == false) {
candidate = Alpm.sync_newversion (local_pkg, alpm_config.handle.syncdbs);
candidate = Alpm.sync_newversion (local_pkg, handle.syncdbs);
if (candidate != null) {
infos.name = candidate.name;
infos.version = candidate.version;
@@ -217,25 +188,25 @@ public Pamac.UpdatesInfos[] get_repos_updates (Alpm.Config alpm_config, string[]
return updates;
}

public Pamac.UpdatesInfos[] get_aur_updates (Alpm.Config alpm_config, string[] ignore_pkgs) {
public Pamac.UpdatesInfos[] get_aur_updates (Alpm.Handle handle, string[] ignore_pkgs) {
unowned Alpm.Package? sync_pkg = null;
unowned Alpm.Package? candidate = null;
string[] local_pkgs = {};
Pamac.UpdatesInfos infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] aur_updates = {};
// get local pkgs
foreach (unowned Alpm.Package local_pkg in alpm_config.handle.localdb.pkgcache) {
foreach (unowned Alpm.Package local_pkg in handle.localdb.pkgcache) {
// continue only if the local pkg is not in IgnorePkg or IgnoreGroup
if ((local_pkg.name in ignore_pkgs) == false) {
// check updates from AUR only for local packages
foreach (unowned Alpm.DB db in alpm_config.handle.syncdbs) {
foreach (unowned Alpm.DB db in handle.syncdbs) {
sync_pkg = Alpm.find_satisfier (db.pkgcache, local_pkg.name);
if (sync_pkg != null)
break;
}
if (sync_pkg == null) {
// check update from AUR only if no package from dbs will replace it
candidate = Alpm.sync_newversion (local_pkg, alpm_config.handle.syncdbs);
candidate = Alpm.sync_newversion (local_pkg, handle.syncdbs);
if (candidate == null) {
local_pkgs += local_pkg.name;
}
@@ -251,7 +222,7 @@ public Pamac.UpdatesInfos[] get_aur_updates (Alpm.Config alpm_config, string[] i
unowned Json.Object pkg_info = node.get_object ();
version = pkg_info.get_string_member ("Version");
name = pkg_info.get_string_member ("Name");
cmp = Alpm.pkg_vercmp (version, alpm_config.handle.localdb.get_pkg (name).version);
cmp = Alpm.pkg_vercmp (version, handle.localdb.get_pkg (name).version);
if (cmp == 1) {
infos.name = name;
infos.version = version;


+ 402
- 391
src/daemon.vala View File

@@ -18,211 +18,184 @@
*/

using Alpm;
using Pamac;
using Polkit;

// i18n
const string GETTEXT_PACKAGE = "pamac";

PamacServer server;
Pamac.Daemon pamac_daemon;
MainLoop loop;

[DBus (name = "org.manjaro.pamac")]
public class PamacServer : Object {
Alpm.Config alpm_config;
Pamac.Config pamac_config;
unowned Alpm.DB localdb;
unowned Alpm.List<DB?> syncdbs;
public uint64 previous_percent;
unowned Alpm.List<string?> local_packages;
int force_refresh;
bool emit_refreshed_signal;
public Cond provider_cond;
public Mutex provider_mutex;
public int? choosen_provider;

public signal void emit_event (uint event, string[] details);
public signal void emit_providers (string depend, string[] providers);
public signal void emit_progress (uint progress, string pkgname, int percent, uint n_targets, uint current_target);
public signal void emit_download (string filename, uint64 xfered, uint64 total);
public signal void emit_totaldownload (uint64 total);
public signal void emit_log (uint level, string msg);
public signal void emit_updates (Updates updates);
public signal void emit_refreshed (ErrorInfos error);
public signal void emit_trans_prepared (ErrorInfos error);
public signal void emit_trans_committed (ErrorInfos error);

public PamacServer () {
previous_percent = 0;
local_packages = null;
get_handle ();
force_refresh = 0;
emit_refreshed_signal = true;
}

private void get_handle () {
alpm_config = new Alpm.Config ("/etc/pacman.conf");
pamac_config = new Pamac.Config ("/etc/pamac.conf");
alpm_config.handle.eventcb = (EventCallBack) cb_event;
alpm_config.handle.progresscb = (ProgressCallBack) cb_progress;
alpm_config.handle.questioncb = (QuestionCallBack) cb_question;
alpm_config.handle.dlcb = (DownloadCallBack) cb_download;
alpm_config.handle.totaldlcb = (TotalDownloadCallBack) cb_totaldownload;
alpm_config.handle.logcb = (LogCallBack) cb_log;
localdb = alpm_config.handle.localdb;
syncdbs = alpm_config.handle.syncdbs;
}
namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
public class Daemon : Object {
string[] syncfirst;
string[] holdpkg;
string[] ignorepkg;
Handle? handle;
public uint64 previous_percent;
int force_refresh;
bool emit_refreshed_signal;
public Cond provider_cond;
public Mutex provider_mutex;
public int? choosen_provider;

public signal void emit_event (uint event, string[] details);
public signal void emit_providers (string depend, string[] providers);
public signal void emit_progress (uint progress, string pkgname, int percent, uint n_targets, uint current_target);
public signal void emit_download (string filename, uint64 xfered, uint64 total);
public signal void emit_totaldownload (uint64 total);
public signal void emit_log (uint level, string msg);
public signal void emit_refreshed (ErrorInfos error);
public signal void emit_trans_prepared (ErrorInfos error);
public signal void emit_trans_committed (ErrorInfos error);

public Daemon () {
}

public void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
try {
Polkit.Authority authority = Polkit.Authority.get_sync (null);
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
Polkit.AuthorizationResult result = authority.check_authorization_sync
(subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null);
if (result.get_is_authorized ()) {
pamac_config.write (new_conf);
private void init_alpm_config () {
var alpm_config = new Alpm.Config ("/etc/pacman.conf");
syncfirst = alpm_config.get_syncfirst ();
holdpkg = alpm_config.get_holdpkg ();
ignorepkg = alpm_config.get_ignore_pkgs ();
handle = alpm_config.get_handle ();
if (handle == null) {
ErrorInfos err = ErrorInfos ();
err.str = _("Failed to initialize alpm library");
emit_trans_committed (err);
} else {
handle.eventcb = (EventCallBack) cb_event;
handle.progresscb = (ProgressCallBack) cb_progress;
handle.questioncb = (QuestionCallBack) cb_question;
handle.dlcb = (DownloadCallBack) cb_download;
handle.totaldlcb = (TotalDownloadCallBack) cb_totaldownload;
handle.logcb = (LogCallBack) cb_log;
}
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
previous_percent = 0;
}
}

public void refresh_alpm_config () {
get_handle ();
}