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/choose_provider_dialog.ui
resources/packages_chooser_dialog.ui resources/packages_chooser_dialog.ui
resources/progress_window.ui resources/progress_dialog.ui
resources/history_dialog.ui resources/history_dialog.ui
resources/transaction_info_dialog.ui resources/transaction_info_dialog.ui
resources/transaction_sum_dialog.ui resources/transaction_sum_dialog.ui
@ -21,6 +21,6 @@ src/preferences_dialog.vala
src/updater.vala src/updater.vala
src/choose_provider_dialog.vala src/choose_provider_dialog.vala
src/manager_window.vala src/manager_window.vala
src/progress_window.vala src/progress_dialog.vala
src/updater_window.vala src/updater_window.vala
src/common.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. # This file is distributed under the same license as the Pamac package.
# Guillaume Benoit <guillaume@manjaro.org>, 2013-2014. # Guillaume Benoit <guillaume@manjaro.org>, 2013-2014.
# #
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pamac 2.0\n" "Project-Id-Version: pamac 2.0\n"
@ -20,19 +21,40 @@ msgstr ""
msgid "Authentication is required" msgid "Authentication is required"
msgstr "" msgstr ""
#: resources/choose_provider_dialog.ui:7 #: resources/choose_provider_dialog.ui:7
msgid "Choose a Provider" msgid "Choose a Provider"
msgstr "" 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" msgid "Install local packages"
msgstr "" 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" msgid "Progress"
msgstr "" 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 #: resources/manager_window.ui:707
msgid "Details" msgid "Details"
msgstr "" msgstr ""
@ -41,7 +63,7 @@ msgstr ""
msgid "Pamac History" msgid "Pamac History"
msgstr "" msgstr ""
#: resources/transaction_sum_dialog.ui:6 src/transaction.vala:356 #: resources/transaction_sum_dialog.ui:6 src/transaction.vala:359
msgid "Transaction Summary" msgid "Transaction Summary"
msgstr "" msgstr ""
@ -50,7 +72,7 @@ msgid "Package Manager"
msgstr "" msgstr ""
#: resources/manager_window.ui:23 #: resources/manager_window.ui:23
msgid "Refresh" msgid "Refresh databases"
msgstr "" msgstr ""
#: resources/manager_window.ui:47 #: resources/manager_window.ui:47
@ -58,7 +80,7 @@ msgid "Apply changes"
msgstr "" msgstr ""
#: resources/manager_window.ui:71 #: resources/manager_window.ui:71
msgid "Cancel" msgid "Cancel all planned changes"
msgstr "" msgstr ""
#: resources/manager_window.ui:170 #: resources/manager_window.ui:170
@ -69,7 +91,7 @@ msgstr ""
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: resources/manager_window.ui:279 src/manager_window.vala:336 #: resources/manager_window.ui:279 src/manager_window.vala:337
msgid "Groups" msgid "Groups"
msgstr "" msgstr ""
@ -89,7 +111,7 @@ msgstr ""
msgid "Version" msgid "Version"
msgstr "" msgstr ""
#: resources/manager_window.ui:463 src/manager_window.vala:328 #: resources/manager_window.ui:463 src/manager_window.vala:329
msgid "Repository" msgid "Repository"
msgstr "" msgstr ""
@ -109,42 +131,58 @@ msgstr ""
msgid "Files" msgid "Files"
msgstr "" msgstr ""
#: resources/manager_window.ui:779 #: resources/manager_window.ui:767
msgid "View History" msgid "View History"
msgstr "" msgstr ""
#: resources/updater_window.ui:14 src/tray.vala:73 src/tray.vala:166 #: resources/manager_window.ui:783 resources/updater_window.ui:108
#: src/tray.vala:238 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" msgid "Update Manager"
msgstr "" msgstr ""
#: resources/updater_window.ui:135
msgid "_Refresh"
msgstr ""
#: resources/updater_window.ui:149
msgid "_Apply"
msgstr ""
#: resources/preferences_dialog.ui:6 #: resources/preferences_dialog.ui:6
msgid "Pamac Preferences" msgid "Pamac Preferences"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:74 #: resources/preferences_dialog.ui:71
msgid "Enable AUR support" msgid "Enable AUR support"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:87 #: resources/preferences_dialog.ui:84
msgid "Allow Pamac to search and install packages from AUR" msgid "Allow Pamac to search and install packages from AUR"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:105 #: resources/preferences_dialog.ui:102
msgid "Remove unrequired dependencies" msgid "Remove unrequired dependencies"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:118 #: resources/preferences_dialog.ui:115
msgid "" msgid ""
"When removing a package, also remove its dependencies that are not required " "When removing a package, also remove its dependencies that are not required "
"by other packages" "by other packages"
msgstr "" 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" msgid "How often to check for updates, value in hours"
msgstr "" msgstr ""
#: resources/preferences_dialog.ui:177 #: resources/preferences_dialog.ui:173
msgid "Options" msgid "Options"
msgstr "" msgstr ""
@ -152,342 +190,346 @@ msgstr ""
msgid "Packages" msgid "Packages"
msgstr "" 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" msgid "Failed to synchronize any databases"
msgstr "" msgstr ""
#: src/daemon.vala:162 #: src/daemon.vala:161
msgid "Failed to init transaction" msgid "Failed to init transaction"
msgstr "" msgstr ""
#: src/daemon.vala:174 src/daemon.vala:192 src/daemon.vala:204 #: src/daemon.vala:173 src/daemon.vala:191 src/daemon.vala:203
#: src/daemon.vala:218 src/daemon.vala:230 src/daemon.vala:245 #: src/daemon.vala:217 src/daemon.vala:229 src/daemon.vala:246
#: src/daemon.vala:252 src/daemon.vala:266 src/daemon.vala:316 #: src/daemon.vala:253 src/daemon.vala:267 src/daemon.vala:317
msgid "Failed to prepare transaction" msgid "Failed to prepare transaction"
msgstr "" msgstr ""
#: src/daemon.vala:193 src/daemon.vala:246 #: src/daemon.vala:192 src/daemon.vala:247
#, c-format #, c-format
msgid "target not found: %s" msgid "target not found: %s"
msgstr "" msgstr ""
#: src/daemon.vala:274 #: src/daemon.vala:275
#, c-format #, c-format
msgid "package %s does not have a valid architecture" msgid "package %s does not have a valid architecture"
msgstr "" msgstr ""
#: src/daemon.vala:283 #: src/daemon.vala:284
#, c-format #, c-format
msgid "%s: requires %s" msgid "%s: requires %s"
msgstr "" msgstr ""
#: src/daemon.vala:291 #: src/daemon.vala:292
#, c-format #, c-format
msgid "%s and %s are in conflict" msgid "%s and %s are in conflict"
msgstr "" msgstr ""
#: src/daemon.vala:310 #: src/daemon.vala:311
#, c-format #, c-format
msgid "%s needs to be removed but it is a locked package" msgid "%s needs to be removed but it is a locked package"
msgstr "" msgstr ""
#: src/daemon.vala:378 #: src/daemon.vala:380
msgid "Failed to commit transaction" msgid "Failed to commit transaction"
msgstr "" msgstr ""
#: src/daemon.vala:392 #: src/daemon.vala:394
#, c-format #, c-format
msgid "%s exists in both %s and %s" msgid "%s exists in both %s and %s"
msgstr "" msgstr ""
#: src/daemon.vala:395 #: src/daemon.vala:397
#, c-format #, c-format
msgid "%s: %s already exists in filesystem" msgid "%s: %s already exists in filesystem"
msgstr "" msgstr ""
#: src/daemon.vala:408 #: src/daemon.vala:410
#, c-format #, c-format
msgid "%s is invalid or corrupted" msgid "%s is invalid or corrupted"
msgstr "" msgstr ""
#: src/daemon.vala:436 #: src/daemon.vala:442
msgid "Authentication failed" msgid "Authentication failed"
msgstr "" msgstr ""
#: src/transaction.vala:154 #: src/transaction.vala:164
msgid "Synchronizing package databases" msgid "Synchronizing package databases"
msgstr "" msgstr ""
#: src/transaction.vala:210 #: src/transaction.vala:216
msgid "Starting full system upgrade" msgid "Starting full system upgrade"
msgstr "" msgstr ""
#: src/transaction.vala:254 #: src/transaction.vala:259
msgid "Preparing" msgid "Preparing"
msgstr "" msgstr ""
#: src/transaction.vala:328 #: src/transaction.vala:331
#, c-format #, c-format
msgid "Choose a provider for %s" msgid "Choose a provider for %s"
msgstr "" msgstr ""
#: src/transaction.vala:386 src/manager_window.vala:187 #: src/transaction.vala:389 src/manager_window.vala:188
#: src/manager_window.vala:731 #: src/manager_window.vala:731
msgid "To remove" msgid "To remove"
msgstr "" msgstr ""
#: src/transaction.vala:399 #: src/transaction.vala:402
msgid "To downgrade" msgid "To downgrade"
msgstr "" msgstr ""
#: src/transaction.vala:412 #: src/transaction.vala:415
msgid "To build" msgid "To build"
msgstr "" msgstr ""
#: src/transaction.vala:425 src/manager_window.vala:186 #: src/transaction.vala:428 src/manager_window.vala:187
#: src/manager_window.vala:720 #: src/manager_window.vala:720
msgid "To install" msgid "To install"
msgstr "" msgstr ""
#: src/transaction.vala:438 #: src/transaction.vala:441
msgid "To reinstall" msgid "To reinstall"
msgstr "" msgstr ""
#: src/transaction.vala:452 #: src/transaction.vala:455
msgid "To update" msgid "To update"
msgstr "" msgstr ""
#: src/transaction.vala:465 src/updater_window.vala:180 #: src/transaction.vala:468 src/updater_window.vala:179
msgid "Total download size" msgid "Total download size"
msgstr "" msgstr ""
#: src/transaction.vala:483 #: src/transaction.vala:485
msgid "Building packages" msgid "Building packages"
msgstr "" msgstr ""
#: src/transaction.vala:540 #: src/transaction.vala:542
msgid "Checking dependencies" msgid "Checking dependencies"
msgstr "" msgstr ""
#: src/transaction.vala:545 #: src/transaction.vala:547
msgid "Checking file conflicts" msgid "Checking file conflicts"
msgstr "" msgstr ""
#: src/transaction.vala:550 #: src/transaction.vala:552
msgid "Resolving dependencies" msgid "Resolving dependencies"
msgstr "" msgstr ""
#: src/transaction.vala:555 #: src/transaction.vala:557
msgid "Checking inter-conflicts" msgid "Checking inter-conflicts"
msgstr "" msgstr ""
#: src/transaction.vala:562 src/transaction.vala:564 #: src/transaction.vala:564 src/transaction.vala:566
#, c-format #, c-format
msgid "Installing %s" msgid "Installing %s"
msgstr "" msgstr ""
#: src/transaction.vala:570 src/transaction.vala:572 #: src/transaction.vala:572 src/transaction.vala:574
#, c-format #, c-format
msgid "Reinstalling %s" msgid "Reinstalling %s"
msgstr "" msgstr ""
#: src/transaction.vala:578 src/transaction.vala:580 #: src/transaction.vala:580 src/transaction.vala:582
#, c-format #, c-format
msgid "Removing %s" msgid "Removing %s"
msgstr "" msgstr ""
#: src/transaction.vala:586 src/transaction.vala:588 #: src/transaction.vala:588 src/transaction.vala:590
#, c-format #, c-format
msgid "Upgrading %s" msgid "Upgrading %s"
msgstr "" msgstr ""
#: src/transaction.vala:594 src/transaction.vala:596 #: src/transaction.vala:596 src/transaction.vala:598
#, c-format #, c-format
msgid "Downgrading %s" msgid "Downgrading %s"
msgstr "" msgstr ""
#: src/transaction.vala:600 #: src/transaction.vala:602
msgid "Checking integrity" msgid "Checking integrity"
msgstr "" msgstr ""
#: src/transaction.vala:605 #: src/transaction.vala:608
msgid "Checking keyring" msgid "Checking keyring"
msgstr "" msgstr ""
#: src/transaction.vala:610 #: src/transaction.vala:613
msgid "Downloading required keys" msgid "Downloading required keys"
msgstr "" msgstr ""
#: src/transaction.vala:615 #: src/transaction.vala:618
msgid "Loading packages files" msgid "Loading packages files"
msgstr "" msgstr ""
#: src/transaction.vala:620 #: src/transaction.vala:623
msgid "Checking delta integrity" msgid "Checking delta integrity"
msgstr "" msgstr ""
#: src/transaction.vala:625 #: src/transaction.vala:628
msgid "Applying deltas" msgid "Applying deltas"
msgstr "" msgstr ""
#: src/transaction.vala:630 #: src/transaction.vala:633
#, c-format #, c-format
msgid "Generating %s with %s" msgid "Generating %s with %s"
msgstr "" msgstr ""
#: src/transaction.vala:635 #: src/transaction.vala:638
msgid "Generation succeeded" msgid "Generation succeeded"
msgstr "" msgstr ""
#: src/transaction.vala:640 #: src/transaction.vala:643
msgid "Generation failed" msgid "Generation failed"
msgstr "" msgstr ""
#: src/transaction.vala:645 #: src/transaction.vala:648
#, c-format #, c-format
msgid "Configuring %s" msgid "Configuring %s"
msgstr "" msgstr ""
#: src/transaction.vala:650 #: src/transaction.vala:654
msgid "Downloading" msgid "Downloading"
msgstr "" msgstr ""
#: src/transaction.vala:655 #: src/transaction.vala:659
msgid "Checking available disk space" msgid "Checking available disk space"
msgstr "" msgstr ""
#: src/transaction.vala:660 #: src/transaction.vala:664
#, c-format #, c-format
msgid "%s optionally requires %s" msgid "%s optionally requires %s"
msgstr "" msgstr ""
#: src/transaction.vala:663 #: src/transaction.vala:667
#, c-format #, c-format
msgid "Database file for %s does not exist" msgid "Database file for %s does not exist"
msgstr "" msgstr ""
#: src/transaction.vala:715 #: src/transaction.vala:719
#, c-format #, c-format
msgid "Refreshing %s" msgid "Refreshing %s"
msgstr "" msgstr ""
#: src/transaction.vala:717 #: src/transaction.vala:721
#, c-format #, c-format
msgid "Downloading %s" msgid "Downloading %s"
msgstr "" msgstr ""
#: src/transaction.vala:754 src/transaction.vala:768 #: src/transaction.vala:758 src/transaction.vala:772
msgid "Warning" msgid "Warning"
msgstr "" msgstr ""
#: src/transaction.vala:758 src/transaction.vala:787 #: src/transaction.vala:762 src/transaction.vala:791
msgid "Error" msgid "Error"
msgstr "" msgstr ""
#: src/transaction.vala:851 src/transaction.vala:866 #: src/transaction.vala:855 src/transaction.vala:870
#: src/progress_window.vala:55 #: src/progress_dialog.vala:55
msgid "Transaction cancelled" msgid "Transaction cancelled"
msgstr "" msgstr ""
#: src/transaction.vala:877 #: src/transaction.vala:881
msgid "Nothing to do" msgid "Nothing to do"
msgstr "" msgstr ""
#: src/transaction.vala:897 src/transaction.vala:913 #: src/transaction.vala:901 src/transaction.vala:917
msgid "Transaction successfully finished" msgid "Transaction successfully finished"
msgstr "" msgstr ""
#: src/tray.vala:24 src/updater_window.vala:176 #: src/tray.vala:24 src/updater_window.vala:175
#, c-format #, c-format
msgid "%u available updates" msgid "%u available updates"
msgstr "" msgstr ""
#: src/tray.vala:25 src/updater_window.vala:173 #: src/tray.vala:25 src/updater_window.vala:172
msgid "1 available update" msgid "1 available update"
msgstr "" 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" msgid "Your system is up-to-date"
msgstr "" msgstr ""
#: src/tray.vala:79 #: src/tray.vala:79
msgid "Quit" msgid "_Quit"
msgstr "" msgstr ""
#: src/tray.vala:167 #: src/tray.vala:164
msgid "Show available updates" msgid "Show available updates"
msgstr "" msgstr ""
#: src/manager_window.vala:179 src/manager_window.vala:777 #: src/manager_window.vala:180 src/manager_window.vala:777
msgid "local" msgid "local"
msgstr "" msgstr ""
#: src/manager_window.vala:183 src/manager_window.vala:250 #: src/manager_window.vala:184 src/manager_window.vala:251
#: src/manager_window.vala:262 src/manager_window.vala:737 #: src/manager_window.vala:263 src/manager_window.vala:737
msgid "Installed" msgid "Installed"
msgstr "" msgstr ""
#: src/manager_window.vala:185 src/manager_window.vala:751 #: src/manager_window.vala:186 src/manager_window.vala:751
msgid "Orphans" msgid "Orphans"
msgstr "" msgstr ""
#: src/manager_window.vala:210 #: src/manager_window.vala:211
msgid "Licenses" msgid "Licenses"
msgstr "" msgstr ""
#: src/manager_window.vala:232 #: src/manager_window.vala:233
msgid "Depends On" msgid "Depends On"
msgstr "" msgstr ""
#: src/manager_window.vala:252 #: src/manager_window.vala:253
msgid "Optional Dependencies" msgid "Optional Dependencies"
msgstr "" msgstr ""
#: src/manager_window.vala:272 #: src/manager_window.vala:273
msgid "Required By" msgid "Required By"
msgstr "" msgstr ""
#: src/manager_window.vala:286 #: src/manager_window.vala:287
msgid "Provides" msgid "Provides"
msgstr "" msgstr ""
#: src/manager_window.vala:299 #: src/manager_window.vala:300
msgid "Replaces" msgid "Replaces"
msgstr "" msgstr ""
#: src/manager_window.vala:312 #: src/manager_window.vala:313
msgid "Conflicts With" msgid "Conflicts With"
msgstr "" msgstr ""
#: src/manager_window.vala:346 #: src/manager_window.vala:347
msgid "Packager" msgid "Packager"
msgstr "" msgstr ""
#: src/manager_window.vala:352 #: src/manager_window.vala:353
msgid "Install Date" msgid "Install Date"
msgstr "" msgstr ""
#: src/manager_window.vala:356 #: src/manager_window.vala:357
msgid "Explicitly installed" msgid "Explicitly installed"
msgstr "" msgstr ""
#: src/manager_window.vala:358 #: src/manager_window.vala:359
msgid "Installed as a dependency for another package" msgid "Installed as a dependency for another package"
msgstr "" msgstr ""
#: src/manager_window.vala:360 #: src/manager_window.vala:361
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""
#: src/manager_window.vala:362 #: src/manager_window.vala:363
msgid "Install Reason" msgid "Install Reason"
msgstr "" msgstr ""
#: src/manager_window.vala:367 #: src/manager_window.vala:368
msgid "Signatures" msgid "Signatures"
msgstr "" msgstr ""
#: src/manager_window.vala:375 #: src/manager_window.vala:376
msgid "Backup files" msgid "Backup files"
msgstr "" msgstr ""
@ -503,12 +545,12 @@ msgstr ""
msgid "A Gtk3 frontend for libalpm" msgid "A Gtk3 frontend for libalpm"
msgstr "" msgstr ""
#: src/common.vala:62 #: src/common.vala:48
#, c-format #, c-format
msgid "%.0f KiB" msgid "%.0f KiB"
msgstr "" msgstr ""
#: src/common.vala:65 #: src/common.vala:51
#, c-format #, c-format
msgid "%.2f MiB" msgid "%.2f MiB"
msgstr "" msgstr ""

