[packagekit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Jan 24 15:39:14 PST 2008
backends/apt/helpers/aptBackend.py | 14 +++---
backends/apt/pk-apt-search-sqlite.cpp | 2
backends/conary/helpers/conaryBackend.py | 20 ++++----
backends/dummy/pk-backend-dummy.c | 2
backends/pisi/helpers/pisiBackend.py | 36 +++++++--------
backends/test/pk-backend-test-dbus.c | 2
backends/test/pk-backend-test-spawn.c | 2
backends/yum/helpers/yumBackend.py | 40 ++++++++---------
backends/yum/helpers/yumDBUSBackend.py | 40 ++++++++---------
backends/zypp/pk-backend-zypp.cpp | 2
client/pk-monitor.c | 27 +++++++++++
docs/spec/pk-backends.xml | 2
docs/spec/pk-introduction.xml | 6 +-
libpackagekit/pk-client.c | 71 +++++++++++++++++++++++++++++++
libpackagekit/pk-client.h | 1
python/packagekit/backend.py | 6 +-
python/packagekit/daemonBackend.py | 6 +-
python/packagekit/frontend.py | 2
src/pk-backend-dbus.c | 12 ++---
src/pk-backend-spawn.c | 10 ++--
src/pk-backend.c | 28 ++++++------
src/pk-backend.h | 6 +-
src/pk-engine.c | 42 ++++++++++++++----
src/pk-engine.h | 4 +
src/pk-interface.xml | 9 +++
src/pk-runner.c | 38 ++++++++++++++--
src/pk-runner.h | 1
27 files changed, 297 insertions(+), 134 deletions(-)
New commits:
commit d58fb96154af9f3b8ac54285949f3d1d408d4f6d
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 24 23:37:57 2008 +0000
provide a method to get the allow-cancel for a transaction as we need this for coldplugging
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index e1b97ae..92c1981 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -67,7 +67,6 @@ struct PkClientPrivate
gboolean is_finished;
gboolean use_buffer;
gboolean promiscuous;
- gboolean allow_cancel;
gchar *tid;
PkPackageList *package_list;
PkConnection *pconnection;
@@ -692,9 +691,6 @@ pk_client_allow_cancel_cb (DBusGProxy *proxy, const gchar *tid,
return;
}
- /* cache */
- client->priv->allow_cancel = allow_cancel;
-
pk_debug ("emit allow-cancel %i", allow_cancel);
g_signal_emit (client , signals [PK_CLIENT_ALLOW_CANCEL], 0, allow_cancel);
}
@@ -705,10 +701,33 @@ pk_client_allow_cancel_cb (DBusGProxy *proxy, const gchar *tid,
gboolean
pk_client_get_allow_cancel (PkClient *client)
{
+ GError *error = NULL;
+ gboolean value = FALSE;
+ gboolean ret;
+
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (client->priv->tid != NULL, FALSE);
+
+ /* check to see if we have a valid transaction */
+ if (client->priv->tid == NULL) {
+ pk_warning ("Transaction ID not set");
+ return FALSE;
+ }
+
+ ret = dbus_g_proxy_call (client->priv->proxy, "GetAllowCancel", &error,
+ G_TYPE_STRING, client->priv->tid,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &value,
+ G_TYPE_INVALID);
+ if (ret == FALSE) {
+ /* abort as the DBUS method failed */
+ pk_warning ("GetAllowCancel failed :%s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
- return client->priv->allow_cancel;
+ return value;
}
/**
@@ -2628,7 +2647,6 @@ pk_client_init (PkClient *client)
client->priv->tid = NULL;
client->priv->use_buffer = FALSE;
client->priv->promiscuous = FALSE;
- client->priv->allow_cancel = FALSE;
client->priv->last_status = PK_STATUS_ENUM_UNKNOWN;
client->priv->require_restart = PK_RESTART_ENUM_NONE;
client->priv->role = PK_ROLE_ENUM_UNKNOWN;
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 8e701f1..718effb 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2312,6 +2312,30 @@ pk_engine_get_package (PkEngine *engine, const gchar *tid, gchar **package, GErr
}
/**
+ * pk_engine_get_allow_cancel:
+ **/
+gboolean
+pk_engine_get_allow_cancel (PkEngine *engine, const gchar *tid, gboolean *allow_cancel, GError **error)
+{
+ PkTransactionItem *item;
+
+ g_return_val_if_fail (engine != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
+
+ pk_debug ("GetAllowCancel method called: %s", tid);
+
+ /* find pre-requested transaction id */
+ item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
+ if (item == NULL) {
+ g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_NO_SUCH_TRANSACTION,
+ "No tid:%s", tid);
+ return FALSE;
+ }
+ *allow_cancel = pk_runner_get_allow_cancel (item->runner);
+ return TRUE;
+}
+
+/**
* pk_engine_get_old_transactions:
**/
gboolean
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 50c17dd..cb984b2 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -212,6 +212,10 @@ gboolean pk_engine_get_package (PkEngine *engine,
const gchar *tid,
gchar **package,
GError **error);
+gboolean pk_engine_get_allow_cancel (PkEngine *engine,
+ const gchar *tid,
+ gboolean *allow_cancel,
+ GError **error);
/* repo stuff */
void pk_engine_get_repo_list (PkEngine *engine,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 17dac6c..265ec24 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -153,7 +153,7 @@
</signal>
<signal name="AllowCancel">
<arg type="s" name="tid" direction="out"/>
- <arg type="b" name="allow_cancel" direction="out"/> <!-- if the transaction can be SIGKILL'd -->
+ <arg type="b" name="allow_cancel" direction="out"/>
</signal>
<signal name="ErrorCode">
<arg type="s" name="tid" direction="out"/>
@@ -238,6 +238,11 @@
<arg type="u" name="elapsed" direction="out"/>
<arg type="u" name="remaining" direction="out"/>
</method>
+ <method name="GetAllowCancel">
+ <!-- throws NoSuchTransaction -->
+ <arg type="s" name="tid" direction="in"/>
+ <arg type="b" name="allow_cancel" direction="out"/>
+ </method>
<method name="GetPackage">
<!-- throws NoSuchTransaction -->
<arg type="s" name="tid" direction="in"/>
diff --git a/src/pk-runner.c b/src/pk-runner.c
index 2e32a01..1ddf131 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -64,6 +64,7 @@ struct PkRunnerPrivate
PkRoleEnum role;
PkStatusEnum status;
gboolean finished;
+ gboolean allow_cancel;
gboolean cached_force;
gboolean cached_allow_deps;
gboolean cached_enabled;
@@ -82,6 +83,7 @@ struct PkRunnerPrivate
gulong signal_package;
gulong signal_finished;
gulong signal_status;
+ gulong signal_allow_cancel;
/* needed for gui coldplugging */
gchar *last_package;
gchar *dbus_name;
@@ -147,6 +149,17 @@ pk_runner_get_package (PkRunner *runner, gchar **package_id)
}
/**
+ * pk_runner_get_allow_cancel:
+ **/
+gboolean
+pk_runner_get_allow_cancel (PkRunner *runner)
+{
+ g_return_val_if_fail (runner != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_RUNNER (runner), FALSE);
+ return runner->priv->allow_cancel;
+}
+
+/**
* pk_runner_get_status:
*
* Even valid when the backend has moved on
@@ -196,8 +209,6 @@ pk_runner_get_text (PkRunner *runner)
gboolean
pk_runner_cancel (PkRunner *runner, gchar **error_text)
{
- gboolean killable;
-
g_return_val_if_fail (runner != NULL, FALSE);
g_return_val_if_fail (error_text != NULL, FALSE);
@@ -214,9 +225,8 @@ pk_runner_cancel (PkRunner *runner, gchar **error_text)
}
/* check if it's safe to kill */
- killable = pk_backend_get_allow_cancel (runner->priv->backend);
- if (killable == FALSE) {
- *error_text = g_strdup ("Tried to kill a process that is not safe to kill");
+ if (runner->priv->allow_cancel == FALSE) {
+ *error_text = g_strdup ("Tried to cancel a runner that is not safe to kill");
return FALSE;
}
runner->priv->backend->desc->cancel (runner->priv->backend);
@@ -1011,6 +1021,19 @@ pk_runner_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkRunner *
}
/**
+ * pk_runner_allow_cancel_cb:
+ **/
+static void
+pk_runner_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkRunner *runner)
+{
+ g_return_if_fail (runner != NULL);
+ g_return_if_fail (PK_IS_RUNNER (runner));
+
+ pk_debug ("AllowCancel now %i", allow_cancel);
+ runner->priv->allow_cancel = allow_cancel;
+}
+
+/**
* pk_runner_get_tid:
*/
const gchar *
@@ -1054,6 +1077,7 @@ pk_runner_finalize (GObject *object)
g_signal_handler_disconnect (runner->priv->backend, runner->priv->signal_package);
g_signal_handler_disconnect (runner->priv->backend, runner->priv->signal_finished);
g_signal_handler_disconnect (runner->priv->backend, runner->priv->signal_status);
+ g_signal_handler_disconnect (runner->priv->backend, runner->priv->signal_allow_cancel);
g_free (runner->priv->last_package);
g_free (runner->priv->dbus_name);
@@ -1105,6 +1129,7 @@ pk_runner_init (PkRunner *runner)
{
runner->priv = PK_RUNNER_GET_PRIVATE (runner);
runner->priv->finished = FALSE;
+ runner->priv->allow_cancel = TRUE;
runner->priv->dbus_name = NULL;
runner->priv->cached_enabled = FALSE;
runner->priv->cached_package_id = NULL;
@@ -1129,6 +1154,9 @@ pk_runner_init (PkRunner *runner)
runner->priv->signal_status =
g_signal_connect (runner->priv->backend, "status-changed",
G_CALLBACK (pk_runner_status_changed_cb), runner);
+ runner->priv->signal_allow_cancel =
+ g_signal_connect (runner->priv->backend, "allow-cancel",
+ G_CALLBACK (pk_runner_allow_cancel_cb), runner);
runner->priv->inhibit = pk_inhibit_new ();
runner->priv->network = pk_network_new ();
diff --git a/src/pk-runner.h b/src/pk-runner.h
index edcbaae..7d8e503 100644
--- a/src/pk-runner.h
+++ b/src/pk-runner.h
@@ -113,6 +113,7 @@ PkRoleEnum pk_runner_get_role (PkRunner *runner);
const gchar *pk_runner_get_text (PkRunner *runner);
gboolean pk_runner_get_package (PkRunner *runner,
gchar **package_id);
+gboolean pk_runner_get_allow_cancel (PkRunner *runner);
PkPackageList *pk_runner_get_package_list (PkRunner *runner);
PkEnumList *pk_runner_get_actions (PkRunner *runner);
PkEnumList *pk_runner_get_groups (PkRunner *runner);
commit 3022c879ea1d12c9fee3b9817873def0b52de6e7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 24 23:02:40 2008 +0000
rationalise the AllowCancel nomenclature and make it standard throughout
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 2501f72..6853938 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -255,7 +255,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
Implement the {backend}-search-name functionality
'''
self.status(STATUS_INFO)
- self.allow_interrupt(True)
+ self.allow_cancel(True)
for package in self._do_search(filters,
lambda pkg: pkg.match_name(key)):
self._emit_package(package)
@@ -265,7 +265,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
Implement the {backend}-search-details functionality
'''
self.status(STATUS_INFO)
- self.allow_interrupt(True)
+ self.allow_cancel(True)
for package in self._do_search(filters,
lambda pkg: pkg.match_details(key)):
self._emit_package(package)
@@ -275,7 +275,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
Implement the {backend}-search-group functionality
'''
self.status(STATUS_INFO)
- self.allow_interrupt(True)
+ self.allow_cancel(True)
for package in self._do_search(filters,
lambda pkg: pkg.match_group(key)):
self._emit_package(package)
@@ -284,7 +284,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-file functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.error(ERROR_NOT_SUPPORTED,
@@ -324,7 +324,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-depends functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.status(STATUS_INFO)
name, version, arch, data = self.get_package_from_id(package)
pkg = Package(self,self._apt_cache[name],version=[(version,"=")],data=data)
@@ -364,7 +364,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-requires functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.status(STATUS_INFO)
name, version, arch, data = self.get_package_from_id(package)
pkg = Package(self,self._apt_cache[name], version, data)
@@ -376,7 +376,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-repo-list functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.status(STATUS_INFO)
sources = SourcesList()
root = apt_pkg.Config.FindDir("Dir::State::Lists")
diff --git a/backends/apt/pk-apt-search-sqlite.cpp b/backends/apt/pk-apt-search-sqlite.cpp
index 99c3ad4..329d9f4 100644
--- a/backends/apt/pk-apt-search-sqlite.cpp
+++ b/backends/apt/pk-apt-search-sqlite.cpp
@@ -98,7 +98,7 @@ extern "C" void
backend_search_group (PkBackend *backend, const gchar *filter, const gchar *search)
{
g_return_if_fail (backend != NULL);
- pk_backend_set_interruptable (backend, TRUE);
+ pk_backend_set_allow_cancel (backend, TRUE);
pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
}
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 9277041..6eaa07d 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -135,7 +135,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
suggMap = self.client.prepareUpdateJob(updJob, applyList)
if apply:
- self.allow_interrupt(False)
+ self.allow_cancel(False)
restartDir = self.client.applyUpdateJob(updJob)
return updJob, suggMap
@@ -150,7 +150,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def resolve(self, filter, package):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
self._do_search(package, filter)
@@ -171,7 +171,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-name functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
@@ -209,7 +209,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def get_files(self, package_id):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
def _get_files(troveSource, n, v, f):
@@ -236,7 +236,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def update_system(self):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
updateItems = self.client.fullUpdateItemList()
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
updJob, suggMap = self._do_update(applyList, apply=True)
@@ -255,7 +255,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
name, version, flavor, installed = self._findPackage(package_id)
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INSTALL)
@@ -277,7 +277,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
name, version, flavor, installed = self._findPackage(package_id)
- self.allow_interrupt(True)
+ self.allow_cancel(True)
if name:
if not installed == INFO_INSTALLED:
@@ -305,7 +305,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
categories
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
@@ -326,7 +326,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Print a detailed description for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -361,7 +361,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def get_updates(self):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 90d32e4..f2b5534 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -443,7 +443,7 @@ backend_update_system_timeout (gpointer data)
}
if (progress_percentage == 40) {
pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
- pk_backend_set_interruptable (backend, FALSE);
+ pk_backend_set_allow_cancel (backend, FALSE);
pk_backend_package (backend, PK_INFO_ENUM_INSTALLING,
"update1;2.19.1-4.fc8;i386;fedora",
"The first update");
@@ -471,7 +471,7 @@ backend_update_system (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_DOWNLOAD);
- pk_backend_set_interruptable (backend, TRUE);
+ pk_backend_set_allow_cancel (backend, TRUE);
progress_percentage = 0;
pk_backend_require_restart (backend, PK_RESTART_ENUM_SYSTEM, NULL);
g_timeout_add (1000, backend_update_system_timeout, backend);
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 0bd7dc5..4f6e6f2 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -152,7 +152,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_depends(self, package_id, recursive):
""" Prints a list of depends for a given package """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -163,7 +163,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_description(self, package_id):
""" Prints a detailed description for a given package """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -187,7 +187,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_files(self, package_id):
""" Prints a file list for a given package """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -204,7 +204,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_repo_list(self):
""" Prints available repositories """
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(None)
for repo in pisi.api.list_repos():
@@ -214,7 +214,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_requires(self, package_id, recursive):
""" Prints a list of requires for a given package """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -225,7 +225,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def get_updates(self):
""" Prints available updates and types """
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(None)
for package in pisi.api.list_upgradable():
@@ -246,7 +246,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def install_file(self, file):
""" Installs given package into system"""
# FIXME: install progress
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(None)
try:
@@ -260,7 +260,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def install(self, package_id):
""" Installs given package into system"""
# FIXME: fetch/install progress
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -276,7 +276,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def refresh_cache(self):
""" Updates repository indexes """
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
self.status(STATUS_REFRESH_CACHE)
@@ -292,7 +292,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def remove(self, deps, package_id):
""" Removes given package from system"""
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -309,7 +309,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def repo_set_data(self, repo_id, parameter, value):
""" Sets a parameter for the repository specified """
- self.allow_interrupt(False)
+ self.allow_cancel(False)
self.percentage(None)
if parameter == "add-repo":
@@ -333,14 +333,14 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def resolve(self, filters, package):
""" Turns a single package name into a package_id suitable for the other methods """
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(None)
self.__get_package(package, filters)
def search_details(self, filters, key):
""" Prints a detailed list of packages contains search term """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -350,7 +350,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def search_file(self, filters, key):
""" Prints the installed package which contains the specified file """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -362,7 +362,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def search_group(self, filters, group):
""" Prints a list of packages belongs to searched group """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -376,7 +376,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def search_name(self, filters, package):
""" Prints a list of packages contains search term in its name """
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -386,7 +386,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def update(self, package_id):
""" Updates given package to its latest version """
# FIXME: fetch/install progress
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -402,7 +402,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def update_system(self):
""" Updates all available packages """
# FIXME: fetch/install progress
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(None)
if not len(pisi.api.list_upgradable()) > 0:
diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c
index 626b9ca..0a3b32a 100644
--- a/backends/test/pk-backend-test-dbus.c
+++ b/backends/test/pk-backend-test-dbus.c
@@ -38,7 +38,7 @@ static void
backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
{
g_return_if_fail (backend != NULL);
- pk_backend_set_interruptable (backend, TRUE);
+ pk_backend_set_allow_cancel (backend, TRUE);
pk_backend_no_percentage_updates (backend);
pk_backend_dbus_search_name (dbus, filter, search);
}
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 91f5501..9c26063 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -34,7 +34,7 @@ static void
backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
{
g_return_if_fail (backend != NULL);
- pk_backend_set_interruptable (backend, TRUE);
+ pk_backend_set_allow_cancel (backend, TRUE);
pk_backend_no_percentage_updates (backend);
pk_backend_spawn_helper (spawn, "search-name.sh", filter, search, NULL);
}
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 4c28ed1..da00640 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -390,7 +390,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-name functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
searchlist = ['name']
@@ -401,7 +401,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-details functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
searchlist = ['name', 'summary', 'description', 'group']
@@ -430,7 +430,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-group functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 1 # Only look in cache.
@@ -471,7 +471,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-file functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
@@ -536,7 +536,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a list of requires for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
pkg,inst = self._findPackage(package)
@@ -626,7 +626,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a list of depends for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -652,7 +652,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-update-system functionality
'''
- self.allow_interrupt(False)
+ self.allow_cancel(False)
self.percentage(0)
txmbr = self.yumbase.update() # Add all updates to Transaction
@@ -665,7 +665,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-refresh_cache functionality
'''
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(0)
self.status(STATUS_REFRESH_CACHE)
@@ -700,7 +700,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-resolve functionality
'''
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(None)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
self.yumbase.conf.cache = 1 # Only look in cache.
@@ -733,7 +733,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
'''
- self.allow_interrupt(False)
+ self.allow_cancel(False)
self.percentage(0)
pkg,inst = self._findPackage(package)
@@ -827,7 +827,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Install the package containing the inst_file file
Needed to be implemented in a sub class
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkgs_to_inst = []
@@ -846,7 +846,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkg,inst = self._findPackage(package)
@@ -927,7 +927,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-remove functionality
Needed to be implemented in a sub class
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkg,inst = self._findPackage( package)
@@ -947,7 +947,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a detailed description for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -965,7 +965,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
def get_files(self, package):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -1005,7 +1005,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-updates functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
try:
@@ -1132,7 +1132,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-update_detail functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
pkg,inst = self._findPackage(package)
@@ -1329,7 +1329,7 @@ class ProcessTransPackageKitCallback:
def event(self,state,data=None):
if state == PT_DOWNLOAD: # Start Downloading
- self.base.allow_interrupt(True)
+ self.base.allow_cancel(True)
self.base.percentage(10)
self.base.status(STATUS_DOWNLOAD)
if state == PT_DOWNLOAD_PKGS: # Packages to download
@@ -1338,11 +1338,11 @@ class ProcessTransPackageKitCallback:
self.base.percentage(40)
pass
elif state == PT_TEST_TRANS:
- self.base.allow_interrupt(False)
+ self.base.allow_cancel(False)
self.base.percentage(45)
pass
elif state == PT_TRANSACTION:
- self.base.allow_interrupt(False)
+ self.base.allow_cancel(False)
self.base.percentage(50)
pass
diff --git a/backends/yum/helpers/yumDBUSBackend.py b/backends/yum/helpers/yumDBUSBackend.py
index e9a42fd..bd72286 100755
--- a/backends/yum/helpers/yumDBUSBackend.py
+++ b/backends/yum/helpers/yumDBUSBackend.py
@@ -393,7 +393,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-name functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
searchlist = ['name']
@@ -404,7 +404,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-details functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
searchlist = ['name', 'summary', 'description', 'group']
@@ -433,7 +433,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-group functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.yumbase.conf.cache = 1 # Only look in cache.
self.status(STATUS_QUERY)
@@ -473,7 +473,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-file functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
@@ -538,7 +538,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a list of requires for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
pkg,inst = self._findPackage(package)
@@ -628,7 +628,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a list of depends for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -654,7 +654,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-update-system functionality
'''
- self.allow_interrupt(False)
+ self.allow_cancel(False)
self.percentage(0)
txmbr = self.yumbase.update() # Add all updates to Transaction
@@ -667,7 +667,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-refresh_cache functionality
'''
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(0)
self.status(STATUS_REFRESH_CACHE)
@@ -702,7 +702,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-resolve functionality
'''
- self.allow_interrupt(True);
+ self.allow_cancel(True);
self.percentage(None)
self.yumbase.conf.cache = 1 # Only look in cache.
self.status(STATUS_QUERY)
@@ -734,7 +734,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
'''
- self.allow_interrupt(False)
+ self.allow_cancel(False)
self.percentage(0)
pkg,inst = self._findPackage(package)
@@ -828,7 +828,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Install the package containing the inst_file file
Needed to be implemented in a sub class
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkgs_to_inst = []
@@ -847,7 +847,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkg,inst = self._findPackage(package)
@@ -928,7 +928,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Implement the {backend}-remove functionality
Needed to be implemented in a sub class
'''
- self.allow_interrupt(False);
+ self.allow_cancel(False);
self.percentage(0)
pkg,inst = self._findPackage( package)
@@ -948,7 +948,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Print a detailed description for a given package
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -966,7 +966,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
def get_files(self, package):
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -1006,7 +1006,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-updates functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
try:
@@ -1133,7 +1133,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
Implement the {backend}-get-update_detail functionality
'''
- self.allow_interrupt(True)
+ self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
pkg,inst = self._findPackage(package)
@@ -1330,7 +1330,7 @@ class ProcessTransPackageKitCallback:
def event(self,state,data=None):
if state == PT_DOWNLOAD: # Start Downloading
- self.base.allow_interrupt(True)
+ self.base.allow_cancel(True)
self.base.percentage(10)
self.base.status(STATUS_DOWNLOAD)
if state == PT_DOWNLOAD_PKGS: # Packages to download
@@ -1339,11 +1339,11 @@ class ProcessTransPackageKitCallback:
self.base.percentage(40)
pass
elif state == PT_TEST_TRANS:
- self.base.allow_interrupt(False)
+ self.base.allow_cancel(False)
self.base.percentage(45)
pass
elif state == PT_TRANSACTION:
- self.base.allow_interrupt(False)
+ self.base.allow_cancel(False)
self.base.percentage(50)
pass
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index bccd156..8ab0b7e 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -639,7 +639,7 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
g_return_if_fail (backend != NULL);
// For now, don't let the user cancel the install once it's started
- pk_backend_set_interruptable (backend, FALSE);
+ pk_backend_set_allow_cancel (backend, FALSE);
//printf("package_id is %s\n", package_id);
gchar *package_to_install = g_strdup (package_id);
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index 6fa971c..5295e81 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -100,13 +100,13 @@ pk_monitor_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
}
/**
- * pk_monitor_allow_interrupt_cb:
+ * pk_monitor_allow_cancel_cb:
**/
static void
-pk_monitor_allow_interrupt_cb (PkClient *client, gboolean allow_kill, gpointer data)
+pk_monitor_allow_cancel_cb (PkClient *client, gboolean allow_cancel, gpointer data)
{
gchar *tid = pk_client_get_tid (client);
- g_print ("%s\tAllow Interrupt: %i\n", tid, allow_kill);
+ g_print ("%s\tAllow Cancel: %i\n", tid, allow_cancel);
g_free (tid);
}
@@ -195,8 +195,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_monitor_status_changed_cb), NULL);
g_signal_connect (client, "package",
G_CALLBACK (pk_monitor_package_cb), NULL);
- g_signal_connect (client, "allow-interrupt",
- G_CALLBACK (pk_monitor_allow_interrupt_cb), NULL);
+ g_signal_connect (client, "allow-cancel",
+ G_CALLBACK (pk_monitor_allow_cancel_cb), NULL);
tlist = pk_task_list_new ();
g_signal_connect (tlist, "task-list-changed",
diff --git a/docs/spec/pk-backends.xml b/docs/spec/pk-backends.xml
index ea8e28c..d9efb4d 100644
--- a/docs/spec/pk-backends.xml
+++ b/docs/spec/pk-backends.xml
@@ -177,7 +177,7 @@
</row>
<row>
<entry>AllowUpdate</entry>
- <entry><literal>allow-interrupt[tab]enabled</literal></entry>
+ <entry><literal>allow-cancel[tab]enabled</literal></entry>
<entry><literal>stderr</literal></entry>
</row>
<row>
diff --git a/docs/spec/pk-introduction.xml b/docs/spec/pk-introduction.xml
index 9a0a4a3..866d510 100644
--- a/docs/spec/pk-introduction.xml
+++ b/docs/spec/pk-introduction.xml
@@ -460,15 +460,15 @@
<title>Cancellation</title>
<para>
If you have a multipart transaction that can be aborted in one phase but
- not another then the AllowInterrupt signal can be sent.
+ not another then the AllowCancel signal can be sent.
This allows for example the yum download to be cancelled, but not the
install transaction.
By cancelling a job all subtransactions are killed.
</para>
<para>
By default actions cannot be cancelled unless enabled in the backend.
- Use <literal>AllowInterrupt(true)</literal> to enable cancellation
- and <literal>AllowInterrupt(false)</literal> to disable it.
+ Use <literal>AllowCancel(true)</literal> to enable cancellation
+ and <literal>AllowCancel(false)</literal> to disable it.
This can be done for any job type.
</para>
<para>
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 5d80b54..e1b97ae 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -67,7 +67,7 @@ struct PkClientPrivate
gboolean is_finished;
gboolean use_buffer;
gboolean promiscuous;
- gboolean allow_kill;
+ gboolean allow_cancel;
gchar *tid;
PkPackageList *package_list;
PkConnection *pconnection;
@@ -100,7 +100,7 @@ typedef enum {
PK_CLIENT_REPO_SIGNATURE_REQUIRED,
PK_CLIENT_CALLER_ACTIVE_CHANGED,
PK_CLIENT_REPO_DETAIL,
- PK_CLIENT_ALLOW_INTERRUPT,
+ PK_CLIENT_ALLOW_CANCEL,
PK_CLIENT_LOCKED,
PK_CLIENT_LAST_SIGNAL
} PkSignals;
@@ -678,11 +678,11 @@ pk_client_locked_cb (DBusGProxy *proxy, gboolean is_locked, PkClient *client)
}
/**
- * pk_client_allow_interrupt_cb:
+ * pk_client_allow_cancel_cb:
*/
static void
-pk_client_allow_interrupt_cb (DBusGProxy *proxy, const gchar *tid,
- gboolean allow_kill, PkClient *client)
+pk_client_allow_cancel_cb (DBusGProxy *proxy, const gchar *tid,
+ gboolean allow_cancel, PkClient *client)
{
g_return_if_fail (client != NULL);
g_return_if_fail (PK_IS_CLIENT (client));
@@ -693,22 +693,22 @@ pk_client_allow_interrupt_cb (DBusGProxy *proxy, const gchar *tid,
}
/* cache */
- client->priv->allow_kill = allow_kill;
+ client->priv->allow_cancel = allow_cancel;
- pk_debug ("emit allow-interrupt %i", allow_kill);
- g_signal_emit (client , signals [PK_CLIENT_ALLOW_INTERRUPT], 0, allow_kill);
+ pk_debug ("emit allow-cancel %i", allow_cancel);
+ g_signal_emit (client , signals [PK_CLIENT_ALLOW_CANCEL], 0, allow_cancel);
}
/**
- * pk_client_get_allow_interrupt:
+ * pk_client_get_allow_cancel:
*/
gboolean
-pk_client_get_allow_interrupt (PkClient *client)
+pk_client_get_allow_cancel (PkClient *client)
{
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- return client->priv->allow_kill;
+ return client->priv->allow_cancel;
}
/**
@@ -2571,8 +2571,8 @@ pk_client_class_init (PkClientClass *klass)
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, pk_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
- signals [PK_CLIENT_ALLOW_INTERRUPT] =
- g_signal_new ("allow-interrupt",
+ signals [PK_CLIENT_ALLOW_CANCEL] =
+ g_signal_new ("allow-cancel",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
@@ -2628,7 +2628,7 @@ pk_client_init (PkClient *client)
client->priv->tid = NULL;
client->priv->use_buffer = FALSE;
client->priv->promiscuous = FALSE;
- client->priv->allow_kill = FALSE;
+ client->priv->allow_cancel = FALSE;
client->priv->last_status = PK_STATUS_ENUM_UNKNOWN;
client->priv->require_restart = PK_RESTART_ENUM_NONE;
client->priv->role = PK_ROLE_ENUM_UNKNOWN;
@@ -2672,7 +2672,7 @@ pk_client_init (PkClient *client)
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT,
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
- /* AllowInterrupt */
+ /* AllowCancel */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_BOOLEAN,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
@@ -2812,9 +2812,9 @@ pk_client_init (PkClient *client)
dbus_g_proxy_connect_signal (proxy, "CallerActiveChanged",
G_CALLBACK (pk_client_caller_active_changed_cb), client, NULL);
- dbus_g_proxy_add_signal (proxy, "AllowInterrupt", G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (proxy, "AllowInterrupt",
- G_CALLBACK (pk_client_allow_interrupt_cb), client, NULL);
+ dbus_g_proxy_add_signal (proxy, "AllowCancel", G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (proxy, "AllowCancel",
+ G_CALLBACK (pk_client_allow_cancel_cb), client, NULL);
dbus_g_proxy_add_signal (proxy, "Locked", G_TYPE_BOOLEAN, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "Locked",
@@ -2868,8 +2868,8 @@ pk_client_finalize (GObject *object)
G_CALLBACK (pk_client_message_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "CallerActiveChanged",
G_CALLBACK (pk_client_caller_active_changed_cb), client);
- dbus_g_proxy_disconnect_signal (client->priv->proxy, "AllowInterrupt",
- G_CALLBACK (pk_client_allow_interrupt_cb), client);
+ dbus_g_proxy_disconnect_signal (client->priv->proxy, "AllowCancel",
+ G_CALLBACK (pk_client_allow_cancel_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Locked",
G_CALLBACK (pk_client_locked_cb), client);
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 5a39f4d..487cc4e 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -68,7 +68,7 @@ gchar *pk_client_get_tid (PkClient *client);
gboolean pk_client_set_use_buffer (PkClient *client,
gboolean use_buffer);
gboolean pk_client_get_use_buffer (PkClient *client);
-gboolean pk_client_get_allow_interrupt (PkClient *client);
+gboolean pk_client_get_allow_cancel (PkClient *client);
/* general methods */
gboolean pk_client_get_status (PkClient *client,
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 4ff4d92..94e1f8f 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -157,16 +157,16 @@ class PackageKitBaseBackend:
'''
print >> sys.stderr,"requirerestart\t%s\t%s" % (restart_type,details)
- def allow_interrupt(self,allow):
+ def allow_cancel(self,allow):
'''
- send 'allow-interrupt' signal:
+ send 'allow-cancel' signal:
@param allow: Allow the current process to be aborted.
'''
if allow:
data = 'true'
else:
data = 'false'
- print >> sys.stderr,"allow-interrupt\t%s" % (data)
+ print >> sys.stderr,"allow-cancel\t%s" % (data)
def repo_signature_required(self,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,type):
'''
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 82de3f3..7c23e91 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -256,16 +256,16 @@ class PackageKitBaseBackend(PackageKitDbusInterface):
'''
self.pk_iface.require_restart(self.tid,restart_type,details)
- def allow_interrupt(self,allow):
+ def allow_cancel(self,allow):
'''
- send 'allow-interrupt' signal:
+ send 'allow-cancel' signal:
@param allow: Allow the current process to be aborted.
'''
if allow:
data = 'true'
else:
data = 'false'
- self.pk_iface.allow_interrupt(self.tid,data)
+ self.pk_iface.allow_cancel(self.tid,data)
def repo_signature_required(self,repo_name,key_url,key_userid,key_id,key_fingerprint,key_timestamp,type):
'''
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 4a33796..8897916 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -72,7 +72,7 @@ class PackageKit(PackageKitDbusInterface):
elif kwargs['member'] == "Transaction":
self.Transaction(args[0],args[1],args[2],args[3],args[4],args[5])
elif kwargs['member'] in ["TransactionListChanged",
- "AllowInterrupt","JobListChanged", "Locked"]:
+ "AllowCancel","JobListChanged", "Locked"]:
pass
else:
print "Caught unhandled signal %s"% kwargs['member']
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 424bc5d..e63fe1d 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -225,13 +225,13 @@ pk_backend_dbus_finished_cb (DBusGProxy *proxy, PkExitEnum exit, PkBackendDbus *
}
/**
- * pk_backend_dbus_allow_interrupt_cb:
+ * pk_backend_dbus_allow_cancel_cb:
**/
static void
-pk_backend_dbus_allow_interrupt_cb (DBusGProxy *proxy, gboolean allow_kill, PkBackendDbus *backend_dbus)
+pk_backend_dbus_allow_cancel_cb (DBusGProxy *proxy, gboolean allow_cancel, PkBackendDbus *backend_dbus)
{
pk_debug ("got signal");
- pk_backend_set_interruptable (backend_dbus->priv->backend, allow_kill);
+ pk_backend_set_allow_cancel (backend_dbus->priv->backend, allow_cancel);
}
/**
@@ -325,7 +325,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Finished",
G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy, "AllowInterrupt",
+ dbus_g_proxy_add_signal (proxy, "AllowCancel",
G_TYPE_BOOLEAN, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "ErrorCode",
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
@@ -359,8 +359,8 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
G_CALLBACK (pk_backend_dbus_update_detail_cb), backend_dbus, NULL);
dbus_g_proxy_connect_signal (proxy, "Finished",
G_CALLBACK (pk_backend_dbus_finished_cb), backend_dbus, NULL);
- dbus_g_proxy_connect_signal (proxy, "AllowInterrupt",
- G_CALLBACK (pk_backend_dbus_allow_interrupt_cb), backend_dbus, NULL);
+ dbus_g_proxy_connect_signal (proxy, "AllowCancel",
+ G_CALLBACK (pk_backend_dbus_allow_cancel_cb), backend_dbus, NULL);
dbus_g_proxy_connect_signal (proxy, "ErrorCode",
G_CALLBACK (pk_backend_dbus_error_code_cb), backend_dbus, NULL);
dbus_g_proxy_connect_signal (proxy, "RequireRestart",
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 56777de..7da5f34 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -309,16 +309,16 @@ pk_backend_spawn_parse_common_error (PkBackendSpawn *backend_spawn, const gchar
goto out;
}
pk_backend_set_status (backend_spawn->priv->backend, status_enum);
- } else if (pk_strequal (command, "allow-interrupt") == TRUE) {
+ } else if (pk_strequal (command, "allow-cancel") == TRUE) {
if (size != 2) {
pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
if (pk_strequal (sections[1], "true") == TRUE) {
- pk_backend_set_interruptable (backend_spawn->priv->backend, TRUE);
+ pk_backend_set_allow_cancel (backend_spawn->priv->backend, TRUE);
} else if (pk_strequal (sections[1], "false") == TRUE) {
- pk_backend_set_interruptable (backend_spawn->priv->backend, FALSE);
+ pk_backend_set_allow_cancel (backend_spawn->priv->backend, FALSE);
} else {
pk_warning ("invalid section '%s'", sections[1]);
ret = FALSE;
@@ -760,7 +760,7 @@ libst_backend_spawn (LibSelfTest *test)
/************************************************************/
libst_title (test, "test pk_backend_spawn_parse_common_error AllowUpdate1");
- ret = pk_backend_spawn_parse_common_error (backend_spawn, "allow-interrupt\ttrue");
+ ret = pk_backend_spawn_parse_common_error (backend_spawn, "allow-cancel\ttrue");
if (ret == TRUE) {
libst_success (test, NULL);
} else {
@@ -769,7 +769,7 @@ libst_backend_spawn (LibSelfTest *test)
/************************************************************/
libst_title (test, "test pk_backend_spawn_parse_common_error AllowUpdate2");
- ret = pk_backend_spawn_parse_common_error (backend_spawn, "allow-interrupt\tbrian");
+ ret = pk_backend_spawn_parse_common_error (backend_spawn, "allow-cancel\tbrian");
if (ret == FALSE) {
libst_success (test, NULL);
} else {
diff --git a/src/pk-backend.c b/src/pk-backend.c
index eafc2d9..4f975ef 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -56,7 +56,7 @@ struct _PkBackendPrivate
PkExitEnum exit;
PkInhibit *inhibit;
gboolean during_initialize;
- gboolean is_interruptable;
+ gboolean allow_cancel;
gboolean finished;
guint last_percentage;
guint last_subpercentage;
@@ -81,7 +81,7 @@ enum {
PK_BACKEND_MESSAGE,
PK_BACKEND_CHANGE_TRANSACTION_DATA,
PK_BACKEND_FINISHED,
- PK_BACKEND_ALLOW_INTERRUPT,
+ PK_BACKEND_ALLOW_CANCEL,
PK_BACKEND_REPO_DETAIL,
PK_BACKEND_LAST_SIGNAL
};
@@ -594,37 +594,37 @@ pk_backend_error_code (PkBackend *backend, PkErrorCodeEnum code, const gchar *fo
}
/**
- * pk_backend_set_interruptable:
+ * pk_backend_set_allow_cancel:
**/
gboolean
-pk_backend_set_interruptable (PkBackend *backend, gboolean is_interruptable)
+pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- pk_debug ("emit allow-interrupt %i", is_interruptable);
- backend->priv->is_interruptable = is_interruptable;
+ pk_debug ("emit allow-cancel %i", allow_cancel);
+ backend->priv->allow_cancel = allow_cancel;
/* remove or add the hal inhibit */
- if (is_interruptable == TRUE) {
+ if (allow_cancel == TRUE) {
pk_inhibit_remove (backend->priv->inhibit, backend);
} else {
pk_inhibit_add (backend->priv->inhibit, backend);
}
- g_signal_emit (backend, signals [PK_BACKEND_ALLOW_INTERRUPT], 0, is_interruptable);
+ g_signal_emit (backend, signals [PK_BACKEND_ALLOW_CANCEL], 0, allow_cancel);
return TRUE;
}
/**
- * pk_backend_get_interruptable:
+ * pk_backend_get_allow_cancel:
**/
gboolean
-pk_backend_get_interruptable (PkBackend *backend)
+pk_backend_get_allow_cancel (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- return backend->priv->is_interruptable;
+ return backend->priv->allow_cancel;
}
/**
@@ -912,8 +912,8 @@ pk_backend_class_init (PkBackendClass *klass)
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_BACKEND_ALLOW_INTERRUPT] =
- g_signal_new ("allow-interrupt",
+ signals [PK_BACKEND_ALLOW_CANCEL] =
+ g_signal_new ("allow-cancel",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
@@ -935,7 +935,7 @@ pk_backend_reset (PkBackend *backend)
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
backend->priv->set_error = FALSE;
- backend->priv->is_interruptable = FALSE;
+ backend->priv->allow_cancel = FALSE;
backend->priv->finished = FALSE;
backend->priv->status = PK_STATUS_ENUM_UNKNOWN;
backend->priv->exit = PK_EXIT_ENUM_SUCCESS;
diff --git a/src/pk-backend.h b/src/pk-backend.h
index b1055f1..83e1877 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -40,8 +40,8 @@ gboolean pk_backend_set_role (PkBackend *backend,
PkRoleEnum role);
gboolean pk_backend_set_status (PkBackend *backend,
PkStatusEnum status);
-gboolean pk_backend_set_interruptable (PkBackend *backend,
- gboolean is_interruptable);
+gboolean pk_backend_set_allow_cancel (PkBackend *backend,
+ gboolean allow_cancel);
gboolean pk_backend_set_percentage (PkBackend *backend,
guint percentage);
gboolean pk_backend_set_sub_percentage (PkBackend *backend,
@@ -54,7 +54,7 @@ gboolean pk_backend_set_transaction_data (PkBackend *backend,
const gchar *pk_backend_get_current_tid (PkBackend *backend);
PkRoleEnum pk_backend_get_role (PkBackend *backend);
PkStatusEnum pk_backend_get_status (PkBackend *backend);
-gboolean pk_backend_get_interruptable (PkBackend *backend);
+gboolean pk_backend_get_allow_cancel (PkBackend *backend);
gboolean pk_backend_get_progress (PkBackend *backend,
guint *percentage,
guint *subpercentage,
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 2b8e76b..8e701f1 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -93,7 +93,7 @@ enum {
PK_ENGINE_UPDATE_DETAIL,
PK_ENGINE_DESCRIPTION,
PK_ENGINE_FILES,
- PK_ENGINE_ALLOW_INTERRUPT,
+ PK_ENGINE_ALLOW_CANCEL,
PK_ENGINE_CALLER_ACTIVE_CHANGED,
PK_ENGINE_LOCKED,
PK_ENGINE_REPO_DETAIL,
@@ -614,10 +614,10 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
}
/**
- * pk_engine_allow_interrupt_cb:
+ * pk_engine_allow_cancel_cb:
**/
static void
-pk_engine_allow_interrupt_cb (PkBackend *backend, gboolean allow_kill, PkEngine *engine)
+pk_engine_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkEngine *engine)
{
const gchar *c_tid;
@@ -630,8 +630,8 @@ pk_engine_allow_interrupt_cb (PkBackend *backend, gboolean allow_kill, PkEngine
return;
}
- pk_debug ("emitting allow-interrpt tid:%s, %i", c_tid, allow_kill);
- g_signal_emit (engine, signals [PK_ENGINE_ALLOW_INTERRUPT], 0, c_tid, allow_kill);
+ pk_debug ("emitting allow-interrpt tid:%s, %i", c_tid, allow_cancel);
+ g_signal_emit (engine, signals [PK_ENGINE_ALLOW_CANCEL], 0, c_tid, allow_cancel);
}
/**
@@ -2630,8 +2630,8 @@ pk_engine_class_init (PkEngineClass *klass)
0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE, 9, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals [PK_ENGINE_ALLOW_INTERRUPT] =
- g_signal_new ("allow-interrupt",
+ signals [PK_ENGINE_ALLOW_CANCEL] =
+ g_signal_new ("allow-cancel",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, pk_marshal_VOID__STRING_BOOL,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
@@ -2698,8 +2698,8 @@ pk_engine_init (PkEngine *engine)
G_CALLBACK (pk_engine_description_cb), engine);
g_signal_connect (engine->priv->backend, "files",
G_CALLBACK (pk_engine_files_cb), engine);
- g_signal_connect (engine->priv->backend, "allow-interrupt",
- G_CALLBACK (pk_engine_allow_interrupt_cb), engine);
+ g_signal_connect (engine->priv->backend, "allow-cancel",
+ G_CALLBACK (pk_engine_allow_cancel_cb), engine);
g_signal_connect (engine->priv->backend, "change-transaction-data",
G_CALLBACK (pk_engine_change_transaction_data_cb), engine);
g_signal_connect (engine->priv->backend, "repo-detail",
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 484b23c..17dac6c 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -151,9 +151,9 @@
<arg type="s" name="status" direction="out"/> <!-- success,failed,canceled -->
<arg type="u" name="runtime" direction="out"/> <!-- amount of time transaction has been running in ms -->
</signal>
- <signal name="AllowInterrupt">
+ <signal name="AllowCancel">
<arg type="s" name="tid" direction="out"/>
- <arg type="b" name="allow_kill" direction="out"/> <!-- if the transaction can be SIGKILL'd -->
+ <arg type="b" name="allow_cancel" direction="out"/> <!-- if the transaction can be SIGKILL'd -->
</signal>
<signal name="ErrorCode">
<arg type="s" name="tid" direction="out"/>
diff --git a/src/pk-runner.c b/src/pk-runner.c
index 10114da..2e32a01 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -214,7 +214,7 @@ pk_runner_cancel (PkRunner *runner, gchar **error_text)
}
/* check if it's safe to kill */
- killable = pk_backend_get_interruptable (runner->priv->backend);
+ killable = pk_backend_get_allow_cancel (runner->priv->backend);
if (killable == FALSE) {
*error_text = g_strdup ("Tried to kill a process that is not safe to kill");
return FALSE;
commit 3c3655915a18591ec8f2f388bbc98412792ddee0
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 24 22:41:48 2008 +0000
add client methods to monitor the allow interrupt signal
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index b53eaf5..6fa971c 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -100,6 +100,17 @@ pk_monitor_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
}
/**
+ * pk_monitor_allow_interrupt_cb:
+ **/
+static void
+pk_monitor_allow_interrupt_cb (PkClient *client, gboolean allow_kill, gpointer data)
+{
+ gchar *tid = pk_client_get_tid (client);
+ g_print ("%s\tAllow Interrupt: %i\n", tid, allow_kill);
+ g_free (tid);
+}
+
+/**
* pk_monitor_finished_cb:
**/
static void
@@ -184,6 +195,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_monitor_status_changed_cb), NULL);
g_signal_connect (client, "package",
G_CALLBACK (pk_monitor_package_cb), NULL);
+ g_signal_connect (client, "allow-interrupt",
+ G_CALLBACK (pk_monitor_allow_interrupt_cb), NULL);
tlist = pk_task_list_new ();
g_signal_connect (tlist, "task-list-changed",
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 33fc645..5d80b54 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -67,6 +67,7 @@ struct PkClientPrivate
gboolean is_finished;
gboolean use_buffer;
gboolean promiscuous;
+ gboolean allow_kill;
gchar *tid;
PkPackageList *package_list;
PkConnection *pconnection;
@@ -99,6 +100,7 @@ typedef enum {
PK_CLIENT_REPO_SIGNATURE_REQUIRED,
PK_CLIENT_CALLER_ACTIVE_CHANGED,
PK_CLIENT_REPO_DETAIL,
+ PK_CLIENT_ALLOW_INTERRUPT,
PK_CLIENT_LOCKED,
PK_CLIENT_LAST_SIGNAL
} PkSignals;
@@ -676,6 +678,40 @@ pk_client_locked_cb (DBusGProxy *proxy, gboolean is_locked, PkClient *client)
}
/**
+ * pk_client_allow_interrupt_cb:
+ */
+static void
+pk_client_allow_interrupt_cb (DBusGProxy *proxy, const gchar *tid,
+ gboolean allow_kill, PkClient *client)
+{
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (PK_IS_CLIENT (client));
+
+ /* not us, ignore */
+ if (pk_client_should_proxy (client, tid) == FALSE) {
+ return;
+ }
+
+ /* cache */
+ client->priv->allow_kill = allow_kill;
+
+ pk_debug ("emit allow-interrupt %i", allow_kill);
+ g_signal_emit (client , signals [PK_CLIENT_ALLOW_INTERRUPT], 0, allow_kill);
+}
+
+/**
+ * pk_client_get_allow_interrupt:
+ */
+gboolean
+pk_client_get_allow_interrupt (PkClient *client)
+{
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+
+ return client->priv->allow_kill;
+}
+
+/**
* pk_client_caller_active_changed_cb:
*/
static void
@@ -2535,6 +2571,11 @@ pk_client_class_init (PkClientClass *klass)
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, pk_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ signals [PK_CLIENT_ALLOW_INTERRUPT] =
+ g_signal_new ("allow-interrupt",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals [PK_CLIENT_LOCKED] =
g_signal_new ("locked",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -2587,6 +2628,7 @@ pk_client_init (PkClient *client)
client->priv->tid = NULL;
client->priv->use_buffer = FALSE;
client->priv->promiscuous = FALSE;
+ client->priv->allow_kill = FALSE;
client->priv->last_status = PK_STATUS_ENUM_UNKNOWN;
client->priv->require_restart = PK_RESTART_ENUM_NONE;
client->priv->role = PK_ROLE_ENUM_UNKNOWN;
@@ -2630,6 +2672,10 @@ pk_client_init (PkClient *client)
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT,
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
+ /* AllowInterrupt */
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_BOOLEAN,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+
/* Locked */
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
@@ -2637,6 +2683,7 @@ pk_client_init (PkClient *client)
/* StatusChanged */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+
/* Finished */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_UINT,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
@@ -2765,6 +2812,10 @@ pk_client_init (PkClient *client)
dbus_g_proxy_connect_signal (proxy, "CallerActiveChanged",
G_CALLBACK (pk_client_caller_active_changed_cb), client, NULL);
+ dbus_g_proxy_add_signal (proxy, "AllowInterrupt", G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (proxy, "AllowInterrupt",
+ G_CALLBACK (pk_client_allow_interrupt_cb), client, NULL);
+
dbus_g_proxy_add_signal (proxy, "Locked", G_TYPE_BOOLEAN, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "Locked",
G_CALLBACK (pk_client_locked_cb), client, NULL);
@@ -2817,6 +2868,8 @@ pk_client_finalize (GObject *object)
G_CALLBACK (pk_client_message_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "CallerActiveChanged",
G_CALLBACK (pk_client_caller_active_changed_cb), client);
+ dbus_g_proxy_disconnect_signal (client->priv->proxy, "AllowInterrupt",
+ G_CALLBACK (pk_client_allow_interrupt_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Locked",
G_CALLBACK (pk_client_locked_cb), client);
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 501dab9..5a39f4d 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -68,6 +68,7 @@ gchar *pk_client_get_tid (PkClient *client);
gboolean pk_client_set_use_buffer (PkClient *client,
gboolean use_buffer);
gboolean pk_client_get_use_buffer (PkClient *client);
+gboolean pk_client_get_allow_interrupt (PkClient *client);
/* general methods */
gboolean pk_client_get_status (PkClient *client,
commit 8dc874ed2d0d67d0c07a5fc32eb3340699e3ddb4
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 24 22:40:32 2008 +0000
make the dummy backend allow interruption
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 5b2c2bc..90d32e4 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -443,6 +443,7 @@ backend_update_system_timeout (gpointer data)
}
if (progress_percentage == 40) {
pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
+ pk_backend_set_interruptable (backend, FALSE);
pk_backend_package (backend, PK_INFO_ENUM_INSTALLING,
"update1;2.19.1-4.fc8;i386;fedora",
"The first update");
@@ -470,6 +471,7 @@ backend_update_system (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_DOWNLOAD);
+ pk_backend_set_interruptable (backend, TRUE);
progress_percentage = 0;
pk_backend_require_restart (backend, PK_RESTART_ENUM_SYSTEM, NULL);
g_timeout_add (1000, backend_update_system_timeout, backend);
commit 7912a670f903195da2f8bef3e36ffae257f564f7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 24 21:21:15 2008 +0000
add the package signal to pkmon for debugging
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index 0f51a5c..b53eaf5 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -88,6 +88,18 @@ pk_monitor_status_changed_cb (PkClient *client, PkStatusEnum status, gpointer da
}
/**
+ * pk_monitor_package_cb:
+ **/
+static void
+pk_monitor_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id,
+ const gchar *summary, gpointer data)
+{
+ gchar *tid = pk_client_get_tid (client);
+ g_print ("%s\tPackage: %s\t%s\t%s\n", tid, pk_info_enum_to_text (info), package_id, summary);
+ g_free (tid);
+}
+
+/**
* pk_monitor_finished_cb:
**/
static void
@@ -170,6 +182,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_monitor_require_restart_cb), NULL);
g_signal_connect (client, "status-changed",
G_CALLBACK (pk_monitor_status_changed_cb), NULL);
+ g_signal_connect (client, "package",
+ G_CALLBACK (pk_monitor_package_cb), NULL);
tlist = pk_task_list_new ();
g_signal_connect (tlist, "task-list-changed",
More information about the PackageKit
mailing list