[PackageKit-commit] packagekit: Branch 'master' - 9 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Oct 15 00:08:12 PDT 2008
backends/dummy/pk-backend-dummy.c | 46 ++
libpackagekit/egg-obj-list.c | 21 +
libpackagekit/egg-obj-list.h | 2
po/zh_CN.po | 690 +++++++++++++-------------------------
src/Makefile.am | 4
src/pk-backend.c | 7
src/pk-post-trans.c | 593 ++++++++++++++++++++++++++++++++
src/pk-post-trans.h | 59 +++
src/pk-refresh.c | 630 ----------------------------------
src/pk-refresh.h | 59 ---
src/pk-transaction.c | 32 -
11 files changed, 971 insertions(+), 1172 deletions(-)
New commits:
commit b2811a97283e6f83e6c9fee7b4f1dbf38c3c4f9c
Author: çé²(Lu Gan) <rhythm.gan at gmail.com>
Date: Tue Oct 14 15:07:33 2008 +0000
Update Chinese Simplified translation
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/zh_CN.po b/po/zh_CN.po
index ef7e2a4..3019240 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -1,617 +1,411 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
-#
-#, fuzzy
+# çé²(Gan Lu) <rhythm.gan at gmail.com>, 2008
+
+
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-10-13 17:25+0100\n"
-"PO-Revision-Date: 2008-04-19 21:40+0800\n"
-"Last-Translator: Chen Yu <jcomee at gmail.com>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
+"POT-Creation-Date: 2008-10-11 04:21+0000\n"
+"PO-Revision-Date: 2008-10-11 18:36+0800\n"
+"Last-Translator: çé²(Gan Lu) <rhythm.gan at gmail.com>\n"
+"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../client/pk-console.c:294
+#: ../policy/org.freedesktop.packagekit.policy.in.h:1
+msgid "Accept EULA"
+msgstr "æ¥åæç»ç¨æ·åè®®"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:2
+msgid "Authentication is required to accept a EULA"
+msgstr "æ¥åæç»ç¨æ·åè®®éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:3
+msgid "Authentication is required to change software source parameters"
+msgstr "æ¹å软件æºåæ°éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:4
+msgid "Authentication is required to install a local file"
+msgstr "å®è£
æ¬å°æä»¶éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:5
+msgid "Authentication is required to install a package"
+msgstr "å®è£
å
éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
+msgid "Authentication is required to install a security signature"
+msgstr "å®è£
å®å
¨ç¾åéè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid "Authentication is required to refresh the package lists"
+msgstr "å·æ°å
å表éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:8
+msgid "Authentication is required to remove packages"
+msgstr "å é¤å
éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:9
+msgid "Authentication is required to rollback a transaction"
+msgstr "æ¢å¤å°åä¸ä¸ªäºå¡éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:10
+msgid "Authentication is required to update all packages"
+msgstr "æ´æ°å
¨é¨è½¯ä»¶å
éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:11
+msgid "Authentication is required to update packages"
+msgstr "æ´æ°å
éè¦è·å¾ææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:12
+msgid "Change software source parameters"
+msgstr "æ´æ¹è½¯ä»¶æºåæ°"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:13
+msgid "Further authentication is required to install an untrusted local file"
+msgstr "å®è£
æªè·ä¿¡ä»»çæ¬å°æä»¶è¦æ±éè¿è¿ä¸æ¥çææ"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
+msgid "Install local file"
+msgstr "å®è£
æ¬å°æä»¶"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Install package"
+msgstr "å®è£
å
"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:16
+msgid "Install security signature"
+msgstr "å®è£
å®å
¨ç¾å"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:17
+msgid "Install untrusted local file"
+msgstr "å®è£
æªè·ä¿¡ä»»çæ¬å°æä»¶"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:18
+msgid "Refresh package lists"
+msgstr "å·æ°å
å表"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:19
+msgid "Remove package"
+msgstr "å é¤å
"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:20
+msgid "Rollback to a previous transaction"
+msgstr "åæº¯å°åä¸ä¸ªäºå¡"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:21
+msgid "Update all packages"
+msgstr "æ´æ°ææå
"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
+msgid "Update package"
+msgstr "æ´æ°å
"
+
+#: ../client/pk-console.c:224
msgid "Update detail"
msgstr "æ´æ°ç»è"
-#: ../client/pk-console.c:511
+#: ../client/pk-console.c:425
msgid "A system restart is required"
msgstr "éè¦éå¯ç³»ç»"
-#: ../client/pk-console.c:513
+#: ../client/pk-console.c:427
msgid "A logout and login is required"
-msgstr "éè¦æ³¨éåç»å½"
+msgstr "éè¦æ³¨éå¹¶ç»å½"
-#: ../client/pk-console.c:515
+#: ../client/pk-console.c:429
msgid "An application restart is required"
msgstr "éè¦éå¯åºç¨ç¨åº"
-#: ../client/pk-console.c:608 ../client/pk-generate-pack.c:140
+#: ../client/pk-console.c:474
+#, c-format
+msgid "Please enter a number from 1 to %i: "
+msgstr "请è¾å
¥ä» 1 å° %i çæ°åï¼"
+
+#: ../client/pk-console.c:524
+msgid "Could not find a package match"
+msgstr "æªè½æ¾å°å¹é
çå
"
+
+#: ../client/pk-console.c:538
msgid "There are multiple package matches"
msgstr "æå¤ä¸ªå¹é
çå
"
#. find out what package the user wants to use
-#: ../client/pk-console.c:615 ../client/pk-generate-pack.c:147
+#: ../client/pk-console.c:545
msgid "Please enter the package number: "
msgstr "请è¾å
¥å
çå·ç "
-#: ../client/pk-console.c:649
-#, fuzzy
-msgid "Could not find package to install"
-msgstr "æªè½æ¾å°å¹é
çå
"
+#: ../client/pk-console.c:561
+msgid "Could not find a package with that name to install, or package already installed"
+msgstr "æªè½æ¾å°è¯¥å½åçå
æ¥å®è£
ï¼æå
å·²ç»å®è£
"
-#: ../client/pk-console.c:755
-#, fuzzy
-msgid "Could not find package to remove"
-msgstr "æªè½æ¾å°è¿ä¸ªååçå
æ¥å é¤"
+#: ../client/pk-console.c:643
+msgid "Could not find a package with that name to remove"
+msgstr "æªè½æ¾å°è¯¥å½åçå
æ¥å é¤"
-#: ../client/pk-console.c:816
+#: ../client/pk-console.c:683
msgid "The following packages have to be removed"
-msgstr "ä¸é¢çå
å¿
é¡»å é¤"
+msgstr "ä¸åå
å¿
é¡»å é¤"
#. get user input
-#: ../client/pk-console.c:823
+#: ../client/pk-console.c:692
msgid "Okay to remove additional packages?"
msgstr "åæå é¤é¢å¤çå
åï¼"
-#: ../client/pk-console.c:827 ../client/pk-generate-pack.c:271
+#: ../client/pk-console.c:696
msgid "Cancelled!"
-msgstr "已忶"
-
-#: ../client/pk-console.c:861
-#, fuzzy
-msgid "Could not find package to download"
-msgstr "æªè½æ¾å°å¹é
çå
"
+msgstr "已忶ï¼"
-#: ../client/pk-console.c:913
-#, fuzzy
-msgid "Could not find package to update"
-msgstr "æªè½æ¾å°å¹é
çå
"
+#: ../client/pk-console.c:718
+msgid "Could not find a package with that name to update"
+msgstr "æªè½æ¾å°è¯¥å½åçå
æ¥å级"
-#: ../client/pk-console.c:935
-#, fuzzy
-msgid "Could not find what packages require"
+#: ../client/pk-console.c:736
+msgid "Could not find what packages require this package"
msgstr "æªè½æ¾å°æ¯åªäºå
éè¦è¿ä¸ªå
"
-#: ../client/pk-console.c:956
-#, fuzzy
-msgid "Could not get dependencies for"
+#: ../client/pk-console.c:754
+msgid "Could not get dependencies for this package"
msgstr "æªè½å¾å°è¿ä¸ªå
çä¾èµ"
-#: ../client/pk-console.c:977
-#, fuzzy
-msgid "Could not find details for"
-msgstr "æªè½æ¾å°è¿ä¸ªå
æå
å«çæä»¶"
+#: ../client/pk-console.c:772
+msgid "Could not find details for this package"
+msgstr "æªè½æ¾å°è¯¥å
ç详ç»èµæ"
-#: ../client/pk-console.c:1000
+#: ../client/pk-console.c:790
+#, c-format
msgid "Could not find the files for this package"
msgstr "æªè½æ¾å°è¿ä¸ªå
æå
å«çæä»¶"
-#: ../client/pk-console.c:1007
-#, fuzzy
-msgid "Could not get the file list"
-msgstr "æªè½æ¾å°è¿ä¸ªå
æå
å«çæä»¶"
-
-#: ../client/pk-console.c:1026
-#, fuzzy
-msgid "Could not find the update details for"
-msgstr "æªè½æ¾å°è¿ä¸ªå
æå
å«çæä»¶"
-
-#: ../client/pk-console.c:1087
+#: ../client/pk-console.c:870
msgid "Package description"
msgstr "å
çæè¿°"
-#: ../client/pk-console.c:1120
+#: ../client/pk-console.c:893
msgid "Package files"
msgstr "å
ä¸çæä»¶"
-#: ../client/pk-console.c:1128
+#: ../client/pk-console.c:901
msgid "No files"
msgstr "æ æä»¶"
#. get user input
-#: ../client/pk-console.c:1160
+#: ../client/pk-console.c:933
msgid "Okay to import key?"
msgstr "åæå¯¼å
¥ keyï¼"
-#: ../client/pk-console.c:1163
+#: ../client/pk-console.c:936
msgid "Did not import key"
msgstr "没æå¯¼å
¥ key"
#. get user input
-#: ../client/pk-console.c:1203
+#: ../client/pk-console.c:976
msgid "Do you agree?"
msgstr "æ¨æ¥ååï¼"
-#: ../client/pk-console.c:1206
+#: ../client/pk-console.c:979
msgid "Did not agree to licence, task will fail"
-msgstr "䏿¥å许å¯ï¼ä»»å¡å°ç»æ¢"
+msgstr "䏿¥å许å¯ï¼ä»»å¡å°ç»æ¢ã"
-#: ../client/pk-console.c:1235
+#: ../client/pk-console.c:1008
msgid "The daemon crashed mid-transaction!"
-msgstr ""
+msgstr "åå°ç¨åºå¨äºå¡å¤ç䏿崩æºäºï¼"
#. header
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1061
msgid "PackageKit Console Interface"
msgstr "PackageKit æ§å¶å°çé¢"
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1061
msgid "Subcommands:"
-msgstr "åå½ä»¤"
+msgstr "åå½ä»¤ï¼"
-#: ../client/pk-console.c:1401 ../client/pk-generate-pack.c:203
-#: ../client/pk-monitor.c:118 ../src/pk-main.c:195
+#: ../client/pk-console.c:1165
+#: ../client/pk-monitor.c:104
+#: ../src/pk-main.c:189
msgid "Show extra debugging information"
msgstr "æ¾ç¤ºé¢å¤çè°è¯ä¿¡æ¯"
-#: ../client/pk-console.c:1403 ../client/pk-monitor.c:120
+#: ../client/pk-console.c:1167
+#: ../client/pk-monitor.c:106
msgid "Show the program version and exit"
-msgstr "æ¾ç¤ºç¨åºçæ¬å¹¶éåº"
+msgstr "æ¾ç¤ºæ¬ç¨åºçæ¬å¹¶éåº"
-#: ../client/pk-console.c:1405
+#: ../client/pk-console.c:1169
msgid "Set the filter, e.g. installed"
msgstr "è®¾ç½®è¿æ»¤å¨ï¼æ¯å¦ï¼å·²å®è£
ç"
-#: ../client/pk-console.c:1407
+#: ../client/pk-console.c:1171
msgid "Exit without waiting for actions to complete"
msgstr "ä¸çå¨ä½å®æå³éåº"
-#: ../client/pk-console.c:1430
+#: ../client/pk-console.c:1194
msgid "Could not connect to system DBUS."
-msgstr "æªè½é¾æ¥ç³»ç» DBUS"
+msgstr "æªè½è¿æ¥å°ç³»ç» DBUS"
-#: ../client/pk-console.c:1525
-#, fuzzy
-msgid "You need to specify a search type, e.g. name"
-msgstr "æ¨è¦æ±éè¿æå®ä¸ä¸ªæç´¢ç±»å"
-
-#: ../client/pk-console.c:1530 ../client/pk-console.c:1537
-#: ../client/pk-console.c:1544 ../client/pk-console.c:1551
-#: ../client/pk-console.c:1662 ../client/pk-console.c:1672
-#: ../client/pk-console.c:1679 ../client/pk-console.c:1686
+#: ../client/pk-console.c:1288
+#, c-format
+msgid "You need to specify a search type"
+msgstr "æ¨éè¦æå®ä¸ä¸ªæç´¢ç±»å"
+
+#: ../client/pk-console.c:1293
+#: ../client/pk-console.c:1300
+#: ../client/pk-console.c:1307
+#: ../client/pk-console.c:1314
+#: ../client/pk-console.c:1421
+#: ../client/pk-console.c:1428
+#: ../client/pk-console.c:1435
+#: ../client/pk-console.c:1442
+#, c-format
msgid "You need to specify a search term"
msgstr "æ¨éè¦æå®ä¸ä¸ªæç´¢æ¡ä»¶"
-#: ../client/pk-console.c:1556
+#: ../client/pk-console.c:1319
+#, c-format
msgid "Invalid search type"
msgstr "æ æçæç´¢ç±»å"
-#: ../client/pk-console.c:1561
+#: ../client/pk-console.c:1324
+#, c-format
msgid "You need to specify a package or file to install"
msgstr "æ¨è¦æå®ä¸ä¸ªå
ææä»¶æ¥å®è£
"
-#: ../client/pk-console.c:1568
+#: ../client/pk-console.c:1339
+#, c-format
msgid "You need to specify a type, key_id and package_id"
msgstr "æ¨è¦éè¿æå®ä¸ä¸ªç±»åï¼key_id å package_id"
-#: ../client/pk-console.c:1575
+#: ../client/pk-console.c:1346
+#, c-format
msgid "You need to specify a package to remove"
-msgstr "æ¨è¦éè¿æå®ä¸ä¸ªå
æ¥å é¤"
+msgstr "æ¨éè¦æå®ä¸ä¸ªå
æ¥å é¤"
-#: ../client/pk-console.c:1581
-#, fuzzy
-msgid ""
-"You need to specify the destination directory and then the packages to "
-"download"
-msgstr "æ¨è¦éè¿æå®ä¸ä¸ªç±»åï¼key_id å package_id"
-
-#: ../client/pk-console.c:1586
-msgid "Directory not found"
-msgstr ""
-
-#: ../client/pk-console.c:1592
+#: ../client/pk-console.c:1353
+#, c-format
msgid "You need to specify a eula-id"
msgstr "ä½ è¦æå®ä¸ä¸ª eula-id"
-#: ../client/pk-console.c:1608
+#: ../client/pk-console.c:1369
+#, c-format
msgid "You need to specify a package name to resolve"
-msgstr "æ¨è¦æå®ä¸ä¸ªå
çååæ¥è§£é"
+msgstr "æ¨éè¦æå®ä¸ä¸ªå
çååæ¥è§£å³"
-#: ../client/pk-console.c:1617 ../client/pk-console.c:1624
+#: ../client/pk-console.c:1376
+#: ../client/pk-console.c:1383
+#, c-format
msgid "You need to specify a repo name"
-msgstr "æ¨è¦æå®ä¸ä¸ªåºå"
+msgstr "æ¨éè¦æå®ä¸ä¸ªåºå"
-#: ../client/pk-console.c:1631
+#: ../client/pk-console.c:1390
+#, c-format
msgid "You need to specify a repo name/parameter and value"
-msgstr "æ¨è¦æå®ä¸ä¸ªåºå/åæ°åå¼"
+msgstr "æ¨éè¦æå®ä¸ä¸ªåºå/åæ°åå¼"
-#: ../client/pk-console.c:1644
+#: ../client/pk-console.c:1403
+#, c-format
msgid "You need to specify a time term"
-msgstr "æ¨è¦æå®ä¸ä¸ªæ¶é´é¡¹ç®"
+msgstr "æ¨éè¦æå®ä¸ä¸ªæ¶é´é¡¹ç®"
-#: ../client/pk-console.c:1649
+#: ../client/pk-console.c:1408
+#, c-format
msgid "You need to specify a correct role"
-msgstr "æ¨è¦æå®ä¸ä¸ªæ£ç¡®çè§è²"
+msgstr "æ¨éè¦æå®ä¸ä¸ªæ£ç¡®çè§è²"
-#: ../client/pk-console.c:1654
+#: ../client/pk-console.c:1413
+#, c-format
msgid "Failed to get last time"
-msgstr "è·åä¸ä¸æ¬¡å¤±è´¥"
+msgstr "æ æ³è·å¾ä¸æ¬¡è¿è¡æ¶é´"
-#: ../client/pk-console.c:1693
-#, fuzzy
+#: ../client/pk-console.c:1449
+#, c-format
msgid "You need to specify a package to find the details for"
-msgstr "æ¨è¦æå®ä¸ä¸ªå
æ¥æ¥æ¾æä»¶"
+msgstr "æ¨éè¦æå®ä¸ä¸ªå
æ¥æ¥æ¾ç¸å
³ç»è"
-#: ../client/pk-console.c:1700
+#: ../client/pk-console.c:1456
+#, c-format
msgid "You need to specify a package to find the files for"
msgstr "æ¨è¦æå®ä¸ä¸ªå
æ¥æ¥æ¾æä»¶"
-#: ../client/pk-console.c:1752
+#: ../client/pk-console.c:1503
#, c-format
msgid "Option '%s' not supported"
-msgstr "䏿¯æ '%s'é项"
-
-#: ../client/pk-console.c:1765
-msgid "You don't have the necessary privileges for this operation"
-msgstr "æ¨æ²¡ææ¤æä½æéçç¹æ"
+msgstr "䏿¯æ '%s' é项"
-#: ../client/pk-console.c:1767
+#: ../client/pk-console.c:1514
msgid "Command failed"
msgstr "å½ä»¤å¤±è´¥"
-#: ../client/pk-generate-pack.c:131
-msgid "Could not find a package match"
-msgstr "æªè½æ¾å°å¹é
çå
"
-
-#: ../client/pk-generate-pack.c:161
-msgid "Downloading"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:205
-msgid "Set the filename of dependencies to be excluded"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:207
-msgid ""
-"The directory to put the pack file, or the current directory if ommitted"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:209
-msgid "The package to be put into the ServicePack"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:211
-msgid "Put all updates available in the ServicePack"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:230
-msgid "Neither option selected"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:237
-msgid "Both optiosn selected"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:269
-msgid "A pack with the same name already exists, do you want to overwrite it?"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:282
-#, fuzzy
-msgid "Failed to create directory"
-msgstr "è·åä¸ä¸æ¬¡å¤±è´¥"
-
-#: ../client/pk-generate-pack.c:290
-#, fuzzy
-msgid "Failed to open package list"
-msgstr "è·åä¸ä¸æ¬¡å¤±è´¥"
-
-#: ../client/pk-generate-pack.c:299
-#, fuzzy
-msgid "Resolving package name to remote object"
-msgstr "ä¸é¢çå
å¿
é¡»å é¤"
-
-#: ../client/pk-generate-pack.c:302
-#, c-format
-msgid "Failed to find package '%s': %s"
-msgstr ""
-
-#. generate the pack
-#: ../client/pk-generate-pack.c:317
-#, c-format
-msgid "Service pack to create: %s\n"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:323
-msgid "Done!"
-msgstr ""
-
-#: ../client/pk-generate-pack.c:325
-msgid "Failed"
-msgstr ""
+#: ../client/pk-console.c:1518
+msgid "You don't have the necessary privileges for this operation"
+msgstr "æ¨æ²¡ææ¤æä½æéçç¹æ"
-#: ../client/pk-import-specspo.c:185
-#, fuzzy
-msgid "Could not set database readonly"
-msgstr "æªè½æå¼æ°æ®åº: %s"
+#: ../client/pk-monitor.c:117
+msgid "PackageKit Monitor"
+msgstr "PackageKit çè§å¨"
-#: ../client/pk-import-specspo.c:192
+#: ../client/pk-import-desktop.c:293
+#: ../client/pk-import-specspo.c:169
#, c-format
msgid "Could not open database: %s"
-msgstr "æªè½æå¼æ°æ®åº: %s"
+msgstr "æªè½æå¼æ°æ®åºï¼ %s"
-#: ../client/pk-import-specspo.c:193
+#: ../client/pk-import-desktop.c:294
+#: ../client/pk-import-specspo.c:170
msgid "You probably need to run this program as the root user"
msgstr "æ¨å¯è½è¦ä»¥æ ¹ç¨æ·èº«ä»½æ¥è¿è¡è¿ä¸ªç¨åº"
-#: ../client/pk-monitor.c:131
-msgid "PackageKit Monitor"
-msgstr "PackageKit çè§å¨"
-
-#: ../client/pk-tools-common.c:51
-#, c-format
-msgid "Please enter a number from 1 to %i: "
-msgstr "请è¾å
¥çå·ç ä» 1 å° %i:"
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:300
-msgid "Getting package information..."
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:304
-#, c-format
-msgid "<span color='#%06x' underline='single' size='larger'>Run %s</span>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:308
-#: ../contrib/packagekit-plugin/src/contents.cpp:313
-#: ../contrib/packagekit-plugin/src/contents.cpp:336
-#: ../contrib/packagekit-plugin/src/contents.cpp:340
-#, c-format
-msgid "<big>%s</big>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:310
-#, c-format
-msgid ""
-"\n"
-"<small>Installed version: %s</small>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:316
-#, c-format
-msgid ""
-"\n"
-"<span color='#%06x' underline='single'>Run version %s now</span>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:321
-#, c-format
-msgid ""
-"\n"
-"<span color='#%06x' underline='single'>Run now</span>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:325
-#, c-format
-msgid ""
-"\n"
-"<span color='#%06x' underline='single'>Upgrade to version %s</span>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:330
-#, c-format
-msgid ""
-"<span color='#%06x' underline='single' size='larger'>Install %s Now</span>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:333
-#, c-format
-msgid ""
-"\n"
-"<small>Version: %s</small>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:337
-msgid ""
-"\n"
-"<small>No packages found for your system</small>"
-msgstr ""
-
-#: ../contrib/packagekit-plugin/src/contents.cpp:341
-msgid ""
-"\n"
-"<small>Installing...</small>"
-msgstr ""
-
-#: ../data/packagekit-catalog.xml.in.h:1
-#, fuzzy
-msgid "PackageKit Catalog"
-msgstr "PackageKit çè§å¨"
-
-#: ../data/packagekit-servicepack.xml.in.h:1
-#, fuzzy
-msgid "PackageKit Service Pack"
-msgstr "PackageKit æå¡"
-
-#: ../data/packagekit-package-list.xml.in.h:1
-#, fuzzy
-msgid "PackageKit Package List"
-msgstr "PackageKit çè§å¨"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:1
-msgid "Accept EULA"
-msgstr "æ¥å EULA"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:2
-msgid "Authentication is required to accept a EULA"
-msgstr "æ¥å EULA è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:3
-msgid "Authentication is required to change software source parameters"
-msgstr "æ¹å软件æºè¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:4
-#, fuzzy
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr "å·æ°å
åè¡¨è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:5
-#, fuzzy
-msgid "Authentication is required to install a signed package"
-msgstr "å®è£
è½¯ä»¶è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:6
-#, fuzzy
-msgid "Authentication is required to install an untrusted package"
-msgstr "å®è£
è½¯ä»¶è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-#, fuzzy
-msgid "Authentication is required to refresh the system sources"
-msgstr "å·æ°å
åè¡¨è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to remove packages"
-msgstr "å é¤å
è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid "Authentication is required to rollback a transaction"
-msgstr ""
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-#, fuzzy
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr "å é¤å
è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid "Authentication is required to update packages"
-msgstr "æ´æ°å
è¦æ±éè¿éªè¯"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid "Change software source parameters"
-msgstr "æ´æ¹è½¯ä»¶æºåæ°"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Install local file"
-msgstr "å®è£
æ¬å°æä»¶"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-#, fuzzy
-msgid "Install untrusted local file"
-msgstr "å®è£
æ¬å°æä»¶"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Refresh system sources"
-msgstr ""
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Remove package"
-msgstr "å é¤å
"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Rollback to a previous transaction"
-msgstr ""
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Set network proxy"
-msgstr ""
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid "Trust a key used for signing packages"
-msgstr ""
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-#, fuzzy
-msgid "Update packages"
-msgstr "æ´æ°å
"
-
-#: ../src/pk-main.c:85
+#: ../src/pk-main.c:83
msgid "Startup failed due to security policies on this machine."
msgstr "å ä¸ºæ¬æºçå®å
¨çç¥å¯¼è´å¯å¨å¤±è´¥"
-#: ../src/pk-main.c:86
+#: ../src/pk-main.c:84
msgid "This can happen for two reasons:"
-msgstr "è¿å¯è½æä¸¤ä¸ªåå "
+msgstr "è¿å¯è½æä¸¤ä¸ªåå ï¼"
-#: ../src/pk-main.c:87
+#: ../src/pk-main.c:85
msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
+msgstr "æ£ç¡®ç¨æ·ä¹æ æ³å¯å¨è¯¥å¯æ§è¡ç¨åºï¼éå¸¸ä¸ºæ ¹ç¨æ·ï¼"
-#: ../src/pk-main.c:88
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system /etc/"
-"dbus-1/system.d directory"
+#: ../src/pk-main.c:86
+msgid "The org.freedesktop.PackageKit.conf file is not installed in the system /etc/dbus-1/system.d directory"
msgstr "æä»¶ org.freedesktop.PackageKit.conf 没æè¢«å®è£
å¨ç³»ç»ç /etc/ ä¸"
-#: ../src/pk-main.c:191
+#: ../src/pk-main.c:185
msgid "Packaging backend to use, e.g. dummy"
-msgstr ""
+msgstr "å¯ä½¿ç¨è¯¸å¦èææå
å端"
-#: ../src/pk-main.c:193
+#: ../src/pk-main.c:187
msgid "Daemonize and detach from the terminal"
-msgstr "åå°è¿ç¨å"
+msgstr "ä»ç»ç«¯ä¸å离并åå°åè¿è¡"
-#: ../src/pk-main.c:197
+#: ../src/pk-main.c:191
msgid "Disable the idle timer"
msgstr "å
³é空é²è®¡æ¶å¨"
-#: ../src/pk-main.c:199
+#: ../src/pk-main.c:193
msgid "Show version and exit"
msgstr "æ¾ç¤ºçæ¬åéåº"
-#: ../src/pk-main.c:201
+#: ../src/pk-main.c:195
msgid "Exit after a small delay"
msgstr "ç¨å¾®å»¶è¿åéåº"
-#: ../src/pk-main.c:203
+#: ../src/pk-main.c:197
msgid "Exit after the engine has loaded"
msgstr "弿å è½½åéåº"
-#: ../src/pk-main.c:213
+#: ../src/pk-main.c:207
msgid "PackageKit service"
msgstr "PackageKit æå¡"
-#: ../src/pk-main.c:249
+#: ../src/pk-main.c:233
msgid "Cannot connect to the system bus"
-msgstr "æªè½é¾æ¥ç³»ç»æ»çº¿"
+msgstr "æªè½è¿æ¥å°ç³»ç»æ»çº¿"
-#: ../src/pk-main.c:295
+#: ../src/pk-main.c:273
#, c-format
msgid "Error trying to start: %s\n"
-msgstr "å°è¯å¯å¨åºé\n"
-
-#~ msgid "Authentication is required to install a local file"
-#~ msgstr "å®è£
æ¬å°æä»¶è¦æ±éè¿éªè¯"
-
-#~ msgid "Authentication is required to install a security signature"
-#~ msgstr "å®è½¬å®å
¨ç¾åè¦æ±éè¿éªè¯"
-
-#~ msgid "Authentication is required to update all packages"
-#~ msgstr "æ´æ°å
¨é¨å
è¦æ±éè¿éªè¯"
-
-#~ msgid "Install package"
-#~ msgstr "å®è£
å
"
-
-#~ msgid "Install security signature"
-#~ msgstr "å®è£
å®å
¨ç¾å"
-
-#~ msgid "Refresh package lists"
-#~ msgstr "å·æ°å
å表"
-
-#~ msgid "Update all packages"
-#~ msgstr "æ´æ°ææå
"
-
-#~ msgid ""
-#~ "Could not find a package with that name to install, or package already "
-#~ "installed"
-#~ msgstr "æªè½æ¾å°è¿ä¸ªååçå
æ¥å®è£
ï¼æå
å·²ç»å®è£
"
-
-#~ msgid "Could not find a package with that name to update"
-#~ msgstr "æªè½æ¾å°è¿ä¸ªååçå
æ¥å级"
-
-#~ msgid "Could not find a description for this package"
-#~ msgstr "æªè½æ¾å°è¿ä¸ªå
çæè¿°"
+msgstr "åºéå½å°è¯å¯å¨ï¼%s\n"
-#~ msgid "You need to specify a package to find the description for"
-#~ msgstr "æ¨è¦æå®ä¸ä¸ªå
æ¥æ¥æ¾æè¿°"
commit 2a22350f6e6fa6484650914bed028ee027f7010b
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 14:30:31 2008 +0100
trivial fix to the dummy backend
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index d57bd6a..d750f7a 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -191,9 +191,9 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- len = g_strv_length (_package_ids);
+ len = g_strv_length (package_ids);
for (i=0; i<len; i++) {
- package_id = _package_ids[i];
+ package_id = package_ids[i];
if (egg_strequal (package_id, "powertop;1.8-1.fc8;i386;fedora"))
pk_backend_files (backend, package_id, "/usr/share/man/man1/boo;/usr/bin/xchat-gnome");
else if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed"))
commit 97e102f1a39e9866ea1b7d3ae40346ae9e65bc64
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 13:41:30 2008 +0100
trivial: don't warn when we finish twice, just return failure
diff --git a/src/pk-backend.c b/src/pk-backend.c
index a135cbf..2bb2660 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1470,11 +1470,8 @@ pk_backend_finished (PkBackend *backend)
}
/* check we have not already finished */
- if (backend->priv->finished) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "%s cannot request Finished more than once!", role_text);
+ if (backend->priv->finished)
return FALSE;
- }
/* check we got a Package() else the UI will suck */
if (!backend->priv->set_error &&
commit 7579d416946feb5496fbe35a5ea8021135db463b
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 13:10:24 2008 +0100
trivial: don't proxy status-changed and progress-changed in PkPostTransaction, use the backend directly
diff --git a/src/pk-post-trans.c b/src/pk-post-trans.c
index 4083132..d831734 100644
--- a/src/pk-post-trans.c
+++ b/src/pk-post-trans.c
@@ -54,13 +54,6 @@ struct PkPostTransPrivate
guint package_id;
};
-enum {
- PK_POST_TRANS_STATUS_CHANGED,
- PK_POST_TRANS_PROGRESS_CHANGED,
- PK_POST_TRANS_LAST_SIGNAL
-};
-
-static guint signals [PK_POST_TRANS_LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (PkPostTrans, pk_post_trans, G_TYPE_OBJECT)
/**
@@ -83,26 +76,6 @@ pk_post_trans_package_cb (PkBackend *backend, const PkPackageObj *obj, PkPostTra
}
/**
- * pk_post_trans_emit_status_changed:
- **/
-static void
-pk_post_trans_emit_status_changed (PkPostTrans *post, PkStatusEnum status)
-{
- egg_debug ("emiting status-changed %s", pk_status_enum_to_text (status));
- g_signal_emit (post, signals [PK_POST_TRANS_STATUS_CHANGED], 0, status);
-}
-
-/**
- * pk_post_trans_emit_progress_changed:
- **/
-static void
-pk_post_trans_emit_progress_changed (PkPostTrans *post, guint percentage)
-{
- egg_debug ("emiting progress-changed %i", percentage);
- g_signal_emit (post, signals [PK_POST_TRANS_PROGRESS_CHANGED], 0, percentage, 0, 0, 0);
-}
-
-/**
* pk_import_get_locale:
**/
static gchar *
@@ -378,7 +351,7 @@ pk_post_trans_import_desktop_files (PkPostTrans *post)
/* use a local backend instance */
pk_backend_reset (post->priv->backend);
- pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+ pk_backend_set_status (post->priv->backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
egg_debug ("getting old desktop mtimes");
mtimes_old = egg_string_list_new ();
@@ -402,7 +375,7 @@ pk_post_trans_import_desktop_files (PkPostTrans *post)
}
/* update UI */
- pk_post_trans_emit_progress_changed (post, 0);
+ pk_backend_set_percentage (post->priv->backend, 0);
step = 100.0f / EGG_OBJ_LIST(mtimes)->len;
/* for each new package, process the desktop file */
@@ -424,7 +397,7 @@ pk_post_trans_import_desktop_files (PkPostTrans *post)
g_free (filename);
/* update UI */
- pk_post_trans_emit_progress_changed (post, i * step);
+ pk_backend_set_percentage (post->priv->backend, i * step);
}
/* save new mtimes data */
@@ -434,8 +407,8 @@ pk_post_trans_import_desktop_files (PkPostTrans *post)
no_changes:
/* update UI */
- pk_post_trans_emit_progress_changed (post, 100);
- pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_FINISHED);
+ pk_backend_set_percentage (post->priv->backend, 100);
+ pk_backend_set_status (post->priv->backend, PK_STATUS_ENUM_FINISHED);
g_object_unref (files);
g_object_unref (mtimes);
@@ -464,8 +437,8 @@ pk_post_trans_update_package_list (PkPostTrans *post)
pk_package_list_clear (post->priv->list);
/* update UI */
- pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_post_trans_emit_progress_changed (post, 101);
+ pk_backend_set_status (post->priv->backend, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_backend_set_percentage (post->priv->backend, 101);
/* get the new package list */
pk_backend_reset (post->priv->backend);
@@ -476,7 +449,7 @@ pk_post_trans_update_package_list (PkPostTrans *post)
g_main_loop_run (post->priv->loop);
/* update UI */
- pk_post_trans_emit_progress_changed (post, 90);
+ pk_backend_set_percentage (post->priv->backend, 90);
/* convert to a file */
ret = pk_package_list_to_file (post->priv->list, PK_SYSTEM_PACKAGE_LIST_FILENAME);
@@ -484,8 +457,8 @@ pk_post_trans_update_package_list (PkPostTrans *post)
egg_warning ("failed to save to file");
/* update UI */
- pk_post_trans_emit_progress_changed (post, 100);
- pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_FINISHED);
+ pk_backend_set_percentage (post->priv->backend, 100);
+ pk_backend_set_status (post->priv->backend, PK_STATUS_ENUM_FINISHED);
return ret;
}
@@ -545,16 +518,6 @@ pk_post_trans_class_init (PkPostTransClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = pk_post_trans_finalize;
- signals [PK_POST_TRANS_STATUS_CHANGED] =
- g_signal_new ("status-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
- signals [PK_POST_TRANS_PROGRESS_CHANGED] =
- g_signal_new ("progress-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
- G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
g_type_class_add_private (klass, sizeof (PkPostTransPrivate));
}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index f95e71c..0b249c7 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -566,20 +566,15 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
}
/* disconnect these straight away, as the PkTransaction object takes time to timeout */
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_details);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_error_code);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_files);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_distro_upgrade);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_finished);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_message);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_package);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_progress_changed);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_detail);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_signature_required);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_eula_required);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_require_restart);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_status_changed);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_update_detail);
g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_category);
@@ -601,6 +596,13 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
pk_post_trans_clear_firmware_requests (transaction->priv->post_trans);
}
+ /* signals we are allowed to send from a post transaction */
+ g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
+ g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_message);
+ g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_status_changed);
+ g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_progress_changed);
+ g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_require_restart);
+
/* if we did not send this, ensure the GUI has the right state */
if (transaction->priv->allow_cancel)
pk_transaction_allow_cancel_emit (transaction, FALSE);
@@ -3659,12 +3661,7 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->inhibit = pk_inhibit_new ();
transaction->priv->package_list = pk_package_list_new ();
transaction->priv->transaction_list = pk_transaction_list_new ();
-
transaction->priv->post_trans = pk_post_trans_new ();
- g_signal_connect (transaction->priv->post_trans, "status-changed",
- G_CALLBACK (pk_transaction_status_changed_cb), transaction);
- g_signal_connect (transaction->priv->post_trans, "progress-changed",
- G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
transaction->priv->transaction_db = pk_transaction_db_new ();
g_signal_connect (transaction->priv->transaction_db, "transaction",
commit 10e7014d31a84a6cc828a006b13528a41a45fd24
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 12:59:16 2008 +0100
trivial: make PkPostTrans an object in PkTransaction
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 784e398..f95e71c 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -102,6 +102,7 @@ struct PkTransactionPrivate
PkUpdateDetailList *update_detail_list;
PkNotify *notify;
PkSecurity *security;
+ PkPostTrans *post_trans;
/* needed for gui coldplugging */
gchar *last_package_id;
@@ -585,27 +586,19 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
/* do some optional extra actions when we've finished refreshing the cache */
if (exit == PK_EXIT_ENUM_SUCCESS &&
transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
- PkPostTrans *post_trans;
- post_trans = pk_post_trans_new ();
-
- g_signal_connect (post_trans, "status-changed",
- G_CALLBACK (pk_transaction_status_changed_cb), transaction);
- g_signal_connect (post_trans, "progress-changed",
- G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
/* generate the package list */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheUpdatePackageList");
if (ret)
- pk_post_trans_update_package_list (post_trans);
+ pk_post_trans_update_package_list (transaction->priv->post_trans);
/* refresh the desktop icon cache */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheScanDesktopFiles");
if (ret)
- pk_post_trans_import_desktop_files (post_trans);
+ pk_post_trans_import_desktop_files (transaction->priv->post_trans);
/* clear the firmware requests directory */
- pk_post_trans_clear_firmware_requests (post_trans);
- g_object_unref (post_trans);
+ pk_post_trans_clear_firmware_requests (transaction->priv->post_trans);
}
/* if we did not send this, ensure the GUI has the right state */
@@ -3666,6 +3659,13 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->inhibit = pk_inhibit_new ();
transaction->priv->package_list = pk_package_list_new ();
transaction->priv->transaction_list = pk_transaction_list_new ();
+
+ transaction->priv->post_trans = pk_post_trans_new ();
+ g_signal_connect (transaction->priv->post_trans, "status-changed",
+ G_CALLBACK (pk_transaction_status_changed_cb), transaction);
+ g_signal_connect (transaction->priv->post_trans, "progress-changed",
+ G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
+
transaction->priv->transaction_db = pk_transaction_db_new ();
g_signal_connect (transaction->priv->transaction_db, "transaction",
G_CALLBACK (pk_transaction_transaction_cb), transaction);
@@ -3720,6 +3720,7 @@ pk_transaction_finalize (GObject *object)
g_object_unref (transaction->priv->transaction_db);
g_object_unref (transaction->priv->security);
g_object_unref (transaction->priv->notify);
+ g_object_unref (transaction->priv->post_trans);
G_OBJECT_CLASS (pk_transaction_parent_class)->finalize (object);
}
commit d595aba9949177493a896dc306f0a070776af423
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 12:54:52 2008 +0100
trivial: rename PkRefresh to PkPostTrans as we're doing other actions too
diff --git a/src/Makefile.am b/src/Makefile.am
index bebee18..0e0d958 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,8 +63,8 @@ shared_SOURCES = \
pk-network.h \
pk-shared.c \
pk-shared.h \
- pk-refresh.c \
- pk-refresh.h \
+ pk-post-trans.c \
+ pk-post-trans.h \
pk-network-nm.h \
pk-network-unix.c \
pk-network-unix.h \
diff --git a/src/pk-post-trans.c b/src/pk-post-trans.c
new file mode 100644
index 0000000..4083132
--- /dev/null
+++ b/src/pk-post-trans.c
@@ -0,0 +1,630 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#ifdef PK_BUILD_GIO
+ #include <gio/gio.h>
+#endif
+
+#include <pk-common.h>
+
+#include "egg-debug.h"
+#include "egg-string-list.h"
+
+#include "pk-post-trans.h"
+#include "pk-shared.h"
+#include "pk-extra.h"
+#include "pk-marshal.h"
+#include "pk-backend-internal.h"
+
+#define PK_POST_TRANS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_POST_TRANS, PkPostTransPrivate))
+
+struct PkPostTransPrivate
+{
+ PkBackend *backend;
+ PkExtra *extra;
+ GMainLoop *loop;
+ PkPackageList *list;
+ guint finished_id;
+ guint package_id;
+};
+
+enum {
+ PK_POST_TRANS_STATUS_CHANGED,
+ PK_POST_TRANS_PROGRESS_CHANGED,
+ PK_POST_TRANS_LAST_SIGNAL
+};
+
+static guint signals [PK_POST_TRANS_LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (PkPostTrans, pk_post_trans, G_TYPE_OBJECT)
+
+/**
+ * pk_post_trans_finished_cb:
+ **/
+static void
+pk_post_trans_finished_cb (PkBackend *backend, PkExitEnum exit, PkPostTrans *post)
+{
+ if (g_main_loop_is_running (post->priv->loop))
+ g_main_loop_quit (post->priv->loop);
+}
+
+/**
+ * pk_post_trans_package_cb:
+ **/
+static void
+pk_post_trans_package_cb (PkBackend *backend, const PkPackageObj *obj, PkPostTrans *post)
+{
+ pk_package_list_add_obj (post->priv->list, obj);
+}
+
+/**
+ * pk_post_trans_emit_status_changed:
+ **/
+static void
+pk_post_trans_emit_status_changed (PkPostTrans *post, PkStatusEnum status)
+{
+ egg_debug ("emiting status-changed %s", pk_status_enum_to_text (status));
+ g_signal_emit (post, signals [PK_POST_TRANS_STATUS_CHANGED], 0, status);
+}
+
+/**
+ * pk_post_trans_emit_progress_changed:
+ **/
+static void
+pk_post_trans_emit_progress_changed (PkPostTrans *post, guint percentage)
+{
+ egg_debug ("emiting progress-changed %i", percentage);
+ g_signal_emit (post, signals [PK_POST_TRANS_PROGRESS_CHANGED], 0, percentage, 0, 0, 0);
+}
+
+/**
+ * pk_import_get_locale:
+ **/
+static gchar *
+pk_import_get_locale (const gchar *buffer)
+{
+ guint len;
+ gchar *locale;
+ gchar *result;
+ result = g_strrstr (buffer, "[");
+ if (result == NULL)
+ return NULL;
+ locale = g_strdup (result+1);
+ len = egg_strlen (locale, 20);
+ locale[len-1] = '\0';
+ return locale;
+}
+
+/**
+ * pk_post_trans_import_desktop_files_process_desktop:
+ **/
+static void
+pk_post_trans_import_desktop_files_process_desktop (PkPostTrans *post, const gchar *package_name, const gchar *filename)
+{
+ GKeyFile *key;
+ gboolean ret;
+ guint i;
+ gchar *name = NULL;
+ gchar *name_unlocalised = NULL;
+ gchar *exec = NULL;
+ gchar *icon = NULL;
+ gchar *comment = NULL;
+ gchar *genericname = NULL;
+ const gchar *locale = NULL;
+ gchar **key_array;
+ gsize len;
+ gchar *locale_temp;
+ static GPtrArray *locale_array = NULL;
+
+ key = g_key_file_new ();
+ ret = g_key_file_load_from_file (key, filename, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
+ if (!ret) {
+ egg_warning ("cannot open desktop file %s", filename);
+ return;
+ }
+
+ /* get this specific locale list */
+ key_array = g_key_file_get_keys (key, G_KEY_FILE_DESKTOP_GROUP, &len, NULL);
+ locale_array = g_ptr_array_new ();
+ for (i=0; i<len; i++) {
+ if (g_str_has_prefix (key_array[i], "Name")) {
+ /* set the locale */
+ locale_temp = pk_import_get_locale (key_array[i]);
+ if (locale_temp != NULL)
+ g_ptr_array_add (locale_array, g_strdup (locale_temp));
+ }
+ }
+ g_strfreev (key_array);
+
+ /* make sure this is still set, as we are sharing PkExtra */
+ pk_extra_set_access (post->priv->extra, PK_EXTRA_ACCESS_WRITE_ONLY);
+
+ /* get the default entry */
+ name_unlocalised = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
+ if (!egg_strzero (name_unlocalised)) {
+ pk_extra_set_locale (post->priv->extra, "C");
+ pk_extra_set_data_locale (post->priv->extra, package_name, name_unlocalised);
+ }
+
+ /* for each locale */
+ for (i=0; i<locale_array->len; i++) {
+ locale = g_ptr_array_index (locale_array, i);
+ /* compare the translated against the default */
+ name = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", locale, NULL);
+
+ /* if different, then save */
+ if (egg_strequal (name_unlocalised, name) == FALSE) {
+ comment = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
+ "Comment", locale, NULL);
+ genericname = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
+ "GenericName", locale, NULL);
+ pk_extra_set_locale (post->priv->extra, locale);
+
+ /* save in order of priority */
+ if (comment != NULL)
+ pk_extra_set_data_locale (post->priv->extra, package_name, comment);
+ else if (genericname != NULL)
+ pk_extra_set_data_locale (post->priv->extra, package_name, genericname);
+ else
+ pk_extra_set_data_locale (post->priv->extra, package_name, name);
+ g_free (comment);
+ g_free (genericname);
+ }
+ g_free (name);
+ }
+ g_ptr_array_foreach (locale_array, (GFunc) g_free, NULL);
+ g_ptr_array_free (locale_array, TRUE);
+ g_free (name_unlocalised);
+
+ exec = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Exec", NULL);
+ icon = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL);
+ pk_extra_set_data_package (post->priv->extra, package_name, icon, exec);
+ g_free (icon);
+ g_free (exec);
+
+ g_key_file_free (key);
+}
+
+/**
+ * pk_post_trans_import_desktop_files_get_package:
+ **/
+static gchar *
+pk_post_trans_import_desktop_files_get_package (PkPostTrans *post, const gchar *filename)
+{
+ guint size;
+ gchar *name = NULL;
+ const PkPackageObj *obj;
+ PkStore *store;
+
+ /* use PK to find the correct package */
+ pk_package_list_clear (post->priv->list);
+ pk_backend_reset (post->priv->backend);
+ store = pk_backend_get_store (post->priv->backend);
+ pk_store_set_uint (store, "filters", pk_bitfield_value (PK_FILTER_ENUM_INSTALLED));
+ pk_store_set_string (store, "search", filename);
+ post->priv->backend->desc->search_file (post->priv->backend, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), filename);
+
+ /* wait for finished */
+ g_main_loop_run (post->priv->loop);
+
+ /* check that we only matched one package */
+ size = pk_package_list_get_size (post->priv->list);
+ if (size != 1) {
+ egg_warning ("not correct size, %i", size);
+ goto out;
+ }
+
+ /* get the obj */
+ obj = pk_package_list_get_obj (post->priv->list, 0);
+ if (obj == NULL) {
+ egg_warning ("cannot get obj");
+ goto out;
+ }
+
+ /* strip the name */
+ name = g_strdup (obj->id->name);
+
+out:
+ return name;
+}
+
+/**
+ * pk_post_trans_import_desktop_files_get_files:
+ *
+ * Returns a list of all the files in the applicaitons directory
+ **/
+#ifdef PK_BUILD_GIO
+static guint
+pk_post_trans_get_filename_mtime (const gchar *filename)
+{
+ GFileInfo *info;
+ GFile *file;
+ GError *error = NULL;
+ GTimeVal time;
+
+ file = g_file_new_for_path (filename);
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, &error);
+ if (info == NULL) {
+ egg_warning ("%s", error->message);
+ g_error_free (error);
+ return 0;
+ }
+
+ /* get the mtime */
+ g_file_info_get_modification_time (info, &time);
+ g_object_unref (file);
+ g_object_unref (info);
+
+ return time.tv_sec;
+}
+#else
+static guint
+pk_post_trans_get_filename_mtime (const gchar *filename)
+{
+ return 0;
+}
+#endif
+
+/**
+ * pk_post_trans_import_desktop_files_get_files:
+ *
+ * Returns a list of all the files in the applicaitons directory
+ **/
+static EggStringList *
+pk_post_trans_import_desktop_files_get_files (PkPostTrans *post)
+{
+ GDir *dir;
+ EggStringList *list;
+ GPatternSpec *pattern;
+ gchar *filename;
+ gboolean match;
+ const gchar *name;
+ const gchar *directory = "/usr/share/applications";
+
+ /* open directory */
+ dir = g_dir_open (directory, 0, NULL);
+ if (dir == NULL) {
+ egg_warning ("not a valid desktop dir!");
+ return NULL;
+ }
+
+ /* find files */
+ pattern = g_pattern_spec_new ("*.desktop");
+ name = g_dir_read_name (dir);
+ list = egg_string_list_new ();
+ while (name != NULL) {
+ /* ITS4: ignore, not used for allocation and has to be NULL terminated */
+ match = g_pattern_match (pattern, strlen (name), name, NULL);
+ if (match) {
+ filename = g_build_filename (directory, name, NULL);
+ egg_obj_list_add (EGG_OBJ_LIST (list), filename);
+ }
+ name = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+
+ return list;
+}
+
+/**
+ * pk_post_trans_import_desktop_files_get_mtimes:
+ **/
+static EggStringList *
+pk_post_trans_import_desktop_files_get_mtimes (const EggStringList *files)
+{
+ guint i;
+ guint mtime;
+ gchar *encode;
+ const gchar *filename;
+ EggStringList *list;
+
+ list = egg_string_list_new ();
+ for (i=0; i<EGG_OBJ_LIST(files)->len; i++) {
+ filename = egg_string_list_index (files, i);
+ mtime = pk_post_trans_get_filename_mtime (filename);
+ encode = g_strdup_printf ("%s|%i|v1", filename, mtime);
+ egg_obj_list_add (EGG_OBJ_LIST (list), encode);
+ g_free (encode);
+ }
+ return list;
+}
+
+/**
+ * pk_post_trans_import_desktop_files:
+ **/
+gboolean
+pk_post_trans_import_desktop_files (PkPostTrans *post)
+{
+ guint i;
+ gboolean ret;
+ gchar *package_name;
+ gfloat step;
+ EggStringList *files;
+ EggStringList *mtimes;
+ EggStringList *mtimes_old;
+ gchar *filename;
+
+ g_return_val_if_fail (PK_IS_POST_TRANS (post), FALSE);
+
+ if (post->priv->backend->desc->search_file == NULL) {
+ egg_debug ("cannot search files");
+ return FALSE;
+ }
+
+ /* use a local backend instance */
+ pk_backend_reset (post->priv->backend);
+ pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+
+ egg_debug ("getting old desktop mtimes");
+ mtimes_old = egg_string_list_new ();
+ ret = egg_obj_list_from_file (EGG_OBJ_LIST (mtimes_old), "/var/lib/PackageKit/desktop-mtimes.txt");
+ if (!ret)
+ egg_warning ("failed to get old mtimes of desktop files");
+
+ /* get the file list */
+ files = pk_post_trans_import_desktop_files_get_files (post);
+
+ /* get the mtimes */
+ mtimes = pk_post_trans_import_desktop_files_get_mtimes (files);
+
+ /* remove old desktop files we've already processed */
+ egg_obj_list_remove_list (EGG_OBJ_LIST(mtimes), EGG_OBJ_LIST (mtimes_old));
+
+ /* shortcut, there are no files to scan */
+ if (EGG_OBJ_LIST(mtimes)->len == 0) {
+ egg_debug ("no desktop files needed to scan");
+ goto no_changes;
+ }
+
+ /* update UI */
+ pk_post_trans_emit_progress_changed (post, 0);
+ step = 100.0f / EGG_OBJ_LIST(mtimes)->len;
+
+ /* for each new package, process the desktop file */
+ for (i=0; i<EGG_OBJ_LIST(mtimes)->len; i++) {
+
+ /* get the filename from the mtime encoded string */
+ filename = g_strdup (egg_string_list_index (mtimes, i));
+ g_strdelimit (filename, "|", '\0');
+
+ /* get the name */
+ package_name = pk_post_trans_import_desktop_files_get_package (post, filename);
+
+ /* process the file */
+ if (package_name != NULL)
+ pk_post_trans_import_desktop_files_process_desktop (post, package_name, filename);
+ else
+ egg_warning ("%s ignored, failed to get package name\n", filename);
+ g_free (package_name);
+ g_free (filename);
+
+ /* update UI */
+ pk_post_trans_emit_progress_changed (post, i * step);
+ }
+
+ /* save new mtimes data */
+ ret = egg_obj_list_to_file (EGG_OBJ_LIST (mtimes), "/var/lib/PackageKit/desktop-mtimes.txt");
+ if (!ret)
+ egg_warning ("failed to set old mtimes of desktop files");
+
+no_changes:
+ /* update UI */
+ pk_post_trans_emit_progress_changed (post, 100);
+ pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_FINISHED);
+
+ g_object_unref (files);
+ g_object_unref (mtimes);
+ g_object_unref (mtimes_old);
+ return TRUE;
+}
+
+/**
+ * pk_post_trans_update_package_list:
+ **/
+gboolean
+pk_post_trans_update_package_list (PkPostTrans *post)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (PK_IS_POST_TRANS (post), FALSE);
+
+ if (post->priv->backend->desc->get_packages == NULL) {
+ egg_debug ("cannot get packages");
+ return FALSE;
+ }
+
+ egg_debug ("updating package lists");
+
+ /* clear old list */
+ pk_package_list_clear (post->priv->list);
+
+ /* update UI */
+ pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_post_trans_emit_progress_changed (post, 101);
+
+ /* get the new package list */
+ pk_backend_reset (post->priv->backend);
+ pk_store_set_uint (pk_backend_get_store (post->priv->backend), "filters", pk_bitfield_value (PK_FILTER_ENUM_NONE));
+ post->priv->backend->desc->get_packages (post->priv->backend, PK_FILTER_ENUM_NONE);
+
+ /* wait for finished */
+ g_main_loop_run (post->priv->loop);
+
+ /* update UI */
+ pk_post_trans_emit_progress_changed (post, 90);
+
+ /* convert to a file */
+ ret = pk_package_list_to_file (post->priv->list, PK_SYSTEM_PACKAGE_LIST_FILENAME);
+ if (!ret)
+ egg_warning ("failed to save to file");
+
+ /* update UI */
+ pk_post_trans_emit_progress_changed (post, 100);
+ pk_post_trans_emit_status_changed (post, PK_STATUS_ENUM_FINISHED);
+
+ return ret;
+}
+
+/**
+ * pk_post_trans_clear_firmware_requests:
+ **/
+gboolean
+pk_post_trans_clear_firmware_requests (PkPostTrans *post)
+{
+ gboolean ret;
+ gchar *filename;
+
+ g_return_val_if_fail (PK_IS_POST_TRANS (post), FALSE);
+
+ /* clear the firmware requests directory */
+ filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
+ egg_debug ("clearing udev firmware requests at %s", filename);
+ ret = pk_directory_remove_contents (filename);
+ if (!ret)
+ egg_warning ("failed to clear %s", filename);
+ g_free (filename);
+ return ret;
+}
+
+/**
+ * pk_post_trans_finalize:
+ **/
+static void
+pk_post_trans_finalize (GObject *object)
+{
+ PkPostTrans *post;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (PK_IS_POST_TRANS (object));
+ post = PK_POST_TRANS (object);
+
+ g_signal_handler_disconnect (post->priv->backend, post->priv->finished_id);
+ g_signal_handler_disconnect (post->priv->backend, post->priv->package_id);
+
+ if (g_main_loop_is_running (post->priv->loop))
+ g_main_loop_quit (post->priv->loop);
+ g_main_loop_unref (post->priv->loop);
+
+ g_object_unref (post->priv->backend);
+ g_object_unref (post->priv->extra);
+ g_object_unref (post->priv->list);
+
+ G_OBJECT_CLASS (pk_post_trans_parent_class)->finalize (object);
+}
+
+/**
+ * pk_post_trans_class_init:
+ **/
+static void
+pk_post_trans_class_init (PkPostTransClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_post_trans_finalize;
+ signals [PK_POST_TRANS_STATUS_CHANGED] =
+ g_signal_new ("status-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+ signals [PK_POST_TRANS_PROGRESS_CHANGED] =
+ g_signal_new ("progress-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
+ G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
+ g_type_class_add_private (klass, sizeof (PkPostTransPrivate));
+}
+
+/**
+ * pk_post_trans_init:
+ *
+ * initializes the post_trans class. NOTE: We expect post_trans objects
+ * to *NOT* be removed or added during the session.
+ * We only control the first post_trans object if there are more than one.
+ **/
+static void
+pk_post_trans_init (PkPostTrans *post)
+{
+ gboolean ret;
+
+ post->priv = PK_POST_TRANS_GET_PRIVATE (post);
+ post->priv->loop = g_main_loop_new (NULL, FALSE);
+ post->priv->list = pk_package_list_new ();
+ post->priv->backend = pk_backend_new ();
+
+ post->priv->finished_id =
+ g_signal_connect (post->priv->backend, "finished",
+ G_CALLBACK (pk_post_trans_finished_cb), post);
+ post->priv->package_id =
+ g_signal_connect (post->priv->backend, "package",
+ G_CALLBACK (pk_post_trans_package_cb), post);
+
+ post->priv->extra = pk_extra_new ();
+ pk_extra_set_access (post->priv->extra, PK_EXTRA_ACCESS_WRITE_ONLY);
+
+ /* use the default location */
+ ret = pk_extra_set_database (post->priv->extra, NULL);
+ if (!ret)
+ egg_warning ("Could not open extra database");
+}
+
+/**
+ * pk_post_trans_new:
+ * Return value: A new post_trans class instance.
+ **/
+PkPostTrans *
+pk_post_trans_new (void)
+{
+ PkPostTrans *post;
+ post = g_object_new (PK_TYPE_POST_TRANS, NULL);
+ return PK_POST_TRANS (post);
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+egg_test_post_trans (EggTest *test)
+{
+ PkPostTrans *post;
+
+ if (!egg_test_start (test, "PkPostTrans"))
+ return;
+
+ /************************************************************/
+ egg_test_title (test, "get an instance");
+ post = pk_post_trans_new ();
+ egg_test_assert (test, post != NULL);
+
+ g_object_unref (post);
+
+ egg_test_end (test);
+}
+#endif
+
diff --git a/src/pk-post-trans.h b/src/pk-post-trans.h
new file mode 100644
index 0000000..de716e5
--- /dev/null
+++ b/src/pk-post-trans.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_POST_TRANS_H
+#define __PK_POST_TRANS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_POST_TRANS (pk_post_trans_get_type ())
+#define PK_POST_TRANS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_POST_TRANS, PkPostTrans))
+#define PK_POST_TRANS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_POST_TRANS, PkPostTransClass))
+#define PK_IS_POST_TRANS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_POST_TRANS))
+#define PK_IS_POST_TRANS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_POST_TRANS))
+#define PK_POST_TRANS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_POST_TRANS, PkPostTransClass))
+
+typedef struct PkPostTransPrivate PkPostTransPrivate;
+
+typedef struct
+{
+ GObject parent;
+ PkPostTransPrivate *priv;
+} PkPostTrans;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} PkPostTransClass;
+
+GType pk_post_trans_get_type (void) G_GNUC_CONST;
+PkPostTrans *pk_post_trans_new (void);
+
+gboolean pk_post_trans_clear_firmware_requests (PkPostTrans *post);
+gboolean pk_post_trans_update_package_list (PkPostTrans *post);
+gboolean pk_post_trans_import_desktop_files (PkPostTrans *post);
+
+G_END_DECLS
+
+#endif /* __PK_POST_TRANS_H */
+
diff --git a/src/pk-refresh.c b/src/pk-refresh.c
deleted file mode 100644
index 0c14b67..0000000
--- a/src/pk-refresh.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#ifdef PK_BUILD_GIO
- #include <gio/gio.h>
-#endif
-
-#include <pk-common.h>
-
-#include "egg-debug.h"
-#include "egg-string-list.h"
-
-#include "pk-refresh.h"
-#include "pk-shared.h"
-#include "pk-extra.h"
-#include "pk-marshal.h"
-#include "pk-backend-internal.h"
-
-#define PK_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_REFRESH, PkRefreshPrivate))
-
-struct PkRefreshPrivate
-{
- PkBackend *backend;
- PkExtra *extra;
- GMainLoop *loop;
- PkPackageList *list;
- guint finished_id;
- guint package_id;
-};
-
-enum {
- PK_REFRESH_STATUS_CHANGED,
- PK_REFRESH_PROGRESS_CHANGED,
- PK_REFRESH_LAST_SIGNAL
-};
-
-static guint signals [PK_REFRESH_LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (PkRefresh, pk_refresh, G_TYPE_OBJECT)
-
-/**
- * pk_refresh_finished_cb:
- **/
-static void
-pk_refresh_finished_cb (PkBackend *backend, PkExitEnum exit, PkRefresh *refresh)
-{
- if (g_main_loop_is_running (refresh->priv->loop))
- g_main_loop_quit (refresh->priv->loop);
-}
-
-/**
- * pk_refresh_package_cb:
- **/
-static void
-pk_refresh_package_cb (PkBackend *backend, const PkPackageObj *obj, PkRefresh *refresh)
-{
- pk_package_list_add_obj (refresh->priv->list, obj);
-}
-
-/**
- * pk_refresh_emit_status_changed:
- **/
-static void
-pk_refresh_emit_status_changed (PkRefresh *refresh, PkStatusEnum status)
-{
- egg_debug ("emiting status-changed %s", pk_status_enum_to_text (status));
- g_signal_emit (refresh, signals [PK_REFRESH_STATUS_CHANGED], 0, status);
-}
-
-/**
- * pk_refresh_emit_progress_changed:
- **/
-static void
-pk_refresh_emit_progress_changed (PkRefresh *refresh, guint percentage)
-{
- egg_debug ("emiting progress-changed %i", percentage);
- g_signal_emit (refresh, signals [PK_REFRESH_PROGRESS_CHANGED], 0, percentage, 0, 0, 0);
-}
-
-/**
- * pk_import_get_locale:
- **/
-static gchar *
-pk_import_get_locale (const gchar *buffer)
-{
- guint len;
- gchar *locale;
- gchar *result;
- result = g_strrstr (buffer, "[");
- if (result == NULL)
- return NULL;
- locale = g_strdup (result+1);
- len = egg_strlen (locale, 20);
- locale[len-1] = '\0';
- return locale;
-}
-
-/**
- * pk_refresh_import_desktop_files_process_desktop:
- **/
-static void
-pk_refresh_import_desktop_files_process_desktop (PkRefresh *refresh, const gchar *package_name, const gchar *filename)
-{
- GKeyFile *key;
- gboolean ret;
- guint i;
- gchar *name = NULL;
- gchar *name_unlocalised = NULL;
- gchar *exec = NULL;
- gchar *icon = NULL;
- gchar *comment = NULL;
- gchar *genericname = NULL;
- const gchar *locale = NULL;
- gchar **key_array;
- gsize len;
- gchar *locale_temp;
- static GPtrArray *locale_array = NULL;
-
- key = g_key_file_new ();
- ret = g_key_file_load_from_file (key, filename, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
- if (!ret) {
- egg_warning ("cannot open desktop file %s", filename);
- return;
- }
-
- /* get this specific locale list */
- key_array = g_key_file_get_keys (key, G_KEY_FILE_DESKTOP_GROUP, &len, NULL);
- locale_array = g_ptr_array_new ();
- for (i=0; i<len; i++) {
- if (g_str_has_prefix (key_array[i], "Name")) {
- /* set the locale */
- locale_temp = pk_import_get_locale (key_array[i]);
- if (locale_temp != NULL)
- g_ptr_array_add (locale_array, g_strdup (locale_temp));
- }
- }
- g_strfreev (key_array);
-
- /* make sure this is still set, as we are sharing PkExtra */
- pk_extra_set_access (refresh->priv->extra, PK_EXTRA_ACCESS_WRITE_ONLY);
-
- /* get the default entry */
- name_unlocalised = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
- if (!egg_strzero (name_unlocalised)) {
- pk_extra_set_locale (refresh->priv->extra, "C");
- pk_extra_set_data_locale (refresh->priv->extra, package_name, name_unlocalised);
- }
-
- /* for each locale */
- for (i=0; i<locale_array->len; i++) {
- locale = g_ptr_array_index (locale_array, i);
- /* compare the translated against the default */
- name = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", locale, NULL);
-
- /* if different, then save */
- if (egg_strequal (name_unlocalised, name) == FALSE) {
- comment = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
- "Comment", locale, NULL);
- genericname = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
- "GenericName", locale, NULL);
- pk_extra_set_locale (refresh->priv->extra, locale);
-
- /* save in order of priority */
- if (comment != NULL)
- pk_extra_set_data_locale (refresh->priv->extra, package_name, comment);
- else if (genericname != NULL)
- pk_extra_set_data_locale (refresh->priv->extra, package_name, genericname);
- else
- pk_extra_set_data_locale (refresh->priv->extra, package_name, name);
- g_free (comment);
- g_free (genericname);
- }
- g_free (name);
- }
- g_ptr_array_foreach (locale_array, (GFunc) g_free, NULL);
- g_ptr_array_free (locale_array, TRUE);
- g_free (name_unlocalised);
-
- exec = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Exec", NULL);
- icon = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL);
- pk_extra_set_data_package (refresh->priv->extra, package_name, icon, exec);
- g_free (icon);
- g_free (exec);
-
- g_key_file_free (key);
-}
-
-/**
- * pk_refresh_import_desktop_files_get_package:
- **/
-static gchar *
-pk_refresh_import_desktop_files_get_package (PkRefresh *refresh, const gchar *filename)
-{
- guint size;
- gchar *name = NULL;
- const PkPackageObj *obj;
- PkStore *store;
-
- /* use PK to find the correct package */
- pk_package_list_clear (refresh->priv->list);
- pk_backend_reset (refresh->priv->backend);
- store = pk_backend_get_store (refresh->priv->backend);
- pk_store_set_uint (store, "filters", pk_bitfield_value (PK_FILTER_ENUM_INSTALLED));
- pk_store_set_string (store, "search", filename);
- refresh->priv->backend->desc->search_file (refresh->priv->backend, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), filename);
-
- /* wait for finished */
- g_main_loop_run (refresh->priv->loop);
-
- /* check that we only matched one package */
- size = pk_package_list_get_size (refresh->priv->list);
- if (size != 1) {
- egg_warning ("not correct size, %i", size);
- goto out;
- }
-
- /* get the obj */
- obj = pk_package_list_get_obj (refresh->priv->list, 0);
- if (obj == NULL) {
- egg_warning ("cannot get obj");
- goto out;
- }
-
- /* strip the name */
- name = g_strdup (obj->id->name);
-
-out:
- return name;
-}
-
-/**
- * pk_refresh_import_desktop_files_get_files:
- *
- * Returns a list of all the files in the applicaitons directory
- **/
-#ifdef PK_BUILD_GIO
-static guint
-pk_refresh_get_filename_mtime (const gchar *filename)
-{
- GFileInfo *info;
- GFile *file;
- GError *error = NULL;
- GTimeVal time;
-
- file = g_file_new_for_path (filename);
- info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, &error);
- if (info == NULL) {
- egg_warning ("%s", error->message);
- g_error_free (error);
- return 0;
- }
-
- /* get the mtime */
- g_file_info_get_modification_time (info, &time);
- g_object_unref (file);
- g_object_unref (info);
-
- return time.tv_sec;
-}
-#else
-static guint
-pk_refresh_get_filename_mtime (const gchar *filename)
-{
- return 0;
-}
-#endif
-
-/**
- * pk_refresh_import_desktop_files_get_files:
- *
- * Returns a list of all the files in the applicaitons directory
- **/
-static EggStringList *
-pk_refresh_import_desktop_files_get_files (PkRefresh *refresh)
-{
- GDir *dir;
- EggStringList *list;
- GPatternSpec *pattern;
- gchar *filename;
- gboolean match;
- const gchar *name;
- const gchar *directory = "/usr/share/applications";
-
- /* open directory */
- dir = g_dir_open (directory, 0, NULL);
- if (dir == NULL) {
- egg_warning ("not a valid desktop dir!");
- return NULL;
- }
-
- /* find files */
- pattern = g_pattern_spec_new ("*.desktop");
- name = g_dir_read_name (dir);
- list = egg_string_list_new ();
- while (name != NULL) {
- /* ITS4: ignore, not used for allocation and has to be NULL terminated */
- match = g_pattern_match (pattern, strlen (name), name, NULL);
- if (match) {
- filename = g_build_filename (directory, name, NULL);
- egg_obj_list_add (EGG_OBJ_LIST (list), filename);
- }
- name = g_dir_read_name (dir);
- }
- g_dir_close (dir);
-
- return list;
-}
-
-/**
- * pk_refresh_import_desktop_files_get_mtimes:
- **/
-static EggStringList *
-pk_refresh_import_desktop_files_get_mtimes (const EggStringList *files)
-{
- guint i;
- guint mtime;
- gchar *encode;
- const gchar *filename;
- EggStringList *list;
-
- list = egg_string_list_new ();
- for (i=0; i<EGG_OBJ_LIST(files)->len; i++) {
- filename = egg_string_list_index (files, i);
- mtime = pk_refresh_get_filename_mtime (filename);
- encode = g_strdup_printf ("%s|%i|v1", filename, mtime);
- egg_obj_list_add (EGG_OBJ_LIST (list), encode);
- g_free (encode);
- }
- return list;
-}
-
-/**
- * pk_refresh_import_desktop_files:
- **/
-gboolean
-pk_refresh_import_desktop_files (PkRefresh *refresh)
-{
- guint i;
- gboolean ret;
- gchar *package_name;
- gfloat step;
- EggStringList *files;
- EggStringList *mtimes;
- EggStringList *mtimes_old;
- gchar *filename;
-
- g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
-
- if (refresh->priv->backend->desc->search_file == NULL) {
- egg_debug ("cannot search files");
- return FALSE;
- }
-
- /* use a local backend instance */
- pk_backend_reset (refresh->priv->backend);
- pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_SCAN_APPLICATIONS);
-
- egg_debug ("getting old desktop mtimes");
- mtimes_old = egg_string_list_new ();
- ret = egg_obj_list_from_file (EGG_OBJ_LIST (mtimes_old), "/var/lib/PackageKit/desktop-mtimes.txt");
- if (!ret)
- egg_warning ("failed to get old mtimes of desktop files");
-
- /* get the file list */
- files = pk_refresh_import_desktop_files_get_files (refresh);
-
- /* get the mtimes */
- mtimes = pk_refresh_import_desktop_files_get_mtimes (files);
-
- /* remove old desktop files we've already processed */
- egg_obj_list_remove_list (EGG_OBJ_LIST(mtimes), EGG_OBJ_LIST (mtimes_old));
-
- /* shortcut, there are no files to scan */
- if (EGG_OBJ_LIST(mtimes)->len == 0) {
- egg_debug ("no desktop files needed to scan");
- goto no_changes;
- }
-
- /* update UI */
- pk_refresh_emit_progress_changed (refresh, 0);
- step = 100.0f / EGG_OBJ_LIST(mtimes)->len;
-
- /* for each new package, process the desktop file */
- for (i=0; i<EGG_OBJ_LIST(mtimes)->len; i++) {
-
- /* get the filename from the mtime encoded string */
- filename = g_strdup (egg_string_list_index (mtimes, i));
- g_strdelimit (filename, "|", '\0');
-
- /* get the name */
- package_name = pk_refresh_import_desktop_files_get_package (refresh, filename);
-
- /* process the file */
- if (package_name != NULL)
- pk_refresh_import_desktop_files_process_desktop (refresh, package_name, filename);
- else
- egg_warning ("%s ignored, failed to get package name\n", filename);
- g_free (package_name);
- g_free (filename);
-
- /* update UI */
- pk_refresh_emit_progress_changed (refresh, i * step);
- }
-
- /* save new mtimes data */
- ret = egg_obj_list_to_file (EGG_OBJ_LIST (mtimes), "/var/lib/PackageKit/desktop-mtimes.txt");
- if (!ret)
- egg_warning ("failed to set old mtimes of desktop files");
-
-no_changes:
- /* update UI */
- pk_refresh_emit_progress_changed (refresh, 100);
- pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_FINISHED);
-
- g_object_unref (files);
- g_object_unref (mtimes);
- g_object_unref (mtimes_old);
- return TRUE;
-}
-
-/**
- * pk_refresh_update_package_list:
- **/
-gboolean
-pk_refresh_update_package_list (PkRefresh *refresh)
-{
- gboolean ret;
-
- g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
-
- if (refresh->priv->backend->desc->get_packages == NULL) {
- egg_debug ("cannot get packages");
- return FALSE;
- }
-
- egg_debug ("updating package lists");
-
- /* clear old list */
- pk_package_list_clear (refresh->priv->list);
-
- /* update UI */
- pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_refresh_emit_progress_changed (refresh, 101);
-
- /* get the new package list */
- pk_backend_reset (refresh->priv->backend);
- pk_store_set_uint (pk_backend_get_store (refresh->priv->backend), "filters", pk_bitfield_value (PK_FILTER_ENUM_NONE));
- refresh->priv->backend->desc->get_packages (refresh->priv->backend, PK_FILTER_ENUM_NONE);
-
- /* wait for finished */
- g_main_loop_run (refresh->priv->loop);
-
- /* update UI */
- pk_refresh_emit_progress_changed (refresh, 90);
-
- /* convert to a file */
- ret = pk_package_list_to_file (refresh->priv->list, PK_SYSTEM_PACKAGE_LIST_FILENAME);
- if (!ret)
- egg_warning ("failed to save to file");
-
- /* update UI */
- pk_refresh_emit_progress_changed (refresh, 100);
- pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_FINISHED);
-
- return ret;
-}
-
-/**
- * pk_refresh_clear_firmware_requests:
- **/
-gboolean
-pk_refresh_clear_firmware_requests (PkRefresh *refresh)
-{
- gboolean ret;
- gchar *filename;
-
- g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
-
- /* clear the firmware requests directory */
- filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
- egg_debug ("clearing udev firmware requests at %s", filename);
- ret = pk_directory_remove_contents (filename);
- if (!ret)
- egg_warning ("failed to clear %s", filename);
- g_free (filename);
- return ret;
-}
-
-/**
- * pk_refresh_finalize:
- **/
-static void
-pk_refresh_finalize (GObject *object)
-{
- PkRefresh *refresh;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_REFRESH (object));
- refresh = PK_REFRESH (object);
-
- g_signal_handler_disconnect (refresh->priv->backend, refresh->priv->finished_id);
- g_signal_handler_disconnect (refresh->priv->backend, refresh->priv->package_id);
-
- if (g_main_loop_is_running (refresh->priv->loop))
- g_main_loop_quit (refresh->priv->loop);
- g_main_loop_unref (refresh->priv->loop);
-
- g_object_unref (refresh->priv->backend);
- g_object_unref (refresh->priv->extra);
- g_object_unref (refresh->priv->list);
-
- G_OBJECT_CLASS (pk_refresh_parent_class)->finalize (object);
-}
-
-/**
- * pk_refresh_class_init:
- **/
-static void
-pk_refresh_class_init (PkRefreshClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_refresh_finalize;
- signals [PK_REFRESH_STATUS_CHANGED] =
- g_signal_new ("status-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
- signals [PK_REFRESH_PROGRESS_CHANGED] =
- g_signal_new ("progress-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
- G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
- g_type_class_add_private (klass, sizeof (PkRefreshPrivate));
-}
-
-/**
- * pk_refresh_init:
- *
- * initializes the refresh class. NOTE: We expect refresh objects
- * to *NOT* be removed or added during the session.
- * We only control the first refresh object if there are more than one.
- **/
-static void
-pk_refresh_init (PkRefresh *refresh)
-{
- gboolean ret;
-
- refresh->priv = PK_REFRESH_GET_PRIVATE (refresh);
- refresh->priv->loop = g_main_loop_new (NULL, FALSE);
- refresh->priv->list = pk_package_list_new ();
- refresh->priv->backend = pk_backend_new ();
-
- refresh->priv->finished_id =
- g_signal_connect (refresh->priv->backend, "finished",
- G_CALLBACK (pk_refresh_finished_cb), refresh);
- refresh->priv->package_id =
- g_signal_connect (refresh->priv->backend, "package",
- G_CALLBACK (pk_refresh_package_cb), refresh);
-
- refresh->priv->extra = pk_extra_new ();
- pk_extra_set_access (refresh->priv->extra, PK_EXTRA_ACCESS_WRITE_ONLY);
-
- /* use the default location */
- ret = pk_extra_set_database (refresh->priv->extra, NULL);
- if (!ret)
- egg_warning ("Could not open extra database");
-}
-
-/**
- * pk_refresh_new:
- * Return value: A new refresh class instance.
- **/
-PkRefresh *
-pk_refresh_new (void)
-{
- PkRefresh *refresh;
- refresh = g_object_new (PK_TYPE_REFRESH, NULL);
- return PK_REFRESH (refresh);
-}
-
-/***************************************************************************
- *** MAKE CHECK TESTS ***
- ***************************************************************************/
-#ifdef EGG_TEST
-#include "egg-test.h"
-
-void
-egg_test_refresh (EggTest *test)
-{
- PkRefresh *refresh;
-
- if (!egg_test_start (test, "PkRefresh"))
- return;
-
- /************************************************************/
- egg_test_title (test, "get an instance");
- refresh = pk_refresh_new ();
- egg_test_assert (test, refresh != NULL);
-
- g_object_unref (refresh);
-
- egg_test_end (test);
-}
-#endif
-
diff --git a/src/pk-refresh.h b/src/pk-refresh.h
deleted file mode 100644
index 1bcc70c..0000000
--- a/src/pk-refresh.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PK_REFRESH_H
-#define __PK_REFRESH_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_REFRESH (pk_refresh_get_type ())
-#define PK_REFRESH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_REFRESH, PkRefresh))
-#define PK_REFRESH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_REFRESH, PkRefreshClass))
-#define PK_IS_REFRESH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_REFRESH))
-#define PK_IS_REFRESH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_REFRESH))
-#define PK_REFRESH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_REFRESH, PkRefreshClass))
-
-typedef struct PkRefreshPrivate PkRefreshPrivate;
-
-typedef struct
-{
- GObject parent;
- PkRefreshPrivate *priv;
-} PkRefresh;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkRefreshClass;
-
-GType pk_refresh_get_type (void) G_GNUC_CONST;
-PkRefresh *pk_refresh_new (void);
-
-gboolean pk_refresh_clear_firmware_requests (PkRefresh *refresh);
-gboolean pk_refresh_update_package_list (PkRefresh *refresh);
-gboolean pk_refresh_import_desktop_files (PkRefresh *refresh);
-
-G_END_DECLS
-
-#endif /* __PK_REFRESH_H */
-
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index cbf8e78..784e398 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -66,7 +66,7 @@
#include "pk-cache.h"
#include "pk-notify.h"
#include "pk-security.h"
-#include "pk-refresh.h"
+#include "pk-post-trans.h"
#include "pk-service-pack.h"
static void pk_transaction_class_init (PkTransactionClass *klass);
@@ -585,27 +585,27 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
/* do some optional extra actions when we've finished refreshing the cache */
if (exit == PK_EXIT_ENUM_SUCCESS &&
transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
- PkRefresh *refresh;
- refresh = pk_refresh_new ();
+ PkPostTrans *post_trans;
+ post_trans = pk_post_trans_new ();
- g_signal_connect (refresh, "status-changed",
+ g_signal_connect (post_trans, "status-changed",
G_CALLBACK (pk_transaction_status_changed_cb), transaction);
- g_signal_connect (refresh, "progress-changed",
+ g_signal_connect (post_trans, "progress-changed",
G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
/* generate the package list */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheUpdatePackageList");
if (ret)
- pk_refresh_update_package_list (refresh);
+ pk_post_trans_update_package_list (post_trans);
/* refresh the desktop icon cache */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheScanDesktopFiles");
if (ret)
- pk_refresh_import_desktop_files (refresh);
+ pk_post_trans_import_desktop_files (post_trans);
/* clear the firmware requests directory */
- pk_refresh_clear_firmware_requests (refresh);
- g_object_unref (refresh);
+ pk_post_trans_clear_firmware_requests (post_trans);
+ g_object_unref (post_trans);
}
/* if we did not send this, ensure the GUI has the right state */
commit 1a892c914c17e9f810540a90642d0a6385f82295
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 12:17:19 2008 +0100
trivial: fix up some debugging to use words, not numbers
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 8cc58e6..a135cbf 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -938,7 +938,7 @@ pk_backend_require_restart (PkBackend *backend, PkRestartEnum restart, const gch
return FALSE;
}
- egg_debug ("emit require-restart %i, %s", restart, details);
+ egg_debug ("emit require-restart %s, %s", pk_restart_enum_to_text (restart), details);
g_signal_emit (backend, signals [PK_BACKEND_REQUIRE_RESTART], 0, restart, details);
return TRUE;
commit a67c51c5ae5db29ff5e6bc7d231e1e2992e0593d
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 12:16:55 2008 +0100
trivial: add an internal function, egg_obj_list_exists()
diff --git a/libpackagekit/egg-obj-list.c b/libpackagekit/egg-obj-list.c
index 9c1ae32..e37e29c 100644
--- a/libpackagekit/egg-obj-list.c
+++ b/libpackagekit/egg-obj-list.c
@@ -369,11 +369,11 @@ egg_obj_list_remove_duplicate (EggObjList *list)
/**
* egg_obj_list_find_obj:
* @list: a valid #EggObjList instance
- * @obj: a valid #gpointer object
+ * @obj: a valid #gconstpointer object
*
* Return value: the object
*
- * Removes an item from a list
+ * Finds an item in a list
**/
static gpointer
egg_obj_list_find_obj (EggObjList *list, gconstpointer obj)
@@ -399,6 +399,23 @@ egg_obj_list_find_obj (EggObjList *list, gconstpointer obj)
}
/**
+ * egg_obj_list_exists:
+ * @list: a valid #EggObjList instance
+ * @obj: a valid #gconstpointer object
+ *
+ * Return value: the object
+ *
+ * Finds an item in a list
+ **/
+gboolean
+egg_obj_list_exists (EggObjList *list, gconstpointer obj)
+{
+ gconstpointer obj_tmp;
+ obj_tmp = egg_obj_list_find_obj (list, obj);
+ return (obj_tmp != NULL);
+}
+
+/**
* egg_obj_list_remove:
* @list: a valid #EggObjList instance
* @obj: a valid #gpointer object
diff --git a/libpackagekit/egg-obj-list.h b/libpackagekit/egg-obj-list.h
index 3ccf01b..6eb9a7e 100644
--- a/libpackagekit/egg-obj-list.h
+++ b/libpackagekit/egg-obj-list.h
@@ -87,6 +87,8 @@ void egg_obj_list_add_array (EggObjList *list,
void egg_obj_list_remove_list (EggObjList *list,
const EggObjList *data);
void egg_obj_list_remove_duplicate (EggObjList *list);
+gboolean egg_obj_list_exists (EggObjList *list,
+ gconstpointer data);
gboolean egg_obj_list_remove (EggObjList *list,
gconstpointer data);
gboolean egg_obj_list_remove_index (EggObjList *list,
commit 0fc191954171161b043aa008a7ecda48a85b8355
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 14 12:16:09 2008 +0100
dummy: make the backend a little cleverer for testing
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 49cd0a2..d57bd6a 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -185,9 +185,22 @@ backend_get_distro_upgrades (PkBackend *backend)
static void
backend_get_files (PkBackend *backend, gchar **package_ids)
{
+ guint i;
+ guint len;
+ const gchar *package_id;
+
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_files (backend, "gnome-power-manager;2.6.19;i386;fedora",
- "/usr/share/man/man1;/usr/share/man/man1/gnome-power-manager.1.gz");
+
+ len = g_strv_length (_package_ids);
+ for (i=0; i<len; i++) {
+ package_id = _package_ids[i];
+ if (egg_strequal (package_id, "powertop;1.8-1.fc8;i386;fedora"))
+ pk_backend_files (backend, package_id, "/usr/share/man/man1/boo;/usr/bin/xchat-gnome");
+ else if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed"))
+ pk_backend_files (backend, package_id, "/usr/share/man/man1;/usr/share/man/man1/gnome-power-manager.1.gz");
+ else if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora"))
+ pk_backend_files (backend, package_id, "/usr/share/man/man1;/usr/bin/ck-xinit-session");
+ }
pk_backend_finished (backend);
}
@@ -493,14 +506,29 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
static void
backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
{
+ guint i;
+ guint len;
+
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- if (egg_strequal (packages[0], "vips-doc")) {
- pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE,
- "vips-doc;7.12.4-2.fc8;noarch;linva",
- "The vips documentation package.");
- } else if (egg_strequal (packages[0], "glib2")) {
- pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
- "glib2;2.14.0;i386;fedora", "The GLib library");
+
+ /* each one has a different detail for testing */
+ len = g_strv_length (packages);
+ for (i=0; i<len; i++) {
+ if (egg_strequal (packages[i], "vips-doc"))
+ pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE,
+ "vips-doc;7.12.4-2.fc8;noarch;linva", "The vips documentation package.");
+ else if (egg_strequal (packages[i], "glib2"))
+ pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
+ "glib2;2.14.0;i386;fedora", "The GLib library");
+ else if (egg_strequal (packages[i], "powertop"))
+ pk_backend_package (backend, PK_INFO_ENUM_UPDATING,
+ "powertop;1.8-1.fc8;i386;fedora", "Power consumption monitor");
+ else if (egg_strequal (packages[i], "kernel"))
+ pk_backend_package (backend, PK_INFO_ENUM_UPDATING,
+ "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed", "The Linux kernel (the core of the Linux operating system)");
+ else if (egg_strequal (packages[i], "gtkhtml2"))
+ pk_backend_package (backend, PK_INFO_ENUM_UPDATING,
+ "gtkhtml2;2.19.1-4.fc8;i386;fedora", "An HTML widget for GTK+ 2.0");
}
pk_backend_finished (backend);
}
More information about the PackageKit-commit
mailing list