View File

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

View File

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

View File

@ -20,17 +20,16 @@
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="close_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -38,7 +37,6 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -63,7 +61,6 @@
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

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

View File

@ -26,32 +26,30 @@
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="package_cancel_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="package_open_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -59,7 +57,6 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<gresources> <gresources>
<gresource prefix="/org/manjaro/pamac/transaction"> <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">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file> <file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_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> <file preprocess="xml-stripblanks">preferences_dialog.ui</file>
</gresource> </gresource>
<gresource prefix="/org/manjaro/pamac/transaction"> <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">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file> <file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_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> <file preprocess="xml-stripblanks">preferences_dialog.ui</file>
</gresource> </gresource>
<gresource prefix="/org/manjaro/pamac/transaction"> <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">choose_provider_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file> <file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file>
<file preprocess="xml-stripblanks">transaction_info_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="can_focus">False</property>
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="preferences_valid_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property> <property name="has_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property> <property name="use_underline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="preferences_close_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -51,7 +49,6 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property> <property name="pack_type">end</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -165,7 +162,6 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -184,14 +180,13 @@
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="-5">preferences_valid_button</action-widget> <action-widget response="-5">valid_button</action-widget>
<action-widget response="-7">preferences_close_button</action-widget> <action-widget response="-7">close_button</action-widget>
</action-widgets> </action-widgets>
</template> </template>
<object class="GtkAdjustment" id="adjustment"> <object class="GtkAdjustment" id="adjustment">

