update alpm bindings and menus

This commit is contained in:
guinux 2014-10-30 14:44:09 +01:00
parent a2d248bc2d
commit ebe01e5d44
30 changed files with 1069 additions and 1013 deletions

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

244
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 ""

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"

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>

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>

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>

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>

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>

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>

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>

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">

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>

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>

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>

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>

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 \

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

View File

@ -26,26 +26,12 @@ 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;
public string[] details;
@ -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;

View File

@ -18,23 +18,22 @@
*/
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;
namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
public class Daemon : Object {
string[] syncfirst;
string[] holdpkg;
string[] ignorepkg;
Handle? handle;
public uint64 previous_percent;
unowned Alpm.List<string?> local_packages;
int force_refresh;
bool emit_refreshed_signal;
public Cond provider_cond;
@ -47,33 +46,36 @@ public class PamacServer : Object {
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;
public Daemon () {
}
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;
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;
}
previous_percent = 0;
}
public void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
try {
Polkit.Authority authority = Polkit.Authority.get_sync (null);
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
@ -91,17 +93,14 @@ public class PamacServer : Object {
}
}
public void refresh_alpm_config () {
get_handle ();
}
private void refresh_real () {
private int refresh_real () {
init_alpm_config ();
ErrorInfos err = ErrorInfos ();
string[] details = {};
uint success = 0;
int ret = alpm_config.handle.trans_init (0);
int success = 0;
int ret = handle.trans_init (0);
if (ret == 0) {
foreach (unowned DB db in syncdbs) {
foreach (var db in handle.syncdbs) {
ret = db.update (force_refresh);
if (ret >= 0) {
success++;
@ -111,43 +110,42 @@ public class PamacServer : Object {
// fail later with unresolved deps, but that should be rare, and would be expected
if (success == 0) {
err.str = _("Failed to synchronize any databases");
details += Alpm.strerror (alpm_config.handle.errno ());
details += Alpm.strerror (handle.errno ());
err.details = details;
}
trans_release ();
get_handle ();
} else {
err.str = _("Failed to synchronize any databases");
details += Alpm.strerror (alpm_config.handle.errno ());
details += Alpm.strerror (handle.errno ());
err.details = details;
}
if (emit_refreshed_signal)
emit_refreshed (err);
else
emit_refreshed_signal = true;
return success;
}
public async void refresh (int force, bool emit_signal) {
public void refresh (int force, bool emit_signal) {
force_refresh = force;
emit_refreshed_signal = emit_signal;
try {
new Thread<void*>.try ("refresh thread", (ThreadFunc) refresh_real);
new Thread<int>.try ("refresh thread", (ThreadFunc) refresh_real);
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
}
public UpdatesInfos[] get_updates () {
init_alpm_config ();
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
UpdatesInfos[] updates = {};
updates = get_syncfirst_updates (alpm_config);
updates = get_syncfirst_updates (handle, syncfirst);
if (updates.length != 0) {
return updates;
} else {
string[] ignore_pkgs = get_ignore_pkgs (alpm_config);
updates = get_repos_updates (alpm_config, ignore_pkgs);
updates = get_repos_updates (handle, ignorepkg);
if (pamac_config.enable_aur) {
UpdatesInfos[] aur_updates = get_aur_updates (alpm_config, ignore_pkgs);
foreach (UpdatesInfos infos in aur_updates)
UpdatesInfos[] aur_updates = get_aur_updates (handle, ignorepkg);
foreach (var infos in aur_updates)
updates += infos;
}
return updates;
@ -155,12 +153,13 @@ public class PamacServer : Object {
}
public ErrorInfos trans_init (TransFlag transflags) {
init_alpm_config ();
ErrorInfos err = ErrorInfos ();
string[] details = {};
int ret = alpm_config.handle.trans_init (transflags);
int ret = handle.trans_init (transflags);
if (ret == -1) {
err.str = _("Failed to init transaction");
details += Alpm.strerror (alpm_config.handle.errno ());
details += Alpm.strerror (handle.errno ());
err.details = details;
}
return err;
@ -169,10 +168,10 @@ public class PamacServer : Object {
public ErrorInfos trans_sysupgrade (int enable_downgrade) {
ErrorInfos err = ErrorInfos ();
string[] details = {};
int ret = alpm_config.handle.trans_sysupgrade (enable_downgrade);
int ret = handle.trans_sysupgrade (enable_downgrade);
if (ret == -1) {;
err.str = _("Failed to prepare transaction");
details += Alpm.strerror (alpm_config.handle.errno ());
details += Alpm.strerror (handle.errno ());
err.details = details;
}
return err;
@ -182,8 +181,8 @@ public class PamacServer : Object {
ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = null;
//pkg = alpm_config.handle.find_dbs_satisfier (syncdbs, pkgname);
foreach (var db in syncdbs) {
//pkg = handle.find_dbs_satisfier (handle.syncdbs, pkgname);
foreach (var db in handle.syncdbs) {
pkg = find_satisfier (db.pkgcache, pkgname);
if (pkg != null)
break;
@ -194,9 +193,9 @@ public class PamacServer : Object {
err.details = details;
return err;
}
int ret = alpm_config.handle.trans_add_pkg (pkg);
int ret = handle.trans_add_pkg (pkg);
if (ret == -1) {
Alpm.Errno errno = alpm_config.handle.errno ();
Alpm.Errno errno = handle.errno ();
if (errno == Errno.TRANS_DUP_TARGET || errno == Errno.PKG_IGNORED)
// just skip duplicate or ignored targets
return err;
@ -213,25 +212,27 @@ public class PamacServer : Object {
public ErrorInfos trans_load_pkg (string pkgpath) {
ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = alpm_config.handle.load_file (pkgpath, 1, alpm_config.handle.localfilesiglevel);
Package* pkg = handle.load_file (pkgpath, 1, handle.localfilesiglevel);
if (pkg == null) {
err.str = _("Failed to prepare transaction");
details += "%s: %s".printf (pkgpath, Alpm.strerror (alpm_config.handle.errno ()));
details += "%s: %s".printf (pkgpath, Alpm.strerror (handle.errno ()));
err.details = details;
return err;
} else {
int ret = alpm_config.handle.trans_add_pkg (pkg);
int ret = handle.trans_add_pkg (pkg);
if (ret == -1) {
Alpm.Errno errno = alpm_config.handle.errno ();
Alpm.Errno errno = handle.errno ();
if (errno == Errno.TRANS_DUP_TARGET || errno == Errno.PKG_IGNORED)
// just skip duplicate or ignored targets
return err;
else {
err.str = _("Failed to prepare transaction");
details += "%s: %s".printf (pkg.name, Alpm.strerror (errno));
details += "%s: %s".printf (pkg->name, Alpm.strerror (errno));
err.details = details;
return err;
}
// free the package because it will not be used
delete pkg;
}
}
return err;
@ -240,29 +241,29 @@ public class PamacServer : Object {
public ErrorInfos trans_remove_pkg (string pkgname) {
ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = localdb.get_pkg (pkgname);
unowned Package? pkg = handle.localdb.get_pkg (pkgname);
if (pkg == null) {
err.str = _("Failed to prepare transaction");
details += _("target not found: %s").printf (pkgname);
err.details = details;
return err;
}
int ret = alpm_config.handle.trans_remove_pkg (pkg);
int ret = handle.trans_remove_pkg (pkg);
if (ret == -1) {
err.str = _("Failed to prepare transaction");
details += "%s: %s".printf (pkg.name, Alpm.strerror (alpm_config.handle.errno ()));
details += "%s: %s".printf (pkg.name, Alpm.strerror (handle.errno ()));
err.details = details;
}
return err;
}
public void trans_prepare_real () {
public int trans_prepare_real () {
ErrorInfos err = ErrorInfos ();
string[] details = {};
Alpm.List<void*> err_data = null;
int ret = alpm_config.handle.trans_prepare (out err_data);
int ret = handle.trans_prepare (out err_data);
if (ret == -1) {
Alpm.Errno errno = alpm_config.handle.errno ();
Alpm.Errno errno = handle.errno ();
err.str = _("Failed to prepare transaction");
string detail = Alpm.strerror (errno);
switch (errno) {
@ -305,8 +306,8 @@ public class PamacServer : Object {
} else {
// Search for holdpkg in target list
bool found_locked_pkg = false;
foreach (unowned Package pkg in alpm_config.handle.trans_to_remove ()) {
if (pkg.name in alpm_config.holdpkg) {
foreach (var pkg in handle.trans_to_remove ()) {
if (pkg.name in holdpkg) {
details += _("%s needs to be removed but it is a locked package").printf (pkg.name);
found_locked_pkg = true;
break;
@ -319,11 +320,12 @@ public class PamacServer : Object {
}
}
emit_trans_prepared (err);
return ret;
}
public async void trans_prepare () {
public void trans_prepare () {
try {
new Thread<void*>.try ("prepare thread", (ThreadFunc) trans_prepare_real);
new Thread<int>.try ("prepare thread", (ThreadFunc) trans_prepare_real);
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
@ -339,7 +341,7 @@ public class PamacServer : Object {
public UpdatesInfos[] trans_to_add () {
UpdatesInfos info = UpdatesInfos ();
UpdatesInfos[] infos = {};
foreach (unowned Package pkg in alpm_config.handle.trans_to_add ()) {
foreach (var pkg in handle.trans_to_add ()) {
info.name = pkg.name;
info.version = pkg.version;
// if pkg was load from a file, pkg.db is null
@ -357,7 +359,7 @@ public class PamacServer : Object {
public UpdatesInfos[] trans_to_remove () {
UpdatesInfos info = UpdatesInfos ();
UpdatesInfos[] infos = {};
foreach (unowned Package pkg in alpm_config.handle.trans_to_remove ()) {
foreach (var pkg in handle.trans_to_remove ()) {
info.name = pkg.name;
info.version = pkg.version;
info.db_name = pkg.db.name;
@ -368,20 +370,20 @@ public class PamacServer : Object {
return infos;
}
private void trans_commit_real () {
private int trans_commit_real () {
ErrorInfos err = ErrorInfos ();
string[] details = {};
Alpm.List<void*> err_data = null;
int ret = alpm_config.handle.trans_commit (out err_data);
int ret = handle.trans_commit (out err_data);
if (ret == -1) {
Alpm.Errno errno = alpm_config.handle.errno ();
Alpm.Errno errno = handle.errno ();
err.str = _("Failed to commit transaction");
string detail = Alpm.strerror (errno);
switch (errno) {
case Alpm.Errno.FILE_CONFLICTS:
detail += ":";
details += detail;
//TransFlag flags = alpm_config.handle.trans_get_flags ();
//TransFlag flags = handle.trans_get_flags ();
//if ((flags & TransFlag.FORCE) != 0) {
//details += _("unable to %s directory-file conflicts").printf ("--force");
//}
@ -415,41 +417,49 @@ public class PamacServer : Object {
err.details = details;
}
trans_release ();
get_handle ();
emit_trans_committed (err);
return ret;
}
public async void trans_commit (GLib.BusName sender) {
public void trans_commit (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,
var result = new Polkit.AuthorizationResult (false, false, null);
authority.check_authorization.begin (
subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null);
null,
(obj, res) => {
try {
result = authority.check_authorization.end (res);
if (result.get_is_authorized ()) {
new Thread<void*>.try ("commit thread", (ThreadFunc) trans_commit_real);
new Thread<int>.try ("commit thread", (ThreadFunc) trans_commit_real);
} else {
ErrorInfos err = ErrorInfos ();
err.str = dgettext ("pamac", "Authentication failed");
err.str = dgettext (null, "Authentication failed");
emit_trans_committed (err);
trans_release ();
}
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
stderr.printf ("Polkit Error: %s\n", e.message);
}
}
);
} catch (GLib.Error e) {
stderr.printf ("Polkit Error: %s\n", e.message);
}
}
public int trans_release () {
return alpm_config.handle.trans_release ();
return handle.trans_release ();
}
public void trans_cancel () {
alpm_config.handle.trans_interrupt ();
alpm_config.handle.trans_release ();
get_handle ();
handle.trans_interrupt ();
handle.trans_release ();
}
public void quit () {
@ -457,7 +467,8 @@ public class PamacServer : Object {
if (lockfile.query_exists () == false)
loop.quit ();
}
// End of Server Object
// End of Daemon Object
}
}
private void write_log_file (string event) {
@ -568,7 +579,7 @@ private void cb_event (Event event, void *data1, void *data2) {
default:
break;
}
server.emit_event ((uint) event, details);
pamac_daemon.emit_event ((uint) event, details);
}
private void cb_question (Question question, void *data1, void *data2, void *data3, out int response) {
@ -594,19 +605,19 @@ private void cb_question (Question question, void *data1, void *data2, void *dat
Depend *depend = data2;
string depend_str = depend->compute_string ();
string[] providers_str = {};
foreach (unowned Package pkg in providers) {
foreach (var pkg in providers) {
providers_str += pkg.name;
}
server.provider_cond = Cond ();
server.provider_mutex = Mutex ();
server.choosen_provider = null;
server.emit_providers (depend_str, providers_str);
server.provider_mutex.lock ();
while (server.choosen_provider == null) {
server.provider_cond.wait (server.provider_mutex);
pamac_daemon.provider_cond = Cond ();
pamac_daemon.provider_mutex = Mutex ();
pamac_daemon.choosen_provider = null;
pamac_daemon.emit_providers (depend_str, providers_str);
pamac_daemon.provider_mutex.lock ();
while (pamac_daemon.choosen_provider == null) {
pamac_daemon.provider_cond.wait (pamac_daemon.provider_mutex);
}
response = server.choosen_provider;
server.provider_mutex.unlock ();
response = pamac_daemon.choosen_provider;
pamac_daemon.provider_mutex.unlock ();
break;
case Question.CORRUPTED_PKG:
// Auto-remove corrupted pkgs in cache
@ -640,21 +651,21 @@ private void cb_progress (Progress progress, string pkgname, int percent, uint n
//~ default:
//~ break;
//~ }
if ((uint64) percent != server.previous_percent) {
server.previous_percent = (uint64) percent;
server.emit_progress ((uint) progress, pkgname, percent, n_targets, current_target);
if ((uint64) percent != pamac_daemon.previous_percent) {
pamac_daemon.previous_percent = (uint64) percent;
pamac_daemon.emit_progress ((uint) progress, pkgname, percent, n_targets, current_target);
}
}
private void cb_download (string filename, uint64 xfered, uint64 total) {
if (xfered != server.previous_percent) {
server.previous_percent = xfered;
server.emit_download (filename, xfered, total);
if (xfered != pamac_daemon.previous_percent) {
pamac_daemon.previous_percent = xfered;
pamac_daemon.emit_download (filename, xfered, total);
}
}
private void cb_totaldownload (uint64 total) {
server.emit_totaldownload (total);
pamac_daemon.emit_totaldownload (total);
}
private void cb_log (LogLevel level, string fmt, va_list args) {
@ -664,13 +675,13 @@ private void cb_log (LogLevel level, string fmt, va_list args) {
string? log = null;
log = fmt.vprintf (args);
if (log != null)
server.emit_log ((uint) level, log);
pamac_daemon.emit_log ((uint) level, log);
}
void on_bus_acquired (DBusConnection conn) {
server = new PamacServer ();
pamac_daemon = new Pamac.Daemon ();
try {
conn.register_object ("/org/manjaro/pamac", server);
conn.register_object ("/org/manjaro/pamac", pamac_daemon);
}
catch (IOError e) {
stderr.printf ("Could not register service\n");
@ -679,10 +690,10 @@ void on_bus_acquired (DBusConnection conn) {
void main () {
// i18n
Intl.setlocale(LocaleCategory.ALL, "");
Intl.textdomain(GETTEXT_PACKAGE);
Intl.setlocale (LocaleCategory.ALL, "");
Intl.textdomain (GETTEXT_PACKAGE);
Bus.own_name(BusType.SYSTEM, "org.manjaro.pamac", BusNameOwnerFlags.NONE,
Bus.own_name (BusType.SYSTEM, "org.manjaro.pamac", BusNameOwnerFlags.NONE,
on_bus_acquired,
() => {},
() => stderr.printf("Could not acquire name\n"));

View File

@ -51,7 +51,7 @@ namespace Pamac {
public override void open (File[] files, string hint) {
foreach (File file in files) {
string? path = file.get_path ();
transaction.data.to_load.insert (path, path);
transaction.to_load.insert (path, path);
}
transaction.run ();
}

View File

@ -59,6 +59,8 @@ namespace Pamac {
[GtkChild]
public TreeView search_treeview;
[GtkChild]
public TreeSelection search_treeview_selection;
[GtkChild]
public TreeView groups_treeview;
[GtkChild]
public TreeView states_treeview;
@ -167,13 +169,14 @@ namespace Pamac {
}
public void update_lists () {
Alpm.List <string?> grps = null;
string[] grps = {};
TreeIter iter;
foreach (unowned DB db in transaction.alpm_config.handle.syncdbs) {
foreach (unowned DB db in transaction.handle.syncdbs) {
repos_list.insert_with_values (out iter, -1, 0, db.name);
foreach (unowned Group grp in db.groupcache) {
if (grps.find_str (grp.name) == null)
grps.add(grp.name);
if ((grp.name in grps) == false) {
grps += grp.name;
}
}
}
repos_list.insert_with_values (out iter, -1, 0, dgettext (null, "local"));
@ -230,20 +233,20 @@ namespace Pamac {
if (len != 0) {
deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Depends On") + ":",
1, list.nth (0).get_data ().compute_string ());
1, list.nth_data (0).compute_string ());
i = 1;
while (i < len) {
deps_list.insert_with_values (out iter, -1,
1, list.nth (i).get_data ().compute_string ());
1, list.nth_data (i).compute_string ());
i++;
}
}
list = pkg.optdepends;
len = list.length;
if (len != 0) {
unowned Depend optdep = list.nth (0).get_data ();
unowned Depend optdep = list.nth_data (0);
unowned Alpm.Package? satisfier = find_satisfier (
transaction.alpm_config.handle.localdb.pkgcache,
transaction.handle.localdb.pkgcache,
optdep.name);
string optdep_str = optdep.compute_string ();
if (satisfier != null)
@ -253,9 +256,9 @@ namespace Pamac {
1, optdep_str);
i = 1;
while (i < len) {
optdep = list.nth (i).get_data ();
optdep = list.nth_data (i);
satisfier = find_satisfier (
transaction.alpm_config.handle.localdb.pkgcache,
transaction.handle.localdb.pkgcache,
optdep.name);
optdep_str = optdep.compute_string ();
if (satisfier != null)
@ -265,16 +268,16 @@ namespace Pamac {
}
}
if (pkg.origin == PkgFrom.LOCALDB) {
unowned Alpm.List<string?> str_list = pkg.compute_requiredby ();
Alpm.List<string?> str_list = pkg.compute_requiredby ();
len = str_list.length;
if (len != 0) {
deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Required By") + ":",
1, str_list.nth (0).get_data ());
1, str_list.nth_data (0));
i = 1;
while (i < len) {
deps_list.insert_with_values (out iter, -1,
1, str_list.nth (i).get_data ());
1, str_list.nth_data (i));
i++;
}
}
@ -284,11 +287,11 @@ namespace Pamac {
if (len != 0) {
deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Provides") + ":",
1, list.nth (0).get_data ().compute_string ());
1, list.nth_data (0).compute_string ());
i = 1;
while (i < len) {
deps_list.insert_with_values (out iter, -1,
1, list.nth (i).get_data ().compute_string ());
1, list.nth_data (i).compute_string ());
i++;
}
}
@ -297,11 +300,11 @@ namespace Pamac {
if (len != 0) {
deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Replaces") + ":",
1, list.nth (0).get_data ().compute_string ());
1, list.nth_data (0).compute_string ());
i = 1;
while (i < len) {
deps_list.insert_with_values (out iter, -1,
1, list.nth (i).get_data ().compute_string ());
1, list.nth_data (i).compute_string ());
i++;
}
}
@ -310,11 +313,11 @@ namespace Pamac {
if (len != 0) {
deps_list.insert_with_values (out iter, -1,
0, dgettext (null, "Conflicts With") + ":",
1, list.nth (0).get_data ().compute_string ());
1, list.nth_data (0).compute_string ());
i = 1;
while (i < len) {
deps_list.insert_with_values (out iter, -1,
1, list.nth (i).get_data ().compute_string ());
1, list.nth_data (i).compute_string ());
i++;
}
}
@ -334,11 +337,11 @@ namespace Pamac {
if (len != 0) {
details_list.insert_with_values (out iter, -1,
0, dgettext (null, "Groups") + ":",
1, list.nth (0).get_data ());
1, list.nth_data (0));
i = 1;
while (i < len) {
details_list.insert_with_values (out iter, -1,
1, list.nth (i).get_data ());
1, list.nth_data (i));
i++;
}
}
@ -373,11 +376,11 @@ namespace Pamac {
if (len != 0) {
details_list.insert_with_values (out iter, -1,
0, dgettext (null, "Backup files") + ":",
1, "/" + backup_list.nth (0).get_data ().name);
1, "/" + backup_list.nth_data (0).name);
i = 1;
while (i < len) {
details_list.insert_with_values (out iter, -1,
1, "/" + backup_list.nth (i).get_data ().name);
1, "/" + backup_list.nth_data (i).name);
i++;
}
}
@ -396,12 +399,11 @@ namespace Pamac {
}
public async unowned Alpm.List<Alpm.Package?> search_pkgs (string search_string, out Json.Array aur_pkgs) {
unowned Alpm.List<Alpm.Package?> pkgs = null;
unowned Alpm.List<string?> needles = null;
string[] splitted = search_string.split (" ");
foreach (unowned string part in splitted)
needles.add (part);
pkgs = search_all_dbs (transaction.alpm_config.handle, needles);
unowned Alpm.List<Alpm.Package?> pkgs = search_all_dbs (transaction.handle, needles);
if (search_aur_button.get_active()) {
if (aur_results.contains (search_string)) {
aur_pkgs = aur_results.get (search_string);
@ -495,28 +497,28 @@ namespace Pamac {
packages_list.get_value (iter, 0, out val);
string name = val.get_string ();
if (name != dgettext (null, "No package found")) {
if (transaction.data.to_add.contains (name)) {
transaction.data.to_add.steal (name);
} else if (transaction.data.to_remove.contains (name)) {
transaction.data.to_remove.steal (name);
} else if (transaction.data.to_build.contains (name)) {
transaction.data.to_build.steal (name);
if (transaction.to_add.contains (name)) {
transaction.to_add.steal (name);
} else if (transaction.to_remove.contains (name)) {
transaction.to_remove.steal (name);
} else if (transaction.to_build.contains (name)) {
transaction.to_build.steal (name);
} else {
packages_list.get_value (iter, 3, out val);
string db_name = val.get_string ();
if (db_name == "local") {
if (!(name in transaction.alpm_config.holdpkg)) {
transaction.data.to_remove.insert (name, name);
if ((name in transaction.holdpkg) == false) {
transaction.to_remove.insert (name, name);
}
} else if (db_name == "AUR") {
transaction.data.to_build.insert (name, name);
transaction.to_build.insert (name, name);
} else {
transaction.data.to_add.insert (name, name);
transaction.to_add.insert (name, name);
}
}
}
}
if (transaction.data.to_add.size () + transaction.data.to_remove.size () + transaction.data.to_build.size () == 0) {
if (transaction.to_add.size () + transaction.to_remove.size () + transaction.to_build.size () == 0) {
set_buttons_sensitive (false);
} else {
set_buttons_sensitive (true);
@ -642,8 +644,11 @@ namespace Pamac {
model.get_value (_iter, 0, out line);
if ((string) line == search_string) {
found = true;
// populate will be done because we select the iter in search_list
// block the signal to not populate when we select the iter in search_list
search_treeview_selection.changed.disconnect (on_search_treeview_selection_changed);
selection.select_iter (_iter);
search_treeview_selection.changed.connect_after (on_search_treeview_selection_changed);
populate_packages_list (pkgs, aur_pkgs);
}
return found;
});
@ -651,8 +656,11 @@ namespace Pamac {
}
if (!found) {
search_list.insert_with_values (out iter, -1, 0, search_string);
// populate will be done because we select the iter in search_list
// block the signal to not populate when we select the iter in search_list
search_treeview_selection.changed.disconnect (on_search_treeview_selection_changed);
selection.select_iter (iter);
search_treeview_selection.changed.connect_after (on_search_treeview_selection_changed);
populate_packages_list (pkgs, aur_pkgs);
}
} else
// populate with empty lists
@ -698,7 +706,7 @@ namespace Pamac {
GLib.Value val;
model.get_value (iter, 0, out val);
string grp_name = val.get_string ();
unowned Alpm.List<Alpm.Package?> pkgs = group_pkgs_all_dbs (transaction.alpm_config.handle, grp_name);
unowned Alpm.List<Alpm.Package?> pkgs = group_pkgs_all_dbs (transaction.handle, grp_name);
populate_packages_list (pkgs);
}
}
@ -718,28 +726,28 @@ namespace Pamac {
unowned Alpm.List<Alpm.Package?> pkgs = null;
unowned Alpm.Package? find_pkg = null;
if (state == dgettext (null, "To install")) {
foreach (string name in transaction.data.to_add.get_keys ()) {
find_pkg = transaction.alpm_config.handle.localdb.get_pkg (name);
foreach (string name in transaction.to_add.get_keys ()) {
find_pkg = transaction.handle.localdb.get_pkg (name);
if (find_pkg != null)
pkgs.add (find_pkg);
else {
find_pkg = get_syncpkg (transaction.alpm_config.handle, name);
find_pkg = get_syncpkg (transaction.handle, name);
if (find_pkg != null)
pkgs.add (find_pkg);
}
}
} else if (state == dgettext (null, "To remove")) {
foreach (string name in transaction.data.to_remove.get_keys ()) {
find_pkg = transaction.alpm_config.handle.localdb.get_pkg (name);
foreach (string name in transaction.to_remove.get_keys ()) {
find_pkg = transaction.handle.localdb.get_pkg (name);
if (find_pkg != null)
pkgs.add (find_pkg);
}
} else if (state == dgettext (null, "Installed")) {
pkgs = transaction.alpm_config.handle.localdb.pkgcache;
pkgs = transaction.handle.localdb.pkgcache;
} else if (state == dgettext (null, "Uninstalled")) {
unowned Alpm.List<Alpm.Package?> tmp = null;
unowned Alpm.List<Alpm.Package?> diff = null;
foreach (unowned DB db in transaction.alpm_config.handle.syncdbs) {
foreach (unowned DB db in transaction.handle.syncdbs) {
if (pkgs.length == 0)
pkgs = db.pkgcache;
else {
@ -749,7 +757,7 @@ namespace Pamac {
}
}
} else if (state == dgettext (null, "Orphans")) {
foreach (unowned Alpm.Package pkg in transaction.alpm_config.handle.localdb.pkgcache) {
foreach (unowned Alpm.Package pkg in transaction.handle.localdb.pkgcache) {
if (pkg.reason == PkgReason.DEPEND) {
if (pkg.compute_requiredby().length == 0)
pkgs.add (pkg);
@ -775,16 +783,16 @@ namespace Pamac {
unowned Alpm.List<Alpm.Package?> pkgs = null;
unowned Alpm.Package? find_pkg = null;
if (repo == dgettext (null, "local")) {
foreach (unowned Alpm.Package pkg in transaction.alpm_config.handle.localdb.pkgcache) {
find_pkg = get_syncpkg (transaction.alpm_config.handle, pkg.name);
foreach (unowned Alpm.Package pkg in transaction.handle.localdb.pkgcache) {
find_pkg = get_syncpkg (transaction.handle, pkg.name);
if (find_pkg == null)
pkgs.add (pkg);
}
} else {
foreach (unowned DB db in transaction.alpm_config.handle.syncdbs) {
foreach (unowned DB db in transaction.handle.syncdbs) {
if (db.name == repo) {
foreach (unowned Alpm.Package pkg in db.pkgcache) {
find_pkg = transaction.alpm_config.handle.localdb.get_pkg (pkg.name);
find_pkg = transaction.handle.localdb.get_pkg (pkg.name);
if (find_pkg != null)
pkgs.add (find_pkg);
else
@ -835,7 +843,7 @@ namespace Pamac {
SList<string> packages_paths = packages_chooser_dialog.get_filenames ();
if (packages_paths.length () != 0) {
foreach (string path in packages_paths) {
transaction.data.to_load.insert (path, path);
transaction.to_load.insert (path, path);
}
this.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
packages_chooser_dialog.hide ();
@ -898,7 +906,7 @@ namespace Pamac {
while (Gtk.events_pending ())
Gtk.main_iteration ();
if (pamac_config.recurse)
transaction.data.flags |= Alpm.TransFlag.RECURSE;
transaction.flags |= Alpm.TransFlag.RECURSE;
transaction.run ();
}
@ -921,7 +929,7 @@ namespace Pamac {
set_buttons_sensitive (false);
refresh_packages_list ();
}
transaction.data.to_load.steal_all ();
transaction.to_load.steal_all ();
this.get_window ().set_cursor (null);
}
}

View File

@ -43,7 +43,7 @@ namespace Pamac {
SList<string> packages_paths = this.get_filenames ();
if (packages_paths.length () != 0) {
foreach (string path in packages_paths) {
transaction.data.to_load.insert (path, path);
transaction.to_load.insert (path, path);
}
window.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
this.hide ();

View File

@ -84,21 +84,21 @@ namespace Pamac {
case 1:
val = Value (typeof (Object));
if (pkg.alpm_pkg != null) {
if (pkg.name in manager_window.transaction.alpm_config.holdpkg)
if (pkg.name in manager_window.transaction.holdpkg)
val.set_object (manager_window.locked_icon);
else if (pkg.repo == "local") {
if (manager_window.transaction.data.to_add.contains (pkg.name))
if (manager_window.transaction.to_add.contains (pkg.name))
val.set_object (manager_window.to_reinstall_icon);
else if (manager_window.transaction.data.to_remove.contains (pkg.name))
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.data.to_add.contains (pkg.name))
} else if (manager_window.transaction.to_add.contains (pkg.name))
val.set_object (manager_window.to_install_icon);
else
val.set_object (manager_window.uninstalled_icon);
} else if (pkg.aur_json != null) {
if (manager_window.transaction.data.to_build.contains (pkg.name))
if (manager_window.transaction.to_build.contains (pkg.name))
val.set_object (manager_window.to_install_icon);
else
val.set_object (manager_window.uninstalled_icon);

View File

@ -19,8 +19,8 @@
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/progress_window.ui")]
public class ProgressWindow : Gtk.Window {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/progress_dialog.ui")]
public class ProgressDialog : Gtk.Dialog {
[GtkChild]
public Gtk.ProgressBar progressbar;
@ -35,8 +35,8 @@ namespace Pamac {
Transaction transaction;
public ProgressWindow (Transaction transaction, Gtk.ApplicationWindow? window) {
Object (transient_for: window);
public ProgressDialog (Transaction transaction, Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 0);
this.transaction = transaction;
}

View File

@ -25,20 +25,18 @@ namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
public interface Daemon : Object {
public abstract void write_config (HashTable<string,string> new_conf) throws IOError;
public abstract void refresh_alpm_config () throws IOError;
public abstract async void refresh (int force, bool emit_signal) throws IOError;
public abstract void refresh (int force, bool emit_signal) throws IOError;
public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError;
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError;
public abstract ErrorInfos trans_add_pkg (string pkgname) throws IOError;
public abstract ErrorInfos trans_remove_pkg (string pkgname) throws IOError;
public abstract ErrorInfos trans_load_pkg (string pkgpath) throws IOError;
public abstract async void trans_prepare () throws IOError;
public abstract void trans_prepare () throws IOError;
public abstract void choose_provider (int provider) throws IOError;
public abstract UpdatesInfos[] trans_to_add () throws IOError;
public abstract UpdatesInfos[] trans_to_remove () throws IOError;
public abstract async void trans_commit () throws IOError;
public abstract void trans_commit () throws IOError;
public abstract void trans_release () throws IOError;
[DBus (no_reply = true)]
public abstract void trans_cancel () throws IOError;
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
@ -56,10 +54,19 @@ namespace Pamac {
public class Transaction: Object {
public Daemon daemon;
public Alpm.Config alpm_config;
public string[] syncfirst;
public string[] holdpkg;
public string[] ignorepkg;
public Handle handle;
public Pamac.Config pamac_config;
public TransactionData data;
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 Mode mode;
uint64 total_download;
@ -80,29 +87,28 @@ namespace Pamac {
ChooseProviderDialog choose_provider_dialog;
TransactionSumDialog transaction_sum_dialog;
TransactionInfoDialog transaction_info_dialog;
ProgressWindow progress_window;
ProgressDialog progress_dialog;
//parent window
ApplicationWindow? window;
public signal void finished (bool error);
public Transaction (ApplicationWindow? window, Pamac.Config pamac_config) {
alpm_config = new Alpm.Config ("/etc/pacman.conf");
refresh_alpm_config ();
this.pamac_config = pamac_config;
mode = Mode.MANAGER;
data = TransactionData ();
data.flags = Alpm.TransFlag.CASCADE;
data.to_add = new HashTable<string, string> (str_hash, str_equal);
data.to_remove = new HashTable<string, string> (str_hash, str_equal);
data.to_load = new HashTable<string, string> (str_hash, str_equal);
data.to_build = new HashTable<string, string> (str_hash, str_equal);
flags = Alpm.TransFlag.CASCADE;
to_add = new HashTable<string, string> (str_hash, str_equal);
to_remove = new HashTable<string, string> (str_hash, str_equal);
to_load = new HashTable<string, string> (str_hash, str_equal);
to_build = new HashTable<string, string> (str_hash, str_equal);
connecting_dbus_signals ();
//creating dialogs
this.window = window;
choose_provider_dialog = new ChooseProviderDialog (window);
transaction_sum_dialog = new TransactionSumDialog (window);
transaction_info_dialog = new TransactionInfoDialog (window);
progress_window = new ProgressWindow (this, window);
progress_dialog = new ProgressDialog (this, window);
//creating terminal
term = new Terminal ();
term.scroll_on_output = false;
@ -125,7 +131,7 @@ namespace Pamac {
sb.set_visible (true);
grid.attach (term, 0, 0, 1, 1);
grid.attach (sb, 1, 0, 1, 1);
progress_window.expander.add (grid);
progress_dialog.expander.add (grid);
// progress data
total_download = 0;
already_downloaded = 0;
@ -147,31 +153,33 @@ namespace Pamac {
}
public void refresh_alpm_config () {
alpm_config = new Alpm.Config ("/etc/pacman.conf");
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 ();
}
public void refresh (int force) {
string action = dgettext (null, "Synchronizing package databases") + "...";
spawn_in_term ({"/usr/bin/echo", action});
progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text ("");
progress_window.cancel_button.set_visible (true);
progress_window.close_button.set_visible (false);
progress_window.show ();
daemon.refresh.begin (force, true, (obj, res) => {
progress_dialog.action_label.set_text (action);
progress_dialog.progressbar.set_fraction (0);
progress_dialog.progressbar.set_text ("");
progress_dialog.cancel_button.set_visible (true);
progress_dialog.close_button.set_visible (false);
progress_dialog.show ();
try {
daemon.refresh.end (res);
daemon.refresh (force, true);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
});
}
public void sysupgrade_simple (int enable_downgrade) {
print ("simple sysupgrade\n");
progress_window.progressbar.set_fraction (0);
progress_window.cancel_button.set_visible (true);
progress_dialog.progressbar.set_fraction (0);
progress_dialog.cancel_button.set_visible (true);
ErrorInfos err = ErrorInfos ();
try {
err = daemon.trans_init (0);
@ -188,16 +196,14 @@ namespace Pamac {
stderr.printf ("IOError: %s\n", e.message);
}
if (err.str == "") {
progress_window.show ();
progress_dialog.show ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
daemon.trans_prepare.begin ((obj, res) => {
try {
daemon.trans_prepare.end (res);
daemon.trans_prepare ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
});
} else {
release ();
finished (true);
@ -209,35 +215,34 @@ namespace Pamac {
public void sysupgrade (int enable_downgrade) {
string action = dgettext (null, "Starting full system upgrade") + "...";
spawn_in_term ({"/usr/bin/echo", action});
progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text ("");
progress_window.cancel_button.set_visible (true);
progress_window.close_button.set_visible (false);
progress_dialog.action_label.set_text (action);
progress_dialog.progressbar.set_fraction (0);
progress_dialog.progressbar.set_text ("");
progress_dialog.cancel_button.set_visible (true);
progress_dialog.close_button.set_visible (false);
while (Gtk.events_pending ())
Gtk.main_iteration ();
// sysupgrade
print ("get syncfirst\n");
// get syncfirst updates
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (alpm_config);
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (handle, syncfirst);
if (syncfirst_updates.length != 0) {
clear_lists ();
if (mode == Mode.MANAGER)
sysupgrade_after_trans = true;
foreach (UpdatesInfos infos in syncfirst_updates)
data.to_add.insert (infos.name, infos.name);
to_add.insert (infos.name, infos.name);
// run as a standard transaction
run ();
} else {
if (pamac_config.enable_aur) {
print ("get aur updates\n");
string[] ignore_pkgs = get_ignore_pkgs (alpm_config);
UpdatesInfos[] aur_updates = get_aur_updates (alpm_config, ignore_pkgs);
UpdatesInfos[] aur_updates = get_aur_updates (handle, ignorepkg);
if (aur_updates.length != 0) {
clear_lists ();
sysupgrade_after_build = true;
foreach (UpdatesInfos infos in aur_updates)
data.to_build.insert (infos.name, infos.name);
to_build.insert (infos.name, infos.name);
}
}
sysupgrade_simple (enable_downgrade);
@ -245,33 +250,33 @@ namespace Pamac {
}
public void clear_lists () {
data.to_add.steal_all ();
data.to_remove.steal_all ();
data.to_build.steal_all ();
to_add.steal_all ();
to_remove.steal_all ();
to_build.steal_all ();
}
public void run () {
string action = dgettext (null,"Preparing") + "...";
spawn_in_term ({"/usr/bin/echo", action});
progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text ("");
progress_window.cancel_button.set_visible (true);
progress_window.close_button.set_visible (false);
progress_window.show ();
progress_dialog.action_label.set_text (action);
progress_dialog.progressbar.set_fraction (0);
progress_dialog.progressbar.set_text ("");
progress_dialog.cancel_button.set_visible (true);
progress_dialog.close_button.set_visible (false);
progress_dialog.show ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
// run
ErrorInfos err = ErrorInfos ();
if (data.to_add.size () == 0
&& data.to_remove.size () == 0
&& data.to_load.size () == 0
&& data.to_build.size () != 0) {
if (to_add.size () == 0
&& to_remove.size () == 0
&& to_load.size () == 0
&& to_build.size () != 0) {
// there only AUR packages to build so no need to prepare transaction
on_emit_trans_prepared (err);
} else {
try {
err = daemon.trans_init (data.flags);
err = daemon.trans_init (flags);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
@ -279,7 +284,7 @@ namespace Pamac {
finished (true);
handle_error (err);
} else {
foreach (string name in data.to_add.get_keys ()) {
foreach (string name in to_add.get_keys ()) {
try {
err = daemon.trans_add_pkg (name);
} catch (IOError e) {
@ -288,7 +293,7 @@ namespace Pamac {
if (err.str != "")
break;
}
foreach (string name in data.to_remove.get_keys ()) {
foreach (string name in to_remove.get_keys ()) {
try {
err = daemon.trans_remove_pkg (name);
} catch (IOError e) {
@ -297,7 +302,7 @@ namespace Pamac {
if (err.str != "")
break;
}
foreach (string path in data.to_load.get_keys ()) {
foreach (string path in to_load.get_keys ()) {
try {
err = daemon.trans_load_pkg (path);
} catch (IOError e) {
@ -307,13 +312,11 @@ namespace Pamac {
break;
}
if (err.str == "") {
daemon.trans_prepare.begin ((obj, res) => {
try {
daemon.trans_prepare.end (res);
daemon.trans_prepare ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
});
} else {
release ();
finished (true);
@ -351,7 +354,7 @@ namespace Pamac {
string[] to_install = {};
string[] to_reinstall = {};
string[] to_update = {};
string[] to_build = {};
string[] _to_build = {};
TreeIter iter;
transaction_sum_dialog.top_label.set_markup ("<big><b>%s</b></big>".printf (dgettext (null, "Transaction Summary")));
transaction_sum_dialog.sum_list.clear ();
@ -363,7 +366,7 @@ namespace Pamac {
}
foreach (UpdatesInfos pkg_info in prepared_to_add) {
dsize += pkg_info.download_size;
unowned Alpm.Package? local_pkg = alpm_config.handle.localdb.get_pkg (pkg_info.name);
unowned Alpm.Package? local_pkg = handle.localdb.get_pkg (pkg_info.name);
if (local_pkg == null) {
to_install += "%s %s".printf (pkg_info.name, pkg_info.version);
} else {
@ -376,8 +379,8 @@ namespace Pamac {
to_downgrade += "%s %s".printf (pkg_info.name, pkg_info.version);
}
}
foreach (string name in data.to_build.get_keys ())
to_build += name;
foreach (string name in to_build.get_keys ())
_to_build += name;
int len = prepared_to_remove.length;
int i;
if (len != 0) {
@ -405,16 +408,16 @@ namespace Pamac {
i++;
}
}
len = to_build.length;
len = _to_build.length;
if (len != 0) {
ret = 0;
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
0, dgettext (null, "To build") + ":",
1, to_build[0]);
1, _to_build[0]);
i = 1;
while (i < len) {
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
1, to_build[i]);
1, _to_build[i]);
i++;
}
}
@ -469,30 +472,29 @@ namespace Pamac {
}
public void commit () {
daemon.trans_commit.begin ((obj, res) => {
progress_dialog.cancel_button.set_visible (false);
try {
daemon.trans_commit.end (res);
daemon.trans_commit ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
});
}
public void build_aur_packages () {
print ("building packages\n");
string action = dgettext (null,"Building packages") + "...";
spawn_in_term ({"/usr/bin/echo", "-n", action});
progress_window.action_label.set_text (action);
progress_window.progressbar.set_fraction (0);
progress_window.progressbar.set_text ("");
progress_window.cancel_button.set_visible (false);
progress_window.close_button.set_visible (false);
progress_window.expander.set_expanded (true);
progress_window.width_request = 700;
progress_dialog.action_label.set_text (action);
progress_dialog.progressbar.set_fraction (0);
progress_dialog.progressbar.set_text ("");
progress_dialog.cancel_button.set_visible (false);
progress_dialog.close_button.set_visible (false);
progress_dialog.expander.set_expanded (true);
progress_dialog.width_request = 700;
term.grab_focus ();
build_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_window.progressbar.pulse);
build_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_dialog.progressbar.pulse);
string[] cmds = {"/usr/bin/yaourt", "-S"};
foreach (string name in data.to_build.get_keys ())
foreach (string name in to_build.get_keys ())
cmds += name;
Pid child_pid;
spawn_in_term (cmds, out child_pid);
@ -538,122 +540,124 @@ namespace Pamac {
switch (event) {
case Event.CHECKDEPS_START:
msg = dgettext (null, "Checking dependencies") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.FILECONFLICTS_START:
msg = dgettext (null, "Checking file conflicts") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.RESOLVEDEPS_START:
msg = dgettext (null, "Resolving dependencies") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.INTERCONFLICTS_START:
msg = dgettext (null, "Checking inter-conflicts") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.ADD_START:
progress_window.cancel_button.set_visible (false);
progress_dialog.cancel_button.set_visible (false);
previous_filename = details[0];
msg = dgettext (null, "Installing %s").printf (details[0]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
msg = dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.REINSTALL_START:
progress_window.cancel_button.set_visible (false);
progress_dialog.cancel_button.set_visible (false);
previous_filename = details[0];
msg = dgettext (null, "Reinstalling %s").printf (details[0]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
msg = dgettext (null, "Reinstalling %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.REMOVE_START:
progress_window.cancel_button.set_visible (false);
progress_dialog.cancel_button.set_visible (false);
previous_filename = details[0];
msg = dgettext (null, "Removing %s").printf (details[0]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
msg = dgettext (null, "Removing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.UPGRADE_START:
progress_window.cancel_button.set_visible (false);
progress_dialog.cancel_button.set_visible (false);
previous_filename = details[0];
msg = dgettext (null, "Upgrading %s").printf (details[0]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
msg = dgettext (null, "Upgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "...";
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DOWNGRADE_START:
progress_window.cancel_button.set_visible (false);
progress_dialog.cancel_button.set_visible (false);
previous_filename = details[0];
msg = dgettext (null, "Downgrading %s").printf (details[0]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
msg = dgettext (null, "Downgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "...";
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.INTEGRITY_START:
msg = dgettext (null, "Checking integrity") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.KEYRING_START:
progress_dialog.cancel_button.set_visible (true);
msg = dgettext (null, "Checking keyring") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.KEY_DOWNLOAD_START:
msg = dgettext (null, "Downloading required keys") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.LOAD_START:
msg = dgettext (null, "Loading packages files") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DELTA_INTEGRITY_START:
msg = dgettext (null, "Checking delta integrity") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DELTA_PATCHES_START:
msg = dgettext (null, "Applying deltas") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DELTA_PATCH_START:
msg = dgettext (null, "Generating %s with %s").printf (details[0], details[1]) + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DELTA_PATCH_DONE:
msg = dgettext (null, "Generation succeeded") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DELTA_PATCH_FAILED:
msg = dgettext (null, "Generation failed") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.SCRIPTLET_INFO:
progress_window.action_label.set_text (dgettext (null, "Configuring %s").printf (previous_filename) + "...");
progress_window.expander.set_expanded (true);
progress_dialog.action_label.set_text (dgettext (null, "Configuring %s").printf (previous_filename) + "...");
progress_dialog.expander.set_expanded (true);
spawn_in_term ({"/usr/bin/echo", details[0]});
break;
case Event.RETRIEVE_START:
progress_dialog.cancel_button.set_visible (true);
msg = dgettext (null, "Downloading") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.DISKSPACE_START:
msg = dgettext (null, "Checking available disk space") + "...";
progress_window.action_label.set_text (msg);
progress_dialog.action_label.set_text (msg);
spawn_in_term ({"/usr/bin/echo", msg});
break;
case Event.OPTDEP_REQUIRED:
@ -695,11 +699,11 @@ namespace Pamac {
string textbar = "%lu/%lu".printf (current_target, n_targets);
if (textbar != previous_textbar) {
previous_textbar = textbar;
progress_window.progressbar.set_text (textbar);
progress_dialog.progressbar.set_text (textbar);
}
if (fraction != previous_percent) {
previous_percent = fraction;
progress_window.progressbar.set_fraction (fraction);
progress_dialog.progressbar.set_fraction (fraction);
}
while (Gtk.events_pending ())
Gtk.main_iteration ();
@ -718,7 +722,7 @@ namespace Pamac {
}
if (label != previous_label) {
previous_label = label;
progress_window.action_label.set_text (label);
progress_dialog.action_label.set_text (label);
spawn_in_term ({"/usr/bin/echo", label});
}
}
@ -731,12 +735,12 @@ namespace Pamac {
}
if (fraction != previous_percent) {
previous_percent = fraction;
progress_window.progressbar.set_fraction (fraction);
progress_dialog.progressbar.set_fraction (fraction);
}
if (textbar != previous_textbar) {
previous_textbar = textbar;
progress_window.progressbar.set_text (textbar);
progress_dialog.progressbar.set_text (textbar);
}
if (xfered == total)
already_downloaded += total;
@ -758,7 +762,7 @@ namespace Pamac {
line = dgettext (null, "Error") + ": " + msg;
}
if (line != null) {
progress_window.expander.set_expanded (true);
progress_dialog.expander.set_expanded (true);
spawn_in_term ({"/usr/bin/echo", "-n", line});
}
}
@ -780,7 +784,7 @@ namespace Pamac {
}
public void handle_error (ErrorInfos error) {
progress_window.expander.set_expanded (true);
progress_dialog.expander.set_expanded (true);
spawn_in_term ({"/usr/bin/echo", "-n", error.str});
TextIter start_iter;
TextIter end_iter;
@ -805,7 +809,7 @@ namespace Pamac {
spawn_in_term ({"/usr/bin/echo"});
transaction_info_dialog.run ();
transaction_info_dialog.hide ();
progress_window.hide ();
progress_dialog.hide ();
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
@ -818,7 +822,7 @@ namespace Pamac {
refresh_alpm_config ();
if (error.str == "") {
if (mode == Mode.UPDATER) {
progress_window.hide ();
progress_dialog.hide ();
finished (false);
} else {
sysupgrade (0);
@ -835,10 +839,10 @@ namespace Pamac {
show_warnings ();
int ret = set_transaction_sum ();
if (ret == 0) {
if (data.to_add.size () == 0
&& data.to_remove.size () == 0
&& data.to_load.size () == 0
&& data.to_build.size () != 0) {
if (to_add.size () == 0
&& to_remove.size () == 0
&& to_load.size () == 0
&& to_build.size () != 0) {
// there only AUR packages to build or we update AUR packages first
release ();
if (transaction_sum_dialog.run () == ResponseType.OK) {
@ -849,7 +853,7 @@ namespace Pamac {
on_emit_trans_committed (err);
} else {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_window.hide ();
progress_dialog.hide ();
transaction_sum_dialog.hide ();
finished (true);
}
@ -864,7 +868,7 @@ namespace Pamac {
commit ();
} else {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_window.hide ();
progress_dialog.hide ();
transaction_sum_dialog.hide ();
release ();
finished (true);
@ -875,7 +879,7 @@ namespace Pamac {
//ErrorInfos err = ErrorInfos ();
//err.str = dgettext (null, "Nothing to do") + "\n";
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Nothing to do") + ".\n"});
progress_window.hide ();
progress_dialog.hide ();
release ();
clear_lists ();
finished (false);
@ -890,16 +894,16 @@ namespace Pamac {
public void on_emit_trans_committed (ErrorInfos error) {
print ("transaction committed\n");
if (error.str == "") {
if (data.to_build.size () != 0) {
if (data.to_add.size () != 0
|| data.to_remove.size () != 0
|| data.to_load.size () != 0) {
if (to_build.size () != 0) {
if (to_add.size () != 0
|| to_remove.size () != 0
|| to_load.size () != 0) {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + ".\n"});
}
build_aur_packages ();
} else {
//progress_window.action_label.set_text (dgettext (null, "Transaction successfully finished"));
//progress_window.close_button.set_visible (true);
//progress_dialog.action_label.set_text (dgettext (null, "Transaction successfully finished"));
//progress_dialog.close_button.set_visible (true);
clear_lists ();
show_warnings ();
refresh_alpm_config ();
@ -913,7 +917,7 @@ namespace Pamac {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + ".\n"});
else
spawn_in_term ({"/usr/bin/echo"});
progress_window.hide ();
progress_dialog.hide ();
finished (false);
}
}
@ -929,13 +933,8 @@ namespace Pamac {
void on_term_child_exited (int status) {
Source.remove (build_timeout_id);
data.to_build.steal_all ();
to_build.steal_all ();
build_status = status;
try {
daemon.refresh_alpm_config ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
ErrorInfos err = ErrorInfos ();
on_emit_trans_committed (err);
}

View File

@ -29,7 +29,7 @@ const string noupdate_info = _("Your system is up-to-date");
namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
public interface Daemon : Object {
public abstract async void refresh (int force, bool emit_signal) throws IOError;
public abstract void refresh (int force, bool emit_signal) throws IOError;
public abstract UpdatesInfos[] get_updates () throws IOError;
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
@ -76,7 +76,7 @@ namespace Pamac {
item = new Gtk.MenuItem.with_label (_("Package Manager"));
item.activate.connect (execute_manager);
menu.append (item);
item = new Gtk.MenuItem.with_label (_("Quit"));
item = new Gtk.MenuItem.with_mnemonic (_("_Quit"));
item.activate.connect (this.release);
menu.append (item);
menu.show_all ();
@ -115,13 +115,11 @@ namespace Pamac {
bool refresh () {
start_daemon ();
daemon.refresh.begin (1, false, (obj, res) => {
try {
daemon.refresh.end (res);
daemon.refresh (0, false);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
});
return true;
}
@ -141,7 +139,6 @@ namespace Pamac {
if (pamac_run == false)
show_notification (one_update_info);
} else {
// workaround to use python format string
string info = update_info.printf (updates_nb);
this.update_icon (update_icon_name, info);
if (pamac_run == false)
@ -153,10 +150,10 @@ namespace Pamac {
void show_notification (string info) {
//~ notification = new Notification (_("Update Manager"));
//~ notification.set_body (info);
//~ Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default ();
//~ Gdk.Pixbuf icon = icon_theme.load_icon ("system-software-update", 32, 0);
//~ notification.set_icon (icon);
//~ notification.set_body (info);
//~ var action = new SimpleAction ("update", null);
//~ action.activate.connect (execute_updater);
//~ this.add_action (action);
@ -235,7 +232,7 @@ namespace Pamac {
create_menu ();
status_icon.popup_menu.connect (menu_popup);
Notify.init(_("Update Manager"));
Notify.init (_("Update Manager"));
refresh ();
launch_refresh_timeout ();

View File

@ -127,7 +127,7 @@ namespace Pamac {
uint updates_nb = 0;
updates_list.clear ();
// get syncfirst updates
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (transaction.alpm_config);
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (transaction.handle, transaction.syncfirst);
if (syncfirst_updates.length != 0) {
updates_nb = syncfirst_updates.length;
foreach (UpdatesInfos infos in syncfirst_updates) {
@ -140,8 +140,7 @@ namespace Pamac {
updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
}
} else {
string[] ignore_pkgs = get_ignore_pkgs (transaction.alpm_config);
UpdatesInfos[] updates = get_repos_updates (transaction.alpm_config, ignore_pkgs);
UpdatesInfos[] updates = get_repos_updates (transaction.handle, transaction.ignorepkg);
foreach (UpdatesInfos infos in updates) {
name = infos.name + " " + infos.version;
if (infos.download_size != 0)
@ -153,7 +152,7 @@ namespace Pamac {
}
updates_nb += updates.length;
if (pamac_config.enable_aur) {
UpdatesInfos[] aur_updates = get_aur_updates (transaction.alpm_config, ignore_pkgs);
UpdatesInfos[] aur_updates = get_aur_updates (transaction.handle, transaction.ignorepkg);
updates_nb += aur_updates.length;
foreach (UpdatesInfos infos in aur_updates) {
name = infos.name + " " + infos.version;

View File

@ -25,6 +25,10 @@ void* alpm_list_get_data (alpm_list_t *list) {
return list->data;
}
void* alpm_list_nth_data (alpm_list_t *list, size_t n) {
return alpm_list_nth (list, n)->data;
}
alpm_list_t* alpm_list_remove_data (alpm_list_t *list, const void *needle, alpm_list_fn_cmp fn) {
void *data = NULL;
list = alpm_list_remove (list, needle, fn, data);

View File

@ -8,6 +8,7 @@ typedef struct __alpm_list_iterator_t {
} alpm_list_iterator_t;
void* alpm_list_get_data(alpm_list_t *list);
void* alpm_list_nth_data (alpm_list_t *list, size_t n);
alpm_list_t *alpm_list_remove_data(alpm_list_t *list, const void *needle, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_sort_data(alpm_list_t *list, alpm_list_fn_cmp fn);
void alpm_list_free_all(alpm_list_t *list);

View File

@ -142,9 +142,6 @@ namespace Alpm {
[CCode (cname = "alpm_initialize")]
public Handle (string root, string dbpath, out Alpm.Errno error);
//[CCode (cname = "alpm_release")]
//public int release();
public unowned string root {
[CCode (cname = "alpm_option_get_root")] get;
}
@ -155,7 +152,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_get_arch")] get;
[CCode (cname = "alpm_option_set_arch")] set;
}
public unowned Alpm.List<string?> cachedirs {
public unowned Alpm.List<unowned string?> cachedirs {
[CCode (cname = "alpm_option_get_cachedirs")] get;
[CCode (cname = "alpm_option_set_cachedirs")] set;
}
@ -180,7 +177,7 @@ namespace Alpm {
/** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */
[CCode (cname = "alpm_option_set_usesyslog")] set;
}
public unowned Alpm.List<string?> noupgrades {
public unowned Alpm.List<unowned string?> noupgrades {
[CCode (cname = "alpm_option_get_noupgrades")] get;
[CCode (cname = "alpm_option_set_noupgrades")] set;
}
@ -189,7 +186,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_noupgrade")]
public int remove_noupgrade(string pkg);
public unowned Alpm.List<string?> noextracts {
public unowned Alpm.List<unowned string?> noextracts {
[CCode (cname = "alpm_option_get_noextracts")] get;
[CCode (cname = "alpm_option_set_noextracts")] set;
}
@ -198,7 +195,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_noextract")]
public int remove_noextract(string pkg);
public unowned Alpm.List<string?> ignorepkgs {
public unowned Alpm.List<unowned string?> ignorepkgs {
[CCode (cname = "alpm_option_get_ignorepkgs")] get;
[CCode (cname = "alpm_option_set_ignorepkgs")] set;
}
@ -207,7 +204,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_ignorepkg")]
public int remove_ignorepkg(string pkg);
public unowned Alpm.List<string?> ignoregroups {
public unowned Alpm.List<unowned string?> ignoregroups {
[CCode (cname = "alpm_option_get_ignoregroups")] get;
[CCode (cname = "alpm_option_set_ignoregroups")] set;
}
@ -226,6 +223,10 @@ namespace Alpm {
[CCode (cname = "alpm_option_set_checkspace")] set;
}
public SigLevel defaultsiglevel {
[CCode (cname = "alpm_option_get_default_siglevel")] get;
[CCode (cname = "alpm_option_set_default_siglevel")] set;
}
public SigLevel localfilesiglevel {
[CCode (cname = "alpm_option_get_local_file_siglevel")] get;
[CCode (cname = "alpm_option_set_local_file_siglevel")] set;
@ -250,8 +251,10 @@ namespace Alpm {
[CCode (cname = "alpm_get_syncdbs")] get;
}
// the return package can be freed except if it is added to a transaction,
// it will be freed upon Handle.trans_release() invocation.
[CCode (cname = "alpm_pkg_load_file")]
public unowned Package? load_file(string filename, int full, SigLevel level);
public Package? load_file(string filename, int full, SigLevel level);
//~ /** Test if a package should be ignored.
//~ * Checks if the package is ignored via IgnorePkg, or if the package is
@ -394,11 +397,11 @@ namespace Alpm {
[CCode (cname = "alpm_db_get_siglevel")] get;
}
public unowned string url {
[CCode (cname = "alpm_db_get_url")] get;
}
//~ public unowned string url {
//~ [CCode (cname = "alpm_db_get_url")] get;
//~ }
public unowned Alpm.List<string?> servers {
public unowned Alpm.List<unowned string?> servers {
[CCode (cname = "alpm_db_get_servers")] get;
[CCode (cname = "alpm_db_set_servers")] set;
}
@ -425,14 +428,13 @@ namespace Alpm {
/**
* Packages
*/
[CCode (cname = "alpm_pkg_t", cprefix = "alpm_pkg_",
free_function = "alpm_pkg_free")]
[CCode (cname = "alpm_pkg_t", cprefix = "alpm_pkg_", free_function = "alpm_pkg_free")]
[Compact]
public class Package {
public static int checkmd5sum();
public unowned Alpm.List<string?> compute_requiredby();
public unowned Alpm.List<string?> compute_optionalfor();
public Alpm.List<string?> compute_requiredby();
public Alpm.List<string?> compute_optionalfor();
/* properties */
[CCode (array_length = false)]
@ -476,9 +478,14 @@ namespace Alpm {
public unowned string arch {
[CCode (cname = "alpm_pkg_get_arch")] get;
}
/** Returns the size of the package. This is only available for sync database
* packages and package files, not those loaded from the local database.
*/
public uint64 size {
[CCode (cname = "alpm_pkg_get_size")] get;
}
public uint64 isize {
[CCode (cname = "alpm_pkg_get_isize")] get;
}
@ -487,16 +494,15 @@ namespace Alpm {
}
public PkgReason reason {
[CCode (cname = "alpm_pkg_get_reason")] get;
/** The provided package object must be from the local database or this method
* will fail. The write to the local database is performed immediately.
* @return 0 on success, -1 on error (Errno is set accordingly)
/** The provided package object must be from the local database
* or this method will fail (Errno is set accordingly).
*/
[CCode (cname = "alpm_pkg_set_reason")] set;
}
public unowned Alpm.List<string?> licenses {
public unowned Alpm.List<unowned string?> licenses {
[CCode (cname = "alpm_pkg_get_licenses")] get;
}
public unowned Alpm.List<string?> groups {
public unowned Alpm.List<unowned string?> groups {
[CCode (cname = "alpm_pkg_get_groups")] get;
}
public unowned Alpm.List<Depend?> depends {
@ -538,7 +544,7 @@ namespace Alpm {
public ulong name_hash;
public DepMod mod;
[CCode (cname = "alpm_dep_compute_string")]
public unowned string compute_string();
public string compute_string();
}
/** Missing dependency */
@ -954,8 +960,7 @@ namespace Alpm {
}
[CCode (cprefix = "alpm_list_", cheader_filename = "alpm_list.h,alpm-util.h",
cname = "alpm_list_t", type_parameters = "G",
free_function = "alpm_list_free")]
cname = "alpm_list_t", type_parameters = "G", free_function = "alpm_list_free_all")]
[Compact]
public class List<G> {
/* Comparator*/
@ -966,30 +971,40 @@ namespace Alpm {
public size_t length {
[CCode (cname = "alpm_list_count")] get;
}
public unowned G? data {
[CCode (cname = "alpm_list_get_data")] get;
}
/* item mutators */
[ReturnsModifiedPointer ()]
public unowned void add(G data);
[ReturnsModifiedPointer ()]
public unowned void join(List<G> list);
[CCode (cname = "alpm_list_sort_data"), ReturnsModifiedPointer ()]
public unowned void sort(CompareFunc fn);
[CCode (cname = "alpm_list_remove_data"), ReturnsModifiedPointer ()]
public unowned void? remove(G data, CompareFunc fn);
public List<G> copy();
[ReturnsModifiedPointer ()]
public unowned void reverse ();
/* item accessors */
public unowned List<G>? first();
public unowned List<G>? last();
public unowned List<G>? nth(size_t n);
public unowned List<G>? nth(size_t index);
public unowned List<G>? next();
public unowned List<G>? previous();
public unowned G get_data();
public unowned G? nth_data(size_t index);
/* misc */
public unowned string? find_str(string needle);
/** @return a list containing all items in `this` not present in `list` */
public unowned List<G>? diff(List<G>? list, CompareFunc fn);