View File

@ -1,29 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<template class="PamacProgressWindow" parent="GtkWindow"> <template class="PamacProgressDialog" parent="GtkDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="title" translatable="yes">Progress</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="window_position">center-on-parent</property> <property name="window_position">center-on-parent</property>
<property name="default_width">500</property> <property name="default_width">500</property>
<property name="icon_name">system-software-install</property> <property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="deletable">False</property> <property name="deletable">False</property>
<child type="titlebar"> <child internal-child="vbox">
<object class="GtkHeaderBar" id="manager_headerbar"> <object class="GtkBox" id="dialog-vbox1">
<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">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">0</property> <property name="border_width">0</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</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> <child>
<object class="GtkLabel" id="action_label"> <object class="GtkLabel" id="action_label">
<property name="visible">True</property> <property name="visible">True</property>
@ -32,7 +62,6 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -45,7 +74,6 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -67,49 +95,13 @@
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">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> </packing>
</child> </child>
</object> </object>
</child> </child>
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
</template> </template>
</interface> </interface>

View File

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

View File

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

View File

@ -105,11 +105,11 @@
<property name="layout_style">start</property> <property name="layout_style">start</property>
<child> <child>
<object class="GtkButton" id="preferences_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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"/> <signal name="clicked" handler="on_preferences_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
@ -132,11 +132,11 @@
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="refresh_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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"/> <signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
@ -146,11 +146,11 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="apply_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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"/> <signal name="clicked" handler="on_apply_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>
@ -160,11 +160,11 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="close_button"> <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="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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"/> <signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
</object> </object>
<packing> <packing>

View File

@ -6,6 +6,7 @@ COMMON_VALA_FLAGS = --pkg=libalpm \
--vapidir=../vapi \ --vapidir=../vapi \
--Xcc=-I../util \ --Xcc=-I../util \
-X -D_FILE_OFFSET_BITS=64 \ -X -D_FILE_OFFSET_BITS=64 \
-X -DGETTEXT_PACKAGE="pamac" \
--target-glib=2.38 --target-glib=2.38
COMMON_SOURCES = ../util/alpm-util.c \ COMMON_SOURCES = ../util/alpm-util.c \
@ -20,7 +21,7 @@ MANAGER_RESOURCES_FILES = ../resources/manager_window.ui \
../resources/packages_chooser_dialog.ui \ ../resources/packages_chooser_dialog.ui \
../resources/history_dialog.ui \ ../resources/history_dialog.ui \
../resources/preferences_dialog.ui \ ../resources/preferences_dialog.ui \
../resources/progress_window.ui \ ../resources/progress_dialog.ui \
../resources/choose_provider_dialog.ui \ ../resources/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \ ../resources/transaction_sum_dialog.ui \
../resources/transaction_info_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 \ UPDATER_RESOURCES_FILES = ../resources/updater_window.ui \
../resources/preferences_dialog.ui \ ../resources/preferences_dialog.ui \
../resources/progress_window.ui \ ../resources/progress_dialog.ui \
../resources/choose_provider_dialog.ui \ ../resources/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \ ../resources/transaction_sum_dialog.ui \
../resources/transaction_info_dialog.ui ../resources/transaction_info_dialog.ui
INSTALLER_GRESOURCE_FILE = ../resources/pamac.installer.gresource.xml 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/choose_provider_dialog.ui \
../resources/transaction_sum_dialog.ui \ ../resources/transaction_sum_dialog.ui \
../resources/transaction_info_dialog.ui ../resources/transaction_info_dialog.ui
@ -50,23 +51,21 @@ INSTALLER_RESOURCES_FILES = ../resources/progress_window.ui \
DIALOGS_FILES = choose_provider_dialog.vala \ DIALOGS_FILES = choose_provider_dialog.vala \
transaction_sum_dialog.vala \ transaction_sum_dialog.vala \
transaction_info_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 \ valac -o pamac-daemon \
$(COMMON_VALA_FLAGS) \ $(COMMON_VALA_FLAGS) \
--pkg=polkit-gobject-1 \ --pkg=polkit-gobject-1 \
-X -DGETTEXT_PACKAGE="pacman" \
--thread \ --thread \
$(COMMON_SOURCES) \ $(COMMON_SOURCES) \
daemon.vala daemon.vala
pamac-tray: $(COMMON_SOURCES) tray.vala pamac-tray: ../vapi/libalpm.vapi $(COMMON_SOURCES) tray.vala
valac -o pamac-tray \ valac -o pamac-tray \
$(COMMON_VALA_FLAGS) \ $(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \ --pkg=gtk+-3.0 \
--pkg=libnotify \ --pkg=libnotify \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \ $(COMMON_SOURCES) \
tray.vala tray.vala
@ -79,7 +78,7 @@ updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_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 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 \ valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \ $(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \ --pkg=gtk+-3.0 \
@ -87,7 +86,6 @@ pamac-manager: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala histor
--pkg=gdk-3.0 \ --pkg=gdk-3.0 \
--pkg=vte-2.91 \ --pkg=vte-2.91 \
--gresources=$(MANAGER_GRESOURCE_FILE) \ --gresources=$(MANAGER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \ $(COMMON_SOURCES) \
$(DIALOGS_FILES) \ $(DIALOGS_FILES) \
preferences_dialog.vala \ preferences_dialog.vala \
@ -100,14 +98,13 @@ pamac-manager: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala histor
manager_window.vala \ manager_window.vala \
manager.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 \ valac -o pamac-updater \
$(COMMON_VALA_FLAGS) \ $(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \ --pkg=gtk+-3.0 \
--pkg=gmodule-2.0 \ --pkg=gmodule-2.0 \
--pkg=vte-2.91 \ --pkg=vte-2.91 \
--gresources=$(UPDATER_GRESOURCE_FILE) \ --gresources=$(UPDATER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \ $(COMMON_SOURCES) \
$(DIALOGS_FILES) \ $(DIALOGS_FILES) \
preferences_dialog.vala \ preferences_dialog.vala \
@ -116,14 +113,13 @@ pamac-updater: $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala update
updater_window.vala \ updater_window.vala \
updater.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 \ valac -o pamac-install \
$(COMMON_VALA_FLAGS) \ $(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \ --pkg=gtk+-3.0 \
--pkg=gmodule-2.0 \ --pkg=gmodule-2.0 \
--pkg=vte-2.91 \ --pkg=vte-2.91 \
--gresources=$(INSTALLER_GRESOURCE_FILE) \ --gresources=$(INSTALLER_GRESOURCE_FILE) \
-X -DGETTEXT_PACKAGE="pamac" \
$(COMMON_SOURCES) \ $(COMMON_SOURCES) \
$(DIALOGS_FILES) \ $(DIALOGS_FILES) \
installer_resources.c \ installer_resources.c \

View File

@ -30,38 +30,103 @@ namespace Alpm {
} }
public class Config { public class Config {
public Handle handle; string rootdir;
private string[] priv_holdpkg; string dbpath;
private string[] priv_syncfirst; string gpgdir;
public string[] holdpkg; string logfile;
public string[] syncfirst; string arch;
SigLevel siglevel; 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 localfilesiglevel;
SigLevel remotefilesiglevel; SigLevel remotefilesiglevel;
Repo[] repo_order; Repo[] repo_order;
public Config (string path) { public Config (string path) {
// rootdir and dbpath are hardcoded so we parse config file only once rootdir = "/";
const string rootdir = "/"; dbpath = "/var/lib/pacman";
const string dbpath = "/var/lib/pacman"; gpgdir = "/etc/pacman.d/gnupg/";
Alpm.Errno error; logfile = "/var/log/pacman.log";
handle = new Handle (rootdir, dbpath, out error); arch = Posix.utsname().machine;
const string gpgdir = "/etc/pacman.d/gnupg/"; cachedir = {"/var/cache/pacman/pkg/"};
const string logfile = "/var/log/pacman.log"; holdpkg = {};
const string cachedir = "/var/cache/pacman/pkg/"; syncfirst = {};
priv_holdpkg = {}; ignoregroup = {};
priv_syncfirst = {}; ignorepkg = {};
siglevel = SigLevel.PACKAGE | SigLevel.PACKAGE_OPTIONAL | SigLevel.DATABASE | SigLevel.DATABASE_OPTIONAL; noextract = {};
noupgrade = {};
usesyslog = 0;
checkspace = 0;
deltaratio = 0.7;
defaultsiglevel = SigLevel.PACKAGE | SigLevel.PACKAGE_OPTIONAL | SigLevel.DATABASE | SigLevel.DATABASE_OPTIONAL;
localfilesiglevel = SigLevel.USE_DEFAULT; localfilesiglevel = SigLevel.USE_DEFAULT;
remotefilesiglevel = SigLevel.USE_DEFAULT; remotefilesiglevel = SigLevel.USE_DEFAULT;
repo_order = {}; repo_order = {};
// parse conf file // parse conf file
parse_file (path); parse_file (path);
// check essential settings }
if (handle.gpgdir == null) handle.gpgdir = gpgdir;
if (handle.logfile == null) handle.logfile = logfile; public string[] get_syncfirst () {
if (handle.arch == null) handle.arch = Posix.utsname().machine; return syncfirst;
if (handle.cachedirs == null) handle.add_cachedir(cachedir); }
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 // register dbs
foreach (Repo repo in repo_order) { foreach (Repo repo in repo_order) {
unowned DB db = handle.register_syncdb (repo.name, repo.siglevel); 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)); db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch));
} }
} }
return handle;
} }
public void parse_file (string path, string? section = null) { public void parse_file (string path, string? section = null) {
@ -91,7 +157,7 @@ namespace Alpm {
current_section = line[1:-1]; current_section = line[1:-1];
if (current_section != "options") { if (current_section != "options") {
Repo repo = new Repo (current_section); Repo repo = new Repo (current_section);
repo.siglevel = siglevel; repo.siglevel = defaultsiglevel;
repo_order += repo; repo_order += repo;
} }
continue; continue;
@ -105,53 +171,53 @@ namespace Alpm {
parse_file (_value, current_section); parse_file (_value, current_section);
if (current_section == "options") { if (current_section == "options") {
if (_key == "GPGDir") if (_key == "GPGDir")
handle.gpgdir = _value; gpgdir = _value;
else if (_key == "LogFile") else if (_key == "LogFile")
handle.logfile = _value; logfile = _value;
else if (_key == "Architecture") { else if (_key == "Architecture") {
if (_value == "auto") if (_value == "auto")
handle.arch = Posix.utsname ().machine; arch = Posix.utsname ().machine;
else else
handle.arch = _value; arch = _value;
} else if (_key == "UseDelta") } else if (_key == "UseDelta")
handle.deltaratio = double.parse (_value); deltaratio = double.parse (_value);
else if (_key == "UseSysLog") else if (_key == "UseSysLog")
handle.usesyslog = 1; usesyslog = 1;
else if (_key == "CheckSpace") else if (_key == "CheckSpace")
handle.checkspace = 1; checkspace = 1;
else if (_key == "SigLevel") else if (_key == "SigLevel")
siglevel = define_siglevel (siglevel, _value); defaultsiglevel = define_siglevel (defaultsiglevel, _value);
else if (_key == "LocalSigLevel") 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") 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") { else if (_key == "HoldPkg") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
priv_holdpkg += name; holdpkg += name;
} }
} else if (_key == "SyncFirst") { } else if (_key == "SyncFirst") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
priv_syncfirst += name; syncfirst += name;
} }
} else if (_key == "CacheDir") { } else if (_key == "CacheDir") {
foreach (string dir in _value.split (" ")) { foreach (string dir in _value.split (" ")) {
handle.add_cachedir (dir); cachedir += dir;
} }
} else if (_key == "IgnoreGroup") { } else if (_key == "IgnoreGroup") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
handle.add_ignoregroup (name); ignoregroup += name;
} }
} else if (_key == "IgnorePkg") { } else if (_key == "IgnorePkg") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
handle.add_ignorepkg (name); ignorepkg += name;
} }
} else if (_key == "Noextract") { } else if (_key == "Noextract") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
handle.add_noextract (name); noextract += name;
} }
} else if (_key == "NoUpgrade") { } else if (_key == "NoUpgrade") {
foreach (string name in _value.split (" ")) { foreach (string name in _value.split (" ")) {
handle.add_noupgrade (name); noupgrade += name;
} }
} }
} else { } else {
@ -160,7 +226,7 @@ namespace Alpm {
if (_key == "Server") if (_key == "Server")
_repo.urls += _value; _repo.urls += _value;
else if (_key == "SigLevel") 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) { } catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message); 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 uint64 download_size;
} }
public struct Updates {
public bool syncfirst;
public UpdatesInfos[] infos;
}
public enum Mode { public enum Mode {
MANAGER, MANAGER,
UPDATER, UPDATER,
NO_CONFIRM 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 struct ErrorInfos {
public string str; public string str;
public string[] details; public string[] details;
@ -159,15 +145,15 @@ public unowned Alpm.Package? get_syncpkg (Alpm.Handle handle, string name) {
return pkg; 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 infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] syncfirst_infos = {}; Pamac.UpdatesInfos[] syncfirst_infos = {};
unowned Alpm.Package? pkg = null; unowned Alpm.Package? pkg = null;
unowned Alpm.Package? candidate = null; unowned Alpm.Package? candidate = null;
foreach (string name in alpm_config.syncfirst) { foreach (string name in syncfirst) {
pkg = Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, name); pkg = Alpm.find_satisfier (handle.localdb.pkgcache, name);
if (pkg != null) { if (pkg != null) {
candidate = Alpm.sync_newversion (pkg, alpm_config.handle.syncdbs); candidate = Alpm.sync_newversion (pkg, handle.syncdbs);
if (candidate != null) { if (candidate != null) {
infos.name = candidate.name; infos.name = candidate.name;
infos.version = candidate.version; infos.version = candidate.version;
@ -181,29 +167,14 @@ public Pamac.UpdatesInfos[] get_syncfirst_updates (Alpm.Config alpm_config) {
return syncfirst_infos; return syncfirst_infos;
} }
public string[] get_ignore_pkgs (Alpm.Config alpm_config) { public Pamac.UpdatesInfos[] get_repos_updates (Alpm.Handle handle, string[] ignore_pkgs) {
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) {
unowned Alpm.Package? candidate = null; unowned Alpm.Package? candidate = null;
Pamac.UpdatesInfos infos = Pamac.UpdatesInfos (); Pamac.UpdatesInfos infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] updates = {}; 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 // continue only if the local pkg is not in IgnorePkg or IgnoreGroup
if ((local_pkg.name in ignore_pkgs) == false) { 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) { if (candidate != null) {
infos.name = candidate.name; infos.name = candidate.name;
infos.version = candidate.version; infos.version = candidate.version;
@ -217,25 +188,25 @@ public Pamac.UpdatesInfos[] get_repos_updates (Alpm.Config alpm_config, string[]
return updates; 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? sync_pkg = null;
unowned Alpm.Package? candidate = null; unowned Alpm.Package? candidate = null;
string[] local_pkgs = {}; string[] local_pkgs = {};
Pamac.UpdatesInfos infos = Pamac.UpdatesInfos (); Pamac.UpdatesInfos infos = Pamac.UpdatesInfos ();
Pamac.UpdatesInfos[] aur_updates = {}; Pamac.UpdatesInfos[] aur_updates = {};
// get local pkgs // 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 // continue only if the local pkg is not in IgnorePkg or IgnoreGroup
if ((local_pkg.name in ignore_pkgs) == false) { if ((local_pkg.name in ignore_pkgs) == false) {
// check updates from AUR only for local packages // 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); sync_pkg = Alpm.find_satisfier (db.pkgcache, local_pkg.name);
if (sync_pkg != null) if (sync_pkg != null)
break; break;
} }
if (sync_pkg == null) { if (sync_pkg == null) {
// check update from AUR only if no package from dbs will replace it // 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) { if (candidate == null) {
local_pkgs += local_pkg.name; 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 (); unowned Json.Object pkg_info = node.get_object ();
version = pkg_info.get_string_member ("Version"); version = pkg_info.get_string_member ("Version");
name = pkg_info.get_string_member ("Name"); 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) { if (cmp == 1) {
infos.name = name; infos.name = name;
infos.version = version; infos.version = version;

View File

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

View File

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

View File

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

View File

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

View File

@ -84,21 +84,21 @@ namespace Pamac {
case 1: case 1:
val = Value (typeof (Object)); val = Value (typeof (Object));
if (pkg.alpm_pkg != null) { 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); val.set_object (manager_window.locked_icon);
else if (pkg.repo == "local") { 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); 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); val.set_object (manager_window.to_remove_icon);
else else
val.set_object (manager_window.installed_icon); 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); val.set_object (manager_window.to_install_icon);
else else
val.set_object (manager_window.uninstalled_icon); val.set_object (manager_window.uninstalled_icon);
} else if (pkg.aur_json != null) { } 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); val.set_object (manager_window.to_install_icon);
else else
val.set_object (manager_window.uninstalled_icon); val.set_object (manager_window.uninstalled_icon);

View File

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

View File

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

View File

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

View File

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

View File

@ -25,6 +25,10 @@ void* alpm_list_get_data (alpm_list_t *list) {
return list->data; 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) { alpm_list_t* alpm_list_remove_data (alpm_list_t *list, const void *needle, alpm_list_fn_cmp fn) {
void *data = NULL; void *data = NULL;
list = alpm_list_remove (list, needle, fn, data); list = alpm_list_remove (list, needle, fn, data);

View File

@ -8,6 +8,7 @@ typedef struct __alpm_list_iterator_t {
} alpm_list_iterator_t; } alpm_list_iterator_t;
void* alpm_list_get_data(alpm_list_t *list); 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_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); 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); void alpm_list_free_all(alpm_list_t *list);

View File

@ -142,9 +142,6 @@ namespace Alpm {
[CCode (cname = "alpm_initialize")] [CCode (cname = "alpm_initialize")]
public Handle (string root, string dbpath, out Alpm.Errno error); public Handle (string root, string dbpath, out Alpm.Errno error);
//[CCode (cname = "alpm_release")]
//public int release();
public unowned string root { public unowned string root {
[CCode (cname = "alpm_option_get_root")] get; [CCode (cname = "alpm_option_get_root")] get;
} }
@ -155,7 +152,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_get_arch")] get; [CCode (cname = "alpm_option_get_arch")] get;
[CCode (cname = "alpm_option_set_arch")] set; [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_get_cachedirs")] get;
[CCode (cname = "alpm_option_set_cachedirs")] set; [CCode (cname = "alpm_option_set_cachedirs")] set;
} }
@ -180,7 +177,7 @@ namespace Alpm {
/** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */ /** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */
[CCode (cname = "alpm_option_set_usesyslog")] set; [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_get_noupgrades")] get;
[CCode (cname = "alpm_option_set_noupgrades")] set; [CCode (cname = "alpm_option_set_noupgrades")] set;
} }
@ -189,7 +186,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_noupgrade")] [CCode (cname = "alpm_option_remove_noupgrade")]
public int remove_noupgrade(string pkg); 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_get_noextracts")] get;
[CCode (cname = "alpm_option_set_noextracts")] set; [CCode (cname = "alpm_option_set_noextracts")] set;
} }
@ -198,7 +195,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_noextract")] [CCode (cname = "alpm_option_remove_noextract")]
public int remove_noextract(string pkg); 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_get_ignorepkgs")] get;
[CCode (cname = "alpm_option_set_ignorepkgs")] set; [CCode (cname = "alpm_option_set_ignorepkgs")] set;
} }
@ -207,7 +204,7 @@ namespace Alpm {
[CCode (cname = "alpm_option_remove_ignorepkg")] [CCode (cname = "alpm_option_remove_ignorepkg")]
public int remove_ignorepkg(string pkg); 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_get_ignoregroups")] get;
[CCode (cname = "alpm_option_set_ignoregroups")] set; [CCode (cname = "alpm_option_set_ignoregroups")] set;
} }
@ -226,6 +223,10 @@ namespace Alpm {
[CCode (cname = "alpm_option_set_checkspace")] set; [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 { public SigLevel localfilesiglevel {
[CCode (cname = "alpm_option_get_local_file_siglevel")] get; [CCode (cname = "alpm_option_get_local_file_siglevel")] get;
[CCode (cname = "alpm_option_set_local_file_siglevel")] set; [CCode (cname = "alpm_option_set_local_file_siglevel")] set;
@ -250,8 +251,10 @@ namespace Alpm {
[CCode (cname = "alpm_get_syncdbs")] get; [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")] [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. //~ /** Test if a package should be ignored.
//~ * Checks if the package is ignored via IgnorePkg, or if the package is //~ * 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; [CCode (cname = "alpm_db_get_siglevel")] get;
} }
public unowned string url { //~ public unowned string url {
[CCode (cname = "alpm_db_get_url")] get; //~ [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_get_servers")] get;
[CCode (cname = "alpm_db_set_servers")] set; [CCode (cname = "alpm_db_set_servers")] set;
} }
@ -425,14 +428,13 @@ namespace Alpm {
/** /**
* Packages * Packages
*/ */
[CCode (cname = "alpm_pkg_t", cprefix = "alpm_pkg_", [CCode (cname = "alpm_pkg_t", cprefix = "alpm_pkg_", free_function = "alpm_pkg_free")]
free_function = "alpm_pkg_free")]
[Compact] [Compact]
public class Package { public class Package {
public static int checkmd5sum(); public static int checkmd5sum();
public unowned Alpm.List<string?> compute_requiredby(); public Alpm.List<string?> compute_requiredby();
public unowned Alpm.List<string?> compute_optionalfor(); public Alpm.List<string?> compute_optionalfor();
/* properties */ /* properties */
[CCode (array_length = false)] [CCode (array_length = false)]
@ -476,9 +478,14 @@ namespace Alpm {
public unowned string arch { public unowned string arch {
[CCode (cname = "alpm_pkg_get_arch")] get; [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 { public uint64 size {
[CCode (cname = "alpm_pkg_get_size")] get; [CCode (cname = "alpm_pkg_get_size")] get;
} }
public uint64 isize { public uint64 isize {
[CCode (cname = "alpm_pkg_get_isize")] get; [CCode (cname = "alpm_pkg_get_isize")] get;
} }
@ -487,16 +494,15 @@ namespace Alpm {
} }
public PkgReason reason { public PkgReason reason {
[CCode (cname = "alpm_pkg_get_reason")] get; [CCode (cname = "alpm_pkg_get_reason")] get;
/** The provided package object must be from the local database or this method /** The provided package object must be from the local database
* will fail. The write to the local database is performed immediately. * or this method will fail (Errno is set accordingly).
* @return 0 on success, -1 on error (Errno is set accordingly)
*/ */
[CCode (cname = "alpm_pkg_set_reason")] set; [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; [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; [CCode (cname = "alpm_pkg_get_groups")] get;
} }
public unowned Alpm.List<Depend?> depends { public unowned Alpm.List<Depend?> depends {
@ -538,7 +544,7 @@ namespace Alpm {
public ulong name_hash; public ulong name_hash;
public DepMod mod; public DepMod mod;
[CCode (cname = "alpm_dep_compute_string")] [CCode (cname = "alpm_dep_compute_string")]
public unowned string compute_string(); public string compute_string();
} }
/** Missing dependency */ /** Missing dependency */
@ -954,8 +960,7 @@ namespace Alpm {
} }
[CCode (cprefix = "alpm_list_", cheader_filename = "alpm_list.h,alpm-util.h", [CCode (cprefix = "alpm_list_", cheader_filename = "alpm_list.h,alpm-util.h",
cname = "alpm_list_t", type_parameters = "G", cname = "alpm_list_t", type_parameters = "G", free_function = "alpm_list_free_all")]
free_function = "alpm_list_free")]
[Compact] [Compact]
public class List<G> { public class List<G> {
/* Comparator*/ /* Comparator*/
@ -966,30 +971,40 @@ namespace Alpm {
public size_t length { public size_t length {
[CCode (cname = "alpm_list_count")] get; [CCode (cname = "alpm_list_count")] get;
} }
public unowned G? data {
[CCode (cname = "alpm_list_get_data")] get;
}
/* item mutators */ /* item mutators */
[ReturnsModifiedPointer ()] [ReturnsModifiedPointer ()]
public unowned void add(G data); public unowned void add(G data);
[ReturnsModifiedPointer ()] [ReturnsModifiedPointer ()]
public unowned void join(List<G> list); public unowned void join(List<G> list);
[CCode (cname = "alpm_list_sort_data"), ReturnsModifiedPointer ()] [CCode (cname = "alpm_list_sort_data"), ReturnsModifiedPointer ()]
public unowned void sort(CompareFunc fn); public unowned void sort(CompareFunc fn);
[CCode (cname = "alpm_list_remove_data"), ReturnsModifiedPointer ()] [CCode (cname = "alpm_list_remove_data"), ReturnsModifiedPointer ()]
public unowned void? remove(G data, CompareFunc fn); public unowned void? remove(G data, CompareFunc fn);
public List<G> copy(); public List<G> copy();
[ReturnsModifiedPointer ()] [ReturnsModifiedPointer ()]
public unowned void reverse (); public unowned void reverse ();
/* item accessors */ /* item accessors */
public unowned List<G>? first(); public unowned List<G>? first();
public unowned List<G>? last(); 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>? next();
public unowned List<G>? previous(); public unowned List<G>? previous();
public unowned G get_data();
public unowned G? nth_data(size_t index);
/* misc */ /* misc */
public unowned string? find_str(string needle); public unowned string? find_str(string needle);
/** @return a list containing all items in `this` not present in `list` */ /** @return a list containing all items in `this` not present in `list` */
public unowned List<G>? diff(List<G>? list, CompareFunc fn); public unowned List<G>? diff(List<G>? list, CompareFunc fn);